mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:17:28 +00:00
UI: Create/remove an "inst.tmp" by Service early
This commit is contained in:
parent
df7757c2ea
commit
df812cb097
@ -267,6 +267,8 @@ void FortManager::install(const char *arg)
|
|||||||
case 's': { // "service"
|
case 's': { // "service"
|
||||||
StartupUtil::setAutoRunMode(StartupUtil::StartupAllUsers);
|
StartupUtil::setAutoRunMode(StartupUtil::StartupAllUsers);
|
||||||
StartupUtil::setServiceInstalled(true);
|
StartupUtil::setServiceInstalled(true);
|
||||||
|
|
||||||
|
OsUtil::endRestartClients();
|
||||||
} break;
|
} break;
|
||||||
case 'e': { // "explorer"
|
case 'e': { // "explorer"
|
||||||
StartupUtil::setExplorerIntegrated(true);
|
StartupUtil::setExplorerIntegrated(true);
|
||||||
|
@ -83,7 +83,7 @@ void AutoUpdateManager::setupRestart()
|
|||||||
{
|
{
|
||||||
if (IoC<FortSettings>()->isService()) {
|
if (IoC<FortSettings>()->isService()) {
|
||||||
connect(IoC<ServiceManager>(), &ServiceManager::stopRestartingRequested, this,
|
connect(IoC<ServiceManager>(), &ServiceManager::stopRestartingRequested, this,
|
||||||
&AutoUpdateManager::restartClients);
|
&AutoUpdateManager::onRestartClientsRequested);
|
||||||
} else {
|
} else {
|
||||||
if (!OsUtil::registerAppRestart()) {
|
if (!OsUtil::registerAppRestart()) {
|
||||||
qCWarning(LC) << "Restart registration error";
|
qCWarning(LC) << "Restart registration error";
|
||||||
@ -146,6 +146,15 @@ void AutoUpdateManager::setupByTaskInfo(TaskInfoUpdateChecker *taskInfo)
|
|||||||
setIsDownloaded(downloaded);
|
setIsDownloaded(downloaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoUpdateManager::onRestartClientsRequested(bool restarting)
|
||||||
|
{
|
||||||
|
if (restarting) {
|
||||||
|
OsUtil::beginRestartClients();
|
||||||
|
}
|
||||||
|
|
||||||
|
emit restartClients(restarting);
|
||||||
|
}
|
||||||
|
|
||||||
void AutoUpdateManager::clearUpdateDir()
|
void AutoUpdateManager::clearUpdateDir()
|
||||||
{
|
{
|
||||||
if (isDownloaded())
|
if (isDownloaded())
|
||||||
|
@ -74,6 +74,8 @@ protected slots:
|
|||||||
private:
|
private:
|
||||||
void setupByTaskInfo(TaskInfoUpdateChecker *taskInfo);
|
void setupByTaskInfo(TaskInfoUpdateChecker *taskInfo);
|
||||||
|
|
||||||
|
void onRestartClientsRequested(bool restarting);
|
||||||
|
|
||||||
void clearUpdateDir();
|
void clearUpdateDir();
|
||||||
|
|
||||||
bool saveInstaller(const QByteArray &fileData);
|
bool saveInstaller(const QByteArray &fileData);
|
||||||
|
@ -180,6 +180,16 @@ bool OsUtil::registerAppRestart()
|
|||||||
RegisterApplicationRestart(L"--restarted", RESTART_NO_CRASH | RESTART_NO_REBOOT));
|
RegisterApplicationRestart(L"--restarted", RESTART_NO_CRASH | RESTART_NO_REBOOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OsUtil::beginRestartClients()
|
||||||
|
{
|
||||||
|
FileUtil::writeFileData(FileUtil::appBinLocation() + "/inst.tmp", {});
|
||||||
|
}
|
||||||
|
|
||||||
|
void OsUtil::endRestartClients()
|
||||||
|
{
|
||||||
|
FileUtil::removeFile(FileUtil::appBinLocation() + "/inst.tmp");
|
||||||
|
}
|
||||||
|
|
||||||
void OsUtil::restartClient()
|
void OsUtil::restartClient()
|
||||||
{
|
{
|
||||||
const QFileInfo fi(QCoreApplication::applicationFilePath());
|
const QFileInfo fi(QCoreApplication::applicationFilePath());
|
||||||
|
@ -44,7 +44,10 @@ public:
|
|||||||
|
|
||||||
static bool registerAppRestart();
|
static bool registerAppRestart();
|
||||||
|
|
||||||
|
static void beginRestartClients();
|
||||||
|
static void endRestartClients();
|
||||||
static void restartClient();
|
static void restartClient();
|
||||||
|
|
||||||
static void restart();
|
static void restart();
|
||||||
static void quit(const QString &reason);
|
static void quit(const QString &reason);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user