mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #777 Moved enum CApplication::SwiftApplication to CApplicationInfo::Application.
This commit is contained in:
committed by
Klaus Basan
parent
d1c2c96c31
commit
cf9b6f039c
@@ -76,7 +76,7 @@ BlackCore::CApplication *sApp = nullptr; // set by constructor
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
CApplication::CApplication(const QString &applicationName, SwiftApplication application, bool init) :
|
||||
CApplication::CApplication(const QString &applicationName, CApplicationInfo::Application application, bool init) :
|
||||
m_cookieManager( {}, this), m_applicationName(applicationName), m_application(application), m_coreFacadeConfig(CCoreFacadeConfig::allEmpty())
|
||||
{
|
||||
Q_ASSERT_X(!sApp, Q_FUNC_INFO, "already initialized");
|
||||
@@ -155,19 +155,19 @@ namespace BlackCore
|
||||
return s;
|
||||
}
|
||||
|
||||
CApplication::SwiftApplication CApplication::getSwiftApplication() const
|
||||
CApplicationInfo::Application CApplication::getSwiftApplication() const
|
||||
{
|
||||
if (this->isUnitTest()) { return UnitTest; }
|
||||
if (this->m_application != Unknown) { return this->m_application; }
|
||||
if (this->isUnitTest()) { return CApplicationInfo::UnitTest; }
|
||||
if (this->m_application != CApplicationInfo::Unknown) { return this->m_application; }
|
||||
|
||||
// if not set, guess
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "Missing application");
|
||||
const QString a(QCoreApplication::instance()->applicationName().toLower());
|
||||
if (a.contains("core")) { return PilotClientCore; }
|
||||
if (a.contains("launcher")) { return Laucher; }
|
||||
if (a.contains("gui")) { return PilotClientGui; }
|
||||
if (a.contains("core")) { return PilotClientCore; }
|
||||
return Unknown;
|
||||
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
||||
if (a.contains("launcher")) { return CApplicationInfo::Laucher; }
|
||||
if (a.contains("gui")) { return CApplicationInfo::PilotClientGui; }
|
||||
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
||||
return CApplicationInfo::Unknown;
|
||||
}
|
||||
|
||||
bool CApplication::isUnitTest() const
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "blackcore/db/databasereaderconfig.h"
|
||||
#include "blackcore/application/applicationsettings.h"
|
||||
#include "blackcore/webreaderflags.h"
|
||||
#include "blackmisc/applicationinfolist.h"
|
||||
#include "blackmisc/network/url.h"
|
||||
#include "blackmisc/network/urllist.h"
|
||||
#include "blackmisc/slot.h"
|
||||
@@ -95,17 +96,6 @@ namespace BlackCore
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Shich swift application is running?
|
||||
enum SwiftApplication
|
||||
{
|
||||
Unknown,
|
||||
Laucher,
|
||||
PilotClientCore,
|
||||
PilotClientGui,
|
||||
MappingTool,
|
||||
UnitTest
|
||||
};
|
||||
|
||||
//! Similar to \sa QCoreApplication::instance() returns the single instance
|
||||
static CApplication *instance();
|
||||
|
||||
@@ -113,7 +103,7 @@ namespace BlackCore
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
CApplication(const QString &applicationName = executable(), SwiftApplication application = Unknown, bool init = true);
|
||||
CApplication(const QString &applicationName = executable(), BlackMisc::CApplicationInfo::Application application = BlackMisc::CApplicationInfo::Unknown, bool init = true);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CApplication();
|
||||
@@ -125,7 +115,7 @@ namespace BlackCore
|
||||
const QString &getApplicationNameVersionBetaDev() const;
|
||||
|
||||
//! swift application running
|
||||
SwiftApplication getSwiftApplication() const;
|
||||
BlackMisc::CApplicationInfo::Application getSwiftApplication() const;
|
||||
|
||||
//! Unit test?
|
||||
bool isUnitTest() const;
|
||||
@@ -442,7 +432,7 @@ namespace BlackCore
|
||||
QNetworkAccessManager m_accessManager { this }; //!< single network access manager
|
||||
CCookieManager m_cookieManager; //!< single cookie manager for our access manager
|
||||
QString m_applicationName; //!< application name
|
||||
SwiftApplication m_application = Unknown; //!< Application if specified
|
||||
BlackMisc::CApplicationInfo::Application m_application = BlackMisc::CApplicationInfo::Unknown; //!< Application if specified
|
||||
QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe
|
||||
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
||||
return l;
|
||||
}
|
||||
|
||||
CGuiApplication::CGuiApplication(const QString &applicationName, SwiftApplication application, const QPixmap &icon) :
|
||||
CGuiApplication::CGuiApplication(const QString &applicationName, CApplicationInfo::Application application, const QPixmap &icon) :
|
||||
CApplication(applicationName, application, false)
|
||||
{
|
||||
if (!sGui)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackGui
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
CGuiApplication(const QString &applicationName = executable(), SwiftApplication application = Unknown, const QPixmap &icon = BlackMisc::CIcons::swift64());
|
||||
CGuiApplication(const QString &applicationName = executable(), BlackMisc::CApplicationInfo::Application application = BlackMisc::CApplicationInfo::Unknown, const QPixmap &icon = BlackMisc::CIcons::swift64());
|
||||
|
||||
//! Destructor
|
||||
virtual ~CGuiApplication();
|
||||
|
||||
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
|
||||
//! [SwiftApplicationDemo]
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv);
|
||||
CGuiApplication a("swift core", CGuiApplication::PilotClientCore, CIcons::swiftCore24());
|
||||
CGuiApplication a("swift core", CApplicationInfo::PilotClientCore, CIcons::swiftCore24());
|
||||
a.addWindowStateOption();
|
||||
a.addDBusAddressOption();
|
||||
a.addVatlibOptions();
|
||||
|
||||
@@ -26,7 +26,7 @@ int main(int argc, char *argv[])
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv);
|
||||
Q_UNUSED(qa);
|
||||
CGuiApplication a("swift mapping tool", CGuiApplication::MappingTool, CIcons::swiftDatabase48());
|
||||
CGuiApplication a("swift mapping tool", CApplicationInfo::MappingTool, CIcons::swiftDatabase48());
|
||||
a.setSignalStartupAutomatically(false); // application will signal startup on its own
|
||||
a.splashScreen(CIcons::swiftDatabase256());
|
||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forMappingTool());
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace BlackMisc;
|
||||
using namespace BlackCore;
|
||||
|
||||
CSwiftGuiStdApplication::CSwiftGuiStdApplication() :
|
||||
CGuiApplication("swift pilot client GUI", CGuiApplication::PilotClientGui, CIcons::swift1024())
|
||||
CGuiApplication("swift pilot client GUI", CApplicationInfo::PilotClientGui, CIcons::swift1024())
|
||||
{
|
||||
this->addParserOption(this->m_cmdFacadeMode);
|
||||
this->addWindowModeOption();
|
||||
|
||||
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
||||
//! [SwiftApplicationDemo]
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv);
|
||||
CGuiApplication a("swift launcher", CGuiApplication::Laucher, CIcons::swiftLauncher1024());
|
||||
CGuiApplication a("swift launcher", CApplicationInfo::Laucher, CIcons::swiftLauncher1024());
|
||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
|
||||
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup."), "installer"});
|
||||
a.parse();
|
||||
|
||||
Reference in New Issue
Block a user