[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3387: Add a dialog that can display the progress of the updater as (vidalia/branches/auto-updates/src/vidalia)



Author: edmanm
Date: 2008-12-13 01:00:41 -0500 (Sat, 13 Dec 2008)
New Revision: 3387

Added:
   vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.cpp
   vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.h
   vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.ui
Modified:
   vidalia/branches/auto-updates/src/vidalia/CMakeLists.txt
Log:
Add a dialog that can display the progress of the updater as it checks for
updates, downloads available updates and then installs the updates.


Modified: vidalia/branches/auto-updates/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/CMakeLists.txt	2008-12-13 05:13:13 UTC (rev 3386)
+++ vidalia/branches/auto-updates/src/vidalia/CMakeLists.txt	2008-12-13 06:00:41 UTC (rev 3387)
@@ -225,12 +225,17 @@
     packageinfo.cpp
     updatedialog.cpp
     updateprocess.cpp
+    updateprogressdialog.cpp
   )
   qt4_wrap_cpp(vidalia_SRCS
     updatedialog.h
     updateprocess.h
+    updateprogressdialog.h
   )
-  qt4_wrap_ui(vidalia_SRCS updatedialog.ui)
+  qt4_wrap_ui(vidalia_SRCS
+    updatedialog.ui
+    updateprogressdialog.ui
+  )
 endif(USE_AUTOUPDATE)
 
 ## Add the resource files (icons, etc.)

Added: vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.cpp
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.cpp	                        (rev 0)
+++ vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.cpp	2008-12-13 06:00:41 UTC (rev 3387)
@@ -0,0 +1,91 @@
+/*
+**  This file is part of Vidalia, and is subject to the license terms in the
+**  LICENSE file, found in the top level directory of this distribution. If you
+**  did not receive the LICENSE file with this file, you may obtain it from the
+**  Vidalia source package distributed by the Vidalia Project at
+**  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+**  may be copied, modified, propagated, or distributed except according to the
+**  terms described in the LICENSE file.
+*/
+
+#include "updateprogressdialog.h"
+
+
+UpdateProgressDialog::UpdateProgressDialog(QWidget *parent)
+  : QDialog(parent)
+{
+  ui.setupUi(this);
+
+  connect(ui.btnHide, SIGNAL(clicked()), this, SLOT(onHide()));
+  connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(onCancel()));
+
+  setModal(true);
+}
+
+void
+UpdateProgressDialog::setStatus(UpdateProgressDialog::Status status)
+{
+  switch (status) {
+    case CheckingForUpdates:
+      ui.lblCurrentAction->setText(tr("Checking for available updates..."));
+
+      ui.progressBar->setMinimum(0);
+      ui.progressBar->setMaximum(0);
+
+      ui.btnHide->setText(tr("Hide"));
+      ui.btnCancel->setVisible(true);
+      ui.btnCancel->setEnabled(true);
+      break;
+
+    case DownloadingUpdates:
+      ui.lblCurrentAction->setText(tr("Downloading updates..."));
+      break;
+
+    case InstallingUpdates:
+      ui.lblCurrentAction->setText(tr("Installing updated software..."));
+
+      ui.progressBar->setMinimum(0);
+      ui.progressBar->setMaximum(0);
+
+      ui.btnCancel->setEnabled(false);
+      break;
+
+    case UpdatesInstalled:
+      ui.lblCurrentAction->setText(tr("Done! Your software is now up to date."));
+
+      ui.progressBar->setMinimum(0);
+      ui.progressBar->setMaximum(1);
+      ui.progressBar->setValue(1);
+
+      ui.btnHide->setText(tr("OK"));
+      ui.btnCancel->setVisible(false);
+      break;
+
+    default:
+      break;
+  }
+}
+
+void
+UpdateProgressDialog::setDownloadProgress(const QString &url,
+                                          int bytesReceived, int bytesTotal)
+{
+  Q_UNUSED(url);
+
+  setStatus(DownloadingUpdates);
+  ui.progressBar->setMaximum(bytesTotal);
+  ui.progressBar->setValue(bytesReceived);
+}
+
+void
+UpdateProgressDialog::onHide()
+{
+  setVisible(false);
+}
+
+void
+UpdateProgressDialog::onCancel()
+{
+  emit cancelUpdate();
+}
+


Property changes on: vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.h
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.h	                        (rev 0)
+++ vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.h	2008-12-13 06:00:41 UTC (rev 3387)
@@ -0,0 +1,70 @@
+/*
+**  This file is part of Vidalia, and is subject to the license terms in the
+**  LICENSE file, found in the top level directory of this distribution. If you
+**  did not receive the LICENSE file with this file, you may obtain it from the
+**  Vidalia source package distributed by the Vidalia Project at
+**  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+**  may be copied, modified, propagated, or distributed except according to the
+**  terms described in the LICENSE file.
+*/
+
+#ifndef _UPDATEPROGRESSDIALOG_H
+#define _UPDATEPROGRESSDIALOG_H
+
+#include <QDialog>
+
+#include "ui_updateprogressdialog.h"
+
+
+class UpdateProgressDialog : public QDialog
+{
+  Q_OBJECT
+
+public:
+  enum Status {
+    CheckingForUpdates,
+    DownloadingUpdates,
+    InstallingUpdates,
+    UpdatesInstalled,
+  };
+
+  /** Default constructor.
+   */
+  UpdateProgressDialog(QWidget *parent = 0);
+
+  /** Updates the dialog's display to reflect the current action indicated
+   * by <b>status</b>.
+   */
+  void setStatus(UpdateProgressDialog::Status status);
+
+signals:
+  /** Emitted when the user clicks the "Cancel" button indicating they
+   * want to terminate the current check for available updates.
+   */
+  void cancelUpdate();
+
+public slots:
+  /** Called when more bytes of <b>url</b> have been received.
+   * <b>bytesReceived</b> indicates how many bytes have been downloaded so
+   * far and <b>bytesTotal</b> indicates the total size of the update to be
+   * downloaded.
+   */
+  void setDownloadProgress(const QString &url,
+                           int bytesReceived, int bytesTotal);
+
+private slots:
+  /** Called when the user clicks the "Cancel" button. Emits the
+   * cancelUpdate() signal.
+   */
+  void onHide();
+
+  /** Called when the user clicks the "Hide" button. Hides the dialog
+   * box.
+   */
+  void onCancel();
+
+private:
+  Ui::UpdateProgressDialog ui; /**< Qt Designer generated object. */
+};
+
+#endif


Property changes on: vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.h
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.ui
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.ui	                        (rev 0)
+++ vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.ui	2008-12-13 06:00:41 UTC (rev 3387)
@@ -0,0 +1,102 @@
+<ui version="4.0" >
+ <class>UpdateProgressDialog</class>
+ <widget class="QDialog" name="UpdateProgressDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>366</width>
+    <height>104</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Software Updates</string>
+  </property>
+  <property name="windowIcon" >
+   <iconset resource="res/vidalia.qrc" >
+    <normaloff>:/images/32x32/system-software-update.png</normaloff>:/images/32x32/system-software-update.png</iconset>
+  </property>
+  <layout class="QGridLayout" name="gridLayout" >
+   <item rowspan="2" row="0" column="0" >
+    <widget class="QLabel" name="label" >
+     <property name="text" >
+      <string/>
+     </property>
+     <property name="pixmap" >
+      <pixmap resource="res/vidalia.qrc" >:/images/48x48/system-software-update.png</pixmap>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1" >
+    <widget class="QLabel" name="lblCurrentAction" >
+     <property name="text" >
+      <string>Checking for updates...</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1" >
+    <widget class="QProgressBar" name="progressBar" >
+     <property name="maximum" >
+      <number>0</number>
+     </property>
+     <property name="value" >
+      <number>-1</number>
+     </property>
+     <property name="textVisible" >
+      <bool>false</bool>
+     </property>
+     <property name="format" >
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" colspan="2" >
+    <layout class="QHBoxLayout" name="horizontalLayout" >
+     <item>
+      <spacer name="horizontalSpacer" >
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnCancel" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnHide" >
+       <property name="text" >
+        <string>Hide</string>
+       </property>
+       <property name="default" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="res/vidalia.qrc" />
+ </resources>
+ <connections/>
+</ui>


Property changes on: vidalia/branches/auto-updates/src/vidalia/updateprogressdialog.ui
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native