feat: 初步适配 AngelScript ,增加代码填充功能,但目前未正常工作

This commit is contained in:
寂静的羽夏 2024-10-15 21:13:52 +08:00
parent b2d03972b8
commit 8c866d090f
37 changed files with 184 additions and 364 deletions

View File

@ -93,7 +93,7 @@ add_library(QCodeEditor2 STATIC ${SOURCE_FILES} ${DOCUMENT_SRC} ${WIDGETS_SRC}
${QNFA_SRC} ${SNIPPET_SRC}) ${QNFA_SRC} ${SNIPPET_SRC})
target_compile_definitions(QCodeEditor2 PUBLIC _QCODE_EDIT_BUILD_ target_compile_definitions(QCodeEditor2 PUBLIC _QCODE_EDIT_BUILD_
_QCODE_EDIT_EMBED_) _QCODE_EDIT_EMBED_ _QCODE_MODEL_)
target_include_directories( target_include_directories(
QCodeEditor2 QCodeEditor2
@ -106,4 +106,5 @@ target_include_directories(
target_link_libraries( target_link_libraries(
QCodeEditor2 QCodeEditor2
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::PrintSupport) Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::PrintSupport
QCodeModel2)

View File

@ -272,7 +272,7 @@ void QCodeCompletionEngine::complete(const QDocumentCursor &c,
Q_UNUSED(trigger) Q_UNUSED(trigger)
qWarning("From complete(QDocumentCursor, QString)"); qWarning("From complete(QDocumentCursor, QString)");
qWarning("QCodeCompletionEngine is not self-sufficient : subclasses should " qWarning("QCodeCompletionEngine is not self-sufficient : subclasses should "
"reimplement at least on of the complete() method..."); "reimplement at least one of the complete() method...");
#endif #endif
} }

View File

@ -40,7 +40,8 @@ add_library(
qcodebuffer.cpp qcodebuffer.cpp
qcodelexer.cpp qcodelexer.cpp
qcodeparser.cpp qcodeparser.cpp
qcodeloader.cpp) qcodeloader.cpp
resources.qrc)
target_include_directories(QCodeModel2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(QCodeModel2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

View File

@ -36,7 +36,7 @@ class QCM_EXPORT QCodeLoader : public QThread {
Q_OBJECT Q_OBJECT
public: public:
QCodeLoader(QObject *p = 0); QCodeLoader(QObject *p = nullptr);
virtual ~QCodeLoader(); virtual ~QCodeLoader();
public slots: public slots:

View File

@ -343,8 +343,7 @@ bool QCodeModel::isCachable(QCodeNode *n, QByteArray &cxt) const {
cxt += qn; cxt += qn;
return true; return true;
} else if ((t == QCodeNode::Enum) || (t == QCodeNode::Union) || } else if ((t == QCodeNode::Enum) || (t == QCodeNode::Class) ||
(t == QCodeNode::Class) || (t == QCodeNode::Struct) ||
(t == QCodeNode::Typedef)) { (t == QCodeNode::Typedef)) {
cxt += qn; cxt += qn;

View File

@ -26,9 +26,7 @@
enum CacheIndex { enum CacheIndex {
ICON_ENUM, ICON_ENUM,
ICON_ENUMERATOR, ICON_ENUMERATOR,
ICON_UNION,
ICON_CLASS, ICON_CLASS,
ICON_STRUCT,
ICON_TYPEDEF, ICON_TYPEDEF,
ICON_NAMESPACE, ICON_NAMESPACE,
ICON_FUNCTION = ICON_NAMESPACE + 2, ICON_FUNCTION = ICON_NAMESPACE + 2,
@ -41,15 +39,11 @@ static QIcon icon(int cacheIndex) {
static bool setup = false; static bool setup = false;
if (!setup) { if (!setup) {
q_icon_cache[ICON_UNION] = QIcon(":/completion/CVunion.png");
q_icon_cache[ICON_ENUM] = QIcon(":/completion/CVenum.png"); q_icon_cache[ICON_ENUM] = QIcon(":/completion/CVenum.png");
q_icon_cache[ICON_ENUMERATOR] = QIcon(":/completion/CVenumerator.png"); q_icon_cache[ICON_ENUMERATOR] = QIcon(":/completion/CVenumerator.png");
q_icon_cache[ICON_CLASS] = QIcon(":/completion/CVclass.png"); q_icon_cache[ICON_CLASS] = QIcon(":/completion/CVclass.png");
q_icon_cache[ICON_STRUCT] = QIcon(":/completion/CVstruct.png");
q_icon_cache[ICON_TYPEDEF] = QIcon(":/completion/CVtypedef.png"); q_icon_cache[ICON_TYPEDEF] = QIcon(":/completion/CVtypedef.png");
q_icon_cache[ICON_NAMESPACE] = QIcon(":/completion/CVnamespace.png"); q_icon_cache[ICON_NAMESPACE] = QIcon(":/completion/CVnamespace.png");
@ -66,9 +60,6 @@ static QIcon icon(int cacheIndex) {
q_icon_cache[ICON_FUNCTION + QCodeNode::VISIBILITY_PRIVATE] = q_icon_cache[ICON_FUNCTION + QCodeNode::VISIBILITY_PRIVATE] =
QIcon(":/completion/CVprivate_meth.png"); QIcon(":/completion/CVprivate_meth.png");
q_icon_cache[ICON_FUNCTION + QCodeNode::VISIBILITY_SIGNAL] =
QIcon(":/completion/CVprotected_signal.png");
q_icon_cache[ICON_VARIABLE + QCodeNode::VISIBILITY_DEFAULT] = q_icon_cache[ICON_VARIABLE + QCodeNode::VISIBILITY_DEFAULT] =
QIcon(":/completion/CVglobal_var.png"); QIcon(":/completion/CVglobal_var.png");
@ -358,27 +349,12 @@ QVariant QCodeNode::data(int r) const {
return d; return d;
} }
case Struct: {
QByteArray d("struct ");
d += role(Name);
QByteArray a = role(Ancestors);
if (a.length())
d += " : " + a;
return d;
}
case Enum: case Enum:
return QByteArray("enum ") + role(Name); return QByteArray("enum ") + role(Name);
case Enumerator: case Enumerator:
return role(Name) + " = " + role(Value); return role(Name) + " = " + role(Value);
case Union:
return QByteArray("union ") + role(Name);
case Namespace: case Namespace:
return QByteArray("namespace ") + role(Name); return QByteArray("namespace ") + role(Name);
@ -406,20 +382,12 @@ QVariant QCodeNode::data(int r) const {
// storage class // storage class
if (m_specifiers & QCodeNode::SPECIFIER_AUTO) if (m_specifiers & QCodeNode::SPECIFIER_AUTO)
specifier += " auto "; specifier += " auto ";
else if (m_specifiers & QCodeNode::SPECIFIER_REGISTER)
specifier += " register ";
else if (m_specifiers & QCodeNode::SPECIFIER_STATIC)
specifier += " static ";
else if (m_specifiers & QCodeNode::SPECIFIER_EXTERN) else if (m_specifiers & QCodeNode::SPECIFIER_EXTERN)
specifier += " extern "; specifier += " extern ";
else if (m_specifiers & QCodeNode::SPECIFIER_MUTABLE)
specifier += " mutable ";
// cv qualifier (for class members) // cv qualifier (for class members)
if (m_specifiers & QCodeNode::SPECIFIER_CONST) if (m_specifiers & QCodeNode::SPECIFIER_CONST)
specifier += " const "; specifier += " const ";
else if (m_specifiers & QCodeNode::SPECIFIER_VOLATILE)
specifier += " volatile ";
if (specifier.length()) if (specifier.length())
signature += " [" + specifier.simplified() + "]"; signature += " [" + specifier.simplified() + "]";
@ -444,17 +412,6 @@ QVariant QCodeNode::data(int r) const {
if (m_qualifiers & QCodeNode::QUALIFIER_CONST) if (m_qualifiers & QCodeNode::QUALIFIER_CONST)
qualifier += " const "; qualifier += " const ";
else if (m_qualifiers & QCodeNode::QUALIFIER_VOLATILE)
qualifier += " volatile ";
else if (m_qualifiers & QCodeNode::QUALIFIER_STATIC)
qualifier += " static ";
if (m_qualifiers & QCodeNode::QUALIFIER_PURE_VIRTUAL)
qualifier.prepend(" pure virtual ");
else if (m_qualifiers & QCodeNode::QUALIFIER_INLINE)
qualifier.prepend(" inline ");
else if (m_qualifiers & QCodeNode::QUALIFIER_VIRTUAL)
qualifier.prepend(" virtual ");
int m_visibility = role(Visibility).toInt(); int m_visibility = role(Visibility).toInt();
@ -462,8 +419,6 @@ QVariant QCodeNode::data(int r) const {
qualifier.prepend(" public "); qualifier.prepend(" public ");
else if (m_visibility == QCodeNode::VISIBILITY_PROTECTED) else if (m_visibility == QCodeNode::VISIBILITY_PROTECTED)
qualifier.prepend(" protected "); qualifier.prepend(" protected ");
else if (m_visibility == QCodeNode::VISIBILITY_SIGNAL)
qualifier.prepend(" signal ");
else if (m_visibility == QCodeNode::VISIBILITY_PRIVATE) else if (m_visibility == QCodeNode::VISIBILITY_PRIVATE)
qualifier.prepend(" private "); qualifier.prepend(" private ");
else else
@ -495,18 +450,12 @@ QVariant QCodeNode::data(int r) const {
case Class: case Class:
return icon(ICON_CLASS); return icon(ICON_CLASS);
case Struct:
return icon(ICON_STRUCT);
case Enum: case Enum:
return icon(ICON_ENUM); return icon(ICON_ENUM);
case Enumerator: case Enumerator:
return icon(ICON_ENUMERATOR); return icon(ICON_ENUMERATOR);
case Union:
return icon(ICON_UNION);
case Namespace: case Namespace:
return icon(ICON_NAMESPACE); return icon(ICON_NAMESPACE);

View File

@ -62,7 +62,6 @@ struct QCM_EXPORT QCodeNode {
Language = 'l', Language = 'l',
Class = 'c', Class = 'c',
Struct = 's',
Function = 'f', Function = 'f',
@ -71,8 +70,6 @@ struct QCM_EXPORT QCodeNode {
Enum = 'e', Enum = 'e',
Enumerator = 'r', Enumerator = 'r',
Union = 'u',
Namespace = 'n', Namespace = 'n',
Typedef = 't' Typedef = 't'
@ -87,7 +84,6 @@ struct QCM_EXPORT QCodeNode {
enum NodeVisibility { enum NodeVisibility {
VISIBILITY_DEFAULT = -1, VISIBILITY_DEFAULT = -1,
VISIBILITY_PUBLIC, VISIBILITY_PUBLIC,
VISIBILITY_SIGNAL,
VISIBILITY_PROTECTED, VISIBILITY_PROTECTED,
VISIBILITY_PRIVATE VISIBILITY_PRIVATE
}; };
@ -95,11 +91,7 @@ struct QCM_EXPORT QCodeNode {
enum Specifier { enum Specifier {
SPECIFIER_NONE = 0, SPECIFIER_NONE = 0,
SPECIFIER_CONST = 1, SPECIFIER_CONST = 1,
SPECIFIER_VOLATILE = 2,
SPECIFIER_MUTABLE = 4,
SPECIFIER_AUTO = 8, SPECIFIER_AUTO = 8,
SPECIFIER_STATIC = 16,
SPECIFIER_REGISTER = 32,
SPECIFIER_EXTERN = 64 SPECIFIER_EXTERN = 64
}; };
@ -108,12 +100,8 @@ struct QCM_EXPORT QCodeNode {
enum Qualifier { enum Qualifier {
QUALIFIER_NONE = 0, QUALIFIER_NONE = 0,
QUALIFIER_CONST = 1, QUALIFIER_CONST = 1,
QUALIFIER_VOLATILE = 2, QUALIFIER_ABSTRACT = 2,
QUALIFIER_STATIC = 4, QUALIFIER_EXTERN = 8
QUALIFIER_EXTERN = 8,
QUALIFIER_VIRTUAL = 16,
QUALIFIER_PURE_VIRTUAL = 32,
QUALIFIER_INLINE = 64
}; };
typedef QFlags<Qualifier> FunctionQualifier; typedef QFlags<Qualifier> FunctionQualifier;

View File

@ -26,7 +26,6 @@
static QList<int> priority = QList<int>() static QList<int> priority = QList<int>()
<< QCodeNode::Group << QCodeNode::Language << QCodeNode::Group << QCodeNode::Language
<< QCodeNode::Namespace << QCodeNode::Class << QCodeNode::Namespace << QCodeNode::Class
<< QCodeNode::Struct << QCodeNode::Union
<< QCodeNode::Enum << QCodeNode::Typedef << QCodeNode::Enum << QCodeNode::Typedef
<< QCodeNode::Function << QCodeNode::Variable; << QCodeNode::Function << QCodeNode::Variable;

View File

@ -29,7 +29,7 @@ class QCM_EXPORT QCodeProxyModel : public QSortFilterProxyModel {
Q_OBJECT Q_OBJECT
public: public:
QCodeProxyModel(QObject *p = 0); QCodeProxyModel(QObject *p = nullptr);
virtual ~QCodeProxyModel(); virtual ~QCodeProxyModel();
protected: protected:

20
3rdparty/qcodemodel2/resources.qrc vendored Normal file
View File

@ -0,0 +1,20 @@
<RCC>
<qresource prefix="/">
<file>completion/CVclass.png</file>
<file>completion/CVenum.png</file>
<file>completion/CVenumerator.png</file>
<file>completion/CVglobal_meth.png</file>
<file>completion/CVglobal_var.png</file>
<file>completion/CVnamespace.png</file>
<file>completion/CVpackage_meth.png</file>
<file>completion/CVpackage_var.png</file>
<file>completion/CVprivate_meth.png</file>
<file>completion/CVprivate_var.png</file>
<file>completion/CVprotected_meth.png</file>
<file>completion/CVprotected_var.png</file>
<file>completion/CVpublic_meth.png</file>
<file>completion/CVpublic_var.png</file>
<file>completion/CVtypedef.png</file>
<file>completion/classnew.png</file>
</qresource>
</RCC>

View File

@ -4293,375 +4293,375 @@ Do you want them to be saved?</source>
<context> <context>
<name>ScriptingDialog</name> <name>ScriptingDialog</name>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="92"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="109"/>
<source>ScriptEditor</source> <source>ScriptEditor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="173"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="190"/>
<source>ScriptPermissionDenied</source> <source>ScriptPermissionDenied</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="219"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="236"/>
<source>File</source> <source>File</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="220"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="237"/>
<source>Edit</source> <source>Edit</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="222"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="239"/>
<source>Debugger</source> <source>Debugger</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="226"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="243"/>
<source>About</source> <source>About</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="239"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="256"/>
<source>Basic</source> <source>Basic</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="240"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="257"/>
<source>New</source> <source>New</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="243"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="260"/>
<source>OpenF</source> <source>OpenF</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="246"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="263"/>
<source>RecentFiles</source> <source>RecentFiles</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="250"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="267"/>
<source>Reload</source> <source>Reload</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="255"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="272"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="257"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="274"/>
<source>Save</source> <source>Save</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="262"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="279"/>
<source>SaveAs</source> <source>SaveAs</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="274"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="291"/>
<source>General</source> <source>General</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="276"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="293"/>
<source>Undo</source> <source>Undo</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="281"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="298"/>
<source>Redo</source> <source>Redo</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="287"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="304"/>
<source>Cut</source> <source>Cut</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="291"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="308"/>
<source>Copy</source> <source>Copy</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="296"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="313"/>
<source>Paste</source> <source>Paste</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="300"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="317"/>
<source>Delete</source> <source>Delete</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="306"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="323"/>
<source>Lookup</source> <source>Lookup</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="307"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="324"/>
<source>Find</source> <source>Find</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="311"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="328"/>
<source>Replace</source> <source>Replace</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="316"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="333"/>
<source>Goto</source> <source>Goto</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="328"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="345"/>
<source>Display</source> <source>Display</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="355"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="372"/>
<source>Scale</source> <source>Scale</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="357"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="374"/>
<source>ResetScale</source> <source>ResetScale</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="363"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="380"/>
<source>Window</source> <source>Window</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="366"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="383"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="454"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="471"/>
<source>Editor</source> <source>Editor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="370"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="387"/>
<source>Tools</source> <source>Tools</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="375"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="392"/>
<source>Layout</source> <source>Layout</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="376"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="393"/>
<source>Fullscreen</source> <source>Fullscreen</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="378"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="395"/>
<source>RestoreLayout</source> <source>RestoreLayout</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="437"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="454"/>
<source>BreakPoint</source> <source>BreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="439"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="456"/>
<source>ToggleBreakPoint</source> <source>ToggleBreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="442"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="459"/>
<source>AddBreakPoint</source> <source>AddBreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="452"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="469"/>
<source>Settings</source> <source>Settings</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="488"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="505"/>
<source>Local</source> <source>Local</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="494"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="511"/>
<source>Global</source> <source>Global</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="497"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="514"/>
<source>Variables</source> <source>Variables</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="510"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="527"/>
<source>BreakPoints</source> <source>BreakPoints</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="522"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="539"/>
<source>ConsoleOutput</source> <source>ConsoleOutput</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="536"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="553"/>
<source>StackTrace</source> <source>StackTrace</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="550"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="567"/>
<source>Watch</source> <source>Watch</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="639"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="656"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="849"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="866"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1013"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1030"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1049"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1066"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1064"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1081"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1089"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1106"/>
<source>Error</source> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="640"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="657"/>
<source>Too much opened files</source> <source>Too much opened files</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="988"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1005"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1028"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1045"/>
<source>ChooseFile</source> <source>ChooseFile</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="849"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="866"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1013"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1030"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1064"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1081"/>
<source>FilePermission</source> <source>FilePermission</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1047"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1064"/>
<source>ReloadSuccessfully</source> <source>ReloadSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1049"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1066"/>
<source>ReloadUnSuccessfully</source> <source>ReloadUnSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1076"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1093"/>
<source>ChooseSaveFile</source> <source>ChooseSaveFile</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1062"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1079"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1087"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1104"/>
<source>SaveSuccessfully</source> <source>SaveSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1089"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1106"/>
<source>SaveUnSuccessfully</source> <source>SaveUnSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1197"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1214"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1212"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1229"/>
<source>CannotSave2RunScript</source> <source>CannotSave2RunScript</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="672"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="689"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1272"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1289"/>
<source>ScriptStillRunning</source> <source>ScriptStillRunning</source>
<translation>退</translation> <translation>退</translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="221"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="238"/>
<source>View</source> <source>View</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="387"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="404"/>
<source>Debug</source> <source>Debug</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="390"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="407"/>
<source>Run</source> <source>Run</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="395"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="412"/>
<source>RunWithDbg</source> <source>RunWithDbg</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="401"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="418"/>
<source>Pause</source> <source>Pause</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="406"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="423"/>
<source>Continue</source> <source>Continue</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="411"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="428"/>
<source>Stop</source> <source>Stop</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="415"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="432"/>
<source>Restart</source> <source>Restart</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="420"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="437"/>
<source>StepInto</source> <source>StepInto</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="425"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="442"/>
<source>StepOver</source> <source>StepOver</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="429"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="446"/>
<source>StepOut</source> <source>StepOut</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="445"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="462"/>
<source>RemoveBreakPoint</source> <source>RemoveBreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="461"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="478"/>
<source>Info</source> <source>Info</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="463"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="480"/>
<source>Software</source> <source>Software</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="466"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="483"/>
<source>Sponsor</source> <source>Sponsor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="469"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="486"/>
<source>Wiki</source> <source>Wiki</source>
<translation> Wiki</translation> <translation> Wiki</translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="472"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="489"/>
<source>AboutQT</source> <source>AboutQT</source>
<translation> QT</translation> <translation> QT</translation>
</message> </message>

View File

@ -45,7 +45,7 @@ def main():
"folder", help="A folder that has contained the binary build") "folder", help="A folder that has contained the binary build")
parser.add_argument("-c", "--cc", help="where ISCC.exe locates", default="C:\Program Files (x86)\Inno Setup 6\ISCC.exe") parser.add_argument("-c", "--cc", help="where ISCC.exe locates", default="C:\Program Files (x86)\Inno Setup 6\ISCC.exe")
parser.add_argument("-o", "--output", help="where to put the installer") parser.add_argument("-o", "--output", help="where to put the installer")
parser.add_argument("--build", action='store_false') parser.add_argument("--no-build", action='store_false')
args = parser.parse_args() args = parser.parse_args()
@ -157,8 +157,6 @@ def main():
print(Fore.GREEN + ">> Copying finished, deploying the software..." + Style.RESET_ALL) print(Fore.GREEN + ">> Copying finished, deploying the software..." + Style.RESET_ALL)
try: try:
subprocess.run([deploy_exec, os.path.join(exeDebPath, f"qt{qt_version}advanceddocking.dll")], check=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
subprocess.run([deploy_exec, os.path.join(exeDebPath, exe_name) ], check=True, subprocess.run([deploy_exec, os.path.join(exeDebPath, exe_name) ], check=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
@ -167,9 +165,6 @@ def main():
except FileNotFoundError: except FileNotFoundError:
exit(-4) exit(-4)
# ok, remove the ads_lib_deploy
os.remove(ads_lib_deploy)
# generate iss file # generate iss file
print(Fore.GREEN + ">> Copying finished, generate ISCC script..." + Style.RESET_ALL) print(Fore.GREEN + ">> Copying finished, generate ISCC script..." + Style.RESET_ALL)

View File

@ -205,11 +205,11 @@ static int contextBound(const QToken& unscoped, const QTokenList& context)
extern QByteArray join(const QList<QByteArray> &l, QByteArray glue, extern QByteArray join(const QList<QByteArray> &l, QByteArray glue,
int max = -1); int max = -1);
QCodeCompletionBackend *AsCompletion::pBackend = 0; QCodeCompletionBackend *AsCompletion::pBackend = nullptr;
unsigned long AsCompletion::instances = 0; unsigned long AsCompletion::instances = 0;
AsCompletion::AsCompletion(QObject *p) AsCompletion::AsCompletion(QObject *p)
: QCodeCompletionEngine(p), pPopup(0), pModel(0) { : QCodeCompletionEngine(p), pPopup(nullptr), pModel(nullptr) {
if (!pBackend) if (!pBackend)
pBackend = new QCodeCompletionBackend; pBackend = new QCodeCompletionBackend;
@ -226,7 +226,7 @@ AsCompletion::AsCompletion(QObject *p)
} }
AsCompletion::AsCompletion(QCodeModel *m, QObject *p) AsCompletion::AsCompletion(QCodeModel *m, QObject *p)
: QCodeCompletionEngine(p), pPopup(0), pModel(m) { : QCodeCompletionEngine(p), pPopup(nullptr), pModel(m) {
if (!pBackend) if (!pBackend)
pBackend = new QCodeCompletionBackend; pBackend = new QCodeCompletionBackend;
@ -248,14 +248,14 @@ AsCompletion::~AsCompletion() {
if (!instances && pBackend) { if (!instances && pBackend) {
delete pBackend; delete pBackend;
pBackend = 0; pBackend = nullptr;
} }
} }
QCodeCompletionEngine *AsCompletion::clone() { QCodeCompletionEngine *AsCompletion::clone() {
AsCompletion *e = new AsCompletion(pModel); AsCompletion *e = new AsCompletion(pModel);
foreach (QString t, triggers()) for (auto &t : triggers())
e->addTrigger(t); e->addTrigger(t);
emit cloned(e); emit cloned(e);
@ -263,18 +263,13 @@ QCodeCompletionEngine *AsCompletion::clone() {
return e; return e;
} }
QString AsCompletion::language() const { return "C++"; } QString AsCompletion::language() const { return "AngelScript"; }
QStringList AsCompletion::extensions() const { QStringList AsCompletion::extensions() const {
QStringList l; QStringList l;
l << "c" l << "as"
<< "cc" << "angelscript";
<< "cpp"
<< "cxx"
<< "h"
<< "hpp"
<< "hxx";
return l; return l;
} }
@ -383,12 +378,12 @@ static void flush(QTokenList::const_iterator beg,
++i; ++i;
--tpl_nest; --tpl_nest;
stillType = stillType =
stillType && (tpl_nest || *i == "*" || *i == "&" || *i == "::"); stillType && (tpl_nest || *i == "*" || *i == "@" || *i == "::");
continue; continue;
} }
if (stillType) { if (stillType) {
if (tpl_nest || *i == "const" || *i == "static" || *i == "::") { if (tpl_nest || *i == "const" || *i == "::") {
++i; ++i;
continue; continue;
} }
@ -396,7 +391,7 @@ static void flush(QTokenList::const_iterator beg,
if (++i == end) if (++i == end)
break; break;
stillType = *i == "*" || *i == "&" || *i == "<" || *i == "::"; stillType = *i == "*" || *i == "@" || *i == "<" || *i == "::";
continue; continue;
} }
@ -457,9 +452,6 @@ static QByteArray trimmedType(const QByteArray &t, bool &ptr) {
QByteArray s = t; QByteArray s = t;
if (s.startsWith("static "))
s.remove(0, 7);
if (s.startsWith("const ")) if (s.startsWith("const "))
s.remove(0, 6); s.remove(0, 6);
@ -470,7 +462,7 @@ static QByteArray trimmedType(const QByteArray &t, bool &ptr) {
ptr = true; ptr = true;
s.remove(i, 1); s.remove(i, 1);
--i; --i;
} else if (s.at(i) == '&') { } else if (s.at(i) == '@') {
s.remove(i, 1); s.remove(i, 1);
--i; --i;
} else if ((s.at(i) == ' ') && } else if ((s.at(i) == ' ') &&
@ -627,7 +619,7 @@ QByteArray AsCompletion::functionLookup(QCodeNode *n, const QByteArray &s) {
QByteArray cn = c->role(QCodeNode::Name), tpl; QByteArray cn = c->role(QCodeNode::Name), tpl;
if (ctype == QCodeNode::Group || if (ctype == QCodeNode::Group ||
(ctype == QCodeNode::Language && cn == "C++") || (ctype == QCodeNode::Language && cn == "AngelScript") ||
(ctype == QCodeNode::Namespace && m_namespaces.contains(cn))) { (ctype == QCodeNode::Namespace && m_namespaces.contains(cn))) {
foreach (QCodeNode *child, c->children) foreach (QCodeNode *child, c->children)
stack.push(child); stack.push(child);
@ -716,7 +708,7 @@ QCodeNode *AsCompletion::lookup(const QByteArray &t) {
TRACE_IF(n, "found in locals") TRACE_IF(n, "found in locals")
if (!n && scope_local && pModel) { if (!n && scope_local && pModel) {
n = pModel->findNode("C++", t); n = pModel->findNode("AngelScript", t);
TRACE_IF(n, "found in projects") TRACE_IF(n, "found in projects")
} }
@ -912,8 +904,6 @@ void AsCompletion::hierarchy(QCodeNode *n, QList<QCodeNode *> &l,
// bool bPriv = a.contains("private"); // bool bPriv = a.contains("private");
remove(a, "virtual");
remove(a, "public"); remove(a, "public");
remove(a, "private"); remove(a, "private");
remove(a, "protected"); remove(a, "protected");
@ -998,7 +988,7 @@ void AsCompletion::getMembers(QTokenList::const_iterator beg,
n = nsAwareLookup(ts); n = nsAwareLookup(ts);
int ntype = n ? n->type() : 0; int ntype = n ? n->type() : 0;
if (n && (ntype == QCodeNode::Class || ntype == QCodeNode::Struct)) { if (n && (ntype == QCodeNode::Class)) {
// ctors // ctors
type = symbol; type = symbol;
matchForward(i, "(", ")", end); matchForward(i, "(", ")", end);
@ -1289,9 +1279,7 @@ void AsCompletion::getMembers(QTokenList::const_iterator beg,
break; break;
} else if (op == "::") { } else if (op == "::") {
if ((nt == QCodeNode::Enum) || if ((nt == QCodeNode::Enum) ||
(nt == QCodeNode::Union) ||
(nt == QCodeNode::Class) || (nt == QCodeNode::Class) ||
(nt == QCodeNode::Struct) ||
(nt == QCodeNode::Namespace)) { (nt == QCodeNode::Namespace)) {
++i; ++i;
type = symbol; type = symbol;
@ -1300,8 +1288,7 @@ void AsCompletion::getMembers(QTokenList::const_iterator beg,
} }
} else if (op == "(") { } else if (op == "(") {
if ((nt == QCodeNode::Class) || if (nt == QCodeNode::Class) {
(nt == QCodeNode::Struct)) {
type = symbol; type = symbol;
updateContext(child, &cxt, &scxt); updateContext(child, &cxt, &scxt);
i += 2; i += 2;
@ -1376,7 +1363,7 @@ void AsCompletion::complete(QCodeStream *s, const QString &trig) {
if (pPopup && pPopup->editor() != editor()) { if (pPopup && pPopup->editor() != editor()) {
delete pPopup; delete pPopup;
pPopup = 0; pPopup = nullptr;
} }
if (!pPopup) { if (!pPopup) {

View File

@ -27,24 +27,25 @@ private:
}; };
class AsCompletion : public QCodeCompletionEngine { class AsCompletion : public QCodeCompletionEngine {
Q_OBJECT
public: public:
AsCompletion(QObject *p = 0); AsCompletion(QObject *p = nullptr);
AsCompletion(QCodeModel *m, QObject *p = 0); AsCompletion(QCodeModel *m, QObject *p = nullptr);
virtual ~AsCompletion(); virtual ~AsCompletion();
virtual QCodeCompletionEngine *clone(); virtual QCodeCompletionEngine *clone() override;
virtual QString language() const; virtual QString language() const override;
virtual QStringList extensions() const; virtual QStringList extensions() const override;
void init(); void init();
QCodeCompletionBackend *backend() const; QCodeCompletionBackend *backend() const;
protected: protected:
virtual void setCodeModel(QCodeModel *m); virtual void setCodeModel(QCodeModel *m) override;
virtual void complete(QCodeStream *s, const QString &trigger); virtual void complete(QCodeStream *s, const QString &trigger) override;
public: public:
void hierarchy(QCodeNode *n, QList<QCodeNode *> &l, void hierarchy(QCodeNode *n, QList<QCodeNode *> &l,

View File

@ -303,10 +303,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
if (type == QCodeNode::Class) { if (type == QCodeNode::Class) {
visibility = QCodeNode::VISIBILITY_PRIVATE; visibility = QCodeNode::VISIBILITY_PRIVATE;
} else if (type == QCodeNode::Struct) { } else if ((type == QCodeNode::Enum) || (type == QCodeNode::Namespace)) {
visibility = QCodeNode::VISIBILITY_PUBLIC;
} else if ((type == QCodeNode::Union) || (type == QCodeNode::Enum) ||
(type == QCodeNode::Namespace)) {
visibility = QCodeNode::VISIBILITY_PUBLIC; visibility = QCodeNode::VISIBILITY_PUBLIC;
} }
@ -323,8 +320,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
// qDebug("\"%s\"", token.constData()); // qDebug("\"%s\"", token.constData());
switch (k) { switch (k) {
case KEYWORD_CLASS: case KEYWORD_CLASS: {
case KEYWORD_STRUCT: {
if (ltemplates.count() == 1 && ltemplates.at(0).isEmpty()) { if (ltemplates.count() == 1 && ltemplates.at(0).isEmpty()) {
// specialization : discard // specialization : discard
buffer_unused.clear(); buffer_unused.clear();
@ -394,7 +390,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
name = "<anonymous>"; name = "<anonymous>";
} }
QByteArray roles = (k == KEYWORD_STRUCT) ? "s@" : "c@"; QByteArray roles = "c@";
#ifdef _TRACE_PARSING_ #ifdef _TRACE_PARSING_
qDebug("%s %s", (k == KEYWORD_STRUCT) ? "struct" : "class", qDebug("%s %s", (k == KEYWORD_STRUCT) ? "struct" : "class",
@ -405,8 +401,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
roles += "@"; roles += "@";
// QList<QByteArray> ancestors; // QList<QByteArray> ancestors;
QByteArray rule, QByteArray rule, drule = "private";
drule = (k == KEYWORD_CLASS) ? "private" : "public";
if (tokens.at(id) == ":") { if (tokens.at(id) == ":") {
while (filter(++id, end)) { while (filter(++id, end)) {
@ -677,73 +672,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
break; break;
} }
case KEYWORD_UNION: {
ltemplates.clear();
QByteArray name;
if (((id + 1) < end && tokens.at(id + 1) != "{") &&
((id + 2) < end && tokens.at(id + 2) != "{")) {
// twisted variable declaration...
++id;
break;
}
if (tokens.at(id + 1) == "{") {
// anonymous enum
name = "<anonymous>";
} else if (tokens.at(id + 2) == "{") {
// named enum
name = tokens.at(++id);
} else {
qWarning("Syntax error : expected \'{\' after \"union\" in %s",
sContext.constData());
buffer_unused.clear();
++id;
break;
}
++id;
first = id + 1;
match(tokens, id, end, '{', '}');
if (buffer_unused.count()) {
qWarning(
"Syntax error : expecting \';\' before \"union\" in %s",
sContext.constData());
dump(buffer_unused);
++id;
break;
}
#ifdef _TRACE_PARSING_
qDebug("union %s", name.constData());
#endif
QCodeNode *un = getNode();
un->line = line;
un->roles =
QByteArray("u@") + name + "@@" + QByteArray::number(visibility);
// if ( l ) qDebug("union at line %i", line);
if (bNeedCxt)
n->roles += "@" + sContext;
un->attach(pScope);
update(un, l, tokens, first, id, false);
while ((id < end) && (tokens.at(id) != ";"))
++id;
if (id < end)
++id;
break;
}
case KEYWORD_NAMESPACE: { case KEYWORD_NAMESPACE: {
ltemplates.clear(); ltemplates.clear();
@ -848,9 +776,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
++id; ++id;
switch (keyword(tokens.at(id))) { switch (keyword(tokens.at(id))) {
case KEYWORD_STRUCT: case KEYWORD_ENUM: {
case KEYWORD_ENUM:
case KEYWORD_UNION: {
++id; ++id;
QByteArray name; QByteArray name;
@ -1197,47 +1123,19 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
int nodeType = pScope->type(); int nodeType = pScope->type();
bool cont = false, bool cont = false,
inClass = ((nodeType == QCodeNode::Class) || inClass = (nodeType == QCodeNode::Class);
(nodeType == QCodeNode::Struct));
if (!inClass) { if (!inClass) {
if (*ba == "extern")
if (*ba == "static") {
ts |= QCodeNode::SPECIFIER_STATIC;
if (((ba + 1) < buffer_end) &&
(*(ba + 1) == "const")) {
++ba;
ts |= QCodeNode::SPECIFIER_CONST;
}
} else if (*ba == "extern")
ts |= QCodeNode::SPECIFIER_EXTERN; ts |= QCodeNode::SPECIFIER_EXTERN;
else if (*ba == "auto") else if (*ba == "auto")
ts |= QCodeNode::SPECIFIER_AUTO; ts |= QCodeNode::SPECIFIER_AUTO;
else if (*ba == "register")
ts |= QCodeNode::SPECIFIER_REGISTER;
else if (*ba == "const") else if (*ba == "const")
ts |= QCodeNode::SPECIFIER_CONST; ts |= QCodeNode::SPECIFIER_CONST;
else if (*ba == "volatile")
ts |= QCodeNode::SPECIFIER_VOLATILE;
else if (*ba == "mutable")
ts |= QCodeNode::SPECIFIER_MUTABLE;
else else
--ba; --ba;
} else { } else {
if (*ba == "static") { if (*ba == "const")
ts |= QCodeNode::SPECIFIER_STATIC;
if ((ba + 1) < buffer_end &&
*(ba + 1) == "const") {
++ba;
ts |= QCodeNode::SPECIFIER_CONST;
}
} else if (*ba == "mutable")
ts |= QCodeNode::SPECIFIER_MUTABLE;
else if (*ba == "const")
ts |= QCodeNode::SPECIFIER_CONST; ts |= QCodeNode::SPECIFIER_CONST;
else else
--ba; --ba;
@ -1414,9 +1312,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
} else if (buffer_unused.last() == "private") { } else if (buffer_unused.last() == "private") {
visa = true; visa = true;
visibility = QCodeNode::VISIBILITY_PRIVATE; visibility = QCodeNode::VISIBILITY_PRIVATE;
} else if (buffer_unused.last() == "signals") {
visa = true;
visibility = QCodeNode::VISIBILITY_SIGNAL;
} else { } else {
// qWarning("weird syntactic construct in %s", // qWarning("weird syntactic construct in %s",
// sContext.constData()); // sContext.constData());
@ -1469,14 +1364,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
QCodeNode::FunctionQualifier fq = QCodeNode::QUALIFIER_NONE; QCodeNode::FunctionQualifier fq = QCodeNode::QUALIFIER_NONE;
int pref_idx = buffer_unused.indexOf("inline"); int pref_idx = buffer_unused.indexOf("explicit");
if (pref_idx != -1) {
fq |= QCodeNode::QUALIFIER_INLINE;
buffer_unused.removeAt(pref_idx);
}
pref_idx = buffer_unused.indexOf("explicit");
if (pref_idx != -1) if (pref_idx != -1)
buffer_unused.removeAt(pref_idx); buffer_unused.removeAt(pref_idx);
@ -1539,8 +1427,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
// maybe ctor or dtor // maybe ctor or dtor
if (((pScope->type() == QCodeNode::Class) || if ((pScope->type() == QCodeNode::Class) &&
(pScope->type() == QCodeNode::Struct)) &&
(name == pScope->role(QCodeNode::Name))) { (name == pScope->role(QCodeNode::Name))) {
isCtorDtor = true; isCtorDtor = true;
@ -1551,8 +1438,8 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
} }
if (buffer_unused.count() && if (buffer_unused.count() &&
buffer_unused.at(0) == "virtual") { buffer_unused.at(0) == "abstract") {
fq |= QCodeNode::QUALIFIER_VIRTUAL; fq |= QCodeNode::QUALIFIER_ABSTRACT;
buffer_unused.removeAt(0); buffer_unused.removeAt(0);
} }
@ -1572,10 +1459,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
// anything else // anything else
if (buffer_unused.at(0) == "extern") if (buffer_unused.at(0) == "extern")
fq |= QCodeNode::QUALIFIER_EXTERN; fq |= QCodeNode::QUALIFIER_EXTERN;
else if (buffer_unused.at(0) == "static")
fq |= QCodeNode::QUALIFIER_STATIC;
else if (buffer_unused.at(0) == "virtual")
fq |= QCodeNode::QUALIFIER_VIRTUAL;
else else
goto skip_qualifiers; goto skip_qualifiers;
@ -1640,12 +1523,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
break; break;
} else if (tokens.at(id) == "const") } else if (tokens.at(id) == "const")
fq |= QCodeNode::QUALIFIER_CONST; fq |= QCodeNode::QUALIFIER_CONST;
else if (tokens.at(id) == "volatile")
fq |= QCodeNode::QUALIFIER_VOLATILE;
else if (tokens.at(id) == "=") {
if (((id + 1) < end) && (tokens.at(id + 1) == "0"))
fq |= QCodeNode::QUALIFIER_PURE_VIRTUAL;
}
++id; ++id;
} }
@ -1653,10 +1530,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id,
if (!retval.endsWith("::") && if (!retval.endsWith("::") &&
!retval.endsWith(":: ~") // small quirk handling... !retval.endsWith(":: ~") // small quirk handling...
) { ) {
if (retval.startsWith("inline ")) {
retval.remove(0, 7);
fq |= QCodeNode::QUALIFIER_INLINE;
}
prettify(name); prettify(name);
prettify(retval); prettify(retval);
@ -1876,10 +1749,8 @@ static const QAsParser::KeywordId IdTable[] = {
QCppParser::KEYWORD_RETURN, QCppParser::KEYWORD_RETURN,
QCppParser::KEYWORD_SHORT, QCppParser::KEYWORD_SHORT,
QCppParser::KEYWORD_SIGNED, QCppParser::KEYWORD_SIGNED,
QCppParser::KEYWORD_STATIC,
*/
QAsParser::KEYWORD_STRUCT, QAsParser::KEYWORD_STRUCT,
*/
/* /*
QCppParser::KEYWORD_SWITCH, QCppParser::KEYWORD_SWITCH,
@ -1898,8 +1769,6 @@ static const QAsParser::KeywordId IdTable[] = {
// QCppParser::KEYWORD_TYPENAME, // QCppParser::KEYWORD_TYPENAME,
QAsParser::KEYWORD_UNION,
// QCppParser::KEYWORD_UNSIGNED, // QCppParser::KEYWORD_UNSIGNED,
QAsParser::KEYWORD_USING, QAsParser::KEYWORD_USING,

View File

@ -12,7 +12,6 @@ public:
KEYWORD_NONE = -1, KEYWORD_NONE = -1,
KEYWORD_ATTRIBUTE, KEYWORD_ATTRIBUTE,
KEYWORD_ASM,
KEYWORD_AUTO, KEYWORD_AUTO,
KEYWORD_BOOL, KEYWORD_BOOL,
KEYWORD_BREAK, KEYWORD_BREAK,
@ -40,19 +39,16 @@ public:
KEYWORD_INT, KEYWORD_INT,
KEYWORD_INTERNAL, KEYWORD_INTERNAL,
KEYWORD_LONG, KEYWORD_LONG,
KEYWORD_MUTABLE,
KEYWORD_NAMESPACE, KEYWORD_NAMESPACE,
KEYWORD_NEW, KEYWORD_NEW,
KEYWORD_OPERATOR, KEYWORD_OPERATOR,
KEYWORD_PRIVATE, KEYWORD_PRIVATE,
KEYWORD_PROTECTED, KEYWORD_PROTECTED,
KEYWORD_PUBLIC, KEYWORD_PUBLIC,
KEYWORD_REGISTER,
KEYWORD_RETURN, KEYWORD_RETURN,
KEYWORD_SHORT, KEYWORD_SHORT,
KEYWORD_SIGNED, KEYWORD_SIGNED,
KEYWORD_STATIC, KEYWORD_STATIC,
KEYWORD_STRUCT,
KEYWORD_SWITCH, KEYWORD_SWITCH,
KEYWORD_SIZEOF, KEYWORD_SIZEOF,
KEYWORD_TEMPLATE, KEYWORD_TEMPLATE,
@ -61,13 +57,10 @@ public:
KEYWORD_TRY, KEYWORD_TRY,
KEYWORD_TYPEDEF, KEYWORD_TYPEDEF,
KEYWORD_TYPENAME, KEYWORD_TYPENAME,
KEYWORD_UNION,
KEYWORD_UNSIGNED, KEYWORD_UNSIGNED,
KEYWORD_USING, KEYWORD_USING,
KEYWORD_VIRTUAL, KEYWORD_VIRTUAL,
KEYWORD_VOID, KEYWORD_VOID,
KEYWORD_VOLATILE,
KEYWORD_WCHAR_T,
KEYWORD_WHILE, KEYWORD_WHILE,
KEYWORD_COUNT KEYWORD_COUNT

View File

@ -513,8 +513,7 @@ bool QCodeCompletionModel::match(QCodeNode *n,
); );
*/ */
if ((((type == QCodeNode::Class) || (type == QCodeNode::Struct) || if ((((type == QCodeNode::Class) || (type == QCodeNode::Typedef)) &&
(type == QCodeNode::Union) || (type == QCodeNode::Typedef)) &&
!(filter & QCodeCompletionWidget::KeepSubTypes)) || !(filter & QCodeCompletionWidget::KeepSubTypes)) ||
((type == QCodeNode::Enum) && ((type == QCodeNode::Enum) &&
!(filter & QCodeCompletionWidget::KeepEnums)) || !(filter & QCodeCompletionWidget::KeepEnums)) ||
@ -525,23 +524,19 @@ bool QCodeCompletionModel::match(QCodeNode *n,
((visibility == QCodeNode::VISIBILITY_PUBLIC) && ((visibility == QCodeNode::VISIBILITY_PUBLIC) &&
!(filter & QCodeCompletionWidget::Public)) || !(filter & QCodeCompletionWidget::Public)) ||
((type == QCodeNode::Variable) && ((type == QCodeNode::Variable) &&
(((specifiers & QCodeNode::SPECIFIER_STATIC) && ((!(filter & QCodeCompletionWidget::KeepStatic)) ||
!(filter & QCodeCompletionWidget::KeepStatic)) ||
((specifiers & QCodeNode::SPECIFIER_CONST) && ((specifiers & QCodeNode::SPECIFIER_CONST) &&
!(filter & QCodeCompletionWidget::KeepConst)) || !(filter & QCodeCompletionWidget::KeepConst)) ||
(!(specifiers & QCodeNode::SPECIFIER_STATIC) && ((filter & QCodeCompletionWidget::IsStatic))
(filter & QCodeCompletionWidget::IsStatic))
// || // ||
// (!(specifiers & QCodeNode::SPECIFIER_CONST) && // (!(specifiers & QCodeNode::SPECIFIER_CONST) &&
//(filter & QCodeCompletionWidget::IsConst)) //(filter & QCodeCompletionWidget::IsConst))
)) || )) ||
((type == QCodeNode::Function) && ((type == QCodeNode::Function) &&
(((qualifiers & QCodeNode::QUALIFIER_STATIC) && ((!(filter & QCodeCompletionWidget::KeepStatic)) ||
!(filter & QCodeCompletionWidget::KeepStatic)) ||
((qualifiers & QCodeNode::QUALIFIER_CONST) && ((qualifiers & QCodeNode::QUALIFIER_CONST) &&
!(filter & QCodeCompletionWidget::KeepConst)) || !(filter & QCodeCompletionWidget::KeepConst)) ||
(!(qualifiers & QCodeNode::QUALIFIER_STATIC) && ((filter & QCodeCompletionWidget::IsStatic) &&
(filter & QCodeCompletionWidget::IsStatic) &&
(n->parent->type() != QCodeNode::Namespace)) || (n->parent->type() != QCodeNode::Namespace)) ||
(!(qualifiers & QCodeNode::QUALIFIER_CONST) && (!(qualifiers & QCodeNode::QUALIFIER_CONST) &&
(filter & QCodeCompletionWidget::IsConst)) || (filter & QCodeCompletionWidget::IsConst)) ||

View File

@ -5,6 +5,7 @@
#include <QFile> #include <QFile>
#include <QPixmap> #include <QPixmap>
#include "qlanguagefactory.h"
#include "qlinemarkpanel.h" #include "qlinemarkpanel.h"
#include "qlinenumberpanel.h" #include "qlinenumberpanel.h"
#include "qpanellayout.h" #include "qpanellayout.h"

View File

@ -10,7 +10,7 @@
#include <QTimerEvent> #include <QTimerEvent>
#include <QWindow> #include <QWindow>
#include "../class/eventfilter.h" #include "class/eventfilter.h"
int Toast::LENGTH_LONG = 4000; int Toast::LENGTH_LONG = 4000;
int Toast::LENGTH_SHORT = 1500; int Toast::LENGTH_SHORT = 1500;

View File

@ -3,6 +3,7 @@
#include "QWingRibbon/ribbontabcontent.h" #include "QWingRibbon/ribbontabcontent.h"
#include "Qt-Advanced-Docking-System/src/DockAreaWidget.h" #include "Qt-Advanced-Docking-System/src/DockAreaWidget.h"
#include "aboutsoftwaredialog.h" #include "aboutsoftwaredialog.h"
#include "class/ascompletion.h"
#include "class/languagemanager.h" #include "class/languagemanager.h"
#include "class/qkeysequences.h" #include "class/qkeysequences.h"
#include "class/settingmanager.h" #include "class/settingmanager.h"
@ -11,6 +12,8 @@
#include "class/wingmessagebox.h" #include "class/wingmessagebox.h"
#include "control/toast.h" #include "control/toast.h"
#include "qcodeeditwidget/qeditconfig.h" #include "qcodeeditwidget/qeditconfig.h"
#include "qcodeloader.h"
#include "qcodemodel.h"
#include "qdocumentline.h" #include "qdocumentline.h"
#include "qeditor.h" #include "qeditor.h"
#include "qformatscheme.h" #include "qformatscheme.h"
@ -73,8 +76,22 @@ ScriptingDialog::ScriptingDialog(QWidget *parent)
break; break;
} }
QDocument::setDefaultFormatScheme(format); QDocument::setDefaultFormatScheme(format);
m_codeModel = new QCodeModel(this);
m_codeModel->setCodeLoader(new QCodeLoader(this));
// m_codeProxy = new QCodeProxyModel(this);
// m_codeProxy->setSourceModel(m_codeModel);
// m_codeProxy->setDynamicSortFilter(true);
// m_codeView = new QCodeView(this);
// m_codeView->setModel(m_codeProxy);
// m_codeView->setSortingEnabled(true);
// m_codeView->header()->hide();
m_language = new QLanguageFactory(format, this); m_language = new QLanguageFactory(format, this);
m_language->addDefinitionPath(QStringLiteral(":/qcodeedit")); m_language->addDefinitionPath(QStringLiteral(":/qcodeedit"));
m_language->addCompletionEngine(new AsCompletion(m_codeModel, this));
auto lmic = QLineMarksInfoCenter::instance(); auto lmic = QLineMarksInfoCenter::instance();
lmic->loadMarkTypes(QCE::fetchDataFile(":/qcodeedit/marks.qxm")); lmic->loadMarkTypes(QCE::fetchDataFile(":/qcodeedit/marks.qxm"));

View File

@ -14,6 +14,8 @@
#include "model/dbgbreakpointmodel.h" #include "model/dbgbreakpointmodel.h"
#include "model/dbgcallstackmodel.h" #include "model/dbgcallstackmodel.h"
#include "model/dbgvarshowmodel.h" #include "model/dbgvarshowmodel.h"
#include "qcodeproxymodel.h"
#include "qcodeview.h"
#include "qlanguagefactory.h" #include "qlanguagefactory.h"
#include "utilities.h" #include "utilities.h"
@ -233,6 +235,9 @@ private:
ads::CDockManager *m_dock = nullptr; ads::CDockManager *m_dock = nullptr;
ads::CDockAreaWidget *m_editorViewArea = nullptr; ads::CDockAreaWidget *m_editorViewArea = nullptr;
QLanguageFactory *m_language = nullptr; QLanguageFactory *m_language = nullptr;
QCodeView *m_codeView = nullptr;
QCodeModel *m_codeModel = nullptr;
QCodeProxyModel *m_codeProxy = nullptr;
QByteArray _defaultLayout; QByteArray _defaultLayout;
ScriptEditor *m_curEditor = nullptr; ScriptEditor *m_curEditor = nullptr;