mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 14:07:35 +08:00
Filter minor style/refactoring
* use normal functions instead of slots * some renamings
This commit is contained in:
committed by
Mat Sutcliffe
parent
f00866fbe7
commit
314c48d5d1
@@ -844,14 +844,14 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool CViewBase<T>::ps_filterDialogFinished(int status)
|
||||
bool CViewBase<T>::filterDialogFinished(int status)
|
||||
{
|
||||
QDialog::DialogCode statusCode = static_cast<QDialog::DialogCode>(status);
|
||||
return ps_filterWidgetChangedFilter(statusCode == QDialog::Accepted);
|
||||
return filterWidgetChangedFilter(statusCode == QDialog::Accepted);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool CViewBase<T>::ps_filterWidgetChangedFilter(bool enabled)
|
||||
bool CViewBase<T>::filterWidgetChangedFilter(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
@@ -884,12 +884,6 @@ namespace BlackGui
|
||||
return true; // handled
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void CViewBase<T>::ps_removeFilter()
|
||||
{
|
||||
this->derivedModel()->removeFilter();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void CViewBase<T>::ps_clicked(const QModelIndex &index)
|
||||
{
|
||||
|
||||
@@ -504,6 +504,15 @@ namespace BlackGui
|
||||
//! Trigger reload from backend by signal requestNewBackendData()
|
||||
void triggerReloadFromBackend();
|
||||
|
||||
//! Remove filter
|
||||
virtual void removeFilter() = 0;
|
||||
|
||||
//! Filter dialog finished
|
||||
virtual bool filterDialogFinished(int status) = 0;
|
||||
|
||||
//! Filter changed in filter widget
|
||||
virtual bool filterWidgetChangedFilter(bool enabled) = 0;
|
||||
|
||||
//! Init text edit dialog if required and return pointer to it
|
||||
Components::CTextEditDialog *textEditDialog();
|
||||
|
||||
@@ -538,15 +547,6 @@ namespace BlackGui
|
||||
BlackMisc::CSettingReadOnly<Settings::TGeneralGui> m_guiSettings { this, &CViewBaseNonTemplate::settingsChanged }; //!< general GUI settings
|
||||
|
||||
protected slots:
|
||||
//! Remove filter
|
||||
virtual void ps_removeFilter() = 0;
|
||||
|
||||
//! Filter dialog finished
|
||||
virtual bool ps_filterDialogFinished(int status) = 0;
|
||||
|
||||
//! Filter changed in filter widget
|
||||
virtual bool ps_filterWidgetChangedFilter(bool enabled) = 0;
|
||||
|
||||
//! Index clicked
|
||||
virtual void ps_clicked(const QModelIndex &index) = 0;
|
||||
|
||||
@@ -728,9 +728,6 @@ namespace BlackGui
|
||||
//! Set filter and take ownership, any previously set filter will be destroyed
|
||||
void takeFilterOwnership(std::unique_ptr<Models::IModelFilter<ContainerType>> &filter);
|
||||
|
||||
//! Removes filter and destroys filter object
|
||||
void removeFilter();
|
||||
|
||||
//! Has filter set?
|
||||
bool hasFilter() const;
|
||||
|
||||
@@ -771,6 +768,9 @@ namespace BlackGui
|
||||
virtual void paste() override;
|
||||
virtual void displayJsonPopup() override { this->displayContainerAsJsonPopup(false); }
|
||||
virtual void displaySelectedJsonPopup() override { this->displayContainerAsJsonPopup(true); }
|
||||
virtual bool filterDialogFinished(int status) override;
|
||||
virtual bool filterWidgetChangedFilter(bool enabled) override;
|
||||
virtual void removeFilter() override;
|
||||
//! @}
|
||||
|
||||
//! Modify JSON data loaded in BlackGui::Views::CViewBaseNonTemplate::ps_loadJson
|
||||
@@ -796,9 +796,6 @@ namespace BlackGui
|
||||
|
||||
//! \name Slot overrides from base class
|
||||
//! @{
|
||||
virtual bool ps_filterDialogFinished(int status) override;
|
||||
virtual bool ps_filterWidgetChangedFilter(bool enabled) override;
|
||||
virtual void ps_removeFilter() override;
|
||||
virtual void ps_clicked(const QModelIndex &index) override;
|
||||
virtual void ps_doubleClicked(const QModelIndex &index) override;
|
||||
virtual void ps_rowSelected(const QModelIndex &index) override;
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace BlackGui
|
||||
this->setFilterWidgetImpl(filterDialog);
|
||||
if (filterDialog)
|
||||
{
|
||||
const bool s = connect(filterDialog, &CFilterDialog::finished, this, &CViewBaseNonTemplate::ps_filterDialogFinished);
|
||||
const bool s = connect(filterDialog, &CFilterDialog::finished, this, &CViewBaseNonTemplate::filterDialogFinished);
|
||||
Q_ASSERT_X(s, Q_FUNC_INFO, "filter dialog connect");
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace BlackGui
|
||||
this->setFilterWidgetImpl(filterWidget);
|
||||
if (filterWidget)
|
||||
{
|
||||
bool s = connect(filterWidget, &CFilterWidget::changeFilter, this, &CViewBaseNonTemplate::ps_filterWidgetChangedFilter);
|
||||
bool s = connect(filterWidget, &CFilterWidget::changeFilter, this, &CViewBaseNonTemplate::filterWidgetChangedFilter);
|
||||
Q_ASSERT_X(s, Q_FUNC_INFO, "filter connect");
|
||||
s = connect(this, &CViewBaseNonTemplate::modelDataChanged, filterWidget, &CFilterWidget::onRowCountChanged);
|
||||
Q_ASSERT_X(s, Q_FUNC_INFO, "filter connect");
|
||||
@@ -241,7 +241,7 @@ namespace BlackGui
|
||||
{
|
||||
const bool dialog = qobject_cast<QDialog *>(m_filterWidget);
|
||||
if (dialog) ma.addAction(CIcons::filter16(), "Show filter " + CShortcut::toParenthesisString(CShortcut::keyDisplayFilter()), CMenuAction::pathViewFilter(), { this, &CViewBaseNonTemplate::displayFilterDialog }, CShortcut::keyDisplayFilter());
|
||||
ma.addAction(CIcons::filter16(), "Remove Filter", CMenuAction::pathViewFilter(), { this, &CViewBaseNonTemplate::ps_removeFilter });
|
||||
ma.addAction(CIcons::filter16(), "Remove Filter", CMenuAction::pathViewFilter(), { this, &CViewBaseNonTemplate::removeFilter });
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user