aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/mesonprojectmanager/settings.cpp
blob: b233ae3c48b876f210e98c387eceb197f4dc873d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (C) 2020 Alexis Jeandet.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "settings.h"

#include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h"

#include <coreplugin/dialogs/ioptionspage.h>

#include <utils/layoutbuilder.h>

namespace MesonProjectManager::Internal {

MesonSettings &settings()
{
    static MesonSettings theSettings;
    return theSettings;
}

MesonSettings::MesonSettings()
{
    setAutoApply(false);
    setSettingsGroup("MesonProjectManager");

    autorunMeson.setSettingsKey("meson.autorun");
    autorunMeson.setLabelText(Tr::tr("Autorun Meson"));
    autorunMeson.setToolTip(Tr::tr("Automatically run Meson when needed."));

    verboseNinja.setSettingsKey("ninja.verbose");
    verboseNinja.setLabelText(Tr::tr("Ninja verbose mode"));
    verboseNinja.setToolTip(Tr::tr("Enables verbose mode by default when invoking Ninja."));

    setLayouter([this] {
        using namespace Layouting;
        return Column {
            autorunMeson,
            verboseNinja,
            st,
        };
    });

    readSettings();
}

class MesonSettingsPage final : public Core::IOptionsPage
{
public:
    MesonSettingsPage()
    {
        setId("A.MesonProjectManager.SettingsPage.General");
        setDisplayName(Tr::tr("General"));
        setDisplayCategory("Meson");
        setCategory(Constants::SettingsPage::CATEGORY);
        setCategoryIconPath(Constants::Icons::MESON_BW);
        setSettingsProvider([] { return &settings(); });
    }
};

const MesonSettingsPage settingsPage;

} // MesonProjectManager::Internal