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), QFrame(parent),
ui(new Ui::CDbAirlineIcaoComponent) ui(new Ui::CDbAirlineIcaoComponent)
{ {
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
ui->setupUi(this); ui->setupUi(this);
this->setViewWithIndicator(ui->tvp_AirlineIcao); this->setViewWithIndicator(ui->tvp_AirlineIcao);
ui->tvp_AirlineIcao->setResizeMode(CAirlineIcaoCodeView::ResizingOff); ui->tvp_AirlineIcao->setResizeMode(CAirlineIcaoCodeView::ResizingOff);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -263,13 +263,13 @@ namespace BlackGui
{ {
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestUpdate); static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestUpdate);
if (!this->isSignalConnected(requestSignal)) break; 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: case MenuBackend:
{ {
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestNewBackendData); static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestNewBackendData);
if (!this->isSignalConnected(requestSignal)) break; 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: case MenuDisplayAutomatically:
{ {
@@ -278,8 +278,8 @@ namespace BlackGui
a->setChecked(this->displayAutomatically()); a->setChecked(this->displayAutomatically());
break; break;
} }
case MenuRemoveSelectedRows: { ma.addAction(BlackMisc::CIcons::delete16(), "Remove selected rows", CMenuAction::pathViewAddRemove(), { this, &CViewBaseNonTemplate::ps_removeSelectedRows }, CShortcut::keyDelete()); break; } case MenuRemoveSelectedRows: { ma.addAction(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 MenuClear: { ma.addAction(CIcons::delete16(), "Clear", CMenuAction::pathViewAddRemove(), { this, &CViewBaseNonTemplate::ps_clear }); break; }
case MenuFilter: case MenuFilter:
{ {
if (m_filterWidget) if (m_filterWidget)
@@ -340,7 +340,7 @@ namespace BlackGui
if (m_showingLoadIndicator) if (m_showingLoadIndicator)
{ {
// just in case, if this ever will be dangling // 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)); } 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)); } if (m_menus.testFlag(MenuSave) && !isEmpty()) { menuActions.addActions(this->initMenuActions(MenuSave)); }
// resizing // 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, // resize to content might decrease performance,
// so I only allow changing to "content resizing" if size matches // so I only allow changing to "content resizing" if size matches