summaryrefslogtreecommitdiff
authordrw <drw>2002-12-30 00:52:51 (UTC)
committer drw <drw>2002-12-30 00:52:51 (UTC)
commitc7bbdeed0daeda9af5115ffa0f1fb1026a338e2d (patch) (unidiff)
tree641b0a344cc9e274c39df282c4478dd74644d813
parent9ec4adfb12bd5c92427a79c6b63a064a0033a67a (diff)
downloadopie-c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d.zip
opie-c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d.tar.gz
opie-c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d.tar.bz2
Use OTabWidget & OColorButtons in config dialog for consistency w/other apps (reduces executable size by ~4k as well).
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp29
-rw-r--r--noncore/net/opieirc/ircmisc.h21
-rw-r--r--noncore/net/opieirc/ircsettings.cpp71
-rw-r--r--noncore/net/opieirc/ircsettings.h21
-rw-r--r--noncore/net/opieirc/mainwindow.cpp2
-rw-r--r--noncore/net/opieirc/opie-irc.control2
6 files changed, 47 insertions, 99 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index f94cf1b..a15a790 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,39 +1,10 @@
1#include <opie/colordialog.h>
2#include <qlayout.h> 1#include <qlayout.h>
3#include <stdio.h> 2#include <stdio.h>
4#include "ircmisc.h" 3#include "ircmisc.h"
5 4
6IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) {
7 m_color = color;
8 setAlignment(AlignVCenter | AlignCenter);
9 setFrameStyle(QFrame::StyledPanel);
10 setFrameShadow(QFrame::Sunken);
11 setBackgroundColor(m_color);
12}
13
14void IRCColorLabel::mousePressEvent(QMouseEvent *) {
15 m_color = OColorDialog::getColor(m_color);
16 setBackgroundColor(m_color);
17}
18
19QColor IRCColorLabel::color() {
20 return m_color;
21}
22
23IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
24 QVBoxLayout *layout = new QVBoxLayout(this, 10, 0);
25 m_label = new IRCColorLabel(color, this);
26 layout->addWidget(m_label);
27}
28
29QColor IRCFramedColorLabel::color() {
30 return m_label->color();
31}
32
33
34IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { 5IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
35} 6}
36 7
37int IRCTabBar::insertTab(QTab *tab, int index) { 8int IRCTabBar::insertTab(QTab *tab, int index) {
38 /* FIXME: find some nicer way to do this */ 9 /* FIXME: find some nicer way to do this */
39 QExtTab *ext = new QExtTab(); 10 QExtTab *ext = new QExtTab();
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h
index 6a8db50..b4a5b06 100644
--- a/noncore/net/opieirc/ircmisc.h
+++ b/noncore/net/opieirc/ircmisc.h
@@ -25,33 +25,12 @@
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qtabbar.h> 26#include <qtabbar.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcolor.h> 28#include <qcolor.h>
29#include <qarray.h> 29#include <qarray.h>
30 30
31/* IRCFramedColorLabel is used to display a color */
32
33class IRCColorLabel : public QLabel {
34 Q_OBJECT
35public:
36 IRCColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
37 QColor color();
38 void mousePressEvent(QMouseEvent *event);
39protected:
40 QColor m_color;
41};
42
43class IRCFramedColorLabel : public QWidget {
44 Q_OBJECT
45public:
46 IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
47 QColor color();
48protected:
49 IRCColorLabel *m_label;
50};
51
52/* Custom colored QTabWidget */ 31/* Custom colored QTabWidget */
53 32
54class QExtTab : public QTab { 33class QExtTab : public QTab {
55public: 34public:
56 QColor color; 35 QColor color;
57}; 36};
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,6 +1,8 @@
1#include <opie/ocolorbutton.h>
2#include <opie/otabwidget.h>
1#include <qlayout.h> 3#include <qlayout.h>
2#include <qvalidator.h> 4#include <qvalidator.h>
3#include <qscrollview.h> 5#include <qscrollview.h>
4#include <qwhatsthis.h> 6#include <qwhatsthis.h>
5#include "ircsettings.h" 7#include "ircsettings.h"
6#include "irctab.h" 8#include "irctab.h"
@@ -8,96 +10,91 @@
8 10
9IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { 11IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
10 setCaption("Settings"); 12 setCaption("Settings");
11 m_config = new Config("OpieIRC"); 13 m_config = new Config("OpieIRC");
12 m_config->setGroup("OpieIRC"); 14 m_config->setGroup("OpieIRC");
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"));
23 QIntValidator *validator = new QIntValidator(this); 25 QIntValidator *validator = new QIntValidator(this);
24 validator->setTop(10000); 26 validator->setTop(10000);
25 validator->setBottom(0); 27 validator->setBottom(0);
26 m_lines->setValidator(validator); 28 m_lines->setValidator(validator);
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);
35 layout = new QGridLayout(widget, 7, 2, 5, 0); 38 layout = new QGridLayout(widget, 7, 2, 5, 0);
36 label = new QLabel(tr("Background color :"), widget); 39 label = new QLabel(tr("Background color :"), widget);
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"));
40 layout->addWidget(m_background, 0, 1); 43 layout->addWidget(m_background, 0, 1);
41 label = new QLabel(tr("Normal text color :"), widget); 44 label = new QLabel(tr("Normal text color :"), widget);
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"));
45 layout->addWidget(m_text, 1, 1); 48 layout->addWidget(m_text, 1, 1);
46 label = new QLabel(tr("Error color :"), widget); 49 label = new QLabel(tr("Error color :"), widget);
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"));
50 layout->addWidget(m_error, 2, 1); 53 layout->addWidget(m_error, 2, 1);
51 label = new QLabel(tr("Text written by yourself :"), widget); 54 label = new QLabel(tr("Text written by yourself :"), widget);
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"));
55 layout->addWidget(m_self, 3, 1); 58 layout->addWidget(m_self, 3, 1);
56 label = new QLabel(tr("Text written by others :"), widget); 59 label = new QLabel(tr("Text written by others :"), widget);
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"));
60 layout->addWidget(m_other, 4, 1); 63 layout->addWidget(m_other, 4, 1);
61 label = new QLabel(tr("Text written by the server :"), widget); 64 label = new QLabel(tr("Text written by the server :"), widget);
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"));
65 layout->addWidget(m_server, 5, 1); 68 layout->addWidget(m_server, 5, 1);
66 label = new QLabel(tr("Notifications :"), widget); 69 label = new QLabel(tr("Notifications :"), widget);
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();
73} 77}
74 78
75QString 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
82void IRCSettings::accept() { 79void 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());
99 QDialog::accept(); 96 QDialog::accept();
100} 97}
101 98
102IRCSettings::~IRCSettings() { 99IRCSettings::~IRCSettings() {
103 delete m_config; 100 delete m_config;
diff --git a/noncore/net/opieirc/ircsettings.h b/noncore/net/opieirc/ircsettings.h
index 190abaf..cb8d896 100644
--- a/noncore/net/opieirc/ircsettings.h
+++ b/noncore/net/opieirc/ircsettings.h
@@ -22,27 +22,28 @@
22#define __IRCSETTINGS_H 22#define __IRCSETTINGS_H
23 23
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qdialog.h> 25#include <qdialog.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27 27
28class OColorButton;
29
28class IRCSettings : public QDialog { 30class IRCSettings : public QDialog {
29 Q_OBJECT 31 Q_OBJECT
30public: 32public:
31 IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0); 33 IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0);
32 QString getColorString(QWidget *widget);
33 ~IRCSettings(); 34 ~IRCSettings();
34protected slots: 35protected slots:
35 void accept(); 36 void accept();
36protected: 37protected:
37 Config *m_config; 38 Config *m_config;
38 QWidget *m_background; 39 OColorButton *m_background;
39 QWidget *m_text; 40 OColorButton *m_text;
40 QWidget *m_error; 41 OColorButton *m_error;
41 QWidget *m_self; 42 OColorButton *m_self;
42 QWidget *m_server; 43 OColorButton *m_server;
43 QWidget *m_other; 44 OColorButton *m_other;
44 QWidget *m_notification; 45 OColorButton *m_notification;
45 QLineEdit *m_lines; 46 QLineEdit *m_lines;
46}; 47};
47 48
48#endif /* __IRCSETTINGS_H */ 49#endif /* __IRCSETTINGS_H */
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 7928310..c0e2ff1 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -20,13 +20,13 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(
20 QPopupMenu *irc = new QPopupMenu(this); 20 QPopupMenu *irc = new QPopupMenu(this);
21 menuBar->insertItem(tr("IRC"), irc); 21 menuBar->insertItem(tr("IRC"), irc);
22 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); 22 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
23 connect(a, SIGNAL(activated()), this, SLOT(newConnection())); 23 connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
24 a->setWhatsThis(tr("Create a new connection to an IRC server")); 24 a->setWhatsThis(tr("Create a new connection to an IRC server"));
25 a->addTo(irc); 25 a->addTo(irc);
26 a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); 26 a = new QAction(tr("Settings"), Resource::loadPixmap("opieirc/settings"), QString::null, 0, this, 0);
27 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); 27 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
28 connect(a, SIGNAL(activated()), this, SLOT(settings())); 28 connect(a, SIGNAL(activated()), this, SLOT(settings()));
29 a->addTo(irc); 29 a->addTo(irc);
30 loadSettings(); 30 loadSettings();
31} 31}
32 32
diff --git a/noncore/net/opieirc/opie-irc.control b/noncore/net/opieirc/opie-irc.control
index 0bcdecd..b0cdfde 100644
--- a/noncore/net/opieirc/opie-irc.control
+++ b/noncore/net/opieirc/opie-irc.control
@@ -1,8 +1,8 @@
1Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc 1Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc
2Priority: optional 2Priority: optional
3Section: Communications 3Section: Communications
4Maintainer: Wenzel Jakob <root@wazlaf.de> 4Maintainer: Wenzel Jakob <root@wazlaf.de>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
8Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer 8Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer