Added developer documentation links in readme file
- Added developer documentation links in read me - Added aytostyle scripts
This commit is contained in:
parent
14ad5b9db9
commit
23999faf4e
@ -1,7 +1,8 @@
|
||||
#include "example.h"
|
||||
#include "ui_example.h"
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
QApplication app (argc, argv);
|
||||
app.setApplicationName ("QSimpleUpdater Example");
|
||||
|
||||
@ -13,7 +14,8 @@ int main (int argc, char *argv[]) {
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Example::Example (QWidget *parent) : QDialog(parent), ui(new Ui::Example) {
|
||||
Example::Example (QWidget *parent) : QDialog (parent), ui (new Ui::Example)
|
||||
{
|
||||
// Create and configure the user interface
|
||||
ui->setupUi (this);
|
||||
ui->versionLineEdit->setText ("0.1");
|
||||
@ -34,11 +36,13 @@ Example::Example (QWidget *parent) : QDialog(parent), ui(new Ui::Example) {
|
||||
connect (updater, SIGNAL (checkingFinished()), this, SLOT (onCheckingFinished()));
|
||||
}
|
||||
|
||||
Example::~Example() {
|
||||
Example::~Example()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Example::checkForUpdates() {
|
||||
void Example::checkForUpdates()
|
||||
{
|
||||
// Disable the check for updates button while the updater
|
||||
// is checking for updates
|
||||
ui->updatesButton->setEnabled (false);
|
||||
@ -46,15 +50,13 @@ void Example::checkForUpdates() {
|
||||
|
||||
// If the user changed the text of the versionLineEdit, then change the
|
||||
// application version in the updater too
|
||||
if (!ui->versionLineEdit->text().isEmpty()) {
|
||||
if (!ui->versionLineEdit->text().isEmpty())
|
||||
updater->setApplicationVersion (ui->versionLineEdit->text());
|
||||
}
|
||||
|
||||
// If the versionLineEdit is empty, then set the application version
|
||||
// to "0.1"
|
||||
else {
|
||||
else
|
||||
updater->setApplicationVersion ("0.1");
|
||||
}
|
||||
|
||||
// Tell the updater where we should download the changelog, note that
|
||||
// the changelog can be any file you want,
|
||||
@ -78,7 +80,8 @@ void Example::checkForUpdates() {
|
||||
updater->checkForUpdates();
|
||||
}
|
||||
|
||||
void Example::onCheckingFinished() {
|
||||
void Example::onCheckingFinished()
|
||||
{
|
||||
// Enable the updatesButton and change its text to let the user know
|
||||
// that he/she can check for updates again
|
||||
ui->updatesButton->setEnabled (true);
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QSimpleUpdater>
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class Example;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,8 @@
|
||||
|
||||
DownloadDialog::DownloadDialog (QWidget *parent)
|
||||
: QWidget (parent)
|
||||
, ui (new Ui::DownloadDialog) {
|
||||
, ui (new Ui::DownloadDialog)
|
||||
{
|
||||
|
||||
// Setup the UI
|
||||
ui->setupUi (this);
|
||||
@ -45,11 +46,13 @@ DownloadDialog::DownloadDialog (QWidget *parent)
|
||||
SLOT (ignoreSslErrors (QNetworkReply *, QList<QSslError>)));
|
||||
}
|
||||
|
||||
DownloadDialog::~DownloadDialog (void) {
|
||||
DownloadDialog::~DownloadDialog (void)
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DownloadDialog::beginDownload (const QUrl& url) {
|
||||
void DownloadDialog::beginDownload (const QUrl& url)
|
||||
{
|
||||
Q_ASSERT (!url.isEmpty());
|
||||
|
||||
// Reset the UI
|
||||
@ -73,7 +76,8 @@ void DownloadDialog::beginDownload (const QUrl& url) {
|
||||
showNormal();
|
||||
}
|
||||
|
||||
void DownloadDialog::installUpdate (void) {
|
||||
void DownloadDialog::installUpdate (void)
|
||||
{
|
||||
QMessageBox msg;
|
||||
msg.setIcon (QMessageBox::Question);
|
||||
msg.setText ("<b>" +
|
||||
@ -83,20 +87,24 @@ void DownloadDialog::installUpdate (void) {
|
||||
msg.setInformativeText (tr ("Do you want to quit %1 now?").arg (qApp->applicationName()));
|
||||
msg.setStandardButtons (QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (msg.exec() == QMessageBox::Yes) {
|
||||
if (msg.exec() == QMessageBox::Yes)
|
||||
{
|
||||
openDownload();
|
||||
qApp->closeAllWindows();
|
||||
}
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
ui->openButton->setEnabled (true);
|
||||
ui->openButton->setVisible (true);
|
||||
ui->timeLabel->setText (tr ("Click the \"Open\" button to apply the update"));
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadDialog::openDownload (void) {
|
||||
if (!m_path.isEmpty()) {
|
||||
void DownloadDialog::openDownload (void)
|
||||
{
|
||||
if (!m_path.isEmpty())
|
||||
{
|
||||
QString url = m_path;
|
||||
|
||||
if (url.startsWith ("/"))
|
||||
@ -109,15 +117,18 @@ void DownloadDialog::openDownload (void) {
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadDialog::cancelDownload (void) {
|
||||
if (!m_reply->isFinished()) {
|
||||
void DownloadDialog::cancelDownload (void)
|
||||
{
|
||||
if (!m_reply->isFinished())
|
||||
{
|
||||
QMessageBox _message;
|
||||
_message.setWindowTitle (tr ("Updater"));
|
||||
_message.setIcon (QMessageBox::Question);
|
||||
_message.setStandardButtons (QMessageBox::Yes | QMessageBox::No);
|
||||
_message.setText (tr ("Are you sure you want to cancel the download?"));
|
||||
|
||||
if (_message.exec() == QMessageBox::Yes) {
|
||||
if (_message.exec() == QMessageBox::Yes)
|
||||
{
|
||||
hide();
|
||||
m_reply->abort();
|
||||
}
|
||||
@ -127,18 +138,21 @@ void DownloadDialog::cancelDownload (void) {
|
||||
hide();
|
||||
}
|
||||
|
||||
void DownloadDialog::downloadFinished (void) {
|
||||
void DownloadDialog::downloadFinished (void)
|
||||
{
|
||||
ui->stopButton->setText (tr ("Close"));
|
||||
ui->downloadLabel->setText (tr ("Download complete!"));
|
||||
ui->timeLabel->setText (tr ("The installer will open in a separate window..."));
|
||||
|
||||
QByteArray data = m_reply->readAll();
|
||||
|
||||
if (!data.isEmpty()) {
|
||||
if (!data.isEmpty())
|
||||
{
|
||||
QStringList list = m_reply->url().toString().split ("/");
|
||||
QFile file (QDir::tempPath() + "/" + list.at (list.count() - 1));
|
||||
|
||||
if (file.open (QIODevice::WriteOnly)) {
|
||||
if (file.open (QIODevice::WriteOnly))
|
||||
{
|
||||
file.write (data);
|
||||
m_path = file.fileName();
|
||||
}
|
||||
@ -148,9 +162,11 @@ void DownloadDialog::downloadFinished (void) {
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadDialog::updateProgress (qint64 received, qint64 total) {
|
||||
void DownloadDialog::updateProgress (qint64 received, qint64 total)
|
||||
{
|
||||
// We know the size of the download, so we can calculate the progress....
|
||||
if (total > 0 && received > 0) {
|
||||
if (total > 0 && received > 0)
|
||||
{
|
||||
ui->progressBar->setMinimum (0);
|
||||
ui->progressBar->setMaximum (100);
|
||||
|
||||
@ -166,12 +182,14 @@ void DownloadDialog::updateProgress (qint64 received, qint64 total) {
|
||||
if (_total < 1024)
|
||||
_total_string = tr ("%1 bytes").arg (_total);
|
||||
|
||||
else if (_total < 1024 * 1024) {
|
||||
else if (_total < 1024 * 1024)
|
||||
{
|
||||
_total = roundNumber (_total / 1024);
|
||||
_total_string = tr ("%1 KB").arg (_total);
|
||||
}
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
_total = roundNumber (_total / (1024 * 1024));
|
||||
_total_string = tr ("%1 MB").arg (_total);
|
||||
}
|
||||
@ -179,12 +197,14 @@ void DownloadDialog::updateProgress (qint64 received, qint64 total) {
|
||||
if (_received < 1024)
|
||||
_received_string = tr ("%1 bytes").arg (_received);
|
||||
|
||||
else if (received < 1024 * 1024) {
|
||||
else if (received < 1024 * 1024)
|
||||
{
|
||||
_received = roundNumber (_received / 1024);
|
||||
_received_string = tr ("%1 KB").arg (_received);
|
||||
}
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
_received = roundNumber (_received / (1024 * 1024));
|
||||
_received_string = tr ("%1 MB").arg (_received);
|
||||
}
|
||||
@ -193,16 +213,19 @@ void DownloadDialog::updateProgress (qint64 received, qint64 total) {
|
||||
|
||||
uint _diff = QDateTime::currentDateTime().toTime_t() - m_start_time;
|
||||
|
||||
if (_diff > 0) {
|
||||
if (_diff > 0)
|
||||
{
|
||||
QString _time_string;
|
||||
float _time_remaining = total / (received / _diff);
|
||||
|
||||
if (_time_remaining > 7200) {
|
||||
if (_time_remaining > 7200)
|
||||
{
|
||||
_time_remaining /= 3600;
|
||||
_time_string = tr ("About %1 hours").arg (int (_time_remaining + 0.5));
|
||||
}
|
||||
|
||||
else if (_time_remaining > 60) {
|
||||
else if (_time_remaining > 60)
|
||||
{
|
||||
_time_remaining /= 60;
|
||||
_time_string = tr ("About %1 minutes").arg (int (_time_remaining + 0.5));
|
||||
}
|
||||
@ -216,7 +239,8 @@ void DownloadDialog::updateProgress (qint64 received, qint64 total) {
|
||||
|
||||
// We do not know the size of the download, so we avoid scaring the shit out
|
||||
// of the user
|
||||
else {
|
||||
else
|
||||
{
|
||||
ui->progressBar->setValue (-1);
|
||||
ui->progressBar->setMinimum (0);
|
||||
ui->progressBar->setMaximum (0);
|
||||
@ -226,7 +250,8 @@ void DownloadDialog::updateProgress (qint64 received, qint64 total) {
|
||||
}
|
||||
|
||||
void DownloadDialog::ignoreSslErrors (QNetworkReply *reply,
|
||||
const QList<QSslError>& error) {
|
||||
const QList<QSslError>& error)
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
reply->ignoreSslErrors (error);
|
||||
#else
|
||||
@ -235,6 +260,7 @@ void DownloadDialog::ignoreSslErrors (QNetworkReply *reply,
|
||||
#endif
|
||||
}
|
||||
|
||||
float DownloadDialog::roundNumber (const float& input) {
|
||||
float DownloadDialog::roundNumber (const float& input)
|
||||
{
|
||||
return roundf (input * 100) / 100;
|
||||
}
|
||||
|
@ -26,11 +26,13 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class DownloadDialog;
|
||||
}
|
||||
|
||||
class DownloadDialog : public QWidget {
|
||||
class DownloadDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -35,7 +35,8 @@ ProgressDialog::~ProgressDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ProgressDialog::cancel(void) {
|
||||
void ProgressDialog::cancel (void)
|
||||
{
|
||||
hide();
|
||||
emit cancelClicked();
|
||||
}
|
||||
|
@ -17,7 +17,8 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class ProgressDialog;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,8 @@ QSimpleUpdater::QSimpleUpdater (QObject *parent)
|
||||
, m_silent (false)
|
||||
, m_show_newest_version (true)
|
||||
, m_show_update_available (true)
|
||||
, m_new_version_available (false) {
|
||||
, m_new_version_available (false)
|
||||
{
|
||||
|
||||
m_progressDialog = new ProgressDialog();
|
||||
m_downloadDialog = new DownloadDialog();
|
||||
@ -109,7 +110,8 @@ QSimpleUpdater::QSimpleUpdater (QObject *parent)
|
||||
* \sa setChangelogUrl()
|
||||
*/
|
||||
|
||||
QString QSimpleUpdater::changeLog() const {
|
||||
QString QSimpleUpdater::changeLog() const
|
||||
{
|
||||
return m_changelog;
|
||||
}
|
||||
|
||||
@ -120,8 +122,10 @@ QString QSimpleUpdater::changeLog() const {
|
||||
* \sa setDownloadUrl(), setReferenceUrl()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::checkForUpdates (void) {
|
||||
if (!m_reference_url.isEmpty()) {
|
||||
void QSimpleUpdater::checkForUpdates (void)
|
||||
{
|
||||
if (!m_reference_url.isEmpty())
|
||||
{
|
||||
m_manager->get (QNetworkRequest (m_reference_url));
|
||||
|
||||
if (!silent())
|
||||
@ -138,7 +142,8 @@ void QSimpleUpdater::checkForUpdates (void) {
|
||||
* \sa setDownloadUrl()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::openDownloadLink (void) {
|
||||
void QSimpleUpdater::openDownloadLink (void)
|
||||
{
|
||||
if (!m_download_url.isEmpty())
|
||||
QDesktopServices::openUrl (m_download_url);
|
||||
}
|
||||
@ -149,7 +154,8 @@ void QSimpleUpdater::openDownloadLink (void) {
|
||||
* \sa setReferenceUrl(), checkForUpdates()
|
||||
*/
|
||||
|
||||
QString QSimpleUpdater::latestVersion() const {
|
||||
QString QSimpleUpdater::latestVersion() const
|
||||
{
|
||||
return m_latest_version;
|
||||
}
|
||||
|
||||
@ -159,7 +165,8 @@ QString QSimpleUpdater::latestVersion() const {
|
||||
* \sa setApplicationVersion()
|
||||
*/
|
||||
|
||||
QString QSimpleUpdater::installedVersion() const {
|
||||
QString QSimpleUpdater::installedVersion() const
|
||||
{
|
||||
return m_installed_version;
|
||||
}
|
||||
|
||||
@ -170,7 +177,8 @@ QString QSimpleUpdater::installedVersion() const {
|
||||
* \sa setDownloadUrl(), checkForUpdates()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::downloadLatestVersion (void) {
|
||||
void QSimpleUpdater::downloadLatestVersion (void)
|
||||
{
|
||||
if (!m_download_url.isEmpty())
|
||||
m_downloadDialog->beginDownload (m_download_url);
|
||||
}
|
||||
@ -182,7 +190,8 @@ void QSimpleUpdater::downloadLatestVersion (void) {
|
||||
* \sa setReferenceUrl(), checkForUpdates()
|
||||
*/
|
||||
|
||||
bool QSimpleUpdater::newerVersionAvailable() const {
|
||||
bool QSimpleUpdater::newerVersionAvailable() const
|
||||
{
|
||||
return m_new_version_available;
|
||||
}
|
||||
|
||||
@ -193,7 +202,8 @@ bool QSimpleUpdater::newerVersionAvailable() const {
|
||||
* \sa setSilent()
|
||||
*/
|
||||
|
||||
bool QSimpleUpdater::silent() const {
|
||||
bool QSimpleUpdater::silent() const
|
||||
{
|
||||
return m_silent;
|
||||
}
|
||||
|
||||
@ -208,7 +218,8 @@ bool QSimpleUpdater::silent() const {
|
||||
* \sa downloadLatestVersion(), openDownloadLink()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::setDownloadUrl (const QString& url) {
|
||||
void QSimpleUpdater::setDownloadUrl (const QString& url)
|
||||
{
|
||||
Q_ASSERT (!url.isEmpty());
|
||||
m_download_url.setUrl (url);
|
||||
}
|
||||
@ -231,7 +242,8 @@ void QSimpleUpdater::setDownloadUrl (const QString& url) {
|
||||
* \sa latestVersion()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::setReferenceUrl (const QString& url) {
|
||||
void QSimpleUpdater::setReferenceUrl (const QString& url)
|
||||
{
|
||||
Q_ASSERT (!url.isEmpty());
|
||||
m_reference_url.setUrl (url);
|
||||
}
|
||||
@ -247,7 +259,8 @@ void QSimpleUpdater::setReferenceUrl (const QString& url) {
|
||||
*/
|
||||
|
||||
|
||||
void QSimpleUpdater::setChangelogUrl (const QString& url) {
|
||||
void QSimpleUpdater::setChangelogUrl (const QString& url)
|
||||
{
|
||||
Q_ASSERT (!url.isEmpty());
|
||||
m_changelog_url.setUrl (url);
|
||||
}
|
||||
@ -263,7 +276,8 @@ void QSimpleUpdater::setChangelogUrl (const QString& url) {
|
||||
*/
|
||||
|
||||
|
||||
void QSimpleUpdater::setApplicationVersion (const QString& version) {
|
||||
void QSimpleUpdater::setApplicationVersion (const QString& version)
|
||||
{
|
||||
Q_ASSERT (!version.isEmpty());
|
||||
m_installed_version = version;
|
||||
}
|
||||
@ -280,7 +294,8 @@ void QSimpleUpdater::setApplicationVersion (const QString& version) {
|
||||
* \sa silent()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::setSilent (bool silent) {
|
||||
void QSimpleUpdater::setSilent (bool silent)
|
||||
{
|
||||
m_silent = silent;
|
||||
|
||||
if (m_silent)
|
||||
@ -294,7 +309,8 @@ void QSimpleUpdater::setSilent (bool silent) {
|
||||
* \sa checkForUpdates()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::setShowUpdateAvailableMessage(bool show) {
|
||||
void QSimpleUpdater::setShowUpdateAvailableMessage (bool show)
|
||||
{
|
||||
m_show_update_available = show;
|
||||
}
|
||||
|
||||
@ -308,7 +324,8 @@ void QSimpleUpdater::setShowUpdateAvailableMessage(bool show) {
|
||||
* \sa checkForUpdates()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::setShowNewestVersionMessage(bool show) {
|
||||
void QSimpleUpdater::setShowNewestVersionMessage (bool show)
|
||||
{
|
||||
m_show_newest_version = show;
|
||||
}
|
||||
|
||||
@ -317,7 +334,8 @@ void QSimpleUpdater::setShowNewestVersionMessage(bool show) {
|
||||
* clicks on the "cancel" button in the progress dialog.
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::cancel(void) {
|
||||
void QSimpleUpdater::cancel (void)
|
||||
{
|
||||
m_manager->disconnect();
|
||||
}
|
||||
|
||||
@ -328,11 +346,15 @@ void QSimpleUpdater::cancel(void) {
|
||||
* \sa checkDownloadedVersion()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::showErrorMessage (void) {
|
||||
void QSimpleUpdater::showErrorMessage (void)
|
||||
{
|
||||
if (!silent())
|
||||
{
|
||||
m_progressDialog->hide();
|
||||
QMessageBox::warning (NULL, tr ("Software Updater"),
|
||||
tr ("An unknown error occured while checking for updates"));
|
||||
}
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
* Informs the user if there's a newer version available for download
|
||||
@ -341,7 +363,11 @@ void QSimpleUpdater::showErrorMessage (void) {
|
||||
* \sa checkDownloadedVersion()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::onCheckingFinished (void) {
|
||||
void QSimpleUpdater::onCheckingFinished (void)
|
||||
{
|
||||
// Hide the progress dialog
|
||||
m_progressDialog->hide();
|
||||
|
||||
// Get the application icon as a pixmap
|
||||
QPixmap _icon = qApp->windowIcon().pixmap (
|
||||
qApp->windowIcon().actualSize (QSize (96, 96)));
|
||||
@ -354,7 +380,8 @@ void QSimpleUpdater::onCheckingFinished (void) {
|
||||
_message.setIconPixmap (_icon);
|
||||
|
||||
// Ask user if he/she wants to download newer version
|
||||
if (newerVersionAvailable() && m_show_update_available) {
|
||||
if (newerVersionAvailable() && m_show_update_available)
|
||||
{
|
||||
_message.setDetailedText (changeLog());
|
||||
_message.setStandardButtons (QMessageBox::Yes | QMessageBox::No);
|
||||
_message.setText ("<b>" + tr ("A new version of %1 is available!").arg (qApp->applicationName()) + "</b>");
|
||||
@ -368,7 +395,8 @@ void QSimpleUpdater::onCheckingFinished (void) {
|
||||
}
|
||||
|
||||
// Tell user that he/she is up to date (only if necessary)
|
||||
else if (!silent() && m_show_newest_version && !m_latest_version.isEmpty()) {
|
||||
else if (!silent() && m_show_newest_version && !m_latest_version.isEmpty())
|
||||
{
|
||||
_message.setStandardButtons (QMessageBox::Ok);
|
||||
_message.setText ("<b>" + tr ("You're up-to-date!") +
|
||||
" </b>");
|
||||
@ -391,34 +419,41 @@ void QSimpleUpdater::onCheckingFinished (void) {
|
||||
* \sa checkForUpdates()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::checkDownloadedVersion (QNetworkReply *reply) {
|
||||
void QSimpleUpdater::checkDownloadedVersion (QNetworkReply *reply)
|
||||
{
|
||||
bool _new_update = false;
|
||||
m_progressDialog->hide();
|
||||
|
||||
QString _reply = QString::fromUtf8 (reply->readAll());
|
||||
_reply.replace (" ", "");
|
||||
_reply.replace ("\n", "");
|
||||
|
||||
if (!_reply.isEmpty()) {
|
||||
if (!_reply.isEmpty())
|
||||
{
|
||||
m_latest_version = _reply;
|
||||
|
||||
QStringList _download = m_latest_version.split (".");
|
||||
QStringList _installed = m_installed_version.split (".");
|
||||
|
||||
for (int i = 0; i <= _download.count() - 1; ++i) {
|
||||
if (_download.count() - 1 >= i && _installed.count() - 1 >= i) {
|
||||
if (_download.at (i) > _installed.at (i)) {
|
||||
for (int i = 0; i <= _download.count() - 1; ++i)
|
||||
{
|
||||
if (_download.count() - 1 >= i && _installed.count() - 1 >= i)
|
||||
{
|
||||
if (_download.at (i) > _installed.at (i))
|
||||
{
|
||||
_new_update = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if (_installed.count() < _download.count()) {
|
||||
else
|
||||
{
|
||||
if (_installed.count() < _download.count())
|
||||
{
|
||||
if (_installed.at (i - 1) == _download.at (i - 1))
|
||||
break;
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
_new_update = true;
|
||||
break;
|
||||
}
|
||||
@ -432,7 +467,8 @@ void QSimpleUpdater::checkDownloadedVersion (QNetworkReply *reply) {
|
||||
|
||||
m_new_version_available = _new_update;
|
||||
|
||||
if (!m_changelog_url.isEmpty() && newerVersionAvailable()) {
|
||||
if (!m_changelog_url.isEmpty() && newerVersionAvailable())
|
||||
{
|
||||
QNetworkAccessManager *_manager = new QNetworkAccessManager (this);
|
||||
|
||||
connect (_manager, SIGNAL (finished (QNetworkReply *)), this,
|
||||
@ -454,7 +490,8 @@ void QSimpleUpdater::checkDownloadedVersion (QNetworkReply *reply) {
|
||||
* \sa setChangelogUrl(), changeLog()
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::processDownloadedChangelog (QNetworkReply *reply) {
|
||||
void QSimpleUpdater::processDownloadedChangelog (QNetworkReply *reply)
|
||||
{
|
||||
QString _reply = QString::fromUtf8 (reply->readAll());
|
||||
|
||||
if (!_reply.isEmpty())
|
||||
@ -470,7 +507,8 @@ void QSimpleUpdater::processDownloadedChangelog (QNetworkReply *reply) {
|
||||
*/
|
||||
|
||||
void QSimpleUpdater::ignoreSslErrors (QNetworkReply *reply,
|
||||
const QList<QSslError>& error) {
|
||||
const QList<QSslError>& error)
|
||||
{
|
||||
#if SUPPORTS_SSL
|
||||
reply->ignoreSslErrors (error);
|
||||
#else
|
||||
|
@ -37,7 +37,8 @@
|
||||
#include "dialogs/download_dialog.h"
|
||||
#include "dialogs/progress_dialog.h"
|
||||
|
||||
class QSimpleUpdater : public QObject {
|
||||
class QSimpleUpdater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -6,6 +6,10 @@ QSimpleUpdater is an implementation of an auto-updating system to be used with Q
|
||||
|
||||
QSimpleUpdater is **free and open source [LGPL software](https://www.gnu.org/licenses/lgpl.html)**, which means that you can use it for both open source and proprietary applications.
|
||||
|
||||
## Developer Documentation
|
||||
|
||||
You can find the developer documentation for QSimpleUpdater [here](http://qsimpleupdater.sourceforge.net/doc/).
|
||||
|
||||
## Using QSimpleUpdater
|
||||
|
||||
1. Copy the *QSimpleUpdater* folder in your "3rd-party" folder.
|
||||
|
21
bin/autostyle.cmd
Normal file
21
bin/autostyle.cmd
Normal file
@ -0,0 +1,21 @@
|
||||
:: Description: This script changes the style format of
|
||||
:: all the source code of the project.
|
||||
|
||||
:: Setup the command line
|
||||
@echo off
|
||||
title Autostyle
|
||||
|
||||
:: Go to the directory where the script is run
|
||||
cd /d %~dp0
|
||||
|
||||
:: Style and format the source code recursively
|
||||
astyle --style=allman -C -S -xG -Y -XW -w -f -F -p -xd -k3 -y -xj -c -K -L --suffix=none --recursive ../*.cpp ../*.h ../*.hxx ../*.cxx
|
||||
|
||||
:: Notify the user that we have finished
|
||||
echo.
|
||||
echo Code styling complete!
|
||||
echo.
|
||||
|
||||
:: Let the user see the output
|
||||
pause
|
||||
|
19
bin/autostyle.sh
Normal file
19
bin/autostyle.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Description: This script changes the style format of
|
||||
# all the source code of the project.
|
||||
|
||||
# Run only on the directory of the script
|
||||
cd "$(dirname ${BASH_SOURCE[0]})"
|
||||
|
||||
# Style and format recursively
|
||||
astyle --style=allman -C -S -xG -Y -XW -w -f -F -p -xd -k3 -y -xj -c -K -L --suffix=none --recursive ../*.cpp ../*.h ../*.hxx ../*.cxx
|
||||
|
||||
# Notify the user that we are done
|
||||
echo
|
||||
echo "Code styling complete!"
|
||||
echo
|
||||
|
||||
# Let the user see the output
|
||||
read -n1 -r -p "Press any key to continue..." key
|
||||
clear
|
1
bin/readme.txt
Normal file
1
bin/readme.txt
Normal file
@ -0,0 +1 @@
|
||||
The scripts contained in this folder will require you to install the [astyle](http://astyle.sf.net) source code styler.
|
Loading…
x
Reference in New Issue
Block a user