author | wazlaf <wazlaf> | 2002-09-23 22:12:39 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-23 22:12:39 (UTC) |
commit | 074769a4adb816153e47d63087e9e326bd3a04bf (patch) (unidiff) | |
tree | cc69651d9e9e5901696a55d9523e343125780705 /noncore/net/opieirc/mainwindow.cpp | |
parent | e0b04701b3c9182ba22f56e329f98c57af4e1fe2 (diff) | |
download | opie-074769a4adb816153e47d63087e9e326bd3a04bf.zip opie-074769a4adb816153e47d63087e9e326bd3a04bf.tar.gz opie-074769a4adb816153e47d63087e9e326bd3a04bf.tar.bz2 |
configuration dialog + color configurability throughout the program + popup menu on the channel person list
Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index af4ce78..d78e5ab 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -6,11 +6,11 @@ | |||
6 | #include "mainwindow.h" | 6 | #include "mainwindow.h" |
7 | #include "ircservertab.h" | 7 | #include "ircservertab.h" |
8 | #include "ircserverlist.h" | 8 | #include "ircserverlist.h" |
9 | #include "ircsettings.h" | ||
9 | 10 | ||
10 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { | 11 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { |
11 | setCaption(tr("IRC Client")); | 12 | setCaption(tr("IRC Client")); |
12 | m_tabWidget = new QTabWidget(this); | 13 | m_tabWidget = new QTabWidget(this); |
13 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabSelected(QWidget *))); | ||
14 | setCentralWidget(m_tabWidget); | 14 | setCentralWidget(m_tabWidget); |
15 | setToolBarsMovable(FALSE); | 15 | setToolBarsMovable(FALSE); |
16 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 16 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
@@ -19,28 +19,33 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindo | |||
19 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); | 19 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); |
20 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); | 20 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); |
21 | a->addTo(irc); | 21 | a->addTo(irc); |
22 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); | ||
23 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | ||
24 | a->addTo(irc); | ||
25 | loadSettings(); | ||
22 | } | 26 | } |
23 | 27 | ||
24 | void MainWindow::tabSelected(QWidget *) { | 28 | void MainWindow::loadSettings() { |
25 | } | 29 | Config config("OpieIRC"); |
26 | 30 | config.setGroup("OpieIRC"); | |
27 | void MainWindow::closeTab() { | 31 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
28 | /* Does not directly close the tab but triggers an action | 32 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
29 | which at some point will close the tab using a callback */ | 33 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
30 | IRCTab *tab = (IRCTab *)m_tabWidget->currentPage(); | 34 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
31 | if (tab) { | 35 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
32 | tab->remove(); | 36 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
33 | } | 37 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
34 | } | 38 | } |
35 | 39 | ||
36 | void MainWindow::addTab(IRCTab *tab) { | 40 | void MainWindow::addTab(IRCTab *tab) { |
37 | m_tabWidget->addTab(tab, tab->title()); | 41 | m_tabWidget->addTab(tab, tab->title()); |
38 | m_tabWidget->showPage(tab); | 42 | m_tabWidget->showPage(tab); |
39 | tabSelected(tab); | 43 | m_tabs.append(tab); |
40 | } | 44 | } |
41 | 45 | ||
42 | void MainWindow::killTab(IRCTab *tab) { | 46 | void MainWindow::killTab(IRCTab *tab) { |
43 | m_tabWidget->removePage(tab); | 47 | m_tabWidget->removePage(tab); |
48 | m_tabs.remove(tab); | ||
44 | /* there might be nicer ways to do this .. */ | 49 | /* there might be nicer ways to do this .. */ |
45 | delete tab; | 50 | delete tab; |
46 | } | 51 | } |
@@ -53,3 +58,14 @@ void MainWindow::newConnection() { | |||
53 | serverTab->doConnect(); | 58 | serverTab->doConnect(); |
54 | } | 59 | } |
55 | } | 60 | } |
61 | |||
62 | void MainWindow::settings() { | ||
63 | IRCSettings settings(this, "Settings", TRUE); | ||
64 | if (settings.exec() == QDialog::Accepted) { | ||
65 | QListIterator<IRCTab> it(m_tabs); | ||
66 | for (; it.current(); ++it) { | ||
67 | /* Inform all tabs about the new settings */ | ||
68 | it.current()->settingsChanged(); | ||
69 | } | ||
70 | } | ||
71 | } | ||