Skip to content

Commit d79b45d

Browse files
committed
Improve wizard launch / device access issues
1 parent 3a00f7b commit d79b45d

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Software/src/LightpackApplication.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,13 @@ void LightpackApplication::processCommandLineArguments()
413413
DEBUG_LOW_LEVEL << "Application running no_GUI mode";
414414
}
415415
else if (parser.isSet(optionWizard)) {
416-
Sleep(500); // Give calling instance a chance to release device
416+
if (isRunning()) {
417+
DEBUG_LOW_LEVEL << "Application still running, telling it to quit";
418+
sendMessage("quitForWizard");
419+
while (isRunning()) {
420+
Sleep(200);
421+
}
422+
}
417423
bool isInitFromSettings = Settings::Initialize(m_applicationDirPath, false);
418424
runWizardLoop(isInitFromSettings);
419425
}

Software/src/SettingsWindow.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,15 +845,18 @@ void SettingsWindow::processMessage(const QString &message)
845845
{
846846
DEBUG_LOW_LEVEL << Q_FUNC_INFO << message;
847847

848-
if ("on" == message)
848+
if (message == "on")
849849
setBacklightStatus(Backlight::StatusOn);
850-
else if ("off" == message)
850+
else if (message == "off")
851851
setBacklightStatus(Backlight::StatusOff);
852852
else if (message.startsWith("set-profile ")) {
853853
QString profile = message.mid(12);
854854
profileSwitch(profile);
855-
}
856-
else if (m_trayIcon != NULL) {
855+
} else if (message == "quitForWizard") {
856+
qWarning() << "Wizard was started, quitting!";
857+
LightpackApplication::quit();
858+
} else if (m_trayIcon != NULL) {
859+
qWarning(qPrintable(message));
857860
m_trayIcon->showMessage(SysTrayIcon::MessageAnotherInstance);
858861
}
859862
}

0 commit comments

Comments
 (0)