1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "texteditcmake.h"
6#include "stylelspcmake.h"
7#include "stylescicmake.h"
8#include "textedittabwidget/style/stylejsonfile.h"
9
10class TextEditCmakePrivate
11{
12 friend class TextEditCmake;
13 StyleLsp *styleLsp {nullptr};
14 StyleSci *styleSci {nullptr};
15 StyleJsonFile *styleFile {nullptr};
16};
17
18TextEditCmake::TextEditCmake(QWidget *parent)
19 : TextEdit (parent)
20 , d (new TextEditCmakePrivate)
21{
22 d->styleFile = new StyleJsonFile(this);
23 d->styleFile->setLanguage(this->supportLanguage());
24 d->styleFile->setTheme(StyleJsonFile::Theme::get()->Dark);
25 d->styleSci = new StyleSciCmake(this);
26// d->styleLsp = new StyleLspCmake(this);
27}
28
29TextEditCmake::~TextEditCmake()
30{
31 if (d) {
32 if (d->styleLsp)
33 delete d->styleLsp;
34 if (d->styleSci)
35 delete d->styleSci;
36 if (d->styleFile)
37 delete d->styleFile;
38 }
39}
40
41QString TextEditCmake::supportLanguage()
42{
43 return "cmake"; // 向上兼容Scintilla中Lexer
44}
45
46QString TextEditCmake::implLanguage()
47{
48 return "cmake"; // 界面调用兼容
49}
50
51StyleLsp *TextEditCmake::getStyleLsp() const
52{
53 return d->styleLsp;
54}
55
56StyleSci *TextEditCmake::getStyleSci() const
57{
58 return d->styleSci;
59}
60
61StyleJsonFile *TextEditCmake::getStyleFile() const
62{
63 return d->styleFile;
64}
65
66