summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/mainwindow.cpp
authorwazlaf <wazlaf>2002-09-30 08:07:05 (UTC)
committer wazlaf <wazlaf>2002-09-30 08:07:05 (UTC)
commita999acbcd1b8bc1715f2ad2dda6acedf423b89ea (patch) (unidiff)
tree898d433efa8ff3b25a5d10ab4dc4a0a9bc415104 /noncore/net/opieirc/mainwindow.cpp
parent75dccdfe90324e9ff2426930ae185c3a6bdab734 (diff)
downloadopie-a999acbcd1b8bc1715f2ad2dda6acedf423b89ea.zip
opie-a999acbcd1b8bc1715f2ad2dda6acedf423b89ea.tar.gz
opie-a999acbcd1b8bc1715f2ad2dda6acedf423b89ea.tar.bz2
tabs now change their color when actions occur
Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/mainwindow.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index d78e5ab..fe59c3b 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -7,13 +7,14 @@
7#include "ircservertab.h" 7#include "ircservertab.h"
8#include "ircserverlist.h" 8#include "ircserverlist.h"
9#include "ircsettings.h" 9#include "ircsettings.h"
10 10
11MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { 11MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) {
12 setCaption(tr("IRC Client")); 12 setCaption(tr("IRC Client"));
13 m_tabWidget = new QTabWidget(this); 13 m_tabWidget = new IRCTabWidget(this);
14 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *)));
14 setCentralWidget(m_tabWidget); 15 setCentralWidget(m_tabWidget);
15 setToolBarsMovable(FALSE); 16 setToolBarsMovable(FALSE);
16 QPEMenuBar *menuBar = new QPEMenuBar(this); 17 QPEMenuBar *menuBar = new QPEMenuBar(this);
17 QPopupMenu *irc = new QPopupMenu(this); 18 QPopupMenu *irc = new QPopupMenu(this);
18 menuBar->insertItem(tr("IRC"), irc); 19 menuBar->insertItem(tr("IRC"), irc);
19 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); 20 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
@@ -34,18 +35,29 @@ void MainWindow::loadSettings() {
34 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); 35 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
35 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); 36 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
36 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); 37 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
37 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); 38 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
38} 39}
39 40
41void MainWindow::selected(QWidget *) {
42 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), &black);
43}
44
40void MainWindow::addTab(IRCTab *tab) { 45void MainWindow::addTab(IRCTab *tab) {
46 connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *)));
41 m_tabWidget->addTab(tab, tab->title()); 47 m_tabWidget->addTab(tab, tab->title());
42 m_tabWidget->showPage(tab); 48 m_tabWidget->showPage(tab);
49 tab->setID(m_tabWidget->currentPageIndex());
43 m_tabs.append(tab); 50 m_tabs.append(tab);
44} 51}
45 52
53void MainWindow::changeEvent(IRCTab *tab) {
54 if (tab->id() != m_tabWidget->currentPageIndex())
55 m_tabWidget->setTabColor(tab->id(), &blue);
56}
57
46void MainWindow::killTab(IRCTab *tab) { 58void MainWindow::killTab(IRCTab *tab) {
47 m_tabWidget->removePage(tab); 59 m_tabWidget->removePage(tab);
48 m_tabs.remove(tab); 60 m_tabs.remove(tab);
49 /* there might be nicer ways to do this .. */ 61 /* there might be nicer ways to do this .. */
50 delete tab; 62 delete tab;
51} 63}