mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Improve integrated update code to match the rest
We're doing updates over HTTP until we get a domain name and a cert, but this is not at all an issue since updates are still signed and checked.
This commit is contained in:
parent
6606688bf3
commit
d67e6c7449
6
qtox.pro
6
qtox.pro
|
@ -47,8 +47,14 @@ include(translations/i18n.pri)
|
|||
# Build all the qm files now, to make RCC happy
|
||||
system($$fromfile(translations/i18n.pri, updateallqm))
|
||||
|
||||
isEmpty(GIT_VERSION) {
|
||||
GIT_VERSION = $$system(git rev-parse HEAD 2> /dev/null || echo "built without git")
|
||||
}
|
||||
DEFINES += GIT_VERSION=\"\\\"$$quote($$GIT_VERSION)\\\"\"
|
||||
isEmpty(GIT_DESCRIBE) {
|
||||
GIT_DESCRIBE = $$system(git describe --tags 2> /dev/null || echo "Nightly")
|
||||
}
|
||||
DEFINES += GIT_DESCRIBE=\"\\\"$$quote($$GIT_DESCRIBE)\\\"\"
|
||||
# date works on linux/mac, but it would hangs qmake on windows
|
||||
# This hack returns 0 on batch (windows), but executes "date +%s" or return 0 if it fails on bash (linux/mac)
|
||||
TIMESTAMP = $$system($1 2>null||echo 0||a;rm null;date +%s||echo 0) # I'm so sorry
|
||||
|
|
|
@ -90,6 +90,8 @@ void logMessageHandler(QtMsgType type, const QMessageLogContext& ctxt, const QSt
|
|||
#endif
|
||||
}
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
qInstallMessageHandler(logMessageHandler); // Enable log as early as possible
|
||||
|
@ -127,7 +129,7 @@ int main(int argc, char *argv[])
|
|||
if (logFileFile->open(QIODevice::Append))
|
||||
{
|
||||
logFileStream->setDevice(logFileFile.get());
|
||||
*logFileStream << QDateTime::currentDateTime().toString("\nyyyy-MM-dd HH:mm:ss' file logger starting\n'");
|
||||
*logFileStream << QDateTime::currentDateTime().toString("\nyyyy-MM-dd HH:mm:ss' qTox file logger starting\n'");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -143,6 +145,10 @@ int main(int argc, char *argv[])
|
|||
qDebug() << "built on: " << __TIME__ << __DATE__ << "(" << TIMESTAMP << ")";
|
||||
qDebug() << "commit: " << GIT_VERSION << "\n";
|
||||
|
||||
long unsigned int bufsize=100;
|
||||
char buf[100];
|
||||
GetUserNameA(buf, &bufsize);
|
||||
|
||||
#if defined(Q_OS_MACX) && defined(QT_RELEASE)
|
||||
osx::moveToAppFolder();
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "src/persistence/settings.h"
|
||||
#include "src/widget/widget.h"
|
||||
#include "src/widget/gui.h"
|
||||
#include "src/nexus.h"
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QCoreApplication>
|
||||
|
@ -31,6 +32,8 @@
|
|||
#include <QProcess>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QMessageBox>
|
||||
#include <QMutexLocker>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
|
@ -72,8 +75,11 @@ unsigned char AutoUpdater::key[crypto_sign_PUBLICKEYBYTES];
|
|||
const QString AutoUpdater::checkURI = AutoUpdater::updateServer+"/qtox/"+AutoUpdater::platform+"/version";
|
||||
const QString AutoUpdater::flistURI = AutoUpdater::updateServer+"/qtox/"+AutoUpdater::platform+"/flist";
|
||||
const QString AutoUpdater::filesURI = AutoUpdater::updateServer+"/qtox/"+AutoUpdater::platform+"/files/";
|
||||
bool AutoUpdater::abortFlag{false};
|
||||
std::atomic_bool AutoUpdater::abortFlag{false};
|
||||
std::atomic_bool AutoUpdater::isDownloadingUpdate{false};
|
||||
std::atomic<float> AutoUpdater::progressValue{0};
|
||||
QString AutoUpdater::progressVersion;
|
||||
QMutex AutoUpdater::progressVersionMutex;
|
||||
|
||||
bool AutoUpdater::isUpdateAvailable()
|
||||
{
|
||||
|
@ -97,7 +103,11 @@ AutoUpdater::VersionInfo AutoUpdater::getUpdateVersion()
|
|||
QNetworkAccessManager *manager = new QNetworkAccessManager;
|
||||
QNetworkReply* reply = manager->get(QNetworkRequest(QUrl(checkURI)));
|
||||
while (!reply->isFinished())
|
||||
{
|
||||
if (abortFlag)
|
||||
return versionInfo;
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
|
@ -207,7 +217,11 @@ QByteArray AutoUpdater::getUpdateFlist()
|
|||
QNetworkAccessManager *manager = new QNetworkAccessManager;
|
||||
QNetworkReply* reply = manager->get(QNetworkRequest(QUrl(flistURI)));
|
||||
while (!reply->isFinished())
|
||||
{
|
||||
if (abortFlag)
|
||||
return flist;
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
|
@ -238,8 +252,6 @@ QList<AutoUpdater::UpdateFileMeta> AutoUpdater::genUpdateDiff(QList<UpdateFileMe
|
|||
bool AutoUpdater::isUpToDate(AutoUpdater::UpdateFileMeta fileMeta)
|
||||
{
|
||||
QString appDir = qApp->applicationDirPath();
|
||||
qDebug() << "App path:"<<appDir;
|
||||
|
||||
QFile file(appDir+QDir::separator()+fileMeta.installpath);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
|
@ -252,13 +264,15 @@ bool AutoUpdater::isUpToDate(AutoUpdater::UpdateFileMeta fileMeta)
|
|||
return true;
|
||||
}
|
||||
|
||||
AutoUpdater::UpdateFile AutoUpdater::getUpdateFile(UpdateFileMeta fileMeta)
|
||||
AutoUpdater::UpdateFile AutoUpdater::getUpdateFile(UpdateFileMeta fileMeta,
|
||||
std::function<void(int,int)> progressCallback)
|
||||
{
|
||||
UpdateFile file;
|
||||
file.metadata = fileMeta;
|
||||
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager;
|
||||
QNetworkReply* reply = manager->get(QNetworkRequest(QUrl(filesURI+fileMeta.id)));
|
||||
QObject::connect(reply, &QNetworkReply::downloadProgress, progressCallback);
|
||||
while (!reply->isFinished())
|
||||
{
|
||||
if (abortFlag)
|
||||
|
@ -297,6 +311,9 @@ bool AutoUpdater::downloadUpdate()
|
|||
QList<UpdateFileMeta> newFlist = parseFlist(newFlistData);
|
||||
QList<UpdateFileMeta> diff = genUpdateDiff(newFlist);
|
||||
|
||||
// Progress
|
||||
progressValue = 0;
|
||||
|
||||
if (abortFlag)
|
||||
{
|
||||
isDownloadingUpdate = false;
|
||||
|
@ -329,9 +346,17 @@ bool AutoUpdater::downloadUpdate()
|
|||
newFlistFile.write(newFlistData);
|
||||
newFlistFile.close();
|
||||
|
||||
progressValue = 1;
|
||||
|
||||
// Download and write each new file
|
||||
for (UpdateFileMeta fileMeta : diff)
|
||||
{
|
||||
float initialProgress = progressValue, step = 99./diff.size();
|
||||
auto stepProgressCallback = [&](int current, int total)
|
||||
{
|
||||
progressValue = initialProgress + step * (float)current/total;
|
||||
};
|
||||
|
||||
if (abortFlag)
|
||||
{
|
||||
isDownloadingUpdate = false;
|
||||
|
@ -355,17 +380,13 @@ bool AutoUpdater::downloadUpdate()
|
|||
QDir().mkpath(fileDirStr);
|
||||
|
||||
// Download
|
||||
UpdateFile file = getUpdateFile(fileMeta);
|
||||
UpdateFile file = getUpdateFile(fileMeta, stepProgressCallback);
|
||||
if (abortFlag)
|
||||
{
|
||||
isDownloadingUpdate = false;
|
||||
return false;
|
||||
}
|
||||
goto fail;
|
||||
if (file.data.isNull())
|
||||
{
|
||||
qCritical() << "downloadUpdate: Error downloading a file, aborting...";
|
||||
isDownloadingUpdate = false;
|
||||
return false;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// Check signature
|
||||
|
@ -373,25 +394,32 @@ bool AutoUpdater::downloadUpdate()
|
|||
file.data.size(), key) != 0)
|
||||
{
|
||||
qCritical() << "downloadUpdate: RECEIVED FORGED FILE, aborting...";
|
||||
isDownloadingUpdate = false;
|
||||
return false;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// Save
|
||||
if (!fileFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
qCritical() << "downloadUpdate: Can't save new update file, aborting...";
|
||||
isDownloadingUpdate = false;
|
||||
return false;
|
||||
goto fail;
|
||||
}
|
||||
fileFile.write(file.data);
|
||||
fileFile.close();
|
||||
|
||||
progressValue = initialProgress + step;
|
||||
}
|
||||
|
||||
qDebug() << "downloadUpdate: The update is ready, it'll be installed on the next restart";
|
||||
|
||||
isDownloadingUpdate = false;
|
||||
progressValue = 100;
|
||||
return true;
|
||||
|
||||
fail:
|
||||
isDownloadingUpdate = false;
|
||||
progressValue = 0;
|
||||
setProgressVersion("");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutoUpdater::isLocalUpdateReady()
|
||||
|
@ -437,43 +465,36 @@ void AutoUpdater::installLocalUpdate()
|
|||
{
|
||||
qDebug() << "About to start the qTox updater to install a local update";
|
||||
|
||||
// Delete the update if we fail so we don't fail again.
|
||||
|
||||
// Updates only for supported platforms.
|
||||
if (platform.isEmpty())
|
||||
// Prepare to delete the update if we fail so we don't fail again.
|
||||
auto failExit = []()
|
||||
{
|
||||
qCritical() << "Failed to start the qTox updater, removing the update and exiting";
|
||||
QString updateDirStr = Settings::getInstance().getSettingsDirPath() + "/update/";
|
||||
QDir(updateDirStr).removeRecursively();
|
||||
exit(-1);
|
||||
}
|
||||
};
|
||||
|
||||
// Updates only for supported platforms.
|
||||
if (platform.isEmpty())
|
||||
failExit();
|
||||
|
||||
// Workaround QTBUG-7645
|
||||
// QProcess fails silently when elevation is required instead of showing a UAC prompt on Win7/Vista
|
||||
#ifdef Q_OS_WIN
|
||||
HINSTANCE result = ::ShellExecuteA(0, "open", updaterBin.toUtf8().constData(), 0, 0, SW_SHOWNORMAL);
|
||||
HINSTANCE result = ::ShellExecuteW(0, L"open", updaterBin.toStdWString().c_str(), 0, 0, SW_SHOWNORMAL);
|
||||
if (result == (HINSTANCE)SE_ERR_ACCESSDENIED)
|
||||
{
|
||||
// Requesting elevation
|
||||
result = ::ShellExecuteA(0, "runas", updaterBin.toUtf8().constData(), 0, 0, SW_SHOWNORMAL);
|
||||
result = ::ShellExecuteW(0, L"runas", updaterBin.toStdWString().c_str(), 0, 0, SW_SHOWNORMAL);
|
||||
}
|
||||
if (result <= (HINSTANCE)32)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
failExit();
|
||||
#else
|
||||
if (!QProcess::startDetached(updaterBin))
|
||||
goto fail;
|
||||
failExit();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
|
||||
// Centralized error handling
|
||||
fail:
|
||||
qCritical() << "Failed to start the qTox updater, removing the update and exiting";
|
||||
QString updateDirStr = Settings::getInstance().getSettingsDirPath() + "/update/";
|
||||
QDir(updateDirStr).removeRecursively();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void AutoUpdater::checkUpdatesAsyncInteractive()
|
||||
|
@ -497,6 +518,7 @@ void AutoUpdater::checkUpdatesAsyncInteractiveWorker()
|
|||
|
||||
if (updateDir.exists() && QFile(updateDirStr+"flist").exists())
|
||||
{
|
||||
setProgressVersion(getUpdateVersion().versionString);
|
||||
downloadUpdate();
|
||||
return;
|
||||
}
|
||||
|
@ -513,12 +535,31 @@ void AutoUpdater::checkUpdatesAsyncInteractiveWorker()
|
|||
if (GUI::askQuestion(QObject::tr("Update", "The title of a message box"),
|
||||
contentText, true, false))
|
||||
{
|
||||
setProgressVersion(newVersion.versionString);
|
||||
GUI::showUpdateDownloadProgress();
|
||||
downloadUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void AutoUpdater::setProgressVersion(QString version)
|
||||
{
|
||||
QMutexLocker lock(&progressVersionMutex);
|
||||
progressVersion = version;
|
||||
}
|
||||
|
||||
void AutoUpdater::abortUpdates()
|
||||
{
|
||||
abortFlag = true;
|
||||
isDownloadingUpdate = false;
|
||||
}
|
||||
|
||||
QString AutoUpdater::getProgressVersion()
|
||||
{
|
||||
QMutexLocker lock(&progressVersionMutex);
|
||||
return progressVersion;
|
||||
}
|
||||
|
||||
int AutoUpdater::getProgressValue()
|
||||
{
|
||||
return progressValue;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QMutex>
|
||||
#include <sodium.h>
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
/// For now we only support auto updates on Windows and OS X, although extending it is not a technical issue.
|
||||
/// Linux users are expected to use their package managers or update manually through official channels.
|
||||
|
@ -94,6 +96,9 @@ public:
|
|||
/// Aborting will make some functions try to return early
|
||||
/// Call before qTox exits to avoid the updater running in the background
|
||||
static void abortUpdates();
|
||||
/// Functions giving info on the progress of update downloads
|
||||
static QString getProgressVersion();
|
||||
static int getProgressValue();
|
||||
|
||||
protected:
|
||||
/// Parses and validates a flist file. Returns an empty list on error
|
||||
|
@ -108,10 +113,12 @@ protected:
|
|||
/// Tries to fetch the file from the update server. Returns a file with a null QByteArray on error.
|
||||
/// Note that a file with an empty but non-null QByteArray is not an error, merely a file of size 0.
|
||||
/// Will try to follow qTox's proxy settings, may block and processEvents
|
||||
static UpdateFile getUpdateFile(UpdateFileMeta fileMeta);
|
||||
static UpdateFile getUpdateFile(UpdateFileMeta fileMeta, std::function<void(int,int)> progressCallback);
|
||||
/// Does the actual work for checkUpdatesAsyncInteractive
|
||||
/// Blocking, but otherwise has the same properties than checkUpdatesAsyncInteractive
|
||||
static void checkUpdatesAsyncInteractiveWorker();
|
||||
/// Thread safe setter
|
||||
static void setProgressVersion(QString version);
|
||||
|
||||
private:
|
||||
AutoUpdater() = delete;
|
||||
|
@ -125,8 +132,11 @@ private:
|
|||
static const QString filesURI; ///< URI of the actual files of the latest version
|
||||
static const QString updaterBin; ///< Path to the qtox-updater binary
|
||||
static unsigned char key[];
|
||||
static bool abortFlag; ///< If true, try to abort everything.
|
||||
static std::atomic_bool abortFlag; ///< If true, try to abort everything.
|
||||
static std::atomic_bool isDownloadingUpdate; ///< We'll pretend there's no new update available if we're already updating
|
||||
static std::atomic<float> progressValue;
|
||||
static QString progressVersion;
|
||||
static QMutex progressVersionMutex; ///< No, we can't just make the QString atomic
|
||||
};
|
||||
|
||||
#endif // AUTOUPDATE_H
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "aboutform.h"
|
||||
#include "src/widget/translator.h"
|
||||
#include "tox/tox.h"
|
||||
#include "src/net/autoupdate.h"
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
AboutForm::AboutForm() :
|
||||
GenericForm(QPixmap(":/img/settings/general.png"))
|
||||
|
@ -33,6 +36,12 @@ AboutForm::AboutForm() :
|
|||
if (QString(GIT_VERSION).indexOf(" ") > -1)
|
||||
bodyUI->gitVersion->setOpenExternalLinks(false);
|
||||
|
||||
showUpdateProgress();
|
||||
progressTimer = new QTimer();
|
||||
progressTimer->setInterval(500);
|
||||
progressTimer->setSingleShot(false);
|
||||
connect(progressTimer, &QTimer::timeout, this, &AboutForm::showUpdateProgress);
|
||||
|
||||
Translator::registerHandler(std::bind(&AboutForm::retranslateUi, this), this);
|
||||
}
|
||||
|
||||
|
@ -40,6 +49,7 @@ AboutForm::AboutForm() :
|
|||
//nightly builds from stable releases.
|
||||
void AboutForm::replaceVersions()
|
||||
{
|
||||
bodyUI->youareusing->setText(bodyUI->youareusing->text().replace("$GIT_DESCRIBE", QString(GIT_DESCRIBE)));
|
||||
bodyUI->gitVersion->setText(bodyUI->gitVersion->text().replace("$GIT_VERSION", QString(GIT_VERSION)));
|
||||
bodyUI->toxCoreVersion->setText(
|
||||
bodyUI->toxCoreVersion->text().replace("$TOXCOREVERSION",
|
||||
|
@ -52,11 +62,46 @@ void AboutForm::replaceVersions()
|
|||
AboutForm::~AboutForm()
|
||||
{
|
||||
Translator::unregister(this);
|
||||
delete progressTimer;
|
||||
delete bodyUI;
|
||||
}
|
||||
|
||||
void AboutForm::showUpdateProgress()
|
||||
{
|
||||
QString version = AutoUpdater::getProgressVersion();
|
||||
int value = AutoUpdater::getProgressValue();
|
||||
|
||||
if (version.isEmpty())
|
||||
{
|
||||
bodyUI->updateProgress->setVisible(value != 0);
|
||||
bodyUI->updateText->setVisible(value != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value == 100)
|
||||
bodyUI->updateText->setText(tr("Restart qTox to install version %1").arg(version));
|
||||
else
|
||||
bodyUI->updateText->setText(tr("qTox is downloading update %1", "%1 is the version of the update").arg(version));
|
||||
bodyUI->updateProgress->setValue(value);
|
||||
|
||||
bodyUI->updateProgress->setVisible(value != 0 && value != 100);
|
||||
bodyUI->updateText->setVisible(value != 0);
|
||||
}
|
||||
}
|
||||
|
||||
void AboutForm::hideEvent(QHideEvent *)
|
||||
{
|
||||
progressTimer->stop();
|
||||
}
|
||||
|
||||
void AboutForm::showEvent(QShowEvent *)
|
||||
{
|
||||
progressTimer->start();
|
||||
}
|
||||
|
||||
void AboutForm::retranslateUi()
|
||||
{
|
||||
bodyUI->retranslateUi(this);
|
||||
replaceVersions();
|
||||
showUpdateProgress();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "genericsettings.h"
|
||||
|
||||
class Core;
|
||||
class QTimer;
|
||||
|
||||
namespace Ui {
|
||||
class AboutSettings;
|
||||
|
@ -39,6 +40,9 @@ public:
|
|||
protected:
|
||||
|
||||
private slots:
|
||||
void showUpdateProgress();
|
||||
virtual void hideEvent(QHideEvent*) final override;
|
||||
virtual void showEvent(QShowEvent*) final override;
|
||||
|
||||
private:
|
||||
void retranslateUi();
|
||||
|
@ -46,6 +50,7 @@ private:
|
|||
|
||||
private:
|
||||
Ui::AboutSettings* bodyUI;
|
||||
QTimer* progressTimer;
|
||||
};
|
||||
|
||||
#endif // ABOUTFORM_H
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>496</width>
|
||||
<height>565</height>
|
||||
<width>493</width>
|
||||
<height>534</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0,0">
|
||||
|
@ -128,7 +128,7 @@
|
|||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You are using a qTox nightly build.</string>
|
||||
<string>You are using qTox version $GIT_DESCRIBE.</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>-1</number>
|
||||
|
@ -141,6 +141,32 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QProgressBar" name="updateProgress">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>Downloading update: %p%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="updateText">
|
||||
<property name="text">
|
||||
<string>Update text</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -183,12 +209,12 @@
|
|||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Oxygen-Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; color:#000000;">Copyright © 2014-2015 by The qTox Project</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">qTox is a Qt-based graphical interface for Tox.</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">You should have received a copy of the GNU General Public License along with this program. If not, see </span><a href="https://www.gnu.org/copyleft/gpl.html"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#007af4;">https://www.gnu.org/copyleft/gpl.html</span></a><span style=" font-family:'Ubuntu';">.</span></p></body></html></string>
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt; color:#000000;">Copyright © 2014-2015 by The qTox Project</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">qTox is a Qt-based graphical interface for Tox.</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt;">qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt;">qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">You should have received a copy of the GNU General Public License along with this program. If not, see </span><a href="https://www.gnu.org/copyleft/gpl.html"><span style=" font-family:'Ubuntu'; font-size:10pt; text-decoration: underline; color:#007af4;">https://www.gnu.org/copyleft/gpl.html</span></a><span style=" font-family:'Ubuntu'; font-size:10pt;">.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="searchPaths">
|
||||
<stringlist/>
|
||||
|
|
|
@ -101,6 +101,18 @@ void GUI::reloadTheme()
|
|||
}
|
||||
}
|
||||
|
||||
void GUI::showUpdateDownloadProgress()
|
||||
{
|
||||
if (QThread::currentThread() == qApp->thread())
|
||||
{
|
||||
getInstance()._showUpdateDownloadProgress();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMetaObject::invokeMethod(&getInstance(), "_showUpdateDownloadProgress", Qt::BlockingQueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::showInfo(const QString& title, const QString& msg)
|
||||
{
|
||||
if (QThread::currentThread() == qApp->thread())
|
||||
|
@ -267,6 +279,13 @@ void GUI::_showError(const QString& title, const QString& msg)
|
|||
QMessageBox::critical(getMainWidget(), title, msg);
|
||||
}
|
||||
|
||||
void GUI::_showUpdateDownloadProgress()
|
||||
{
|
||||
#ifndef Q_OS_ANDROID
|
||||
Nexus::getDesktopGUI()->showUpdateDownloadProgress();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GUI::_askQuestion(const QString& title, const QString& msg,
|
||||
bool defaultAns, bool warning,
|
||||
bool yesno)
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
static void setWindowTitle(const QString& title);
|
||||
/// Reloads the application theme and redraw the window
|
||||
static void reloadTheme();
|
||||
/// Optionally switches to a view of the qTox update being downloaded
|
||||
static void showUpdateDownloadProgress();
|
||||
/// Show some text to the user, for example in a message box
|
||||
static void showInfo(const QString& title, const QString& msg);
|
||||
/// Show a warning to the user, for example in a message box
|
||||
|
@ -93,6 +95,7 @@ private slots:
|
|||
void _showInfo(const QString& title, const QString& msg);
|
||||
void _showWarning(const QString& title, const QString& msg);
|
||||
void _showError(const QString& title, const QString& msg);
|
||||
void _showUpdateDownloadProgress();
|
||||
bool _askQuestion(const QString& title, const QString& msg,
|
||||
bool defaultAns = false, bool warning = true,
|
||||
bool yesno = true);
|
||||
|
|
|
@ -484,6 +484,12 @@ Widget* Widget::getInstance()
|
|||
return instance;
|
||||
}
|
||||
|
||||
void Widget::showUpdateDownloadProgress()
|
||||
{
|
||||
settingsWidget->showAbout();
|
||||
onSettingsClicked();
|
||||
}
|
||||
|
||||
void Widget::moveEvent(QMoveEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Move)
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
QString getUsername();
|
||||
Camera* getCamera();
|
||||
static Widget* getInstance();
|
||||
void showUpdateDownloadProgress(); ///< Switches to the About settings page
|
||||
void addFriendDialog(Friend* frnd, ContentDialog* dialog);
|
||||
void addGroupDialog(Group* group, ContentDialog* dialog);
|
||||
bool newFriendMessageAlert(int friendId, bool sound=true);
|
||||
|
|
Loading…
Reference in New Issue
Block a user