summaryrefslogtreecommitdiff
Side-by-side diff
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,65 +1,36 @@
-#include <opie/colordialog.h>
#include <qlayout.h>
#include <stdio.h>
#include "ircmisc.h"
-IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) {
- m_color = color;
- setAlignment(AlignVCenter | AlignCenter);
- setFrameStyle(QFrame::StyledPanel);
- setFrameShadow(QFrame::Sunken);
- setBackgroundColor(m_color);
-}
-
-void IRCColorLabel::mousePressEvent(QMouseEvent *) {
- m_color = OColorDialog::getColor(m_color);
- setBackgroundColor(m_color);
-}
-
-QColor IRCColorLabel::color() {
- return m_color;
-}
-
-IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
- QVBoxLayout *layout = new QVBoxLayout(this, 10, 0);
- m_label = new IRCColorLabel(color, this);
- layout->addWidget(m_label);
-}
-
-QColor IRCFramedColorLabel::color() {
- return m_label->color();
-}
-
-
IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
}
int IRCTabBar::insertTab(QTab *tab, int index) {
/* FIXME: find some nicer way to do this */
QExtTab *ext = new QExtTab();
ext->color = black;
ext->label = tab->text();
ext->r = tab->rect();
ext->enabled = tab->isEnabled();
ext->iconset = tab->iconSet();
delete tab;
return QTabBar::insertTab(ext, index);
}
void IRCTabBar::setTabColor(int index, QColor color) {
((QExtTab *)tab(index))->color = color;
update();
}
void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
QRect r = br;
QTabBar::paintLabel(p, br, t, focus);
if (t->id == currentTab())
r.setBottom(r.bottom() - style().defaultFrameWidth());
p->setPen(((QExtTab *)t)->color);
p->drawText(r, AlignCenter | ShowPrefix, t->label);
}
IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) {
setTabBar(new IRCTabBar(this, "tab control"));
}
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,83 +1,62 @@
/*
OpieIRC - An embedded IRC client
Copyright (C) 2002 Wenzel Jakob
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __IRCMISC_H
#define __IRCMISC_H
#include <qtabwidget.h>
#include <qlineedit.h>
#include <qtabbar.h>
#include <qlabel.h>
#include <qcolor.h>
#include <qarray.h>
-/* IRCFramedColorLabel is used to display a color */
-
-class IRCColorLabel : public QLabel {
- Q_OBJECT
-public:
- IRCColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
- QColor color();
- void mousePressEvent(QMouseEvent *event);
-protected:
- QColor m_color;
-};
-
-class IRCFramedColorLabel : public QWidget {
- Q_OBJECT
-public:
- IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
- QColor color();
-protected:
- IRCColorLabel *m_label;
-};
-
/* Custom colored QTabWidget */
class QExtTab : public QTab {
public:
QColor color;
};
class IRCTabWidget : public QTabWidget {
Q_OBJECT
public:
IRCTabWidget(QWidget *parent = 0, const char *name = 0);
void setTabColor(int index, QColor color);
};
class IRCTabBar : public QTabBar {
Q_OBJECT
public:
IRCTabBar(QWidget *parent = 0, const char *name = 0);
void setTabColor(int index, QColor color);
protected:
void paintLabel(QPainter*, const QRect&, QTab*, bool) const;
int insertTab(QTab *, int index = -1);
protected:
QArray<QColor> m_colors;
};
/* A QLineEdit with history functionality and tab completion */
class IRCHistoryLineEdit : public QLineEdit {
Q_OBJECT
public:
IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0);
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 @@
+#include <opie/ocolorbutton.h>
+#include <opie/otabwidget.h>
#include <qlayout.h>
#include <qvalidator.h>
#include <qscrollview.h>
#include <qwhatsthis.h>
#include "ircsettings.h"
#include "irctab.h"
#include "ircmisc.h"
IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
setCaption("Settings");
m_config = new Config("OpieIRC");
m_config->setGroup("OpieIRC");
QHBoxLayout *l = new QHBoxLayout(this, 2, 2);
- QTabWidget *tw = new QTabWidget(this);
+ OTabWidget *tw = new OTabWidget(this);
l->addWidget(tw);
/* General Configuration */
- QWidget *widget = new QWidget(tw);
- QGridLayout *layout = new QGridLayout(widget, 1, 2, 5, 0);
- QLabel *label = new QLabel(tr("Lines displayed :"), widget);
+ QWidget *genwidget = new QWidget(tw);
+ QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0);
+ QLabel *label = new QLabel(tr("Lines displayed :"), genwidget);
layout->addWidget(label, 0, 0);
- m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), widget);
+ m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget);
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"));
QIntValidator *validator = new QIntValidator(this);
validator->setTop(10000);
validator->setBottom(0);
m_lines->setValidator(validator);
layout->addWidget(m_lines, 0, 1);
- tw->addTab(widget, tr("General"));
+ tw->addTab(genwidget, "opieirc/settings", tr("General"));
/* Color configuration */
- QScrollView *view = new QScrollView(tw);
+ QScrollView *view = new QScrollView(this);
view->setResizePolicy(QScrollView::AutoOneFit);
- widget = new QWidget(view->viewport());
+ view->setFrameStyle( QFrame::NoFrame );
+ QWidget *widget = new QWidget(view->viewport());
view->addChild(widget);
layout = new QGridLayout(widget, 7, 2, 5, 0);
label = new QLabel(tr("Background color :"), widget);
layout->addWidget(label, 0, 0);
- m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), widget);
+ m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF"));
QWhatsThis::add(m_background, tr("Background color to be used in chats"));
layout->addWidget(m_background, 0, 1);
label = new QLabel(tr("Normal text color :"), widget);
layout->addWidget(label, 1, 0);
- m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), widget);
+ m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000"));
QWhatsThis::add(m_text, tr("Text color to be used in chats"));
layout->addWidget(m_text, 1, 1);
label = new QLabel(tr("Error color :"), widget);
layout->addWidget(label, 2, 0);
- m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), widget);
+ m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000"));
QWhatsThis::add(m_error, tr("Text color to be used to display errors"));
layout->addWidget(m_error, 2, 1);
label = new QLabel(tr("Text written by yourself :"), widget);
layout->addWidget(label, 3, 0);
- m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), widget);
+ m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000"));
QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself"));
layout->addWidget(m_self, 3, 1);
label = new QLabel(tr("Text written by others :"), widget);
layout->addWidget(label, 4, 0);
- m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), widget);
+ m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB"));
QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others"));
layout->addWidget(m_other, 4, 1);
label = new QLabel(tr("Text written by the server :"), widget);
layout->addWidget(label, 5, 0);
- m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), widget);
+ m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF"));
QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server"));
layout->addWidget(m_server, 5, 1);
label = new QLabel(tr("Notifications :"), widget);
layout->addWidget(label, 6, 0);
- m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), widget);
+ m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#AAE300"));
QWhatsThis::add(m_notification, tr("Text color to be used to display notifications"));
layout->addWidget(m_notification, 6, 1);
- tw->addTab(view, tr("Colors"));
+ tw->addTab(view, "opieirc/colors", tr("Colors"));
+ tw->setCurrentTab( genwidget );
showMaximized();
}
-QString IRCSettings::getColorString(QWidget *widget) {
- QColor color = ((IRCFramedColorLabel *)widget)->color();
- QString temp;
- temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue());
- return temp;
-}
-
void IRCSettings::accept() {
- IRCTab::m_backgroundColor = getColorString(m_background);
- IRCTab::m_textColor = getColorString(m_text);
- IRCTab::m_errorColor = getColorString(m_error);
- IRCTab::m_selfColor = getColorString(m_self);
- IRCTab::m_otherColor = getColorString(m_other);
- IRCTab::m_serverColor = getColorString(m_server);
- IRCTab::m_notificationColor = getColorString(m_notification);
+ IRCTab::m_backgroundColor = m_background->color().name();
+ IRCTab::m_textColor = m_text->color().name();
+ IRCTab::m_errorColor = m_error->color().name();
+ IRCTab::m_selfColor = m_self->color().name();
+ IRCTab::m_otherColor = m_other->color().name();
+ IRCTab::m_serverColor = m_server->color().name();
+ IRCTab::m_notificationColor = m_notification->color().name();
IRCTab::m_maxLines = m_lines->text().toInt();
- m_config->writeEntry("BackgroundColor", getColorString(m_background));
- m_config->writeEntry("TextColor", getColorString(m_text));
- m_config->writeEntry("ErrorColor", getColorString(m_error));
- m_config->writeEntry("SelfColor", getColorString(m_self));
- m_config->writeEntry("OtherColor", getColorString(m_other));
- m_config->writeEntry("ServerColor", getColorString(m_server));
- m_config->writeEntry("NotificationColor", getColorString(m_notification));
+ m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor);
+ m_config->writeEntry("TextColor", IRCTab::m_textColor);
+ m_config->writeEntry("ErrorColor", IRCTab::m_errorColor);
+ m_config->writeEntry("SelfColor", IRCTab::m_selfColor);
+ m_config->writeEntry("OtherColor", IRCTab::m_otherColor);
+ m_config->writeEntry("ServerColor", IRCTab::m_serverColor);
+ m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor);
m_config->writeEntry("Lines", m_lines->text());
QDialog::accept();
}
IRCSettings::~IRCSettings() {
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
@@ -1,48 +1,49 @@
/*
OpieIRC - An embedded IRC client
Copyright (C) 2002 Wenzel Jakob
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __IRCSETTINGS_H
#define __IRCSETTINGS_H
#include <qpe/config.h>
#include <qdialog.h>
#include <qlineedit.h>
+class OColorButton;
+
class IRCSettings : public QDialog {
Q_OBJECT
public:
IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0);
- QString getColorString(QWidget *widget);
~IRCSettings();
protected slots:
void accept();
protected:
- Config *m_config;
- QWidget *m_background;
- QWidget *m_text;
- QWidget *m_error;
- QWidget *m_self;
- QWidget *m_server;
- QWidget *m_other;
- QWidget *m_notification;
- QLineEdit *m_lines;
+ Config *m_config;
+ OColorButton *m_background;
+ OColorButton *m_text;
+ OColorButton *m_error;
+ OColorButton *m_self;
+ OColorButton *m_server;
+ OColorButton *m_other;
+ OColorButton *m_notification;
+ QLineEdit *m_lines;
};
#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,58 +1,58 @@
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpopupmenu.h>
#include <qwhatsthis.h>
#include "mainwindow.h"
#include "ircservertab.h"
#include "ircserverlist.h"
#include "ircsettings.h"
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
setCaption(tr("IRC Client"));
m_tabWidget = new IRCTabWidget(this);
QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *)));
setCentralWidget(m_tabWidget);
setToolBarsMovable(FALSE);
QPEMenuBar *menuBar = new QPEMenuBar(this);
QPopupMenu *irc = new QPopupMenu(this);
menuBar->insertItem(tr("IRC"), irc);
QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
a->setWhatsThis(tr("Create a new connection to an IRC server"));
a->addTo(irc);
- a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0);
+ a = new QAction(tr("Settings"), Resource::loadPixmap("opieirc/settings"), QString::null, 0, this, 0);
a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
connect(a, SIGNAL(activated()), this, SLOT(settings()));
a->addTo(irc);
loadSettings();
}
void MainWindow::loadSettings() {
Config config("OpieIRC");
config.setGroup("OpieIRC");
IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
IRCTab::m_maxLines = config.readNumEntry("Lines", 100);
}
void MainWindow::selected(QWidget *) {
m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
}
void MainWindow::addTab(IRCTab *tab) {
connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *)));
m_tabWidget->addTab(tab, tab->title());
m_tabWidget->showPage(tab);
tab->setID(m_tabWidget->currentPageIndex());
m_tabs.append(tab);
}
void MainWindow::changeEvent(IRCTab *tab) {
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 @@
Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc
Priority: optional
Section: Communications
Maintainer: Wenzel Jakob <root@wazlaf.de>
Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION
-Depends: opie-base ($QPE_VERSION)
+Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer