[krita] /: FEATURE: Add an option to allow multiple instances of Krita

Boudewijn Rempt null at kde.org
Thu Mar 16 09:44:45 UTC 2017


Git commit 2ef180dde22df906cf729be776141571b471ddef by Boudewijn Rempt.
Committed on 16/03/2017 at 09:41.
Pushed by rempt into branch 'master'.

FEATURE: Add an option to allow multiple instances of Krita

Probably most useful for developers and really busy people like
Bollebib with really big hardware. Others are probably better
of loading resources only once.

BUG:377199
CCMAIL:kimageshop at kde.org

M  +3    -2    krita/main.cc
M  +5    -0    libs/ui/dialogs/kis_dlg_preferences.cc
M  +15   -1    libs/ui/forms/wdggeneralsettings.ui

https://commits.kde.org/krita/2ef180dde22df906cf729be776141571b471ddef

diff --git a/krita/main.cc b/krita/main.cc
index 4bee467a2ac..0f3df58f801 100644
--- a/krita/main.cc
+++ b/krita/main.cc
@@ -121,10 +121,11 @@ extern "C" int main(int argc, char **argv)
 
     const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
 
-
+    bool singleApplication = true;
 #if QT_VERSION >= 0x050600
     {
         QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
+        singleApplication = kritarc.value("EnableSingleApplication").toBool();
         if (kritarc.value("EnableHiDPI", false).toBool()) {
             QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
         }
@@ -207,7 +208,7 @@ extern "C" int main(int argc, char **argv)
 
     KisApplicationArguments args(app);
 
-    if (app.isRunning()) {
+    if (singleApplication && app.isRunning()) {
         // only pass arguments to main instance if they are not for batch processing
         // any batch processing would be done in this separate instance
         const bool batchRun = (args.print() || args.exportAs() || args.exportAsPdf());
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index d30800fb492..81b758ed464 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -135,6 +135,7 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
     const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
     QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
     m_chkHiDPI->setChecked(kritarc.value("EnableHiDPI", false).toBool());
+    m_chkSingleApplication->setChecked(kritarc.value("EnableSingleApplication", true).toBool());
 
     m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker());
     m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt());
@@ -170,6 +171,9 @@ void GeneralTab::setDefault()
     m_backgroundimage->setText(cfg.getMDIBackgroundImage(true));
     m_chkCanvasMessages->setChecked(cfg.showCanvasMessages(true));
     m_chkCompressKra->setChecked(cfg.compressKra(true));
+    m_chkHiDPI->setChecked(false);
+    m_chkSingleApplication->setChecked(true);
+
     m_chkHiDPI->setChecked(true);
     m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker(true));
     m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt(true));
@@ -1024,6 +1028,7 @@ bool KisDlgPreferences::editPreferences()
         const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
         QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
         kritarc.setValue("EnableHiDPI", dialog->m_general->m_chkHiDPI->isChecked());
+        kritarc.setValue("EnableSingleApplication", dialog->m_general->m_chkSingleApplication->isChecked());
 
         cfg.setToolOptionsInDocker(dialog->m_general->toolOptionsInDocker());
         cfg.setSwitchSelectionCtrlAlt(dialog->m_general->switchSelectionCtrlAlt());
diff --git a/libs/ui/forms/wdggeneralsettings.ui b/libs/ui/forms/wdggeneralsettings.ui
index f475a196b31..9a321828295 100644
--- a/libs/ui/forms/wdggeneralsettings.ui
+++ b/libs/ui/forms/wdggeneralsettings.ui
@@ -294,7 +294,7 @@
          </property>
         </widget>
        </item>
-       <item row="6" column="0" colspan="2">
+       <item row="7" column="0" colspan="2">
         <spacer name="verticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
@@ -321,6 +321,20 @@
          </property>
         </widget>
        </item>
+       <item row="6" column="1">
+        <widget class="QCheckBox" name="m_chkSingleApplication">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="0">
+        <widget class="QLabel" name="label_r98">
+         <property name="text">
+          <string>Allow only one instance of Krita:</string>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="Tools">


More information about the kimageshop mailing list