mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
Ref T362, mapping component added workbench component
- adjusted UI - singe function to get view per tab - used setTabWidgetViewText
This commit is contained in:
@@ -96,6 +96,10 @@ namespace BlackGui
|
|||||||
ui->comp_StashAircraft->view()->setCustomMenu(new COwnModelSetMenu(this));
|
ui->comp_StashAircraft->view()->setCustomMenu(new COwnModelSetMenu(this));
|
||||||
ui->comp_StashAircraft->view()->setCustomMenu(new CStashToolsMenu(this));
|
ui->comp_StashAircraft->view()->setCustomMenu(new CStashToolsMenu(this));
|
||||||
|
|
||||||
|
ui->comp_ModelWorkbench->view()->setCustomMenu(new CApplyDbDataMenu(this));
|
||||||
|
ui->comp_ModelWorkbench->view()->setCustomMenu(new COwnModelSetMenu(this));
|
||||||
|
ui->comp_ModelWorkbench->view()->setCustomMenu(new CStashToolsMenu(this));
|
||||||
|
|
||||||
// connects
|
// connects
|
||||||
connect(ui->editor_ModelMapping, &CModelMappingForm::requestStash, this, &CDbMappingComponent::stashCurrentModel);
|
connect(ui->editor_ModelMapping, &CModelMappingForm::requestStash, this, &CDbMappingComponent::stashCurrentModel);
|
||||||
|
|
||||||
@@ -104,6 +108,11 @@ namespace BlackGui
|
|||||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::requestStash, this, &CDbMappingComponent::stashSelectedModels);
|
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::requestStash, this, &CDbMappingComponent::stashSelectedModels);
|
||||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::onStashedModelsChangedTriggerDigest);
|
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::onStashedModelsChangedTriggerDigest);
|
||||||
|
|
||||||
|
connect(ui->comp_ModelWorkbench->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::onModelRowSelected);
|
||||||
|
connect(ui->comp_ModelWorkbench->view(), &CAircraftModelView::modelDataChangedDigest, this, &CDbMappingComponent::onWorkbenchDataChanged, Qt::QueuedConnection);
|
||||||
|
connect(ui->comp_ModelWorkbench->view(), &CAircraftModelView::requestStash, this, &CDbMappingComponent::stashSelectedModels);
|
||||||
|
connect(ui->comp_ModelWorkbench->view(), &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::onStashedModelsChangedTriggerDigest);
|
||||||
|
|
||||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::modelDataChangedDigest, this, &CDbMappingComponent::onStashedModelsDataChangedDigest);
|
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::modelDataChangedDigest, this, &CDbMappingComponent::onStashedModelsDataChangedDigest);
|
||||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::onModelRowSelected);
|
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::onModelRowSelected);
|
||||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::requestHandlingOfStashDrop, this, &CDbMappingComponent::handleStashDropRequest);
|
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::requestHandlingOfStashDrop, this, &CDbMappingComponent::handleStashDropRequest);
|
||||||
@@ -129,6 +138,7 @@ namespace BlackGui
|
|||||||
ui->tw_ModelsToBeMapped->setTabIcon(TabStash, CIcons::appDbStash16());
|
ui->tw_ModelsToBeMapped->setTabIcon(TabStash, CIcons::appDbStash16());
|
||||||
ui->tw_ModelsToBeMapped->setTabIcon(TabOwnModels, CIcons::appModels16());
|
ui->tw_ModelsToBeMapped->setTabIcon(TabOwnModels, CIcons::appModels16());
|
||||||
ui->tw_ModelsToBeMapped->setTabIcon(TabOwnModelSet, CIcons::appModels16());
|
ui->tw_ModelsToBeMapped->setTabIcon(TabOwnModelSet, CIcons::appModels16());
|
||||||
|
ui->tw_ModelsToBeMapped->setTabIcon(TabWorkbench, CIcons::wrench16());
|
||||||
|
|
||||||
// custom menu and shortcut
|
// custom menu and shortcut
|
||||||
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
@@ -203,9 +213,9 @@ namespace BlackGui
|
|||||||
if (sender == ui->comp_OwnModelSet->view()) { return ui->comp_OwnModelSet->view()->at(index); }
|
if (sender == ui->comp_OwnModelSet->view()) { return ui->comp_OwnModelSet->view()->at(index); }
|
||||||
|
|
||||||
// no sender, use current tab
|
// no sender, use current tab
|
||||||
const CAircraftModelView *v = this->currentModelView();
|
const CAircraftModelView *mv = this->currentModelView();
|
||||||
if (!v) { return CAircraftModel(); }
|
if (!mv) { return CAircraftModel(); }
|
||||||
return v->at(index);
|
return mv->at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbMappingComponent::gracefulShutdown()
|
void CDbMappingComponent::gracefulShutdown()
|
||||||
@@ -217,20 +227,19 @@ namespace BlackGui
|
|||||||
|
|
||||||
bool CDbMappingComponent::hasSelectedModelsToStash() const
|
bool CDbMappingComponent::hasSelectedModelsToStash() const
|
||||||
{
|
{
|
||||||
const TabIndex tab = currentTabIndex();
|
const CAircraftModelView *mv = this->currentModelView();
|
||||||
switch (tab)
|
if (!mv) { return false; }
|
||||||
{
|
return mv->hasSelectedModelsToStash();
|
||||||
case TabOwnModels: return ui->comp_OwnAircraftModels->view()->hasSelectedModelsToStash();
|
|
||||||
case TabOwnModelSet: return ui->comp_OwnModelSet->view()->hasSelectedModelsToStash();
|
|
||||||
case TabVPilot: return ui->tvp_AircraftModelsForVPilot->hasSelectedModelsToStash();
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftModelView *CDbMappingComponent::currentModelView() const
|
CAircraftModelView *CDbMappingComponent::currentModelView() const
|
||||||
{
|
{
|
||||||
const TabIndex tab = currentTabIndex();
|
const TabIndex tab = currentTabIndex();
|
||||||
|
return this->modelView(tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
CAircraftModelView *CDbMappingComponent::modelView(TabIndex tab) const
|
||||||
|
{
|
||||||
switch (tab)
|
switch (tab)
|
||||||
{
|
{
|
||||||
case TabOwnModels: return ui->comp_OwnAircraftModels->view();
|
case TabOwnModels: return ui->comp_OwnAircraftModels->view();
|
||||||
@@ -285,16 +294,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
CAircraftModelList CDbMappingComponent::getSelectedModelsToStash() const
|
CAircraftModelList CDbMappingComponent::getSelectedModelsToStash() const
|
||||||
{
|
{
|
||||||
if (!hasSelectedModelsToStash()) { return CAircraftModelList(); }
|
const CAircraftModelView *mv = this->currentModelView();
|
||||||
const TabIndex tab = currentTabIndex();
|
if (!mv || !mv->hasSelectedModelsToStash()) { return CAircraftModelList(); }
|
||||||
switch (tab)
|
return mv->selectedObjects();
|
||||||
{
|
|
||||||
case TabOwnModels: return ui->comp_OwnAircraftModels->view()->selectedObjects();
|
|
||||||
case TabOwnModelSet: return ui->comp_OwnModelSet->view()->selectedObjects();
|
|
||||||
case TabVPilot: return ui->tvp_AircraftModelsForVPilot->selectedObjects();
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
return CAircraftModelList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAircraftModelList &CDbMappingComponent::getStashedModels() const
|
const CAircraftModelList &CDbMappingComponent::getStashedModels() const
|
||||||
@@ -388,17 +390,8 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
const QStringList modelStrings(sGui->getWebDataServices()->getModelStrings());
|
const QStringList modelStrings(sGui->getWebDataServices()->getModelStrings());
|
||||||
if (modelStrings.isEmpty()) { return; }
|
if (modelStrings.isEmpty()) { return; }
|
||||||
switch (currentTabIndex())
|
CAircraftModelView *mv = this->currentModelView();
|
||||||
{
|
if (mv) { mv->removeModelsWithModelString(modelStrings); }
|
||||||
case TabVPilot:
|
|
||||||
case TabOwnModels:
|
|
||||||
case TabOwnModelSet:
|
|
||||||
case TabStash:
|
|
||||||
this->currentModelView()->removeModelsWithModelString(modelStrings);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbMappingComponent::showChangedAttributes()
|
void CDbMappingComponent::showChangedAttributes()
|
||||||
@@ -627,17 +620,22 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
Q_UNUSED(withFilter);
|
Q_UNUSED(withFilter);
|
||||||
const int i = ui->tw_ModelsToBeMapped->indexOf(ui->tab_VPilot);
|
ui->tvp_AircraftModelsForVPilot->setTabWidgetViewText(ui->tw_ModelsToBeMapped, ui->tw_ModelsToBeMapped->indexOf(ui->tab_VPilot));
|
||||||
QString o = ui->tw_ModelsToBeMapped->tabText(i);
|
}
|
||||||
const QString f = ui->tvp_AircraftModelsForVPilot->hasFilter() ? "F" : "";
|
|
||||||
o = CGuiUtility::replaceTabCountValue(o, ui->tvp_AircraftModelsForVPilot->rowCount()) + f;
|
void CDbMappingComponent::onWorkbenchDataChanged(int count, bool withFilter)
|
||||||
ui->tw_ModelsToBeMapped->setTabText(i, o);
|
{
|
||||||
|
Q_UNUSED(count);
|
||||||
|
Q_UNUSED(withFilter);
|
||||||
|
ui->comp_ModelWorkbench->view()->setTabWidgetViewText(ui->tw_ModelsToBeMapped, ui->tw_ModelsToBeMapped->indexOf(ui->tab_Workbench));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbMappingComponent::onOwnModelsChangedDigest(int count, bool withFilter)
|
void CDbMappingComponent::onOwnModelsChangedDigest(int count, bool withFilter)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
Q_UNUSED(withFilter);
|
Q_UNUSED(withFilter);
|
||||||
|
|
||||||
|
// non standard with sim
|
||||||
const int i = ui->tw_ModelsToBeMapped->indexOf(ui->tab_OwnModels);
|
const int i = ui->tw_ModelsToBeMapped->indexOf(ui->tab_OwnModels);
|
||||||
static const QString ot(ui->tw_ModelsToBeMapped->tabText(i));
|
static const QString ot(ui->tw_ModelsToBeMapped->tabText(i));
|
||||||
QString o(ot);
|
QString o(ot);
|
||||||
@@ -702,11 +700,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
Q_UNUSED(withFilter);
|
Q_UNUSED(withFilter);
|
||||||
int i = ui->tw_ModelsToBeMapped->indexOf(ui->tab_StashAircraftModels);
|
ui->comp_StashAircraft->view()->setTabWidgetViewText(ui->tw_ModelsToBeMapped, ui->tw_ModelsToBeMapped->indexOf(ui->tab_StashAircraftModels));
|
||||||
QString o = ui->tw_ModelsToBeMapped->tabText(i);
|
|
||||||
const QString f = ui->comp_StashAircraft->view()->hasFilter() ? "F" : "";
|
|
||||||
o = CGuiUtility::replaceTabCountValue(o, ui->comp_StashAircraft->view()->rowCount()) + f;
|
|
||||||
ui->tw_ModelsToBeMapped->setTabText(i, o);
|
|
||||||
|
|
||||||
// update editors
|
// update editors
|
||||||
this->updateEditorsWhenApplicable();
|
this->updateEditorsWhenApplicable();
|
||||||
@@ -716,6 +710,8 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
Q_UNUSED(withFilter);
|
Q_UNUSED(withFilter);
|
||||||
|
|
||||||
|
// none standard with simulator
|
||||||
int i = ui->tw_ModelsToBeMapped->indexOf(ui->tab_OwnModelSet);
|
int i = ui->tw_ModelsToBeMapped->indexOf(ui->tab_OwnModelSet);
|
||||||
QString o = "Model set " + ui->comp_OwnModelSet->getModelSetSimulator().toQString(true);
|
QString o = "Model set " + ui->comp_OwnModelSet->getModelSetSimulator().toQString(true);
|
||||||
const QString f = ui->comp_OwnModelSet->view()->hasFilter() ? "F" : "";
|
const QString f = ui->comp_OwnModelSet->view()->hasFilter() ? "F" : "";
|
||||||
|
|||||||
@@ -72,15 +72,16 @@ namespace BlackGui
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//! Tab index.
|
//! Tab index.
|
||||||
//! Must match real tab index
|
//! \remark Must match real tab index
|
||||||
enum TabIndex
|
enum TabIndex
|
||||||
{
|
{
|
||||||
NoValidTab = -1,
|
NoValidTab = -1,
|
||||||
TabOwnModelSet = 0,
|
TabOwnModelSet = 0,
|
||||||
TabOwnModels = 1,
|
TabOwnModels = 1,
|
||||||
TabStash = 2,
|
TabWorkbench = 2,
|
||||||
TabModelMatcher = 3,
|
TabStash = 3,
|
||||||
TabVPilot = 4
|
TabModelMatcher = 4,
|
||||||
|
TabVPilot = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
@@ -113,6 +114,9 @@ namespace BlackGui
|
|||||||
//! Current model view
|
//! Current model view
|
||||||
Views::CAircraftModelView *currentModelView() const;
|
Views::CAircraftModelView *currentModelView() const;
|
||||||
|
|
||||||
|
//! Current model view
|
||||||
|
Views::CAircraftModelView *modelView(TabIndex tab) const;
|
||||||
|
|
||||||
//! Unvalidated consolidated aircraft model from the editor subparts (icao, distributor)
|
//! Unvalidated consolidated aircraft model from the editor subparts (icao, distributor)
|
||||||
//! \note not guaranteed to be valid, just a snapshot of its current editor state
|
//! \note not guaranteed to be valid, just a snapshot of its current editor state
|
||||||
BlackMisc::Simulation::CAircraftModel getEditorAircraftModel() const;
|
BlackMisc::Simulation::CAircraftModel getEditorAircraftModel() const;
|
||||||
@@ -247,6 +251,9 @@ namespace BlackGui
|
|||||||
//! vPilot data changed
|
//! vPilot data changed
|
||||||
void onVPilotDataChanged(int count, bool withFilter);
|
void onVPilotDataChanged(int count, bool withFilter);
|
||||||
|
|
||||||
|
//! Workbench data changed
|
||||||
|
void onWorkbenchDataChanged(int count, bool withFilter);
|
||||||
|
|
||||||
//! Tab index changed
|
//! Tab index changed
|
||||||
void onTabIndexChanged(int index);
|
void onTabIndexChanged(int index);
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,38 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_Workbench">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Workbench</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QHBoxLayout" name="hl_Workbench">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Components::CDbModelWorkbenchComponent" name="comp_ModelWorkbench">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="QWidget" name="tab_StashAircraftModels">
|
<widget class="QWidget" name="tab_StashAircraftModels">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Stashed models</string>
|
<string>Stashed models</string>
|
||||||
@@ -287,7 +319,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>882</width>
|
<width>885</width>
|
||||||
<height>450</height>
|
<height>450</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -378,6 +410,12 @@
|
|||||||
<header>blackgui/components/modelmatchercomponent.h</header>
|
<header>blackgui/components/modelmatchercomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CDbModelWorkbenchComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/dbmodelworkbenchcomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
Reference in New Issue
Block a user