diff --git a/src/blackcore/modeldatareader.cpp b/src/blackcore/modeldatareader.cpp index e63fdb8ff..3a2e8726f 100644 --- a/src/blackcore/modeldatareader.cpp +++ b/src/blackcore/modeldatareader.cpp @@ -277,7 +277,7 @@ namespace BlackCore if (!liveriesJson.isEmpty()) { CLiveryList liveries; - liveries.convertFromJson(Json::jsonObjectFromString(liveriesJson)); + liveries.convertFromJson(liveriesJson); int c = liveries.size(); { QWriteLocker l(&m_lockLivery); diff --git a/src/blackgui/components/audiovolumecomponent.cpp b/src/blackgui/components/audiovolumecomponent.cpp index cef13f1a1..4ef382aac 100644 --- a/src/blackgui/components/audiovolumecomponent.cpp +++ b/src/blackgui/components/audiovolumecomponent.cpp @@ -8,6 +8,7 @@ */ #include "blackcore/contextaudio.h" +#include "blackmisc/audio/audioutils.h" #include "audiovolumecomponent.h" #include "ui_audiovolumecomponent.h" diff --git a/src/blackgui/components/audiovolumecomponent.h b/src/blackgui/components/audiovolumecomponent.h index dd13c71e7..38143e07b 100644 --- a/src/blackgui/components/audiovolumecomponent.h +++ b/src/blackgui/components/audiovolumecomponent.h @@ -22,7 +22,6 @@ namespace BlackGui { namespace Components { - //! Audio volume, mixer class BLACKGUI_EXPORT CAudioVolumeComponent : public QFrame, @@ -62,9 +61,7 @@ namespace BlackGui private: QScopedPointer ui; - }; - } // namespace } // namespace diff --git a/src/blackgui/components/infobarstatuscomponent.cpp b/src/blackgui/components/infobarstatuscomponent.cpp index 0caea19c4..c71b83d71 100644 --- a/src/blackgui/components/infobarstatuscomponent.cpp +++ b/src/blackgui/components/infobarstatuscomponent.cpp @@ -14,6 +14,7 @@ #include "blackcore/contextapplication.h" #include "blackcore/contextaudio.h" #include "blackcore/simulator.h" +#include "blackmisc/audio/audioutils.h" #include "blackmisc/project.h" #include "blackmisc/icons.h" diff --git a/src/blackgui/models/modelfilter.h b/src/blackgui/models/modelfilter.h index 64c76acf5..67456765e 100644 --- a/src/blackgui/models/modelfilter.h +++ b/src/blackgui/models/modelfilter.h @@ -53,11 +53,11 @@ namespace BlackGui bool m_enabled = true; }; - //! Model filter interface for those who can generate such a filter (e.g. a widget dialog) + //! Model filter interface for those who can generate such a filter (e.g. a widget or dialog) template class IModelFilterProvider { public: - //! Get the filter + //! Get the filter, this is the filter itself, not its widget or dialog virtual std::unique_ptr> createModelFilter() const = 0; }; diff --git a/src/blackmisc/audio/audiodeviceinfo.cpp b/src/blackmisc/audio/audiodeviceinfo.cpp index eb6ed27f1..681058823 100644 --- a/src/blackmisc/audio/audiodeviceinfo.cpp +++ b/src/blackmisc/audio/audiodeviceinfo.cpp @@ -10,6 +10,7 @@ #include "audiodeviceinfo.h" #include "blackmisc/blackmiscfreefunctions.h" #include +#include namespace BlackMisc { @@ -18,12 +19,12 @@ namespace BlackMisc CAudioDeviceInfo::CAudioDeviceInfo() : m_type(Unknown), m_deviceIndex(invalidDeviceIndex()), - m_deviceName(""), m_hostName(BlackMisc::localHostName()) + m_deviceName(""), m_hostName(QHostInfo::localHostName()) { } CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const int index, const QString &name) : m_type(type), m_deviceIndex(index), - m_deviceName(name), m_hostName(BlackMisc::localHostName()) + m_deviceName(name), m_hostName(QHostInfo::localHostName()) { } QString CAudioDeviceInfo::convertToQString(bool i18n) const diff --git a/src/blackmisc/audio/audiodeviceinfo.h b/src/blackmisc/audio/audiodeviceinfo.h index 7bb2975c5..576f552b0 100644 --- a/src/blackmisc/audio/audiodeviceinfo.h +++ b/src/blackmisc/audio/audiodeviceinfo.h @@ -37,11 +37,9 @@ namespace BlackMisc Unknown }; - /*! - * Default constructor. - * If m_deviceIndex is -1, default should be used. However on Windows this doesnt work. Needs - * to be checked in Vatlib. - */ + //! + //! Default constructor. + //! \note If m_deviceIndex is -1, default should be used. However on Windows this doesnt work. Needs to be checked in Vatlib. CAudioDeviceInfo(); //! Constructor. @@ -85,17 +83,11 @@ namespace BlackMisc private: BLACK_ENABLE_TUPLE_CONVERSION(CAudioDeviceInfo) - //! Device type, @see CAudioDeviceInfo::DeviceType - DeviceType m_type; - /*! - * deviceIndex is the number is the reference for the VVL. The device is selected by this index. - * The managing class needs to take care, that indexes are valid. - */ - int m_deviceIndex; - //! Device name - QString m_deviceName; - //! We use a DBus based system. Hence an audio device can reside on a differen computers, this here is its name - QString m_hostName; + + DeviceType m_type; //!< Device type, @see CAudioDeviceInfo::DeviceType + int m_deviceIndex; //!< deviceIndex is the number is the reference for the VVL. The device is selected by this index. The managing class needs to take care, that indexes are valid. + QString m_deviceName; //!< Device name + QString m_hostName; //!< We use a DBus based system. Hence an audio device can reside on a differen computers, this here is its name }; } // namespace } // namespace diff --git a/src/blackmisc/audio/audioutils.cpp b/src/blackmisc/audio/audioutils.cpp new file mode 100644 index 000000000..e7173692b --- /dev/null +++ b/src/blackmisc/audio/audioutils.cpp @@ -0,0 +1,25 @@ +/* Copyright (C) 2013 + * 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. + */ + +#include "audioutils.h" +#include "blackmisc/project.h" +#include + +namespace BlackMisc +{ + namespace Audio + { + bool startWindowsMixer() + { + if (!CProject::isRunningOnWindowsNtPlatform()) { return false; } + QStringList parameterlist; + return QProcess::startDetached("SndVol.exe", parameterlist); + } + } // ns +} // ns diff --git a/src/blackmisc/audio/audioutils.h b/src/blackmisc/audio/audioutils.h new file mode 100644 index 000000000..1270c3aa6 --- /dev/null +++ b/src/blackmisc/audio/audioutils.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2015 + * 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_AUDIO_UTILS_H +#define BLACKMISC_AUDIO_UTILS_H + +#include "blackmisc/blackmiscexport.h" + +namespace BlackMisc +{ + namespace Audio + { + //! Start the Windows mixer + BLACKMISC_EXPORT bool startWindowsMixer(); + } +} + +#endif // guard diff --git a/src/blackmisc/blackmiscfreefunctions.cpp b/src/blackmisc/blackmiscfreefunctions.cpp index eea4bd41c..d8636181e 100644 --- a/src/blackmisc/blackmiscfreefunctions.cpp +++ b/src/blackmisc/blackmiscfreefunctions.cpp @@ -60,7 +60,6 @@ uint BlackMisc::calculateHash(const QList &values, const char *className) uint s = 0; foreach(int i, values) { - if (i >= 0) { list.append(static_cast(i)); @@ -74,20 +73,8 @@ uint BlackMisc::calculateHash(const QList &values, const char *className) return calculateHash(list, className); } -const QString &BlackMisc::localHostName() -{ - static const QString hostName = QHostInfo::localHostName(); - return hostName; -} - const QString &BlackMisc::localHostNameEnvVariable() { static const QString hostName = QProcessEnvironment::systemEnvironment().value("COMPUTERNAME", QProcessEnvironment::systemEnvironment().value("HOSTNAME")); return hostName; } - -bool BlackMisc::Audio::startWindowsMixer() -{ - QStringList parameterlist; - return QProcess::startDetached("SndVol.exe", parameterlist); -} diff --git a/src/blackmisc/blackmiscfreefunctions.h b/src/blackmisc/blackmiscfreefunctions.h index 311f09360..3a108411c 100644 --- a/src/blackmisc/blackmiscfreefunctions.h +++ b/src/blackmisc/blackmiscfreefunctions.h @@ -35,12 +35,6 @@ inline void initBlackMiscResources() //! Free functions in BlackMisc namespace BlackMisc { - namespace Audio - { - //! Start the Windows mixer - BLACKMISC_EXPORT bool startWindowsMixer(); - } - //! Init resources BLACKMISC_EXPORT void initResources(); @@ -157,9 +151,6 @@ namespace BlackMisc //! Hash value, but with int list BLACKMISC_EXPORT uint calculateHash(const QList &values, const char *className); - //! Get local host name - BLACKMISC_EXPORT const QString &localHostName(); - //! Get local host name env.variable BLACKMISC_EXPORT const QString &localHostNameEnvVariable();