author | wazlaf <wazlaf> | 2002-09-30 13:43:36 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-30 13:43:36 (UTC) |
commit | 5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d (patch) (unidiff) | |
tree | 12d8e59152c434e0774f067d5b0163578d603daf /noncore/net/opieirc/ircsettings.cpp | |
parent | b753c264b7acd26aba9f5a73c1fa0a7deb0b73a3 (diff) | |
download | opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.zip opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.gz opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.bz2 |
history functionality, tabs switch colors, extended settings dialog
Diffstat (limited to 'noncore/net/opieirc/ircsettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp index d1fef67..1903e87 100644 --- a/noncore/net/opieirc/ircsettings.cpp +++ b/noncore/net/opieirc/ircsettings.cpp | |||
@@ -1,46 +1,68 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qvalidator.h> | ||
3 | #include <qscrollview.h> | ||
2 | #include "ircsettings.h" | 4 | #include "ircsettings.h" |
3 | #include "irctab.h" | 5 | #include "irctab.h" |
4 | #include "ircmisc.h" | 6 | #include "ircmisc.h" |
5 | #include <stdio.h> | ||
6 | 7 | ||
7 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags f) : QDialog(parent, name, modal, f) { | 8 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags f) : QDialog(parent, name, modal, f) { |
9 | setCaption("Settings"); | ||
8 | m_config = new Config("OpieIRC"); | 10 | m_config = new Config("OpieIRC"); |
9 | m_config->setGroup("OpieIRC"); | 11 | m_config->setGroup("OpieIRC"); |
12 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); | ||
13 | QTabWidget *tw = new QTabWidget(this); | ||
14 | l->addWidget(tw); | ||
15 | /* General Configuration */ | ||
16 | QWidget *widget = new QWidget(tw); | ||
17 | QGridLayout *layout = new QGridLayout(widget, 1, 2, 5, 0); | ||
18 | QLabel *label = new QLabel(tr("Lines displayed :"), widget); | ||
19 | layout->addWidget(label, 0, 0); | ||
20 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), widget); | ||
21 | QIntValidator *validator = new QIntValidator(this); | ||
22 | validator->setTop(10000); | ||
23 | validator->setBottom(0); | ||
24 | m_lines->setValidator(validator); | ||
25 | layout->addWidget(m_lines, 0, 1); | ||
26 | tw->addTab(widget, tr("General")); | ||
10 | 27 | ||
11 | setCaption("Settings"); | 28 | /* Color configuration */ |
12 | QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 0); | 29 | QScrollView *view = new QScrollView(tw); |
13 | QLabel *label = new QLabel(tr("Background color :"), this); | 30 | view->setResizePolicy(QScrollView::AutoOneFit); |
31 | widget = new QWidget(view->viewport()); | ||
32 | view->addChild(widget); | ||
33 | layout = new QGridLayout(widget, 7, 2, 5, 0); | ||
34 | label = new QLabel(tr("Background color :"), widget); | ||
14 | layout->addWidget(label, 0, 0); | 35 | layout->addWidget(label, 0, 0); |
15 | m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), this); | 36 | m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), widget); |
16 | layout->addWidget(m_background, 0, 1); | 37 | layout->addWidget(m_background, 0, 1); |
17 | label = new QLabel(tr("Normal text color :"), this); | 38 | label = new QLabel(tr("Normal text color :"), widget); |
18 | layout->addWidget(label, 1, 0); | 39 | layout->addWidget(label, 1, 0); |
19 | m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), this); | 40 | m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), widget); |
20 | layout->addWidget(m_text, 1, 1); | 41 | layout->addWidget(m_text, 1, 1); |
21 | label = new QLabel(tr("Error color :"), this); | 42 | label = new QLabel(tr("Error color :"), widget); |
22 | layout->addWidget(label, 2, 0); | 43 | layout->addWidget(label, 2, 0); |
23 | m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), this); | 44 | m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), widget); |
24 | layout->addWidget(m_error, 2, 1); | 45 | layout->addWidget(m_error, 2, 1); |
25 | label = new QLabel(tr("Text written by yourself :"), this); | 46 | label = new QLabel(tr("Text written by yourself :"), widget); |
26 | layout->addWidget(label, 3, 0); | 47 | layout->addWidget(label, 3, 0); |
27 | m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), this); | 48 | m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), widget); |
28 | layout->addWidget(m_self, 3, 1); | 49 | layout->addWidget(m_self, 3, 1); |
29 | label = new QLabel(tr("Text written by others :"), this); | 50 | label = new QLabel(tr("Text written by others :"), widget); |
30 | layout->addWidget(label, 4, 0); | 51 | layout->addWidget(label, 4, 0); |
31 | m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), this); | 52 | m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), widget); |
32 | layout->addWidget(m_other, 4, 1); | 53 | layout->addWidget(m_other, 4, 1); |
33 | label = new QLabel(tr("Text written by the server :"), this); | 54 | label = new QLabel(tr("Text written by the server :"), widget); |
34 | layout->addWidget(label, 5, 0); | 55 | layout->addWidget(label, 5, 0); |
35 | m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), this); | 56 | m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), widget); |
36 | layout->addWidget(m_server, 5, 1); | 57 | layout->addWidget(m_server, 5, 1); |
37 | label = new QLabel(tr("Notifications :"), this); | 58 | label = new QLabel(tr("Notifications :"), widget); |
38 | layout->addWidget(label, 6, 0); | 59 | layout->addWidget(label, 6, 0); |
39 | m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), this); | 60 | m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), widget); |
40 | layout->addWidget(m_notification, 6, 1); | 61 | layout->addWidget(m_notification, 6, 1); |
62 | tw->addTab(view, tr("Colors")); | ||
41 | showMaximized(); | 63 | showMaximized(); |
42 | } | 64 | } |
43 | 65 | ||
44 | QString IRCSettings::getColorString(QWidget *widget) { | 66 | QString IRCSettings::getColorString(QWidget *widget) { |
45 | QColor color = ((IRCFramedColorLabel *)widget)->color(); | 67 | QColor color = ((IRCFramedColorLabel *)widget)->color(); |
46 | QString temp; | 68 | QString temp; |
@@ -53,19 +75,21 @@ void IRCSettings::accept() { | |||
53 | IRCTab::m_textColor = getColorString(m_text); | 75 | IRCTab::m_textColor = getColorString(m_text); |
54 | IRCTab::m_errorColor = getColorString(m_error); | 76 | IRCTab::m_errorColor = getColorString(m_error); |
55 | IRCTab::m_selfColor = getColorString(m_self); | 77 | IRCTab::m_selfColor = getColorString(m_self); |
56 | IRCTab::m_otherColor = getColorString(m_other); | 78 | IRCTab::m_otherColor = getColorString(m_other); |
57 | IRCTab::m_serverColor = getColorString(m_server); | 79 | IRCTab::m_serverColor = getColorString(m_server); |
58 | IRCTab::m_notificationColor = getColorString(m_notification); | 80 | IRCTab::m_notificationColor = getColorString(m_notification); |
81 | IRCTab::m_maxLines = m_lines->text().toInt(); | ||
59 | m_config->writeEntry("BackgroundColor", getColorString(m_background)); | 82 | m_config->writeEntry("BackgroundColor", getColorString(m_background)); |
60 | m_config->writeEntry("TextColor", getColorString(m_text)); | 83 | m_config->writeEntry("TextColor", getColorString(m_text)); |
61 | m_config->writeEntry("ErrorColor", getColorString(m_error)); | 84 | m_config->writeEntry("ErrorColor", getColorString(m_error)); |
62 | m_config->writeEntry("SelfColor", getColorString(m_self)); | 85 | m_config->writeEntry("SelfColor", getColorString(m_self)); |
63 | m_config->writeEntry("OtherColor", getColorString(m_other)); | 86 | m_config->writeEntry("OtherColor", getColorString(m_other)); |
64 | m_config->writeEntry("ServerColor", getColorString(m_server)); | 87 | m_config->writeEntry("ServerColor", getColorString(m_server)); |
65 | m_config->writeEntry("NotificationColor", getColorString(m_notification)); | 88 | m_config->writeEntry("NotificationColor", getColorString(m_notification)); |
89 | m_config->writeEntry("Lines", m_lines->text()); | ||
66 | QDialog::accept(); | 90 | QDialog::accept(); |
67 | } | 91 | } |
68 | 92 | ||
69 | IRCSettings::~IRCSettings() { | 93 | IRCSettings::~IRCSettings() { |
70 | delete m_config; | 94 | delete m_config; |
71 | } | 95 | } |