cfgircappearance.cpp
1 //------------------------------------------------------------------------------
2 // cfgircappearance.cpp
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #include "cfgircappearance.h"
24 #include "ui_cfgircappearance.h"
25 #include "irc/configuration/ircconfig.h"
26 
27 DClass<CFGIRCAppearance> : public Ui::CFGIRCAppearance
28 {
29 };
30 
31 DPointered(CFGIRCAppearance)
32 
33 CFGIRCAppearance::CFGIRCAppearance(QWidget* parent)
34 : ConfigPage(parent)
35 {
36  d->setupUi(this);
37 }
38 
39 CFGIRCAppearance::~CFGIRCAppearance()
40 {
41 }
42 
44 {
45  // Colors
46  d->btnBackgroundColor->setColorHtml(gIRCConfig.appearance.backgroundColor);
47  d->btnChannelActionColor->setColorHtml(gIRCConfig.appearance.channelActionColor);
48  d->btnCtcpColor->setColorHtml(gIRCConfig.appearance.ctcpColor);
49  d->btnDefaultTextColor->setColorHtml(gIRCConfig.appearance.defaultTextColor);
50  d->btnErrorColor->setColorHtml(gIRCConfig.appearance.errorColor);
51  d->btnNetworkActionColor->setColorHtml(gIRCConfig.appearance.networkActionColor);
52  d->btnUrlColor->setColorHtml(gIRCConfig.appearance.urlColor);
53  d->btnUserListSelectedTextColor->setColorHtml(gIRCConfig.appearance.userListSelectedTextColor);
54  d->btnUserListSelectedBackgroundColor->setColorHtml(gIRCConfig.appearance.userListSelectedBackgroundColor);
55 
56  // Fonts
57  d->btnMainFont->setSelectedFont(gIRCConfig.appearance.mainFont);
58  d->btnUserListFont->setSelectedFont(gIRCConfig.appearance.userListFont);
59 
60  // Others
61  d->cbTimestamps->setChecked(gIRCConfig.appearance.timestamps);
62  d->cbWindowAlertOnImportantEvent->setChecked(gIRCConfig.appearance.windowAlertOnImportantChatEvent);
63 }
64 
66 {
67  // Colors
68  gIRCConfig.appearance.backgroundColor = d->btnBackgroundColor->colorHtml();
69  gIRCConfig.appearance.channelActionColor = d->btnChannelActionColor->colorHtml();
70  gIRCConfig.appearance.ctcpColor = d->btnCtcpColor->colorHtml();
71  gIRCConfig.appearance.defaultTextColor = d->btnDefaultTextColor->colorHtml();
72  gIRCConfig.appearance.errorColor = d->btnErrorColor->colorHtml();
73  gIRCConfig.appearance.networkActionColor = d->btnNetworkActionColor->colorHtml();
74  gIRCConfig.appearance.urlColor = d->btnUrlColor->colorHtml();
75  gIRCConfig.appearance.userListSelectedTextColor = d->btnUserListSelectedTextColor->colorHtml();
76  gIRCConfig.appearance.userListSelectedBackgroundColor = d->btnUserListSelectedBackgroundColor->colorHtml();
77 
78  // Fonts
79  gIRCConfig.appearance.mainFont = d->btnMainFont->selectedFont();
80  gIRCConfig.appearance.userListFont = d->btnUserListFont->selectedFont();
81 
82  // Others
83  gIRCConfig.appearance.timestamps = d->cbTimestamps->isChecked();
84  gIRCConfig.appearance.windowAlertOnImportantChatEvent = d->cbWindowAlertOnImportantEvent->isChecked();
85 }
void saveSettings()
Reimplement this to write settings to config from widgets.
void readSettings()
Reimplement this to read settings from config into widgets.
Base class for configuration pages.
Definition: configpage.h:44