#5707 Add from and to version numbers to version update notification
This commit is contained in:
parent
2de06b9727
commit
4206799ae3
|
@ -29,6 +29,15 @@ void ActivationNotifier::setIdentity(QString identity)
|
||||||
m_Identity = identity;
|
m_Identity = identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActivationNotifier::setUpgradeInfo(QString const& fromVersion,
|
||||||
|
QString const& toVersion,
|
||||||
|
QString const& serialKey)
|
||||||
|
{
|
||||||
|
m_fromVersion = fromVersion;
|
||||||
|
m_toVersion = toVersion;
|
||||||
|
m_serialKey = serialKey;
|
||||||
|
}
|
||||||
|
|
||||||
void ActivationNotifier::notify()
|
void ActivationNotifier::notify()
|
||||||
{
|
{
|
||||||
CoreInterface coreInterface;
|
CoreInterface coreInterface;
|
||||||
|
@ -39,3 +48,13 @@ void ActivationNotifier::notify()
|
||||||
// catch all exceptions and fails silently
|
// catch all exceptions and fails silently
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActivationNotifier::notifyUpgrade()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
CoreInterface coreInterface;
|
||||||
|
coreInterface.notifyUpdate(m_fromVersion, m_toVersion,
|
||||||
|
m_serialKey);
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -27,15 +27,21 @@ public:
|
||||||
explicit ActivationNotifier(QObject *parent = 0);
|
explicit ActivationNotifier(QObject *parent = 0);
|
||||||
|
|
||||||
void setIdentity(QString identity);
|
void setIdentity(QString identity);
|
||||||
|
void setUpgradeInfo(QString const& fromVersion,
|
||||||
|
QString const& toVersion, QString const& serialKey);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void notify();
|
void notify();
|
||||||
|
void notifyUpgrade();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_Identity;
|
QString m_Identity;
|
||||||
|
QString m_fromVersion;
|
||||||
|
QString m_toVersion;
|
||||||
|
QString m_serialKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ACTIVATIONNOTIFIER_H
|
#endif // ACTIVATIONNOTIFIER_H
|
||||||
|
|
|
@ -62,10 +62,11 @@ QString CoreInterface::getSerialKeyFilePath()
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CoreInterface::notifyUpgrade (QString const& version,
|
QString CoreInterface::notifyUpdate (QString const& fromVersion,
|
||||||
|
QString const& toVersion,
|
||||||
QString const& serialKey) {
|
QString const& serialKey) {
|
||||||
QStringList args("--notify-upgrade");
|
QStringList args("--notify-upgrade");
|
||||||
QString input(version + ":" + serialKey);
|
QString input(fromVersion + ":" + toVersion + ":" + serialKey);
|
||||||
return run(args, input);
|
return run(args, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ public:
|
||||||
QString getArch();
|
QString getArch();
|
||||||
QString getSerialKeyFilePath();
|
QString getSerialKeyFilePath();
|
||||||
QString notifyActivation(const QString& identity);
|
QString notifyActivation(const QString& identity);
|
||||||
QString notifyUpgrade (QString const& version, QString const& serialKey);
|
QString notifyUpdate (QString const& fromVersion,
|
||||||
|
QString const& toVersion,
|
||||||
|
QString const& serialKey);
|
||||||
QString run(const QStringList& args, const QString& input = "");
|
QString run(const QStringList& args, const QString& input = "");
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,8 +72,21 @@ LicenseManager::setSerialKey(QString serialKeyString, bool acceptExpired)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LicenseManager::notifyUpdate(QString version) {
|
LicenseManager::notifyUpdate(QString fromVersion, QString toVersion) {
|
||||||
|
ActivationNotifier* notifier = new ActivationNotifier();
|
||||||
|
notifier->setUpgradeInfo (fromVersion, toVersion,
|
||||||
|
QString::fromStdString(m_serialKey.toString()));
|
||||||
|
|
||||||
|
QThread* thread = new QThread();
|
||||||
|
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||||
|
connect(notifier, SIGNAL(finished()), notifier, SLOT(deleteLater()));
|
||||||
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
||||||
|
notifier->moveToThread(thread);
|
||||||
|
thread->start();
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(notifier, "notifyUpgrade",
|
||||||
|
Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
Edition
|
Edition
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
QString activeEditionName() const;
|
QString activeEditionName() const;
|
||||||
SerialKey serialKey() const;
|
SerialKey serialKey() const;
|
||||||
void skipActivation();
|
void skipActivation();
|
||||||
void notifyUpdate(QString version);
|
void notifyUpdate(QString fromVersion, QString toVersion);
|
||||||
static QString getEditionName(Edition edition, bool trial = false);
|
static QString getEditionName(Edition edition, bool trial = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -157,9 +157,12 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||||
m_LicenseManager->refresh();
|
m_LicenseManager->refresh();
|
||||||
|
|
||||||
|
QString lastVersion = m_AppConfig->lastVersion();
|
||||||
QString currentVersion = m_VersionChecker.getVersion();
|
QString currentVersion = m_VersionChecker.getVersion();
|
||||||
if (m_AppConfig->lastVersion() != currentVersion) {
|
if (lastVersion != currentVersion) {
|
||||||
m_AppConfig->setLastVersion (currentVersion);
|
m_AppConfig->setLastVersion (currentVersion);
|
||||||
|
m_AppConfig->saveSettings();
|
||||||
|
m_LicenseManager->notifyUpdate (lastVersion, currentVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,11 +146,12 @@ ToolApp::notifyUpgrade()
|
||||||
std::vector<String> parts = synergy::string::splitString(data, ':');
|
std::vector<String> parts = synergy::string::splitString(data, ':');
|
||||||
size_t count = parts.size();
|
size_t count = parts.size();
|
||||||
|
|
||||||
if (count == 2) {
|
if (count == 3) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << JSON_URL << "notify/upgraded/";
|
ss << JSON_URL << "notify/upgraded/";
|
||||||
ss << "?version=" << parts[0];
|
ss << "?from=" << parts[0];
|
||||||
ss << "&serial=" << parts[1];
|
ss << "&to=" << parts[1];
|
||||||
|
ss << "&serial=" << parts[2];
|
||||||
|
|
||||||
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue