diff --git a/src/blackgui/components/dbdistributorcomponent.cpp b/src/blackgui/components/dbdistributorcomponent.cpp index 86c988178..805ba499a 100644 --- a/src/blackgui/components/dbdistributorcomponent.cpp +++ b/src/blackgui/components/dbdistributorcomponent.cpp @@ -7,13 +7,14 @@ * contained in the LICENSE file. */ -#include "blackcore/webdataservices.h" +#include "dbdistributorcomponent.h" +#include "ui_dbdistributorcomponent.h" #include "blackgui/components/dbdistributorcomponent.h" #include "blackgui/guiapplication.h" #include "blackgui/views/distributorview.h" #include "blackgui/views/viewbase.h" -#include "dbdistributorcomponent.h" -#include "ui_dbdistributorcomponent.h" +#include "blackcore/webdataservices.h" +#include "blackmisc/simulation/simulatorinfo.h" #include #include @@ -21,6 +22,7 @@ using namespace BlackCore; using namespace BlackMisc::Network; +using namespace BlackMisc::Simulation; using namespace BlackGui::Views; namespace BlackGui @@ -35,9 +37,11 @@ namespace BlackGui this->setViewWithIndicator(ui->tvp_Distributors); ui->tvp_Distributors->setResizeMode(CViewBaseNonTemplate::ResizingAuto); ui->tvp_Distributors->allowDragDrop(true, false); - connect(ui->tvp_Distributors, &CDistributorView::requestNewBackendData, this, &CDbDistributorComponent::ps_reload); - connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbDistributorComponent::ps_distributorsRead); - this->ps_distributorsRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getDistributorsCount()); + ui->tvp_Distributors->setFilterWidget(ui->filter_Distributor); + + connect(ui->tvp_Distributors, &CDistributorView::requestNewBackendData, this, &CDbDistributorComponent::reload); + connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbDistributorComponent::distributorsRead); + this->distributorsRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getDistributorsCount()); } CDbDistributorComponent::~CDbDistributorComponent() @@ -48,7 +52,12 @@ namespace BlackGui return ui->tvp_Distributors; } - void CDbDistributorComponent::ps_distributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count) + void CDbDistributorComponent::filterBySimulator(const CSimulatorInfo &simulator) + { + ui->filter_Distributor->setSimulator(simulator); + } + + void CDbDistributorComponent::distributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count) { Q_UNUSED(count); if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished) @@ -57,7 +66,7 @@ namespace BlackGui } } - void CDbDistributorComponent::ps_reload() + void CDbDistributorComponent::reload() { if (!sGui) { return; } sGui->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::DistributorEntity); diff --git a/src/blackgui/components/dbdistributorcomponent.h b/src/blackgui/components/dbdistributorcomponent.h index 98145981a..7ea15c3bb 100644 --- a/src/blackgui/components/dbdistributorcomponent.h +++ b/src/blackgui/components/dbdistributorcomponent.h @@ -21,7 +21,9 @@ #include class QWidget; + namespace Ui { class CDbDistributorComponent; } +namespace BlackMisc { namespace Simulation { class CSimulatorInfo; }} namespace BlackGui { namespace Views { class CDistributorView; } @@ -42,22 +44,23 @@ namespace BlackGui explicit CDbDistributorComponent(QWidget *parent = nullptr); //! Destructor - ~CDbDistributorComponent(); + virtual ~CDbDistributorComponent(); //! Get the view BlackGui::Views::CDistributorView *view() const; - private slots: - //! Distributors have been read - void ps_distributorsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count); - - //! Reload models - void ps_reload(); + //! Filter by simulator + void filterBySimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator); private: QScopedPointer ui; - }; + //! Distributors have been read + void distributorsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count); + + //! Reload models + void reload(); + }; } // ns } // ns diff --git a/src/blackgui/components/dbdistributorcomponent.ui b/src/blackgui/components/dbdistributorcomponent.ui index 3d1d11371..67ce071ea 100644 --- a/src/blackgui/components/dbdistributorcomponent.ui +++ b/src/blackgui/components/dbdistributorcomponent.ui @@ -38,8 +38,14 @@ 0 - - + + + + + 150 + 0 + + QFrame::StyledPanel @@ -72,6 +78,12 @@ QTableView
blackgui/views/distributorview.h
+ + BlackGui::Filters::CDistributorFilterBar + QFrame +
blackgui/filters/distributorfilterbar.h
+ 1 +
diff --git a/src/blackgui/components/firstmodelsetcomponent.cpp b/src/blackgui/components/firstmodelsetcomponent.cpp index 9844153d1..77e260a2d 100644 --- a/src/blackgui/components/firstmodelsetcomponent.cpp +++ b/src/blackgui/components/firstmodelsetcomponent.cpp @@ -52,6 +52,8 @@ namespace BlackGui Q_ASSERT_X(m_modelSetDialog, Q_FUNC_INFO, "No model set dialog"); m_modelSetDialog->setSimulator(simulator); + ui->comp_Distributors->filterBySimulator(simulator); + // kind of hack, but simplest solution // we us the loader of the components directly, // avoid to fully init a loader logic here diff --git a/src/blackgui/components/firstmodelsetcomponent.ui b/src/blackgui/components/firstmodelsetcomponent.ui index 43383c47d..1fc23887e 100644 --- a/src/blackgui/components/firstmodelsetcomponent.ui +++ b/src/blackgui/components/firstmodelsetcomponent.ui @@ -20,7 +20,7 @@ - <html><head/><body><p><span style=" font-size:9pt;">The model set defines which aircraft you will use in the simulator. From all models you have installed on your disk you can select a subset actually being used.</span></p></body></html> + <html><head/><body><p><span style=" font-size:9pt; font-weight:600; color:#ff0000;">WORK IN PROGRESS, not finished </span><span style=" font-size:9pt;">The model set defines which aircraft you will use in the simulator. From all models you have installed on your disk you can select a subset actually being used.</span></p></body></html> Qt::RichText @@ -158,6 +158,12 @@ + + + 0 + 125 + + QFrame::StyledPanel diff --git a/src/blackgui/share/qss/stdwidget.qss b/src/blackgui/share/qss/stdwidget.qss index f6607fb80..0b8484066 100644 --- a/src/blackgui/share/qss/stdwidget.qss +++ b/src/blackgui/share/qss/stdwidget.qss @@ -178,6 +178,13 @@ BlackGui--Components--CDbOwnModelSetDialog background-image: url(:/textures/icons/textures/texture-inner.jpg); } +BlackGui--Components--CFirstModelSetComponent +BlackGui--Components--CDbDistributorComponent +{ + background: black; /* background is background color here */ + background-image: url(:/textures/icons/textures/texture-inner.jpg); +} + /* default for buttons */ QToolButton { background-color: transparent; /* transparent tool buttons */