Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index 0923a11..1143213 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -4,12 +4,17 @@ | |||
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include "ircservertab.h" | 6 | #include "ircservertab.h" |
7 | #include "ircserverlist.h" | 7 | #include "ircserverlist.h" |
8 | #include "ircsettings.h" | 8 | #include "ircsettings.h" |
9 | 9 | ||
10 | QString MainWindow::appCaption() { | ||
11 | return QObject::tr("Opie IRC"); | ||
12 | } | ||
13 | |||
14 | |||
10 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 15 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
11 | setCaption(tr("IRC Client")); | 16 | setCaption(tr("IRC Client")); |
12 | m_tabWidget = new IRCTabWidget(this); | 17 | m_tabWidget = new IRCTabWidget(this); |
13 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); | 18 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); |
14 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*))); | 19 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*))); |
15 | setCentralWidget(m_tabWidget); | 20 | setCentralWidget(m_tabWidget); |
@@ -49,12 +54,17 @@ void MainWindow::selected(QWidget *) { | |||
49 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); | 54 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
50 | emit updateScroll(); | 55 | emit updateScroll(); |
51 | } | 56 | } |
52 | 57 | ||
53 | void MainWindow::addTab(IRCTab *tab) { | 58 | void MainWindow::addTab(IRCTab *tab) { |
54 | connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); | 59 | connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); |
60 | connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&))); | ||
61 | connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab())); | ||
62 | connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab())); | ||
63 | connect(tab, SIGNAL(closeTab()), this, SLOT(slotCloseTab())); | ||
64 | |||
55 | m_tabWidget->addTab(tab, tab->title()); | 65 | m_tabWidget->addTab(tab, tab->title()); |
56 | m_tabWidget->showPage(tab); | 66 | m_tabWidget->showPage(tab); |
57 | tab->setID(m_tabWidget->currentPageIndex()); | 67 | tab->setID(m_tabWidget->currentPageIndex()); |
58 | m_tabs.append(tab); | 68 | m_tabs.append(tab); |
59 | } | 69 | } |
60 | 70 | ||
@@ -86,6 +96,33 @@ void MainWindow::settings() { | |||
86 | for (; it.current(); ++it) { | 96 | for (; it.current(); ++it) { |
87 | /* Inform all tabs about the new settings */ | 97 | /* Inform all tabs about the new settings */ |
88 | it.current()->settingsChanged(); | 98 | it.current()->settingsChanged(); |
89 | } | 99 | } |
90 | } | 100 | } |
91 | } | 101 | } |
102 | |||
103 | |||
104 | void MainWindow::slotNextTab() { | ||
105 | int i = m_tabWidget->currentPageIndex (); | ||
106 | m_tabWidget->setCurrentPage ( i+1 ); | ||
107 | |||
108 | int j = m_tabWidget->currentPageIndex (); | ||
109 | if ( i == j ) | ||
110 | m_tabWidget->setCurrentPage ( 1 ); | ||
111 | } | ||
112 | |||
113 | void MainWindow::slotPrevTab() { | ||
114 | int i = m_tabWidget->currentPageIndex (); | ||
115 | if ( i > 1 ) | ||
116 | m_tabWidget->setCurrentPage ( i-1 ); | ||
117 | } | ||
118 | |||
119 | void MainWindow::slotCloseTab() { | ||
120 | IRCTab *tab = (IRCTab *) m_tabWidget->currentPage (); | ||
121 | if ( tab ) | ||
122 | killTab ( tab ); | ||
123 | } | ||
124 | |||
125 | void MainWindow::slotPing( const QString& channel ) { | ||
126 | raise(); | ||
127 | } | ||
128 | |||