Files
qt-creator/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp
hjk 5e786d444d Meson: Flatten directory hierarchy
Keep tests/ and icons/ but put the rest into the toplevel.

The previous setup was so different from the rest of the bunch that
it regularly stuck out in maintenance tasks.

Change-Id: I69821be6268f69682353a388f6bb1fa343215303
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-10 06:08:57 +00:00

92 lines
2.8 KiB
C++

// Copyright (C) 2020 Alexis Jeandet.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "mesonprojectplugin.h"
#include "machinefilemanager.h"
#include "mesonactionsmanager.h"
#include "mesonbuildconfiguration.h"
#include "mesonproject.h"
#include "mesonrunconfiguration.h"
#include "mesontoolkitaspect.h"
#include "ninjabuildstep.h"
#include "ninjatoolkitaspect.h"
#include "settings.h"
#include "toolssettingsaccessor.h"
#include "toolssettingspage.h"
#include <coreplugin/icore.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/runcontrol.h>
#include <utils/fsengine/fileiconprovider.h>
using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace MesonProjectManager {
namespace Internal {
class MesonProjectPluginPrivate : public QObject
{
Q_OBJECT
public:
MesonProjectPluginPrivate()
{
MesonTools::setTools(m_toolsSettings.loadMesonTools(ICore::dialogParent()));
connect(ICore::instance(),
&ICore::saveSettingsRequested,
this,
&MesonProjectPluginPrivate::saveAll);
}
~MesonProjectPluginPrivate() {}
private:
GeneralSettingsPage m_generalSettingsPage;
ToolsSettingsPage m_toolslSettingsPage;
ToolsSettingsAccessor m_toolsSettings;
MesonToolKitAspect m_mesonKitAspect;
NinjaToolKitAspect m_ninjaKitAspect;
MesonBuildStepFactory m_buildStepFactory;
MesonBuildConfigurationFactory m_buildConfigurationFactory;
MesonRunConfigurationFactory m_runConfigurationFactory;
MesonActionsManager m_actions;
MachineFileManager m_machineFilesManager;
RunWorkerFactory
m_mesonRunWorkerFactory{RunWorkerFactory::make<ProjectExplorer::SimpleTargetRunner>(),
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
{m_runConfigurationFactory.runConfigurationId()}};
void saveAll()
{
m_toolsSettings.saveMesonTools(MesonTools::tools(), ICore::dialogParent());
Settings::instance()->writeSettings(ICore::settings());
}
};
MesonProjectPlugin::~MesonProjectPlugin()
{
delete d;
}
bool MesonProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
Q_UNUSED(errorMessage)
d = new MesonProjectPluginPrivate;
ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE);
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
Settings::instance()->readSettings(ICore::settings());
return true;
}
} // namespace Internal
} // namespace MesonProjectManager
#include "mesonprojectplugin.moc"