updating the sync dialog according to the new sync system
authorMarcus Eggenberger <egs@quassel-irc.org>
Sat, 12 Jul 2008 13:17:42 +0000 (15:17 +0200)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sat, 12 Jul 2008 13:17:42 +0000 (15:17 +0200)
src/client/clientsyncer.cpp
src/client/clientsyncer.h
src/qtui/coreconnectdlg.cpp
src/qtui/coreconnectdlg.h
src/qtui/ui/coreconnectdlg.ui

index 6759973..4ec529c 100644 (file)
@@ -178,8 +178,6 @@ void ClientSyncer::coreSocketDisconnected() {
 
   coreConnectionInfo.clear();
   netsToSync.clear();
 
   coreConnectionInfo.clear();
   netsToSync.clear();
-  channelsToSync.clear();
-  usersToSync.clear();
   blockSize = 0;
   //restartPhaseNull();
 }
   blockSize = 0;
   //restartPhaseNull();
 }
@@ -264,17 +262,15 @@ void ClientSyncer::syncToCore(const QVariantMap &sessionState) {
   // create buffers
   // FIXME: get rid of this crap
   QVariantList bufferinfos = sessionState["BufferInfos"].toList();
   // create buffers
   // FIXME: get rid of this crap
   QVariantList bufferinfos = sessionState["BufferInfos"].toList();
-  foreach(QVariant vinfo, bufferinfos) Client::buffer(vinfo.value<BufferInfo>());  // create Buffers and BufferItems
+  foreach(QVariant vinfo, bufferinfos)
+    Client::buffer(vinfo.value<BufferInfo>());  // create Buffers and BufferItems
 
   QVariantList networkids = sessionState["NetworkIds"].toList();
 
 
   QVariantList networkids = sessionState["NetworkIds"].toList();
 
-  // prepare sync progress thingys... FIXME: Care about removal of networks
+  // prepare sync progress thingys...
+  // FIXME: Care about removal of networks
   numNetsToSync = networkids.count();
   numNetsToSync = networkids.count();
-  numChannelsToSync = 0; //sessionState["IrcChannelCount"].toUInt();
-  numUsersToSync = 0; // sessionState["IrcUserCount"].toUInt(); qDebug() << numUsersToSync;
   emit networksProgress(0, numNetsToSync);
   emit networksProgress(0, numNetsToSync);
-  emit channelsProgress(0, numChannelsToSync);
-  emit ircUsersProgress(0, numUsersToSync);
 
   // create network objects
   foreach(QVariant networkid, networkids) {
 
   // create network objects
   foreach(QVariant networkid, networkids) {
@@ -282,12 +278,6 @@ void ClientSyncer::syncToCore(const QVariantMap &sessionState) {
     Network *net = new Network(netid, Client::instance());
     netsToSync.insert(net);
     connect(net, SIGNAL(initDone()), this, SLOT(networkInitDone()));
     Network *net = new Network(netid, Client::instance());
     netsToSync.insert(net);
     connect(net, SIGNAL(initDone()), this, SLOT(networkInitDone()));
-    connect(net, SIGNAL(ircUserInitDone(IrcUser *)), this, SLOT(ircUserInitDone(IrcUser *)));
-    connect(net, SIGNAL(ircUserAdded(IrcUser *)), this, SLOT(ircUserAdded(IrcUser *)));
-    connect(net, SIGNAL(ircUserRemoved(QObject *)), this, SLOT(ircUserRemoved(QObject *)));
-    connect(net, SIGNAL(ircChannelInitDone(IrcChannel *)), this, SLOT(ircChannelInitDone(IrcChannel *)));
-    connect(net, SIGNAL(ircChannelAdded(IrcChannel *)), this, SLOT(ircChannelAdded(IrcChannel *)));
-    connect(net, SIGNAL(ircChannelRemoved(QObject *)), this, SLOT(ircChannelRemoved(QObject *)));
     Client::addNetwork(net);
   }
   checkSyncState();
     Client::addNetwork(net);
   }
   checkSyncState();
@@ -299,84 +289,10 @@ void ClientSyncer::networkInitDone() {
   checkSyncState();
 }
 
   checkSyncState();
 }
 
-void ClientSyncer::ircChannelInitDone(IrcChannel *chan) {
-  channelsToSync.remove(chan);
-  emit channelsProgress(numChannelsToSync - channelsToSync.count(), numChannelsToSync);
-  checkSyncState();
-}
-
-void ClientSyncer::ircChannelAdded(IrcChannel *chan) {
-  if(!chan->isInitialized()) {
-    channelsToSync.insert(chan);
-    numChannelsToSync++;
-    emit channelsProgress(numChannelsToSync - channelsToSync.count(), numChannelsToSync);
-    checkSyncState();
-  }
-}
-
-void ClientSyncer::ircChannelRemoved(QObject *chan) {
-  if(channelsToSync.contains(chan)) {
-    numChannelsToSync--;
-    channelsToSync.remove(chan);
-    emit channelsProgress(numChannelsToSync - channelsToSync.count(), numChannelsToSync);
-    checkSyncState();
-  }
-}
-
-void ClientSyncer::ircUserInitDone(IrcUser *user) {
-  usersToSync.remove(user);
-  emit ircUsersProgress(numUsersToSync - usersToSync.count(), numUsersToSync);
-  checkSyncState();
-}
-
-void ClientSyncer::ircUserAdded(IrcUser *user) {
-  if(!user->isInitialized()) {
-    usersToSync.insert(user);
-    numUsersToSync++;
-    emit ircUsersProgress(numUsersToSync - usersToSync.count(), numUsersToSync);
-    checkSyncState();
-  }
-}
-
-void ClientSyncer::ircUserRemoved(QObject *user) {
-  if(usersToSync.contains(user)) {
-    numUsersToSync--;
-    usersToSync.remove(user);
-    emit ircUsersProgress(numUsersToSync - usersToSync.count(), numUsersToSync);
-    checkSyncState();
-  }
-}
-
 void ClientSyncer::checkSyncState() {
 void ClientSyncer::checkSyncState() {
-  // if(usersToSync.count() + channelsToSync.count() + netsToSync.count() == 0) {
   if(netsToSync.isEmpty()) {
   if(netsToSync.isEmpty()) {
-    // done syncing!
-    /*
-    qDebug() << "done";
-    foreach(Network *net, _networks.values()) {
-      //disconnect(net, 0, this, SLOT(networkInitDone()));
-      //disconnect(net, 0, this, SLOT(ircUserInitDone(IrcUser *)));
-      //disconnect(net, 0, this, SLOT(ircUserAdded(IrcUser *)));
-      //disconnect(net, 0, this, SLOT(ircUserRemoved(QObject *)));
-      //disconnect(net, 0, this, SLOT(ircChannelInitDone(IrcChannel *)));
-      //disconnect(net, 0, this, SLOT(ircChannelAdded(IrcChannel *)));
-      //disconnect(net, 0, this, SLOT(ircChannelRemoved(QObject *)));
-      qDebug() << "disconnecting";
-      disconnect(net, SIGNAL(initDone()), this, SLOT(networkInitDone()));
-      disconnect(net, SIGNAL(ircUserInitDone(IrcUser *)), this, SLOT(ircUserInitDone(IrcUser *)));
-      disconnect(net, SIGNAL(ircUserAdded(IrcUser *)), this, SLOT(ircUserAdded(IrcUser *)));
-      disconnect(net, SIGNAL(ircUserRemoved(QObject *)), this, SLOT(ircUserRemoved(QObject *)));
-      disconnect(net, SIGNAL(ircChannelInitDone(IrcChannel *)), this, SLOT(ircChannelInitDone(IrcChannel *)));
-      disconnect(net, SIGNAL(ircChannelAdded(IrcChannel *)), this, SLOT(ircChannelAdded(IrcChannel *)));
-      disconnect(net, SIGNAL(ircChannelRemoved(QObject *)), this, SLOT(ircChannelRemoved(QObject *)));
-    }
-    */
-
     Client::instance()->setSyncedToCore();
     emit syncFinished();
     Client::instance()->setSyncedToCore();
     emit syncFinished();
-    //emit connected();
-    //emit connectionStateChanged(true);
-
   }
 }
 
   }
 }
 
index 44e3373..8f37048 100644 (file)
@@ -37,70 +37,61 @@ class IrcChannel;
 class ClientSyncer : public QObject {
   Q_OBJECT
 
 class ClientSyncer : public QObject {
   Q_OBJECT
 
-  public:
-    ClientSyncer(QObject *parent = 0);
-    ~ClientSyncer();
-
-  signals:
-    void recvPartialItem(quint32 avail, quint32 size);
-    void connectionError(const QString &errorMsg);
-    void connectionMsg(const QString &msg);
-    void sessionProgress(quint32 part, quint32 total);
-    void networksProgress(quint32 part, quint32 total);
-    void channelsProgress(quint32 part, quint32 total);
-    void ircUsersProgress(quint32 part, quint32 total);
-    void socketStateChanged(QAbstractSocket::SocketState);
-    void socketDisconnected();
-
-    void startLogin();
-    void loginFailed(const QString &error);
-    void loginSuccess();
-    void syncFinished();
-    void startCoreSetup(const QVariantList &);
-    void coreSetupSuccess();
-    void coreSetupFailed(const QString &error);
-
-    void encrypted(bool);
-
-  public slots:
-    void connectToCore(const QVariantMap &);
-    void loginToCore(const QString &user, const QString &passwd);
-    void disconnectFromCore();
-
-  private slots:
-    void coreSocketError(QAbstractSocket::SocketError);
-    void coreHasData();
-    void coreSocketConnected();
-    void coreSocketDisconnected();
-
-    void clientInitAck(const QVariantMap &msg);
-
+public:
+  ClientSyncer(QObject *parent = 0);
+  ~ClientSyncer();
+  
+signals:
+  void recvPartialItem(quint32 avail, quint32 size);
+  void connectionError(const QString &errorMsg);
+  void connectionMsg(const QString &msg);
+  void sessionProgress(quint32 part, quint32 total);
+  void networksProgress(quint32 part, quint32 total);
+  void socketStateChanged(QAbstractSocket::SocketState);
+  void socketDisconnected();
+  
+  void startLogin();
+  void loginFailed(const QString &error);
+  void loginSuccess();
+  void syncFinished();
+  void startCoreSetup(const QVariantList &);
+  void coreSetupSuccess();
+  void coreSetupFailed(const QString &error);
+  
+  void encrypted(bool);
+                     
+public slots:
+  void connectToCore(const QVariantMap &);
+  void loginToCore(const QString &user, const QString &passwd);
+  void disconnectFromCore();
+                          
+private slots:
+  void coreSocketError(QAbstractSocket::SocketError);
+  void coreHasData();
+  void coreSocketConnected();
+  void coreSocketDisconnected();
+
+  void clientInitAck(const QVariantMap &msg);
+  
   // for sync progress
   // for sync progress
-    void networkInitDone();
-    void ircUserAdded(IrcUser *);
-    void ircUserRemoved(QObject *);
-    void ircUserInitDone(IrcUser *);
-    void ircChannelAdded(IrcChannel *);
-    void ircChannelRemoved(QObject *);
-    void ircChannelInitDone(IrcChannel *);
-    void checkSyncState();
-
-    void syncToCore(const QVariantMap &sessionState);
-    void sessionStateReceived(const QVariantMap &state);
-
-    void doCoreSetup(const QVariant &setupData);
+  void networkInitDone();
+  void checkSyncState();
+  
+  void syncToCore(const QVariantMap &sessionState);
+  void sessionStateReceived(const QVariantMap &state);
+  
+  void doCoreSetup(const QVariant &setupData);
 #ifndef QT_NO_OPENSSL
     void sslErrors(const QList<QSslError> &errors);
 #endif
   
 #ifndef QT_NO_OPENSSL
     void sslErrors(const QList<QSslError> &errors);
 #endif
   
-  private:
-    QPointer<QIODevice> socket;
-    quint32 blockSize;
-    QVariantMap coreConnectionInfo;
-
-    QSet<QObject *> netsToSync, channelsToSync, usersToSync;
-    int numNetsToSync, numChannelsToSync, numUsersToSync;
-
+private:
+  QPointer<QIODevice> socket;
+  quint32 blockSize;
+  QVariantMap coreConnectionInfo;
+  
+  QSet<QObject *> netsToSync;
+  int numNetsToSync;
 };
 
 #endif
 };
 
 #endif
index 7490cb4..d7d52de 100644 (file)
@@ -76,8 +76,6 @@ CoreConnectDlg::CoreConnectDlg(QWidget *parent, bool autoconnect)
   connect(clientSyncer, SIGNAL(startCoreSetup(const QVariantList &)), this, SLOT(startCoreConfig(const QVariantList &)));
   connect(clientSyncer, SIGNAL(sessionProgress(quint32, quint32)), this, SLOT(coreSessionProgress(quint32, quint32)));
   connect(clientSyncer, SIGNAL(networksProgress(quint32, quint32)), this, SLOT(coreNetworksProgress(quint32, quint32)));
   connect(clientSyncer, SIGNAL(startCoreSetup(const QVariantList &)), this, SLOT(startCoreConfig(const QVariantList &)));
   connect(clientSyncer, SIGNAL(sessionProgress(quint32, quint32)), this, SLOT(coreSessionProgress(quint32, quint32)));
   connect(clientSyncer, SIGNAL(networksProgress(quint32, quint32)), this, SLOT(coreNetworksProgress(quint32, quint32)));
-  connect(clientSyncer, SIGNAL(channelsProgress(quint32, quint32)), this, SLOT(coreChannelsProgress(quint32, quint32)));
-  connect(clientSyncer, SIGNAL(ircUsersProgress(quint32, quint32)), this, SLOT(coreIrcUsersProgress(quint32, quint32)));
   connect(clientSyncer, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
 
   connect(ui.user, SIGNAL(textChanged(const QString &)), this, SLOT(setLoginWidgetStates()));
   connect(clientSyncer, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
 
   connect(ui.user, SIGNAL(textChanged(const QString &)), this, SLOT(setLoginWidgetStates()));
@@ -396,10 +394,6 @@ void CoreConnectDlg::startSync() {
   ui.sessionProgress->setValue(0);
   ui.networksProgress->setRange(0, 1);
   ui.networksProgress->setValue(0);
   ui.sessionProgress->setValue(0);
   ui.networksProgress->setRange(0, 1);
   ui.networksProgress->setValue(0);
-  ui.channelsProgress->setRange(0, 1);
-  ui.channelsProgress->setValue(0);
-  ui.ircUsersProgress->setRange(0, 1);
-  ui.ircUsersProgress->setValue(0);
 
   ui.stackedWidget->setCurrentWidget(ui.syncPage);
   // clean up old page
 
   ui.stackedWidget->setCurrentWidget(ui.syncPage);
   // clean up old page
@@ -428,31 +422,6 @@ void CoreConnectDlg::coreNetworksProgress(quint32 val, quint32 max) {
   }
 }
 
   }
 }
 
-void CoreConnectDlg::coreChannelsProgress(quint32 val, quint32 max) {
-  if(max == 0) {
-    ui.channelsProgress->setFormat("0/0");
-    ui.channelsProgress->setRange(0, 1);
-    ui.channelsProgress->setValue(1);
-  } else {
-    ui.channelsProgress->setFormat("%v/%m");
-    ui.channelsProgress->setRange(0, max);
-    ui.channelsProgress->setValue(val);
-  }
-}
-
-void CoreConnectDlg::coreIrcUsersProgress(quint32 val, quint32 max) {
-  if(max == 0) {
-    ui.ircUsersProgress->setFormat("0/0");
-    ui.ircUsersProgress->setRange(0, 1);
-    ui.ircUsersProgress->setValue(1);
-  } else {
-    if(val % 100) return;
-    ui.ircUsersProgress->setFormat("%v/%m");
-    ui.ircUsersProgress->setRange(0, max);
-    ui.ircUsersProgress->setValue(val);
-  }
-}
-
 void CoreConnectDlg::syncFinished() {
   if(!wizard) accept();
   else {
 void CoreConnectDlg::syncFinished() {
   if(!wizard) accept();
   else {
index 0877247..3cd7294 100644 (file)
@@ -81,8 +81,6 @@ class CoreConnectDlg : public QDialog {
 
     void coreSessionProgress(quint32, quint32);
     void coreNetworksProgress(quint32, quint32);
 
     void coreSessionProgress(quint32, quint32);
     void coreNetworksProgress(quint32, quint32);
-    void coreChannelsProgress(quint32, quint32);
-    void coreIrcUsersProgress(quint32, quint32);
 
   private:
     Ui::CoreConnectDlg ui;
 
   private:
     Ui::CoreConnectDlg ui;
index 10b28ab..9b62884 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>519</width>
-    <height>325</height>
+    <width>563</width>
+    <height>356</height>
    </rect>
   </property>
   <property name="sizePolicy" >
    </rect>
   </property>
   <property name="sizePolicy" >
       </sizepolicy>
      </property>
      <property name="currentIndex" >
       </sizepolicy>
      </property>
      <property name="currentIndex" >
-      <number>0</number>
+      <number>2</number>
      </property>
      <widget class="QWidget" name="accountPage" >
       <property name="geometry" >
        <rect>
         <x>0</x>
         <y>0</y>
      </property>
      <widget class="QWidget" name="accountPage" >
       <property name="geometry" >
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>511</width>
-        <height>317</height>
+        <width>539</width>
+        <height>331</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" >
        </rect>
       </property>
       <layout class="QVBoxLayout" >
        <rect>
         <x>0</x>
         <y>0</y>
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>511</width>
-        <height>317</height>
+        <width>539</width>
+        <height>332</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" >
        </rect>
       </property>
       <layout class="QVBoxLayout" >
@@ -249,8 +249,8 @@ space</string>
               <rect>
                <x>0</x>
                <y>0</y>
               <rect>
                <x>0</x>
                <y>0</y>
-               <width>485</width>
-               <height>147</height>
+               <width>501</width>
+               <height>145</height>
               </rect>
              </property>
              <layout class="QVBoxLayout" >
               </rect>
              </property>
              <layout class="QVBoxLayout" >
@@ -458,8 +458,8 @@ space</string>
        <rect>
         <x>0</x>
         <y>0</y>
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>511</width>
-        <height>317</height>
+        <width>539</width>
+        <height>332</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" >
        </rect>
       </property>
       <layout class="QVBoxLayout" >
@@ -523,49 +523,6 @@ space</string>
                 </property>
                </widget>
               </item>
                 </property>
                </widget>
               </item>
-              <item row="2" column="0" >
-               <widget class="QLabel" name="label_4" >
-                <property name="text" >
-                 <string>Channel states:</string>
-                </property>
-               </widget>
-              </item>
-              <item row="2" column="1" >
-               <widget class="QProgressBar" name="channelsProgress" >
-                <property name="maximum" >
-                 <number>1</number>
-                </property>
-                <property name="value" >
-                 <number>0</number>
-                </property>
-                <property name="format" >
-                 <string>0/0</string>
-                </property>
-               </widget>
-              </item>
-              <item row="3" column="0" >
-               <widget class="QLabel" name="label_5" >
-                <property name="text" >
-                 <string>User states:</string>
-                </property>
-               </widget>
-              </item>
-              <item row="3" column="1" >
-               <widget class="QProgressBar" name="ircUsersProgress" >
-                <property name="minimum" >
-                 <number>0</number>
-                </property>
-                <property name="maximum" >
-                 <number>1</number>
-                </property>
-                <property name="value" >
-                 <number>0</number>
-                </property>
-                <property name="format" >
-                 <string>0/0</string>
-                </property>
-               </widget>
-              </item>
              </layout>
             </item>
             <item>
              </layout>
             </item>
             <item>