This is the long-awaited monster commit, bringing you a redesigned core arch and...
[quassel.git] / src / qtui / coreconnectdlg.h
1 /***************************************************************************
2  *   Copyright (C) 2005-08 by the Quassel IRC 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) 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 _CORECONNECTDLG_H_
22 #define _CORECONNECTDLG_H_
23
24 #include <QAbstractSocket>
25
26 #include "ui_coreconnectdlg.h"
27 #include "ui_coreaccounteditdlg.h"
28
29 class ClientSyncer;
30
31 class CoreConnectDlg : public QDialog {
32   Q_OBJECT
33
34   public:
35     CoreConnectDlg(QWidget *parent = 0, bool = false);
36     ~CoreConnectDlg();
37
38   private slots:
39
40     /*** Phase Null: Accounts ***/
41     void restartPhaseNull();
42
43     void on_accountList_itemSelectionChanged();
44     void on_autoConnect_clicked(bool);
45
46     void on_addAccount_clicked();
47     void on_editAccount_clicked();
48     void on_deleteAccount_clicked();
49
50     void on_accountList_itemDoubleClicked(QListWidgetItem *item);
51     void on_accountButtonBox_accepted();
52
53     void setAccountWidgetStates();
54
55     /*** Phase One: Connection ***/
56     void connectToCore();
57
58     void initPhaseError(const QString &error);
59     void initPhaseMsg(const QString &msg);
60     void initPhaseSocketState(QAbstractSocket::SocketState);
61
62     /*** Phase Two: Login ***/
63     void startLogin();
64     void doLogin();
65     void loginFailed(const QString &);
66
67     void setLoginWidgetStates();
68
69     /*** Phase Three: Sync ***/
70     void startSync();
71
72     void coreSessionProgress(quint32, quint32);
73     void coreNetworksProgress(quint32, quint32);
74     void coreChannelsProgress(quint32, quint32);
75     void coreIrcUsersProgress(quint32, quint32);
76
77   private:
78     Ui::CoreConnectDlg ui;
79
80     QString autoConnectAccount;
81     QHash<QString, QVariantMap> accounts;
82     QVariantMap account;
83     QString accountName;
84
85     bool doingAutoConnect;
86
87     ClientSyncer *clientSyncer;
88 };
89
90 class CoreAccountEditDlg : public QDialog {
91   Q_OBJECT
92
93   public:
94     CoreAccountEditDlg(const QString &name, const QVariantMap &data, const QStringList &existing = QStringList(), QWidget *parent = 0);
95
96     QString accountName() const;
97     QVariantMap accountData();
98
99   private slots:
100     void on_host_textChanged(const QString &);
101     void on_accountName_textChanged(const QString &);
102     void on_useRemote_toggled(bool);
103
104     void setWidgetStates();
105
106   private:
107     Ui::CoreAccountEditDlg ui;
108
109     QStringList existing;
110     QVariantMap account;
111 };
112
113 #endif