From: Manuel Nickschas Date: Thu, 7 Aug 2008 00:21:20 +0000 (+0200) Subject: Add MessageProcessor progress widget to MainWin's status bar X-Git-Tag: 0.3.0~87 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=31253a98ef87edb8f87ff53270529ed4f7659612 Add MessageProcessor progress widget to MainWin's status bar --- diff --git a/src/client/abstractmessageprocessor.h b/src/client/abstractmessageprocessor.h index b6bc4492..ecbca380 100644 --- a/src/client/abstractmessageprocessor.h +++ b/src/client/abstractmessageprocessor.h @@ -35,6 +35,7 @@ class AbstractMessageProcessor : public QObject { virtual void process(QList &msgs) = 0; signals: + void progressUpdated(int value, int maximum); protected: void postProcess(Message &msg); diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt index 6c2c18de..670cda30 100644 --- a/src/qtui/CMakeLists.txt +++ b/src/qtui/CMakeLists.txt @@ -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 diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index b2a8b470..6c8628a6 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -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); diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 5b601379..8cffe8bd 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -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 index 00000000..ca071908 --- /dev/null +++ b/src/qtui/msgprocessorstatuswidget.cpp @@ -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 index 00000000..b664e5da --- /dev/null +++ b/src/qtui/msgprocessorstatuswidget.h @@ -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 index 00000000..ab3e469d --- /dev/null +++ b/src/qtui/ui/msgprocessorstatuswidget.ui @@ -0,0 +1,55 @@ + + MsgProcessorStatusWidget + + + + 0 + 0 + 229 + 26 + + + + + 0 + 0 + + + + Form + + + + 4 + + + 0 + + + 0 + + + + + Processing Messages + + + + + + + + 0 + 0 + + + + 24 + + + + + + + +