Avoid misleading note in autostart wizard page

When the launcher has already been setup and the wizard is opened and the
currently running Syncthing instance is selected, then the wizard said the
autostart option had no effect on Syncthing itself. However, that's not
correct when the currently running Syncthing instance has already been
started via the internal launcher. This change adds a special note for this
case which is actually correct.
This commit is contained in:
Martchus 2023-01-09 15:19:45 +01:00
parent 41f6da986d
commit c14ae7b963
2 changed files with 20 additions and 4 deletions

View File

@ -67,6 +67,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="launcherAlreadyEnabledLabel">
<property name="text">
<string>The currently running Syncthing instance is started via Syncthing Tray so Syncthing itself will be started automatically on login as well.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources>

View File

@ -807,16 +807,22 @@ void AutostartWizardPage::initializePage()
return;
}
for (auto *const widget :
std::initializer_list<QWidget *>{ m_ui->launcherEnabledLabel, m_ui->systemdEnabledLabel, m_ui->launcherDisabledLabel }) {
for (auto *const widget : std::initializer_list<QWidget *>{
m_ui->launcherEnabledLabel, m_ui->systemdEnabledLabel, m_ui->launcherDisabledLabel, m_ui->launcherAlreadyEnabledLabel }) {
widget->hide();
}
switch (wizard->mainConfig()) {
case MainConfiguration::None:
case MainConfiguration::CurrentlyRunning:
m_ui->launcherDisabledLabel->show();
case MainConfiguration::CurrentlyRunning: {
auto *const launcher = Data::SyncthingLauncher::mainInstance();
if (launcher && launcher->guiUrl().port(-1) == QUrl(wizard->setupDetection().config.syncthingUrl()).port(-2)) {
m_ui->launcherAlreadyEnabledLabel->show();
} else {
m_ui->launcherDisabledLabel->show();
}
break;
}
case MainConfiguration::LauncherExternal:
case MainConfiguration::LauncherBuiltIn:
m_ui->launcherEnabledLabel->show();