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

Method launcherForMode

kdevplatform/shell/launchconfiguration.cpp:133–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133QString LaunchConfiguration::launcherForMode(const QString& mode) const
134{
135 Q_D(const LaunchConfiguration);
136
137 QStringList modes = d->baseGroup.readEntry("Configured Launch Modes", QStringList());
138 int idx = modes.indexOf( mode );
139 if( idx != -1 )
140 {
141 const QStringList launcherIds = d->baseGroup.readEntry("Configured Launchers", QStringList());
142 if (launcherIds.count() > idx ) {
143 const auto& id = launcherIds.at(idx);
144 const auto typeLaunchers = type()->launchers();
145 for (ILauncher* l : typeLaunchers) {
146 if (l->id() == id) {
147 return id;
148 }
149 }
150 }
151 }
152
153 // No launcher configured, if it's debug mode, prefer GDB if available.
154 if( mode == QLatin1String("debug") )
155 {
156 const auto launchers = type()->launchers();
157 for (ILauncher* l : launchers) {
158 if( l->supportedModes().contains( mode ) && l->id() == QLatin1String("gdb") )
159 {
160 return l->id();
161 }
162 }
163 }
164 // Otherwise, lets just try with the first one in the list and hope it works
165 const auto launchers = type()->launchers();
166 for (ILauncher* l : launchers) {
167 if( l->supportedModes().contains( mode ) )
168 {
169 return l->id();
170 }
171 }
172
173 return QString();
174}
175
176void LaunchConfiguration::setLauncherForMode(const QString& mode, const QString& id)
177{

Callers 3

dataMethod · 0.80
executeMethod · 0.80
mainFunction · 0.80

Calls 11

QStringListClass · 0.85
readEntryMethod · 0.80
launchersMethod · 0.80
QStringClass · 0.70
typeFunction · 0.50
indexOfMethod · 0.45
countMethod · 0.45
atMethod · 0.45
idMethod · 0.45
containsMethod · 0.45
supportedModesMethod · 0.45

Tested by

no test coverage detected