summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-08 23:25:46 (UTC)
committer harlekin <harlekin>2003-12-08 23:25:46 (UTC)
commite372949ac776a7d986cac91b2ff1a5022040d43b (patch) (side-by-side diff)
tree4c37d554d55501e1be587828651d90722a18f681
parent92d67d6f0e34cdee111c94d2b0304768dfdea2f9 (diff)
downloadopie-e372949ac776a7d986cac91b2ff1a5022040d43b.zip
opie-e372949ac776a7d986cac91b2ff1a5022040d43b.tar.gz
opie-e372949ac776a7d986cac91b2ff1a5022040d43b.tar.bz2
remove not used includes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannellist.cpp1
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp2
-rw-r--r--noncore/net/opieirc/ircmisc.cpp1
-rw-r--r--noncore/net/opieirc/ircservertab.cpp1
-rw-r--r--noncore/net/opieirc/ircsettings.cpp3
-rw-r--r--noncore/net/opieirc/irctab.cpp1
-rw-r--r--noncore/net/opieirc/main.cpp1
-rw-r--r--noncore/net/opieirc/mainwindow.cpp2
8 files changed, 0 insertions, 12 deletions
diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp
index 566b223..4e13dee 100644
--- a/noncore/net/opieirc/ircchannellist.cpp
+++ b/noncore/net/opieirc/ircchannellist.cpp
@@ -1,48 +1,47 @@
#include <qpe/resource.h>
-#include <qpixmap.h>
#include "ircchannellist.h"
IRCChannelList::IRCChannelList(IRCChannel *channel, QWidget *parent, const char *name, WFlags f) : QListBox(parent, name, f) {
m_channel = channel;
}
void IRCChannelList::update() {
QPixmap op = Resource::loadPixmap("opieirc/op");
QPixmap hop = Resource::loadPixmap("opieirc/hop");
QPixmap voice = Resource::loadPixmap("opieirc/voice");
QListIterator<IRCChannelPerson> it = m_channel->people();
clear();
for (; it.current(); ++it) {
IRCChannelPerson *person = it.current();
if (person->flags & PERSON_FLAG_OP) {
insertItem(op, person->person->nick());
} else if (person->flags & PERSON_FLAG_HALFOP) {
insertItem(op, person->person->nick());
} else if (person->flags & PERSON_FLAG_VOICE) {
insertItem(voice, person->person->nick());
} else {
insertItem(person->person->nick());
}
}
sort();
}
bool IRCChannelList::hasPerson(QString nick) {
for (unsigned int i=0; i<count(); i++) {
if (text(i) == nick)
return TRUE;
}
return FALSE;
}
bool IRCChannelList::removePerson(QString nick) {
for (unsigned int i=0; i<count(); i++) {
if (text(i) == nick){
removeItem(i);
return TRUE;
}
}
return FALSE;
}
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index 2b8b65e..b0771f6 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -1,67 +1,65 @@
-#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
-#include <qcursor.h>
#include <qwhatsthis.h>
#include <qhbox.h>
#include "ircchanneltab.h"
#include "ircservertab.h"
IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
m_mainWindow = mainWindow;
m_parentTab = parentTab;
m_channel = channel;
m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>");
QHBox *hbox = new QHBox(this);
m_textview = new QTextView(hbox);
m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
m_listVisible = TRUE;
m_listButton = new QPushButton(">", m_textview);
m_textview->setCornerWidget(m_listButton);
m_textview->setTextFormat(RichText);
QWhatsThis::add(m_textview, tr("Channel discussion"));
connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList()));
m_list = new IRCChannelList(m_channel, hbox);
m_list->update();
m_list->setMaximumWidth(LISTWIDTH);
m_field = new IRCHistoryLineEdit(this);
QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion"));
m_popup = new QPopupMenu(m_list);
m_lines = 0;
/* Required so that embedded-style "right" clicks work */
QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold);
connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &)));
/* Construct the popup menu */
QPopupMenu *ctcpMenu = new QPopupMenu(m_list);
m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu);
m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery()));
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing()));
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
m_layout->add(hbox);
hbox->show();
m_layout->add(m_field);
m_field->setFocus();
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
settingsChanged();
}
void IRCChannelTab::scrolling(){
m_textview->ensureVisible(0, m_textview->contentsHeight());
}
void IRCChannelTab::appendText(QString text) {
/* not using append because it creates layout problems */
QString txt = m_textview->text() + text + "\n";
if (m_maxLines > 0 && m_lines >= m_maxLines) {
int firstBreak = txt.find('\n');
if (firstBreak != -1) {
txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
}
} else {
m_lines++;
}
m_textview->ensureVisible(0, m_textview->contentsHeight());
m_textview->setText(txt);
m_textview->ensureVisible(0, m_textview->contentsHeight());
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index a15a790..22387b3 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,65 +1,64 @@
-#include <qlayout.h>
#include <stdio.h>
#include "ircmisc.h"
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"));
}
void IRCTabWidget::setTabColor(int index, QColor color) {
((IRCTabBar *)tabBar())->setTabColor(index, color);
}
IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
m_index = -1;
installEventFilter(this);
}
void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
int key = event->key();
if (key == Key_Up) {
if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
m_index++;
setText(m_history[m_index]);
}
} else if (key == Key_Down) {
if (m_history.count() > 0 && m_index > 0) {
m_index--;
setText(m_history[m_index]);
}
if (m_index == 0) {
m_index = -1;
setText("");
}
} else if (key == Key_Return) {
m_history.prepend(text());
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index 2c28507..d1aab40 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -1,65 +1,64 @@
-#include <qpe/config.h>
#include <qtextstream.h>
#include <qwhatsthis.h>
#include "ircservertab.h"
IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
m_server = server;
m_session = new IRCSession(&m_server);
m_mainWindow = mainWindow;
m_close = FALSE;
m_lines = 0;
m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>");
m_textview = new QTextView(this);
m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
m_textview->setTextFormat(RichText);
QWhatsThis::add(m_textview, tr("Server messages"));
m_layout->add(m_textview);
m_field = new IRCHistoryLineEdit(this);
QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help"));
m_layout->add(m_field);
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
m_field->setFocus();
connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
settingsChanged();
}
void IRCServerTab::scrolling(){
m_textview->ensureVisible(0, m_textview->contentsHeight());
}
void IRCServerTab::appendText(QString text) {
/* not using append because it creates layout problems */
QString txt = m_textview->text() + text + "\n";
if (m_maxLines > 0 && m_lines >= m_maxLines) {
int firstBreak = txt.find('\n');
if (firstBreak != -1) {
txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
}
} else {
m_lines++;
}
m_textview->setText(txt);
m_textview->ensureVisible(0, m_textview->contentsHeight());
emit changed(this);
}
IRCServerTab::~IRCServerTab() {
delete m_session;
}
void IRCServerTab::removeChannelTab(IRCChannelTab *tab) {
m_channelTabs.remove(tab);
}
void IRCServerTab::removeQueryTab(IRCQueryTab *tab) {
m_queryTabs.remove(tab);
}
void IRCServerTab::addQueryTab(IRCQueryTab *tab) {
m_queryTabs.append(tab);
}
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp
index 70d5445..2862296 100644
--- a/noncore/net/opieirc/ircsettings.cpp
+++ b/noncore/net/opieirc/ircsettings.cpp
@@ -1,73 +1,70 @@
#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(tr("Settings") );
m_config = new Config("OpieIRC");
m_config->setGroup("OpieIRC");
QHBoxLayout *l = new QHBoxLayout(this, 2, 2);
OTabWidget *tw = new OTabWidget(this);
l->addWidget(tw);
/* General Configuration */
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"), 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(genwidget, "opieirc/settings", tr("General"));
/* Color configuration */
QScrollView *view = new QScrollView(this);
view->setResizePolicy(QScrollView::AutoOneFit);
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 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 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 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 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 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 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 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);
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp
index 8a869d6..3351c3b 100644
--- a/noncore/net/opieirc/irctab.cpp
+++ b/noncore/net/opieirc/irctab.cpp
@@ -1,39 +1,38 @@
#include <qpe/resource.h>
-#include <qpixmap.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
#include "irctab.h"
QString IRCTab::m_errorColor;
QString IRCTab::m_serverColor;
QString IRCTab::m_textColor;
QString IRCTab::m_backgroundColor;
QString IRCTab::m_selfColor;
QString IRCTab::m_otherColor;
QString IRCTab::m_notificationColor;
int IRCTab::m_maxLines;
IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
m_layout = new QVBoxLayout(this);
QHBoxLayout *descLayout = new QHBoxLayout(m_layout);
descLayout->setMargin(5);
m_description = new QLabel(tr("Missing description"), this);
QWhatsThis::add(m_description, tr("Description of the tab's content"));
descLayout->addWidget(m_description);
descLayout->setStretchFactor(m_description, 5);
QPushButton *close = new QPushButton(this);
QWhatsThis::add(close, tr("Close this tab"));
close->setPixmap(Resource::loadPixmap("close"));
connect(close, SIGNAL(clicked()), this, SLOT(remove()));
descLayout->addWidget(close);
descLayout->setStretchFactor(m_description, 1);
}
void IRCTab::setID(int id) {
m_id = id;
}
int IRCTab::id() {
return m_id;
}
diff --git a/noncore/net/opieirc/main.cpp b/noncore/net/opieirc/main.cpp
index 39acfcc..da38024 100644
--- a/noncore/net/opieirc/main.cpp
+++ b/noncore/net/opieirc/main.cpp
@@ -1,7 +1,6 @@
-#include <qpe/qpeapplication.h>
#include "mainwindow.h"
#include <opie/oapplicationfactory.h>
OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index be6f8ed..7414154 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -1,68 +1,66 @@
#include <qmenubar.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);
QMenuBar *menuBar = new QMenuBar(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->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
connect(a, SIGNAL(activated()), this, SLOT(settings()));
a->addTo(irc);
loadSettings();
}
/*IRCTabWidget MainWindow::getTabWidget(){
return m_tabWidget;
} */
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);
emit updateScroll();
}
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) {
if (tab->id() != m_tabWidget->currentPageIndex())
m_tabWidget->setTabColor(tab->id(), blue);
}
void MainWindow::killTab(IRCTab *tab) {