changeset 240:53ad43d5a463

* Small tidy
author Chris Cannam
date Mon, 10 Jan 2011 15:23:53 +0000
parents 661f5808aa0a
children 4e98950f72e8
files hgrunner.cpp settingsdialog.cpp settingsdialog.h
diffstat 3 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgrunner.cpp	Mon Jan 10 15:18:21 2011 +0000
+++ b/hgrunner.cpp	Mon Jan 10 15:23:53 2011 +0000
@@ -18,6 +18,7 @@
 #include "hgrunner.h"
 #include "common.h"
 #include "debug.h"
+#include "settingsdialog.h"
 
 #include <QPushButton>
 #include <QListWidget>
@@ -71,10 +72,7 @@
 
 QString HgRunner::getUnbundledFileName()
 {
-    QString home = QDir::homePath();
-    QString target = QString("%1/.easyhg").arg(home);
-    QString extpath = QString("%1/easyhg.py").arg(target);
-    return extpath;
+    return SettingsDialog::getUnbundledExtensionFileName();
 }
 
 QString HgRunner::unbundleExtension()
--- a/settingsdialog.cpp	Mon Jan 10 15:18:21 2011 +0000
+++ b/settingsdialog.cpp	Mon Jan 10 15:23:53 2011 +0000
@@ -225,6 +225,15 @@
     }
 }
 
+QString
+SettingsDialog::getUnbundledExtensionFileName()
+{
+    QString home = QDir::homePath();
+    QString target = QString("%1/.easyhg").arg(home);
+    QString extpath = QString("%1/easyhg.py").arg(target);
+    return extpath;
+}
+
 void
 SettingsDialog::findExtension()
 {
@@ -234,11 +243,7 @@
     QString extpath = settings.value("extensionpath", "").toString();
     if (extpath != "" || !QFile(extpath).exists()) {
 
-        //!!! bad: this is a dupe with hgrunner
-
-        QString home = QDir::homePath();
-        QString target = QString("%1/.easyhg").arg(home);
-        extpath = QString("%1/easyhg.py").arg(target);
+        extpath = getUnbundledExtensionFileName();
 
         if (!QFile(extpath).exists()) {
             extpath = findInPath("easyhg.py", m_installPath, false);
--- a/settingsdialog.h	Mon Jan 10 15:18:21 2011 +0000
+++ b/settingsdialog.h	Mon Jan 10 15:23:53 2011 +0000
@@ -36,6 +36,7 @@
     }
 
     static void findDefaultLocations(QString installPath = m_installPath);
+    static QString getUnbundledExtensionFileName();
     
 private slots:
     void hgPathBrowse();