Axivion: Drop known namespace specifiers

Add more "using namespace".

Change-Id: Ib207d14c79c692eb87d52cbc95917539c88f0536
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2024-02-11 12:53:52 +01:00
parent 9c4bd40f7c
commit 231e7da761
4 changed files with 35 additions and 34 deletions

View File

@@ -35,6 +35,8 @@
#include <map> #include <map>
using namespace Core;
using namespace ProjectExplorer;
using namespace Tasking; using namespace Tasking;
using namespace Utils; using namespace Utils;
@@ -199,11 +201,11 @@ public:
if (role == BaseTreeView::ItemActivatedRole && !m_links.isEmpty()) { if (role == BaseTreeView::ItemActivatedRole && !m_links.isEmpty()) {
// TODO for now only simple - just the first.. // TODO for now only simple - just the first..
Link link = m_links.first(); Link link = m_links.first();
ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject(); Project *project = ProjectManager::startupProject();
FilePath baseDir = project ? project->projectDirectory() : FilePath{}; FilePath baseDir = project ? project->projectDirectory() : FilePath{};
link.targetFilePath = baseDir.resolvePath(link.targetFilePath); link.targetFilePath = baseDir.resolvePath(link.targetFilePath);
if (link.targetFilePath.exists()) if (link.targetFilePath.exists())
Core::EditorManager::openEditorAt(link); EditorManager::openEditorAt(link);
return true; return true;
} }
return StaticTreeItem::setData(column, value, role); return StaticTreeItem::setData(column, value, role);
@@ -591,7 +593,7 @@ void IssuesWidget::fetchMoreIssues()
} }
AxivionOutputPane::AxivionOutputPane(QObject *parent) AxivionOutputPane::AxivionOutputPane(QObject *parent)
: Core::IOutputPane(parent) : IOutputPane(parent)
{ {
setId("Axivion"); setId("Axivion");
setDisplayName(Tr::tr("Axivion")); setDisplayName(Tr::tr("Axivion"));
@@ -702,7 +704,7 @@ void AxivionOutputPane::updateAndShowRule(const QString &ruleHtml)
browser->setText(ruleHtml); browser->setText(ruleHtml);
if (!ruleHtml.isEmpty()) { if (!ruleHtml.isEmpty()) {
m_outputWidget->setCurrentIndex(2); m_outputWidget->setCurrentIndex(2);
popup(Core::IOutputPane::NoModeSwitch); popup(IOutputPane::NoModeSwitch);
} }
} }
} }

View File

@@ -169,7 +169,7 @@ public:
setLineAnnotation(markText); setLineAnnotation(markText);
setActionsProvider([id] { setActionsProvider([id] {
auto action = new QAction; auto action = new QAction;
action->setIcon(Utils::Icons::INFO.icon()); action->setIcon(Icons::INFO.icon());
action->setToolTip(Tr::tr("Show rule details")); action->setToolTip(Tr::tr("Show rule details"));
QObject::connect(action, &QAction::triggered, dd, [id] { dd->fetchIssueInfo(id); }); QObject::connect(action, &QAction::triggered, dd, [id] { dd->fetchIssueInfo(id); });
return QList{action}; return QList{action};
@@ -480,7 +480,7 @@ Group issueTableRecipe(const IssueListSearch &search, const IssueTableHandler &h
return fetchDataRecipe<Dto::IssueTableDto>(url, handler); return fetchDataRecipe<Dto::IssueTableDto>(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(dd->m_currentProjectInfo, return {}); // TODO: Call handler with unexpected?
QTC_ASSERT(!filePath.isEmpty(), return {}); // TODO: Call handler with unexpected? QTC_ASSERT(!filePath.isEmpty(), return {}); // TODO: Call handler with unexpected?

View File

@@ -33,7 +33,7 @@ const char PSK_PROJECTNAME[] = "Axivion.ProjectName";
class AxivionProjectSettingsHandler : public QObject class AxivionProjectSettingsHandler : public QObject
{ {
public: public:
AxivionProjectSettings *projectSettings(ProjectExplorer::Project *project) AxivionProjectSettings *projectSettings(Project *project)
{ {
auto &settings = m_axivionProjectSettings[project]; auto &settings = m_axivionProjectSettings[project];
if (!settings) if (!settings)
@@ -47,7 +47,7 @@ public:
m_axivionProjectSettings.clear(); m_axivionProjectSettings.clear();
} }
QHash<ProjectExplorer::Project *, AxivionProjectSettings *> m_axivionProjectSettings; QHash<Project *, AxivionProjectSettings *> m_axivionProjectSettings;
}; };
static AxivionProjectSettingsHandler &projectSettingsHandler() static AxivionProjectSettingsHandler &projectSettingsHandler()
@@ -58,17 +58,15 @@ static AxivionProjectSettingsHandler &projectSettingsHandler()
// AxivionProjectSettings // AxivionProjectSettings
AxivionProjectSettings::AxivionProjectSettings(ProjectExplorer::Project *project) AxivionProjectSettings::AxivionProjectSettings(Project *project)
: m_project{project} : m_project{project}
{ {
load(); load();
connect(project, &ProjectExplorer::Project::settingsLoaded, connect(project, &Project::settingsLoaded, this, &AxivionProjectSettings::load);
this, &AxivionProjectSettings::load); connect(project, &Project::aboutToSaveSettings, this, &AxivionProjectSettings::save);
connect(project, &ProjectExplorer::Project::aboutToSaveSettings,
this, &AxivionProjectSettings::save);
} }
AxivionProjectSettings *AxivionProjectSettings::projectSettings(ProjectExplorer::Project *project) AxivionProjectSettings *AxivionProjectSettings::projectSettings(Project *project)
{ {
return projectSettingsHandler().projectSettings(project); return projectSettingsHandler().projectSettings(project);
} }
@@ -90,10 +88,10 @@ void AxivionProjectSettings::save()
// AxivionProjectSettingsWidget // AxivionProjectSettingsWidget
class AxivionProjectSettingsWidget : public ProjectExplorer::ProjectSettingsWidget class AxivionProjectSettingsWidget : public ProjectSettingsWidget
{ {
public: public:
explicit AxivionProjectSettingsWidget(ProjectExplorer::Project *project); explicit AxivionProjectSettingsWidget(Project *project);
private: private:
void fetchProjects(); void fetchProjects();
@@ -109,11 +107,11 @@ private:
QPushButton *m_fetchProjects = nullptr; QPushButton *m_fetchProjects = nullptr;
QPushButton *m_link = nullptr; QPushButton *m_link = nullptr;
QPushButton *m_unlink = nullptr; QPushButton *m_unlink = nullptr;
Utils::InfoLabel *m_infoLabel = nullptr; InfoLabel *m_infoLabel = nullptr;
TaskTreeRunner m_taskTreeRunner; TaskTreeRunner m_taskTreeRunner;
}; };
AxivionProjectSettingsWidget::AxivionProjectSettingsWidget(ProjectExplorer::Project *project) AxivionProjectSettingsWidget::AxivionProjectSettingsWidget(Project *project)
: m_projectSettings(projectSettingsHandler().projectSettings(project)) : m_projectSettings(projectSettingsHandler().projectSettings(project))
{ {
setUseGlobalSettingsCheckBoxVisible(false); setUseGlobalSettingsCheckBoxVisible(false);
@@ -132,7 +130,7 @@ AxivionProjectSettingsWidget::AxivionProjectSettingsWidget(ProjectExplorer::Proj
verticalLayout->addWidget(new QLabel(Tr::tr("Dashboard projects:"))); verticalLayout->addWidget(new QLabel(Tr::tr("Dashboard projects:")));
verticalLayout->addWidget(m_dashboardProjects); verticalLayout->addWidget(m_dashboardProjects);
m_infoLabel = new Utils::InfoLabel(this); m_infoLabel = new InfoLabel(this);
m_infoLabel->setVisible(false); m_infoLabel->setVisible(false);
verticalLayout->addWidget(m_infoLabel); verticalLayout->addWidget(m_infoLabel);
@@ -171,7 +169,7 @@ void AxivionProjectSettingsWidget::fetchProjects()
const auto onDashboardInfo = [this](const expected_str<DashboardInfo> &info) { const auto onDashboardInfo = [this](const expected_str<DashboardInfo> &info) {
if (!info) { if (!info) {
m_infoLabel->setText(info.error()); m_infoLabel->setText(info.error());
m_infoLabel->setType(Utils::InfoLabel::Error); m_infoLabel->setType(InfoLabel::Error);
m_infoLabel->setVisible(true); m_infoLabel->setVisible(true);
} else { } else {
for (const QString &project : info->projects) for (const QString &project : info->projects)
@@ -234,19 +232,19 @@ void AxivionProjectSettingsWidget::updateEnabledStates()
if (!hasDashboardSettings) { if (!hasDashboardSettings) {
m_infoLabel->setText(Tr::tr("Incomplete or misconfigured settings.")); m_infoLabel->setText(Tr::tr("Incomplete or misconfigured settings."));
m_infoLabel->setType(Utils::InfoLabel::NotOk); m_infoLabel->setType(InfoLabel::NotOk);
m_infoLabel->setVisible(true); m_infoLabel->setVisible(true);
} }
} }
class AxivionProjectPanelFactory : public ProjectExplorer::ProjectPanelFactory class AxivionProjectPanelFactory : public ProjectPanelFactory
{ {
public: public:
AxivionProjectPanelFactory() AxivionProjectPanelFactory()
{ {
setPriority(250); setPriority(250);
setDisplayName(Tr::tr("Axivion")); setDisplayName(Tr::tr("Axivion"));
setCreateWidgetFunction([](ProjectExplorer::Project *project) { setCreateWidgetFunction([](Project *project) {
return new AxivionProjectSettingsWidget(project); return new AxivionProjectSettingsWidget(project);
}); });
} }

View File

@@ -20,11 +20,12 @@
#include <QUuid> #include <QUuid>
#include <QVBoxLayout> #include <QVBoxLayout>
using namespace Core;
using namespace Utils; using namespace Utils;
namespace Axivion::Internal { 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) const QString &description, const QString &token)
: id(id) : id(id)
, dashboard(dashboard) , dashboard(dashboard)
@@ -68,17 +69,17 @@ AxivionServer AxivionServer::fromJson(const QJsonObject &json)
const QJsonValue token = json.value("token"); const QJsonValue token = json.value("token");
if (token == QJsonValue::Undefined) if (token == QJsonValue::Undefined)
return invalidServer; return invalidServer;
return { Utils::Id::fromString(id.toString()), dashboard.toString(), return { Id::fromString(id.toString()), dashboard.toString(),
description.toString(), token.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"); .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; QJsonDocument doc;
doc.setObject(server.toJson()); doc.setObject(server.toJson());
@@ -87,11 +88,11 @@ static void writeTokenFile(const Utils::FilePath &filePath, const AxivionServer
filePath.setPermissions(QFile::ReadUser | QFile::WriteUser); filePath.setPermissions(QFile::ReadUser | QFile::WriteUser);
} }
static AxivionServer readTokenFile(const Utils::FilePath &filePath) static AxivionServer readTokenFile(const FilePath &filePath)
{ {
if (!filePath.exists()) if (!filePath.exists())
return {}; return {};
Utils::expected_str<QByteArray> contents = filePath.fileContents(); expected_str<QByteArray> contents = filePath.fileContents();
if (!contents) if (!contents)
return {}; return {};
const QJsonDocument doc = QJsonDocument::fromJson(*contents); const QJsonDocument doc = QJsonDocument::fromJson(*contents);
@@ -120,7 +121,7 @@ AxivionSettings::AxivionSettings()
void AxivionSettings::toSettings() const void AxivionSettings::toSettings() const
{ {
writeTokenFile(tokensFilePath(), server); writeTokenFile(tokensFilePath(), server);
Utils::AspectContainer::writeSettings(); AspectContainer::writeSettings();
} }
// AxivionSettingsPage // AxivionSettingsPage
@@ -214,7 +215,7 @@ AxivionServer DashboardSettingsWidget::dashboardServer() const
if (m_id.isValid()) if (m_id.isValid())
result.id = m_id; result.id = m_id;
else 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.dashboard = m_dashboardUrl();
result.description = m_description(); result.description = m_description();
result.token = m_token(); result.token = m_token();
@@ -234,7 +235,7 @@ bool DashboardSettingsWidget::isValid() const
return !m_token().isEmpty() && !m_description().isEmpty() && isUrlValid(m_dashboardUrl()); return !m_token().isEmpty() && !m_description().isEmpty() && isUrlValid(m_dashboardUrl());
} }
class AxivionSettingsWidget : public Core::IOptionsPageWidget class AxivionSettingsWidget : public IOptionsPageWidget
{ {
public: public:
AxivionSettingsWidget(); AxivionSettingsWidget();
@@ -299,7 +300,7 @@ void AxivionSettingsWidget::showEditServerDialog()
// AxivionSettingsPage // AxivionSettingsPage
class AxivionSettingsPage : public Core::IOptionsPage class AxivionSettingsPage : public IOptionsPage
{ {
public: public:
AxivionSettingsPage() AxivionSettingsPage()