- implemented on request a chat monitor: a simple buffer which shows
[quassel.git] / src / qtui / serverlist.h
1 /***************************************************************************
2  *   Copyright (C) 2005 by the Quassel Project                             *
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) version 3.                                           *
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 _SERVERLIST_H_
22 #define _SERVERLIST_H_
23
24 #include <QtGui>
25 #include <QMap>
26 #include <QList>
27 #include <QVariant>
28
29 #include "ui_serverlistdlg.h"
30 #include "ui_networkeditdlg.h"
31 #include "ui_servereditdlg.h"
32
33 class ServerListDlg : public QDialog {
34   Q_OBJECT
35
36   public:
37     ServerListDlg(QWidget *parent);
38     virtual ~ServerListDlg();
39
40     bool showOnStartup();
41
42   public slots:
43     void editIdentities(bool end = false);
44     //virtual void reject() { exit(0); }
45     virtual void accept();
46
47   signals:
48     void requestConnect(QString network);
49
50   private slots:
51     void updateButtons();
52     void updateNetworkTree();
53     void on_showOnStartup_stateChanged(int);
54     void on_addButton_clicked();
55     void on_editButton_clicked();
56     void on_deleteButton_clicked();
57
58   private:
59     Ui::ServerListDlg ui;
60
61     //QVariantMap networks;
62     //QVariantMap identities;  <-- this is now stored in global
63 };
64
65 class NetworkEditDlg : public QDialog {
66   Q_OBJECT
67
68   public:
69     NetworkEditDlg(QWidget *parent, QVariantMap network);
70
71     QVariantMap getNetwork() { return network; }
72   public slots:
73     virtual void accept();
74
75   private slots:
76     void on_networkName_textChanged(QString);
77     void on_addServer_clicked();
78     void on_editServer_clicked();
79     void on_deleteServer_clicked();
80     void on_upServer_clicked();
81     void on_downServer_clicked();
82     void on_editIdentities_clicked();
83
84     void updateWidgets();
85     void updateServerButtons();
86   private:
87     Ui::NetworkEditDlg ui;
88
89     QVariantMap network;
90     //QVariantMap identities;
91     QString oldName;
92
93     QVariantMap createDefaultNetwork();
94     QString checkValidity();
95 };
96
97 class ServerEditDlg : public QDialog {
98   Q_OBJECT
99
100   public:
101     ServerEditDlg(QWidget *parent, QVariantMap server = QVariantMap());
102
103     QVariantMap getServer();
104
105   private slots:
106     void on_serverAddress_textChanged();
107
108   private:
109     Ui::ServerEditDlg ui;
110
111 };
112
113 #endif