MCPcopy Create free account
hub / github.com/KDE/kdevelop / generatePrettyContents

Method generatePrettyContents

kdevplatform/shell/session.cpp:136–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136QString SessionPrivate::generatePrettyContents( const SessionInfo& info )
137{
138 if( info.projects.isEmpty() )
139 return i18n("(no projects)");
140
141 QStringList projectNames;
142 projectNames.reserve( info.projects.size() );
143
144 for (const QUrl& url : info.projects) {
145 IProject* project = nullptr;
146 if( ICore::self() && ICore::self()->projectController() ) {
147 project = ICore::self()->projectController()->findProjectForUrl( url );
148 }
149
150 if( project ) {
151 projectNames << project->name();
152 } else {
153 QString projectName = url.fileName();
154 static const QRegularExpression projectFileExtensionRegex(QStringLiteral("\\.kdev4$"),
155 QRegularExpression::CaseInsensitiveOption);
156 projectName.remove(projectFileExtensionRegex);
157 projectNames << projectName;
158 }
159 }
160
161 if( projectNames.isEmpty() ) {
162 return i18n("(no projects)");
163 } else {
164 return projectNames.join(QLatin1String(", "));
165 }
166}
167
168QString SessionPrivate::generateDescription( const SessionInfo& info )
169{

Callers

nothing calls this directly

Calls 9

projectControllerMethod · 0.80
findProjectForUrlMethod · 0.80
joinMethod · 0.80
isEmptyMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
nameMethod · 0.45
fileNameMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected