OK, disabled warnings for the moment :)
[quassel.git] / src / qtui / settingspages / networkssettingspage.h
index 16e4981..89ac4b2 100644 (file)
 #ifndef _NETWORKSSETTINGSPAGE_H_
 #define _NETWORKSSETTINGSPAGE_H_
 
 #ifndef _NETWORKSSETTINGSPAGE_H_
 #define _NETWORKSSETTINGSPAGE_H_
 
-#include "settingspage.h"
+#include <QIcon>
 
 
+#include "settingspage.h"
 #include "ui_networkssettingspage.h"
 #include "ui_networkssettingspage.h"
+#include "ui_networkeditdlgnew.h"
+#include "ui_servereditdlgnew.h"
+#include "ui_saveidentitiesdlg.h"
+
+#include "network.h"
+#include "types.h"
 
 class NetworksSettingsPage : public SettingsPage {
   Q_OBJECT
 
 class NetworksSettingsPage : public SettingsPage {
   Q_OBJECT
@@ -31,16 +38,98 @@ class NetworksSettingsPage : public SettingsPage {
   public:
     NetworksSettingsPage(QWidget *parent = 0);
 
   public:
     NetworksSettingsPage(QWidget *parent = 0);
 
-    //bool aboutToSave();
+    bool aboutToSave();
 
   public slots:
     void save();
     void load();
 
 
   public slots:
     void save();
     void load();
 
+  private slots:
+    void widgetHasChanged();
+    void setWidgetStates();
+    void coreConnectionStateChanged(bool);
+
+    void displayNetwork(NetworkId, bool dontsave = false);
+
+    void clientNetworkAdded(NetworkId);
+    void clientNetworkRemoved(NetworkId);
+    void clientNetworkUpdated();
+
+    void clientIdentityAdded(IdentityId);
+    void clientIdentityRemoved(IdentityId);
+    void clientIdentityUpdated();
+
+    void on_networkList_itemSelectionChanged();
+    void on_addNetwork_clicked();
+    void on_deleteNetwork_clicked();
+    void on_renameNetwork_clicked();
+
+    void on_serverList_itemSelectionChanged();
+    void on_addServer_clicked();
+    void on_deleteServer_clicked();
+    void on_editServer_clicked();
+    void on_upServer_clicked();
+    void on_downServer_clicked();
+
   private:
     Ui::NetworksSettingsPage ui;
 
   private:
     Ui::NetworksSettingsPage ui;
 
+    NetworkId currentId;
+    QHash<NetworkId, NetworkInfo> networkInfos;
+
+    QIcon connectedIcon, disconnectedIcon;
+
+    void reset();
+    bool testHasChanged();
+    QListWidgetItem *insertNetwork(NetworkId);
+    QListWidgetItem *insertNetwork(const NetworkInfo &info);
+    QListWidgetItem *networkItem(NetworkId) const;
+    void saveToNetworkInfo(NetworkInfo &);
+};
+
+class NetworkEditDlgNew : public QDialog {
+  Q_OBJECT
+
+  public:
+    NetworkEditDlgNew(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
+
+    QString networkName() const;
+
+  private slots:
+    void on_networkEdit_textChanged(const QString &);
+
+  private:
+    Ui::NetworkEditDlgNew ui;
 
 
+    QStringList existing;
+};
+
+
+
+class ServerEditDlgNew : public QDialog {
+  Q_OBJECT
+
+  public:
+    ServerEditDlgNew(const QVariantMap &serverData = QVariantMap(), QWidget *parent = 0);
+
+    QVariantMap serverData() const;
+
+  private slots:
+    void on_host_textChanged();
+
+  private:
+    Ui::ServerEditDlgNew ui;
+};
+
+
+class SaveNetworksDlg : public QDialog {
+  Q_OBJECT
+
+  public:
+    SaveNetworksDlg(const QList<NetworkInfo> &toCreate, const QList<NetworkInfo> &toUpdate, const QList<NetworkId> &toRemove, QWidget *parent = 0);
+
+  private:
+    Ui::SaveIdentitiesDlg ui;
 };
 
 #endif
 };
 
 #endif