/** * Returns the \c Updater instance registered with the given \a url. * * If an \c Updater instance registered with teh given \a url does not exist, * this function will create it and configure it automatically. */ Updater* QSimpleUpdater::getUpdater (const QString& url) const { if (!URLS.contains (url)) { Updater* updater = new Updater; updater->setUrl (url); URLS.append (url); UPDATERS.append (updater); connect (updater, SIGNAL (checkingFinished (QString)), this, SIGNAL (checkingFinished (QString))); connect (updater, SIGNAL (downloadFinished (QString, QString)), this, SIGNAL (downloadFinished (QString, QString))); connect (updater, SIGNAL (appcastDownloaded (QString, QByteArray)), this, SIGNAL (appcastDownloaded (QString, QByteArray))); } return UPDATERS.at (URLS.indexOf (url)); }
QSimpleUpdater::QSimpleUpdater (QObject *parent) : QObject (parent) , m_silent (false) , m_show_newest_version (true) , m_show_update_available (true) , m_new_version_available (false) { m_progressDialog = new ProgressDialog(); m_downloadDialog = new DownloadDialog(); m_manager = new QNetworkAccessManager (this); connect (m_manager, SIGNAL (sslErrors (QNetworkReply *, QList<QSslError>)), this, SLOT (ignoreSslErrors (QNetworkReply *, QList<QSslError>))); connect (m_progressDialog, SIGNAL (cancelClicked()), this, SLOT (cancel())); connect (this, SIGNAL (checkingFinished()), this, SLOT (onCheckingFinished())); setApplicationVersion (qApp->applicationVersion()); }