First sorta working network code added. We can connect to a server now and send/recv
[quassel.git] / gui / mainwin.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005 by The Quassel Team                                *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #include <QtGui>
22
23 #include "mainwin.h"
24 #include "channelwidget.h"
25 #include "serverlist.h"
26
27 #include "core.h"
28 #include "server.h"
29
30 MainWin::MainWin() : QMainWindow() {
31
32   setWindowTitle("Quassel IRC");
33   setWindowIcon(QIcon(":/default/tux.png"));
34   setWindowIconText("Quassel IRC");
35   workspace = new QWorkspace(this);
36   setCentralWidget(workspace);
37   ChannelWidget *cw = new ChannelWidget(this);
38   workspace->addWindow(cw);
39   //setCentralWidget(cw);
40   serverListDlg = new ServerListDlg(this);
41   serverListDlg->setVisible(serverListDlg->showOnStartup());
42   //showServerList();
43
44   setupMenus();
45   statusBar()->showMessage(tr("Ready"));
46
47 }
48
49 void MainWin::setupMenus() {
50   fileMenu = menuBar()->addMenu(tr("&File"));
51   serverListAct = fileMenu->addAction(QIcon(":/default/server.png"), tr("&Server List..."), this, SLOT(showServerList()), tr("F7"));
52   fileMenu->addSeparator();
53   quitAct = fileMenu->addAction(QIcon(":/default/exit.png"), tr("&Quit"), qApp, SLOT(quit()), tr("CTRL+Q"));
54
55   editMenu = menuBar()->addMenu(tr("&Edit"));
56   editMenu->setEnabled(0);
57
58   ircMenu = menuBar()->addMenu(tr("&IRC"));
59   ircMenu->setEnabled(0);
60
61   serverMenu = menuBar()->addMenu(tr("Ser&ver"));
62   serverMenu->setEnabled(0);
63
64   windowMenu = menuBar()->addMenu(tr("&Window"));
65   windowMenu->setEnabled(0);
66
67   settingsMenu = menuBar()->addMenu(tr("&Settings"));
68   identitiesAct = settingsMenu->addAction(QIcon(":/default/identity.png"), tr("&Identities..."), serverListDlg, SLOT(editIdentities()));
69   settingsMenu->addSeparator();
70   configAct = settingsMenu->addAction(QIcon(":/default/configure.png"), tr("&Configure Quassel..."));
71   configAct->setEnabled(0);
72
73   helpMenu = menuBar()->addMenu(tr("&Help"));
74   aboutAct = helpMenu->addAction(tr("&About"));
75   aboutAct->setEnabled(0);
76   aboutQtAct = helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
77
78
79   //toolBar = new QToolBar("Test", this);
80   //toolBar->addAction(identitiesAct);
81   //addToolBar(Qt::TopToolBarArea, toolBar);
82 }
83
84 void MainWin::showServerList() {
85 //  if(!serverListDlg) {
86 //    serverListDlg = new ServerListDlg(this);
87 //  }
88   serverListDlg->show();
89 }
90