mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +08:00
refactor: Fix some clang-tidy warnings
This commit is contained in:
@@ -261,7 +261,7 @@ namespace swift::core
|
|||||||
switch (application)
|
switch (application)
|
||||||
{
|
{
|
||||||
case CApplicationInfo::PilotClientCore: searchFor = "core"; break;
|
case CApplicationInfo::PilotClientCore: searchFor = "core"; break;
|
||||||
case CApplicationInfo::Laucher: searchFor = "launcher"; break;
|
case CApplicationInfo::Launcher: searchFor = "launcher"; break;
|
||||||
case CApplicationInfo::MappingTool: searchFor = "data"; break;
|
case CApplicationInfo::MappingTool: searchFor = "data"; break;
|
||||||
case CApplicationInfo::PilotClientGui: searchFor = "gui"; break;
|
case CApplicationInfo::PilotClientGui: searchFor = "gui"; break;
|
||||||
default: break;
|
default: break;
|
||||||
@@ -278,8 +278,8 @@ namespace swift::core
|
|||||||
|
|
||||||
bool CApplication::startLauncher()
|
bool CApplication::startLauncher()
|
||||||
{
|
{
|
||||||
static const QString launcher = CApplication::getExecutableForApplication(CApplicationInfo::Application::Laucher);
|
static const QString launcher = CApplication::getExecutableForApplication(CApplicationInfo::Application::Launcher);
|
||||||
if (launcher.isEmpty() || CApplication::isApplicationRunning(CApplicationInfo::Laucher)) { return false; }
|
if (launcher.isEmpty() || CApplication::isApplicationRunning(CApplicationInfo::Launcher)) { return false; }
|
||||||
|
|
||||||
// const QStringList args = this->argumentsJoined({}, { "--dbus", "--core", "--coreaudio" });
|
// const QStringList args = this->argumentsJoined({}, { "--dbus", "--core", "--coreaudio" });
|
||||||
const QStringList args = this->argumentsJoined({}, { "--dbus", "--core" });
|
const QStringList args = this->argumentsJoined({}, { "--dbus", "--core" });
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ namespace swift::gui
|
|||||||
addMenuForStyleSheets(menu);
|
addMenuForStyleSheets(menu);
|
||||||
QAction *a = nullptr;
|
QAction *a = nullptr;
|
||||||
bool c = false;
|
bool c = false;
|
||||||
if (this->getApplicationInfo().getApplication() != CApplicationInfo::Laucher)
|
if (this->getApplicationInfo().getApplication() != CApplicationInfo::Launcher)
|
||||||
{
|
{
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
a = menu.addAction(CIcons::swiftLauncher24(), "Start swift launcher");
|
a = menu.addAction(CIcons::swiftLauncher24(), "Start swift launcher");
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ SWIFT_DEFINE_VALUEOBJECT_MIXINS(swift::misc, CApplicationInfo)
|
|||||||
|
|
||||||
namespace swift::misc
|
namespace swift::misc
|
||||||
{
|
{
|
||||||
CApplicationInfo::CApplicationInfo() {}
|
|
||||||
|
|
||||||
CApplicationInfo::CApplicationInfo(Application app) : m_app(app),
|
CApplicationInfo::CApplicationInfo(Application app) : m_app(app),
|
||||||
m_wordSize(CBuildConfig::buildWordSize()),
|
m_wordSize(CBuildConfig::buildWordSize()),
|
||||||
m_exePath(QCoreApplication::applicationDirPath()),
|
m_exePath(QCoreApplication::applicationDirPath()),
|
||||||
@@ -43,7 +41,7 @@ namespace swift::misc
|
|||||||
|
|
||||||
switch (getApplication())
|
switch (getApplication())
|
||||||
{
|
{
|
||||||
case Laucher: return launcher;
|
case Launcher: return launcher;
|
||||||
case PilotClientCore: return core;
|
case PilotClientCore: return core;
|
||||||
case PilotClientGui: return gui;
|
case PilotClientGui: return gui;
|
||||||
case MappingTool: return mapping;
|
case MappingTool: return mapping;
|
||||||
@@ -94,7 +92,7 @@ namespace swift::misc
|
|||||||
{
|
{
|
||||||
switch (getApplication())
|
switch (getApplication())
|
||||||
{
|
{
|
||||||
case Laucher: return CIcons::SwiftLauncher16;
|
case Launcher: return CIcons::SwiftLauncher16;
|
||||||
case PilotClientCore: return CIcons::SwiftCore16;
|
case PilotClientCore: return CIcons::SwiftCore16;
|
||||||
case PilotClientGui: return CIcons::Swift16;
|
case PilotClientGui: return CIcons::Swift16;
|
||||||
case MappingTool: return CIcons::SwiftDatabase16;
|
case MappingTool: return CIcons::SwiftDatabase16;
|
||||||
@@ -218,7 +216,7 @@ namespace swift::misc
|
|||||||
if (a.contains("test")) { return CApplicationInfo::UnitTest; } // names like testcore
|
if (a.contains("test")) { return CApplicationInfo::UnitTest; } // names like testcore
|
||||||
if (a.contains("sample")) { return CApplicationInfo::Sample; }
|
if (a.contains("sample")) { return CApplicationInfo::Sample; }
|
||||||
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
||||||
if (a.contains("launcher")) { return CApplicationInfo::Laucher; }
|
if (a.contains("launcher")) { return CApplicationInfo::Launcher; }
|
||||||
if (a.contains("gui")) { return CApplicationInfo::PilotClientGui; }
|
if (a.contains("gui")) { return CApplicationInfo::PilotClientGui; }
|
||||||
if (a.contains("data") || a.contains("mapping")) { return CApplicationInfo::MappingTool; }
|
if (a.contains("data") || a.contains("mapping")) { return CApplicationInfo::MappingTool; }
|
||||||
return CApplicationInfo::Unknown;
|
return CApplicationInfo::Unknown;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace swift::misc
|
|||||||
enum Application
|
enum Application
|
||||||
{
|
{
|
||||||
Unknown,
|
Unknown,
|
||||||
Laucher,
|
Launcher,
|
||||||
PilotClientCore,
|
PilotClientCore,
|
||||||
PilotClientGui,
|
PilotClientGui,
|
||||||
MappingTool,
|
MappingTool,
|
||||||
@@ -52,7 +52,7 @@ namespace swift::misc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CApplicationInfo();
|
CApplicationInfo() = default;
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CApplicationInfo(Application app);
|
CApplicationInfo(Application app);
|
||||||
@@ -154,7 +154,7 @@ namespace swift::misc
|
|||||||
//! Name of swift core
|
//! Name of swift core
|
||||||
static const QString &swiftCore();
|
static const QString &swiftCore();
|
||||||
|
|
||||||
//! Info automatically initalized
|
//! Info automatically initialized
|
||||||
static const CApplicationInfo &autoInfo();
|
static const CApplicationInfo &autoInfo();
|
||||||
|
|
||||||
//! File name of the application info file
|
//! File name of the application info file
|
||||||
@@ -165,7 +165,7 @@ namespace swift::misc
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int m_app = static_cast<int>(Unknown);
|
int m_app = static_cast<int>(Unknown);
|
||||||
int m_wordSize;
|
int m_wordSize {};
|
||||||
QString m_exePath;
|
QString m_exePath;
|
||||||
QString m_applicationDataDir;
|
QString m_applicationDataDir;
|
||||||
QString m_version;
|
QString m_version;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "misc/comparefunctions.h"
|
#include "misc/comparefunctions.h"
|
||||||
#include "misc/verify.h"
|
#include "misc/verify.h"
|
||||||
|
|
||||||
#include <QStringBuilder>
|
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QAudioDevice>
|
#include <QAudioDevice>
|
||||||
@@ -49,19 +48,18 @@ namespace swift::misc::audio
|
|||||||
|
|
||||||
CAudioDeviceInfo CAudioDeviceInfo::getDefaultOutputDevice()
|
CAudioDeviceInfo CAudioDeviceInfo::getDefaultOutputDevice()
|
||||||
{
|
{
|
||||||
return CAudioDeviceInfo(OutputDevice, QMediaDevices::defaultAudioOutput().description());
|
return { OutputDevice, QMediaDevices::defaultAudioOutput().description() };
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioDeviceInfo CAudioDeviceInfo::getDefaultInputDevice()
|
CAudioDeviceInfo CAudioDeviceInfo::getDefaultInputDevice()
|
||||||
{
|
{
|
||||||
return CAudioDeviceInfo(InputDevice, QMediaDevices::defaultAudioInput().description());
|
return { InputDevice, QMediaDevices::defaultAudioInput().description() };
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CAudioDeviceInfo::propertyByIndex(CPropertyIndexRef index) const
|
QVariant CAudioDeviceInfo::propertyByIndex(CPropertyIndexRef index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
switch (index.frontCasted<ColumnIndex>())
|
||||||
switch (i)
|
|
||||||
{
|
{
|
||||||
case IndexDeviceType: return QVariant::fromValue(this->getType());
|
case IndexDeviceType: return QVariant::fromValue(this->getType());
|
||||||
case IndexDeviceTypeAsString: return QVariant::fromValue(this->getTypeAsString());
|
case IndexDeviceTypeAsString: return QVariant::fromValue(this->getTypeAsString());
|
||||||
@@ -79,8 +77,7 @@ namespace swift::misc::audio
|
|||||||
(*this) = variant.value<CAudioDeviceInfo>();
|
(*this) = variant.value<CAudioDeviceInfo>();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
switch (index.frontCasted<ColumnIndex>())
|
||||||
switch (i)
|
|
||||||
{
|
{
|
||||||
case IndexDeviceType: m_type = static_cast<DeviceType>(variant.toInt()); return;
|
case IndexDeviceType: m_type = static_cast<DeviceType>(variant.toInt()); return;
|
||||||
case IndexName: m_deviceName = variant.toString(); return;
|
case IndexName: m_deviceName = variant.toString(); return;
|
||||||
@@ -93,8 +90,7 @@ namespace swift::misc::audio
|
|||||||
int CAudioDeviceInfo::comparePropertyByIndex(CPropertyIndexRef index, const CAudioDeviceInfo &compareValue) const
|
int CAudioDeviceInfo::comparePropertyByIndex(CPropertyIndexRef index, const CAudioDeviceInfo &compareValue) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive); }
|
if (index.isMyself()) { return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive); }
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
switch (index.frontCasted<ColumnIndex>())
|
||||||
switch (i)
|
|
||||||
{
|
{
|
||||||
case IndexDeviceTypeAsString:
|
case IndexDeviceTypeAsString:
|
||||||
case IndexDeviceType: return Compare::compare(m_type, compareValue.m_type);
|
case IndexDeviceType: return Compare::compare(m_type, compareValue.m_type);
|
||||||
|
|||||||
@@ -119,4 +119,4 @@ namespace swift::misc::audio
|
|||||||
Q_DECLARE_METATYPE(swift::misc::audio::CAudioDeviceInfo)
|
Q_DECLARE_METATYPE(swift::misc::audio::CAudioDeviceInfo)
|
||||||
Q_DECLARE_METATYPE(swift::misc::audio::CAudioDeviceInfo::DeviceType)
|
Q_DECLARE_METATYPE(swift::misc::audio::CAudioDeviceInfo::DeviceType)
|
||||||
|
|
||||||
#endif // guard
|
#endif // SWIFT_MISC_AUDIO_AUDIODEVICE_H
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ SWIFT_DEFINE_SEQUENCE_MIXINS(swift::misc::audio, CAudioDeviceInfo, CAudioDeviceI
|
|||||||
|
|
||||||
namespace swift::misc::audio
|
namespace swift::misc::audio
|
||||||
{
|
{
|
||||||
CAudioDeviceInfoList::CAudioDeviceInfoList() {}
|
|
||||||
|
|
||||||
CAudioDeviceInfoList::CAudioDeviceInfoList(const CSequence &other) : CSequence(other)
|
CAudioDeviceInfoList::CAudioDeviceInfoList(const CSequence &other) : CSequence(other)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace swift::misc::audio
|
|||||||
using CSequence::CSequence;
|
using CSequence::CSequence;
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CAudioDeviceInfoList();
|
CAudioDeviceInfoList() = default;
|
||||||
|
|
||||||
//! Construct from a base class object.
|
//! Construct from a base class object.
|
||||||
CAudioDeviceInfoList(const CSequence &other);
|
CAudioDeviceInfoList(const CSequence &other);
|
||||||
@@ -101,4 +101,4 @@ namespace swift::misc::audio
|
|||||||
Q_DECLARE_METATYPE(swift::misc::audio::CAudioDeviceInfoList)
|
Q_DECLARE_METATYPE(swift::misc::audio::CAudioDeviceInfoList)
|
||||||
Q_DECLARE_METATYPE(swift::misc::CCollection<swift::misc::audio::CAudioDeviceInfo>)
|
Q_DECLARE_METATYPE(swift::misc::CCollection<swift::misc::audio::CAudioDeviceInfo>)
|
||||||
|
|
||||||
#endif // guard
|
#endif // SWIFT_MISC_AUDIO_AUDIODEVICELIST_H
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "misc/swiftdirectories.h"
|
#include "misc/swiftdirectories.h"
|
||||||
#include "misc/fileutils.h"
|
#include "misc/fileutils.h"
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QStringBuilder>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
using namespace swift::misc::audio;
|
using namespace swift::misc::audio;
|
||||||
@@ -76,9 +75,7 @@ namespace swift::misc::audio
|
|||||||
|
|
||||||
void CSettings::setNotificationVolume(int volume)
|
void CSettings::setNotificationVolume(int volume)
|
||||||
{
|
{
|
||||||
m_notificationVolume = volume;
|
m_notificationVolume = std::clamp(volume, 0, 100);
|
||||||
if (m_notificationVolume < 0) { m_notificationVolume = 0; }
|
|
||||||
else if (m_notificationVolume > 100) { m_notificationVolume = 100; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettings::setOutVolume(int volume)
|
void CSettings::setOutVolume(int volume)
|
||||||
|
|||||||
@@ -65,9 +65,6 @@ namespace swift::misc::audio
|
|||||||
bool afvBlocked() const { return this->isNotificationFlagSet(CNotificationSounds::AFVBlocked); }
|
bool afvBlocked() const { return this->isNotificationFlagSet(CNotificationSounds::AFVBlocked); }
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Settings value
|
|
||||||
CStatusMessage value(const QString &path, const QString &command, const CVariant &value, bool &changedFlag);
|
|
||||||
|
|
||||||
//! Directory
|
//! Directory
|
||||||
void setNotificationSoundDirectory(const QString &dir);
|
void setNotificationSoundDirectory(const QString &dir);
|
||||||
|
|
||||||
@@ -167,4 +164,4 @@ namespace swift::misc::audio
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(swift::misc::audio::CSettings)
|
Q_DECLARE_METATYPE(swift::misc::audio::CSettings)
|
||||||
|
|
||||||
#endif // guard
|
#endif // SWIFT_MISC_AUDIO_SETTINGS_H
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace swift::misc::audio
|
|||||||
SWIFT_MISC_EXPORT bool startWindowsMixer();
|
SWIFT_MISC_EXPORT bool startWindowsMixer();
|
||||||
|
|
||||||
//! On windows init the audio devices
|
//! On windows init the audio devices
|
||||||
//! \remarks workaround for WSAPI driver crashes, hoping that upfront init already sets global vars. etc.
|
//! \remarks workaround for WASAPI driver crashes, hoping that upfront init already sets global vars. etc.
|
||||||
SWIFT_MISC_EXPORT void initWindowsAudioDevices();
|
SWIFT_MISC_EXPORT void initWindowsAudioDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,4 +75,4 @@ namespace swift::misc::audio
|
|||||||
Q_DECLARE_METATYPE(swift::misc::audio::CNotificationSounds::Notification)
|
Q_DECLARE_METATYPE(swift::misc::audio::CNotificationSounds::Notification)
|
||||||
Q_DECLARE_METATYPE(swift::misc::audio::CNotificationSounds::NotificationFlag)
|
Q_DECLARE_METATYPE(swift::misc::audio::CNotificationSounds::NotificationFlag)
|
||||||
|
|
||||||
#endif // guard
|
#endif // SWIFT_MISC_NOTIFICATIONSOUNDS_H
|
||||||
|
|||||||
@@ -10,21 +10,19 @@
|
|||||||
|
|
||||||
#include <QDBusMetaType>
|
#include <QDBusMetaType>
|
||||||
|
|
||||||
namespace swift::misc
|
namespace swift::misc::audio
|
||||||
{
|
{
|
||||||
namespace audio
|
//! Register metadata for audio / voice
|
||||||
|
void registerMetadata()
|
||||||
{
|
{
|
||||||
//! Register metadata for audio / voice
|
CAudioDeviceInfo::registerMetadata();
|
||||||
void registerMetadata()
|
CAudioDeviceInfoList::registerMetadata();
|
||||||
{
|
CSettings::registerMetadata();
|
||||||
CAudioDeviceInfo::registerMetadata();
|
|
||||||
CAudioDeviceInfoList::registerMetadata();
|
|
||||||
CSettings::registerMetadata();
|
|
||||||
|
|
||||||
// ENUMs
|
// ENUMs
|
||||||
qDBusRegisterMetaType<CNotificationSounds::NotificationFlag>();
|
qDBusRegisterMetaType<CNotificationSounds::NotificationFlag>();
|
||||||
qDBusRegisterMetaType<CAudioDeviceInfo::DeviceType>();
|
qDBusRegisterMetaType<CAudioDeviceInfo::DeviceType>();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // ns
|
// ns
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ namespace swift::misc::audio
|
|||||||
SWIFT_MISC_EXPORT void registerMetadata();
|
SWIFT_MISC_EXPORT void registerMetadata();
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
#endif // guard
|
#endif // SWIFT_MISC_AUDIO_REGISTERMETADATAAUDIO_H
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace swift::misc
|
|||||||
typename QMap<T, T>::iterator insert(const T &value) { return QMap<T, T>::insert(value, value); }
|
typename QMap<T, T>::iterator insert(const T &value) { return QMap<T, T>::insert(value, value); }
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
QOrderedSet() {}
|
QOrderedSet() = default;
|
||||||
|
|
||||||
//! Initializer list constructor.
|
//! Initializer list constructor.
|
||||||
QOrderedSet(std::initializer_list<T> il)
|
QOrderedSet(std::initializer_list<T> il)
|
||||||
@@ -104,37 +104,37 @@ namespace swift::misc
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef T key_type;
|
using key_type = T;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef T value_type;
|
using value_type = T;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef T &reference;
|
using reference = T &;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef const T &const_reference;
|
using const_reference = const T &;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef T *pointer;
|
using pointer = T *;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef const T *const_pointer;
|
using const_pointer = const T *;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef typename QOrderedSet<T>::const_iterator const_iterator;
|
using const_iterator = typename QOrderedSet<T>::const_iterator;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef const_iterator iterator; // can't modify elements in-place
|
using iterator = const_iterator; // can't modify elements in-place
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef ptrdiff_t difference_type;
|
using difference_type = ptrdiff_t;
|
||||||
|
|
||||||
//! STL compatibility
|
//! STL compatibility
|
||||||
typedef int size_type;
|
using size_type = int;
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CCollection() {}
|
CCollection() = default;
|
||||||
|
|
||||||
//! Initializer list constructor.
|
//! Initializer list constructor.
|
||||||
CCollection(std::initializer_list<T> il) : m_impl(il) {}
|
CCollection(std::initializer_list<T> il) : m_impl(il) {}
|
||||||
|
|||||||
@@ -44,4 +44,4 @@ namespace swift::misc::Compare
|
|||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
#endif
|
#endif // SWIFT_MISC_COMPAREFUNCTIONS_H
|
||||||
|
|||||||
@@ -41,4 +41,4 @@ namespace swift::misc
|
|||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
#endif // guard
|
#endif // SWIFT_MISC_COMPRESSUTILS_H
|
||||||
|
|||||||
@@ -5,14 +5,10 @@
|
|||||||
#include "misc/fileutils.h"
|
#include "misc/fileutils.h"
|
||||||
#include "misc/worker.h"
|
#include "misc/worker.h"
|
||||||
|
|
||||||
#include <QStringBuilder>
|
|
||||||
|
|
||||||
SWIFT_DEFINE_VALUEOBJECT_MIXINS(swift::misc, CCrashInfo)
|
SWIFT_DEFINE_VALUEOBJECT_MIXINS(swift::misc, CCrashInfo)
|
||||||
|
|
||||||
namespace swift::misc
|
namespace swift::misc
|
||||||
{
|
{
|
||||||
CCrashInfo::CCrashInfo() {}
|
|
||||||
|
|
||||||
QString CCrashInfo::convertToQString(bool i18n) const
|
QString CCrashInfo::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
@@ -38,8 +34,7 @@ namespace swift::misc
|
|||||||
QVariant CCrashInfo::propertyByIndex(CPropertyIndexRef index) const
|
QVariant CCrashInfo::propertyByIndex(CPropertyIndexRef index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
switch (index.frontCasted<ColumnIndex>())
|
||||||
switch (i)
|
|
||||||
{
|
{
|
||||||
case IndexUserName: return QVariant::fromValue(m_userName);
|
case IndexUserName: return QVariant::fromValue(m_userName);
|
||||||
case IndexInfo: return QVariant::fromValue(m_info);
|
case IndexInfo: return QVariant::fromValue(m_info);
|
||||||
@@ -57,8 +52,7 @@ namespace swift::misc
|
|||||||
(*this) = variant.value<CCrashInfo>();
|
(*this) = variant.value<CCrashInfo>();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
switch (index.frontCasted<ColumnIndex>())
|
||||||
switch (i)
|
|
||||||
{
|
{
|
||||||
case IndexUserName: this->setUserName(variant.toString()); break;
|
case IndexUserName: this->setUserName(variant.toString()); break;
|
||||||
case IndexInfo: this->setUserName(variant.toString()); break;
|
case IndexInfo: this->setUserName(variant.toString()); break;
|
||||||
@@ -71,8 +65,7 @@ namespace swift::misc
|
|||||||
int CCrashInfo::comparePropertyByIndex(CPropertyIndexRef index, const CCrashInfo &compareValue) const
|
int CCrashInfo::comparePropertyByIndex(CPropertyIndexRef index, const CCrashInfo &compareValue) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return this->getInfo().compare(compareValue.getInfo()); }
|
if (index.isMyself()) { return this->getInfo().compare(compareValue.getInfo()); }
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
switch (index.frontCasted<ColumnIndex>())
|
||||||
switch (i)
|
|
||||||
{
|
{
|
||||||
case IndexUserName: return this->getUserName().compare(compareValue.getUserName());
|
case IndexUserName: return this->getUserName().compare(compareValue.getUserName());
|
||||||
case IndexInfo: return this->getInfo().compare(compareValue.getInfo());
|
case IndexInfo: return this->getInfo().compare(compareValue.getInfo());
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace swift::misc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CCrashInfo();
|
CCrashInfo() = default;
|
||||||
|
|
||||||
//! Get user name
|
//! Get user name
|
||||||
const QString &getUserName() const { return m_userName; }
|
const QString &getUserName() const { return m_userName; }
|
||||||
@@ -104,4 +104,4 @@ namespace swift::misc
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(swift::misc::CCrashInfo)
|
Q_DECLARE_METATYPE(swift::misc::CCrashInfo)
|
||||||
|
|
||||||
#endif // guard
|
#endif // SWIFT_MISC_CRASHINFO_H
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "misc/datacache.h"
|
#include "misc/datacache.h"
|
||||||
#include "misc/atomicfile.h"
|
#include "misc/atomicfile.h"
|
||||||
#include "misc/directoryutils.h"
|
|
||||||
#include "misc/identifier.h"
|
#include "misc/identifier.h"
|
||||||
#include "misc/logmessage.h"
|
#include "misc/logmessage.h"
|
||||||
#include "misc/processinfo.h"
|
#include "misc/processinfo.h"
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "misc/identifier.h"
|
#include "misc/identifier.h"
|
||||||
#include "misc/propertyindexref.h"
|
#include "misc/propertyindexref.h"
|
||||||
#include "misc/statusmessage.h"
|
#include "misc/statusmessage.h"
|
||||||
#include "misc/logcategories.h"
|
|
||||||
#include "misc/valuecache.h"
|
#include "misc/valuecache.h"
|
||||||
#include "misc/valuecacheprivate.h"
|
#include "misc/valuecacheprivate.h"
|
||||||
#include "misc/variantmap.h"
|
#include "misc/variantmap.h"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
|
|||||||
CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv));
|
CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv));
|
||||||
QApplication qa(argc, argv); // needed
|
QApplication qa(argc, argv); // needed
|
||||||
Q_UNUSED(qa)
|
Q_UNUSED(qa)
|
||||||
CGuiApplication a(CApplicationInfo::swiftLauncher(), CApplicationInfo::Laucher, CIcons::swiftLauncher1024());
|
CGuiApplication a(CApplicationInfo::swiftLauncher(), CApplicationInfo::Launcher, CIcons::swiftLauncher1024());
|
||||||
a.addNetworkOptions(); // so it can be passed (hand over) to started applications
|
a.addNetworkOptions(); // so it can be passed (hand over) to started applications
|
||||||
a.addDBusAddressOption(); // required by the dbus server address selector
|
a.addDBusAddressOption(); // required by the dbus server address selector
|
||||||
const QCommandLineOption installerOption { { "i", "installer" }, QCoreApplication::translate("main", "Installer setup.") };
|
const QCommandLineOption installerOption { { "i", "installer" }, QCoreApplication::translate("main", "Installer setup.") };
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ void CSwiftLauncher::saveSetup()
|
|||||||
bool CSwiftLauncher::warnAboutOtherSwiftApplications()
|
bool CSwiftLauncher::warnAboutOtherSwiftApplications()
|
||||||
{
|
{
|
||||||
CApplicationInfoList running = CGuiApplication::getRunningApplications();
|
CApplicationInfoList running = CGuiApplication::getRunningApplications();
|
||||||
running.removeApplication(CApplicationInfo::Laucher);
|
running.removeApplication(CApplicationInfo::Launcher);
|
||||||
if (running.isEmpty()) { return true; }
|
if (running.isEmpty()) { return true; }
|
||||||
|
|
||||||
// getting here means another application is running
|
// getting here means another application is running
|
||||||
|
|||||||
Reference in New Issue
Block a user