ui: Show license type label in title bar: "Sourcetrail [trial, test, non-commercial]"

This commit is contained in:
Eberhard Graether
2017-07-17 15:31:06 +02:00
parent 83e5497a18
commit 4bb88a51b7
9 changed files with 78 additions and 23 deletions
+28
View File
@@ -128,6 +128,34 @@ LicenseChecker::LicenseState LicenseChecker::checkLicenseString(const std::strin
return checkLicense(license);
}
MessageEnteredLicense::LicenseType LicenseChecker::getCurrentLicenseType() const
{
License license;
bool isLoaded = license.loadFromEncodedString(
ApplicationSettings::getInstance()->getLicenseString(), AppPath::getAppPath());
if (!isLoaded)
{
return MessageEnteredLicense::LICENSE_NONE;
}
LicenseState state = checkLicense(license);
if (state != LICENSE_VALID)
{
return MessageEnteredLicense::LICENSE_NONE;
}
else if (license.isTestLicense())
{
return MessageEnteredLicense::LICENSE_TEST;
}
else if (license.isNonCommercialLicenseType())
{
return MessageEnteredLicense::LICENSE_NON_COMMERCIAL;
}
return MessageEnteredLicense::LICENSE_COMMERCIAL;
}
LicenseChecker::LicenseChecker()
: m_forcedLicenseEntering(false)
{