From 80725e96dc1065301384e9556209b723c1f35409 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 30 Oct 2019 01:41:24 +0100 Subject: [PATCH] [AFV] Ref T731, Ref T739 model/view for audio device info --- src/blackgui/models/allmodelcontainers.h | 1 + src/blackgui/models/allmodels.h | 1 + .../models/audiodeviceinfolistmodel.cpp | 36 ++++++++++++++++++ .../models/audiodeviceinfolistmodel.h | 37 +++++++++++++++++++ src/blackgui/models/listmodelbasemisc.cpp | 2 + src/blackgui/views/audiodeviceinfoview.cpp | 24 ++++++++++++ src/blackgui/views/audiodeviceinfoview.h | 34 +++++++++++++++++ src/blackgui/views/viewbasemisc.cpp | 3 ++ 8 files changed, 138 insertions(+) create mode 100644 src/blackgui/models/audiodeviceinfolistmodel.cpp create mode 100644 src/blackgui/models/audiodeviceinfolistmodel.h create mode 100644 src/blackgui/views/audiodeviceinfoview.cpp create mode 100644 src/blackgui/views/audiodeviceinfoview.h diff --git a/src/blackgui/models/allmodelcontainers.h b/src/blackgui/models/allmodelcontainers.h index d8ec2194f..01cc65de1 100644 --- a/src/blackgui/models/allmodelcontainers.h +++ b/src/blackgui/models/allmodelcontainers.h @@ -23,6 +23,7 @@ #include "blackmisc/aviation/aircraftsituationlist.h" #include "blackmisc/aviation/aircraftsituationchangelist.h" #include "blackmisc/aviation/liverylist.h" +#include "blackmisc/audio/audiodeviceinfolist.h" #include "blackmisc/network/clientlist.h" #include "blackmisc/network/serverlist.h" #include "blackmisc/network/textmessagelist.h" diff --git a/src/blackgui/models/allmodels.h b/src/blackgui/models/allmodels.h index 0e3d4787a..638359dc9 100644 --- a/src/blackgui/models/allmodels.h +++ b/src/blackgui/models/allmodels.h @@ -20,6 +20,7 @@ #include "blackgui/models/airportlistmodel.h" #include "blackgui/models/applicationinfolistmodel.h" #include "blackgui/models/atcstationlistmodel.h" +#include "blackgui/models/audiodeviceinfolistmodel.h" #include "blackgui/models/clientlistmodel.h" #include "blackgui/models/cloudlayerlistmodel.h" #include "blackgui/models/countrylistmodel.h" diff --git a/src/blackgui/models/audiodeviceinfolistmodel.cpp b/src/blackgui/models/audiodeviceinfolistmodel.cpp new file mode 100644 index 000000000..74661fd2d --- /dev/null +++ b/src/blackgui/models/audiodeviceinfolistmodel.cpp @@ -0,0 +1,36 @@ +/* Copyright (C) 2019 + * 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. 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 "blackgui/models/audiodeviceinfolistmodel.h" +#include "blackgui/models/columnformatters.h" +#include "blackgui/models/columns.h" + +#include +#include + +using namespace BlackMisc; +using namespace BlackMisc::Audio; + +namespace BlackGui +{ + namespace Models + { + CAudioDeviceInfoListModel::CAudioDeviceInfoListModel(QObject *parent) : + CListModelBase("AudioDeviceInfoListModel", parent) + { + m_columns.addColumn(CColumn::standardString("type", CAudioDeviceInfo::IndexDeviceTypeAsString)); + m_columns.addColumn(CColumn::standardString("name", CAudioDeviceInfo::IndexName)); + m_columns.addColumn(CColumn::standardString("machine", { CAudioDeviceInfo::IndexIdentifier, CIdentifier::IndexMachineName })); + m_columns.addColumn(CColumn::standardString("process", { CAudioDeviceInfo::IndexIdentifier, CIdentifier::IndexProcessName })); + + // default sort order + this->setSortColumnByPropertyIndex(CAudioDeviceInfo::IndexName); + m_sortOrder = Qt::AscendingOrder; + } + } // ns +} // ns diff --git a/src/blackgui/models/audiodeviceinfolistmodel.h b/src/blackgui/models/audiodeviceinfolistmodel.h new file mode 100644 index 000000000..11a3e7823 --- /dev/null +++ b/src/blackgui/models/audiodeviceinfolistmodel.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2019 + * 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. 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 BLACKGUI_MODELS_AUDIODEVICEINFOLISTMODEL_H +#define BLACKGUI_MODELS_AUDIODEVICEINFOLISTMODEL_H + +#include "blackgui/blackguiexport.h" +#include "blackgui/models/listmodelbase.h" +#include "blackmisc/audio/audiodeviceinfolist.h" + +namespace BlackGui +{ + namespace Models + { + //! Audio device list model + class BLACKGUI_EXPORT CAudioDeviceInfoListModel : + public CListModelBase + { + Q_OBJECT + + public: + //! Constructor + explicit CAudioDeviceInfoListModel(QObject *parent = nullptr); + + //! Destructor + virtual ~CAudioDeviceInfoListModel() override {} + }; + } +} +#endif // guard diff --git a/src/blackgui/models/listmodelbasemisc.cpp b/src/blackgui/models/listmodelbasemisc.cpp index 316ae1cc3..8e28d7441 100644 --- a/src/blackgui/models/listmodelbasemisc.cpp +++ b/src/blackgui/models/listmodelbasemisc.cpp @@ -20,5 +20,7 @@ namespace BlackGui template class CListModelBase; template class CListModelBase; + template class CListModelBase; + } // namespace } // namespace diff --git a/src/blackgui/views/audiodeviceinfoview.cpp b/src/blackgui/views/audiodeviceinfoview.cpp new file mode 100644 index 000000000..2fb87c236 --- /dev/null +++ b/src/blackgui/views/audiodeviceinfoview.cpp @@ -0,0 +1,24 @@ +/* Copyright (C) 2019 + * 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. 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 "blackgui/models/audiodeviceinfolistmodel.h" +#include "blackgui/views/audiodeviceinfoview.h" + +using namespace BlackMisc; +using namespace BlackGui::Models; + +namespace BlackGui +{ + namespace Views + { + CAudioDeviceInfoView::CAudioDeviceInfoView(QWidget *parent) : CViewBase(parent) + { + this->standardInit(new CAudioDeviceInfoListModel(this)); + } + } +} // namespace diff --git a/src/blackgui/views/audiodeviceinfoview.h b/src/blackgui/views/audiodeviceinfoview.h new file mode 100644 index 000000000..e6b1dd309 --- /dev/null +++ b/src/blackgui/views/audiodeviceinfoview.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2019 + * 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. 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 BLACKGUI_VIEWS_AUDIODEVICEINFOVIEW_H +#define BLACKGUI_VIEWS_AUDIODEVICEINFOVIEW_H + +#include "blackgui/models/audiodeviceinfolistmodel.h" +#include "blackgui/views/viewbase.h" +#include "blackgui/blackguiexport.h" + +namespace BlackGui +{ + namespace Views + { + //! Audio device view + class BLACKGUI_EXPORT CAudioDeviceInfoView : public CViewBase + { + Q_OBJECT + + public: + //! Constructor + explicit CAudioDeviceInfoView(QWidget *parent = nullptr); + }; + } +} // ns + +#endif // guard diff --git a/src/blackgui/views/viewbasemisc.cpp b/src/blackgui/views/viewbasemisc.cpp index c44d95d49..09ecd01f7 100644 --- a/src/blackgui/views/viewbasemisc.cpp +++ b/src/blackgui/views/viewbasemisc.cpp @@ -17,5 +17,8 @@ namespace BlackGui template class CViewBase; template class CViewBase; template class CViewBase; + + template class CViewBase; + } // namespace } // namespace