ui: Show news sent with update check on start screen

* News are passed as JSON string, containing an array of news items.
* Each news item has version and content (html).
* Items can be filtered by min/max version, OS and license. The first item that fits is used.
* Items can be important, which highlights the news box.
* News are not shown if older than 5 days.

fortune cookie message = You will be financially successful in case your actions are well planned.
This commit is contained in:
Eberhard Graether
2018-10-21 13:49:06 +02:00
parent 518f15d490
commit 6a6bd0fca8
17 changed files with 463 additions and 102 deletions
+22 -5
View File
@@ -137,6 +137,16 @@ void utility::killRunningProcesses()
}
}
int utility::getIdealThreadCount()
{
int threadCount = QThread::idealThreadCount();
if (getOsType() == OS_WINDOWS)
{
threadCount -= 1;
}
return std::max(1, threadCount);
}
OsType utility::getOsType()
{
if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
@@ -154,14 +164,21 @@ OsType utility::getOsType()
return OS_UNKNOWN;
}
int utility::getIdealThreadCount()
std::string utility::getOsTypeString()
{
int threadCount = QThread::idealThreadCount();
if (getOsType() == OS_WINDOWS)
// WARNING: Don't change these string. The server API relies on them.
switch (utility::getOsType())
{
threadCount -= 1;
case OS_WINDOWS:
return "windows";
case OS_MAC:
return "macOS";
case OS_LINUX:
return "linux";
default:
break;
}
return std::max(1, threadCount);
return "unknown";
}
bool utility::saveLicense(const License* license)