summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmisc.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircmisc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index c8e6190..f94cf1b 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,85 +1,85 @@
1#include <opie/colordialog.h> 1#include <opie/colordialog.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <stdio.h> 3#include <stdio.h>
4#include "ircmisc.h" 4#include "ircmisc.h"
5 5
6IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) { 6IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) {
7 m_color = color; 7 m_color = color;
8 setAlignment(AlignVCenter | AlignCenter); 8 setAlignment(AlignVCenter | AlignCenter);
9 setFrameStyle(QFrame::StyledPanel); 9 setFrameStyle(QFrame::StyledPanel);
10 setFrameShadow(QFrame::Sunken); 10 setFrameShadow(QFrame::Sunken);
11 setBackgroundColor(m_color); 11 setBackgroundColor(m_color);
12} 12}
13 13
14void IRCColorLabel::mousePressEvent(QMouseEvent *) { 14void IRCColorLabel::mousePressEvent(QMouseEvent *) {
15 m_color = OColorDialog::getColor(m_color); 15 m_color = OColorDialog::getColor(m_color);
16 setBackgroundColor(m_color); 16 setBackgroundColor(m_color);
17} 17}
18 18
19QColor IRCColorLabel::color() { 19QColor IRCColorLabel::color() {
20 return m_color; 20 return m_color;
21} 21}
22 22
23IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { 23IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
24 QVBoxLayout *layout = new QVBoxLayout(this, 10, 0); 24 QVBoxLayout *layout = new QVBoxLayout(this, 10, 0);
25 m_label = new IRCColorLabel(color, this); 25 m_label = new IRCColorLabel(color, this);
26 layout->addWidget(m_label); 26 layout->addWidget(m_label);
27} 27}
28 28
29QColor IRCFramedColorLabel::color() { 29QColor IRCFramedColorLabel::color() {
30 return m_label->color(); 30 return m_label->color();
31} 31}
32 32
33 33
34IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { 34IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
35} 35}
36 36
37int IRCTabBar::insertTab(QTab *tab, int index = -1) { 37int IRCTabBar::insertTab(QTab *tab, int index) {
38 /* FIXME: find some nicer way to do this */ 38 /* FIXME: find some nicer way to do this */
39 QExtTab *ext = new QExtTab(); 39 QExtTab *ext = new QExtTab();
40 ext->color = black; 40 ext->color = black;
41 ext->label = tab->text(); 41 ext->label = tab->text();
42 ext->r = tab->rect(); 42 ext->r = tab->rect();
43 ext->enabled = tab->isEnabled(); 43 ext->enabled = tab->isEnabled();
44 ext->iconset = tab->iconSet(); 44 ext->iconset = tab->iconSet();
45 delete tab; 45 delete tab;
46 return QTabBar::insertTab(ext, index); 46 return QTabBar::insertTab(ext, index);
47} 47}
48 48
49void IRCTabBar::setTabColor(int index, QColor color) { 49void IRCTabBar::setTabColor(int index, QColor color) {
50 ((QExtTab *)tab(index))->color = color; 50 ((QExtTab *)tab(index))->color = color;
51 update(); 51 update();
52} 52}
53 53
54void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { 54void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
55 QRect r = br; 55 QRect r = br;
56 QTabBar::paintLabel(p, br, t, focus); 56 QTabBar::paintLabel(p, br, t, focus);
57 if (t->id == currentTab()) 57 if (t->id == currentTab())
58 r.setBottom(r.bottom() - style().defaultFrameWidth()); 58 r.setBottom(r.bottom() - style().defaultFrameWidth());
59 p->setPen(((QExtTab *)t)->color); 59 p->setPen(((QExtTab *)t)->color);
60 p->drawText(r, AlignCenter | ShowPrefix, t->label); 60 p->drawText(r, AlignCenter | ShowPrefix, t->label);
61} 61}
62 62
63IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { 63IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) {
64 setTabBar(new IRCTabBar(this, "tab control")); 64 setTabBar(new IRCTabBar(this, "tab control"));
65} 65}
66 66
67void IRCTabWidget::setTabColor(int index, QColor color) { 67void IRCTabWidget::setTabColor(int index, QColor color) {
68 ((IRCTabBar *)tabBar())->setTabColor(index, color); 68 ((IRCTabBar *)tabBar())->setTabColor(index, color);
69} 69}
70 70
71 71
72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { 72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
73 m_index = -1; 73 m_index = -1;
74 installEventFilter(this); 74 installEventFilter(this);
75} 75}
76 76
77void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { 77void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
78 int key = event->key(); 78 int key = event->key();
79 if (key == Key_Up) { 79 if (key == Key_Up) {
80 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { 80 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
81 m_index++; 81 m_index++;
82 setText(m_history[m_index]); 82 setText(m_history[m_index]);
83 } 83 }
84 } else if (key == Key_Down) { 84 } else if (key == Key_Down) {
85 if (m_history.count() > 0 && m_index > 0) { 85 if (m_history.count() > 0 && m_index > 0) {