MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / externalMessage

Method externalMessage

src/moapplication.cpp:375–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375void MOApplication::externalMessage(const QString& message)
376{
377 log::debug("received external message '{}'", message);
378
379 MOShortcut moshortcut(message);
380
381 if (moshortcut.isValid()) {
382 if (moshortcut.hasExecutable()) {
383 try {
384 m_core->processRunner()
385 .setFromShortcut(moshortcut)
386 .setWaitForCompletion(ProcessRunner::TriggerRefresh)
387 .run();
388 } catch (std::exception&) {
389 // user was already warned
390 }
391 }
392 } else if (isNxmLink(message)) {
393 MessageDialog::showMessage(tr("Download started"), qApp->activeWindow(), false);
394 m_core->downloadRequestedNXM(message);
395 } else {
396 cl::CommandLine cl;
397
398 if (auto r = cl.process(message.toStdWString())) {
399 log::debug("while processing external message, command line wants to "
400 "exit; ignoring");
401
402 return;
403 }
404
405 if (auto i = cl.instance()) {
406 const auto ci = InstanceManager::singleton().currentInstance();
407
408 if (*i != ci->displayName()) {
409 reportError(
410 tr("This shortcut or command line is for instance '%1', but the current "
411 "instance is '%2'.")
412 .arg(*i)
413 .arg(ci->displayName()));
414
415 return;
416 }
417 }
418
419 if (auto p = cl.profile()) {
420 if (*p != m_core->profileName()) {
421 reportError(
422 tr("This shortcut or command line is for profile '%1', but the current "
423 "profile is '%2'.")
424 .arg(*p)
425 .arg(m_core->profileName()));
426
427 return;
428 }
429 }
430
431 cl.runPostOrganizer(*m_core);
432 }

Callers

nothing calls this directly

Calls 13

isNxmLinkFunction · 0.85
hasExecutableMethod · 0.80
processRunnerMethod · 0.80
instanceMethod · 0.80
runPostOrganizerMethod · 0.80
isValidMethod · 0.45
runMethod · 0.45
downloadRequestedNXMMethod · 0.45
processMethod · 0.45
currentInstanceMethod · 0.45
displayNameMethod · 0.45
profileMethod · 0.45

Tested by

no test coverage detected