Browse Source

HelperLauncher: add hidden setting to avoid starting helper

Quite a relief on Windows, where rebuilding will frequently fail due to
the helper still running.
Vincent Lang 8 years ago
parent
commit
0646d048ed

+ 5 - 0
resources/settings/settings_description.json

@@ -136,6 +136,11 @@
         "value": "preventSystemScreensaver",
         "default": false,
         "hidden": true
+      },
+      {
+        "value": "useHelper",
+        "default": true,
+        "hidden": true
       }
     ]
   },

+ 18 - 0
src/utils/HelperLauncher.cpp

@@ -42,6 +42,9 @@ void HelperLauncher::start()
 /////////////////////////////////////////////////////////////////////////////////////////
 bool HelperLauncher::connectToHelper()
 {
+  if (!helperEnabled())
+    return true;
+
   if (m_jsonClient->state() == QLocalSocket::ConnectedState ||
       m_jsonClient->state() == QLocalSocket::ConnectingState)
     return true;
@@ -55,6 +58,9 @@ bool HelperLauncher::connectToHelper()
 /////////////////////////////////////////////////////////////////////////////////////////
 bool HelperLauncher::killHelper()
 {
+  if (!helperEnabled())
+    return true;
+
   QVariantMap msg;
   msg.insert("command", "quit");
   m_jsonClient->sendMessage(msg);
@@ -108,6 +114,9 @@ void HelperLauncher::socketDisconnect()
 /////////////////////////////////////////////////////////////////////////////////////////
 void HelperLauncher::updateClientId()
 {
+  if (!helperEnabled())
+    return;
+
   // update clientId if we have it
   if (!SettingsComponent::Get().value(SETTINGS_SECTION_WEBCLIENT, "clientID").toString().isEmpty())
   {
@@ -127,6 +136,12 @@ void HelperLauncher::updateClientId()
   }
 };
 
+/////////////////////////////////////////////////////////////////////////////////////////
+bool HelperLauncher::helperEnabled()
+{
+  return SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "useHelper").toBool();
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////
 void HelperLauncher::didConnect()
 {
@@ -137,6 +152,9 @@ void HelperLauncher::didConnect()
 /////////////////////////////////////////////////////////////////////////////////////////
 void HelperLauncher::launch()
 {
+  if (!helperEnabled())
+    return;
+
   QLOG_DEBUG() << "Launching helper:" << HelperPath();
 
 #ifdef Q_OS_MAC

+ 1 - 0
src/utils/HelperLauncher.h

@@ -44,6 +44,7 @@ private:
   LocalJsonClient* m_jsonClient;
 
   void updateClientId();
+  bool helperEnabled();
 
 #ifdef Q_OS_MAC
   HelperLaunchd* m_launchd;