From 231e7da7617dbe2ff1811d5dc9f4de8c542a1596 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Sun, 11 Feb 2024 12:53:52 +0100 Subject: [PATCH] Axivion: Drop known namespace specifiers Add more "using namespace". Change-Id: Ib207d14c79c692eb87d52cbc95917539c88f0536 Reviewed-by: Christian Stenger --- src/plugins/axivion/axivionoutputpane.cpp | 10 +++--- src/plugins/axivion/axivionplugin.cpp | 4 +-- .../axivion/axivionprojectsettings.cpp | 32 +++++++++---------- src/plugins/axivion/axivionsettings.cpp | 23 ++++++------- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/plugins/axivion/axivionoutputpane.cpp b/src/plugins/axivion/axivionoutputpane.cpp index ec5ae042292..a9fb3a4e3f4 100644 --- a/src/plugins/axivion/axivionoutputpane.cpp +++ b/src/plugins/axivion/axivionoutputpane.cpp @@ -35,6 +35,8 @@ #include +using namespace Core; +using namespace ProjectExplorer; using namespace Tasking; using namespace Utils; @@ -199,11 +201,11 @@ public: if (role == BaseTreeView::ItemActivatedRole && !m_links.isEmpty()) { // TODO for now only simple - just the first.. Link link = m_links.first(); - ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject(); + Project *project = ProjectManager::startupProject(); FilePath baseDir = project ? project->projectDirectory() : FilePath{}; link.targetFilePath = baseDir.resolvePath(link.targetFilePath); if (link.targetFilePath.exists()) - Core::EditorManager::openEditorAt(link); + EditorManager::openEditorAt(link); return true; } return StaticTreeItem::setData(column, value, role); @@ -591,7 +593,7 @@ void IssuesWidget::fetchMoreIssues() } AxivionOutputPane::AxivionOutputPane(QObject *parent) - : Core::IOutputPane(parent) + : IOutputPane(parent) { setId("Axivion"); setDisplayName(Tr::tr("Axivion")); @@ -702,7 +704,7 @@ void AxivionOutputPane::updateAndShowRule(const QString &ruleHtml) browser->setText(ruleHtml); if (!ruleHtml.isEmpty()) { m_outputWidget->setCurrentIndex(2); - popup(Core::IOutputPane::NoModeSwitch); + popup(IOutputPane::NoModeSwitch); } } } diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index efdfa620789..8d2b869963f 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -169,7 +169,7 @@ public: setLineAnnotation(markText); setActionsProvider([id] { auto action = new QAction; - action->setIcon(Utils::Icons::INFO.icon()); + action->setIcon(Icons::INFO.icon()); action->setToolTip(Tr::tr("Show rule details")); QObject::connect(action, &QAction::triggered, dd, [id] { dd->fetchIssueInfo(id); }); return QList{action}; @@ -480,7 +480,7 @@ Group issueTableRecipe(const IssueListSearch &search, const IssueTableHandler &h return fetchDataRecipe(url, handler); } -Group lineMarkerRecipe(const Utils::FilePath &filePath, const LineMarkerHandler &handler) +Group lineMarkerRecipe(const FilePath &filePath, const LineMarkerHandler &handler) { QTC_ASSERT(dd->m_currentProjectInfo, return {}); // TODO: Call handler with unexpected? QTC_ASSERT(!filePath.isEmpty(), return {}); // TODO: Call handler with unexpected? diff --git a/src/plugins/axivion/axivionprojectsettings.cpp b/src/plugins/axivion/axivionprojectsettings.cpp index a3e3e3f3bc6..14d47eca53a 100644 --- a/src/plugins/axivion/axivionprojectsettings.cpp +++ b/src/plugins/axivion/axivionprojectsettings.cpp @@ -33,7 +33,7 @@ const char PSK_PROJECTNAME[] = "Axivion.ProjectName"; class AxivionProjectSettingsHandler : public QObject { public: - AxivionProjectSettings *projectSettings(ProjectExplorer::Project *project) + AxivionProjectSettings *projectSettings(Project *project) { auto &settings = m_axivionProjectSettings[project]; if (!settings) @@ -47,7 +47,7 @@ public: m_axivionProjectSettings.clear(); } - QHash m_axivionProjectSettings; + QHash m_axivionProjectSettings; }; static AxivionProjectSettingsHandler &projectSettingsHandler() @@ -58,17 +58,15 @@ static AxivionProjectSettingsHandler &projectSettingsHandler() // AxivionProjectSettings -AxivionProjectSettings::AxivionProjectSettings(ProjectExplorer::Project *project) +AxivionProjectSettings::AxivionProjectSettings(Project *project) : m_project{project} { load(); - connect(project, &ProjectExplorer::Project::settingsLoaded, - this, &AxivionProjectSettings::load); - connect(project, &ProjectExplorer::Project::aboutToSaveSettings, - this, &AxivionProjectSettings::save); + connect(project, &Project::settingsLoaded, this, &AxivionProjectSettings::load); + connect(project, &Project::aboutToSaveSettings, this, &AxivionProjectSettings::save); } -AxivionProjectSettings *AxivionProjectSettings::projectSettings(ProjectExplorer::Project *project) +AxivionProjectSettings *AxivionProjectSettings::projectSettings(Project *project) { return projectSettingsHandler().projectSettings(project); } @@ -90,10 +88,10 @@ void AxivionProjectSettings::save() // AxivionProjectSettingsWidget -class AxivionProjectSettingsWidget : public ProjectExplorer::ProjectSettingsWidget +class AxivionProjectSettingsWidget : public ProjectSettingsWidget { public: - explicit AxivionProjectSettingsWidget(ProjectExplorer::Project *project); + explicit AxivionProjectSettingsWidget(Project *project); private: void fetchProjects(); @@ -109,11 +107,11 @@ private: QPushButton *m_fetchProjects = nullptr; QPushButton *m_link = nullptr; QPushButton *m_unlink = nullptr; - Utils::InfoLabel *m_infoLabel = nullptr; + InfoLabel *m_infoLabel = nullptr; TaskTreeRunner m_taskTreeRunner; }; -AxivionProjectSettingsWidget::AxivionProjectSettingsWidget(ProjectExplorer::Project *project) +AxivionProjectSettingsWidget::AxivionProjectSettingsWidget(Project *project) : m_projectSettings(projectSettingsHandler().projectSettings(project)) { setUseGlobalSettingsCheckBoxVisible(false); @@ -132,7 +130,7 @@ AxivionProjectSettingsWidget::AxivionProjectSettingsWidget(ProjectExplorer::Proj verticalLayout->addWidget(new QLabel(Tr::tr("Dashboard projects:"))); verticalLayout->addWidget(m_dashboardProjects); - m_infoLabel = new Utils::InfoLabel(this); + m_infoLabel = new InfoLabel(this); m_infoLabel->setVisible(false); verticalLayout->addWidget(m_infoLabel); @@ -171,7 +169,7 @@ void AxivionProjectSettingsWidget::fetchProjects() const auto onDashboardInfo = [this](const expected_str &info) { if (!info) { m_infoLabel->setText(info.error()); - m_infoLabel->setType(Utils::InfoLabel::Error); + m_infoLabel->setType(InfoLabel::Error); m_infoLabel->setVisible(true); } else { for (const QString &project : info->projects) @@ -234,19 +232,19 @@ void AxivionProjectSettingsWidget::updateEnabledStates() if (!hasDashboardSettings) { m_infoLabel->setText(Tr::tr("Incomplete or misconfigured settings.")); - m_infoLabel->setType(Utils::InfoLabel::NotOk); + m_infoLabel->setType(InfoLabel::NotOk); m_infoLabel->setVisible(true); } } -class AxivionProjectPanelFactory : public ProjectExplorer::ProjectPanelFactory +class AxivionProjectPanelFactory : public ProjectPanelFactory { public: AxivionProjectPanelFactory() { setPriority(250); setDisplayName(Tr::tr("Axivion")); - setCreateWidgetFunction([](ProjectExplorer::Project *project) { + setCreateWidgetFunction([](Project *project) { return new AxivionProjectSettingsWidget(project); }); } diff --git a/src/plugins/axivion/axivionsettings.cpp b/src/plugins/axivion/axivionsettings.cpp index d85178df544..3d95673b9c0 100644 --- a/src/plugins/axivion/axivionsettings.cpp +++ b/src/plugins/axivion/axivionsettings.cpp @@ -20,11 +20,12 @@ #include #include +using namespace Core; using namespace Utils; namespace Axivion::Internal { -AxivionServer::AxivionServer(const Utils::Id &id, const QString &dashboard, +AxivionServer::AxivionServer(const Id &id, const QString &dashboard, const QString &description, const QString &token) : id(id) , dashboard(dashboard) @@ -68,17 +69,17 @@ AxivionServer AxivionServer::fromJson(const QJsonObject &json) const QJsonValue token = json.value("token"); if (token == QJsonValue::Undefined) return invalidServer; - return { Utils::Id::fromString(id.toString()), dashboard.toString(), + return { Id::fromString(id.toString()), dashboard.toString(), description.toString(), token.toString() }; } -static Utils::FilePath tokensFilePath() +static FilePath tokensFilePath() { - return Utils::FilePath::fromString(Core::ICore::settings()->fileName()).parentDir() + return FilePath::fromString(ICore::settings()->fileName()).parentDir() .pathAppended("qtcreator/axivion.json"); } -static void writeTokenFile(const Utils::FilePath &filePath, const AxivionServer &server) +static void writeTokenFile(const FilePath &filePath, const AxivionServer &server) { QJsonDocument doc; doc.setObject(server.toJson()); @@ -87,11 +88,11 @@ static void writeTokenFile(const Utils::FilePath &filePath, const AxivionServer filePath.setPermissions(QFile::ReadUser | QFile::WriteUser); } -static AxivionServer readTokenFile(const Utils::FilePath &filePath) +static AxivionServer readTokenFile(const FilePath &filePath) { if (!filePath.exists()) return {}; - Utils::expected_str contents = filePath.fileContents(); + expected_str contents = filePath.fileContents(); if (!contents) return {}; const QJsonDocument doc = QJsonDocument::fromJson(*contents); @@ -120,7 +121,7 @@ AxivionSettings::AxivionSettings() void AxivionSettings::toSettings() const { writeTokenFile(tokensFilePath(), server); - Utils::AspectContainer::writeSettings(); + AspectContainer::writeSettings(); } // AxivionSettingsPage @@ -214,7 +215,7 @@ AxivionServer DashboardSettingsWidget::dashboardServer() const if (m_id.isValid()) result.id = m_id; else - result.id = m_mode == Edit ? Utils::Id::fromName(QUuid::createUuid().toByteArray()) : m_id; + result.id = m_mode == Edit ? Id::fromName(QUuid::createUuid().toByteArray()) : m_id; result.dashboard = m_dashboardUrl(); result.description = m_description(); result.token = m_token(); @@ -234,7 +235,7 @@ bool DashboardSettingsWidget::isValid() const return !m_token().isEmpty() && !m_description().isEmpty() && isUrlValid(m_dashboardUrl()); } -class AxivionSettingsWidget : public Core::IOptionsPageWidget +class AxivionSettingsWidget : public IOptionsPageWidget { public: AxivionSettingsWidget(); @@ -299,7 +300,7 @@ void AxivionSettingsWidget::showEditServerDialog() // AxivionSettingsPage -class AxivionSettingsPage : public Core::IOptionsPage +class AxivionSettingsPage : public IOptionsPage { public: AxivionSettingsPage()