minimize and close buttons can now be configured to minimize quasselclient to the system tray
#include "inputwidget.h"
#include "verticaldock.h"
#include "uisettings.h"
+#include "qtuisettings.h"
#include "selectionmodelsynchronizer.h"
#include "mappedselectionmodel.h"
#include "settingspages/fontssettingspage.h"
#include "settingspages/identitiessettingspage.h"
#include "settingspages/networkssettingspage.h"
+#include "settingspages/generalsettingspage.h"
#include "debugconsole.h"
setupTopicWidget();
setupSystray();
+
setupSettingsDlg();
// restore mainwin state
settingsDlg->registerSettingsPage(new FontsSettingsPage(settingsDlg));
settingsDlg->registerSettingsPage(new IdentitiesSettingsPage(settingsDlg));
settingsDlg->registerSettingsPage(new NetworksSettingsPage(settingsDlg));
-
+ settingsDlg->registerSettingsPage(new GeneralSettingsPage(settingsDlg));
+
#ifdef SPUTDEV
connect(settingsDlg, SIGNAL(finished(int)), QApplication::instance(), SLOT(quit())); // FIXME
#endif
systray->setContextMenu(systrayMenu);
- systray->show();
+ QtUiSettings s;
+ if(s.value("UseSystemTrayIcon").toBool()) {
+ systray->show();
+ }
+
#ifndef Q_WS_MAC
connect(systray, SIGNAL(activated( QSystemTrayIcon::ActivationReason )),
this, SLOT(systrayActivated( QSystemTrayIcon::ActivationReason )));
#endif
+
+}
+
+void MainWin::changeEvent(QEvent *event) {
+ if(event->type() == QEvent::WindowStateChange) {
+ if(windowState() & Qt::WindowMinimized) {
+ QtUiSettings s;
+ if(s.value("UseSystemTrayIcon").toBool() && s.value("MinimizeOnMinimize").toBool()) {
+ toggleVisibility();
+ }
+ }
+ }
}
void MainWin::connectedToCore() {
void MainWin::closeEvent(QCloseEvent *event)
{
- //if (userReallyWantsToQuit()) {
- UiSettings s;
- s.setValue("MainWinSize", size());
- s.setValue("MainWinPos", pos());
- s.setValue("MainWinState", saveState());
+ QtUiSettings s;
+ if(s.value("UseSystemTrayIcon").toBool() && s.value("MinimizeOnClose").toBool()) {
+ toggleVisibility();
+ event->ignore();
+ } else {
event->accept();
+ }
+ //if (userReallyWantsToQuit()) {
+ s.setValue("MainWinSize", size());
+ s.setValue("MainWinPos", pos());
+ s.setValue("MainWinState", saveState());
//} else {
- //event->ignore();
+ // event->ignore();
//}
}
void MainWin::systrayActivated( QSystemTrayIcon::ActivationReason activationReason) {
if (activationReason == QSystemTrayIcon::Trigger) {
- if(isHidden()) {
- show();
- if(isMinimized()) {
- if(isMaximized()) {
- showMaximized();
- } else {
- showNormal();
- }
+ toggleVisibility();
+ }
+}
+
+void MainWin::toggleVisibility() {
+ if(isHidden()) {
+ show();
+ if(isMinimized()) {
+ if(isMaximized()) {
+ showMaximized();
+ } else {
+ showNormal();
}
- raise();
- activateWindow();
- } else {
- hide();
}
+ raise();
+ activateWindow();
+ } else {
+ hide();
}
}
protected:
void closeEvent(QCloseEvent *event);
+ virtual void changeEvent(QEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
protected slots:
void systrayActivated( QSystemTrayIcon::ActivationReason );
private slots:
-
void showSettingsDlg();
void showNetworkDlg();
void showDebugConsole();
void setupSettingsDlg();
+ void toggleVisibility();
+
void enableMenus();
void bindKey(int key);
QT_MOD = core gui network
SRCS += bufferwidget.cpp chatline-old.cpp chatwidget.cpp coreconfigwizard.cpp coreconnectdlg.cpp configwizard.cpp debugconsole.cpp inputwidget.cpp \
- mainwin.cpp nicklistwidget.cpp qtui.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \
+ mainwin.cpp nicklistwidget.cpp qtui.cpp qtuisettings.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \
topicwidget.cpp verticaldock.cpp
HDRS += bufferwidget.h chatline-old.h chatwidget.h coreconfigwizard.h configwizard.h debugconsole.h inputwidget.h \
- coreconnectdlg.h mainwin.h nicklistwidget.h qtui.h qtuistyle.h settingsdlg.h settingspagedlg.h \
+ coreconnectdlg.h mainwin.h nicklistwidget.h qtui.h qtuisettings.h qtuistyle.h settingsdlg.h settingspagedlg.h \
topicwidget.h verticaldock.h
FORMNAMES = mainwin.ui coreaccounteditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui nicklistwidget.ui settingsdlg.ui \
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * 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 "qtuisettings.h"
+
+QtUiSettings::QtUiSettings(const QString &group) : UiSettings(group) {
+
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * 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 _QTUISETTINGS_H_
+#define _QTUISETTINGS_H_
+
+#include "uisettings.h"
+
+class QtUiSettings : public UiSettings {
+
+ public:
+ QtUiSettings(const QString &group = "QtUi");
+
+};
+
+
+#endif
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * 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) any later version. *
+ * *
+ * 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 "generalsettingspage.h"
+
+#include "qtui.h"
+#include "qtuisettings.h"
+
+GeneralSettingsPage::GeneralSettingsPage(QWidget *parent)
+ : SettingsPage(tr("Behaviour"), tr("General"), parent) {
+ ui.setupUi(this);
+
+ connect(ui.useSystemTrayIcon, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+ connect(ui.minimizeOnMinimize, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+ connect(ui.minimizeOnClose, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+
+ connect(ui.userMessagesInStatusBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+ connect(ui.userMessagesInQueryBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+ connect(ui.userMessagesInCurrentBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+}
+
+bool GeneralSettingsPage::hasDefaults() const {
+ return true;
+}
+
+void GeneralSettingsPage::defaults() {
+ qDebug() << "defaults in generalsettingspage";
+ ui.useSystemTrayIcon->setChecked(true);
+ ui.minimizeOnMinimize->setChecked(false);
+ ui.minimizeOnClose->setChecked(false);
+
+ ui.userMessagesInStatusBuffer->setChecked(true);
+ ui.userMessagesInQueryBuffer->setChecked(false);
+ ui.userMessagesInCurrentBuffer->setChecked(false);
+
+ widgetHasChanged();
+}
+
+void GeneralSettingsPage::load() {
+ QtUiSettings s;
+ settings["UseSystemTrayIcon"] = s.value("UseSystemTrayIcon");
+ ui.useSystemTrayIcon->setChecked(settings["UseSystemTrayIcon"].toBool());
+
+ settings["MinimizeOnMinimize"] = s.value("MinimizeOnMinimize");
+ ui.minimizeOnMinimize->setChecked(settings["MinimizeOnMinimize"].toBool());
+
+ settings["MinimizeOnClose"] = s.value("MinimizeOnClose");
+ ui.minimizeOnClose->setChecked(settings["MinimizeOnClose"].toBool());
+
+ settings["UserMessagesInStatusBuffer"] = s.value("UserMessagesInStatusBuffer");
+ ui.userMessagesInStatusBuffer->setChecked(settings["UserMessagesInStatusBuffer"].toBool());
+
+ settings["UserMessagesInQueryBuffer"] = s.value("UserMessagesInQueryBuffer");
+ ui.userMessagesInQueryBuffer->setChecked(settings["UserMessagesInQueryBuffer"].toBool());
+
+ settings["UserMessagesInCurrentBuffer"] = s.value("UserMessagesInCurrentBuffer");
+ ui.userMessagesInCurrentBuffer->setChecked(settings["UserMessagesInCurrentBuffer"].toBool());
+
+ setChangedState(false);
+}
+
+void GeneralSettingsPage::save() {
+ QtUiSettings s;
+ s.setValue("UseSystemTrayIcon", ui.useSystemTrayIcon->isChecked());
+ s.setValue("MinimizeOnMinimize", ui.minimizeOnMinimize->isChecked());
+ s.setValue("MinimizeOnClose", ui.minimizeOnClose->isChecked());
+
+ s.setValue("UserMessagesInStatusBuffer", ui.userMessagesInStatusBuffer->isChecked());
+ s.setValue("UserMessagesInQueryBuffer", ui.userMessagesInQueryBuffer->isChecked());
+ s.setValue("UserMessagesInCurrentBuffer", ui.userMessagesInCurrentBuffer->isChecked());
+
+ setChangedState(false);
+}
+
+void GeneralSettingsPage::widgetHasChanged() {
+ bool changed = testHasChanged();
+ if(changed != hasChanged()) setChangedState(changed);
+}
+
+bool GeneralSettingsPage::testHasChanged() {
+ if(settings["UseSystemTrayIcon"] != ui.useSystemTrayIcon->isChecked()) return true;
+ if(settings["MinimizeOnMinimize"] != ui.minimizeOnMinimize->isChecked()) return true;
+ if(settings["MinimizeOnClose"] != ui.minimizeOnClose->isChecked()) return true;
+ if(settings["UserMessagesInStatusBuffer"] != ui.userMessagesInStatusBuffer->isChecked()) return true;
+ if(settings["UserMessagesInQueryBuffer"] != ui.userMessagesInQueryBuffer->isChecked()) return true;
+ if(settings["UserMessagesInCurrentBuffer"] != ui.userMessagesInCurrentBuffer->isChecked()) return true;
+
+ return false;
+}
+
+
+
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * 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) any later version. *
+ * *
+ * 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 _GENERALSETTINGSPAGE_H_
+#define _GENERALSETTINGSPAGE_H_
+
+#include <QHash>
+
+#include "settingspage.h"
+#include "ui_generalsettingspage.h"
+
+class GeneralSettingsPage : public SettingsPage {
+ Q_OBJECT
+
+ public:
+ GeneralSettingsPage(QWidget *parent = 0);
+
+ bool hasDefaults() const;
+
+ public slots:
+ void save();
+ void load();
+ void defaults();
+
+ private slots:
+ void widgetHasChanged();
+
+ private:
+ Ui::GeneralSettingsPage ui;
+ QHash<QString, QVariant> settings;
+
+ bool testHasChanged();
+};
+
+#endif
--- /dev/null
+<ui version="4.0" >
+ <class>GeneralSettingsPage</class>
+ <widget class="QWidget" name="GeneralSettingsPage" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>475</width>
+ <height>366</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QGroupBox" name="useSystemTrayIcon" >
+ <property name="title" >
+ <string>Use system tray icon:</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QCheckBox" name="minimizeOnMinimize" >
+ <property name="text" >
+ <string>Minimize to tray on minimize button</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="minimizeOnClose" >
+ <property name="text" >
+ <string>Minimize to tray on close button</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Display user related messages:</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QCheckBox" name="userMessagesInStatusBuffer" >
+ <property name="text" >
+ <string>in status buffer</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="userMessagesInQueryBuffer" >
+ <property name="text" >
+ <string> in query buffer (if exists)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="userMessagesInCurrentBuffer" >
+ <property name="text" >
+ <string>in current buffer</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
# Putting $FOO in SETTINGSPAGES automatically includes
# $FOOsettingspage.cpp, $FOOsettingspage.h and $FOOsettingspage.ui
-SETTINGSPAGES = fonts identities networks
+SETTINGSPAGES = fonts identities networks general
# Specify additional files (e.g. for subdialogs) here!
SP_SRCS =
quasselVersion = "0.2.0-pre";
quasselDate = "2008-02-08";
- quasselBuild = 480;
+ quasselBuild = 483;
//! Minimum client build number the core needs
clientBuildNeeded = 480;