2023-05-15 15:15:17 +02:00
|
|
|
// 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"
|
|
|
|
|
|
2023-07-18 12:05:36 +02:00
|
|
|
#include <coreplugin/dialogs/ioptionspage.h>
|
|
|
|
|
|
2023-05-15 15:15:17 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
|
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
namespace Haskell::Internal {
|
|
|
|
|
|
|
|
|
|
HaskellSettings &settings()
|
|
|
|
|
{
|
2023-07-18 12:05:36 +02:00
|
|
|
static HaskellSettings theSettings;
|
|
|
|
|
return theSettings;
|
2023-05-15 15:15:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HaskellSettings::HaskellSettings()
|
|
|
|
|
{
|
2023-07-18 12:05:36 +02:00
|
|
|
setAutoApply(false);
|
2023-05-15 15:15:17 +02:00
|
|
|
|
|
|
|
|
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.
|
2023-06-29 16:45:11 +02:00
|
|
|
stackPath.setDefaultValue(HostOsInfo::isAnyUnixHost()
|
2023-05-15 15:15:17 +02:00
|
|
|
? FilePath::fromString("/usr/local/bin/stack")
|
|
|
|
|
: FilePath::fromString("stack"));
|
|
|
|
|
|
2023-05-17 17:18:11 +02:00
|
|
|
setLayouter([this] {
|
2023-05-15 15:15:17 +02:00
|
|
|
using namespace Layouting;
|
2023-05-17 17:18:11 +02:00
|
|
|
return Column {
|
2023-05-15 15:15:17 +02:00
|
|
|
Group {
|
|
|
|
|
title(Tr::tr("General")),
|
|
|
|
|
Row { Tr::tr("Stack executable:"), stackPath }
|
|
|
|
|
},
|
|
|
|
|
st,
|
2023-05-17 17:18:11 +02:00
|
|
|
};
|
2023-05-15 15:15:17 +02:00
|
|
|
});
|
|
|
|
|
|
2023-05-17 17:18:11 +02:00
|
|
|
readSettings();
|
2023-05-15 15:15:17 +02:00
|
|
|
}
|
|
|
|
|
|
2023-07-18 12:05:36 +02:00
|
|
|
// HaskellSettingsPage
|
|
|
|
|
|
|
|
|
|
class HaskellSettingsPage final : public Core::IOptionsPage
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
HaskellSettingsPage()
|
|
|
|
|
{
|
|
|
|
|
setId(Constants::OPTIONS_GENERAL);
|
|
|
|
|
setDisplayName(Tr::tr("General"));
|
|
|
|
|
setCategory("J.Z.Haskell");
|
|
|
|
|
setDisplayCategory(Tr::tr("Haskell"));
|
|
|
|
|
setCategoryIconPath(":/haskell/images/settingscategory_haskell.png");
|
|
|
|
|
setSettingsProvider([] { return &settings(); });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const HaskellSettingsPage settingsPage;
|
|
|
|
|
|
2023-05-15 15:15:17 +02:00
|
|
|
} // Haskell::Internal
|