Some fixups for the per-chat history stuff
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 3 Mar 2010 02:19:24 +0000 (03:19 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 3 Mar 2010 02:19:24 +0000 (03:19 +0100)
src/qtui/inputwidget.cpp
src/qtui/settingspages/inputwidgetsettingspage.ui
src/uisupport/multilineedit.h

index f05311a..3148d63 100644 (file)
@@ -33,6 +33,8 @@
 #include "tabcompleter.h"
 #include <QPainter>
 
+const int leftMargin = 3;
+
 InputWidget::InputWidget(QWidget *parent)
   : AbstractItemView(parent),
     _networkId(0)
@@ -111,7 +113,7 @@ InputWidget::InputWidget(QWidget *parent)
   setShowStyleButtons(s.value("ShowStyleButtons", true));
 
   s.notify("EnablePerChatHistory", this, SLOT(setEnablePerChatHistory(QVariant)));
-  setEnablePerChatHistory(s.value("EnablePerChatHistory", true));
+  setEnablePerChatHistory(s.value("EnablePerChatHistory", false));
 
   s.notify("MaxNumLines", this, SLOT(setMaxLines(QVariant)));
   setMaxLines(s.value("MaxNumLines", 5));
@@ -226,6 +228,11 @@ void InputWidget::currentChanged(const QModelIndex &current, const QModelIndex &
     inputLine()->setIdx(historyMap[currentBufferId].idx);
     inputLine()->setHtml(historyMap[currentBufferId].inputLine);
     inputLine()->moveCursor(QTextCursor::End,QTextCursor::MoveAnchor);
+
+    // FIXME this really should be in MultiLineEdit (and the const int on top removed)
+    QTextBlockFormat format = inputLine()->textCursor().blockFormat();
+    format.setLeftMargin(leftMargin); // we want a little space between the frame and the contents
+    inputLine()->textCursor().setBlockFormat(format);
   }
 
   NetworkId networkId = current.data(NetworkModel::NetworkIdRole).value<NetworkId>();
index 64048cd..c4197d4 100644 (file)
       <string>Enable per chat history</string>
      </property>
      <property name="checked">
-      <bool>true</bool>
+      <bool>false</bool>
      </property>
      <property name="settingsKey" stdset="0">
-      <string>EnablePerChatHistory</string>
+      <string notr="true">EnablePerChatHistory</string>
      </property>
      <property name="defaultValue" stdset="0">
-      <bool>true</bool>
+      <bool>false</bool>
      </property>
     </widget>
    </item>
index 73ea678..04afed3 100644 (file)
@@ -53,12 +53,12 @@ public:
   void setCustomFont(const QFont &); // should be used instead setFont(), so we can set our size correctly
 
   // Compatibility methods with the rest of the classes which still expect this to be a QLineEdit
-  inline QString text() { return toPlainText(); }
-  inline QString html() { return toHtml(); }
-  inline int cursorPosition() { return textCursor().position(); }
+  inline QString text() const { return toPlainText(); }
+  inline QString html() const { return toHtml(); }
+  inline int cursorPosition() const { return textCursor().position(); }
   inline void insert(const QString &newText) { insertPlainText(newText); }
   inline void backspace() { keyPressEvent(new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier)); }
-  inline bool hasSelectedText() { return textCursor().hasSelection(); }
+  inline bool hasSelectedText() const { return textCursor().hasSelection(); }
 
   inline bool isSingleLine() const { return _singleLine; }
   inline bool pasteProtectionEnabled() const { return _pasteProtectionEnabled; }
@@ -70,9 +70,9 @@ public:
   inline QString rgbColorFromMirc(QString mircColor) const { return _mircColorMap[mircColor]; }
   inline QMap<QString, QString>  mircColorMap() const { return _mircColorMap; }
 
-  inline QStringList history() { return _history; }
-  inline QHash<int, QString> tempHistory() { return _tempHistory; }
-  inline qint32 idx() { return _idx; }
+  inline QStringList history() const { return _history; }
+  inline QHash<int, QString> tempHistory() const { return _tempHistory; }
+  inline qint32 idx() const { return _idx; }
 
 public slots:
   void setMode(Mode mode);