Fixes in model set form as described by RP

https://swift-project.slack.com/archives/G96QTUBEG/p1544353355002400

* fixed missing radio button groups
* return values for some functions to detect "changes"
* minor style fixes
This commit is contained in:
Klaus Basan
2018-12-10 01:35:04 +01:00
parent 9b06a159f2
commit 9f408e8319
9 changed files with 176 additions and 115 deletions

View File

@@ -20,6 +20,7 @@
#include <QtGlobal>
#include <QPointer>
using namespace BlackMisc;
using namespace BlackMisc::Simulation;
using namespace BlackGui::Models;
using namespace BlackGui::Components;
@@ -59,7 +60,7 @@ namespace BlackGui
const bool hasPreferences = this->hasDistributorPreferences();
ui->cb_SortByPreferences->setChecked(hasPreferences);
CGuiUtility::checkBoxReadOnly(ui->cb_SortByPreferences, !hasPreferences);
ui->comp_SimulatorSelector->setValue(this->m_simulator);
ui->comp_SimulatorSelector->setValue(m_simulator);
this->setDistributorView(hasPreferences);
this->initDistributorDisplay();
}
@@ -142,29 +143,23 @@ namespace BlackGui
{
ui->tvp_Distributors->setDistributorMode(hasPreferences ? CDistributorListModel::MinimalWithOrder : CDistributorListModel::Minimal);
ui->tvp_Distributors->fullResizeToContents();
if (hasPreferences)
{
ui->tvp_Distributors->setSorting(CDistributor::IndexOrder);
}
else
{
ui->tvp_Distributors->setSorting(CDistributor::IndexDbStringKey);
}
const CPropertyIndex i = hasPreferences ? CPropertyIndex(CDistributor::IndexOrder) : CPropertyIndex(CDistributor::IndexDbStringKey);
ui->tvp_Distributors->sortByPropertyIndex(i);
}
CDistributorList COwnModelSetForm::getDistributorsFromPreferences() const
{
Q_ASSERT_X(this->m_simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
const CDistributorListPreferences prefs(this->m_distributorPreferences.get());
const CDistributorList distributors(prefs.getDistributors(this->m_simulator));
Q_ASSERT_X(m_simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
const CDistributorListPreferences prefs(m_distributorPreferences.get());
const CDistributorList distributors(prefs.getDistributors(m_simulator));
return distributors;
}
CDistributorList COwnModelSetForm::getAllDistributors() const
{
Q_ASSERT_X(this->m_simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
Q_ASSERT_X(m_simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
Q_ASSERT_X(sGui && sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
return sGui->getWebDataServices()->getDistributors().matchesSimulator(this->m_simulator);
return sGui->getWebDataServices()->getDistributors().matchesSimulator(m_simulator);
}
CDistributorList COwnModelSetForm::getDistributorsBasedOnOptions() const
@@ -199,8 +194,8 @@ namespace BlackGui
bool COwnModelSetForm::hasDistributorPreferences() const
{
const CDistributorListPreferences prefs(this->m_distributorPreferences.get());
return !prefs.getDistributors(this->m_simulator).isEmpty();
const CDistributorListPreferences prefs(m_distributorPreferences.get());
return !prefs.getDistributors(m_simulator).isEmpty();
}
} // ns
} // ns

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>350</height>
<width>350</width>
<height>376</height>
</rect>
</property>
<property name="minimumSize">
@@ -37,11 +37,21 @@
<property name="title">
<string>Selection</string>
</property>
<layout class="QGridLayout" name="gl_Selection">
<item row="1" column="0">
<widget class="QLabel" name="lbl_Mode">
<layout class="QGridLayout" name="gl_Selection" columnstretch="0,1,1,1">
<item row="0" column="1" colspan="3" alignment="Qt::AlignLeft">
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_Simulator">
<property name="text">
<string>Mode:</string>
<string>Simulator:</string>
</property>
</widget>
</item>
@@ -54,24 +64,24 @@
<string>full</string>
</property>
<property name="checked">
<bool>false</bool>
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_Mode</string>
</attribute>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_Mode">
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_Simulator">
<item row="2" column="0">
<widget class="QLabel" name="lbl_SelectSourceSet">
<property name="text">
<string>Simulator:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QRadioButton" name="rb_Incremental">
<property name="toolTip">
<string>add to existing set</string>
</property>
<property name="text">
<string>incremental</string>
<string>Source set:</string>
</property>
</widget>
</item>
@@ -86,6 +96,22 @@
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_SourceSet</string>
</attribute>
</widget>
</item>
<item row="1" column="2">
<widget class="QRadioButton" name="rb_Incremental">
<property name="toolTip">
<string>add to existing set</string>
</property>
<property name="text">
<string>incremental</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_Mode</string>
</attribute>
</widget>
</item>
<item row="2" column="3">
@@ -99,6 +125,9 @@
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_SourceSet</string>
</attribute>
</widget>
</item>
<item row="1" column="3">
@@ -111,23 +140,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_SelectSourceSet">
<property name="text">
<string>Source set:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="rb_DbDataOnly">
<property name="toolTip">
@@ -136,6 +148,22 @@
<property name="text">
<string>DB data only</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_SourceSet</string>
</attribute>
</widget>
</item>
<item row="3" column="2">
<widget class="QRadioButton" name="rb_DistributorsFromBelow">
<property name="text">
<string>all from below</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_Distributors</string>
</attribute>
</widget>
</item>
<item row="3" column="0">
@@ -150,20 +178,9 @@
<property name="text">
<string>selected</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QRadioButton" name="rb_DisplayPreferencesDistributors">
<property name="text">
<string>from preferences</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QRadioButton" name="rb_DistributorsFromBelow">
<property name="text">
<string>all from below</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_Distributors</string>
</attribute>
</widget>
</item>
<item row="3" column="3">
@@ -174,26 +191,9 @@
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QRadioButton" name="rb_DisplayAllDistributors">
<property name="text">
<string>all distributors</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QCheckBox" name="cb_SortByPreferences">
<property name="toolTip">
<string>If checked the distributors from the settings page will be used</string>
</property>
<property name="text">
<string>sort by dist. preferences</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_Distributors</string>
</attribute>
</widget>
</item>
</layout>
@@ -205,6 +205,57 @@
<string>Distributors</string>
</property>
<layout class="QVBoxLayout" name="vl_Distributors">
<item>
<widget class="QWidget" name="wi_DistributionButtons" native="true">
<layout class="QGridLayout" name="gl_DistributorButtons">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="rb_DisplayPreferencesDistributors">
<property name="text">
<string>from preferences</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_Displayed</string>
</attribute>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="rb_DisplayAllDistributors">
<property name="text">
<string>all distributors</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_Displayed</string>
</attribute>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cb_SortByPreferences">
<property name="toolTip">
<string>If checked the distributors from the settings page will be used</string>
</property>
<property name="text">
<string>sort by dist. preferences</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="BlackGui::Views::CDistributorView" name="tvp_Distributors">
<property name="selectionBehavior">
@@ -236,12 +287,27 @@
<header>blackgui/views/distributorview.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>rb_Full</tabstop>
<tabstop>rb_Incremental</tabstop>
<tabstop>cb_ConsolidateModelSet</tabstop>
<tabstop>rb_DbDataOnly</tabstop>
<tabstop>rb_DbIcaoCodesOnly</tabstop>
<tabstop>rb_WithIcaoData</tabstop>
<tabstop>rb_DistributorsSelected</tabstop>
<tabstop>rb_DistributorsFromBelow</tabstop>
<tabstop>rb_DistributorsAll</tabstop>
<tabstop>rb_DisplayPreferencesDistributors</tabstop>
<tabstop>rb_DisplayAllDistributors</tabstop>
<tabstop>cb_SortByPreferences</tabstop>
<tabstop>tvp_Distributors</tabstop>
</tabstops>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="bg_SourceSet"/>
<buttongroup name="bg_Distributors"/>
<buttongroup name="bg_Mode"/>
<buttongroup name="bg_DisplayedDistributors"/>
<buttongroup name="bg_Displayed"/>
</buttongroups>
</ui>