Pumpkin mod.
To provide a better quality service we restrict the lifetime a user can use a test build. --HG-- branch : develop
This commit is contained in:
parent
c63a1af61d
commit
a9a09d85c3
|
@ -29,6 +29,7 @@
|
||||||
#include "tmainwindow.h"
|
#include "tmainwindow.h"
|
||||||
#include "mapplication.h"
|
#include "mapplication.h"
|
||||||
#include "../fervor/fvupdater.h"
|
#include "../fervor/fvupdater.h"
|
||||||
|
#include "../vmisc/vsysexits.h"
|
||||||
|
|
||||||
#include <QMessageBox> // For QT_REQUIRE_VERSION
|
#include <QMessageBox> // For QT_REQUIRE_VERSION
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
@ -55,6 +56,17 @@ int main(int argc, char *argv[])
|
||||||
MApplication app(argc, argv);
|
MApplication app(argc, argv);
|
||||||
app.InitOptions();
|
app.InitOptions();
|
||||||
|
|
||||||
|
if (FvUpdater::IsStaledTestBuild())
|
||||||
|
{
|
||||||
|
qWarning() << QApplication::translate("Tape",
|
||||||
|
"This test build is older than %1 days. To provide you with better "
|
||||||
|
"quality service we restrict the lifetime you can use a test build. "
|
||||||
|
"To continue using Tape please update to newer test build. The "
|
||||||
|
"application will be shut down.")
|
||||||
|
.arg(FvUpdater::testBuildLifetime);
|
||||||
|
return V_EX_UNAVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
QTimer::singleShot(0, &app, &MApplication::ProcessCMD);
|
QTimer::singleShot(0, &app, &MApplication::ProcessCMD);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
|
@ -66,6 +66,17 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
app.InitOptions();
|
app.InitOptions();
|
||||||
|
|
||||||
|
if (FvUpdater::IsStaledTestBuild())
|
||||||
|
{
|
||||||
|
qWarning() << QApplication::translate("Valentina",
|
||||||
|
"This test build is older than %1 days. To provide you with better "
|
||||||
|
"quality service we restrict the lifetime you can use a test build. "
|
||||||
|
"To continue using Valentina please update to newer test build. The "
|
||||||
|
"application will be shut down.")
|
||||||
|
.arg(FvUpdater::testBuildLifetime);
|
||||||
|
return V_EX_UNAVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (VApplication::IsGUIMode())
|
if (VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
// Set feed URL before doing anything else
|
// Set feed URL before doing anything else
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
#include "fvavailableupdate.h"
|
#include "fvavailableupdate.h"
|
||||||
#include "fvupdatewindow.h"
|
#include "fvupdatewindow.h"
|
||||||
|
|
||||||
|
const int FvUpdater::testBuildLifetime = 90;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL,
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL,
|
||||||
|
@ -132,6 +134,20 @@ bool FvUpdater::IsTestBuild()
|
||||||
return (version != 0x0 && version != APP_VERSION);
|
return (version != 0x0 && version != APP_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool FvUpdater::IsStaledTestBuild()
|
||||||
|
{
|
||||||
|
if (IsTestBuild())
|
||||||
|
{
|
||||||
|
QDate builtDate = QLocale::c().toDate(QStringLiteral(__DATE__).simplified(), QStringLiteral("MMM d yyyy"));
|
||||||
|
return builtDate.daysTo(QDate::currentDate()) > testBuildLifetime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
FvUpdater::FvUpdater()
|
FvUpdater::FvUpdater()
|
||||||
: QObject(nullptr),
|
: QObject(nullptr),
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
static QString CurrentFeedURL();
|
static QString CurrentFeedURL();
|
||||||
static int CurrentVersion();
|
static int CurrentVersion();
|
||||||
static bool IsTestBuild();
|
static bool IsTestBuild();
|
||||||
|
static bool IsStaledTestBuild();
|
||||||
|
|
||||||
// Set / get feed URL
|
// Set / get feed URL
|
||||||
void SetFeedURL(const QUrl &feedURL);
|
void SetFeedURL(const QUrl &feedURL);
|
||||||
|
@ -55,6 +56,8 @@ public:
|
||||||
bool IsDropOnFinnish() const;
|
bool IsDropOnFinnish() const;
|
||||||
void SetDropOnFinnish(bool value);
|
void SetDropOnFinnish(bool value);
|
||||||
|
|
||||||
|
static const int testBuildLifetime;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Check for updates
|
// Check for updates
|
||||||
bool CheckForUpdates(bool silentAsMuchAsItCouldGet = true);
|
bool CheckForUpdates(bool silentAsMuchAsItCouldGet = true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user