Add MessageProcessor progress widget to MainWin's status bar
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 7 Aug 2008 00:21:20 +0000 (02:21 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 7 Aug 2008 00:43:00 +0000 (02:43 +0200)
src/client/abstractmessageprocessor.h
src/qtui/CMakeLists.txt
src/qtui/mainwin.cpp
src/qtui/mainwin.h
src/qtui/msgprocessorstatuswidget.cpp [new file with mode: 0644]
src/qtui/msgprocessorstatuswidget.h [new file with mode: 0644]
src/qtui/ui/msgprocessorstatuswidget.ui [new file with mode: 0644]

index b6bc449..ecbca38 100644 (file)
@@ -35,6 +35,7 @@ class AbstractMessageProcessor : public QObject {
     virtual void process(QList<Message> &msgs) = 0;
 
   signals:
+    void progressUpdated(int value, int maximum);
 
   protected:
     void postProcess(Message &msg);
index 6c2c18d..670cda3 100644 (file)
@@ -24,6 +24,7 @@ set(SOURCES
     inputwidget.cpp
     jumpkeyhandler.cpp
     mainwin.cpp
+    msgprocessorstatuswidget.cpp
     nicklistwidget.cpp
     qtui.cpp
     qtuimessageprocessor.cpp
@@ -52,6 +53,7 @@ set(MOC_HDRS
     inputwidget.h
     jumpkeyhandler.h
     mainwin.h
+    msgprocessorstatuswidget.h
     nicklistwidget.h
     qtui.h
     qtuimessageprocessor.h
@@ -84,6 +86,7 @@ set(FORMS
     debugconsole.ui
     inputwidget.ui
     mainwin.ui
+    msgprocessorstatuswidget.ui
     nicklistwidget.ui
     settingsdlg.ui
     settingspagedlg.ui
index b2a8b47..6c8628a 100644 (file)
@@ -32,6 +32,8 @@
 #include "clientbacklogmanager.h"
 #include "coreinfodlg.h"
 #include "coreconnectdlg.h"
+#include "msgprocessorstatuswidget.h"
+#include "qtuimessageprocessor.h"
 #include "networkmodel.h"
 #include "buffermodel.h"
 #include "nicklistwidget.h"
@@ -70,6 +72,7 @@ MainWin::MainWin(QtUi *_gui, QWidget *parent)
     gui(_gui),
     coreLagLabel(new QLabel()),
     sslLabel(new QLabel()),
+    msgProcessorStatusWidget(new MsgProcessorStatusWidget()),
     _titleSetter(this),
     systray(new QSystemTrayIcon(this)),
     activeTrayIcon(":/icons/quassel-icon-active.png"),
@@ -335,6 +338,10 @@ void MainWin::setupTopicWidget() {
 }
 
 void MainWin::setupStatusBar() {
+  // MessageProcessor progress
+  statusBar()->addPermanentWidget(msgProcessorStatusWidget);
+  connect(Client::messageProcessor(), SIGNAL(progressUpdated(int, int)), msgProcessorStatusWidget, SLOT(setProgress(int, int)));
+
   // Core Lag:
   updateLagIndicator(0);
   statusBar()->addPermanentWidget(coreLagLabel);
index 5b60137..8cffe8b 100644 (file)
@@ -34,6 +34,7 @@ class ChannelListDlg;
 class CoreConnectDlg;
 class Buffer;
 class BufferViewConfig;
+class MsgProcessorStatusWidget;
 class SettingsDlg;
 class QtUi;
 class Message;
@@ -125,6 +126,7 @@ class MainWin : public QMainWindow {
     QMenu *systrayMenu;
     QLabel *coreLagLabel;
     QLabel *sslLabel;
+    MsgProcessorStatusWidget *msgProcessorStatusWidget;
 
     TitleSetter _titleSetter;
 
diff --git a/src/qtui/msgprocessorstatuswidget.cpp b/src/qtui/msgprocessorstatuswidget.cpp
new file mode 100644 (file)
index 0000000..ca07190
--- /dev/null
@@ -0,0 +1,37 @@
+/***************************************************************************
+*   Copyright (C) 2005-08 by the Quassel Project                          *
+*   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) version 3.                                           *
+*                                                                         *
+*   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 "msgprocessorstatuswidget.h"
+
+MsgProcessorStatusWidget::MsgProcessorStatusWidget(QWidget *parent) : QWidget(parent) {
+  ui.setupUi(this);
+
+  hide();
+}
+
+void MsgProcessorStatusWidget::setProgress(int value, int max) {
+  if(max <= 0) {
+    hide();
+  } else {
+    if(isHidden()) show();
+    ui.progressBar->setMaximum(max);
+    ui.progressBar->setValue(value);
+  }
+}
diff --git a/src/qtui/msgprocessorstatuswidget.h b/src/qtui/msgprocessorstatuswidget.h
new file mode 100644 (file)
index 0000000..b664e5d
--- /dev/null
@@ -0,0 +1,40 @@
+/***************************************************************************
+*   Copyright (C) 2005-08 by the Quassel Project                          *
+*   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) version 3.                                           *
+*                                                                         *
+*   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 MSGPROCESSORSTATUSWIDGET_H_
+#define MSGPROCESSORSTATUSWIDGET_H_
+
+#include "ui_msgprocessorstatuswidget.h"
+
+class MsgProcessorStatusWidget : public QWidget {
+  Q_OBJECT
+
+  public:
+    MsgProcessorStatusWidget(QWidget *parent = 0);
+
+  public slots:
+    void setProgress(int value, int max);
+
+  private:
+    Ui::MsgProcessorStatusWidget ui;
+
+};
+
+#endif
diff --git a/src/qtui/ui/msgprocessorstatuswidget.ui b/src/qtui/ui/msgprocessorstatuswidget.ui
new file mode 100644 (file)
index 0000000..ab3e469
--- /dev/null
@@ -0,0 +1,55 @@
+<ui version="4.0" >
+ <class>MsgProcessorStatusWidget</class>
+ <widget class="QWidget" name="MsgProcessorStatusWidget" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>229</width>
+    <height>26</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="Maximum" hsizetype="Maximum" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout" >
+   <property name="leftMargin" >
+    <number>4</number>
+   </property>
+   <property name="topMargin" >
+    <number>0</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="label" >
+     <property name="text" >
+      <string>Processing Messages</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QProgressBar" name="progressBar" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Maximum" hsizetype="Expanding" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="value" >
+      <number>24</number>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>