Diffstat (limited to 'noncore/net/opieirc/ircsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp index 78eaed3..b110a5b 100644 --- a/noncore/net/opieirc/ircsettings.cpp +++ b/noncore/net/opieirc/ircsettings.cpp | |||
@@ -1 +1,3 @@ | |||
1 | #include <opie/ocolorbutton.h> | ||
2 | #include <opie/otabwidget.h> | ||
1 | #include <qlayout.h> | 3 | #include <qlayout.h> |
@@ -13,10 +15,10 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
13 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); | 15 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); |
14 | QTabWidget *tw = new QTabWidget(this); | 16 | OTabWidget *tw = new OTabWidget(this); |
15 | l->addWidget(tw); | 17 | l->addWidget(tw); |
16 | /* General Configuration */ | 18 | /* General Configuration */ |
17 | QWidget *widget = new QWidget(tw); | 19 | QWidget *genwidget = new QWidget(tw); |
18 | QGridLayout *layout = new QGridLayout(widget, 1, 2, 5, 0); | 20 | QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0); |
19 | QLabel *label = new QLabel(tr("Lines displayed :"), widget); | 21 | QLabel *label = new QLabel(tr("Lines displayed :"), genwidget); |
20 | layout->addWidget(label, 0, 0); | 22 | layout->addWidget(label, 0, 0); |
21 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), widget); | 23 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget); |
22 | QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this")); | 24 | QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this")); |
@@ -27,8 +29,9 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
27 | layout->addWidget(m_lines, 0, 1); | 29 | layout->addWidget(m_lines, 0, 1); |
28 | tw->addTab(widget, tr("General")); | 30 | tw->addTab(genwidget, "opieirc/settings", tr("General")); |
29 | 31 | ||
30 | /* Color configuration */ | 32 | /* Color configuration */ |
31 | QScrollView *view = new QScrollView(tw); | 33 | QScrollView *view = new QScrollView(this); |
32 | view->setResizePolicy(QScrollView::AutoOneFit); | 34 | view->setResizePolicy(QScrollView::AutoOneFit); |
33 | widget = new QWidget(view->viewport()); | 35 | view->setFrameStyle( QFrame::NoFrame ); |
36 | QWidget *widget = new QWidget(view->viewport()); | ||
34 | view->addChild(widget); | 37 | view->addChild(widget); |
@@ -37,3 +40,3 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
37 | layout->addWidget(label, 0, 0); | 40 | layout->addWidget(label, 0, 0); |
38 | m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), widget); | 41 | m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF")); |
39 | QWhatsThis::add(m_background, tr("Background color to be used in chats")); | 42 | QWhatsThis::add(m_background, tr("Background color to be used in chats")); |
@@ -42,3 +45,3 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
42 | layout->addWidget(label, 1, 0); | 45 | layout->addWidget(label, 1, 0); |
43 | m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), widget); | 46 | m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000")); |
44 | QWhatsThis::add(m_text, tr("Text color to be used in chats")); | 47 | QWhatsThis::add(m_text, tr("Text color to be used in chats")); |
@@ -47,3 +50,3 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
47 | layout->addWidget(label, 2, 0); | 50 | layout->addWidget(label, 2, 0); |
48 | m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), widget); | 51 | m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000")); |
49 | QWhatsThis::add(m_error, tr("Text color to be used to display errors")); | 52 | QWhatsThis::add(m_error, tr("Text color to be used to display errors")); |
@@ -52,3 +55,3 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
52 | layout->addWidget(label, 3, 0); | 55 | layout->addWidget(label, 3, 0); |
53 | m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), widget); | 56 | m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000")); |
54 | QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself")); | 57 | QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself")); |
@@ -57,3 +60,3 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
57 | layout->addWidget(label, 4, 0); | 60 | layout->addWidget(label, 4, 0); |
58 | m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), widget); | 61 | m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB")); |
59 | QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others")); | 62 | QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others")); |
@@ -62,3 +65,3 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
62 | layout->addWidget(label, 5, 0); | 65 | layout->addWidget(label, 5, 0); |
63 | m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), widget); | 66 | m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF")); |
64 | QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server")); | 67 | QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server")); |
@@ -67,6 +70,7 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
67 | layout->addWidget(label, 6, 0); | 70 | layout->addWidget(label, 6, 0); |
68 | m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), widget); | 71 | m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#AAE300")); |
69 | QWhatsThis::add(m_notification, tr("Text color to be used to display notifications")); | 72 | QWhatsThis::add(m_notification, tr("Text color to be used to display notifications")); |
70 | layout->addWidget(m_notification, 6, 1); | 73 | layout->addWidget(m_notification, 6, 1); |
71 | tw->addTab(view, tr("Colors")); | 74 | tw->addTab(view, "opieirc/colors", tr("Colors")); |
75 | tw->setCurrentTab( genwidget ); | ||
72 | showMaximized(); | 76 | showMaximized(); |
@@ -74,25 +78,18 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) | |||
74 | 78 | ||
75 | QString IRCSettings::getColorString(QWidget *widget) { | ||
76 | QColor color = ((IRCFramedColorLabel *)widget)->color(); | ||
77 | QString temp; | ||
78 | temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue()); | ||
79 | return temp; | ||
80 | } | ||
81 | |||
82 | void IRCSettings::accept() { | 79 | void IRCSettings::accept() { |
83 | IRCTab::m_backgroundColor = getColorString(m_background); | 80 | IRCTab::m_backgroundColor = m_background->color().name(); |
84 | IRCTab::m_textColor = getColorString(m_text); | 81 | IRCTab::m_textColor = m_text->color().name(); |
85 | IRCTab::m_errorColor = getColorString(m_error); | 82 | IRCTab::m_errorColor = m_error->color().name(); |
86 | IRCTab::m_selfColor = getColorString(m_self); | 83 | IRCTab::m_selfColor = m_self->color().name(); |
87 | IRCTab::m_otherColor = getColorString(m_other); | 84 | IRCTab::m_otherColor = m_other->color().name(); |
88 | IRCTab::m_serverColor = getColorString(m_server); | 85 | IRCTab::m_serverColor = m_server->color().name(); |
89 | IRCTab::m_notificationColor = getColorString(m_notification); | 86 | IRCTab::m_notificationColor = m_notification->color().name(); |
90 | IRCTab::m_maxLines = m_lines->text().toInt(); | 87 | IRCTab::m_maxLines = m_lines->text().toInt(); |
91 | m_config->writeEntry("BackgroundColor", getColorString(m_background)); | 88 | m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); |
92 | m_config->writeEntry("TextColor", getColorString(m_text)); | 89 | m_config->writeEntry("TextColor", IRCTab::m_textColor); |
93 | m_config->writeEntry("ErrorColor", getColorString(m_error)); | 90 | m_config->writeEntry("ErrorColor", IRCTab::m_errorColor); |
94 | m_config->writeEntry("SelfColor", getColorString(m_self)); | 91 | m_config->writeEntry("SelfColor", IRCTab::m_selfColor); |
95 | m_config->writeEntry("OtherColor", getColorString(m_other)); | 92 | m_config->writeEntry("OtherColor", IRCTab::m_otherColor); |
96 | m_config->writeEntry("ServerColor", getColorString(m_server)); | 93 | m_config->writeEntry("ServerColor", IRCTab::m_serverColor); |
97 | m_config->writeEntry("NotificationColor", getColorString(m_notification)); | 94 | m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor); |
98 | m_config->writeEntry("Lines", m_lines->text()); | 95 | m_config->writeEntry("Lines", m_lines->text()); |