From 713382cb7e35561849dcdccef6d093fa9541bdb3 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 3 Mar 2010 03:19:24 +0100 Subject: [PATCH 1/1] Some fixups for the per-chat history stuff --- src/qtui/inputwidget.cpp | 9 ++++++++- src/qtui/settingspages/inputwidgetsettingspage.ui | 6 +++--- src/uisupport/multilineedit.h | 14 +++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index f05311a7..3148d636 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -33,6 +33,8 @@ #include "tabcompleter.h" #include +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 ¤t, 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(); diff --git a/src/qtui/settingspages/inputwidgetsettingspage.ui b/src/qtui/settingspages/inputwidgetsettingspage.ui index 64048cdb..c4197d4d 100644 --- a/src/qtui/settingspages/inputwidgetsettingspage.ui +++ b/src/qtui/settingspages/inputwidgetsettingspage.ui @@ -63,13 +63,13 @@ Enable per chat history - true + false - EnablePerChatHistory + EnablePerChatHistory - true + false diff --git a/src/uisupport/multilineedit.h b/src/uisupport/multilineedit.h index 73ea6788..04afed31 100644 --- a/src/uisupport/multilineedit.h +++ b/src/uisupport/multilineedit.h @@ -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 mircColorMap() const { return _mircColorMap; } - inline QStringList history() { return _history; } - inline QHash tempHistory() { return _tempHistory; } - inline qint32 idx() { return _idx; } + inline QStringList history() const { return _history; } + inline QHash tempHistory() const { return _tempHistory; } + inline qint32 idx() const { return _idx; } public slots: void setMode(Mode mode); -- 2.20.1