From 4b3d1dfbdc5a541dbbdd6574e603f4351d8b3274 Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Wed, 29 Jun 2016 02:10:40 -0400 Subject: [PATCH] Move Chat View colors to new settings page Add new settings page Chat View Colors for "allowMircColors", "useCustomColors", "useSenderColors", and related color buttons. Remove the above settings from the general Chat View settings page. Add missing tab stops for "autoMarkerLineOnLostFocus" and "webSearchUrlFormat". This reduces visual clutter, improves organization, and saves vertical space, helpful for smaller screens. (~54 pixels saved vs 0.12.4, ~112 pixels saved vs all options in one) --- src/qtui/mainwin.cpp | 2 + .../chatviewcolorsettingspage.cpp | 44 ++ .../settingspages/chatviewcolorsettingspage.h | 62 ++ .../chatviewcolorsettingspage.ui | 727 ++++++++++++++++++ .../settingspages/chatviewsettingspage.cpp | 3 +- .../settingspages/chatviewsettingspage.ui | 690 +---------------- src/qtui/settingspages/settingspages.cmake | 1 + 7 files changed, 841 insertions(+), 688 deletions(-) create mode 100644 src/qtui/settingspages/chatviewcolorsettingspage.cpp create mode 100644 src/qtui/settingspages/chatviewcolorsettingspage.h create mode 100644 src/qtui/settingspages/chatviewcolorsettingspage.ui diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 37921675..6e681e44 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -140,6 +140,7 @@ #include "settingspages/bufferviewsettingspage.h" #include "settingspages/chatmonitorsettingspage.h" #include "settingspages/chatviewsettingspage.h" +#include "settingspages/chatviewcolorsettingspage.h" #include "settingspages/connectionsettingspage.h" #include "settingspages/coreaccountsettingspage.h" #include "settingspages/coreconnectionsettingspage.h" @@ -1384,6 +1385,7 @@ void MainWin::showSettingsDlg() //Category: Interface dlg->registerSettingsPage(new AppearanceSettingsPage(dlg)); dlg->registerSettingsPage(new ChatViewSettingsPage(dlg)); + dlg->registerSettingsPage(new ChatViewColorSettingsPage(dlg)); dlg->registerSettingsPage(new ChatMonitorSettingsPage(dlg)); dlg->registerSettingsPage(new ItemViewSettingsPage(dlg)); dlg->registerSettingsPage(new BufferViewSettingsPage(dlg)); diff --git a/src/qtui/settingspages/chatviewcolorsettingspage.cpp b/src/qtui/settingspages/chatviewcolorsettingspage.cpp new file mode 100644 index 00000000..69a4979b --- /dev/null +++ b/src/qtui/settingspages/chatviewcolorsettingspage.cpp @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2005-2016 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "chatviewcolorsettingspage.h" + +#include "client.h" +#include "colorbutton.h" +#include "qtui.h" +#include "qtuistyle.h" + +ChatViewColorSettingsPage::ChatViewColorSettingsPage(QWidget *parent) : + SettingsPage(tr("Interface"), tr("Chat View Colors"), parent) +{ + ui.setupUi(this); + + initAutoWidgets(); +} + + +void ChatViewColorSettingsPage::save() +{ + // Save the general settings + SettingsPage::save(); + // Update the stylesheet in case colors are changed + QtUi::style()->generateSettingsQss(); + QtUi::style()->reload(); +} diff --git a/src/qtui/settingspages/chatviewcolorsettingspage.h b/src/qtui/settingspages/chatviewcolorsettingspage.h new file mode 100644 index 00000000..6f21f3ca --- /dev/null +++ b/src/qtui/settingspages/chatviewcolorsettingspage.h @@ -0,0 +1,62 @@ +/*************************************************************************** + * Copyright (C) 2005-2016 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#pragma once + +#include "settingspage.h" +#include "ui_chatviewcolorsettingspage.h" + +class ColorButton; + +class ChatViewColorSettingsPage : public SettingsPage +{ + Q_OBJECT + +public: + /** + * Construct and initialize the ChatViewColorSettingsPage + * + * @param parent Parent QWidget object, such as the settings dialog + */ + explicit ChatViewColorSettingsPage(QWidget *parent = 0); + + /** + * Gets whether or not this settings page has defaults + * + * @return True if defaults available, otherwise false + */ + inline bool hasDefaults() const { return true; } + +public slots: + /** + * Save and apply current settings + */ + void save(); + +private: + Ui::ChatViewColorSettingsPage ui; /// Reference to the Qt settings page UI + + /** + * Gets the settings path for configuration values + * + * @return QString pointing to settings group and key for configuration values + */ + inline QString settingsKey() const { return QString("QtUi/ChatView/__default__"); } +}; diff --git a/src/qtui/settingspages/chatviewcolorsettingspage.ui b/src/qtui/settingspages/chatviewcolorsettingspage.ui new file mode 100644 index 00000000..3070a3a6 --- /dev/null +++ b/src/qtui/settingspages/chatviewcolorsettingspage.ui @@ -0,0 +1,727 @@ + + + ChatViewColorSettingsPage + + + + 0 + 0 + 486 + 398 + + + + Form + + + + + + Show colored text in the chat window + + + Allow colored text (mIRC color codes) + + + true + + + true + + + /UiStyle/AllowMircColors + + + + + + + Custom Colors + + + true + + + false + + + /QtUiStyle/Colors/UseChatViewColors + + + false + + + + + + Action: + + + + + + + ... + + + /QtUiStyle/Colors/ActionMsg + + + + 0 + 0 + 255 + + + + + + + + Timestamp: + + + + + + + ... + + + /QtUiStyle/Colors/Timestamp + + + + 112 + 124 + 112 + + + + + + + + Channel message: + + + + + + + ... + + + /QtUiStyle/Colors/ChannelMsg + + + + 0 + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 134 + 20 + + + + + + + + Highlight foreground: + + + + + + + ... + + + /QtUiStyle/Colors/Highlight + + + + 0 + 0 + 0 + + + + + + + + Command message: + + + + + + + ... + + + /QtUiStyle/Colors/CommandMsg + + + + 150 + 0 + 150 + + + + + + + + Highlight background: + + + + + + + Server message: + + + + + + + ... + + + /QtUiStyle/Colors/ServerMsg + + + + 145 + 100 + 9 + + + + + + + + Marker line: + + + + + + + ... + + + /QtUiStyle/Colors/MarkerLine + + + + 255 + 0 + 0 + + + + + + + + Error message: + + + + + + + ... + + + /QtUiStyle/Colors/ErrorMsg + + + + 145 + 100 + 9 + + + + + + + + Background: + + + + + + + ... + + + /QtUiStyle/Colors/ChatViewBackground + + + + 255 + 255 + 255 + + + + + + + + ... + + + /QtUiStyle/Colors/HighlightBackground + + + + 255 + 128 + 0 + + + + + + + + + + + Color senders in chat based on nicknames + + + Use Sender Coloring + + + true + + + true + + + /QtUiStyle/Colors/UseSenderColors + + + true + + + + + + + + ... + + + /QtUiStyle/Colors/Sender00 + + + + 233 + 13 + 127 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender02 + + + + 179 + 14 + 14 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender04 + + + + 88 + 175 + 179 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender05 + + + + 157 + 84 + 179 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender06 + + + + 179 + 151 + 117 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender07 + + + + 49 + 118 + 179 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender08 + + + + 233 + 13 + 127 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender09 + + + + 142 + 85 + 233 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender10 + + + + 179 + 14 + 14 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender11 + + + + 23 + 179 + 57 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender12 + + + + 88 + 175 + 179 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender13 + + + + 157 + 84 + 179 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender14 + + + + 179 + 151 + 117 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender15 + + + + 49 + 118 + 179 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender01 + + + + 142 + 85 + 233 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender03 + + + + 23 + 179 + 57 + + + + + + + + + + + + Own messages: + + + + + + + ... + + + /QtUiStyle/Colors/SenderSelf + + + + 0 + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Color sender nicknames in action messages, e.g.<br/>-*- <span style=" font-style:italic;">Nick</span> does an action + + + Color senders in action messages + + + true + + + /QtUiStyle/Colors/UseSenderActionColors + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + ColorButton + QToolButton +
colorbutton.h
+
+
+ + allowMircColors + useCustomColors + actionMsgColor + channelMsgColor + commandMsgColor + serverMsgColor + errorMsgColor + timestampColor + highlightColor + highlightBackgroundColor + markerLineColor + backgroundColor + useSenderColors + senderColor00 + senderColor01 + senderColor02 + senderColor03 + senderColor04 + senderColor05 + senderColor06 + senderColor07 + senderColor08 + senderColor09 + senderColor10 + senderColor11 + senderColor12 + senderColor13 + senderColor14 + senderColor15 + senderColorSelf + useSenderActionColors + + + +
diff --git a/src/qtui/settingspages/chatviewsettingspage.cpp b/src/qtui/settingspages/chatviewsettingspage.cpp index 47463881..924474c1 100644 --- a/src/qtui/settingspages/chatviewsettingspage.cpp +++ b/src/qtui/settingspages/chatviewsettingspage.cpp @@ -20,7 +20,6 @@ #include "chatviewsettingspage.h" #include "client.h" -#include "colorbutton.h" #include "qtui.h" #include "qtuistyle.h" @@ -47,7 +46,9 @@ ChatViewSettingsPage::ChatViewSettingsPage(QWidget *parent) void ChatViewSettingsPage::save() { + // Save the general settings SettingsPage::save(); + // Update the stylesheet in case fonts are changed QtUi::style()->generateSettingsQss(); QtUi::style()->reload(); } diff --git a/src/qtui/settingspages/chatviewsettingspage.ui b/src/qtui/settingspages/chatviewsettingspage.ui index 5e4eb245..b68c8726 100644 --- a/src/qtui/settingspages/chatviewsettingspage.ui +++ b/src/qtui/settingspages/chatviewsettingspage.ui @@ -7,7 +7,7 @@ 0 0 486 - 610 + 230 @@ -115,25 +115,6 @@ - - - - Show colored text in the chat window - - - Allow colored text (mIRC color codes) - - - true - - - true - - - /UiStyle/AllowMircColors - - - @@ -215,637 +196,6 @@ - - - - Custom Colors - - - true - - - false - - - /QtUiStyle/Colors/UseChatViewColors - - - false - - - - - - Action: - - - - - - - ... - - - /QtUiStyle/Colors/ActionMsg - - - - 0 - 0 - 255 - - - - - - - - Timestamp: - - - - - - - ... - - - /QtUiStyle/Colors/Timestamp - - - - 112 - 124 - 112 - - - - - - - - Channel message: - - - - - - - ... - - - /QtUiStyle/Colors/ChannelMsg - - - - 0 - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 134 - 20 - - - - - - - - Highlight foreground: - - - - - - - ... - - - /QtUiStyle/Colors/Highlight - - - - 0 - 0 - 0 - - - - - - - - Command message: - - - - - - - ... - - - /QtUiStyle/Colors/CommandMsg - - - - 150 - 0 - 150 - - - - - - - - Highlight background: - - - - - - - Server message: - - - - - - - ... - - - /QtUiStyle/Colors/ServerMsg - - - - 145 - 100 - 9 - - - - - - - - Marker line: - - - - - - - ... - - - /QtUiStyle/Colors/MarkerLine - - - - 255 - 0 - 0 - - - - - - - - Error message: - - - - - - - ... - - - /QtUiStyle/Colors/ErrorMsg - - - - 145 - 100 - 9 - - - - - - - - Background: - - - - - - - ... - - - /QtUiStyle/Colors/ChatViewBackground - - - - 255 - 255 - 255 - - - - - - - - ... - - - /QtUiStyle/Colors/HighlightBackground - - - - 255 - 128 - 0 - - - - - - - - - - - Use Sender Coloring - - - true - - - true - - - /QtUiStyle/Colors/UseSenderColors - - - true - - - - - - - - ... - - - /QtUiStyle/Colors/Sender00 - - - - 233 - 13 - 127 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender02 - - - - 179 - 14 - 14 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender04 - - - - 88 - 175 - 179 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender05 - - - - 157 - 84 - 179 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender06 - - - - 179 - 151 - 117 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender07 - - - - 49 - 118 - 179 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender08 - - - - 233 - 13 - 127 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender09 - - - - 142 - 85 - 233 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender10 - - - - 179 - 14 - 14 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender11 - - - - 23 - 179 - 57 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender12 - - - - 88 - 175 - 179 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender13 - - - - 157 - 84 - 179 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender14 - - - - 179 - 151 - 117 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender15 - - - - 49 - 118 - 179 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender01 - - - - 142 - 85 - 233 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender03 - - - - 23 - 179 - 57 - - - - - - - - - - - - Own messages: - - - - - - - ... - - - /QtUiStyle/Colors/SenderSelf - - - - 0 - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Color sender nicknames in action messages, e.g.<br/>-*- <span style=" font-style:italic;">Nick</span> does an action - - - Color senders in action messages - - - true - - - /QtUiStyle/Colors/UseSenderActionColors - - - true - - - - - - @@ -862,11 +212,6 @@ - - ColorButton - QToolButton -
colorbutton.h
-
FontSelector QWidget @@ -878,39 +223,10 @@ timestampFormat showSenderBrackets customChatViewFont - allowMircColors showWebPreview autoMarkerLine - useCustomColors - actionMsgColor - channelMsgColor - commandMsgColor - serverMsgColor - errorMsgColor - timestampColor - highlightColor - highlightBackgroundColor - markerLineColor - backgroundColor - useSenderColors - senderColor00 - senderColor01 - senderColor02 - senderColor03 - senderColor04 - senderColor05 - senderColor06 - senderColor07 - senderColor08 - senderColor09 - senderColor10 - senderColor11 - senderColor12 - senderColor13 - senderColor14 - senderColor15 - senderColorSelf - useSenderActionColors + autoMarkerLineOnLostFocus + webSearchUrlFormat diff --git a/src/qtui/settingspages/settingspages.cmake b/src/qtui/settingspages/settingspages.cmake index ded24d7e..c2705cbc 100644 --- a/src/qtui/settingspages/settingspages.cmake +++ b/src/qtui/settingspages/settingspages.cmake @@ -8,6 +8,7 @@ set(SETTINGSPAGES bufferview chatmonitor chatview + chatviewcolor connection coreconnection coreaccount -- 2.20.1