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

Method launchAs

kdevplatform/shell/runcontroller.cpp:166–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 }
165
166 void launchAs( int id )
167 {
168 //qCDebug(SHELL) << "Launching id:" << id;
169 QPair<QString,QString> info = launchAsInfo[id];
170 //qCDebug(SHELL) << "fetching type and mode:" << info.first << info.second;
171 LaunchConfigurationType* type = launchConfigurationTypeForId( info.first );
172 ILaunchMode* mode = q->launchModeForId( info.second );
173
174 //qCDebug(SHELL) << "got mode and type:" << type << type->id() << mode << mode->id();
175 if( type && mode )
176 {
177 const auto launchers = type->launchers();
178 auto it = std::find_if(launchers.begin(), launchers.end(), [&](ILauncher* l) {
179 //qCDebug(SHELL) << "available launcher" << l << l->id() << l->supportedModes();
180 return (l->supportedModes().contains(mode->id()));
181 });
182 if (it != launchers.end()) {
183 ILauncher* launcher = *it;
184
185 QStringList itemPath = Core::self()->projectController()->projectModel()->pathFromIndex(contextItem->index());
186 auto it = std::find_if(launchConfigurations.constBegin(), launchConfigurations.constEnd(),
187 [&] (LaunchConfiguration* l) {
188 QStringList path = l->config().readEntry(Strings::ConfiguredFromProjectItemEntry(), QStringList());
189 if (l->type() == type && path == itemPath) {
190 qCDebug(SHELL) << "already generated ilaunch" << path;
191 return true;
192 }
193 return false;
194 });
195 ILaunchConfiguration* ilaunch = (it != launchConfigurations.constEnd()) ? *it : nullptr;
196
197 if (!ilaunch) {
198 ilaunch = q->createLaunchConfiguration( type,
199 qMakePair( mode->id(), launcher->id() ),
200 contextItem->project(),
201 contextItem->text() );
202 auto* launch = static_cast<LaunchConfiguration*>(ilaunch);
203 type->configureLaunchFromItem( launch->config(), contextItem );
204 launch->config().writeEntry(Strings::ConfiguredFromProjectItemEntry(), itemPath);
205 //qCDebug(SHELL) << "created config, launching";
206 } else {
207 //qCDebug(SHELL) << "reusing generated config, launching";
208 }
209 q->setDefaultLaunch(ilaunch);
210 q->execute( mode->id(), ilaunch );
211 }
212 }
213 }
214
215 void updateCurrentLaunchAction()
216 {

Callers 1

contextMenuExtensionMethod · 0.80

Calls 15

QStringListClass · 0.85
launchModeForIdMethod · 0.80
launchersMethod · 0.80
projectControllerMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
readEntryMethod · 0.80
writeEntryMethod · 0.80
setDefaultLaunchMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected