diff --git a/src/blackgui/components/modelbrowsercomponent.cpp b/src/blackgui/components/modelbrowsercomponent.cpp new file mode 100644 index 000000000..048c52aec --- /dev/null +++ b/src/blackgui/components/modelbrowsercomponent.cpp @@ -0,0 +1,28 @@ +/* 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 "modelbrowsercomponent.h" +#include "ui_modelbrowsercomponent.h" + +namespace BlackGui +{ + namespace Components + { + CModelBrowserComponent::CModelBrowserComponent(QWidget *parent) : + QFrame(parent), + ui(new Ui::CModelBrowserComponent) + { + ui->setupUi(this); + } + + CModelBrowserComponent::~CModelBrowserComponent() + { + // void + } + } // ns +} // ns diff --git a/src/blackgui/components/modelbrowsercomponent.h b/src/blackgui/components/modelbrowsercomponent.h new file mode 100644 index 000000000..430b46853 --- /dev/null +++ b/src/blackgui/components/modelbrowsercomponent.h @@ -0,0 +1,40 @@ +/* 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_COMPONENTS_MODELBROWSERCOMPONENT_H +#define BLACKGUI_COMPONENTS_MODELBROWSERCOMPONENT_H + +#include +#include + +namespace Ui { class CModelBrowserComponent; } +namespace BlackGui +{ + namespace Components + { + //! Allow to browse thru the model set + class CModelBrowserComponent : public QFrame + { + Q_OBJECT + + public: + //! Constructor + explicit CModelBrowserComponent(QWidget *parent = nullptr); + + //! Destructor + virtual ~CModelBrowserComponent() override; + + private: + QScopedPointer ui; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/modelbrowsercomponent.ui b/src/blackgui/components/modelbrowsercomponent.ui new file mode 100644 index 000000000..3a279f55a --- /dev/null +++ b/src/blackgui/components/modelbrowsercomponent.ui @@ -0,0 +1,19 @@ + + + CModelBrowserComponent + + + + 0 + 0 + 640 + 480 + + + + Model browser + + + + + diff --git a/src/blackgui/components/modelbrowserdialog.cpp b/src/blackgui/components/modelbrowserdialog.cpp new file mode 100644 index 000000000..3ade871aa --- /dev/null +++ b/src/blackgui/components/modelbrowserdialog.cpp @@ -0,0 +1,28 @@ +/* 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 "modelbrowserdialog.h" +#include "ui_modelbrowserdialog.h" + +namespace BlackGui +{ + namespace Components + { + CModelBrowserDialog::CModelBrowserDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::CModelBrowserDialog) + { + ui->setupUi(this); + } + + CModelBrowserDialog::~CModelBrowserDialog() + { + // void; + } + } // ns +} // ns diff --git a/src/blackgui/components/modelbrowserdialog.h b/src/blackgui/components/modelbrowserdialog.h new file mode 100644 index 000000000..dfaee9b42 --- /dev/null +++ b/src/blackgui/components/modelbrowserdialog.h @@ -0,0 +1,41 @@ +/* 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_COMPONENTS_MODELBROWSERDIALOG_H +#define BLACKGUI_COMPONENTS_MODELBROWSERDIALOG_H + +#include "blackgui/blackguiexport.h" +#include +#include + +namespace Ui { class CModelBrowserDialog; } +namespace BlackGui +{ + namespace Components + { + //! Model browser as dialog + class BLACKGUI_EXPORT CModelBrowserDialog : public QDialog + { + Q_OBJECT + + public: + //! Constructor + explicit CModelBrowserDialog(QWidget *parent = nullptr); + + //! Destructor + virtual ~CModelBrowserDialog() override; + + private: + QScopedPointer ui; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/modelbrowserdialog.ui b/src/blackgui/components/modelbrowserdialog.ui new file mode 100644 index 000000000..00e62714b --- /dev/null +++ b/src/blackgui/components/modelbrowserdialog.ui @@ -0,0 +1,75 @@ + + + CModelBrowserDialog + + + + 0 + 0 + 640 + 480 + + + + Model browser + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + BlackGui::Components::CModelBrowserComponent + QFrame +
blackgui/components/modelbrowsercomponent.h
+ 1 +
+
+ + + + bb_ModelBrowserDialog + accepted() + CModelBrowserDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + bb_ModelBrowserDialog + rejected() + CModelBrowserDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index b4b0640db..abae9f5b9 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -13,6 +13,7 @@ #include "blackgui/components/dbloaddatadialog.h" #include "blackgui/components/autopublishdialog.h" #include "blackgui/components/logindialog.h" +#include "blackgui/components/modelbrowserdialog.h" #include "blackgui/components/settingscomponent.h" #include "blackgui/guiapplication.h" #include "blackgui/guiutility.h" @@ -623,3 +624,13 @@ bool SwiftGuiStd::triggerAutoPublishDialog() return true; } +bool SwiftGuiStd::startModelBrowser() +{ + if (!m_modelBrower) + { + m_modelBrower.reset(new CModelBrowserDialog(this)); + } + m_modelBrower->exec(); + return true; +} + diff --git a/src/swiftguistandard/swiftguistd.h b/src/swiftguistandard/swiftguistd.h index 87a8d3abc..aee870e93 100644 --- a/src/swiftguistandard/swiftguistd.h +++ b/src/swiftguistandard/swiftguistd.h @@ -55,6 +55,7 @@ namespace BlackGui class CDbLoadDataDialog; class CAutoPublishDialog; class CLoginDialog; + class CModelBrowserDialog; } } namespace Ui { class SwiftGuiStd; } @@ -112,10 +113,11 @@ protected: private: QScopedPointer ui; - QScopedPointer m_navigator{ new BlackGui::Components::CNavigatorDialog() }; //!< navigator dialog bar, if I pass the parent, the dialog is always centered over the parent - QScopedPointer m_dbLoadDialog; //!< load DB data, lazy init UI component - QScopedPointer m_autoPublishDialog; //!< auto publish dialog - QScopedPointer m_loginDialog; //!< login dialog + QScopedPointer m_navigator{ new BlackGui::Components::CNavigatorDialog() }; //!< navigator dialog bar, if I pass the parent, the dialog is always centered over the parent + QScopedPointer m_dbLoadDialog; //!< load DB data, lazy init UI component + QScopedPointer m_autoPublishDialog; //!< auto publish dialog + QScopedPointer m_loginDialog; //!< login dialog + QScopedPointer m_modelBrower; //!< model browser QScopedPointer m_validationDialog; //!< aircraft model validation dialog BlackMisc::CData m_lastAutoPublish { this }; BlackCore::CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::CIcons::radio16(), this, &SwiftGuiStd::onPttChanged }; @@ -210,7 +212,7 @@ private: void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); // - // GUI related slots + // GUI related functions // //! Set \sa MainPageInfoArea @@ -305,6 +307,9 @@ private: //! Show auto publish dialog if appropriate bool triggerAutoPublishDialog(); + //! Start the model browser + bool startModelBrowser(); + //! Request overlay inline text message @{ void onShowOverlayVariant(const BlackMisc::CVariant &variant, int durationMs); void onShowOverlayInlineTextMessageTab(BlackGui::Components::TextMessageTab tab); diff --git a/src/swiftguistandard/swiftguistd.ui b/src/swiftguistandard/swiftguistd.ui index c98cd8421..a8af0f8e9 100644 --- a/src/swiftguistandard/swiftguistd.ui +++ b/src/swiftguistandard/swiftguistd.ui @@ -281,6 +281,7 @@ + @@ -516,6 +517,11 @@ Toggle incognito mode + + + Model brower + + diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index 20ba756f1..8d8626a53 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -225,6 +225,7 @@ void SwiftGuiStd::initGuiSignals() connect(ui->menu_AutoPublish, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked); connect(ui->menu_MovingMap, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked); connect(ui->menu_ToggleIncognito, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked); + connect(ui->menu_ModelBrowser, &QAction::triggered, this, &SwiftGuiStd::startModelBrowser, Qt::QueuedConnection); connect(m_navigator.data(), &CNavigatorDialog::navigatorClosed, this, &SwiftGuiStd::onNavigatorClosed, Qt::QueuedConnection);