mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #777 Added classes CApplicationInfo and CApplicationInfoList.
This commit is contained in:
committed by
Klaus Basan
parent
34a68ca336
commit
d1c2c96c31
30
src/blackmisc/applicationinfo.cpp
Normal file
30
src/blackmisc/applicationinfo.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/* 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,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/applicationinfo.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
CApplicationInfo::CApplicationInfo() = default;
|
||||
|
||||
CApplicationInfo::CApplicationInfo(Application app, ApplicationMode mode, const QString &exePath, const QString &version, const CProcessInfo &process) :
|
||||
m_app(app),
|
||||
m_mode(mode),
|
||||
m_exePath(exePath),
|
||||
m_version(version),
|
||||
m_process(process)
|
||||
{}
|
||||
|
||||
QString CApplicationInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
return QString("{ %1, %2, %3, %4, %5 }").arg(QString::number(m_app), QString::number(m_mode), m_exePath, m_version, m_process.convertToQString(i18n));
|
||||
}
|
||||
}
|
||||
105
src/blackmisc/applicationinfo.h
Normal file
105
src/blackmisc/applicationinfo.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/* 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,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_APPLICATIONINFO_H
|
||||
#define BLACKMISC_APPLICATIONINFO_H
|
||||
|
||||
#include "blackmisc/processinfo.h"
|
||||
#include <QMetaType>
|
||||
#include <QFlags>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*!
|
||||
* Description of a swift application.
|
||||
*/
|
||||
class BLACKMISC_EXPORT CApplicationInfo : public CValueObject<CApplicationInfo>
|
||||
{
|
||||
public:
|
||||
//! Enumeration of application roles
|
||||
enum Application
|
||||
{
|
||||
Unknown,
|
||||
Laucher,
|
||||
PilotClientCore,
|
||||
PilotClientGui,
|
||||
MappingTool,
|
||||
UnitTest
|
||||
};
|
||||
|
||||
//! Flags describing application modes
|
||||
enum ApplicationModeFlag
|
||||
{
|
||||
Developer = 1 << 0,
|
||||
BetaTest = 1 << 1
|
||||
};
|
||||
Q_DECLARE_FLAGS(ApplicationMode, ApplicationModeFlag)
|
||||
|
||||
//! Default constructor.
|
||||
CApplicationInfo();
|
||||
|
||||
//! Constructor.
|
||||
CApplicationInfo(Application app, ApplicationMode mode, const QString &exePath, const QString &version, const CProcessInfo &process);
|
||||
|
||||
//! Set application.
|
||||
void setApplication(Application app) { m_app = static_cast<int>(app); }
|
||||
|
||||
//! Get application.
|
||||
Application application() const { return static_cast<Application>(m_app); }
|
||||
|
||||
//! Set application mode.
|
||||
void setApplicationMode(ApplicationMode mode) { m_mode = static_cast<int>(mode); }
|
||||
|
||||
//! Get application mode.
|
||||
ApplicationMode applicationMode() const { return static_cast<ApplicationMode>(m_mode); }
|
||||
|
||||
//! Set executable path.
|
||||
void setExecutablePath(const QString &exePath) { m_exePath = exePath; }
|
||||
|
||||
//! Get executable path.
|
||||
const QString &executablePath() const { return m_exePath; }
|
||||
|
||||
//! Set version string.
|
||||
void setVersionString(const QString &version) { m_version = version; }
|
||||
|
||||
//! Get version string.
|
||||
const QString &versionString() const { return m_version; }
|
||||
|
||||
//! Set process info.
|
||||
void setProcessInfo(const CProcessInfo &process) { m_process = process; }
|
||||
|
||||
//! Get process info.
|
||||
const CProcessInfo &processInfo() const { return m_process; }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
private:
|
||||
int m_app = static_cast<int>(Unknown);
|
||||
int m_mode = 0;
|
||||
QString m_exePath;
|
||||
QString m_version;
|
||||
CProcessInfo m_process;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CApplicationInfo,
|
||||
BLACK_METAMEMBER(app),
|
||||
BLACK_METAMEMBER(mode),
|
||||
BLACK_METAMEMBER(exePath),
|
||||
BLACK_METAMEMBER(version),
|
||||
BLACK_METAMEMBER(process)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::CApplicationInfo)
|
||||
|
||||
#endif
|
||||
19
src/blackmisc/applicationinfolist.cpp
Normal file
19
src/blackmisc/applicationinfolist.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
/* 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,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/applicationinfolist.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
CApplicationInfoList::CApplicationInfoList() = default;
|
||||
|
||||
CApplicationInfoList::CApplicationInfoList(const CSequence<CApplicationInfo> &other) : CSequence<CApplicationInfo>(other) {}
|
||||
}
|
||||
43
src/blackmisc/applicationinfolist.h
Normal file
43
src/blackmisc/applicationinfolist.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* 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,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_APPLICATIONINFOLIST_H
|
||||
#define BLACKMISC_APPLICATIONINFOLIST_H
|
||||
|
||||
#include "blackmisc/applicationinfo.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/collection.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*!
|
||||
* List of swift application descriptions.
|
||||
*/
|
||||
class BLACKMISC_EXPORT CApplicationInfoList :
|
||||
public CSequence<CApplicationInfo>,
|
||||
public Mixin::MetaType<CApplicationInfoList>
|
||||
{
|
||||
public:
|
||||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CApplicationInfoList)
|
||||
|
||||
//! Default constructor.
|
||||
CApplicationInfoList();
|
||||
|
||||
//! Construct from base class object.
|
||||
CApplicationInfoList(const CSequence<CApplicationInfo> &other);
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::CApplicationInfoList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::CApplicationInfo>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::CApplicationInfo>)
|
||||
|
||||
#endif
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
|
||||
#include "registermetadata.h"
|
||||
#include "blackmisc/applicationinfo.h"
|
||||
#include "blackmisc/applicationinfolist.h"
|
||||
#include "blackmisc/audio/registermetadataaudio.h"
|
||||
#include "blackmisc/aviation/registermetadataaviation.h"
|
||||
#include "blackmisc/country.h"
|
||||
@@ -60,6 +62,8 @@ namespace BlackMisc
|
||||
{
|
||||
initBlackMiscResourcesImpl();
|
||||
|
||||
CApplicationInfo::registerMetadata();
|
||||
CApplicationInfoList::registerMetadata();
|
||||
CCountry::registerMetadata();
|
||||
CCountryList::registerMetadata();
|
||||
CIcon::registerMetadata();
|
||||
|
||||
Reference in New Issue
Block a user