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 | |
parent | b753c264b7acd26aba9f5a73c1fa0a7deb0b73a3 (diff) | |
download | opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.zip opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.gz opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.bz2 |
history functionality, tabs switch colors, extended settings dialog
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 17 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.h | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.cpp | 53 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.h | 27 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.cpp | 15 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.h | 6 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 15 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.h | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 58 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.h | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.h | 3 | ||||
-rw-r--r-- | noncore/net/opieirc/ircversion.h | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/net/opieirc/opie-irc.control | 3 |
16 files changed, 169 insertions, 49 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index ddd6cf1..f19e019 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -2,4 +2,5 @@ | |||
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qcursor.h> | 3 | #include <qcursor.h> |
4 | #include <stdio.h> | ||
4 | #include <qhbox.h> | 5 | #include <qhbox.h> |
5 | #include "ircchanneltab.h" | 6 | #include "ircchanneltab.h" |
@@ -23,9 +24,11 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
23 | m_list->update(); | 24 | m_list->update(); |
24 | m_list->setMaximumWidth(LISTWIDTH); | 25 | m_list->setMaximumWidth(LISTWIDTH); |
25 | m_field = new QLineEdit(this); | 26 | m_field = new IRCHistoryLineEdit(this); |
26 | m_popup = new QPopupMenu(m_list); | 27 | m_popup = new QPopupMenu(m_list); |
28 | m_lines = 0; | ||
27 | /* Required so that embedded-style "right" clicks work */ | 29 | /* Required so that embedded-style "right" clicks work */ |
28 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); | 30 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); |
29 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); | 31 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); |
32 | |||
30 | /* Construct the popup menu */ | 33 | /* Construct the popup menu */ |
31 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | 34 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); |
@@ -46,5 +49,14 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
46 | void IRCChannelTab::appendText(QString text) { | 49 | void IRCChannelTab::appendText(QString text) { |
47 | /* not using append because it creates layout problems */ | 50 | /* not using append because it creates layout problems */ |
48 | m_textview->setText(m_textview->text() + text); | 51 | QString txt = m_textview->text() + text + "\n"; |
52 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
53 | int firstBreak = txt.find('\n'); | ||
54 | if (firstBreak != -1) { | ||
55 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
56 | } | ||
57 | } else { | ||
58 | m_lines++; | ||
59 | } | ||
60 | m_textview->setText(txt); | ||
49 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 61 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
50 | emit changed(this); | 62 | emit changed(this); |
@@ -77,4 +89,5 @@ void IRCChannelTab::processCommand() { | |||
77 | void IRCChannelTab::settingsChanged() { | 89 | void IRCChannelTab::settingsChanged() { |
78 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 90 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
91 | m_lines = 0; | ||
79 | } | 92 | } |
80 | 93 | ||
diff --git a/noncore/net/opieirc/ircchanneltab.h b/noncore/net/opieirc/ircchanneltab.h index 971614b..a03ee3e 100644 --- a/noncore/net/opieirc/ircchanneltab.h +++ b/noncore/net/opieirc/ircchanneltab.h | |||
@@ -26,4 +26,5 @@ | |||
26 | #include "irctab.h" | 26 | #include "irctab.h" |
27 | #include "ircsession.h" | 27 | #include "ircsession.h" |
28 | #include "ircmisc.h" | ||
28 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
29 | #include "ircchannellist.h" | 30 | #include "ircchannellist.h" |
@@ -63,7 +64,8 @@ protected: | |||
63 | MainWindow *m_mainWindow; | 64 | MainWindow *m_mainWindow; |
64 | QTextView *m_textview; | 65 | QTextView *m_textview; |
65 | QLineEdit *m_field; | 66 | IRCHistoryLineEdit *m_field; |
66 | QPopupMenu *m_popup; | 67 | QPopupMenu *m_popup; |
67 | bool m_listVisible; | 68 | bool m_listVisible; |
69 | int m_lines; | ||
68 | }; | 70 | }; |
69 | 71 | ||
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index a95c64e..e8d3b1a 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp | |||
@@ -518,4 +518,4 @@ void IRCMessageParser::parseNumericalTopic(IRCMessage *message) { | |||
518 | } | 518 | } |
519 | 519 | ||
520 | void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *message) { | 520 | void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *) { |
521 | } | 521 | } |
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp index dd7292c..2e7f316 100644 --- a/noncore/net/opieirc/ircmisc.cpp +++ b/noncore/net/opieirc/ircmisc.cpp | |||
@@ -31,19 +31,22 @@ QColor IRCFramedColorLabel::color() { | |||
31 | } | 31 | } |
32 | 32 | ||
33 | |||
33 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { | 34 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { |
34 | } | 35 | } |
35 | 36 | ||
36 | int IRCTabBar::insertTab(QTab *tab, int index = -1) { | 37 | int IRCTabBar::insertTab(QTab *tab, int index = -1) { |
37 | if (m_colors.size() == (unsigned int)count()) | 38 | /* FIXME: find some nicer way to do this */ |
38 | m_colors.resize(m_colors.size() * 2 + 1); | 39 | QExtTab *ext = new QExtTab(); |
39 | if (index == -1) | 40 | ext->color = black; |
40 | m_colors.insert(count(), &black); | 41 | ext->label = tab->text(); |
41 | else | 42 | ext->r = tab->rect(); |
42 | m_colors.insert(index, &black); | 43 | ext->enabled = tab->isEnabled(); |
43 | return QTabBar::insertTab(tab, index); | 44 | ext->iconset = tab->iconSet(); |
45 | delete tab; | ||
46 | return QTabBar::insertTab(ext, index); | ||
44 | } | 47 | } |
45 | 48 | ||
46 | void IRCTabBar::setTabColor(int index, const QColor *color) { | 49 | void IRCTabBar::setTabColor(int index, QColor color) { |
47 | m_colors.insert(index, color); | 50 | ((QExtTab *)tab(index))->color = color; |
48 | update(); | 51 | update(); |
49 | } | 52 | } |
@@ -54,5 +57,5 @@ void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) co | |||
54 | if (t->id == currentTab()) | 57 | if (t->id == currentTab()) |
55 | r.setBottom(r.bottom() - style().defaultFrameWidth()); | 58 | r.setBottom(r.bottom() - style().defaultFrameWidth()); |
56 | p->setPen(*m_colors.at(t->id)); | 59 | p->setPen(((QExtTab *)t)->color); |
57 | p->drawText(r, AlignCenter | ShowPrefix, t->label); | 60 | p->drawText(r, AlignCenter | ShowPrefix, t->label); |
58 | } | 61 | } |
@@ -62,5 +65,33 @@ IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(paren | |||
62 | } | 65 | } |
63 | 66 | ||
64 | void IRCTabWidget::setTabColor(int index, const QColor *color) { | 67 | void IRCTabWidget::setTabColor(int index, QColor color) { |
65 | ((IRCTabBar *)tabBar())->setTabColor(index, color); | 68 | ((IRCTabBar *)tabBar())->setTabColor(index, color); |
66 | } | 69 | } |
70 | |||
71 | |||
72 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { | ||
73 | m_index = -1; | ||
74 | } | ||
75 | |||
76 | void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { | ||
77 | int key = event->key(); | ||
78 | if (key == Key_Up) { | ||
79 | if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { | ||
80 | m_index++; | ||
81 | setText(m_history[m_index]); | ||
82 | } | ||
83 | } else if (key == Key_Down) { | ||
84 | if (m_history.count() > 0 && m_index > 0) { | ||
85 | m_index--; | ||
86 | setText(m_history[m_index]); | ||
87 | } | ||
88 | if (m_index == 0) { | ||
89 | m_index = -1; | ||
90 | setText(""); | ||
91 | } | ||
92 | } else if (key == Key_Return) { | ||
93 | m_history.prepend(text()); | ||
94 | m_index = -1; | ||
95 | } | ||
96 | QLineEdit::keyPressEvent(event); | ||
97 | } | ||
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h index 4df6ce0..7151e6b 100644 --- a/noncore/net/opieirc/ircmisc.h +++ b/noncore/net/opieirc/ircmisc.h | |||
@@ -23,8 +23,9 @@ | |||
23 | 23 | ||
24 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
25 | #include <qlineedit.h> | ||
25 | #include <qtabbar.h> | 26 | #include <qtabbar.h> |
26 | #include <qlabel.h> | 27 | #include <qlabel.h> |
27 | #include <qcolor.h> | 28 | #include <qcolor.h> |
28 | #include <qvector.h> | 29 | #include <qarray.h> |
29 | 30 | ||
30 | /* IRCFramedColorLabel is used to display a color */ | 31 | /* IRCFramedColorLabel is used to display a color */ |
@@ -51,9 +52,14 @@ protected: | |||
51 | /* Custom colored QTabWidget */ | 52 | /* Custom colored QTabWidget */ |
52 | 53 | ||
54 | class QExtTab : public QTab { | ||
55 | public: | ||
56 | QColor color; | ||
57 | }; | ||
58 | |||
53 | class IRCTabWidget : public QTabWidget { | 59 | class IRCTabWidget : public QTabWidget { |
54 | Q_OBJECT | 60 | Q_OBJECT |
55 | public: | 61 | public: |
56 | IRCTabWidget(QWidget *parent = 0, const char *name = 0); | 62 | IRCTabWidget(QWidget *parent = 0, const char *name = 0); |
57 | void setTabColor(int index, const QColor *color); | 63 | void setTabColor(int index, QColor color); |
58 | }; | 64 | }; |
59 | 65 | ||
@@ -62,10 +68,23 @@ class IRCTabBar : public QTabBar { | |||
62 | public: | 68 | public: |
63 | IRCTabBar(QWidget *parent = 0, const char *name = 0); | 69 | IRCTabBar(QWidget *parent = 0, const char *name = 0); |
64 | void setTabColor(int index, const QColor *color); | 70 | void setTabColor(int index, QColor color); |
65 | protected: | 71 | protected: |
66 | void paintLabel(QPainter*, const QRect&, QTab*, bool) const; | 72 | void paintLabel(QPainter*, const QRect&, QTab*, bool) const; |
67 | int insertTab(QTab *, int index = -1); | 73 | int insertTab(QTab *, int index = -1); |
68 | protected: | 74 | protected: |
69 | QVector<QColor> m_colors; | 75 | QArray<QColor> m_colors; |
76 | }; | ||
77 | |||
78 | /* A QLineEdit with history functionality */ | ||
79 | |||
80 | class IRCHistoryLineEdit : public QLineEdit { | ||
81 | Q_OBJECT | ||
82 | public: | ||
83 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); | ||
84 | protected: | ||
85 | void keyPressEvent(QKeyEvent *); | ||
86 | protected: | ||
87 | QStringList m_history; | ||
88 | int m_index; | ||
70 | }; | 89 | }; |
71 | 90 | ||
diff --git a/noncore/net/opieirc/ircquerytab.cpp b/noncore/net/opieirc/ircquerytab.cpp index b946174..869e4f7 100644 --- a/noncore/net/opieirc/ircquerytab.cpp +++ b/noncore/net/opieirc/ircquerytab.cpp | |||
@@ -6,4 +6,5 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
6 | m_mainWindow = mainWindow; | 6 | m_mainWindow = mainWindow; |
7 | m_parentTab = parentTab; | 7 | m_parentTab = parentTab; |
8 | m_lines = 0; | ||
8 | m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */ | 9 | m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */ |
9 | m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>"); | 10 | m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>"); |
@@ -13,5 +14,5 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
13 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 14 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
14 | m_textview->setTextFormat(RichText); | 15 | m_textview->setTextFormat(RichText); |
15 | m_field = new QLineEdit(this); | 16 | m_field = new IRCHistoryLineEdit(this); |
16 | m_layout->add(hbox); | 17 | m_layout->add(hbox); |
17 | hbox->show(); | 18 | hbox->show(); |
@@ -24,5 +25,14 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
24 | void IRCQueryTab::appendText(QString text) { | 25 | void IRCQueryTab::appendText(QString text) { |
25 | /* not using append because it creates layout problems */ | 26 | /* not using append because it creates layout problems */ |
26 | m_textview->setText(m_textview->text() + text); | 27 | QString txt = m_textview->text() + text + "\n"; |
28 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
29 | int firstBreak = txt.find('\n'); | ||
30 | if (firstBreak != -1) { | ||
31 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
32 | } | ||
33 | } else { | ||
34 | m_lines++; | ||
35 | } | ||
36 | m_textview->setText(txt); | ||
27 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 37 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
28 | emit changed(this); | 38 | emit changed(this); |
@@ -64,4 +74,5 @@ void IRCQueryTab::display(IRCOutput output) { | |||
64 | void IRCQueryTab::settingsChanged() { | 74 | void IRCQueryTab::settingsChanged() { |
65 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 75 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
76 | m_lines = 0; | ||
66 | } | 77 | } |
67 | 78 | ||
diff --git a/noncore/net/opieirc/ircquerytab.h b/noncore/net/opieirc/ircquerytab.h index 07fa57f..f9cc8e1 100644 --- a/noncore/net/opieirc/ircquerytab.h +++ b/noncore/net/opieirc/ircquerytab.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define __IRCQUERYTAB_H | 22 | #define __IRCQUERYTAB_H |
23 | 23 | ||
24 | #include "ircsession.h" | ||
25 | #include "mainwindow.h" | 24 | #include "mainwindow.h" |
25 | #include "ircsession.h" | ||
26 | #include "ircmisc.h" | ||
26 | 27 | ||
27 | class IRCServerTab; | 28 | class IRCServerTab; |
@@ -47,5 +48,6 @@ protected: | |||
47 | IRCPerson *m_person; | 48 | IRCPerson *m_person; |
48 | QTextView *m_textview; | 49 | QTextView *m_textview; |
49 | QLineEdit *m_field; | 50 | IRCHistoryLineEdit *m_field; |
51 | int m_lines; | ||
50 | }; | 52 | }; |
51 | 53 | ||
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 4ed5364..5d1e290 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -8,4 +8,5 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
8 | m_mainWindow = mainWindow; | 8 | m_mainWindow = mainWindow; |
9 | m_close = FALSE; | 9 | m_close = FALSE; |
10 | m_lines = 0; | ||
10 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); | 11 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); |
11 | m_textview = new QTextView(this); | 12 | m_textview = new QTextView(this); |
@@ -14,5 +15,5 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
14 | m_textview->setTextFormat(RichText); | 15 | m_textview->setTextFormat(RichText); |
15 | m_layout->add(m_textview); | 16 | m_layout->add(m_textview); |
16 | m_field = new QLineEdit(this); | 17 | m_field = new IRCHistoryLineEdit(this); |
17 | m_layout->add(m_field); | 18 | m_layout->add(m_field); |
18 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 19 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
@@ -24,5 +25,14 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
24 | void IRCServerTab::appendText(QString text) { | 25 | void IRCServerTab::appendText(QString text) { |
25 | /* not using append because it creates layout problems */ | 26 | /* not using append because it creates layout problems */ |
26 | m_textview->setText(m_textview->text() + text); | 27 | QString txt = m_textview->text() + text + "\n"; |
28 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
29 | int firstBreak = txt.find('\n'); | ||
30 | if (firstBreak != -1) { | ||
31 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
32 | } | ||
33 | } else { | ||
34 | m_lines++; | ||
35 | } | ||
36 | m_textview->setText(txt); | ||
27 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 37 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
28 | emit changed(this); | 38 | emit changed(this); |
@@ -59,4 +69,5 @@ IRCServer *IRCServerTab::server() { | |||
59 | void IRCServerTab::settingsChanged() { | 69 | void IRCServerTab::settingsChanged() { |
60 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 70 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
71 | m_lines = 0; | ||
61 | } | 72 | } |
62 | 73 | ||
diff --git a/noncore/net/opieirc/ircservertab.h b/noncore/net/opieirc/ircservertab.h index 698689a..8d24cba 100644 --- a/noncore/net/opieirc/ircservertab.h +++ b/noncore/net/opieirc/ircservertab.h | |||
@@ -27,4 +27,5 @@ | |||
27 | #include "ircchanneltab.h" | 27 | #include "ircchanneltab.h" |
28 | #include "ircquerytab.h" | 28 | #include "ircquerytab.h" |
29 | #include "ircmisc.h" | ||
29 | 30 | ||
30 | class IRCServerTab : public IRCTab { | 31 | class IRCServerTab : public IRCTab { |
@@ -59,4 +60,5 @@ protected slots: | |||
59 | void display(IRCOutput output); | 60 | void display(IRCOutput output); |
60 | protected: | 61 | protected: |
62 | int m_lines; | ||
61 | bool m_close; | 63 | bool m_close; |
62 | IRCServer m_server; | 64 | IRCServer m_server; |
@@ -64,5 +66,5 @@ protected: | |||
64 | MainWindow *m_mainWindow; | 66 | MainWindow *m_mainWindow; |
65 | QTextView *m_textview; | 67 | QTextView *m_textview; |
66 | QLineEdit *m_field; | 68 | IRCHistoryLineEdit *m_field; |
67 | /* Channel tabs associated with this server tab */ | 69 | /* Channel tabs associated with this server tab */ |
68 | QList<IRCChannelTab> m_channelTabs; | 70 | QList<IRCChannelTab> m_channelTabs; |
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,42 +1,64 @@ | |||
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 | } |
@@ -57,4 +79,5 @@ void IRCSettings::accept() { | |||
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)); |
@@ -64,4 +87,5 @@ void IRCSettings::accept() { | |||
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 | } |
diff --git a/noncore/net/opieirc/ircsettings.h b/noncore/net/opieirc/ircsettings.h index 1d3aeb7..190abaf 100644 --- a/noncore/net/opieirc/ircsettings.h +++ b/noncore/net/opieirc/ircsettings.h | |||
@@ -24,4 +24,5 @@ | |||
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qdialog.h> | 25 | #include <qdialog.h> |
26 | #include <qlineedit.h> | ||
26 | 27 | ||
27 | class IRCSettings : public QDialog { | 28 | class IRCSettings : public QDialog { |
@@ -42,4 +43,5 @@ protected: | |||
42 | QWidget *m_other; | 43 | QWidget *m_other; |
43 | QWidget *m_notification; | 44 | QWidget *m_notification; |
45 | QLineEdit *m_lines; | ||
44 | }; | 46 | }; |
45 | 47 | ||
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp index a4dd7e2..0bb9d4c 100644 --- a/noncore/net/opieirc/irctab.cpp +++ b/noncore/net/opieirc/irctab.cpp | |||
@@ -11,5 +11,5 @@ QString IRCTab::m_selfColor; | |||
11 | QString IRCTab::m_otherColor; | 11 | QString IRCTab::m_otherColor; |
12 | QString IRCTab::m_notificationColor; | 12 | QString IRCTab::m_notificationColor; |
13 | 13 | int IRCTab::m_maxLines; | |
14 | 14 | ||
15 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { | 15 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { |
diff --git a/noncore/net/opieirc/irctab.h b/noncore/net/opieirc/irctab.h index e3a1857..7a2d0a2 100644 --- a/noncore/net/opieirc/irctab.h +++ b/noncore/net/opieirc/irctab.h | |||
@@ -36,4 +36,5 @@ class IRCTab : public QWidget { | |||
36 | public: | 36 | public: |
37 | IRCTab(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 37 | IRCTab(QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
38 | /* The ID is required to store the position of this IRCTab inside the IRCTabWidget */ | ||
38 | void setID(int id); | 39 | void setID(int id); |
39 | int id(); | 40 | int id(); |
@@ -59,4 +60,6 @@ public: | |||
59 | static QString m_otherColor; | 60 | static QString m_otherColor; |
60 | static QString m_notificationColor; | 61 | static QString m_notificationColor; |
62 | /* Max number of lines to be displayed */ | ||
63 | static int m_maxLines; | ||
61 | }; | 64 | }; |
62 | 65 | ||
diff --git a/noncore/net/opieirc/ircversion.h b/noncore/net/opieirc/ircversion.h index f0f196e..ec6acfa 100644 --- a/noncore/net/opieirc/ircversion.h +++ b/noncore/net/opieirc/ircversion.h | |||
@@ -22,5 +22,5 @@ | |||
22 | #define __IRCVERSION_H | 22 | #define __IRCVERSION_H |
23 | 23 | ||
24 | #define APP_VERSION "OpieIRC 0.3" | 24 | #define APP_VERSION "OpieIRC 0.4" |
25 | #define APP_COPYSTR "(c) 2002 by Wenzel Jakob" | 25 | #define APP_COPYSTR "(c) 2002 by Wenzel Jakob" |
26 | 26 | ||
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index fe59c3b..bb03a1c 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -37,8 +37,9 @@ void MainWindow::loadSettings() { | |||
37 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 37 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
38 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 38 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
39 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | ||
39 | } | 40 | } |
40 | 41 | ||
41 | void MainWindow::selected(QWidget *) { | 42 | void MainWindow::selected(QWidget *) { |
42 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), &black); | 43 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
43 | } | 44 | } |
44 | 45 | ||
@@ -53,5 +54,5 @@ void MainWindow::addTab(IRCTab *tab) { | |||
53 | void MainWindow::changeEvent(IRCTab *tab) { | 54 | void MainWindow::changeEvent(IRCTab *tab) { |
54 | if (tab->id() != m_tabWidget->currentPageIndex()) | 55 | if (tab->id() != m_tabWidget->currentPageIndex()) |
55 | m_tabWidget->setTabColor(tab->id(), &blue); | 56 | m_tabWidget->setTabColor(tab->id(), blue); |
56 | } | 57 | } |
57 | 58 | ||
diff --git a/noncore/net/opieirc/opie-irc.control b/noncore/net/opieirc/opie-irc.control index 9e93991..aada957 100644 --- a/noncore/net/opieirc/opie-irc.control +++ b/noncore/net/opieirc/opie-irc.control | |||
@@ -6,4 +6,3 @@ 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) |
8 | Description: The Opie IRC client lets you chat on your favorite | 8 | Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer |
9 | IRC server using your zaurus or ipaq | ||