aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/haskell/haskellsettings.cpp
blob: 7b2bbc7fd389381058f28003abf490d7c3d1cdc2 (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
// Copyright (c) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "haskellsettings.h"

#include "haskellconstants.h"
#include "haskelltr.h"

#include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h>

using namespace Utils;

namespace Haskell::Internal {

static HaskellSettings *theSettings;

HaskellSettings &settings()
{
    return *theSettings;
}

HaskellSettings::HaskellSettings()
{
    theSettings = this;

    setId(Constants::OPTIONS_GENERAL);
    setDisplayName(Tr::tr("General"));
    setCategory("J.Z.Haskell");
    setDisplayCategory(Tr::tr("Haskell"));
    setCategoryIconPath(":/haskell/images/settingscategory_haskell.png");

    stackPath.setSettingsKey("Haskell/StackExecutable");
    stackPath.setExpectedKind(PathChooser::ExistingCommand);
    stackPath.setPromptDialogTitle(Tr::tr("Choose Stack Executable"));
    stackPath.setCommandVersionArguments({"--version"});

    // stack from brew or the installer script from https://docs.haskellstack.org
    // install to /usr/local/bin.
    stackPath.setDefaultFilePath(HostOsInfo::isAnyUnixHost()
        ? FilePath::fromString("/usr/local/bin/stack")
        : FilePath::fromString("stack"));

    setLayouter([this] {
        using namespace Layouting;
        return Column {
            Group {
                title(Tr::tr("General")),
                Row { Tr::tr("Stack executable:"), stackPath }
            },
            st,
        };
    });

    readSettings();
}

} // Haskell::Internal