1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "texteditjava.h"
6#include "stylelspjava.h"
7#include "stylescijava.h"
8#include "textedittabwidget/style/stylejsonfile.h"
9
10class TextEditJavaPrivate
11{
12 friend class TextEditJava;
13 StyleLsp *styleLsp {nullptr};
14 StyleSci *styleSci {nullptr};
15 StyleJsonFile *styleFile {nullptr};
16};
17
18TextEditJava::TextEditJava(QWidget *parent)
19 : TextEdit (parent)
20 , d (new TextEditJavaPrivate)
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 StyleSciJava(this);
26 d->styleLsp = new StyleLspJava(this);
27}
28
29TextEditJava::~TextEditJava()
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 TextEditJava::supportLanguage()
42{
43 return "java"; // 向上兼容Scintilla中Lexer
44}
45
46QString TextEditJava::implLanguage()
47{
48 return "java"; // 界面调用兼容
49}
50
51StyleLsp *TextEditJava::getStyleLsp() const
52{
53 return d->styleLsp;
54}
55
56StyleSci *TextEditJava::getStyleSci() const
57{
58 return d->styleSci;
59}
60
61StyleJsonFile *TextEditJava::getStyleFile() const
62{
63 return d->styleFile;
64}
65