diff --git a/3rdparty/qcodeedit2/CMakeLists.txt b/3rdparty/qcodeedit2/CMakeLists.txt index 1c268b2..65d1247 100644 --- a/3rdparty/qcodeedit2/CMakeLists.txt +++ b/3rdparty/qcodeedit2/CMakeLists.txt @@ -93,7 +93,7 @@ add_library(QCodeEditor2 STATIC ${SOURCE_FILES} ${DOCUMENT_SRC} ${WIDGETS_SRC} ${QNFA_SRC} ${SNIPPET_SRC}) target_compile_definitions(QCodeEditor2 PUBLIC _QCODE_EDIT_BUILD_ - _QCODE_EDIT_EMBED_) + _QCODE_EDIT_EMBED_ _QCODE_MODEL_) target_include_directories( QCodeEditor2 @@ -106,4 +106,5 @@ target_include_directories( target_link_libraries( QCodeEditor2 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) diff --git a/3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp b/3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp index c79e9f4..ffa62b9 100644 --- a/3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp +++ b/3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp @@ -272,7 +272,7 @@ void QCodeCompletionEngine::complete(const QDocumentCursor &c, Q_UNUSED(trigger) qWarning("From complete(QDocumentCursor, QString)"); 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 } diff --git a/3rdparty/qcodemodel2/CMakeLists.txt b/3rdparty/qcodemodel2/CMakeLists.txt index d113d95..8364fbb 100644 --- a/3rdparty/qcodemodel2/CMakeLists.txt +++ b/3rdparty/qcodemodel2/CMakeLists.txt @@ -40,7 +40,8 @@ add_library( qcodebuffer.cpp qcodelexer.cpp qcodeparser.cpp - qcodeloader.cpp) + qcodeloader.cpp + resources.qrc) target_include_directories(QCodeModel2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/3rdparty/qcodemodel2/completion/CVclass.png b/3rdparty/qcodemodel2/completion/CVclass.png new file mode 100644 index 0000000..6bd8993 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVclass.png differ diff --git a/3rdparty/qcodemodel2/completion/CVenum.png b/3rdparty/qcodemodel2/completion/CVenum.png new file mode 100644 index 0000000..90c3f96 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVenum.png differ diff --git a/3rdparty/qcodemodel2/completion/CVenumerator.png b/3rdparty/qcodemodel2/completion/CVenumerator.png new file mode 100644 index 0000000..f932f37 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVenumerator.png differ diff --git a/3rdparty/qcodemodel2/completion/CVglobal_meth.png b/3rdparty/qcodemodel2/completion/CVglobal_meth.png new file mode 100644 index 0000000..a7bb665 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVglobal_meth.png differ diff --git a/3rdparty/qcodemodel2/completion/CVglobal_var.png b/3rdparty/qcodemodel2/completion/CVglobal_var.png new file mode 100644 index 0000000..f7f8545 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVglobal_var.png differ diff --git a/3rdparty/qcodemodel2/completion/CVnamespace.png b/3rdparty/qcodemodel2/completion/CVnamespace.png new file mode 100644 index 0000000..37a9ae2 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVnamespace.png differ diff --git a/3rdparty/qcodemodel2/completion/CVpackage_meth.png b/3rdparty/qcodemodel2/completion/CVpackage_meth.png new file mode 100644 index 0000000..4b26f25 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVpackage_meth.png differ diff --git a/3rdparty/qcodemodel2/completion/CVpackage_var.png b/3rdparty/qcodemodel2/completion/CVpackage_var.png new file mode 100644 index 0000000..66b9f38 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVpackage_var.png differ diff --git a/3rdparty/qcodemodel2/completion/CVprivate_meth.png b/3rdparty/qcodemodel2/completion/CVprivate_meth.png new file mode 100644 index 0000000..45c7b3e Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVprivate_meth.png differ diff --git a/3rdparty/qcodemodel2/completion/CVprivate_var.png b/3rdparty/qcodemodel2/completion/CVprivate_var.png new file mode 100644 index 0000000..4bf6180 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVprivate_var.png differ diff --git a/3rdparty/qcodemodel2/completion/CVprotected_meth.png b/3rdparty/qcodemodel2/completion/CVprotected_meth.png new file mode 100644 index 0000000..fe96d4d Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVprotected_meth.png differ diff --git a/3rdparty/qcodemodel2/completion/CVprotected_var.png b/3rdparty/qcodemodel2/completion/CVprotected_var.png new file mode 100644 index 0000000..f97903f Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVprotected_var.png differ diff --git a/3rdparty/qcodemodel2/completion/CVpublic_meth.png b/3rdparty/qcodemodel2/completion/CVpublic_meth.png new file mode 100644 index 0000000..56063b0 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVpublic_meth.png differ diff --git a/3rdparty/qcodemodel2/completion/CVpublic_var.png b/3rdparty/qcodemodel2/completion/CVpublic_var.png new file mode 100644 index 0000000..d17730e Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVpublic_var.png differ diff --git a/3rdparty/qcodemodel2/completion/CVtypedef.png b/3rdparty/qcodemodel2/completion/CVtypedef.png new file mode 100644 index 0000000..4867dfa Binary files /dev/null and b/3rdparty/qcodemodel2/completion/CVtypedef.png differ diff --git a/3rdparty/qcodemodel2/completion/classnew.png b/3rdparty/qcodemodel2/completion/classnew.png new file mode 100644 index 0000000..0d145d8 Binary files /dev/null and b/3rdparty/qcodemodel2/completion/classnew.png differ diff --git a/3rdparty/qcodemodel2/qcodeloader.h b/3rdparty/qcodemodel2/qcodeloader.h index 359c315..56a5ed9 100644 --- a/3rdparty/qcodemodel2/qcodeloader.h +++ b/3rdparty/qcodemodel2/qcodeloader.h @@ -36,7 +36,7 @@ class QCM_EXPORT QCodeLoader : public QThread { Q_OBJECT public: - QCodeLoader(QObject *p = 0); + QCodeLoader(QObject *p = nullptr); virtual ~QCodeLoader(); public slots: diff --git a/3rdparty/qcodemodel2/qcodemodel.cpp b/3rdparty/qcodemodel2/qcodemodel.cpp index e868f15..36e6cd1 100644 --- a/3rdparty/qcodemodel2/qcodemodel.cpp +++ b/3rdparty/qcodemodel2/qcodemodel.cpp @@ -343,8 +343,7 @@ bool QCodeModel::isCachable(QCodeNode *n, QByteArray &cxt) const { cxt += qn; return true; - } else if ((t == QCodeNode::Enum) || (t == QCodeNode::Union) || - (t == QCodeNode::Class) || (t == QCodeNode::Struct) || + } else if ((t == QCodeNode::Enum) || (t == QCodeNode::Class) || (t == QCodeNode::Typedef)) { cxt += qn; diff --git a/3rdparty/qcodemodel2/qcodenode.cpp b/3rdparty/qcodemodel2/qcodenode.cpp index 19aa9ed..f3faa2d 100644 --- a/3rdparty/qcodemodel2/qcodenode.cpp +++ b/3rdparty/qcodemodel2/qcodenode.cpp @@ -26,9 +26,7 @@ enum CacheIndex { ICON_ENUM, ICON_ENUMERATOR, - ICON_UNION, ICON_CLASS, - ICON_STRUCT, ICON_TYPEDEF, ICON_NAMESPACE, ICON_FUNCTION = ICON_NAMESPACE + 2, @@ -41,15 +39,11 @@ static QIcon icon(int cacheIndex) { static bool setup = false; if (!setup) { - q_icon_cache[ICON_UNION] = QIcon(":/completion/CVunion.png"); - q_icon_cache[ICON_ENUM] = QIcon(":/completion/CVenum.png"); q_icon_cache[ICON_ENUMERATOR] = QIcon(":/completion/CVenumerator.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_NAMESPACE] = QIcon(":/completion/CVnamespace.png"); @@ -66,9 +60,6 @@ static QIcon icon(int cacheIndex) { q_icon_cache[ICON_FUNCTION + QCodeNode::VISIBILITY_PRIVATE] = 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] = QIcon(":/completion/CVglobal_var.png"); @@ -358,27 +349,12 @@ QVariant QCodeNode::data(int r) const { return d; } - case Struct: { - QByteArray d("struct "); - d += role(Name); - - QByteArray a = role(Ancestors); - - if (a.length()) - d += " : " + a; - - return d; - } - case Enum: return QByteArray("enum ") + role(Name); case Enumerator: return role(Name) + " = " + role(Value); - case Union: - return QByteArray("union ") + role(Name); - case Namespace: return QByteArray("namespace ") + role(Name); @@ -406,20 +382,12 @@ QVariant QCodeNode::data(int r) const { // storage class if (m_specifiers & QCodeNode::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) specifier += " extern "; - else if (m_specifiers & QCodeNode::SPECIFIER_MUTABLE) - specifier += " mutable "; // cv qualifier (for class members) if (m_specifiers & QCodeNode::SPECIFIER_CONST) specifier += " const "; - else if (m_specifiers & QCodeNode::SPECIFIER_VOLATILE) - specifier += " volatile "; if (specifier.length()) signature += " [" + specifier.simplified() + "]"; @@ -444,17 +412,6 @@ QVariant QCodeNode::data(int r) const { if (m_qualifiers & QCodeNode::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(); @@ -462,8 +419,6 @@ QVariant QCodeNode::data(int r) const { qualifier.prepend(" public "); else if (m_visibility == QCodeNode::VISIBILITY_PROTECTED) qualifier.prepend(" protected "); - else if (m_visibility == QCodeNode::VISIBILITY_SIGNAL) - qualifier.prepend(" signal "); else if (m_visibility == QCodeNode::VISIBILITY_PRIVATE) qualifier.prepend(" private "); else @@ -495,18 +450,12 @@ QVariant QCodeNode::data(int r) const { case Class: return icon(ICON_CLASS); - case Struct: - return icon(ICON_STRUCT); - case Enum: return icon(ICON_ENUM); case Enumerator: return icon(ICON_ENUMERATOR); - case Union: - return icon(ICON_UNION); - case Namespace: return icon(ICON_NAMESPACE); diff --git a/3rdparty/qcodemodel2/qcodenode.h b/3rdparty/qcodemodel2/qcodenode.h index cb29e2a..8e5c5a8 100644 --- a/3rdparty/qcodemodel2/qcodenode.h +++ b/3rdparty/qcodemodel2/qcodenode.h @@ -62,7 +62,6 @@ struct QCM_EXPORT QCodeNode { Language = 'l', Class = 'c', - Struct = 's', Function = 'f', @@ -71,8 +70,6 @@ struct QCM_EXPORT QCodeNode { Enum = 'e', Enumerator = 'r', - Union = 'u', - Namespace = 'n', Typedef = 't' @@ -87,7 +84,6 @@ struct QCM_EXPORT QCodeNode { enum NodeVisibility { VISIBILITY_DEFAULT = -1, VISIBILITY_PUBLIC, - VISIBILITY_SIGNAL, VISIBILITY_PROTECTED, VISIBILITY_PRIVATE }; @@ -95,11 +91,7 @@ struct QCM_EXPORT QCodeNode { enum Specifier { SPECIFIER_NONE = 0, SPECIFIER_CONST = 1, - SPECIFIER_VOLATILE = 2, - SPECIFIER_MUTABLE = 4, SPECIFIER_AUTO = 8, - SPECIFIER_STATIC = 16, - SPECIFIER_REGISTER = 32, SPECIFIER_EXTERN = 64 }; @@ -108,12 +100,8 @@ struct QCM_EXPORT QCodeNode { enum Qualifier { QUALIFIER_NONE = 0, QUALIFIER_CONST = 1, - QUALIFIER_VOLATILE = 2, - QUALIFIER_STATIC = 4, - QUALIFIER_EXTERN = 8, - QUALIFIER_VIRTUAL = 16, - QUALIFIER_PURE_VIRTUAL = 32, - QUALIFIER_INLINE = 64 + QUALIFIER_ABSTRACT = 2, + QUALIFIER_EXTERN = 8 }; typedef QFlags FunctionQualifier; diff --git a/3rdparty/qcodemodel2/qcodeproxymodel.cpp b/3rdparty/qcodemodel2/qcodeproxymodel.cpp index bc82b6d..4dc9e23 100644 --- a/3rdparty/qcodemodel2/qcodeproxymodel.cpp +++ b/3rdparty/qcodemodel2/qcodeproxymodel.cpp @@ -26,7 +26,6 @@ static QList priority = QList() << QCodeNode::Group << QCodeNode::Language << QCodeNode::Namespace << QCodeNode::Class - << QCodeNode::Struct << QCodeNode::Union << QCodeNode::Enum << QCodeNode::Typedef << QCodeNode::Function << QCodeNode::Variable; diff --git a/3rdparty/qcodemodel2/qcodeproxymodel.h b/3rdparty/qcodemodel2/qcodeproxymodel.h index cbe3808..151118c 100644 --- a/3rdparty/qcodemodel2/qcodeproxymodel.h +++ b/3rdparty/qcodemodel2/qcodeproxymodel.h @@ -29,7 +29,7 @@ class QCM_EXPORT QCodeProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - QCodeProxyModel(QObject *p = 0); + QCodeProxyModel(QObject *p = nullptr); virtual ~QCodeProxyModel(); protected: diff --git a/3rdparty/qcodemodel2/resources.qrc b/3rdparty/qcodemodel2/resources.qrc new file mode 100644 index 0000000..c2db8c7 --- /dev/null +++ b/3rdparty/qcodemodel2/resources.qrc @@ -0,0 +1,20 @@ + + + completion/CVclass.png + completion/CVenum.png + completion/CVenumerator.png + completion/CVglobal_meth.png + completion/CVglobal_var.png + completion/CVnamespace.png + completion/CVpackage_meth.png + completion/CVpackage_var.png + completion/CVprivate_meth.png + completion/CVprivate_var.png + completion/CVprotected_meth.png + completion/CVprotected_var.png + completion/CVpublic_meth.png + completion/CVpublic_var.png + completion/CVtypedef.png + completion/classnew.png + + diff --git a/lang/zh_CN/winghex.ts b/lang/zh_CN/winghex.ts index 8dadf05..22d3b56 100644 --- a/lang/zh_CN/winghex.ts +++ b/lang/zh_CN/winghex.ts @@ -4293,375 +4293,375 @@ Do you want them to be saved? ScriptingDialog - + ScriptEditor 脚本编辑器 - + ScriptPermissionDenied 因权限无法打开脚本 - + File 文件 - + Edit 编辑 - + Debugger 调试器 - + About 关于 - + Basic 基础 - + New 新建 - + OpenF 打开文件 - + RecentFiles 最近打开 - + Reload 重新加载 - - + + Save 保存 - + SaveAs 另存为 - + General 基本 - + Undo 撤销 - + Redo 恢复 - + Cut 剪切 - + Copy 复制 - + Paste 粘贴 - + Delete 删除 - + Lookup 查询 - + Find 查找 - + Replace 替换 - + Goto 跳转 - + Display 显示 - + Scale 缩放 - + ResetScale 重置缩放 - + Window 窗体 - - + + Editor 编辑器 - + Tools 工具 - + Layout 布局 - + Fullscreen 全屏 - + RestoreLayout 恢复默认布局 - + BreakPoint 断点 - + ToggleBreakPoint 切换断点 - + AddBreakPoint 添加断点 - + Settings 设置 - + Local 本地 - + Global 全局 - + Variables 变量 - + BreakPoints 断点 - + ConsoleOutput 输出 - + StackTrace 栈跟踪 - + Watch 监视 - - - - - - + + + + + + Error 错误 - + Too much opened files 打开的文件过多,无法继续操作! - - + + ChooseFile 选择文件 - - - + + + FilePermission 因文件权限无法继续! - + ReloadSuccessfully 文件重新加载成功! - + ReloadUnSuccessfully 文件重新加载失败! - + ChooseSaveFile 请选择保存文件路径: - - + + SaveSuccessfully 保存成功! - + SaveUnSuccessfully 保存失败! - - + + CannotSave2RunScript 无法保存,故无法继续运行脚本。 - - + + ScriptStillRunning 脚本仍在运行,你确定要退出吗? - + View 视图 - + Debug 调试 - + Run 运行 - + RunWithDbg 调试运行 - + Pause 暂停 - + Continue 继续 - + Stop 停止 - + Restart 重启 - + StepInto 单步步入 - + StepOver 单步步过 - + StepOut 单步跳出 - + RemoveBreakPoint 删除断点 - + Info 信息 - + Software 软件 - + Sponsor 赞助 - + Wiki 网页 Wiki - + AboutQT 关于 QT diff --git a/mkinstaller/innoSetup/mkinnopak.py b/mkinstaller/innoSetup/mkinnopak.py index 108eb5e..f2ef952 100644 --- a/mkinstaller/innoSetup/mkinnopak.py +++ b/mkinstaller/innoSetup/mkinnopak.py @@ -45,7 +45,7 @@ def main(): "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("-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() @@ -157,8 +157,6 @@ def main(): print(Fore.GREEN + ">> Copying finished, deploying the software..." + Style.RESET_ALL) 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, stdout=subprocess.PIPE, stderr=subprocess.PIPE) except subprocess.CalledProcessError as e: @@ -167,9 +165,6 @@ def main(): except FileNotFoundError: exit(-4) - # ok, remove the ads_lib_deploy - os.remove(ads_lib_deploy) - # generate iss file print(Fore.GREEN + ">> Copying finished, generate ISCC script..." + Style.RESET_ALL) diff --git a/src/class/ascompletion.cpp b/src/class/ascompletion.cpp index 403e5a0..0920266 100644 --- a/src/class/ascompletion.cpp +++ b/src/class/ascompletion.cpp @@ -205,11 +205,11 @@ static int contextBound(const QToken& unscoped, const QTokenList& context) extern QByteArray join(const QList &l, QByteArray glue, int max = -1); -QCodeCompletionBackend *AsCompletion::pBackend = 0; +QCodeCompletionBackend *AsCompletion::pBackend = nullptr; unsigned long AsCompletion::instances = 0; AsCompletion::AsCompletion(QObject *p) - : QCodeCompletionEngine(p), pPopup(0), pModel(0) { + : QCodeCompletionEngine(p), pPopup(nullptr), pModel(nullptr) { if (!pBackend) pBackend = new QCodeCompletionBackend; @@ -226,7 +226,7 @@ AsCompletion::AsCompletion(QObject *p) } AsCompletion::AsCompletion(QCodeModel *m, QObject *p) - : QCodeCompletionEngine(p), pPopup(0), pModel(m) { + : QCodeCompletionEngine(p), pPopup(nullptr), pModel(m) { if (!pBackend) pBackend = new QCodeCompletionBackend; @@ -248,14 +248,14 @@ AsCompletion::~AsCompletion() { if (!instances && pBackend) { delete pBackend; - pBackend = 0; + pBackend = nullptr; } } QCodeCompletionEngine *AsCompletion::clone() { AsCompletion *e = new AsCompletion(pModel); - foreach (QString t, triggers()) + for (auto &t : triggers()) e->addTrigger(t); emit cloned(e); @@ -263,18 +263,13 @@ QCodeCompletionEngine *AsCompletion::clone() { return e; } -QString AsCompletion::language() const { return "C++"; } +QString AsCompletion::language() const { return "AngelScript"; } QStringList AsCompletion::extensions() const { QStringList l; - l << "c" - << "cc" - << "cpp" - << "cxx" - << "h" - << "hpp" - << "hxx"; + l << "as" + << "angelscript"; return l; } @@ -383,12 +378,12 @@ static void flush(QTokenList::const_iterator beg, ++i; --tpl_nest; stillType = - stillType && (tpl_nest || *i == "*" || *i == "&" || *i == "::"); + stillType && (tpl_nest || *i == "*" || *i == "@" || *i == "::"); continue; } if (stillType) { - if (tpl_nest || *i == "const" || *i == "static" || *i == "::") { + if (tpl_nest || *i == "const" || *i == "::") { ++i; continue; } @@ -396,7 +391,7 @@ static void flush(QTokenList::const_iterator beg, if (++i == end) break; - stillType = *i == "*" || *i == "&" || *i == "<" || *i == "::"; + stillType = *i == "*" || *i == "@" || *i == "<" || *i == "::"; continue; } @@ -457,9 +452,6 @@ static QByteArray trimmedType(const QByteArray &t, bool &ptr) { QByteArray s = t; - if (s.startsWith("static ")) - s.remove(0, 7); - if (s.startsWith("const ")) s.remove(0, 6); @@ -470,7 +462,7 @@ static QByteArray trimmedType(const QByteArray &t, bool &ptr) { ptr = true; s.remove(i, 1); --i; - } else if (s.at(i) == '&') { + } else if (s.at(i) == '@') { s.remove(i, 1); --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; if (ctype == QCodeNode::Group || - (ctype == QCodeNode::Language && cn == "C++") || + (ctype == QCodeNode::Language && cn == "AngelScript") || (ctype == QCodeNode::Namespace && m_namespaces.contains(cn))) { foreach (QCodeNode *child, c->children) stack.push(child); @@ -716,7 +708,7 @@ QCodeNode *AsCompletion::lookup(const QByteArray &t) { TRACE_IF(n, "found in locals") if (!n && scope_local && pModel) { - n = pModel->findNode("C++", t); + n = pModel->findNode("AngelScript", t); TRACE_IF(n, "found in projects") } @@ -912,8 +904,6 @@ void AsCompletion::hierarchy(QCodeNode *n, QList &l, // bool bPriv = a.contains("private"); - remove(a, "virtual"); - remove(a, "public"); remove(a, "private"); remove(a, "protected"); @@ -998,7 +988,7 @@ void AsCompletion::getMembers(QTokenList::const_iterator beg, n = nsAwareLookup(ts); int ntype = n ? n->type() : 0; - if (n && (ntype == QCodeNode::Class || ntype == QCodeNode::Struct)) { + if (n && (ntype == QCodeNode::Class)) { // ctors type = symbol; matchForward(i, "(", ")", end); @@ -1289,9 +1279,7 @@ void AsCompletion::getMembers(QTokenList::const_iterator beg, break; } else if (op == "::") { if ((nt == QCodeNode::Enum) || - (nt == QCodeNode::Union) || (nt == QCodeNode::Class) || - (nt == QCodeNode::Struct) || (nt == QCodeNode::Namespace)) { ++i; type = symbol; @@ -1300,8 +1288,7 @@ void AsCompletion::getMembers(QTokenList::const_iterator beg, } } else if (op == "(") { - if ((nt == QCodeNode::Class) || - (nt == QCodeNode::Struct)) { + if (nt == QCodeNode::Class) { type = symbol; updateContext(child, &cxt, &scxt); i += 2; @@ -1376,7 +1363,7 @@ void AsCompletion::complete(QCodeStream *s, const QString &trig) { if (pPopup && pPopup->editor() != editor()) { delete pPopup; - pPopup = 0; + pPopup = nullptr; } if (!pPopup) { diff --git a/src/class/ascompletion.h b/src/class/ascompletion.h index e727ded..5b91845 100644 --- a/src/class/ascompletion.h +++ b/src/class/ascompletion.h @@ -27,24 +27,25 @@ private: }; class AsCompletion : public QCodeCompletionEngine { + Q_OBJECT public: - AsCompletion(QObject *p = 0); - AsCompletion(QCodeModel *m, QObject *p = 0); + AsCompletion(QObject *p = nullptr); + AsCompletion(QCodeModel *m, QObject *p = nullptr); virtual ~AsCompletion(); - virtual QCodeCompletionEngine *clone(); + virtual QCodeCompletionEngine *clone() override; - virtual QString language() const; - virtual QStringList extensions() const; + virtual QString language() const override; + virtual QStringList extensions() const override; void init(); QCodeCompletionBackend *backend() const; protected: - virtual void setCodeModel(QCodeModel *m); - virtual void complete(QCodeStream *s, const QString &trigger); + virtual void setCodeModel(QCodeModel *m) override; + virtual void complete(QCodeStream *s, const QString &trigger) override; public: void hierarchy(QCodeNode *n, QList &l, diff --git a/src/class/qasparser.cpp b/src/class/qasparser.cpp index f8d262f..53dffac 100644 --- a/src/class/qasparser.cpp +++ b/src/class/qasparser.cpp @@ -303,10 +303,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, if (type == QCodeNode::Class) { visibility = QCodeNode::VISIBILITY_PRIVATE; - } else if (type == QCodeNode::Struct) { - visibility = QCodeNode::VISIBILITY_PUBLIC; - } else if ((type == QCodeNode::Union) || (type == QCodeNode::Enum) || - (type == QCodeNode::Namespace)) { + } else if ((type == QCodeNode::Enum) || (type == QCodeNode::Namespace)) { visibility = QCodeNode::VISIBILITY_PUBLIC; } @@ -323,8 +320,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, // qDebug("\"%s\"", token.constData()); switch (k) { - case KEYWORD_CLASS: - case KEYWORD_STRUCT: { + case KEYWORD_CLASS: { if (ltemplates.count() == 1 && ltemplates.at(0).isEmpty()) { // specialization : discard buffer_unused.clear(); @@ -394,7 +390,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, name = ""; } - QByteArray roles = (k == KEYWORD_STRUCT) ? "s@" : "c@"; + QByteArray roles = "c@"; #ifdef _TRACE_PARSING_ qDebug("%s %s", (k == KEYWORD_STRUCT) ? "struct" : "class", @@ -405,8 +401,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, roles += "@"; // QList ancestors; - QByteArray rule, - drule = (k == KEYWORD_CLASS) ? "private" : "public"; + QByteArray rule, drule = "private"; if (tokens.at(id) == ":") { while (filter(++id, end)) { @@ -677,73 +672,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, 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 = ""; - } 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: { ltemplates.clear(); @@ -848,9 +776,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, ++id; switch (keyword(tokens.at(id))) { - case KEYWORD_STRUCT: - case KEYWORD_ENUM: - case KEYWORD_UNION: { + case KEYWORD_ENUM: { ++id; QByteArray name; @@ -1197,47 +1123,19 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, int nodeType = pScope->type(); bool cont = false, - inClass = ((nodeType == QCodeNode::Class) || - (nodeType == QCodeNode::Struct)); + inClass = (nodeType == QCodeNode::Class); if (!inClass) { - - if (*ba == "static") { - ts |= QCodeNode::SPECIFIER_STATIC; - - if (((ba + 1) < buffer_end) && - (*(ba + 1) == "const")) { - ++ba; - ts |= QCodeNode::SPECIFIER_CONST; - } - - } else if (*ba == "extern") + if (*ba == "extern") ts |= QCodeNode::SPECIFIER_EXTERN; else if (*ba == "auto") ts |= QCodeNode::SPECIFIER_AUTO; - else if (*ba == "register") - ts |= QCodeNode::SPECIFIER_REGISTER; else if (*ba == "const") ts |= QCodeNode::SPECIFIER_CONST; - else if (*ba == "volatile") - ts |= QCodeNode::SPECIFIER_VOLATILE; - else if (*ba == "mutable") - ts |= QCodeNode::SPECIFIER_MUTABLE; else --ba; } else { - if (*ba == "static") { - 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") + if (*ba == "const") ts |= QCodeNode::SPECIFIER_CONST; else --ba; @@ -1414,9 +1312,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, } else if (buffer_unused.last() == "private") { visa = true; visibility = QCodeNode::VISIBILITY_PRIVATE; - } else if (buffer_unused.last() == "signals") { - visa = true; - visibility = QCodeNode::VISIBILITY_SIGNAL; } else { // qWarning("weird syntactic construct in %s", // sContext.constData()); @@ -1469,14 +1364,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, QCodeNode::FunctionQualifier fq = QCodeNode::QUALIFIER_NONE; - int pref_idx = buffer_unused.indexOf("inline"); - - if (pref_idx != -1) { - fq |= QCodeNode::QUALIFIER_INLINE; - buffer_unused.removeAt(pref_idx); - } - - pref_idx = buffer_unused.indexOf("explicit"); + int pref_idx = buffer_unused.indexOf("explicit"); if (pref_idx != -1) buffer_unused.removeAt(pref_idx); @@ -1539,8 +1427,7 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, // maybe ctor or dtor - if (((pScope->type() == QCodeNode::Class) || - (pScope->type() == QCodeNode::Struct)) && + if ((pScope->type() == QCodeNode::Class) && (name == pScope->role(QCodeNode::Name))) { isCtorDtor = true; @@ -1551,8 +1438,8 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, } if (buffer_unused.count() && - buffer_unused.at(0) == "virtual") { - fq |= QCodeNode::QUALIFIER_VIRTUAL; + buffer_unused.at(0) == "abstract") { + fq |= QCodeNode::QUALIFIER_ABSTRACT; buffer_unused.removeAt(0); } @@ -1572,10 +1459,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, // anything else if (buffer_unused.at(0) == "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 goto skip_qualifiers; @@ -1640,12 +1523,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, break; } else if (tokens.at(id) == "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; } @@ -1653,10 +1530,6 @@ void QAsParser::update(QCodeNode *n, QCodeLexer *l, QTokenList &tokens, int id, if (!retval.endsWith("::") && !retval.endsWith(":: ~") // small quirk handling... ) { - if (retval.startsWith("inline ")) { - retval.remove(0, 7); - fq |= QCodeNode::QUALIFIER_INLINE; - } prettify(name); prettify(retval); @@ -1876,10 +1749,8 @@ static const QAsParser::KeywordId IdTable[] = { QCppParser::KEYWORD_RETURN, QCppParser::KEYWORD_SHORT, QCppParser::KEYWORD_SIGNED, - QCppParser::KEYWORD_STATIC, - */ - QAsParser::KEYWORD_STRUCT, + */ /* QCppParser::KEYWORD_SWITCH, @@ -1898,8 +1769,6 @@ static const QAsParser::KeywordId IdTable[] = { // QCppParser::KEYWORD_TYPENAME, - QAsParser::KEYWORD_UNION, - // QCppParser::KEYWORD_UNSIGNED, QAsParser::KEYWORD_USING, diff --git a/src/class/qasparser.h b/src/class/qasparser.h index 672a25a..1dfc08f 100644 --- a/src/class/qasparser.h +++ b/src/class/qasparser.h @@ -12,7 +12,6 @@ public: KEYWORD_NONE = -1, KEYWORD_ATTRIBUTE, - KEYWORD_ASM, KEYWORD_AUTO, KEYWORD_BOOL, KEYWORD_BREAK, @@ -40,19 +39,16 @@ public: KEYWORD_INT, KEYWORD_INTERNAL, KEYWORD_LONG, - KEYWORD_MUTABLE, KEYWORD_NAMESPACE, KEYWORD_NEW, KEYWORD_OPERATOR, KEYWORD_PRIVATE, KEYWORD_PROTECTED, KEYWORD_PUBLIC, - KEYWORD_REGISTER, KEYWORD_RETURN, KEYWORD_SHORT, KEYWORD_SIGNED, KEYWORD_STATIC, - KEYWORD_STRUCT, KEYWORD_SWITCH, KEYWORD_SIZEOF, KEYWORD_TEMPLATE, @@ -61,13 +57,10 @@ public: KEYWORD_TRY, KEYWORD_TYPEDEF, KEYWORD_TYPENAME, - KEYWORD_UNION, KEYWORD_UNSIGNED, KEYWORD_USING, KEYWORD_VIRTUAL, KEYWORD_VOID, - KEYWORD_VOLATILE, - KEYWORD_WCHAR_T, KEYWORD_WHILE, KEYWORD_COUNT diff --git a/src/control/qcodecompletionwidget.cpp b/src/control/qcodecompletionwidget.cpp index b5d3dd0..ccf88d7 100644 --- a/src/control/qcodecompletionwidget.cpp +++ b/src/control/qcodecompletionwidget.cpp @@ -513,8 +513,7 @@ bool QCodeCompletionModel::match(QCodeNode *n, ); */ - if ((((type == QCodeNode::Class) || (type == QCodeNode::Struct) || - (type == QCodeNode::Union) || (type == QCodeNode::Typedef)) && + if ((((type == QCodeNode::Class) || (type == QCodeNode::Typedef)) && !(filter & QCodeCompletionWidget::KeepSubTypes)) || ((type == QCodeNode::Enum) && !(filter & QCodeCompletionWidget::KeepEnums)) || @@ -525,23 +524,19 @@ bool QCodeCompletionModel::match(QCodeNode *n, ((visibility == QCodeNode::VISIBILITY_PUBLIC) && !(filter & QCodeCompletionWidget::Public)) || ((type == QCodeNode::Variable) && - (((specifiers & QCodeNode::SPECIFIER_STATIC) && - !(filter & QCodeCompletionWidget::KeepStatic)) || + ((!(filter & QCodeCompletionWidget::KeepStatic)) || ((specifiers & QCodeNode::SPECIFIER_CONST) && !(filter & QCodeCompletionWidget::KeepConst)) || - (!(specifiers & QCodeNode::SPECIFIER_STATIC) && - (filter & QCodeCompletionWidget::IsStatic)) + ((filter & QCodeCompletionWidget::IsStatic)) // || // (!(specifiers & QCodeNode::SPECIFIER_CONST) && //(filter & QCodeCompletionWidget::IsConst)) )) || ((type == QCodeNode::Function) && - (((qualifiers & QCodeNode::QUALIFIER_STATIC) && - !(filter & QCodeCompletionWidget::KeepStatic)) || + ((!(filter & QCodeCompletionWidget::KeepStatic)) || ((qualifiers & QCodeNode::QUALIFIER_CONST) && !(filter & QCodeCompletionWidget::KeepConst)) || - (!(qualifiers & QCodeNode::QUALIFIER_STATIC) && - (filter & QCodeCompletionWidget::IsStatic) && + ((filter & QCodeCompletionWidget::IsStatic) && (n->parent->type() != QCodeNode::Namespace)) || (!(qualifiers & QCodeNode::QUALIFIER_CONST) && (filter & QCodeCompletionWidget::IsConst)) || diff --git a/src/control/scripteditor.cpp b/src/control/scripteditor.cpp index 589ebbf..90ce828 100644 --- a/src/control/scripteditor.cpp +++ b/src/control/scripteditor.cpp @@ -5,6 +5,7 @@ #include #include +#include "qlanguagefactory.h" #include "qlinemarkpanel.h" #include "qlinenumberpanel.h" #include "qpanellayout.h" diff --git a/src/control/toast.cpp b/src/control/toast.cpp index 99d6fda..29aea0f 100644 --- a/src/control/toast.cpp +++ b/src/control/toast.cpp @@ -10,7 +10,7 @@ #include #include -#include "../class/eventfilter.h" +#include "class/eventfilter.h" int Toast::LENGTH_LONG = 4000; int Toast::LENGTH_SHORT = 1500; diff --git a/src/dialog/scriptingdialog.cpp b/src/dialog/scriptingdialog.cpp index ec07d1a..09eb080 100644 --- a/src/dialog/scriptingdialog.cpp +++ b/src/dialog/scriptingdialog.cpp @@ -3,6 +3,7 @@ #include "QWingRibbon/ribbontabcontent.h" #include "Qt-Advanced-Docking-System/src/DockAreaWidget.h" #include "aboutsoftwaredialog.h" +#include "class/ascompletion.h" #include "class/languagemanager.h" #include "class/qkeysequences.h" #include "class/settingmanager.h" @@ -11,6 +12,8 @@ #include "class/wingmessagebox.h" #include "control/toast.h" #include "qcodeeditwidget/qeditconfig.h" +#include "qcodeloader.h" +#include "qcodemodel.h" #include "qdocumentline.h" #include "qeditor.h" #include "qformatscheme.h" @@ -73,8 +76,22 @@ ScriptingDialog::ScriptingDialog(QWidget *parent) break; } 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->addDefinitionPath(QStringLiteral(":/qcodeedit")); + m_language->addCompletionEngine(new AsCompletion(m_codeModel, this)); auto lmic = QLineMarksInfoCenter::instance(); lmic->loadMarkTypes(QCE::fetchDataFile(":/qcodeedit/marks.qxm")); diff --git a/src/dialog/scriptingdialog.h b/src/dialog/scriptingdialog.h index a8b8b56..695aea5 100644 --- a/src/dialog/scriptingdialog.h +++ b/src/dialog/scriptingdialog.h @@ -14,6 +14,8 @@ #include "model/dbgbreakpointmodel.h" #include "model/dbgcallstackmodel.h" #include "model/dbgvarshowmodel.h" +#include "qcodeproxymodel.h" +#include "qcodeview.h" #include "qlanguagefactory.h" #include "utilities.h" @@ -233,6 +235,9 @@ private: ads::CDockManager *m_dock = nullptr; ads::CDockAreaWidget *m_editorViewArea = nullptr; QLanguageFactory *m_language = nullptr; + QCodeView *m_codeView = nullptr; + QCodeModel *m_codeModel = nullptr; + QCodeProxyModel *m_codeProxy = nullptr; QByteArray _defaultLayout; ScriptEditor *m_curEditor = nullptr;