Formatting, minor UI tweaks

* minor renamings in simulator selector
* simplified namespaces

Ref T246
This commit is contained in:
Klaus Basan
2018-02-10 19:13:35 +01:00
parent 4f63c04225
commit 117e8996bb
11 changed files with 47 additions and 29 deletions

View File

@@ -31,6 +31,8 @@ namespace BlackGui
QFrame(parent),
ui(new Ui::CDbAirlineIcaoComponent)
{
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
ui->setupUi(this);
this->setViewWithIndicator(ui->tvp_AirlineIcao);
ui->tvp_AirlineIcao->setResizeMode(CAirlineIcaoCodeView::ResizingOff);

View File

@@ -106,7 +106,7 @@ namespace BlackGui
this->setValue(simulator);
}
void CSimulatorSelector::setAll()
void CSimulatorSelector::checkAll()
{
// checkboxes
ui->cb_FSX->setChecked(true);
@@ -118,6 +118,15 @@ namespace BlackGui
ui->rb_FSX->setChecked(true);
}
void CSimulatorSelector::uncheckAll()
{
// checkboxes
ui->cb_FSX->setChecked(false);
ui->cb_FS9->setChecked(false);
ui->cb_XPlane->setChecked(false);
ui->cb_P3D->setChecked(false);
}
bool CSimulatorSelector::isUnselected() const
{
bool c = false;
@@ -165,6 +174,14 @@ namespace BlackGui
ui->hl_CheckBoxes->setContentsMargins(m);
}
void CSimulatorSelector::clear()
{
if (m_mode == CheckBoxes)
{
this->uncheckAll();
}
}
void CSimulatorSelector::radioButtonChanged(bool checked)
{
if (m_mode != RadioButtons) { return; }

View File

@@ -64,7 +64,10 @@ namespace BlackGui
void setToLastSelection();
//! Set all, only making sense with checkboxes
void setAll();
void checkAll();
//! Unset all, only making sense with checkboxes
void uncheckAll();
//! Not selected at all
bool isUnselected() const;
@@ -78,6 +81,9 @@ namespace BlackGui
//! Remember selection
void setRememberSelection(bool remember) { m_rememberSelection = remember; }
//! Clear values
void clear();
signals:
//! Value has been changed
void changed(const BlackMisc::Simulation::CSimulatorInfo &simulator);

View File

@@ -37,7 +37,7 @@ namespace BlackGui
ui(new Ui::CAircraftModelFilterBar)
{
ui->setupUi(this);
ui->frp_SimulatorSelector->setAll();
ui->frp_SimulatorSelector->checkAll();
ui->comp_DistributorSelector->withDistributorDescription(false);
this->setButtonsAndCount(ui->filter_Buttons);
@@ -135,7 +135,7 @@ namespace BlackGui
ui->le_AirlineName->clear();
ui->le_LiveryCode->clear();
ui->le_FileName->clear();
ui->frp_SimulatorSelector->setAll();
ui->frp_SimulatorSelector->checkAll();
ui->comp_DistributorSelector->clear();
ui->cbt_IncludeExclude->setCheckState(Qt::PartiallyChecked);
ui->cbt_Db->setCheckState(Qt::PartiallyChecked);

View File

@@ -32,7 +32,7 @@ namespace BlackGui
//! Form for a aircraft model filter
class BLACKGUI_EXPORT CAircraftModelFilterDialog :
public CFilterDialog,
public BlackGui::Models::IModelFilterProvider<BlackMisc::Simulation::CAircraftModelList>
public Models::IModelFilterProvider<BlackMisc::Simulation::CAircraftModelList>
{
Q_OBJECT
@@ -49,7 +49,6 @@ namespace BlackGui
private:
QScopedPointer<Ui::CAircraftModelFilterDialog> ui;
};
} // namespace
} // namespace

View File

@@ -25,7 +25,7 @@
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="bb_ButtonBox">
<widget class="QDialogButtonBox" name="bb_FilterDialog">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -47,7 +47,7 @@
<resources/>
<connections>
<connection>
<sender>bb_ButtonBox</sender>
<sender>bb_FilterDialog</sender>
<signal>accepted()</signal>
<receiver>CAircraftModelFilterDialog</receiver>
<slot>accept()</slot>
@@ -63,7 +63,7 @@
</hints>
</connection>
<connection>
<sender>bb_ButtonBox</sender>
<sender>bb_FilterDialog</sender>
<signal>rejected()</signal>
<receiver>CAircraftModelFilterDialog</receiver>
<slot>reject()</slot>

View File

@@ -24,7 +24,6 @@ class QWidget;
namespace BlackMisc { class CCountryList; }
namespace Ui { class CCountryFilterBar; }
namespace BlackGui
{
namespace Filters
@@ -34,14 +33,14 @@ namespace BlackGui
*/
class BLACKGUI_EXPORT CCountryFilterBar :
public CFilterWidget,
public BlackGui::Models::IModelFilterProvider<BlackMisc::CCountryList>
public Models::IModelFilterProvider<BlackMisc::CCountryList>
{
public:
//! Constructor
explicit CCountryFilterBar(QWidget *parent = nullptr);
//! Destructor
~CCountryFilterBar();
virtual ~CCountryFilterBar();
//! \copydoc Models::IModelFilterProvider::createModelFilter
virtual std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::CCountryList>> createModelFilter() const override;
@@ -57,7 +56,7 @@ namespace BlackGui
private:
QScopedPointer<Ui::CCountryFilterBar> ui;
};
}
}
} // ns
} // ns
#endif // guard

View File

@@ -7,19 +7,16 @@
<x>0</x>
<y>0</y>
<width>384</width>
<height>22</height>
<height>24</height>
</rect>
</property>
<property name="windowTitle">
<string>Country filter bat</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<string>Country filter bar</string>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gl_CountryFilterBar">
<property name="topMargin">
<number>0</number>
</property>

View File

@@ -36,7 +36,6 @@ namespace BlackGui
QString m_isoCode;
QString m_name;
};
} // namespace
} // namespace

View File

@@ -79,7 +79,6 @@ namespace BlackGui
//! Get the filter, this is the filter itself, not its widget or dialog
virtual std::unique_ptr<IModelFilter<ContainerType>> createModelFilter() const = 0;
};
} // namespace
} // namespace
#endif // guard

View File

@@ -263,13 +263,13 @@ namespace BlackGui
{
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestUpdate);
if (!this->isSignalConnected(requestSignal)) break;
ma.addAction(BlackMisc::CIcons::refresh16(), "Update", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReload }); break;
ma.addAction(CIcons::refresh16(), "Update", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReload }); break;
}
case MenuBackend:
{
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestNewBackendData);
if (!this->isSignalConnected(requestSignal)) break;
ma.addAction(BlackMisc::CIcons::refresh16(), "Reload from backend", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReloadFromBackend }); break;
ma.addAction(CIcons::refresh16(), "Reload from backend", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReloadFromBackend }); break;
}
case MenuDisplayAutomatically:
{
@@ -278,8 +278,8 @@ namespace BlackGui
a->setChecked(this->displayAutomatically());
break;
}
case MenuRemoveSelectedRows: { ma.addAction(BlackMisc::CIcons::delete16(), "Remove selected rows", CMenuAction::pathViewAddRemove(), { this, &CViewBaseNonTemplate::ps_removeSelectedRows }, CShortcut::keyDelete()); break; }
case MenuClear: { ma.addAction(BlackMisc::CIcons::delete16(), "Clear", CMenuAction::pathViewAddRemove(), { this, &CViewBaseNonTemplate::ps_clear }); break; }
case MenuRemoveSelectedRows: { ma.addAction(CIcons::delete16(), "Remove selected rows", CMenuAction::pathViewAddRemove(), { this, &CViewBaseNonTemplate::ps_removeSelectedRows }, CShortcut::keyDelete()); break; }
case MenuClear: { ma.addAction(CIcons::delete16(), "Clear", CMenuAction::pathViewAddRemove(), { this, &CViewBaseNonTemplate::ps_clear }); break; }
case MenuFilter:
{
if (m_filterWidget)
@@ -340,7 +340,7 @@ namespace BlackGui
if (m_showingLoadIndicator)
{
// just in case, if this ever will be dangling
menuActions.addAction(BlackMisc::CIcons::preloader16(), "Hide load indicator", CMenuAction::pathViewUpdates(), nullptr, { this, &CViewBaseNonTemplate::ps_hideLoadIndicator });
menuActions.addAction(CIcons::preloader16(), "Hide load indicator", CMenuAction::pathViewUpdates(), nullptr, { this, &CViewBaseNonTemplate::ps_hideLoadIndicator });
}
if (m_menus.testFlag(MenuClear)) { menuActions.addActions(this->initMenuActions(MenuClear)); }
@@ -408,7 +408,7 @@ namespace BlackGui
if (m_menus.testFlag(MenuSave) && !isEmpty()) { menuActions.addActions(this->initMenuActions(MenuSave)); }
// resizing
menuActions.addAction(BlackMisc::CIcons::resize16(), "Resize", CMenuAction::pathViewResize(), nullptr, { this, &CViewBaseNonTemplate::presizeOrFullResizeToContents });
menuActions.addAction(CIcons::resize16(), "Resize", CMenuAction::pathViewResize(), nullptr, { this, &CViewBaseNonTemplate::presizeOrFullResizeToContents });
// resize to content might decrease performance,
// so I only allow changing to "content resizing" if size matches