changeset 19951:6049bdfa8d56

make notepad++ the custom default editor in windows * default-qt-settings.in: use a placeholder for the custom editor * file-editor.cc (call_custom_editor): set a default for the preference for using a custom editor * resource-manager.cc (do_reload_settings): replace the placeholders by the appropriate string depending on the platform * settings-dialog.ui: remove the hard coded string from the settings dialog
author Torsten <ttl@justmail.de>
date Sun, 08 Mar 2015 09:48:45 +0100
parents 85c5a81c6ddd
children f48e650a68b5
files libgui/default-qt-settings.in libgui/src/m-editor/file-editor.cc libgui/src/resource-manager.cc libgui/src/settings-dialog.ui
diffstat 4 files changed, 26 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/default-qt-settings.in	Sat Mar 07 17:29:06 2015 -0800
+++ b/libgui/default-qt-settings.in	Sun Mar 08 09:48:45 2015 +0100
@@ -2,9 +2,8 @@
 connectOnStartup=true
 showMessageOfTheDay=true
 showTopic=true
+customFileEditor=__default_custom_editor__
 autoIdentification=false
-useCustomFileEditor=false
-customFileEditor=emacs
 useProxyServer=false
 proxyType=
 proxyHostName=none
--- a/libgui/src/m-editor/file-editor.cc	Sat Mar 07 17:29:06 2015 -0800
+++ b/libgui/src/m-editor/file-editor.cc	Sun Mar 08 09:48:45 2015 +0100
@@ -270,7 +270,7 @@
   // Check if the user wants to use a custom file editor.
   QSettings *settings = resource_manager::get_settings ();
 
-  if (settings->value ("useCustomFileEditor").toBool ())
+  if (settings->value ("useCustomFileEditor",false).toBool ())
     {
       QString editor = settings->value ("customFileEditor").toString ();
       editor.replace ("%f", file_name);
--- a/libgui/src/resource-manager.cc	Sat Mar 07 17:29:06 2015 -0800
+++ b/libgui/src/resource-manager.cc	Sun Mar 08 09:48:45 2015 +0100
@@ -191,7 +191,7 @@
       QString settings_text = in.readAll ();
       qt_settings.close ();
 
-      // Get the default monospaced font and replace placeholder
+      // Get the default monospaced font
 #if defined (HAVE_QFONT_MONOSPACE)
       QFont fixed_font;
       fixed_font.setStyleHint (QFont::Monospace);
@@ -203,6 +203,16 @@
 #else
       QString default_family = "courier";
 #endif
+
+      // Get the default custom editor
+#if defined (Q_OS_WIN32)
+      QString custom_editor = "notepad++ -n%l %f";
+#else
+      QString custom_editor = "emacs +%l %f";
+#endif
+
+      // Replace placeholders
+      settings_text.replace ("__default_custom_editor__", custom_editor);
       settings_text.replace ("__default_font__", default_family);
       settings_text.replace ("__default_font_size__", "10");
 
--- a/libgui/src/settings-dialog.ui	Sat Mar 07 17:29:06 2015 -0800
+++ b/libgui/src/settings-dialog.ui	Sun Mar 08 09:48:45 2015 +0100
@@ -32,7 +32,7 @@
       </size>
      </property>
      <property name="currentIndex">
-      <number>0</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="tab_general">
       <property name="enabled">
@@ -498,7 +498,7 @@
           <property name="geometry">
            <rect>
             <x>0</x>
-            <y>0</y>
+            <y>-295</y>
             <width>662</width>
             <height>673</height>
            </rect>
@@ -1375,7 +1375,7 @@
                   <bool>false</bool>
                  </property>
                  <property name="text">
-                  <string>emacs +%l %f </string>
+                  <string/>
                  </property>
                 </widget>
                </item>
@@ -1472,8 +1472,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>678</width>
-            <height>378</height>
+            <width>488</width>
+            <height>236</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_7">
@@ -1760,8 +1760,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>678</width>
-            <height>378</height>
+            <width>474</width>
+            <height>318</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_18">
@@ -1937,8 +1937,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>678</width>
-            <height>378</height>
+            <width>203</width>
+            <height>79</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_19">
@@ -2006,8 +2006,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>678</width>
-            <height>378</height>
+            <width>368</width>
+            <height>244</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_25">
@@ -2269,8 +2269,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>678</width>
-            <height>378</height>
+            <width>529</width>
+            <height>204</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_20">