#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;
|
||||
}
|
||||
|
||||
void ActivationNotifier::setUpgradeInfo(QString const& fromVersion,
|
||||
QString const& toVersion,
|
||||
QString const& serialKey)
|
||||
{
|
||||
m_fromVersion = fromVersion;
|
||||
m_toVersion = toVersion;
|
||||
m_serialKey = serialKey;
|
||||
}
|
||||
|
||||
void ActivationNotifier::notify()
|
||||
{
|
||||
CoreInterface coreInterface;
|
||||
|
@ -39,3 +48,13 @@ void ActivationNotifier::notify()
|
|||
// 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);
|
||||
|
||||
void setIdentity(QString identity);
|
||||
void setUpgradeInfo(QString const& fromVersion,
|
||||
QString const& toVersion, QString const& serialKey);
|
||||
|
||||
public slots:
|
||||
void notify();
|
||||
void notifyUpgrade();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
QString m_Identity;
|
||||
QString m_fromVersion;
|
||||
QString m_toVersion;
|
||||
QString m_serialKey;
|
||||
};
|
||||
|
||||
#endif // ACTIVATIONNOTIFIER_H
|
||||
|
|
|
@ -62,10 +62,11 @@ QString CoreInterface::getSerialKeyFilePath()
|
|||
return filename;
|
||||
}
|
||||
|
||||
QString CoreInterface::notifyUpgrade (QString const& version,
|
||||
QString CoreInterface::notifyUpdate (QString const& fromVersion,
|
||||
QString const& toVersion,
|
||||
QString const& serialKey) {
|
||||
QStringList args("--notify-upgrade");
|
||||
QString input(version + ":" + serialKey);
|
||||
QString input(fromVersion + ":" + toVersion + ":" + serialKey);
|
||||
return run(args, input);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
QString getArch();
|
||||
QString getSerialKeyFilePath();
|
||||
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 = "");
|
||||
};
|
||||
|
|
|
@ -72,8 +72,21 @@ LicenseManager::setSerialKey(QString serialKeyString, bool acceptExpired)
|
|||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
QString activeEditionName() const;
|
||||
SerialKey serialKey() const;
|
||||
void skipActivation();
|
||||
void notifyUpdate(QString version);
|
||||
void notifyUpdate(QString fromVersion, QString toVersion);
|
||||
static QString getEditionName(Edition edition, bool trial = false);
|
||||
|
||||
private:
|
||||
|
|
|
@ -157,9 +157,12 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
|||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
m_LicenseManager->refresh();
|
||||
|
||||
QString lastVersion = m_AppConfig->lastVersion();
|
||||
QString currentVersion = m_VersionChecker.getVersion();
|
||||
if (m_AppConfig->lastVersion() != currentVersion) {
|
||||
if (lastVersion != 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, ':');
|
||||
size_t count = parts.size();
|
||||
|
||||
if (count == 2) {
|
||||
if (count == 3) {
|
||||
std::stringstream ss;
|
||||
ss << JSON_URL << "notify/upgraded/";
|
||||
ss << "?version=" << parts[0];
|
||||
ss << "&serial=" << parts[1];
|
||||
ss << "?from=" << parts[0];
|
||||
ss << "&to=" << parts[1];
|
||||
ss << "&serial=" << parts[2];
|
||||
|
||||
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue