d899695330c0770bc52a923c8a05fcbbc4d694a0
[quassel.git] / gui / mainwin.h
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 #ifndef _MAINWIN_H_
22 #define _MAINWIN_H_
23
24 #include <QtGui>
25 #include "gui/ui_mainwin.h"
26
27 #include "global.h"
28 #include "message.h"
29
30 class ServerListDlg;
31 class CoreConnectDlg;
32 class NetworkView;
33 class Buffer;
34
35 class MainWin : public QMainWindow {
36   Q_OBJECT
37
38   public:
39     MainWin();
40
41   protected:
42     void closeEvent(QCloseEvent *event);
43
44   signals:
45     void sendInput(QString network, QString buffer, QString message);
46     void bufferSelected(QString net, QString buffer);
47
48   private slots:
49     void userInput(QString, QString, QString);
50     void networkConnected(QString);
51     void networkDisconnected(QString);
52     void recvNetworkState(QString, QVariant);
53     void recvMessage(QString network, Message message);
54     void recvStatusMsg(QString network, QString message);
55     void setTopic(QString, QString, QString);
56     void setNicks(QString, QString, QStringList);
57     void addNick(QString net, QString nick, VarMap props);
58     void removeNick(QString net, QString nick);
59     void renameNick(QString net, QString oldnick, QString newnick);
60     void updateNick(QString net, QString nick, VarMap props);
61     void setOwnNick(QString net, QString nick);
62
63     void showServerList();
64
65     void showBuffer(QString net, QString buf);
66
67   private:
68     Ui::MainWin ui;
69
70     void setupMenus();
71     void syncToCore();  // implemented in main_mono.cpp or main_gui.cpp
72     Buffer * getBuffer(QString net, QString buf);
73     void buffersUpdated();
74
75     QWorkspace *workspace;
76     QWidget *widget;
77
78     ServerListDlg *serverListDlg;
79     CoreConnectDlg *coreConnectDlg;
80
81     QString currentNetwork, currentBuffer;
82     QHash<QString, QHash<QString, Buffer*> > buffers;
83     QHash<QString, QHash<QString, VarMap> > nicks;
84     QHash<QString, bool> connected;
85     QHash<QString, QString> ownNick;
86     QHash<QString, QList<Message> > coreBackLog;
87
88     NetworkView *netView;
89 };
90
91 #endif