mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Ref T717, initial UI components for model browser
This commit is contained in:
committed by
Mat Sutcliffe
parent
c9d5a18421
commit
1409dae355
28
src/blackgui/components/modelbrowsercomponent.cpp
Normal file
28
src/blackgui/components/modelbrowsercomponent.cpp
Normal file
@@ -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
|
||||||
40
src/blackgui/components/modelbrowsercomponent.h
Normal file
40
src/blackgui/components/modelbrowsercomponent.h
Normal file
@@ -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 <QFrame>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
|
||||||
|
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::CModelBrowserComponent> ui;
|
||||||
|
};
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
19
src/blackgui/components/modelbrowsercomponent.ui
Normal file
19
src/blackgui/components/modelbrowsercomponent.ui
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CModelBrowserComponent</class>
|
||||||
|
<widget class="QFrame" name="CModelBrowserComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>640</width>
|
||||||
|
<height>480</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Model browser</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
28
src/blackgui/components/modelbrowserdialog.cpp
Normal file
28
src/blackgui/components/modelbrowserdialog.cpp
Normal file
@@ -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
|
||||||
41
src/blackgui/components/modelbrowserdialog.h
Normal file
41
src/blackgui/components/modelbrowserdialog.h
Normal file
@@ -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 <QDialog>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
|
||||||
|
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::CModelBrowserDialog> ui;
|
||||||
|
};
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
75
src/blackgui/components/modelbrowserdialog.ui
Normal file
75
src/blackgui/components/modelbrowserdialog.ui
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CModelBrowserDialog</class>
|
||||||
|
<widget class="QDialog" name="CModelBrowserDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>640</width>
|
||||||
|
<height>480</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Model browser</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Components::CModelBrowserComponent" name="comp_ModelBrowser"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="bb_ModelBrowserDialog">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CModelBrowserComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/modelbrowsercomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>bb_ModelBrowserDialog</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>CModelBrowserDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>bb_ModelBrowserDialog</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>CModelBrowserDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "blackgui/components/dbloaddatadialog.h"
|
#include "blackgui/components/dbloaddatadialog.h"
|
||||||
#include "blackgui/components/autopublishdialog.h"
|
#include "blackgui/components/autopublishdialog.h"
|
||||||
#include "blackgui/components/logindialog.h"
|
#include "blackgui/components/logindialog.h"
|
||||||
|
#include "blackgui/components/modelbrowserdialog.h"
|
||||||
#include "blackgui/components/settingscomponent.h"
|
#include "blackgui/components/settingscomponent.h"
|
||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
#include "blackgui/guiutility.h"
|
#include "blackgui/guiutility.h"
|
||||||
@@ -623,3 +624,13 @@ bool SwiftGuiStd::triggerAutoPublishDialog()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SwiftGuiStd::startModelBrowser()
|
||||||
|
{
|
||||||
|
if (!m_modelBrower)
|
||||||
|
{
|
||||||
|
m_modelBrower.reset(new CModelBrowserDialog(this));
|
||||||
|
}
|
||||||
|
m_modelBrower->exec();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ namespace BlackGui
|
|||||||
class CDbLoadDataDialog;
|
class CDbLoadDataDialog;
|
||||||
class CAutoPublishDialog;
|
class CAutoPublishDialog;
|
||||||
class CLoginDialog;
|
class CLoginDialog;
|
||||||
|
class CModelBrowserDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace Ui { class SwiftGuiStd; }
|
namespace Ui { class SwiftGuiStd; }
|
||||||
@@ -112,10 +113,11 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::SwiftGuiStd> ui;
|
QScopedPointer<Ui::SwiftGuiStd> ui;
|
||||||
QScopedPointer<BlackGui::Components::CNavigatorDialog> m_navigator{ new BlackGui::Components::CNavigatorDialog() }; //!< navigator dialog bar, if I pass the parent, the dialog is always centered over the parent
|
QScopedPointer<BlackGui::Components::CNavigatorDialog> m_navigator{ new BlackGui::Components::CNavigatorDialog() }; //!< navigator dialog bar, if I pass the parent, the dialog is always centered over the parent
|
||||||
QScopedPointer<BlackGui::Components::CDbLoadDataDialog> m_dbLoadDialog; //!< load DB data, lazy init UI component
|
QScopedPointer<BlackGui::Components::CDbLoadDataDialog> m_dbLoadDialog; //!< load DB data, lazy init UI component
|
||||||
QScopedPointer<BlackGui::Components::CAutoPublishDialog> m_autoPublishDialog; //!< auto publish dialog
|
QScopedPointer<BlackGui::Components::CAutoPublishDialog> m_autoPublishDialog; //!< auto publish dialog
|
||||||
QScopedPointer<BlackGui::Components::CLoginDialog> m_loginDialog; //!< login dialog
|
QScopedPointer<BlackGui::Components::CLoginDialog> m_loginDialog; //!< login dialog
|
||||||
|
QScopedPointer<BlackGui::Components::CModelBrowserDialog> m_modelBrower; //!< model browser
|
||||||
QScopedPointer<BlackGui::Components::CAircraftModelSetValidationDialog> m_validationDialog; //!< aircraft model validation dialog
|
QScopedPointer<BlackGui::Components::CAircraftModelSetValidationDialog> m_validationDialog; //!< aircraft model validation dialog
|
||||||
BlackMisc::CData<BlackMisc::Simulation::Data::TLastAutoPublish> m_lastAutoPublish { this };
|
BlackMisc::CData<BlackMisc::Simulation::Data::TLastAutoPublish> m_lastAutoPublish { this };
|
||||||
BlackCore::CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::CIcons::radio16(), this, &SwiftGuiStd::onPttChanged };
|
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);
|
void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||||
|
|
||||||
//
|
//
|
||||||
// GUI related slots
|
// GUI related functions
|
||||||
//
|
//
|
||||||
|
|
||||||
//! Set \sa MainPageInfoArea
|
//! Set \sa MainPageInfoArea
|
||||||
@@ -305,6 +307,9 @@ private:
|
|||||||
//! Show auto publish dialog if appropriate
|
//! Show auto publish dialog if appropriate
|
||||||
bool triggerAutoPublishDialog();
|
bool triggerAutoPublishDialog();
|
||||||
|
|
||||||
|
//! Start the model browser
|
||||||
|
bool startModelBrowser();
|
||||||
|
|
||||||
//! Request overlay inline text message @{
|
//! Request overlay inline text message @{
|
||||||
void onShowOverlayVariant(const BlackMisc::CVariant &variant, int durationMs);
|
void onShowOverlayVariant(const BlackMisc::CVariant &variant, int durationMs);
|
||||||
void onShowOverlayInlineTextMessageTab(BlackGui::Components::TextMessageTab tab);
|
void onShowOverlayInlineTextMessageTab(BlackGui::Components::TextMessageTab tab);
|
||||||
|
|||||||
@@ -281,6 +281,7 @@
|
|||||||
<addaction name="menu_MovingMap"/>
|
<addaction name="menu_MovingMap"/>
|
||||||
<addaction name="menu_AutoPublish"/>
|
<addaction name="menu_AutoPublish"/>
|
||||||
<addaction name="menu_ToggleIncognito"/>
|
<addaction name="menu_ToggleIncognito"/>
|
||||||
|
<addaction name="menu_ModelBrowser"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menu_File"/>
|
<addaction name="menu_File"/>
|
||||||
<addaction name="menu_Window"/>
|
<addaction name="menu_Window"/>
|
||||||
@@ -516,6 +517,11 @@
|
|||||||
<string>Toggle incognito mode</string>
|
<string>Toggle incognito mode</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="menu_ModelBrowser">
|
||||||
|
<property name="text">
|
||||||
|
<string>Model brower</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
connect(ui->menu_AutoPublish, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked);
|
connect(ui->menu_AutoPublish, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked);
|
||||||
connect(ui->menu_MovingMap, &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_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);
|
connect(m_navigator.data(), &CNavigatorDialog::navigatorClosed, this, &SwiftGuiStd::onNavigatorClosed, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user