From 3af9590db2240b439e84e8dc47c729852574de6f Mon Sep 17 00:00:00 2001 From: Wojciech Smigaj Date: Thu, 15 Jul 2021 21:03:31 +0100 Subject: [PATCH] Rename "Show Source and Header Groups" This patch renames the "Show Source and Header Groups" filter to "Hide Source and Header Groups" for consistency with existing filters such as "Hide Generated Files". Change-Id: I34c204f7cae55bab60a50932cf307614987ef2ea Reviewed-by: hjk --- src/plugins/projectexplorer/projectmodels.cpp | 8 ++--- src/plugins/projectexplorer/projectmodels.h | 6 ++-- .../projectexplorer/projecttreewidget.cpp | 36 +++++++++---------- .../projectexplorer/projecttreewidget.h | 6 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 8cf78d2850e..0a35243a117 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -488,7 +488,7 @@ void FlatModel::addFolderNode(WrapperNode *parent, FolderNode *folderNode, QSet< continue; if (FolderNode *subFolderNode = node->asFolderNode()) { bool isHidden = m_filterProjects && !subFolderNode->showInSimpleTree(); - if (!m_showSourceGroups) { + if (m_hideSourceGroups) { if (subFolderNode->isVirtualFolderType()) { auto vnode = static_cast(subFolderNode); if (vnode->isSourcesOrHeaders()) { @@ -899,11 +899,11 @@ void FlatModel::setTrimEmptyDirectories(bool filter) rebuildModel(); } -void FlatModel::setShowSourceGroups(bool filter) +void FlatModel::setHideSourceGroups(bool filter) { - if (filter == m_showSourceGroups) + if (filter == m_hideSourceGroups) return; - m_showSourceGroups = filter; + m_hideSourceGroups = filter; rebuildModel(); } diff --git a/src/plugins/projectexplorer/projectmodels.h b/src/plugins/projectexplorer/projectmodels.h index 2da85b1a858..ca34aab3e6a 100644 --- a/src/plugins/projectexplorer/projectmodels.h +++ b/src/plugins/projectexplorer/projectmodels.h @@ -84,12 +84,12 @@ public: bool generatedFilesFilterEnabled(); bool disabledFilesFilterEnabled() const { return m_filterDisabledFiles; } bool trimEmptyDirectoriesEnabled(); - bool showSourceGroups() { return m_showSourceGroups; } + bool hideSourceGroups() { return m_hideSourceGroups; } void setProjectFilterEnabled(bool filter); void setGeneratedFilesFilterEnabled(bool filter); void setDisabledFilesFilterEnabled(bool filter); void setTrimEmptyDirectories(bool filter); - void setShowSourceGroups(bool filter); + void setHideSourceGroups(bool filter); void onExpanded(const QModelIndex &idx); void onCollapsed(const QModelIndex &idx); @@ -102,7 +102,7 @@ private: bool m_filterGeneratedFiles = true; bool m_filterDisabledFiles = false; bool m_trimEmptyDirectories = true; - bool m_showSourceGroups = true; + bool m_hideSourceGroups = true; static const QLoggingCategory &logger(); diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 54afde7d053..0337a6963c7 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -273,11 +273,11 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent) connect(m_trimEmptyDirectoriesAction, &QAction::toggled, this, &ProjectTreeWidget::setTrimEmptyDirectories); - m_showSourceGroupsAction = new QAction(tr("Show Source and Header Groups"), this); - m_showSourceGroupsAction->setCheckable(true); - m_showSourceGroupsAction->setChecked(true); - connect(m_showSourceGroupsAction, &QAction::toggled, - this, &ProjectTreeWidget::setShowSourceGroups); + m_hideSourceGroupsAction = new QAction(tr("Hide Source and Header Groups"), this); + m_hideSourceGroupsAction->setCheckable(true); + m_hideSourceGroupsAction->setChecked(false); + connect(m_hideSourceGroupsAction, &QAction::toggled, + this, &ProjectTreeWidget::setHideSourceGroups); // connections connect(m_model, &FlatModel::renamed, @@ -448,7 +448,7 @@ QList ProjectTreeWidget::createToolButtons() filterMenu->addAction(m_filterGeneratedFilesAction); filterMenu->addAction(m_filterDisabledFilesAction); filterMenu->addAction(m_trimEmptyDirectoriesAction); - filterMenu->addAction(m_showSourceGroupsAction); + filterMenu->addAction(m_hideSourceGroupsAction); filter->setMenu(filterMenu); auto toggleSync = new QToolButton; @@ -593,10 +593,10 @@ void ProjectTreeWidget::setTrimEmptyDirectories(bool filter) m_trimEmptyDirectoriesAction->setChecked(filter); } -void ProjectTreeWidget::setShowSourceGroups(bool filter) +void ProjectTreeWidget::setHideSourceGroups(bool filter) { - m_model->setShowSourceGroups(filter); - m_showSourceGroupsAction->setChecked(filter); + m_model->setHideSourceGroups(filter); + m_hideSourceGroupsAction->setChecked(filter); } bool ProjectTreeWidget::generatedFilesFilter() @@ -614,9 +614,9 @@ bool ProjectTreeWidget::trimEmptyDirectoriesFilter() return m_model->trimEmptyDirectoriesEnabled(); } -bool ProjectTreeWidget::showSourceGroups() +bool ProjectTreeWidget::hideSourceGroups() { - return m_model->showSourceGroups(); + return m_model->hideSourceGroups(); } bool ProjectTreeWidget::projectFilter() @@ -643,7 +643,7 @@ const bool kProjectFilterDefault = false; const bool kHideGeneratedFilesDefault = true; const bool kHideDisabledFilesDefault = false; const bool kTrimEmptyDirsDefault = true; -const bool kShowSourceGroupsDefault = true; +const bool kHideSourceGroupsDefault = false; const bool kSyncDefault = true; const char kBaseKey[] = "ProjectTreeWidget."; const char kProjectFilterKey[] = ".ProjectFilter"; @@ -651,7 +651,7 @@ const char kHideGeneratedFilesKey[] = ".GeneratedFilter"; const char kHideDisabledFilesKey[] = ".DisabledFilesFilter"; const char kTrimEmptyDirsKey[] = ".TrimEmptyDirsFilter"; const char kSyncKey[] = ".SyncWithEditor"; -const char kShowSourceGroupsKey[] = ".ShowSourceGroups"; +const char kHideSourceGroupsKey[] = ".HideSourceGroups"; void ProjectTreeWidgetFactory::saveSettings(QtcSettings *settings, int position, QWidget *widget) { @@ -670,9 +670,9 @@ void ProjectTreeWidgetFactory::saveSettings(QtcSettings *settings, int position, settings->setValueWithDefault(baseKey + kTrimEmptyDirsKey, ptw->trimEmptyDirectoriesFilter(), kTrimEmptyDirsDefault); - settings->setValueWithDefault(baseKey + kShowSourceGroupsKey, - ptw->showSourceGroups(), - kShowSourceGroupsDefault); + settings->setValueWithDefault(baseKey + kHideSourceGroupsKey, + ptw->hideSourceGroups(), + kHideSourceGroupsDefault); settings->setValueWithDefault(baseKey + kSyncKey, ptw->autoSynchronization(), kSyncDefault); } @@ -689,7 +689,7 @@ void ProjectTreeWidgetFactory::restoreSettings(QSettings *settings, int position settings->value(baseKey + kHideDisabledFilesKey, kHideDisabledFilesDefault).toBool()); ptw->setTrimEmptyDirectories( settings->value(baseKey + kTrimEmptyDirsKey, kTrimEmptyDirsDefault).toBool()); - ptw->setShowSourceGroups( - settings->value(baseKey + kShowSourceGroupsKey, kShowSourceGroupsDefault).toBool()); + ptw->setHideSourceGroups( + settings->value(baseKey + kHideSourceGroupsKey, kHideSourceGroupsDefault).toBool()); ptw->setAutoSynchronization(settings->value(baseKey + kSyncKey, kSyncDefault).toBool()); } diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h index 8daf6be4b9e..7b3c53c84fa 100644 --- a/src/plugins/projectexplorer/projecttreewidget.h +++ b/src/plugins/projectexplorer/projecttreewidget.h @@ -58,7 +58,7 @@ public: bool generatedFilesFilter(); bool disabledFilesFilter(); bool trimEmptyDirectoriesFilter(); - bool showSourceGroups(); + bool hideSourceGroups(); Node *currentNode(); void sync(ProjectExplorer::Node *node); void showMessage(ProjectExplorer::Node *node, const QString &message); @@ -78,7 +78,7 @@ private: void setGeneratedFilesFilter(bool filter); void setDisabledFilesFilter(bool filter); void setTrimEmptyDirectories(bool filter); - void setShowSourceGroups(bool filter); + void setHideSourceGroups(bool filter); void handleCurrentItemChange(const QModelIndex ¤t); void showContextMenu(const QPoint &pos); @@ -100,7 +100,7 @@ private: QAction *m_filterDisabledFilesAction = nullptr; QAction *m_trimEmptyDirectoriesAction = nullptr; QAction *m_toggleSync = nullptr; - QAction *m_showSourceGroupsAction = nullptr; + QAction *m_hideSourceGroupsAction = nullptr; QString m_modelId; bool m_autoSync = true;