changeset 633:db62a0cb3037

* Added setting to specify that diff command should be run once for each selected file, rather than passing all file names to diff command (p4merge doesn't like being given many files)
author Sam Izzo <sam@humbug.net>
date Mon, 27 Aug 2012 01:26:57 +1000
parents f9fd48e55af1
children 58ac1b197666
files src/mainwindow.cpp src/settingsdialog.cpp src/settingsdialog.h
diffstat 3 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Mon Aug 27 01:26:05 2012 +1000
+++ b/src/mainwindow.cpp	Mon Aug 27 01:26:57 2012 +1000
@@ -915,11 +915,20 @@
     // Diff parent against working folder (folder diff)
 
     params << "--config" << "extensions.extdiff=" << "extdiff";
-    params << "--program" << diff;
-
-    params << "--" << files; // may be none: whole dir
-
-    m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, params));
+    params << "--program" << diff << "--";
+
+    QSettings settings;
+    if (settings.value("multipleDiffInstances", false).toBool()) {
+        foreach (QString file, files) {
+            QStringList p = params;
+            p << file;
+            m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, p));
+        }
+    }
+    else {
+        params << files; // may be none: whole dir
+        m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, params));
+    }
 }
 
 void MainWindow::hgDiffToCurrent(QString id)
--- a/src/settingsdialog.cpp	Mon Aug 27 01:26:05 2012 +1000
+++ b/src/settingsdialog.cpp	Mon Aug 27 01:26:57 2012 +1000
@@ -138,7 +138,10 @@
     browse = new QPushButton(tr("Browse..."));
     pathsLayout->addWidget(browse, row++, 1);
     connect(browse, SIGNAL(clicked()), this, SLOT(diffPathBrowse()));
-    
+
+    m_multipleDiffInstances = new QCheckBox(tr("Multiple instances when multiple files are selected"));
+    pathsLayout->addWidget(m_multipleDiffInstances, row++, 2);
+
     pathsLayout->addWidget(new QLabel(tr("External file-merge program:")), row, 0);
 
     m_mergePathLabel = new QLineEdit();
@@ -170,6 +173,7 @@
     connect(m_extensionBrowse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse()));
 
     pathsLayout->setRowStretch(row, 20);
+    pathsLayout->setColumnStretch(2, 20);
 
 
     reset(); // loads current defaults from settings
@@ -424,6 +428,7 @@
     settings.endGroup();
     settings.beginGroup("");
     settings.remove("useextension");
+    settings.remove("multipleDiffInstances");
     settings.endGroup();
 }
 
@@ -455,6 +460,7 @@
     settings.beginGroup("");
     m_useExtension->setChecked(settings.value("useextension", true).toBool());
     useExtension(m_useExtension->isChecked());
+    m_multipleDiffInstances->setChecked(settings.value("multipleDiffInstances", false).toBool());
     settings.endGroup();
 }
 
@@ -507,6 +513,7 @@
     settings.endGroup();
     settings.beginGroup("");
     settings.setValue("useextension", m_useExtension->isChecked());
+    settings.setValue("multipleDiffInstances", m_multipleDiffInstances->isChecked());
     settings.endGroup();
     QDialog::accept();
 }
--- a/src/settingsdialog.h	Mon Aug 27 01:26:05 2012 +1000
+++ b/src/settingsdialog.h	Mon Aug 27 01:26:57 2012 +1000
@@ -85,6 +85,8 @@
     QComboBox *m_workHistoryArrangement;
 #endif
 
+    QCheckBox *m_multipleDiffInstances;
+
     QPushButton *m_extensionBrowse;
     QPushButton *m_ok;