Make completion suffix configurable. Fixes BR130
authorSebastian Goth <seezer@roath.org>
Sat, 28 Jun 2008 18:50:14 +0000 (20:50 +0200)
committerSebastian Goth <seezer@roath.org>
Sat, 28 Jun 2008 18:50:14 +0000 (20:50 +0200)
src/qtui/settingspages/generalsettingspage.cpp
src/qtui/settingspages/generalsettingspage.ui
src/uisupport/tabcompleter.cpp

index 5111b4e..2462c63 100644 (file)
@@ -52,6 +52,7 @@ GeneralSettingsPage::GeneralSettingsPage(QWidget *parent)
 
   connect(ui.displayTopicInTooltip, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
   connect(ui.mouseWheelChangesBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+  connect(ui.completionSuffix, SIGNAL(textEdited(const QString&)), this, SLOT(widgetHasChanged()));
 }
 
 bool GeneralSettingsPage::hasDefaults() const {
@@ -74,6 +75,8 @@ void GeneralSettingsPage::defaults() {
   ui.displayTopicInTooltip->setChecked(false);
   ui.mouseWheelChangesBuffers->setChecked(true);
 
+  ui.completionSuffix->setText(": ");
+
   widgetHasChanged();
 }
 
@@ -113,6 +116,10 @@ void GeneralSettingsPage::load() {
   settings["DisplayTopicInTooltip"] = bufferSettings.value("DisplayTopicInTooltip", QVariant(false));
   ui.displayTopicInTooltip->setChecked(settings["DisplayTopicInTooltip"].toBool());
 
+  // inputline settings
+  settings["CompletionSuffix"] = uiSettings.value("CompletionSuffix", QString(": "));
+  ui.completionSuffix->setText(settings["CompletionSuffix"].toString());
+
   setChangedState(false);
 }
 
@@ -125,7 +132,8 @@ void GeneralSettingsPage::save() {
 
   uiSettings.setValue("AnimateTrayIcon", ui.animateTrayIcon->isChecked());
   uiSettings.setValue("DisplayPopupMessages", ui.displayPopupMessages->isChecked());
-
+  uiSettings.setValue("CompletionSuffix", ui.completionSuffix->text());
+  
   BufferSettings bufferSettings;
   bufferSettings.setValue("UserMessagesInStatusBuffer", ui.userMessagesInStatusBuffer->isChecked());
   bufferSettings.setValue("UserMessagesInQueryBuffer", ui.userMessagesInQueryBuffer->isChecked());
@@ -157,6 +165,8 @@ bool GeneralSettingsPage::testHasChanged() {
   if(settings["DisplayTopicInTooltip"].toBool() != ui.displayTopicInTooltip->isChecked()) return true;
   if(settings["MouseWheelChangesBuffers"].toBool() != ui.mouseWheelChangesBuffers->isChecked()) return true;
 
+  if(settings["CompletionSuffix"].toString() != ui.completionSuffix->text()) return true;
+
   return false;
 }
 
index 4fce47f..e24ebd8 100644 (file)
@@ -12,7 +12,7 @@
   <property name="windowTitle" >
    <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" >
+  <layout class="QVBoxLayout" name="verticalLayout_2" >
    <item>
     <widget class="QGroupBox" name="useSystemTrayIcon" >
      <property name="title" >
      </layout>
     </widget>
    </item>
+   <item>
+    <widget class="QGroupBox" name="inputLineGroup" >
+     <property name="toolTip" >
+      <string>The suffix appended to a nick on completion via TAB. Default is ": "</string>
+     </property>
+     <property name="title" >
+      <string>Input Line:</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout" >
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout" >
+        <item>
+         <widget class="QLabel" name="completionSuffixDesc" >
+          <property name="text" >
+           <string>Completion suffix:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="completionSuffix" >
+          <property name="sizePolicy" >
+           <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer" >
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType" >
+           <enum>QSizePolicy::MinimumExpanding</enum>
+          </property>
+          <property name="sizeHint" stdset="0" >
+           <size>
+            <width>157</width>
+            <height>27</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
    <item>
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeHint" >
+     <property name="sizeHint" stdset="0" >
       <size>
        <width>20</width>
        <height>40</height>
index 8c29e8a..c68b695 100644 (file)
@@ -27,6 +27,7 @@
 #include "network.h"
 #include "ircchannel.h"
 #include "ircuser.h"
+#include "uisettings.h"
 
 TabCompleter::TabCompleter(InputLine *inputLine_)
   : QObject(inputLine_),
@@ -84,6 +85,9 @@ void TabCompleter::ircUserJoinedOrParted(IrcUser *ircUser) {
 }
 
 void TabCompleter::complete() {
+  UiSettings uiSettings;
+  nickSuffix = uiSettings.value("CompletionSuffix", QString(": ")).toString();
+  
   if(!enabled) {
     buildCompletionList();
     enabled = true;