public:
enum RequesterTypes {
InvalidRequester = 0,
- GlobalUnread,
+ PerBufferFixed,
PerBufferUnread,
- PerBufferFixed
+ GlobalUnread
};
BacklogRequester(bool buffering, ClientBacklogManager *backlogManger);
class BacklogSettings : public ClientSettings {
public:
BacklogSettings() : ClientSettings("Backlog") {}
- inline int requesterType() { return localValue("RequesterType", 0).toInt(); }
+ inline int requesterType() { return localValue("RequesterType", 1).toInt(); }
inline void setRequesterType(int requesterType) { setLocalValue("RequesterType", requesterType); }
inline int dynamicBacklogAmount() { return localValue("DynamicBacklogAmount", 200).toInt(); }
switch(settings.requesterType()) {
case BacklogRequester::GlobalUnread:
_requester = new GlobalUnreadBacklogRequester(this);
+ break;
case BacklogRequester::PerBufferUnread:
_requester = new PerBufferUnreadBacklogRequester(this);
+ break;
case BacklogRequester::PerBufferFixed:
default:
_requester = new FixedBacklogRequester(this);
#include "settingspages/aliasessettingspage.h"
#include "settingspages/appearancesettingspage.h"
+#include "settingspages/backlogsettingspage.h"
#include "settingspages/bufferviewsettingspage.h"
#include "settingspages/colorsettingspage.h"
#include "settingspages/fontssettingspage.h"
dlg->registerSettingsPage(new AppearanceSettingsPage(dlg)); //General
//Category: Behaviour
dlg->registerSettingsPage(new GeneralSettingsPage(dlg));
+ dlg->registerSettingsPage(new BacklogSettingsPage(dlg));
dlg->registerSettingsPage(new HighlightSettingsPage(dlg));
dlg->registerSettingsPage(new AliasesSettingsPage(dlg));
dlg->registerSettingsPage(new NotificationsSettingsPage(dlg));
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "backlogsettingspage.h"
+
+#include "qtui.h"
+#include "backlogsettings.h"
+
+BacklogSettingsPage::BacklogSettingsPage(QWidget *parent)
+ : SettingsPage(tr("Behaviour"), tr("Backlog"), parent)
+{
+ ui.setupUi(this);
+ connect(ui.requesterType, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
+
+ connect(ui.fixedBacklogAmount, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+ connect(ui.globalUnreadLimit, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+ connect(ui.globalUnreadAdditional, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+ connect(ui.perBufferUnreadLimit, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+ connect(ui.perBufferUnreadAdditional, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+
+ connect(ui.dynamicBacklogAmount, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+}
+
+bool BacklogSettingsPage::hasDefaults() const {
+ return true;
+}
+
+void BacklogSettingsPage::defaults() {
+ // ui.completionSuffix->setText(": ");
+
+ widgetHasChanged();
+}
+
+void BacklogSettingsPage::load() {
+ BacklogSettings backlogSettings;
+ SettingsPage::load(ui.requesterType, backlogSettings.requesterType() - 1);
+
+ SettingsPage::load(ui.fixedBacklogAmount, backlogSettings.fixedBacklogAmount());
+ SettingsPage::load(ui.globalUnreadLimit, backlogSettings.globalUnreadBacklogLimit());
+ SettingsPage::load(ui.globalUnreadAdditional, backlogSettings.globalUnreadBacklogAdditional());
+ SettingsPage::load(ui.perBufferUnreadLimit, backlogSettings.perBufferUnreadBacklogLimit());
+ SettingsPage::load(ui.perBufferUnreadAdditional, backlogSettings.perBufferUnreadBacklogAdditional());
+
+ SettingsPage::load(ui.dynamicBacklogAmount, backlogSettings.dynamicBacklogAmount());
+
+ setChangedState(false);
+}
+
+void BacklogSettingsPage::save() {
+ BacklogSettings backlogSettings;
+ backlogSettings.setRequesterType(ui.requesterType->currentIndex() + 1);
+ backlogSettings.setFixedBacklogAmount(ui.fixedBacklogAmount->value());
+ backlogSettings.setGlobalUnreadBacklogLimit(ui.globalUnreadLimit->value());
+ backlogSettings.setGlobalUnreadBacklogAdditional(ui.globalUnreadAdditional->value());
+ backlogSettings.setPerBufferUnreadBacklogLimit(ui.perBufferUnreadLimit->value());
+ backlogSettings.setPerBufferUnreadBacklogAdditional(ui.perBufferUnreadAdditional->value());
+
+ backlogSettings.setDynamicBacklogAmount(ui.dynamicBacklogAmount->value());
+
+ load();
+ setChangedState(false);
+}
+
+void BacklogSettingsPage::widgetHasChanged() {
+ bool changed = testHasChanged();
+ if(changed != hasChanged()) setChangedState(changed);
+}
+
+bool BacklogSettingsPage::testHasChanged() {
+ if(SettingsPage::hasChanged(ui.fixedBacklogAmount)) return true;
+ if(SettingsPage::hasChanged(ui.dynamicBacklogAmount)) return true;
+
+ return false;
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef BACKLOGSETTINGSPAGE_H
+#define BACKLOGSETTINGSPAGE_H
+
+#include <QHash>
+
+#include "settingspage.h"
+#include "ui_backlogsettingspage.h"
+
+class BacklogSettingsPage : public SettingsPage {
+ Q_OBJECT
+
+public:
+ BacklogSettingsPage(QWidget *parent = 0);
+
+ bool hasDefaults() const;
+
+public slots:
+ void save();
+ void load();
+ void defaults();
+
+private slots:
+ void widgetHasChanged();
+
+private:
+ Ui::BacklogSettingsPage ui;
+ QHash<QString, QVariant> settings;
+
+ bool testHasChanged();
+};
+
+#endif
--- /dev/null
+<ui version="4.0" >
+ <class>BacklogSettingsPage</class>
+ <widget class="QWidget" name="BacklogSettingsPage" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>505</width>
+ <height>362</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QComboBox" name="requesterType" >
+ <item>
+ <property name="text" >
+ <string>Fixed Amount per Buffer</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Unread Messages per Buffer</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Global Unread Messages</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QStackedWidget" name="stackedWidget" >
+ <property name="currentIndex" >
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="page" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>481</width>
+ <height>259</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QLabel" name="label_9" >
+ <property name="text" >
+ <string>The simplest Requester. It fetches a fixed amount of lines for each buffer from the Backlog.</string>
+ </property>
+ <property name="textFormat" >
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="toolTip" >
+ <string>amount of messages per buffer that are requested after the core connection has been established.</string>
+ </property>
+ <property name="text" >
+ <string>Initial backlog amount:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="fixedBacklogAmount" >
+ <property name="maximum" >
+ <number>1000</number>
+ </property>
+ <property name="singleStep" >
+ <number>10</number>
+ </property>
+ <property name="value" >
+ <number>500</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>263</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_4" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>481</width>
+ <height>259</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <item>
+ <widget class="QLabel" name="label_10" >
+ <property name="text" >
+ <string>This requester fetches unread messages for each buffer individually. The amount of lines can be limited per buffer.
+
+You can also chose to fetch additional older chatlines to provide a better context.</string>
+ </property>
+ <property name="textFormat" >
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3" >
+ <item>
+ <widget class="QLabel" name="label_11" >
+ <property name="toolTip" >
+ <string>Maximum amount of messages to be fetched per buffer.</string>
+ </property>
+ <property name="text" >
+ <string>Limit:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="perBufferUnreadLimit" >
+ <property name="toolTip" >
+ <string>Maximum amount of messages to be fetched per buffer.</string>
+ </property>
+ <property name="maximum" >
+ <number>1000</number>
+ </property>
+ <property name="singleStep" >
+ <number>10</number>
+ </property>
+ <property name="value" >
+ <number>200</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_12" >
+ <property name="toolTip" >
+ <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+ </property>
+ <property name="text" >
+ <string>Additional Messages:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="perBufferUnreadAdditional" >
+ <property name="toolTip" >
+ <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+ </property>
+ <property name="maximum" >
+ <number>1000</number>
+ </property>
+ <property name="singleStep" >
+ <number>10</number>
+ </property>
+ <property name="value" >
+ <number>50</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_3" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Seite" >
+ <layout class="QVBoxLayout" name="verticalLayout_4" >
+ <item>
+ <widget class="QLabel" name="label_15" >
+ <property name="text" >
+ <string>This requester fetches all messages newer than the oldest unread message for all buffers.
+This requester determines which is the oldest read message of all buffers and then requests one large chunk of messages across all buffers.
+
+Note: this requester is not recommended if you use hidden buffer or have inactive buffers (i.e.: no stale queries or channels).
+It is useful to limit the total amount of the backlog and is probably the fastest.
+
+You can also chose to fetch additional older chatlines to provide a better context similar.</string>
+ </property>
+ <property name="textFormat" >
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4" >
+ <item>
+ <widget class="QLabel" name="label_13" >
+ <property name="toolTip" >
+ <string>Maximum amount of messages to be fetched over all buffers.</string>
+ </property>
+ <property name="text" >
+ <string>Limit:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="globalUnreadLimit" >
+ <property name="toolTip" >
+ <string>Maximum amount of messages to be fetched per buffer.</string>
+ </property>
+ <property name="maximum" >
+ <number>1000</number>
+ </property>
+ <property name="singleStep" >
+ <number>10</number>
+ </property>
+ <property name="value" >
+ <number>200</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_14" >
+ <property name="toolTip" >
+ <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+ </property>
+ <property name="text" >
+ <string>Additional Messages:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="globalUnreadAdditional" >
+ <property name="toolTip" >
+ <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+ </property>
+ <property name="maximum" >
+ <number>1000</number>
+ </property>
+ <property name="singleStep" >
+ <number>10</number>
+ </property>
+ <property name="value" >
+ <number>50</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="toolTip" >
+ <string>Number of messages to be requested from the core when using scrolling up in the buffer view.</string>
+ </property>
+ <property name="text" >
+ <string>Dynamic backlog amount:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="dynamicBacklogAmount" >
+ <property name="maximum" >
+ <number>1000</number>
+ </property>
+ <property name="singleStep" >
+ <number>10</number>
+ </property>
+ <property name="value" >
+ <number>200</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>18</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>requesterType</sender>
+ <signal>currentIndexChanged(int)</signal>
+ <receiver>stackedWidget</receiver>
+ <slot>setCurrentIndex(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>146</x>
+ <y>27</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>147</x>
+ <y>142</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
# Putting $FOO in SETTINGSPAGES automatically includes
# $FOOsettingspage.cpp, $FOOsettingspage.h and $FOOsettingspage.ui
-set(SETTINGSPAGES aliases appearance bufferview color fonts general highlight identities networks)
+set(SETTINGSPAGES aliases appearance backlog bufferview color fonts general highlight identities networks)
# Specify additional files (e.g. for subdialogs) here!
set(SP_SOURCES aliasesmodel.cpp notificationssettingspage.cpp)
#include "settingspage.h"
#include <QCheckBox>
+#include <QComboBox>
+#include <QSpinBox>
#include <QVariant>
SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent)
bool SettingsPage::hasChanged(QCheckBox *box) {
return box->property("StoredValue").toBool() == box->isChecked();
}
+
+
+void SettingsPage::load(QComboBox *box, int index) {
+ box->setProperty("StoredValue", index);
+ box->setCurrentIndex(index);
+}
+
+bool SettingsPage::hasChanged(QComboBox *box) {
+ return box->property("StoredValue").toInt() == box->currentIndex();
+}
+
+void SettingsPage::load(QSpinBox *box, int value) {
+ box->setProperty("StoredValue", value);
+ box->setValue(value);
+}
+
+bool SettingsPage::hasChanged(QSpinBox *box) {
+ return box->property("StoredValue").toInt() == box->value();
+}
#include <QWidget>
class QCheckBox;
+class QComboBox;
+class QSpinBox;
//! A SettingsPage is a page in the settings dialog.
/** The SettingsDlg provides suitable standard buttons, such as Ok, Apply, Cancel, Restore Defaults and Reset.
//! sets checked state depending on \checked and stores the value for later comparision
static void load(QCheckBox *box, bool checked);
static bool hasChanged(QCheckBox *box);
+ static void load(QComboBox *box, int index);
+ static bool hasChanged(QComboBox *box);
+ static void load(QSpinBox *box, int value);
+ static bool hasChanged(QSpinBox *box);
public slots:
//! Save settings to permanent storage.