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

Method NativeAppJob

plugins/execute/nativeappjob.cpp:48–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46} // unnamed namespace
47
48NativeAppJob::NativeAppJob(QObject* parent, KDevelop::ILaunchConfiguration* cfg)
49 : KDevelop::OutputExecuteJob( parent )
50 , m_name(cfg->name())
51{
52 setCapabilities(Killable);
53
54 auto* iface = KDevelop::ICore::self()->pluginController()->pluginForExtension(QStringLiteral("org.kdevelop.IExecutePlugin"), QStringLiteral("kdevexecute"))->extension<IExecutePlugin>();
55 Q_ASSERT(iface);
56
57 QString err;
58 const auto detectError = [&err, this](int errorCode) {
59 if (err.isEmpty()) {
60 return false;
61 }
62 setError(errorCode);
63 setErrorText(err);
64 return true;
65 };
66
67 const auto executable = iface->executable(cfg, err).toLocalFile();
68 if (detectError(-1)) {
69 return;
70 }
71 QStringList arguments = iface->arguments( cfg, err );
72 if (detectError(-2)) {
73 return;
74 }
75
76 QStringList terminal;
77 if (iface->useTerminal(cfg)) {
78 terminal = iface->terminal(cfg, err);
79 if (detectError(-3)) {
80 return;
81 }
82 }
83
84 const auto launchConfigurationName = m_name;
85 {
86 const auto cfgGroup = cfg->config();
87 if (cfgGroup.readEntry(ExecutePlugin::isExecutableEntry, false)) {
88 m_name = cfgGroup.readEntry(ExecutePlugin::executableEntry, launchConfigurationName)
89 .section(QLatin1Char('/'), -1);
90 }
91 if (!cfgGroup.readEntry(ExecutePlugin::configuredByCTest, false)) {
92 m_killBeforeExecutingAgain = cfgGroup.readEntry<int>(ExecutePlugin::killBeforeExecutingAgain, askIfRunning);
93 }
94 }
95
96 setEnvironmentProfile(validEnvironmentProfileName(launchConfigurationName, iface->environmentProfileName(cfg)));
97
98 setStandardToolView(KDevelop::IOutputView::RunView);
99 setBehaviours(KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll);
100 setFilteringStrategy(OutputModel::NativeAppErrorFilter);
101 setProperties(DisplayStdout | DisplayStderr);
102
103 // Now setup the process parameters
104
105 QUrl wc = iface->workingDirectory( cfg );

Callers

nothing calls this directly

Calls 15

pluginControllerMethod · 0.80
toLocalFileMethod · 0.80
readEntryMethod · 0.80
sectionMethod · 0.80
emptyMethod · 0.80
nameMethod · 0.45
pluginForExtensionMethod · 0.45
isEmptyMethod · 0.45
executableMethod · 0.45
argumentsMethod · 0.45
useTerminalMethod · 0.45

Tested by

no test coverage detected