aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nim/settings/nimcodestylepreferencesfactory.cpp
blob: 1930a25f42de86c1329de0607fc4df014651bbc4 (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
63
64
65
66
// Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "nimcodestylepreferencesfactory.h"
#include "nimcodestylepreferenceswidget.h"

#include "../nimconstants.h"
#include "../editor/nimindenter.h"

#include <utils/id.h>

#include <texteditor/simplecodestylepreferences.h>

#include <QWidget>
#include <QLayout>

using namespace TextEditor;

namespace Nim {

NimCodeStylePreferencesFactory::NimCodeStylePreferencesFactory()
{
}

Utils::Id NimCodeStylePreferencesFactory::languageId()
{
    return Constants::C_NIMLANGUAGE_ID;
}

QString NimCodeStylePreferencesFactory::displayName()
{
    return tr(Constants::C_NIMLANGUAGE_NAME);
}

TextEditor::ICodeStylePreferences *NimCodeStylePreferencesFactory::createCodeStyle() const
{
    return new TextEditor::SimpleCodeStylePreferences();
}

TextEditor::CodeStyleEditorWidget *NimCodeStylePreferencesFactory::createEditor(
    TextEditor::ICodeStylePreferences *preferences,
    ProjectExplorer::Project *project,
    QWidget *parent) const
{
    Q_UNUSED(project)
    auto result = new NimCodeStylePreferencesWidget(preferences, parent);
    result->layout()->setContentsMargins(0, 0, 0, 0);
    return result;
}

TextEditor::Indenter *NimCodeStylePreferencesFactory::createIndenter(QTextDocument *doc) const
{
    return new NimIndenter(doc);
}

QString NimCodeStylePreferencesFactory::snippetProviderGroupId() const
{
    return Nim::Constants::C_NIMSNIPPETSGROUP_ID;
}

QString NimCodeStylePreferencesFactory::previewText() const
{
    return QLatin1String(Nim::Constants::C_NIMCODESTYLEPREVIEWSNIPPET);
}

}