Backlog amount (initial and dynamic) can now be configured (Settings -> behavior...
authorMarcus Eggenberger <egs@quassel-irc.org>
Mon, 27 Oct 2008 15:06:12 +0000 (16:06 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Mon, 27 Oct 2008 15:06:12 +0000 (16:06 +0100)
Requests are now more verbose (status bar) so one know, that the request really did trigger.

src/client/backlogrequester.cpp
src/client/messagemodel.cpp
src/qtui/settingspages/generalsettingspage.cpp
src/qtui/settingspages/generalsettingspage.ui

index 8b4d374..920e564 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QObject>
 
+#include "backlogsettings.h"
 #include "clientbacklogmanager.h"
 
 BacklogRequester::BacklogRequester(bool buffering, ClientBacklogManager *backlogManager)
@@ -41,9 +42,10 @@ bool BacklogRequester::buffer(BufferId bufferId, const MessageList &messages) {
 //  FIXED BACKLOG REQUESTER
 // ========================================
 FixedBacklogRequester::FixedBacklogRequester(ClientBacklogManager *backlogManager)
-  : BacklogRequester(true, backlogManager),
-    _backlogCount(500)
+  : BacklogRequester(true, backlogManager)
 {
+  BacklogSettings backlogSettings;
+  _backlogCount = backlogSettings.fixedBacklogAmount();
 }
 
 void FixedBacklogRequester::requestBacklog() {
index fd0ae3e..82fd71b 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QEvent>
 
+#include "backlogsettings.h"
 #include "clientbacklogmanager.h"
 #include "client.h"
 #include "message.h"
@@ -349,16 +350,17 @@ void MessageModel::requestBacklog(BufferId bufferId) {
   if(_messagesWaiting.contains(bufferId))
     return;
 
-  static const int REQUEST_COUNT = 500;
+  BacklogSettings backlogSettings;
+  int requestCount = backlogSettings.dynamicBacklogAmount();
 
   for(int i = 0; i < _messageList.count(); i++) {
     if(_messageList.at(i)->bufferId() == bufferId) {
-      _messagesWaiting[bufferId] = REQUEST_COUNT;
+      _messagesWaiting[bufferId] = requestCount;
       Client::backlogManager()->emitMessagesRequested(tr("Requesting %1 messages from backlog for buffer %2:%3")
-                                                     .arg(REQUEST_COUNT)
+                                                     .arg(requestCount)
                                                      .arg(Client::networkModel()->networkName(bufferId))
                                                      .arg(Client::networkModel()->bufferName(bufferId)));
-      Client::backlogManager()->requestBacklog(bufferId, REQUEST_COUNT, _messageList.at(i)->msgId().toInt());
+      Client::backlogManager()->requestBacklog(bufferId, requestCount, _messageList.at(i)->msgId().toInt());
       return;
     }
   }
index cac26c0..ce7bacc 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "qtui.h"
 #include "qtuisettings.h"
+#include "backlogsettings.h"
 #include "buffersettings.h"
 
 GeneralSettingsPage::GeneralSettingsPage(QWidget *parent)
@@ -50,6 +51,8 @@ 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()));
+  connect(ui.fixedBacklogAmount, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+  connect(ui.dynamicBacklogAmount, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
 }
 
 bool GeneralSettingsPage::hasDefaults() const {
@@ -109,6 +112,14 @@ void GeneralSettingsPage::load() {
   settings["CompletionSuffix"] = uiSettings.value("CompletionSuffix", QString(": "));
   ui.completionSuffix->setText(settings["CompletionSuffix"].toString());
 
+  // backlogSettings:
+  BacklogSettings backlogSettings;
+  settings["FixedBacklogAmount"] = backlogSettings.fixedBacklogAmount();
+  ui.fixedBacklogAmount->setValue(backlogSettings.fixedBacklogAmount());
+
+  settings["DynamicBacklogAmount"] = backlogSettings.dynamicBacklogAmount();
+  ui.dynamicBacklogAmount->setValue(backlogSettings.dynamicBacklogAmount());
+
   setChangedState(false);
 }
 
@@ -130,6 +141,11 @@ void GeneralSettingsPage::save() {
 
   uiSettings.setValue("CompletionSuffix", ui.completionSuffix->text());
 
+
+  BacklogSettings backlogSettings;
+  backlogSettings.setFixedBacklogAmount(ui.fixedBacklogAmount->value());
+  backlogSettings.setDynamicBacklogAmount(ui.dynamicBacklogAmount->value());
+  
   load();
   setChangedState(false);
 }
@@ -153,5 +169,8 @@ bool GeneralSettingsPage::testHasChanged() {
 
   if(settings["CompletionSuffix"].toString() != ui.completionSuffix->text()) return true;
 
+  if(settings["FixedBacklogAmount"].toInt() != ui.fixedBacklogAmount->value()) return true;
+  if(settings["DynamicBacklogAmount"].toInt() != ui.dynamicBacklogAmount->value()) return true;
+
   return false;
 }
index d35bce1..317c2f0 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>453</width>
-    <height>467</height>
+    <width>542</width>
+    <height>599</height>
    </rect>
   </property>
   <property name="windowTitle" >
     </widget>
    </item>
    <item>
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0" >
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
+    <widget class="QGroupBox" name="groupBox_3" >
+     <property name="title" >
+      <string>Backlog</string>
      </property>
-    </spacer>
+     <layout class="QGridLayout" name="gridLayout" >
+      <item row="0" column="0" >
+       <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 row="0" column="2" >
+       <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 row="1" column="0" >
+       <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 row="1" column="2" >
+       <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 row="0" column="3" >
+       <spacer name="horizontalSpacer_2" >
+        <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>
+    </widget>
    </item>
   </layout>
  </widget>