changeset 195:ff0d76dcb3b8

* Don't close proc input on finished() -- causes crash on program failure on Windows * Use merge binary from settings, even if empty -- sometimes user may wish to set an empty string to avoid having an external merge program * Revert labels to line edits in settings dialog, for a similar reason (permit setting empty value) * Avoid showing hard hyphens on Windows, they don't look right * Use preformatted text for merge outcome dialog (but format3 would be better)
author Chris Cannam
date Fri, 24 Dec 2010 13:14:45 +0000
parents 5ca49523892f
children dbc8d97caaf4
files hgrunner.cpp mainwindow.cpp settingsdialog.cpp settingsdialog.h
diffstat 4 files changed, 31 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/hgrunner.cpp	Mon Dec 20 22:39:45 2010 +0000
+++ b/hgrunner.cpp	Fri Dec 24 13:14:45 2010 +0000
@@ -348,7 +348,7 @@
     m_isRunning = false;
     m_currentAction = HgAction();
 
-    closeProcInput();
+    //closeProcInput();
     m_proc->deleteLater();
     m_proc = 0;
 
--- a/mainwindow.cpp	Mon Dec 20 22:39:45 2010 +0000
+++ b/mainwindow.cpp	Fri Dec 24 13:14:45 2010 +0000
@@ -441,23 +441,25 @@
 {
     QSettings settings;
     settings.beginGroup("Locations");
-    QString merge = settings.value("mergebinary", "").toString();
-    if (merge == "") {
-        QStringList bases;
-        bases << "fmdiff3" << "meld" << "diffuse" << "kdiff3";
-        bool found = false;
-        foreach (QString base, bases) {
-            merge = findInPath(base, m_myDirPath, true);
-            if (merge != base) {
-                found = true;
-                break;
-            }
+    QVariant v = settings.value("mergebinary");
+    if (v != QVariant()) {
+        return v.toString(); // even if empty: user may have specified no external tool
+    }
+    QString merge;
+    QStringList bases;
+    bases << "fmdiff3" << "meld" << "diffuse" << "kdiff3";
+    bool found = false;
+    foreach (QString base, bases) {
+        merge = findInPath(base, m_myDirPath, true);
+        if (merge != base && merge != base + ".exe") {
+            found = true;
+            break;
         }
-        if (found) {
-            settings.setValue("mergebinary", merge);
-        } else {
-            merge = "";
-        }
+    }
+    if (found) {
+        settings.setValue("mergebinary", merge);
+    } else {
+        merge = "";
     }
     return merge;
 }
--- a/settingsdialog.cpp	Mon Dec 20 22:39:45 2010 +0000
+++ b/settingsdialog.cpp	Fri Dec 24 13:14:45 2010 +0000
@@ -71,7 +71,7 @@
 
     pathsLayout->addWidget(new QLabel(tr("Mercurial (hg) program:")), row, 0);
 
-    m_hgPathLabel = new QLabel();
+    m_hgPathLabel = new QLineEdit();
     m_hgPathLabel->setText(settings.value("hgbinary").toString());
     pathsLayout->addWidget(m_hgPathLabel, row, 2);
 
@@ -81,7 +81,7 @@
 
     pathsLayout->addWidget(new QLabel(tr("External diff program:")), row, 0);
 
-    m_diffPathLabel = new QLabel();
+    m_diffPathLabel = new QLineEdit();
     m_diffPathLabel->setText(settings.value("extdiffbinary").toString());
     pathsLayout->addWidget(m_diffPathLabel, row, 2);
 
@@ -91,7 +91,7 @@
     
     pathsLayout->addWidget(new QLabel(tr("External file-merge program:")), row, 0);
 
-    m_mergePathLabel = new QLabel();
+    m_mergePathLabel = new QLineEdit();
     m_mergePathLabel->setText(settings.value("mergebinary").toString());
     pathsLayout->addWidget(m_mergePathLabel, row, 2);
 
@@ -101,7 +101,7 @@
 
     pathsLayout->addWidget(new QLabel(tr("External text editor:")), row, 0);
 
-    m_editPathLabel = new QLabel();
+    m_editPathLabel = new QLineEdit();
     m_editPathLabel->setText(settings.value("editorbinary").toString());
     pathsLayout->addWidget(m_editPathLabel, row, 2);
 
@@ -115,7 +115,7 @@
 
     pathsLayout->addWidget(new QLabel(tr("EasyHg Mercurial extension:")), row, 0);
 
-    m_extensionPathLabel = new QLabel();
+    m_extensionPathLabel = new QLineEdit();
     m_extensionPathLabel->setText(settings.value("extensionpath").toString());
     pathsLayout->addWidget(m_extensionPathLabel, row, 2);
 
@@ -172,7 +172,7 @@
 }
 
 void
-SettingsDialog::browseFor(QString title, QLabel *edit)
+SettingsDialog::browseFor(QString title, QLineEdit *edit)
 {
     QString origin = edit->text();
 
--- a/settingsdialog.h	Mon Dec 20 22:39:45 2010 +0000
+++ b/settingsdialog.h	Fri Dec 24 13:14:45 2010 +0000
@@ -43,17 +43,17 @@
 private:
     QLineEdit *m_nameEdit;
     QLineEdit *m_emailEdit;
-    QLabel *m_hgPathLabel;
-    QLabel *m_diffPathLabel;
-    QLabel *m_mergePathLabel;
-    QLabel *m_editPathLabel;
+    QLineEdit *m_hgPathLabel;
+    QLineEdit *m_diffPathLabel;
+    QLineEdit *m_mergePathLabel;
+    QLineEdit *m_editPathLabel;
 
     QCheckBox *m_useExtension;
-    QLabel *m_extensionPathLabel;
+    QLineEdit *m_extensionPathLabel;
 
     QPushButton *m_ok;
 
-    void browseFor(QString, QLabel *);
+    void browseFor(QString, QLineEdit *);
 };
 
 #endif