author | drw <drw> | 2002-12-30 00:52:51 (UTC) |
---|---|---|
committer | drw <drw> | 2002-12-30 00:52:51 (UTC) |
commit | c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d (patch) (unidiff) | |
tree | 641b0a344cc9e274c39df282c4478dd74644d813 | |
parent | 9ec4adfb12bd5c92427a79c6b63a064a0033a67a (diff) | |
download | opie-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).
-rw-r--r-- | noncore/net/opieirc/ircmisc.cpp | 29 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.h | 21 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 71 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.h | 21 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/opie-irc.control | 2 |
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,113 +1,84 @@ | |||
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 | ||
6 | IRCColorLabel::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 | |||
14 | void IRCColorLabel::mousePressEvent(QMouseEvent *) { | ||
15 | m_color = OColorDialog::getColor(m_color); | ||
16 | setBackgroundColor(m_color); | ||
17 | } | ||
18 | |||
19 | QColor IRCColorLabel::color() { | ||
20 | return m_color; | ||
21 | } | ||
22 | |||
23 | IRCFramedColorLabel::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 | |||
29 | QColor IRCFramedColorLabel::color() { | ||
30 | return m_label->color(); | ||
31 | } | ||
32 | |||
33 | |||
34 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { | 5 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { |
35 | } | 6 | } |
36 | 7 | ||
37 | int IRCTabBar::insertTab(QTab *tab, int index) { | 8 | int 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(); |
40 | ext->color = black; | 11 | ext->color = black; |
41 | ext->label = tab->text(); | 12 | ext->label = tab->text(); |
42 | ext->r = tab->rect(); | 13 | ext->r = tab->rect(); |
43 | ext->enabled = tab->isEnabled(); | 14 | ext->enabled = tab->isEnabled(); |
44 | ext->iconset = tab->iconSet(); | 15 | ext->iconset = tab->iconSet(); |
45 | delete tab; | 16 | delete tab; |
46 | return QTabBar::insertTab(ext, index); | 17 | return QTabBar::insertTab(ext, index); |
47 | } | 18 | } |
48 | 19 | ||
49 | void IRCTabBar::setTabColor(int index, QColor color) { | 20 | void IRCTabBar::setTabColor(int index, QColor color) { |
50 | ((QExtTab *)tab(index))->color = color; | 21 | ((QExtTab *)tab(index))->color = color; |
51 | update(); | 22 | update(); |
52 | } | 23 | } |
53 | 24 | ||
54 | void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { | 25 | void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { |
55 | QRect r = br; | 26 | QRect r = br; |
56 | QTabBar::paintLabel(p, br, t, focus); | 27 | QTabBar::paintLabel(p, br, t, focus); |
57 | if (t->id == currentTab()) | 28 | if (t->id == currentTab()) |
58 | r.setBottom(r.bottom() - style().defaultFrameWidth()); | 29 | r.setBottom(r.bottom() - style().defaultFrameWidth()); |
59 | p->setPen(((QExtTab *)t)->color); | 30 | p->setPen(((QExtTab *)t)->color); |
60 | p->drawText(r, AlignCenter | ShowPrefix, t->label); | 31 | p->drawText(r, AlignCenter | ShowPrefix, t->label); |
61 | } | 32 | } |
62 | 33 | ||
63 | IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { | 34 | IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { |
64 | setTabBar(new IRCTabBar(this, "tab control")); | 35 | setTabBar(new IRCTabBar(this, "tab control")); |
65 | } | 36 | } |
66 | 37 | ||
67 | void IRCTabWidget::setTabColor(int index, QColor color) { | 38 | void IRCTabWidget::setTabColor(int index, QColor color) { |
68 | ((IRCTabBar *)tabBar())->setTabColor(index, color); | 39 | ((IRCTabBar *)tabBar())->setTabColor(index, color); |
69 | } | 40 | } |
70 | 41 | ||
71 | 42 | ||
72 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { | 43 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { |
73 | m_index = -1; | 44 | m_index = -1; |
74 | installEventFilter(this); | 45 | installEventFilter(this); |
75 | } | 46 | } |
76 | 47 | ||
77 | void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { | 48 | void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { |
78 | int key = event->key(); | 49 | int key = event->key(); |
79 | if (key == Key_Up) { | 50 | if (key == Key_Up) { |
80 | if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { | 51 | if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { |
81 | m_index++; | 52 | m_index++; |
82 | setText(m_history[m_index]); | 53 | setText(m_history[m_index]); |
83 | } | 54 | } |
84 | } else if (key == Key_Down) { | 55 | } else if (key == Key_Down) { |
85 | if (m_history.count() > 0 && m_index > 0) { | 56 | if (m_history.count() > 0 && m_index > 0) { |
86 | m_index--; | 57 | m_index--; |
87 | setText(m_history[m_index]); | 58 | setText(m_history[m_index]); |
88 | } | 59 | } |
89 | if (m_index == 0) { | 60 | if (m_index == 0) { |
90 | m_index = -1; | 61 | m_index = -1; |
91 | setText(""); | 62 | setText(""); |
92 | } | 63 | } |
93 | } else if (key == Key_Return) { | 64 | } else if (key == Key_Return) { |
94 | m_history.prepend(text()); | 65 | m_history.prepend(text()); |
95 | m_index = -1; | 66 | m_index = -1; |
96 | } else if (key == Key_Tab) { | 67 | } else if (key == Key_Tab) { |
97 | printf("got tab\n"); | 68 | printf("got tab\n"); |
98 | return; | 69 | return; |
99 | } | 70 | } |
100 | QLineEdit::keyPressEvent(event); | 71 | QLineEdit::keyPressEvent(event); |
101 | } | 72 | } |
102 | 73 | ||
103 | bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { | 74 | bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { |
104 | if (event->type() == QEvent::KeyPress) { | 75 | if (event->type() == QEvent::KeyPress) { |
105 | QKeyEvent *k = (QKeyEvent *) event; | 76 | QKeyEvent *k = (QKeyEvent *) event; |
106 | /* Catch tab characters */ | 77 | /* Catch tab characters */ |
107 | if (k->key() == Key_Tab) { | 78 | if (k->key() == Key_Tab) { |
108 | qDebug("tab!"); | 79 | qDebug("tab!"); |
109 | return TRUE; | 80 | return TRUE; |
110 | } | 81 | } |
111 | } | 82 | } |
112 | return QLineEdit::eventFilter(object, event); | 83 | return QLineEdit::eventFilter(object, event); |
113 | } | 84 | } |
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 | |||
@@ -1,92 +1,71 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCMISC_H | 21 | #ifndef __IRCMISC_H |
22 | #define __IRCMISC_H | 22 | #define __IRCMISC_H |
23 | 23 | ||
24 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
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 | |||
33 | class IRCColorLabel : public QLabel { | ||
34 | Q_OBJECT | ||
35 | public: | ||
36 | IRCColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
37 | QColor color(); | ||
38 | void mousePressEvent(QMouseEvent *event); | ||
39 | protected: | ||
40 | QColor m_color; | ||
41 | }; | ||
42 | |||
43 | class IRCFramedColorLabel : public QWidget { | ||
44 | Q_OBJECT | ||
45 | public: | ||
46 | IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
47 | QColor color(); | ||
48 | protected: | ||
49 | IRCColorLabel *m_label; | ||
50 | }; | ||
51 | |||
52 | /* Custom colored QTabWidget */ | 31 | /* Custom colored QTabWidget */ |
53 | 32 | ||
54 | class QExtTab : public QTab { | 33 | class QExtTab : public QTab { |
55 | public: | 34 | public: |
56 | QColor color; | 35 | QColor color; |
57 | }; | 36 | }; |
58 | 37 | ||
59 | class IRCTabWidget : public QTabWidget { | 38 | class IRCTabWidget : public QTabWidget { |
60 | Q_OBJECT | 39 | Q_OBJECT |
61 | public: | 40 | public: |
62 | IRCTabWidget(QWidget *parent = 0, const char *name = 0); | 41 | IRCTabWidget(QWidget *parent = 0, const char *name = 0); |
63 | void setTabColor(int index, QColor color); | 42 | void setTabColor(int index, QColor color); |
64 | }; | 43 | }; |
65 | 44 | ||
66 | class IRCTabBar : public QTabBar { | 45 | class IRCTabBar : public QTabBar { |
67 | Q_OBJECT | 46 | Q_OBJECT |
68 | public: | 47 | public: |
69 | IRCTabBar(QWidget *parent = 0, const char *name = 0); | 48 | IRCTabBar(QWidget *parent = 0, const char *name = 0); |
70 | void setTabColor(int index, QColor color); | 49 | void setTabColor(int index, QColor color); |
71 | protected: | 50 | protected: |
72 | void paintLabel(QPainter*, const QRect&, QTab*, bool) const; | 51 | void paintLabel(QPainter*, const QRect&, QTab*, bool) const; |
73 | int insertTab(QTab *, int index = -1); | 52 | int insertTab(QTab *, int index = -1); |
74 | protected: | 53 | protected: |
75 | QArray<QColor> m_colors; | 54 | QArray<QColor> m_colors; |
76 | }; | 55 | }; |
77 | 56 | ||
78 | /* A QLineEdit with history functionality and tab completion */ | 57 | /* A QLineEdit with history functionality and tab completion */ |
79 | 58 | ||
80 | class IRCHistoryLineEdit : public QLineEdit { | 59 | class IRCHistoryLineEdit : public QLineEdit { |
81 | Q_OBJECT | 60 | Q_OBJECT |
82 | public: | 61 | public: |
83 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); | 62 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); |
84 | virtual bool eventFilter(QObject *object, QEvent *event); | 63 | virtual bool eventFilter(QObject *object, QEvent *event); |
85 | protected: | 64 | protected: |
86 | void keyPressEvent(QKeyEvent *); | 65 | void keyPressEvent(QKeyEvent *); |
87 | protected: | 66 | protected: |
88 | QStringList m_history; | 67 | QStringList m_history; |
89 | int m_index; | 68 | int m_index; |
90 | }; | 69 | }; |
91 | 70 | ||
92 | #endif /* __IRCMISC_H */ | 71 | #endif /* __IRCMISC_H */ |
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,104 +1,101 @@ | |||
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" |
7 | #include "ircmisc.h" | 9 | #include "ircmisc.h" |
8 | 10 | ||
9 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { | 11 | IRCSettings::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 | ||
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()); |
99 | QDialog::accept(); | 96 | QDialog::accept(); |
100 | } | 97 | } |
101 | 98 | ||
102 | IRCSettings::~IRCSettings() { | 99 | IRCSettings::~IRCSettings() { |
103 | delete m_config; | 100 | delete m_config; |
104 | } | 101 | } |
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 | |||
@@ -1,48 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCSETTINGS_H | 21 | #ifndef __IRCSETTINGS_H |
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 | ||
28 | class OColorButton; | ||
29 | |||
28 | class IRCSettings : public QDialog { | 30 | class IRCSettings : public QDialog { |
29 | Q_OBJECT | 31 | Q_OBJECT |
30 | public: | 32 | public: |
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(); |
34 | protected slots: | 35 | protected slots: |
35 | void accept(); | 36 | void accept(); |
36 | protected: | 37 | protected: |
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 | |||
@@ -1,88 +1,88 @@ | |||
1 | #include <qpe/qpemenubar.h> | 1 | #include <qpe/qpemenubar.h> |
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qwhatsthis.h> | 5 | #include <qwhatsthis.h> |
6 | 6 | ||
7 | #include "mainwindow.h" | 7 | #include "mainwindow.h" |
8 | #include "ircservertab.h" | 8 | #include "ircservertab.h" |
9 | #include "ircserverlist.h" | 9 | #include "ircserverlist.h" |
10 | #include "ircsettings.h" | 10 | #include "ircsettings.h" |
11 | 11 | ||
12 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 12 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
13 | setCaption(tr("IRC Client")); | 13 | setCaption(tr("IRC Client")); |
14 | m_tabWidget = new IRCTabWidget(this); | 14 | m_tabWidget = new IRCTabWidget(this); |
15 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); | 15 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); |
16 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); | 16 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); |
17 | setCentralWidget(m_tabWidget); | 17 | setCentralWidget(m_tabWidget); |
18 | setToolBarsMovable(FALSE); | 18 | setToolBarsMovable(FALSE); |
19 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 19 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
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 | ||
33 | void MainWindow::loadSettings() { | 33 | void MainWindow::loadSettings() { |
34 | Config config("OpieIRC"); | 34 | Config config("OpieIRC"); |
35 | config.setGroup("OpieIRC"); | 35 | config.setGroup("OpieIRC"); |
36 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); | 36 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
37 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); | 37 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
38 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); | 38 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
39 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); | 39 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
40 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); | 40 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
41 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 41 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
42 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 42 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
43 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | 43 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); |
44 | } | 44 | } |
45 | 45 | ||
46 | void MainWindow::selected(QWidget *) { | 46 | void MainWindow::selected(QWidget *) { |
47 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); | 47 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
48 | } | 48 | } |
49 | 49 | ||
50 | void MainWindow::addTab(IRCTab *tab) { | 50 | void MainWindow::addTab(IRCTab *tab) { |
51 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); | 51 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); |
52 | m_tabWidget->addTab(tab, tab->title()); | 52 | m_tabWidget->addTab(tab, tab->title()); |
53 | m_tabWidget->showPage(tab); | 53 | m_tabWidget->showPage(tab); |
54 | tab->setID(m_tabWidget->currentPageIndex()); | 54 | tab->setID(m_tabWidget->currentPageIndex()); |
55 | m_tabs.append(tab); | 55 | m_tabs.append(tab); |
56 | } | 56 | } |
57 | 57 | ||
58 | void MainWindow::changeEvent(IRCTab *tab) { | 58 | void MainWindow::changeEvent(IRCTab *tab) { |
59 | if (tab->id() != m_tabWidget->currentPageIndex()) | 59 | if (tab->id() != m_tabWidget->currentPageIndex()) |
60 | m_tabWidget->setTabColor(tab->id(), blue); | 60 | m_tabWidget->setTabColor(tab->id(), blue); |
61 | } | 61 | } |
62 | 62 | ||
63 | void MainWindow::killTab(IRCTab *tab) { | 63 | void MainWindow::killTab(IRCTab *tab) { |
64 | m_tabWidget->removePage(tab); | 64 | m_tabWidget->removePage(tab); |
65 | m_tabs.remove(tab); | 65 | m_tabs.remove(tab); |
66 | /* there might be nicer ways to do this .. */ | 66 | /* there might be nicer ways to do this .. */ |
67 | delete tab; | 67 | delete tab; |
68 | } | 68 | } |
69 | 69 | ||
70 | void MainWindow::newConnection() { | 70 | void MainWindow::newConnection() { |
71 | IRCServerList list(this, "ServerList", TRUE); | 71 | IRCServerList list(this, "ServerList", TRUE); |
72 | if (list.exec() == QDialog::Accepted && list.hasServer()) { | 72 | if (list.exec() == QDialog::Accepted && list.hasServer()) { |
73 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); | 73 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); |
74 | addTab(serverTab); | 74 | addTab(serverTab); |
75 | serverTab->doConnect(); | 75 | serverTab->doConnect(); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | void MainWindow::settings() { | 79 | void MainWindow::settings() { |
80 | IRCSettings settings(this, "Settings", TRUE); | 80 | IRCSettings settings(this, "Settings", TRUE); |
81 | if (settings.exec() == QDialog::Accepted) { | 81 | if (settings.exec() == QDialog::Accepted) { |
82 | QListIterator<IRCTab> it(m_tabs); | 82 | QListIterator<IRCTab> it(m_tabs); |
83 | for (; it.current(); ++it) { | 83 | for (; it.current(); ++it) { |
84 | /* Inform all tabs about the new settings */ | 84 | /* Inform all tabs about the new settings */ |
85 | it.current()->settingsChanged(); | 85 | it.current()->settingsChanged(); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | } | 88 | } |
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 @@ | |||
1 | Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc | 1 | Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: Communications | 3 | Section: Communications |
4 | Maintainer: Wenzel Jakob <root@wazlaf.de> | 4 | Maintainer: Wenzel Jakob <root@wazlaf.de> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) |
8 | Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer | 8 | Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer |