mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:45:22 +00:00
UI: Refactor restart requesting
This commit is contained in:
parent
4878582b61
commit
26b67801c2
@ -425,12 +425,9 @@ void FortManager::processRestartRequired()
|
|||||||
auto settings = IoC<FortSettings>();
|
auto settings = IoC<FortSettings>();
|
||||||
|
|
||||||
if (settings->isService()) {
|
if (settings->isService()) {
|
||||||
IoC<ServiceManager>()->restart();
|
IoC<ServiceManager>()->processRestartRequired();
|
||||||
} else {
|
} else {
|
||||||
auto windowManager = IoC<WindowManager>();
|
IoC<WindowManager>()->processRestartRequired();
|
||||||
|
|
||||||
windowManager->showConfirmBox(
|
|
||||||
[=] { windowManager->restart(); }, tr("Restart Now?"), tr("Restart Required"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,9 +129,11 @@ void ServiceManager::processControl(quint32 code, quint32 eventType)
|
|||||||
reportStatus(state);
|
reportStatus(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceManager::restart()
|
void ServiceManager::processRestartRequired()
|
||||||
{
|
{
|
||||||
qCDebug(LC) << "Quit due required restart";
|
qCDebug(LC) << "Quit due required restart";
|
||||||
|
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
|
|
||||||
|
reportStatus(SERVICE_STOP_PENDING);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
|
|
||||||
void processControl(quint32 code, quint32 eventType) override;
|
void processControl(quint32 code, quint32 eventType) override;
|
||||||
|
|
||||||
void restart();
|
void processRestartRequired();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void pauseRequested();
|
void pauseRequested();
|
||||||
|
@ -501,6 +501,11 @@ void WindowManager::restart()
|
|||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::processRestartRequired()
|
||||||
|
{
|
||||||
|
showConfirmBox([&] { restart(); }, tr("Restart Now?"), tr("Restart Required"));
|
||||||
|
}
|
||||||
|
|
||||||
bool WindowManager::checkWindowPassword(WindowCode code)
|
bool WindowManager::checkWindowPassword(WindowCode code)
|
||||||
{
|
{
|
||||||
return (WindowPasswordProtected & code) == 0 || checkPassword();
|
return (WindowPasswordProtected & code) == 0 || checkPassword();
|
||||||
|
@ -105,6 +105,7 @@ public slots:
|
|||||||
|
|
||||||
void quit();
|
void quit();
|
||||||
void restart();
|
void restart();
|
||||||
|
void processRestartRequired();
|
||||||
|
|
||||||
bool checkWindowPassword(WindowCode code);
|
bool checkWindowPassword(WindowCode code);
|
||||||
bool checkPassword();
|
bool checkPassword();
|
||||||
|
Loading…
Reference in New Issue
Block a user