From: Marcus Eggenberger Date: Mon, 31 Mar 2008 11:05:56 +0000 (+0000) Subject: code cleanup X-Git-Tag: 0.2.0-alpha5~43 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=db199a3d46e34a02e8a66046fd44bf53a988cdf8 code cleanup --- diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 846ccc13..49496a8c 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -30,7 +30,6 @@ #include "networkmodel.h" #include "buffermodel.h" #include "nicklistwidget.h" -#include "nicklistdock.h" #include "settingsdlg.h" #include "settingspagedlg.h" #include "signalproxy.h" diff --git a/src/qtui/nicklistdock.cpp b/src/qtui/nicklistdock.cpp deleted file mode 100644 index dc24d528..00000000 --- a/src/qtui/nicklistdock.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 "nicklistdock.h" -#include "qtuisettings.h" - -#include -#include -#include -#include - -NickListDock::NickListDock(const QString &title, QWidget *parent) - : QDockWidget(title, parent) -{ - QAction *toggleView = toggleViewAction(); - disconnect(toggleView, SIGNAL(triggered(bool)), this, 0); - - foreach(QAbstractButton *button, findChildren()) { - if(disconnect(button, SIGNAL(clicked()), this, SLOT(close()))) - connect(button, SIGNAL(clicked()), toggleView, SLOT(trigger())); - } - - installEventFilter(this); - - toggleView->setChecked(QtUiSettings().value("ShowNickList", QVariant(true)).toBool()); -} - -NickListDock::~NickListDock() { - QtUiSettings().setValue("ShowNickList", toggleViewAction()->isChecked()); -} - -bool NickListDock::eventFilter(QObject *watched, QEvent *event) { - Q_UNUSED(watched) - if(event->type() != QEvent::Hide && event->type() != QEvent::Show) - return false; - - emit visibilityChanged(event->type() == QEvent::Show); - - return true; -} diff --git a/src/qtui/nicklistdock.h b/src/qtui/nicklistdock.h deleted file mode 100644 index ca610eeb..00000000 --- a/src/qtui/nicklistdock.h +++ /dev/null @@ -1,36 +0,0 @@ -/*************************************************************************** - * 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 NICKLISTDOCK_H -#define NICKLISTDOCK_H - -#include - -class NickListDock : public QDockWidget { - Q_OBJECT - -public: - NickListDock(const QString &title, QWidget *parent = 0); - ~NickListDock(); - - virtual bool eventFilter(QObject *watched, QEvent *event); -}; - -#endif //NICKLISTDOCK_H diff --git a/src/qtui/nicklistwidget.cpp b/src/qtui/nicklistwidget.cpp index d6916f99..ebd1825f 100644 --- a/src/qtui/nicklistwidget.cpp +++ b/src/qtui/nicklistwidget.cpp @@ -28,7 +28,10 @@ #include "nickviewfilter.h" #include "qtuisettings.h" -#include +#include +#include +#include +#include NickListWidget::NickListWidget(QWidget *parent) : AbstractItemView(parent) @@ -152,3 +155,36 @@ QSize NickListWidget::sizeHint() const { else return currentWidget->sizeHint(); } + + +// ============================== +// NickList Dock +// ============================== +NickListDock::NickListDock(const QString &title, QWidget *parent) + : QDockWidget(title, parent) +{ + QAction *toggleView = toggleViewAction(); + disconnect(toggleView, SIGNAL(triggered(bool)), this, 0); + toggleView->setChecked(QtUiSettings().value("ShowNickList", QVariant(true)).toBool()); + + // reconnecting the closebuttons clicked signal to the action + foreach(QAbstractButton *button, findChildren()) { + if(disconnect(button, SIGNAL(clicked()), this, SLOT(close()))) + connect(button, SIGNAL(clicked()), toggleView, SLOT(trigger())); + } +} + +NickListDock::~NickListDock() { + QtUiSettings().setValue("ShowNickList", toggleViewAction()->isChecked()); +} + +bool NickListDock::event(QEvent *event) { + switch (event->type()) { + case QEvent::Hide: + case QEvent::Show: + emit visibilityChanged(event->type() == QEvent::Show); + return QWidget::event(event); + default: + return QDockWidget::event(event); + } +} diff --git a/src/qtui/nicklistwidget.h b/src/qtui/nicklistwidget.h index 9525803e..2da05a96 100644 --- a/src/qtui/nicklistwidget.h +++ b/src/qtui/nicklistwidget.h @@ -23,12 +23,12 @@ #include "ui_nicklistwidget.h" #include "abstractitemview.h" +#include "buffermodel.h" #include "types.h" #include - -#include "buffermodel.h" +#include class Buffer; class NickView; @@ -60,4 +60,18 @@ private: QDockWidget *dock() const; }; + +// ============================== +// NickList Dock +// ============================== +class NickListDock : public QDockWidget { + Q_OBJECT + +public: + NickListDock(const QString &title, QWidget *parent = 0); + ~NickListDock(); + + virtual bool event(QEvent *event); +}; + #endif diff --git a/src/qtui/qtui.pri b/src/qtui/qtui.pri index 693e3851..e410de45 100644 --- a/src/qtui/qtui.pri +++ b/src/qtui/qtui.pri @@ -3,12 +3,12 @@ QT_MOD = core gui network SRCS += aboutdlg.cpp bufferwidget.cpp chatitem.cpp chatline.cpp chatline-old.cpp chatscene.cpp chatview.cpp chatwidget.cpp \ coreconfigwizard.cpp coreconnectdlg.cpp configwizard.cpp debugconsole.cpp inputwidget.cpp \ - mainwin.cpp nicklistdock.cpp nicklistwidget.cpp qtui.cpp qtuisettings.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \ + mainwin.cpp nicklistwidget.cpp qtui.cpp qtuisettings.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \ topicbutton.cpp topicwidget.cpp verticaldock.cpp jumpkeyhandler.cpp HDRS += aboutdlg.h bufferwidget.h chatitem.h chatline.h chatline-old.h chatscene.h chatview.h chatwidget.h \ coreconfigwizard.h configwizard.h debugconsole.h inputwidget.h \ - coreconnectdlg.h mainwin.h nicklistdock.h nicklistwidget.h qtui.h qtuisettings.h qtuistyle.h settingsdlg.h settingspagedlg.h \ + coreconnectdlg.h mainwin.h nicklistwidget.h qtui.h qtuisettings.h qtuistyle.h settingsdlg.h settingspagedlg.h \ topicbutton.h topicwidget.h verticaldock.h jumpkeyhandler.h FORMNAMES = aboutdlg.ui mainwin.ui coreaccounteditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui nicklistwidget.ui settingsdlg.ui \ diff --git a/version.inc b/version.inc index 893ba04f..f7d2871c 100644 --- a/version.inc +++ b/version.inc @@ -5,7 +5,7 @@ quasselVersion = "0.2.0-alpha5-pre"; quasselDate = "2008-03-31"; - quasselBuild = 673; + quasselBuild = 675; //! Minimum client build number the core needs clientBuildNeeded = 642;