Switched client-side account data to using AccountId now rather than the account...
[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 "types.h"
27
28 #include "ui_coreconnectdlg.h"
29 #include "ui_coreaccounteditdlg.h"
30
31 class ClientSyncer;
32
33 class CoreConnectDlg : public QDialog {
34   Q_OBJECT
35
36   public:
37     CoreConnectDlg(QWidget *parent = 0, bool = false);
38     ~CoreConnectDlg();
39
40   private slots:
41
42     /*** Phase Null: Accounts ***/
43     void restartPhaseNull();
44
45     void on_accountList_itemSelectionChanged();
46     void on_autoConnect_clicked(bool);
47
48     void on_addAccount_clicked();
49     void on_editAccount_clicked();
50     void on_deleteAccount_clicked();
51
52     void on_accountList_itemDoubleClicked(QListWidgetItem *item);
53     void on_accountButtonBox_accepted();
54
55     void setAccountWidgetStates();
56
57     /*** Phase One: Connection ***/
58     void connectToCore();
59
60     void initPhaseError(const QString &error);
61     void initPhaseMsg(const QString &msg);
62     void initPhaseSocketState(QAbstractSocket::SocketState);
63
64     /*** Phase Two: Login ***/
65     void startLogin();
66     void doLogin();
67     void loginFailed(const QString &);
68
69     void setLoginWidgetStates();
70
71     /*** Phase Three: Sync ***/
72     void startSync();
73
74     void coreSessionProgress(quint32, quint32);
75     void coreNetworksProgress(quint32, quint32);
76     void coreChannelsProgress(quint32, quint32);
77     void coreIrcUsersProgress(quint32, quint32);
78
79   private:
80     Ui::CoreConnectDlg ui;
81
82     AccountId autoConnectAccount;
83     QHash<AccountId, QVariantMap> accounts;
84     QVariantMap accountData;
85     AccountId account;
86
87     bool doingAutoConnect;
88
89     ClientSyncer *clientSyncer;
90 };
91
92 class CoreAccountEditDlg : public QDialog {
93   Q_OBJECT
94
95   public:
96     CoreAccountEditDlg(AccountId id, const QVariantMap &data, const QStringList &existing = QStringList(), QWidget *parent = 0);
97
98     QVariantMap accountData();
99
100   private slots:
101     void on_host_textChanged(const QString &);
102     void on_accountName_textChanged(const QString &);
103     void on_useRemote_toggled(bool);
104
105     void setWidgetStates();
106
107   private:
108     Ui::CoreAccountEditDlg ui;
109
110     QStringList existing;
111     QVariantMap account;
112 };
113
114 #endif