Having this in one widget encapsulates the functionality from MainWin.
chatviewsettings.cpp
columnhandleitem.cpp
coreconfigwizard.cpp
+ coreconnectionstatuswidget.cpp
coreinfodlg.cpp
debugbufferviewoverlay.cpp
debugconsole.cpp
chatviewsearchcontroller.h
columnhandleitem.h
coreconfigwizard.h
+ coreconnectionstatuswidget.h
coreinfodlg.h
debugbufferviewoverlay.h
debugconsole.h
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2009 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 "coreconnectionstatuswidget.h"
+
+#include "client.h"
+#include "coreconnection.h"
+#include "iconloader.h"
+
+CoreConnectionStatusWidget::CoreConnectionStatusWidget(CoreConnection *connection, QWidget *parent)
+ : QWidget(parent),
+ _coreConnection(connection)
+{
+ ui.setupUi(this);
+ update();
+
+ connect(coreConnection(), SIGNAL(progressTextChanged(QString)), ui.messageLabel, SLOT(setText(QString)));
+ connect(coreConnection(), SIGNAL(progressValueChanged(int)), ui.progressBar, SLOT(setValue(int)));
+ connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), ui.progressBar, SLOT(setRange(int, int)));
+ connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), this, SLOT(progressRangeChanged(int, int)));
+}
+
+void CoreConnectionStatusWidget::update() {
+ CoreConnection *conn = coreConnection();
+ if(conn->progressMaximum() >= 0) {
+ ui.progressBar->setMinimum(conn->progressMinimum());
+ ui.progressBar->setMaximum(conn->progressMaximum());
+ ui.progressBar->setValue(conn->progressValue());
+ ui.progressBar->show();
+ } else
+ ui.progressBar->hide();
+
+ ui.messageLabel->setText(conn->progressText());
+
+}
+
+void CoreConnectionStatusWidget::progressRangeChanged(int min, int max) {
+ Q_UNUSED(min)
+ ui.progressBar->setVisible(max >= 0);
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2009 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 CORECONNECTIONSTATUSWIDGET_H
+#define CORECONNECTIONSTATUSWIDGET_H
+
+#include <QWidget>
+
+#include "ui_coreconnectionstatuswidget.h"
+
+class CoreConnection;
+
+class CoreConnectionStatusWidget : public QWidget {
+ Q_OBJECT
+
+public:
+ CoreConnectionStatusWidget(CoreConnection *connection, QWidget *parent = 0);
+
+ inline CoreConnection *coreConnection() const { return _coreConnection; }
+
+public slots:
+ void update();
+private slots:
+ void progressRangeChanged(int min, int max);
+
+private:
+ Ui::CoreConnectionStatusWidget ui;
+
+ CoreConnection *_coreConnection;
+};
+
+#endif // CORECONNECTIONSTATUSWIDGET_H
#include "clientbufferviewmanager.h"
#include "clientignorelistmanager.h"
#include "coreconnection.h"
+#include "coreconnectionstatuswidget.h"
#include "coreinfodlg.h"
#include "contextmenuactionprovider.h"
#include "debugbufferviewoverlay.h"
#endif
coreLagLabel(new QLabel()),
sslLabel(new QLabel()),
- msgProcessorStatusWidget(new MsgProcessorStatusWidget()),
+ _msgProcessorStatusWidget(new MsgProcessorStatusWidget(this)),
+ _coreConnectionStatusWidget(new CoreConnectionStatusWidget(Client::coreConnection(), this)),
_titleSetter(this),
_awayLog(0),
_layoutLoaded(false)
void MainWin::setupStatusBar() {
// MessageProcessor progress
- statusBar()->addPermanentWidget(msgProcessorStatusWidget);
+ statusBar()->addPermanentWidget(_msgProcessorStatusWidget);
+
+ // Connection state
+ _coreConnectionStatusWidget->update();
+ statusBar()->addPermanentWidget(_coreConnectionStatusWidget);
// Core Lag:
updateLagIndicator();
action->setVisible(!Client::internalCore());
}
- disconnect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), msgProcessorStatusWidget, SLOT(setProgress(int, int)));
+ disconnect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), _msgProcessorStatusWidget, SLOT(setProgress(int, int)));
disconnect(Client::backlogManager(), SIGNAL(messagesRequested(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
disconnect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
if(!Client::internalCore()) {
- connect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), msgProcessorStatusWidget, SLOT(setProgress(int, int)));
+ connect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), _msgProcessorStatusWidget, SLOT(setProgress(int, int)));
connect(Client::backlogManager(), SIGNAL(messagesRequested(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
connect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
}
class BufferView;
class BufferViewConfig;
class ClientBufferViewConfig;
+class CoreConnectionStatusWidget;
class BufferViewDock;
class BufferWidget;
class InputWidget;
QLabel *coreLagLabel;
QLabel *sslLabel;
- MsgProcessorStatusWidget *msgProcessorStatusWidget;
+ MsgProcessorStatusWidget *_msgProcessorStatusWidget;
+ CoreConnectionStatusWidget *_coreConnectionStatusWidget;
TitleSetter _titleSetter;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CoreConnectionStatusWidget</class>
+ <widget class="QWidget" name="CoreConnectionStatusWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>402</width>
+ <height>34</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="messageLabel">
+ <property name="text">
+ <string>Message</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="value">
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="sslLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>