[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3228: Glider was renamed to Thandy. So rename the GliderProcess wr (vidalia/trunk/src/vidalia)
Author: edmanm
Date: 2008-10-14 17:52:26 -0400 (Tue, 14 Oct 2008)
New Revision: 3228
Added:
vidalia/trunk/src/vidalia/updateprocess.cpp
vidalia/trunk/src/vidalia/updateprocess.h
Removed:
vidalia/trunk/src/vidalia/gliderprocess.cpp
vidalia/trunk/src/vidalia/gliderprocess.h
Modified:
vidalia/trunk/src/vidalia/CMakeLists.txt
vidalia/trunk/src/vidalia/mainwindow.cpp
vidalia/trunk/src/vidalia/mainwindow.h
Log:
Glider was renamed to Thandy. So rename the GliderProcess wrapper class
to UpdateProcess.
Modified: vidalia/trunk/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/trunk/src/vidalia/CMakeLists.txt 2008-10-14 02:59:10 UTC (rev 3227)
+++ vidalia/trunk/src/vidalia/CMakeLists.txt 2008-10-14 21:52:26 UTC (rev 3228)
@@ -186,7 +186,7 @@
vmessagebox.cpp
helperprocess.cpp
controlpasswordinputdialog.cpp
- gliderprocess.cpp
+ updateprocess.cpp
)
qt4_wrap_cpp(vidalia_SRCS
vidalia.h
@@ -195,7 +195,7 @@
vidaliawindow.h
vmessagebox.h
helperprocess.h
- gliderprocess.h
+ updateprocess.h
controlpasswordinputdialog.h
)
Deleted: vidalia/trunk/src/vidalia/gliderprocess.cpp
Deleted: vidalia/trunk/src/vidalia/gliderprocess.h
Modified: vidalia/trunk/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/trunk/src/vidalia/mainwindow.cpp 2008-10-14 02:59:10 UTC (rev 3227)
+++ vidalia/trunk/src/vidalia/mainwindow.cpp 2008-10-14 21:52:26 UTC (rev 3228)
@@ -277,12 +277,12 @@
if (settings.isAutoUpdateEnabled()) {
QDateTime lastCheckedAt = settings.lastCheckedForUpdates();
- if (GliderProcess::shouldCheckForUpdates(lastCheckedAt)) {
+ if (UpdateProcess::shouldCheckForUpdates(lastCheckedAt)) {
/* Initiate a background check for updates */
checkForUpdates();
} else {
/* Schedule the next time to check for updates */
- QDateTime nextCheckAt = GliderProcess::nextCheckForUpdates(lastCheckedAt);
+ QDateTime nextCheckAt = UpdateProcess::nextCheckForUpdates(lastCheckedAt);
QDateTime now = QDateTime::currentDateTime().toUTC();
_updateTimer.start((nextCheckAt.toTime_t() - now.toTime_t()) * 1000);
}
@@ -1497,7 +1497,7 @@
* be done in the background, notifying the user only if there are
* updates to be installed.
*/
- _gliderProcess.checkForUpdates("takemeforarideonyourmagicglider.exe",
+ _updateProcess.checkForUpdates("takemeforarideonyourmagicglider.exe",
QStringList() << "plztohasnewtor");
/* XXX: The stuff below should be moved to another method that gets called
@@ -1507,6 +1507,6 @@
settings.setLastCheckedForUpdates(QDateTime::currentDateTime().toUTC());
/* Restart the "Check for Updates" timer */
- _updateTimer.start(GliderProcess::checkForUpdatesInterval() * 1000);
+ _updateTimer.start(UpdateProcess::checkForUpdatesInterval() * 1000);
}
Modified: vidalia/trunk/src/vidalia/mainwindow.h
===================================================================
--- vidalia/trunk/src/vidalia/mainwindow.h 2008-10-14 02:59:10 UTC (rev 3227)
+++ vidalia/trunk/src/vidalia/mainwindow.h 2008-10-14 21:52:26 UTC (rev 3228)
@@ -33,7 +33,7 @@
#include "ui_mainwindow.h"
#include "helperprocess.h"
#include "config.h"
-#include "gliderprocess.h"
+#include "updateprocess.h"
#if defined(USE_MINIUPNPC)
#include "config/upnpcontrol.h"
@@ -212,8 +212,8 @@
TrayIcon _trayIcon;
/** Timer used to remind us to check for software updates. */
QTimer _updateTimer;
- /** The Glider process used to check for and download updates. */
- GliderProcess _gliderProcess;
+ /** The auto-update process used to check for and download updates. */
+ UpdateProcess _updateProcess;
/** The menubar (Mac OS X only). */
QMenuBar *_menuBar;
Copied: vidalia/trunk/src/vidalia/updateprocess.cpp (from rev 3219, vidalia/trunk/src/vidalia/gliderprocess.cpp)
===================================================================
--- vidalia/trunk/src/vidalia/updateprocess.cpp (rev 0)
+++ vidalia/trunk/src/vidalia/updateprocess.cpp 2008-10-14 21:52:26 UTC (rev 3228)
@@ -0,0 +1,76 @@
+/*
+** 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 <QtDebug>
+
+#include "updateprocess.h"
+
+
+UpdateProcess::UpdateProcess(QObject *parent)
+ : QProcess(parent)
+{
+ connect(this, SIGNAL(readyReadStandardError()),
+ this, SLOT(readStandardError()));
+ connect(this, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(readStandardOutput()));
+}
+
+void
+UpdateProcess::checkForUpdates(const QString &updaterExecutable,
+ const QStringList &args)
+{
+ start(updaterExecutable, args);
+}
+
+void
+UpdateProcess::readStandardError()
+{
+ QString line;
+
+ setReadChannel(QProcess::StandardError);
+ while (canReadLine()) {
+ line = readLine();
+ qDebug() << QString("updater (stderr): %1").arg(line);
+ }
+}
+
+void
+UpdateProcess::readStandardOutput()
+{
+ QString line;
+
+ setReadChannel(QProcess::StandardOutput);
+ while (canReadLine()) {
+ line = readLine();
+ qDebug() << QString("updater (stdout): %1").arg(line);
+ }
+}
+
+int
+UpdateProcess::checkForUpdatesInterval()
+{
+ /* XXX: Check once a day. I totally made this up. We want to do something
+ * smarter here. */
+ return 24*60*60;
+}
+
+QDateTime
+UpdateProcess::nextCheckForUpdates(const QDateTime &lastCheckedAt)
+{
+ return lastCheckedAt.toUTC().addSecs(checkForUpdatesInterval());
+}
+
+bool
+UpdateProcess::shouldCheckForUpdates(const QDateTime &lastCheckedAt)
+{
+ QDateTime nextCheck = nextCheckForUpdates(lastCheckedAt);
+ return (nextCheck >= QDateTime::currentDateTime().toUTC());
+}
+
Property changes on: vidalia/trunk/src/vidalia/updateprocess.cpp
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: vidalia/trunk/src/vidalia/updateprocess.h (from rev 3219, vidalia/trunk/src/vidalia/gliderprocess.h)
===================================================================
--- vidalia/trunk/src/vidalia/updateprocess.h (rev 0)
+++ vidalia/trunk/src/vidalia/updateprocess.h 2008-10-14 21:52:26 UTC (rev 3228)
@@ -0,0 +1,63 @@
+/*
+** 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 _UPDATEPROCESS_H
+#define _UPDATEPROCESS_H
+
+#include <QProcess>
+#include <QDateTime>
+#include <QStringList>
+
+
+class UpdateProcess : public QProcess
+{
+ Q_OBJECT
+
+public:
+ /** Default constructor.
+ */
+ UpdateProcess(QObject *parent = 0);
+
+ /** Begin a check for software updates using the updater binary specified
+ * by <b>updaterExecutable</b>. The arguments in <b>args</b> will be given
+ * to the auto-update binary on the command line.
+ */
+ void checkForUpdates(const QString &updaterExecutable,
+ const QStringList &args);
+
+ /** Return the time at which we should next check for available updates,
+ * given the last we checked was at <b>lastCheckedAt</b>.
+ */
+ static QDateTime nextCheckForUpdates(const QDateTime &lastCheckedAt);
+
+ /** Return true if we should check for available software udpates, given
+ * the last time we checked was at <b>lastCheckedAt</b>. The returned
+ * QDateTime will be in UTC.
+ */
+ static bool shouldCheckForUpdates(const QDateTime &lastCheckedAt);
+
+ /** Returns the preferred interval (in seconds) between executions of the
+ * Glider process to check for available software updates. */
+ static int checkForUpdatesInterval();
+
+protected slots:
+ /** Called when there is data to be read from the update process's stdout.
+ * Reads and parses all available data.
+ */
+ void readStandardOutput();
+
+ /** Called when there is data to be read from the update process's stderr.
+ * Reads and parses all available data.
+ */
+ void readStandardError();
+};
+
+#endif
+
Property changes on: vidalia/trunk/src/vidalia/updateprocess.h
___________________________________________________________________
Name: svn:mergeinfo
+