mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
refs #507, improvements on frameless window base class
* handle minimized / normal in window base class * removed initial on top flag and project * executable names * version number check (for launcher)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
63e1695e3b
commit
864ca20be3
@@ -127,15 +127,28 @@ namespace BlackMisc
|
||||
|
||||
const QString &CProject::swiftVersionString()
|
||||
{
|
||||
static const QString s(QString("swift %1").arg(version()));
|
||||
static const QString s(QString("swift %1").arg(versionStringDevBetaInfo()));
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CProject::swiftVersionStringDevInfo()
|
||||
const QString &CProject::versionStringDevBetaInfo()
|
||||
{
|
||||
if (!isRunningInDeveloperEnvironment()) { return swiftVersionString(); }
|
||||
static const QString s(swiftVersionString() + " [DEV]");
|
||||
return s;
|
||||
if (isRunningInDeveloperEnvironment() && isBetaTest())
|
||||
{
|
||||
static const QString s(version() + " [DEV, BETA]");
|
||||
return s;
|
||||
}
|
||||
if (isRunningInDeveloperEnvironment())
|
||||
{
|
||||
static const QString s(version() + " [DEV]");
|
||||
return s;
|
||||
}
|
||||
if (isBetaTest())
|
||||
{
|
||||
static const QString s(version() + " [BETA]");
|
||||
return s;
|
||||
}
|
||||
return version();
|
||||
}
|
||||
|
||||
const char *CProject::swiftVersionChar()
|
||||
@@ -154,6 +167,20 @@ namespace BlackMisc
|
||||
return getMajorMinor(1);
|
||||
}
|
||||
|
||||
bool CProject::isNewerVersion(const QString &versionString)
|
||||
{
|
||||
if (versionString.isEmpty()) { return false; }
|
||||
QList<int> newer(getVersionParts(versionString));
|
||||
QList<int> current(getVersionParts(version()));
|
||||
for (int i = 0; i < current.length(); i++)
|
||||
{
|
||||
if (newer.length() <= i) { return false; }
|
||||
if (current.at(i) > newer.at(i)) { return false; }
|
||||
if (current.at(i) < newer.at(i)) { return true; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CProject::isDebugBuild()
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
@@ -213,13 +240,24 @@ namespace BlackMisc
|
||||
return isBetaTest() || isRunningInDeveloperEnvironment();
|
||||
}
|
||||
|
||||
QList<int> CProject::getVersionParts(const QString &versionString)
|
||||
{
|
||||
QStringList parts = versionString.split('.');
|
||||
QList<int> partsInt;
|
||||
for (const QString &p : parts)
|
||||
{
|
||||
bool ok = false;
|
||||
int pInt = p.toInt(&ok);
|
||||
partsInt.append(ok ? pInt : -1);
|
||||
}
|
||||
return partsInt;
|
||||
}
|
||||
|
||||
int CProject::getMajorMinor(int index)
|
||||
{
|
||||
QString v = version();
|
||||
if (v.isEmpty() || !v.contains(".")) return -1;
|
||||
bool ok;
|
||||
int vi = v.split(".")[index].toInt(&ok);
|
||||
return ok ? vi : -1;
|
||||
QList<int> partsInt(getVersionParts(version()));
|
||||
if (index >= partsInt.length()) { return -1; }
|
||||
return partsInt[index];
|
||||
}
|
||||
|
||||
const QString &CProject::envVarDevelopment()
|
||||
@@ -239,6 +277,24 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CProject::swiftGuiExecutableName()
|
||||
{
|
||||
static const QString s("swiftguistd");
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CProject::swiftCoreExecutableName()
|
||||
{
|
||||
static const QString s("swiftcore");
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CProject::swiftDataExecutableName()
|
||||
{
|
||||
static const QString s("swiftdata");
|
||||
return s;
|
||||
}
|
||||
|
||||
QString CProject::envVarPrivateSetupDirValue()
|
||||
{
|
||||
return QProcessEnvironment::systemEnvironment().value(envVarPrivateSetupDir());
|
||||
|
||||
@@ -66,18 +66,21 @@ namespace BlackMisc
|
||||
//! System's name and version
|
||||
static const QString &swiftVersionString();
|
||||
|
||||
//! System's name and version + info if dev.environemnt
|
||||
static const QString &swiftVersionStringDevInfo();
|
||||
|
||||
//! System's name and version
|
||||
static const char *swiftVersionChar();
|
||||
|
||||
//! System's name and version + info if dev.environment / beta
|
||||
static const QString &versionStringDevBetaInfo();
|
||||
|
||||
//! Version major
|
||||
static int versionMajor();
|
||||
|
||||
//! Version minor
|
||||
static int versionMinor();
|
||||
|
||||
//! Is the given string representing a newer version?
|
||||
static bool isNewerVersion(const QString &versionString);
|
||||
|
||||
//! Debug build?
|
||||
static bool isDebugBuild();
|
||||
|
||||
@@ -132,10 +135,22 @@ namespace BlackMisc
|
||||
//! Environment variable private resources directory
|
||||
static const QString &envVarPrivateSetupDir();
|
||||
|
||||
//! Executable name for swift GUI, no(!) appendix
|
||||
static const QString &swiftGuiExecutableName();
|
||||
|
||||
//! Executable name for swift core, no(!) appendix
|
||||
static const QString &swiftCoreExecutableName();
|
||||
|
||||
//! Executable name for swift data, no(!) appendix
|
||||
static const QString &swiftDataExecutableName();
|
||||
|
||||
private:
|
||||
//! Constructor
|
||||
CProject() {}
|
||||
|
||||
//! Parts of version string 1.0.2
|
||||
static QList<int> getVersionParts(const QString &versionString);
|
||||
|
||||
//! Split version
|
||||
static int getMajorMinor(int index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user