mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
@@ -14,7 +14,6 @@
|
||||
#include "blackcore/vatsimbookingreader.h"
|
||||
#include "blackcore/vatsimdatafilereader.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/testing.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/propertyindexallclasses.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "application.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackcore/corefacade.h"
|
||||
#include "blackcore/setupreader.h"
|
||||
#include "blackcore/networkvatlib.h"
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "blackcore/registermetadata.h"
|
||||
#include "blackcore/cookiemanager.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/dbusserver.h"
|
||||
#include "blackmisc/registermetadata.h"
|
||||
#include "blackmisc/threadutils.h"
|
||||
@@ -52,7 +52,7 @@ namespace BlackCore
|
||||
{
|
||||
CApplication::initEnvironment();
|
||||
QCoreApplication::setApplicationName(applicationName);
|
||||
QCoreApplication::setApplicationVersion(CProject::version());
|
||||
QCoreApplication::setApplicationVersion(CVersion::version());
|
||||
this->setObjectName(applicationName);
|
||||
this->initParser();
|
||||
this->initLogging();
|
||||
@@ -103,7 +103,7 @@ namespace BlackCore
|
||||
|
||||
const QString &CApplication::getApplicationNameAndVersion() const
|
||||
{
|
||||
static const QString s(QCoreApplication::instance()->applicationName() + " " + CProject::version());
|
||||
static const QString s(QCoreApplication::instance()->applicationName() + " " + CVersion::version());
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -210,22 +210,22 @@ namespace BlackCore
|
||||
|
||||
const QString &CApplication::versionStringDevBetaInfo() const
|
||||
{
|
||||
if (isRunningInDeveloperEnvironment() && CProject::isBetaTest())
|
||||
if (isRunningInDeveloperEnvironment() && CBuildConfig::isBetaTest())
|
||||
{
|
||||
static const QString s(CProject::version() + " [DEV, BETA]");
|
||||
static const QString s(CVersion::version() + " [DEV, BETA]");
|
||||
return s;
|
||||
}
|
||||
if (isRunningInDeveloperEnvironment())
|
||||
{
|
||||
static const QString s(CProject::version() + " [DEV]");
|
||||
static const QString s(CVersion::version() + " [DEV]");
|
||||
return s;
|
||||
}
|
||||
if (CProject::isBetaTest())
|
||||
if (CBuildConfig::isBetaTest())
|
||||
{
|
||||
static const QString s(CProject::version() + " [BETA]");
|
||||
static const QString s(CVersion::version() + " [BETA]");
|
||||
return s;
|
||||
}
|
||||
return CProject::version();
|
||||
return CVersion::version();
|
||||
}
|
||||
|
||||
const QString &CApplication::swiftVersionString() const
|
||||
@@ -242,7 +242,7 @@ namespace BlackCore
|
||||
|
||||
bool CApplication::isRunningInDeveloperEnvironment() const
|
||||
{
|
||||
if (!CProject::canRunInDeveloperEnvironment()) { return false; }
|
||||
if (!CBuildConfig::canRunInDeveloperEnvironment()) { return false; }
|
||||
if (!this->m_parser.value(this->m_cmdDevelopment).isEmpty())
|
||||
{
|
||||
// explicit value
|
||||
@@ -265,21 +265,21 @@ namespace BlackCore
|
||||
QString CApplication::getEnvironmentInfoString(const QString &separator) const
|
||||
{
|
||||
QString env("Beta: ");
|
||||
env.append(boolToYesNo(CProject::isBetaTest()));
|
||||
env.append(boolToYesNo(CBuildConfig::isBetaTest()));
|
||||
env = env.append(" dev.env,: ").append(boolToYesNo(isRunningInDeveloperEnvironment()));
|
||||
env = env.append(separator);
|
||||
env.append("Windows: ").append(boolToYesNo(CProject::isRunningOnWindowsNtPlatform()));
|
||||
env.append("Windows: ").append(boolToYesNo(CBuildConfig::isRunningOnWindowsNtPlatform()));
|
||||
return env;
|
||||
}
|
||||
|
||||
QString CApplication::getInfoString(const QString &separator) const
|
||||
{
|
||||
QString str(CProject::version());
|
||||
str = str.append(" ").append(CProject::isReleaseBuild() ? "Release build" : "Debug build");
|
||||
QString str(CVersion::version());
|
||||
str = str.append(" ").append(CBuildConfig::isReleaseBuild() ? "Release build" : "Debug build");
|
||||
str = str.append(separator);
|
||||
str = str.append(getEnvironmentInfoString(separator));
|
||||
str = str.append(separator);
|
||||
str.append(CProject::compiledWithInfo(false));
|
||||
str.append(CBuildConfig::compiledWithInfo(false));
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -661,9 +661,9 @@ namespace BlackCore
|
||||
bool CApplication::parse()
|
||||
{
|
||||
if (this->m_parsed) { return m_parsed; }
|
||||
if (CProject::isLifetimeExpired())
|
||||
if (CBuildConfig::isLifetimeExpired())
|
||||
{
|
||||
this->cmdLineErrorMessage("Program exired " + CProject::getEol().toString());
|
||||
this->cmdLineErrorMessage("Program exired " + CBuildConfig::getEol().toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/pixmap.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include <QObject>
|
||||
@@ -165,7 +165,7 @@ namespace BlackCore
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const = 0;
|
||||
|
||||
//! Simulator avialable (driver available)?
|
||||
bool isSimulatorAvailable() const { return BlackMisc::CProject::isCompiledWithFlightSimulatorSupport() && !getSimulatorPluginInfo().isUnspecified(); }
|
||||
bool isSimulatorAvailable() const { return BlackMisc::CBuildConfig::isCompiledWithFlightSimulatorSupport() && !getSimulatorPluginInfo().isUnspecified(); }
|
||||
|
||||
//! Icon representing the model
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "globalsetup.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/math/mathutils.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include <QStringList>
|
||||
@@ -29,7 +29,7 @@ namespace BlackCore
|
||||
m_vatsimMetarsUrls( {"http://metar.vatsim.net/metar.php"}),
|
||||
m_vatsimStatusFileUrls({ "https://status.vatsim.net" }),
|
||||
m_vatsimDataFileUrls({ "http://info.vroute.net/vatsim-data.txt" }),
|
||||
m_sharedUrls(CProject::swiftTeamDefaultServers()),
|
||||
m_sharedUrls(CBuildConfig::swiftTeamDefaultServers()),
|
||||
m_newsUrls(QStringList({ "http://swift-project.org/" }))
|
||||
{ }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "updateinfo.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include <QStringList>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -22,20 +22,20 @@ namespace BlackCore
|
||||
ITimestampBased(0),
|
||||
m_downloadsStableUrls(QStringList {"http://swift-project.org/"}),
|
||||
m_downloadsBetaUrls(QStringList {"http://swift-project.org/"}),
|
||||
m_latestVersionStable(CProject::version()),
|
||||
m_latestVersionStable(CVersion::version()),
|
||||
m_lastSupportedVersionStable("0.6"),
|
||||
m_latestVersionBeta(CProject::version()),
|
||||
m_latestVersionBeta(CVersion::version()),
|
||||
m_lastSupportedVersionBeta("0.6")
|
||||
{ }
|
||||
|
||||
CUrlList CUpdateInfo::getDownloadUrls() const
|
||||
{
|
||||
return CProject::isBetaTest() ? getDownloadUrlsBeta() : getDownloadUrlsStable();
|
||||
return CBuildConfig::isBetaTest() ? getDownloadUrlsBeta() : getDownloadUrlsStable();
|
||||
}
|
||||
|
||||
QString CUpdateInfo::getLatestVersion() const
|
||||
{
|
||||
return CProject::isBetaTest() ? getLatestVersionBeta() : getLatestVersionStable();
|
||||
return CBuildConfig::isBetaTest() ? getLatestVersionBeta() : getLatestVersionStable();
|
||||
}
|
||||
|
||||
bool CUpdateInfo::hasSameType(const CUpdateInfo &otherDownload) const
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/datastoreutility.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include <QUrlQuery>
|
||||
#include <QJsonDocument>
|
||||
#include <QHttpPart>
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
|
||||
#include "networkvatlib.h"
|
||||
#include "application.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include <QJsonDocument>
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
@@ -20,14 +21,6 @@
|
||||
static_assert(! std::is_abstract<BlackCore::CNetworkVatlib>::value, "Must implement all pure virtuals");
|
||||
static_assert(VAT_LIBVATLIB_VERSION == 905, "Wrong vatlib header installed");
|
||||
|
||||
#if !defined(BLACK_CLIENT_PUBLIC_ID)
|
||||
#error Missing definition of id
|
||||
#endif
|
||||
|
||||
#if !defined(BLACK_CLIENT_PRIVATE_KEY)
|
||||
#error Missing definition of pk
|
||||
#endif
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
@@ -71,11 +64,10 @@ namespace BlackCore
|
||||
clientCapabilities |= vatCapsStealth;
|
||||
}
|
||||
|
||||
static const QString pkDef(BLACK_STRINGIFY(BLACK_CLIENT_PRIVATE_KEY));
|
||||
static const QByteArray pk(this->getCmdLineFsdKey().isEmpty() ? pkDef.toLocal8Bit() : this->getCmdLineFsdKey().toLocal8Bit());
|
||||
static const QByteArray pk(this->getCmdLineFsdKey().isEmpty() ? CBuildConfig::vatsimPrivateKey().toLocal8Bit() : this->getCmdLineFsdKey().toLocal8Bit());
|
||||
m_net.reset(Vat_CreateNetworkSession(vatServerLegacyFsd, sApp->swiftVersionChar(),
|
||||
CProject::versionMajor(), CProject::versionMinor(),
|
||||
"None", BLACK_CLIENT_PUBLIC_ID, pk.constData(),
|
||||
CVersion::versionMajor(), CVersion::versionMinor(),
|
||||
"None", CBuildConfig::vatsimClientId(), pk.constData(),
|
||||
clientCapabilities));
|
||||
|
||||
Vat_SetStateChangeHandler(m_net.data(), onConnectionStatusChanged, this);
|
||||
@@ -599,7 +591,7 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
// only in not officially shipped versions
|
||||
return (CProject::isShippedVersion() && !CProject::isBetaTest()) ? e : opts;
|
||||
return (CBuildConfig::isShippedVersion() && !CBuildConfig::isBetaTest()) ? e : opts;
|
||||
}
|
||||
|
||||
QString CNetworkVatlib::getCmdLineFsdKey() const
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/logcategory.h"
|
||||
#include "blackmisc/json.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "setupreader.h"
|
||||
@@ -87,7 +87,7 @@ namespace BlackCore
|
||||
if (this->m_bootstrapUrls.isEmpty())
|
||||
{
|
||||
CGlobalSetup resourceSetup(CGlobalSetup::fromJsonFile(
|
||||
CProject::getBootstrapResourceFile()
|
||||
CBuildConfig::getBootstrapResourceFile()
|
||||
));
|
||||
this->m_bootstrapUrls.push_back(resourceSetup.getBootstrapFileUrls());
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "blackmisc/weather/metarset.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
#include "blackmisc/countrylist.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/restricted.h"
|
||||
#include <QObject>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -78,7 +79,7 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// write to disk
|
||||
bool s = sGui->getWebDataServices()->writeDbDataToDisk(CProject::getSwiftStaticDbFilesDir());
|
||||
bool s = sGui->getWebDataServices()->writeDbDataToDisk(CBuildConfig::getSwiftStaticDbFilesDir());
|
||||
if (s)
|
||||
{
|
||||
CLogMessage(this).info("Written DB data");
|
||||
@@ -93,12 +94,12 @@ namespace BlackGui
|
||||
bool CDataInfoAreaComponent::readDbDataFromResourceDir()
|
||||
{
|
||||
bool s = sGui &&
|
||||
sGui->getWebDataServices()->readDbDataFromDisk(CProject::getSwiftStaticDbFilesDir(), true);
|
||||
sGui->getWebDataServices()->readDbDataFromDisk(CBuildConfig::getSwiftStaticDbFilesDir(), true);
|
||||
|
||||
// info
|
||||
if (s)
|
||||
{
|
||||
CLogMessage(this).info("Read DB data from directory: %1") << CProject::getSwiftStaticDbFilesDir();
|
||||
CLogMessage(this).info("Read DB data from directory: %1") << CBuildConfig::getSwiftStaticDbFilesDir();
|
||||
this->ui->comp_DbAircraftIcao->showLoadIndicator();
|
||||
this->ui->comp_DbAirlineIcao->showLoadIndicator();
|
||||
this->ui->comp_DbCountries->showLoadIndicator();
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "dbdebugdatabasesetup.h"
|
||||
#include "ui_dbdebugdatabasesetup.h"
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "blackcore/contextaudio.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/audio/audioutils.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/icons.h"
|
||||
|
||||
#include <QPoint>
|
||||
@@ -159,7 +159,7 @@ namespace BlackGui
|
||||
QMenu menuAudio(this);
|
||||
menuAudio.addAction("Toogle mute");
|
||||
|
||||
if (CProject::isRunningOnWindowsNtPlatform())
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
menuAudio.addAction("Mixer");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "blackcore/network.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include <QIntValidator>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -106,7 +107,7 @@ namespace BlackGui
|
||||
CServerList otherServers(this->m_otherTrafficNetworkServers.get());
|
||||
|
||||
// add a testserver when no servers can be loaded
|
||||
if (otherServers.isEmpty() && (sGui->isRunningInDeveloperEnvironment() || CProject::isBetaTest()))
|
||||
if (otherServers.isEmpty() && (sGui->isRunningInDeveloperEnvironment() || CBuildConfig::isBetaTest()))
|
||||
{
|
||||
otherServers.push_back(sGui->getGlobalSetup().getFsdTestServersPlusHardcodedServers());
|
||||
CLogMessage(this).info("Added servers for testing");
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "blackcore/setupreader.h"
|
||||
#include "blackcore/contextapplication.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include <QModelIndex>
|
||||
|
||||
using namespace BlackCore;
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
|
||||
// add swift test servers in case we have no servers:
|
||||
// this is debug/bootstrap feature we can continue to test when something goes wrong
|
||||
if (serverList.isEmpty() && (CProject::isBetaTest() || sGui->isRunningInDeveloperEnvironment()))
|
||||
if (serverList.isEmpty() && (CBuildConfig::isBetaTest() || sGui->isRunningInDeveloperEnvironment()))
|
||||
{
|
||||
serverList.push_back(sGui->getGlobalSetup().getFsdTestServersPlusHardcodedServers());
|
||||
this->ui->tvp_Servers->updateContainer(serverList);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "stylesheetutility.h"
|
||||
#include "registermetadata.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "blackmisc/metadatautils.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
@@ -215,7 +215,7 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::cmdLineErrorMessage(const QString &errorMessage) const
|
||||
{
|
||||
if (CProject::isRunningOnWindowsNtPlatform())
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
const QString helpText(beautifyHelpMessage(this->m_parser.helpText()));
|
||||
QMessageBox::warning(nullptr,
|
||||
@@ -439,7 +439,7 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::cmdLineHelpMessage()
|
||||
{
|
||||
if (CProject::isRunningOnWindowsNtPlatform())
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
QMessageBox::information(nullptr,
|
||||
QGuiApplication::applicationDisplayName(),
|
||||
@@ -453,7 +453,7 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::cmdLineVersionMessage() const
|
||||
{
|
||||
if (CProject::isRunningOnWindowsNtPlatform())
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
QMessageBox::information(nullptr,
|
||||
QGuiApplication::applicationDisplayName(),
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "blackcore/cookiemanager.h"
|
||||
#include "blackmisc/filelogger.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include <QMainWindow>
|
||||
#include <QApplication>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "atcstationview.h"
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
#include "blackmisc/testing.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -41,7 +42,7 @@ namespace BlackGui
|
||||
|
||||
void CAtcStationView::customMenu(QMenu &menu) const
|
||||
{
|
||||
if (BlackMisc::CProject::isDebugBuild())
|
||||
if (BlackMisc::CBuildConfig::isDebugBuild())
|
||||
{
|
||||
menu.addAction(CIcons::tableSheet16(), "Test: 1k ATC online stations", this, SLOT(ps_testRequest1kAtcOnlineDummies()));
|
||||
menu.addAction(CIcons::tableSheet16(), "Test: 3k ATC online stations", this, SLOT(ps_testRequest3kAtcOnlineDummies()));
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "viewbase.h"
|
||||
#include "../models/atcstationlistmodel.h"
|
||||
#include "blackmisc/project.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "simulatedaircraftview.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -41,7 +41,7 @@ namespace BlackGui
|
||||
|
||||
void CSimulatedAircraftView::customMenu(QMenu &menu) const
|
||||
{
|
||||
if (BlackMisc::CProject::isDebugBuild())
|
||||
if (BlackMisc::CBuildConfig::isDebugBuild())
|
||||
{
|
||||
// tbd
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "viewbase.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackgui/models/allmodels.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
@@ -374,7 +374,7 @@ namespace BlackGui
|
||||
QString CViewBaseNonTemplate::getDefaultFilename(bool load) const
|
||||
{
|
||||
// some logic to find a useful default name
|
||||
QString dir = CProject::getDocumentationDirectory();
|
||||
QString dir = CBuildConfig::getDocumentationDirectory();
|
||||
|
||||
if (load)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "audioutils.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include <QProcess>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -17,7 +17,7 @@ namespace BlackMisc
|
||||
{
|
||||
bool startWindowsMixer()
|
||||
{
|
||||
if (!CProject::isRunningOnWindowsNtPlatform()) { return false; }
|
||||
if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return false; }
|
||||
QStringList parameterlist;
|
||||
return QProcess::startDetached("SndVol.exe", parameterlist);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ contains(BLACK_CONFIG, Static) {
|
||||
CONFIG += staticlib
|
||||
}
|
||||
|
||||
buildconfig.input = buildconfig.h.in
|
||||
buildconfig.output = buildconfig.h
|
||||
QMAKE_SUBSTITUTES += buildconfig
|
||||
|
||||
INCLUDEPATH += ..
|
||||
# DEPENDPATH += . .. // BlackMisc should be independent
|
||||
# PRECOMPILED_HEADER = stdpch.h
|
||||
@@ -65,7 +69,7 @@ win32 {
|
||||
DESTDIR = $$DestRoot/lib
|
||||
DLLDESTDIR = $$DestRoot/bin
|
||||
|
||||
OTHER_FILES += $$TRANSLATIONS readme.txt
|
||||
OTHER_FILES += $$TRANSLATIONS readme.txt buildconfig.h.in
|
||||
|
||||
win32 {
|
||||
dlltarget.path = $$PREFIX/bin
|
||||
|
||||
@@ -38,16 +38,4 @@
|
||||
# define BLACKMISC_EXPORT_TEMPLATE
|
||||
#endif
|
||||
|
||||
|
||||
//! \cond
|
||||
// helper define
|
||||
#define BLACK_STRINGIFY_X(v) #v
|
||||
//! \endcond
|
||||
|
||||
/*!
|
||||
* \def BLACK_STRINGIFY
|
||||
* Value in quotes (normally to be used then with QString)
|
||||
*/
|
||||
#define BLACK_STRINGIFY(v) BLACK_STRINGIFY_X(v)
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
//! \cond PRIVATE
|
||||
|
||||
#include "project.h"
|
||||
#include "buildconfig.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
@@ -19,17 +19,9 @@
|
||||
#include <QProcessEnvironment>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#if !defined(BLACK_VERSION)
|
||||
#error Missing version
|
||||
#endif
|
||||
|
||||
#if !defined(BLACK_EOL)
|
||||
#error Missing EOL
|
||||
#endif
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
bool CProject::isCompiledWithBlackCore()
|
||||
bool CBuildConfig::isCompiledWithBlackCore()
|
||||
{
|
||||
#ifdef WITH_BLACKCORE
|
||||
return true;
|
||||
@@ -38,7 +30,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithBlackSound()
|
||||
bool CBuildConfig::isCompiledWithBlackSound()
|
||||
{
|
||||
#ifdef WITH_BLACKSOUND
|
||||
return true;
|
||||
@@ -47,7 +39,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithBlackInput()
|
||||
bool CBuildConfig::isCompiledWithBlackInput()
|
||||
{
|
||||
#ifdef WITH_BLACKINPUT
|
||||
return true;
|
||||
@@ -56,7 +48,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithFs9Support()
|
||||
bool CBuildConfig::isCompiledWithFs9Support()
|
||||
{
|
||||
#ifdef WITH_FS9
|
||||
return true;
|
||||
@@ -65,7 +57,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithFsxSupport()
|
||||
bool CBuildConfig::isCompiledWithFsxSupport()
|
||||
{
|
||||
#ifdef WITH_FSX
|
||||
return true;
|
||||
@@ -74,17 +66,17 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithP3DSupport()
|
||||
bool CBuildConfig::isCompiledWithP3DSupport()
|
||||
{
|
||||
return isCompiledWithFsxSupport();
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithMsFlightSimulatorSupport()
|
||||
bool CBuildConfig::isCompiledWithMsFlightSimulatorSupport()
|
||||
{
|
||||
return isCompiledWithFs9Support() || isCompiledWithFsxSupport() || isCompiledWithP3DSupport();
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithXPlaneSupport()
|
||||
bool CBuildConfig::isCompiledWithXPlaneSupport()
|
||||
{
|
||||
#ifdef WITH_XPLANE
|
||||
return true;
|
||||
@@ -93,12 +85,12 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isCompiledWithFlightSimulatorSupport()
|
||||
bool CBuildConfig::isCompiledWithFlightSimulatorSupport()
|
||||
{
|
||||
return isCompiledWithFsxSupport() || isCompiledWithXPlaneSupport();
|
||||
}
|
||||
|
||||
bool BlackMisc::CProject::isCompiledWithGui()
|
||||
bool CBuildConfig::isCompiledWithGui()
|
||||
{
|
||||
#ifdef WITH_BLACKGUI
|
||||
return true;
|
||||
@@ -107,60 +99,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
const BlackMisc::Simulation::CSimulatorInfo &CProject::simulators()
|
||||
{
|
||||
static const BlackMisc::Simulation::CSimulatorInfo simInfo(
|
||||
isCompiledWithFsxSupport(),
|
||||
isCompiledWithFs9Support(),
|
||||
isCompiledWithXPlaneSupport(),
|
||||
isCompiledWithP3DSupport()
|
||||
);
|
||||
return simInfo;
|
||||
}
|
||||
|
||||
const char *CProject::simulatorsChar()
|
||||
{
|
||||
static const QByteArray sims(simulators().toQString().toUtf8());
|
||||
return sims.constData();
|
||||
}
|
||||
|
||||
const QString &CProject::version()
|
||||
{
|
||||
#ifdef BLACK_VERSION
|
||||
static const QString v(BLACK_STRINGIFY(BLACK_VERSION));
|
||||
#else
|
||||
static const QString v("?");
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
|
||||
int CProject::versionMajor()
|
||||
{
|
||||
return getMajorMinor(0);
|
||||
}
|
||||
|
||||
int CProject::versionMinor()
|
||||
{
|
||||
return getMajorMinor(1);
|
||||
}
|
||||
|
||||
bool CProject::isNewerVersion(const QString &versionString)
|
||||
{
|
||||
if (versionString.isEmpty()) { return false; }
|
||||
if (CProject::version() == versionString) { 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 false;
|
||||
}
|
||||
|
||||
bool CProject::isDebugBuild()
|
||||
bool CBuildConfig::isDebugBuild()
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
return true;
|
||||
@@ -169,7 +108,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isReleaseBuild()
|
||||
bool CBuildConfig::isReleaseBuild()
|
||||
{
|
||||
#ifdef QT_NO_DEBUG
|
||||
return true;
|
||||
@@ -178,7 +117,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isBetaTest()
|
||||
bool CBuildConfig::isBetaTest()
|
||||
{
|
||||
#ifdef SWIFT_BETA
|
||||
return true;
|
||||
@@ -187,13 +126,13 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::canRunInDeveloperEnvironment()
|
||||
bool CBuildConfig::canRunInDeveloperEnvironment()
|
||||
{
|
||||
if (isBetaTest()) { return true; }
|
||||
return !isShippedVersion();
|
||||
}
|
||||
|
||||
bool CProject::isShippedVersion()
|
||||
bool CBuildConfig::isShippedVersion()
|
||||
{
|
||||
#ifdef SWIFT_SHIPPED
|
||||
return true;
|
||||
@@ -202,7 +141,7 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CProject::isRunningOnWindowsNtPlatform()
|
||||
bool CBuildConfig::isRunningOnWindowsNtPlatform()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// QSysInfo::WindowsVersion only available on Win platforms
|
||||
@@ -212,58 +151,32 @@ namespace BlackMisc
|
||||
#endif
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
QList<int> partsInt(getVersionParts(version()));
|
||||
if (index >= partsInt.length()) { return -1; }
|
||||
return partsInt[index];
|
||||
}
|
||||
|
||||
const QString &CProject::swiftGuiExecutableName()
|
||||
const QString &CBuildConfig::swiftGuiExecutableName()
|
||||
{
|
||||
static const QString s("swiftguistd");
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CProject::swiftCoreExecutableName()
|
||||
const QString &CBuildConfig::swiftCoreExecutableName()
|
||||
{
|
||||
static const QString s("swiftcore");
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CProject::swiftDataExecutableName()
|
||||
const QString &CBuildConfig::swiftDataExecutableName()
|
||||
{
|
||||
static const QString s("swiftdata");
|
||||
return s;
|
||||
}
|
||||
|
||||
const QStringList &CProject::swiftTeamDefaultServers()
|
||||
const QStringList &CBuildConfig::swiftTeamDefaultServers()
|
||||
{
|
||||
static const QStringList s({ "https://vatsim-germany.org:50443/mapping/public/shared", "http://ubuntu12/public/bootstrap/shared"});
|
||||
static const QStringList s({ "https://vatsim-germany.org:50443/mapping/public/shared",
|
||||
"http://ubuntu12/public/bootstrap/shared"});
|
||||
return s;
|
||||
}
|
||||
|
||||
const QDateTime &CProject::getEol()
|
||||
{
|
||||
static const QString eol(BLACK_STRINGIFY(BLACK_EOL));
|
||||
static const QDateTime dt(eol.isEmpty() ? QDateTime() : QDateTime::fromString(eol, "yyyyMMdd"));
|
||||
return dt;
|
||||
}
|
||||
|
||||
bool CProject::isLifetimeExpired()
|
||||
bool CBuildConfig::isLifetimeExpired()
|
||||
{
|
||||
if (getEol().isValid())
|
||||
{
|
||||
@@ -282,7 +195,7 @@ namespace BlackMisc
|
||||
return p.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CProject::getApplicationDir()
|
||||
const QString &CBuildConfig::getApplicationDir()
|
||||
{
|
||||
static const QString s(getApplicationDirImpl());
|
||||
return s;
|
||||
@@ -290,7 +203,7 @@ namespace BlackMisc
|
||||
|
||||
QString getSwiftResourceDirImpl()
|
||||
{
|
||||
QDir dir(CProject::getApplicationDir());
|
||||
QDir dir(CBuildConfig::getApplicationDir());
|
||||
if (dir.cdUp())
|
||||
{
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
@@ -300,7 +213,7 @@ namespace BlackMisc
|
||||
return "";
|
||||
}
|
||||
|
||||
const QString &CProject::getSwiftResourceDir()
|
||||
const QString &CBuildConfig::getSwiftResourceDir()
|
||||
{
|
||||
static const QString s(getSwiftResourceDirImpl());
|
||||
return s;
|
||||
@@ -308,14 +221,14 @@ namespace BlackMisc
|
||||
|
||||
const QString getBootstrapResourceFileImpl()
|
||||
{
|
||||
const QString d(CProject::getSwiftResourceDir());
|
||||
const QString d(CBuildConfig::getSwiftResourceDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QFile file(CFileUtils::appendFilePaths(d, "shared/boostrap/boostrap.json"));
|
||||
Q_ASSERT_X(file.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return QFileInfo(file).absoluteFilePath();
|
||||
}
|
||||
|
||||
const QString &CProject::getBootstrapResourceFile()
|
||||
const QString &CBuildConfig::getBootstrapResourceFile()
|
||||
{
|
||||
static const QString s(getBootstrapResourceFileImpl());
|
||||
return s;
|
||||
@@ -323,14 +236,14 @@ namespace BlackMisc
|
||||
|
||||
QString getSwiftStaticDbFilesDirImpl()
|
||||
{
|
||||
const QString d(CProject::getSwiftResourceDir());
|
||||
const QString d(CBuildConfig::getSwiftResourceDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
QDir dir(CFileUtils::appendFilePaths(d, "shared/dbdata"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CProject::getSwiftStaticDbFilesDir()
|
||||
const QString &CBuildConfig::getSwiftStaticDbFilesDir()
|
||||
{
|
||||
static QString s(getSwiftStaticDbFilesDirImpl());
|
||||
return s;
|
||||
@@ -338,13 +251,13 @@ namespace BlackMisc
|
||||
|
||||
QString getImagesDirImpl()
|
||||
{
|
||||
const QString d(CProject::getSwiftResourceDir());
|
||||
const QString d(CBuildConfig::getSwiftResourceDir());
|
||||
QDir dir(CFileUtils::appendFilePaths(d, "data/images"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CProject::getImagesDir()
|
||||
const QString &CBuildConfig::getImagesDir()
|
||||
{
|
||||
static const QString s(getImagesDirImpl());
|
||||
return s;
|
||||
@@ -360,13 +273,13 @@ namespace BlackMisc
|
||||
return pathes.first();
|
||||
}
|
||||
|
||||
const QString &CProject::getDocumentationDirectory()
|
||||
const QString &CBuildConfig::getDocumentationDirectory()
|
||||
{
|
||||
static const QString d(getDocumentationDirectoryImpl());
|
||||
return d;
|
||||
}
|
||||
|
||||
const QString &CProject::compiledWithInfo(bool shortVersion)
|
||||
const QString &CBuildConfig::compiledWithInfo(bool shortVersion)
|
||||
{
|
||||
if (shortVersion)
|
||||
{
|
||||
@@ -405,6 +318,38 @@ namespace BlackMisc
|
||||
return infoLong;
|
||||
}
|
||||
}
|
||||
|
||||
bool CVersion::isNewerVersion(const QString &versionString)
|
||||
{
|
||||
if (versionString.isEmpty()) { return false; }
|
||||
if (CVersion::version() == versionString) { 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 false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QList<int> CVersion::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;
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
//! \endcond
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift Project Community / Contributors
|
||||
/* Copyright (C) 2016
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
@@ -9,19 +9,30 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_CPROJECT_H
|
||||
#define BLACKMISC_CPROJECT_H
|
||||
#ifndef BLACKMISC_BUILDCONFIG_H
|
||||
#define BLACKMISC_BUILDCONFIG_H
|
||||
|
||||
#include "blackmiscexport.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include \"blackmisc/blackmiscexport.h\"
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
|
||||
$$DEFINE_WITH_BLACKCORE#define WITH_BLACKCORE
|
||||
$$DEFINE_WITH_BLACKSOUND#define WITH_BLACKSOUND
|
||||
$$DEFINE_WITH_BLACKINPUT#define WITH_BLACKINPUT
|
||||
$$DEFINE_WITH_BLACKGUI#define WITH_BLACKGUI
|
||||
$$DEFINE_WITH_SWIFTDATA#define WITH_SWIFTDATA
|
||||
$$DEFINE_WITH_SWIFTGUI#define WITH_SWIFTGUI
|
||||
$$DEFINE_WITH_SWIFTCORE#define WITH_SWIFTCORE
|
||||
$$DEFINE_WITH_FSX#define WITH_FSX
|
||||
$$DEFINE_WITH_FS9#define WITH_FS9
|
||||
$$DEFINE_WITH_XPLANE#define WITH_XPLANE
|
||||
$$DEFINE_SWIFT_BETA#define SWIFT_BETA
|
||||
$$DEFINE_SWIFT_SHIPPED#define SWIFT_SHIPPED
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*!
|
||||
* Metadata about the project
|
||||
*/
|
||||
class BLACKMISC_EXPORT CProject
|
||||
|
||||
class BLACKMISC_EXPORT CBuildConfig
|
||||
{
|
||||
public:
|
||||
//! with BlackCore?
|
||||
@@ -54,24 +65,6 @@ namespace BlackMisc
|
||||
//! with GUI?
|
||||
static bool isCompiledWithGui();
|
||||
|
||||
//! Simulator String info
|
||||
static const BlackMisc::Simulation::CSimulatorInfo &simulators();
|
||||
|
||||
//! Simulator String info
|
||||
static const char *simulatorsChar();
|
||||
|
||||
//! Version info
|
||||
static const QString &version();
|
||||
|
||||
//! 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();
|
||||
|
||||
@@ -91,6 +84,7 @@ namespace BlackMisc
|
||||
static bool isRunningOnWindowsNtPlatform();
|
||||
|
||||
//! Application directory where current application is located
|
||||
//! \todo Move to to CApplication
|
||||
static const QString &getApplicationDir();
|
||||
|
||||
//! Where resource files (static DB files, ...) etc are located
|
||||
@@ -111,9 +105,6 @@ namespace BlackMisc
|
||||
//! Info string about compilation
|
||||
static const QString &compiledWithInfo(bool shortVersion = true);
|
||||
|
||||
//! Whole info
|
||||
static QString convertToQString(const QString &separator = QString("\n"));
|
||||
|
||||
//! Executable name for swift GUI, no(!) appendix
|
||||
static const QString &swiftGuiExecutableName();
|
||||
|
||||
@@ -127,21 +118,61 @@ namespace BlackMisc
|
||||
static const QStringList &swiftTeamDefaultServers();
|
||||
|
||||
//! End of lifetime
|
||||
static const QDateTime &getEol();
|
||||
static const QDateTime &getEol()
|
||||
{
|
||||
static const QString eol(\"$$BLACK_EOL\");
|
||||
static const QDateTime dt(eol.isEmpty() ? QDateTime() : QDateTime::fromString(eol, \"yyyyMMdd\"));
|
||||
return dt;
|
||||
}
|
||||
|
||||
//! Lifetime ended?
|
||||
static bool isLifetimeExpired();
|
||||
|
||||
private:
|
||||
//! Constructor
|
||||
CProject() {}
|
||||
//! Vatsim client id
|
||||
static int vatsimClientId()
|
||||
{
|
||||
static const int id { $$VATSIM_CLIENT_ID };
|
||||
return id;
|
||||
}
|
||||
|
||||
//! Vatsim client key
|
||||
static const QString &vatsimPrivateKey()
|
||||
{
|
||||
static const auto pk = QString { \"$$VATSIM_CLIENT_PRIVATE_KEY\" };
|
||||
return pk;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class BLACKMISC_EXPORT CVersion
|
||||
{
|
||||
public:
|
||||
//! Version info
|
||||
static const QString &version()
|
||||
{
|
||||
static const QString version(\"$$BLACK_VERSION\");
|
||||
Q_ASSERT(!version.isEmpty());
|
||||
return version;
|
||||
}
|
||||
|
||||
//! Version major
|
||||
static int versionMajor() { return $$BLACK_VER_MAJ; }
|
||||
|
||||
//! Version minor
|
||||
static int versionMinor() { return $$BLACK_VER_MIN; }
|
||||
|
||||
//! Version patch
|
||||
static int versionPatch() { return $$BLACK_VER_PAT; }
|
||||
|
||||
//! Is the given string representing a newer version?
|
||||
static bool isNewerVersion(const QString &versionString);
|
||||
|
||||
private:
|
||||
//! Parts of version string 1.0.2
|
||||
static QList<int> getVersionParts(const QString &versionString);
|
||||
|
||||
//! Split version
|
||||
static int getMajorMinor(int index);
|
||||
};
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
}
|
||||
|
||||
#endif // BLACKCONFIG_H
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "blackmisc/worker.h"
|
||||
#include "fileutils.h"
|
||||
#include "project.h"
|
||||
#include "buildconfig.h"
|
||||
#include <QFile>
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace BlackMisc
|
||||
|
||||
Qt::CaseSensitivity CFileUtils::osFileNameCaseSensitivity()
|
||||
{
|
||||
return CProject::isRunningOnWindowsNtPlatform() ? Qt::CaseInsensitive : Qt::CaseSensitive;
|
||||
return CBuildConfig::isRunningOnWindowsNtPlatform() ? Qt::CaseInsensitive : Qt::CaseSensitive;
|
||||
}
|
||||
|
||||
bool CFileUtils::matchesExcludeDirectory(const QString &directoryPath, const QString &excludeDirectory, Qt::CaseSensitivity cs)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <functional>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
//! \cond PRIVATE
|
||||
|
||||
#include "icons.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "buildconfig.h"
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
@@ -1126,7 +1126,7 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(!fileName.isEmpty(), Q_FUNC_INFO, "missing filename");
|
||||
if (!getResourceFileCache().contains(fileName))
|
||||
{
|
||||
QString path = CFileUtils::appendFilePaths(CProject::getImagesDir(), fileName);
|
||||
QString path = CFileUtils::appendFilePaths(CBuildConfig::getImagesDir(), fileName);
|
||||
QPixmap pm;
|
||||
bool s = pm.load(path);
|
||||
if (s)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "fscommonutil.h"
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
@@ -25,7 +25,7 @@ namespace BlackMisc
|
||||
QString CFsCommonUtil::fsxDirFromRegistry()
|
||||
{
|
||||
QString fsxPath;
|
||||
if (CProject::isCompiledWithFsxSupport())
|
||||
if (CBuildConfig::isCompiledWithFsxSupport())
|
||||
{
|
||||
FsRegistryPathPair fsxRegistryPathPairs =
|
||||
{
|
||||
@@ -102,7 +102,7 @@ namespace BlackMisc
|
||||
QString CFsCommonUtil::fs9DirFromRegistry()
|
||||
{
|
||||
QString fs9Path;
|
||||
if (CProject::isCompiledWithFs9Support())
|
||||
if (CBuildConfig::isCompiledWithFs9Support())
|
||||
{
|
||||
FsRegistryPathPair fs9RegistryPathPairs =
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "fsxsimulatorsetup.h"
|
||||
|
||||
#include "blackmisc/project.h"
|
||||
#include "buildconfig.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include "blackmisc/simulation/fsx/simconnectutilities.h"
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
CSimulatorSetup s;
|
||||
s.setValue(KeyLocalSimConnectCfgFilename(), CSimConnectUtilities::getLocalSimConnectCfgFilename());
|
||||
|
||||
if (CProject::isCompiledWithFsxSupport())
|
||||
if (CBuildConfig::isCompiledWithFsxSupport())
|
||||
{
|
||||
// set FSX path
|
||||
QString fsxPath = CFsCommonUtil::fsxDirFromRegistry();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "simulatorinfo.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "buildconfig.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include <algorithm>
|
||||
@@ -170,15 +170,15 @@ namespace BlackMisc
|
||||
//! \todo add XP, ...
|
||||
CSimulatorInfo sim;
|
||||
bool fs9 =
|
||||
CProject::isRunningOnWindowsNtPlatform() &&
|
||||
CBuildConfig::isRunningOnWindowsNtPlatform() &&
|
||||
!CFsCommonUtil::fs9AircraftDir().isEmpty() &&
|
||||
!CFsCommonUtil::fs9Dir().isEmpty();
|
||||
bool fsx =
|
||||
CProject::isRunningOnWindowsNtPlatform() &&
|
||||
CBuildConfig::isRunningOnWindowsNtPlatform() &&
|
||||
!CFsCommonUtil::fsxSimObjectsDir().isEmpty() &&
|
||||
!CFsCommonUtil::fsxDir().isEmpty();
|
||||
bool p3d =
|
||||
CProject::isRunningOnWindowsNtPlatform() &&
|
||||
CBuildConfig::isRunningOnWindowsNtPlatform() &&
|
||||
!CFsCommonUtil::p3dDir().isEmpty() &&
|
||||
!CFsCommonUtil::p3dSimObjectsDir().isEmpty();
|
||||
bool xp = true; //! \todo XP resolution
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#include "blackcore/interpolatorlinear.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/propertyindexallclasses.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include <QTimer>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "blackmisc/simulation/fsx/fsxsimulatorsetup.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/threadutils.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "simulatorfsxfactory.h"
|
||||
#include "simulatorfsx.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include <QTimer>
|
||||
|
||||
namespace BlackSimPlugin
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "ui_swiftcore.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/dbusserver.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/worker.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/filelogger.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/metadatautils.h"
|
||||
#include <QPoint>
|
||||
#include <QMenu>
|
||||
@@ -58,7 +58,7 @@ void CSwiftData::initDynamicMenus()
|
||||
Q_ASSERT_X(this->ui->comp_MainInfoArea, Q_FUNC_INFO, "missing main area");
|
||||
this->ui->menu_InfoAreas->addActions(this->ui->comp_MainInfoArea->getInfoAreaSelectActions(this->ui->menu_InfoAreas));
|
||||
|
||||
QString resourceDir(CProject::getSwiftResourceDir());
|
||||
QString resourceDir(CBuildConfig::getSwiftResourceDir());
|
||||
if (!resourceDir.isEmpty() && QDir(resourceDir).exists())
|
||||
{
|
||||
Q_ASSERT_X(this->ui->comp_MainInfoArea, Q_FUNC_INFO, "Missing main info area");
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "blackmisc/dbusserver.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/aviation/selcal.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include <QSizeGrip>
|
||||
#include <QHBoxLayout>
|
||||
@@ -112,7 +112,7 @@ void SwiftGuiStd::init()
|
||||
|
||||
// info
|
||||
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(sGui->swiftVersionString());
|
||||
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CProject::compiledWithInfo());
|
||||
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CBuildConfig::compiledWithInfo());
|
||||
|
||||
// update timers
|
||||
this->startUpdateTimersWhenConnected();
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "blackcore/registermetadata.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/project.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QProcess>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "blackmisc/dbusserver.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/buildconfig.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include <QPixmap>
|
||||
@@ -196,7 +196,7 @@ void CSwiftLauncher::startSwiftCore()
|
||||
|
||||
// I set this for debug purpose only
|
||||
this->m_executableArgs = args;
|
||||
this->m_executable = CProject::swiftCoreExecutableName();
|
||||
this->m_executable = CBuildConfig::swiftCoreExecutableName();
|
||||
CLogMessage(this).info(this->getCmdLine());
|
||||
|
||||
// start
|
||||
@@ -205,7 +205,7 @@ void CSwiftLauncher::startSwiftCore()
|
||||
|
||||
void CSwiftLauncher::setSwiftDataExecutable()
|
||||
{
|
||||
m_executable = CProject::swiftDataExecutableName();
|
||||
m_executable = CBuildConfig::swiftDataExecutableName();
|
||||
m_executableArgs.clear();
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ bool CSwiftLauncher::setSwiftGuiExecutable()
|
||||
QString msg;
|
||||
if (this->isStandaloneGuiSelected() || this->canConnectDBusServer(msg))
|
||||
{
|
||||
m_executable = CProject::swiftGuiExecutableName();
|
||||
m_executable = CBuildConfig::swiftGuiExecutableName();
|
||||
QStringList args
|
||||
{
|
||||
"--core", CoreModes::coreModeToString(getCoreMode()),
|
||||
@@ -233,7 +233,7 @@ bool CSwiftLauncher::setSwiftGuiExecutable()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_executable = CProject::swiftGuiExecutableName();
|
||||
m_executable = CBuildConfig::swiftGuiExecutableName();
|
||||
m_executableArgs.clear();
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::validation() }));
|
||||
CStatusMessage m(cats, CStatusMessage::SeverityError,
|
||||
@@ -303,7 +303,7 @@ void CSwiftLauncher::ps_loadedUpdateInfo(bool success)
|
||||
const CUpdateInfo updateInfo(this->m_updateInfo.get());
|
||||
const QString latestVersion(updateInfo.getLatestVersion()) ; // need to get this from somewhere
|
||||
CFailoverUrlList downloadUrls(updateInfo.getDownloadUrls());
|
||||
bool newVersionAvailable = CProject::isNewerVersion(latestVersion) && !downloadUrls.isEmpty();
|
||||
bool newVersionAvailable = CVersion::isNewerVersion(latestVersion) && !downloadUrls.isEmpty();
|
||||
this->ui->wi_NewVersionAvailable->setVisible(newVersionAvailable);
|
||||
this->ui->wi_NoNewVersion->setVisible(!newVersionAvailable);
|
||||
this->ui->le_LatestVersion->setText(latestVersion);
|
||||
|
||||
Reference in New Issue
Block a user