feat: 优化代码编辑器;完善插件系统;增加C结构体分析支持;
This commit is contained in:
parent
bef7f232f3
commit
f77f7ae1b1
|
@ -690,17 +690,7 @@ void QHexRenderer::applyBookMark(QTextCursor &textcursor, qsizetype line,
|
|||
auto charformat = textcursor.charFormat();
|
||||
textcursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor,
|
||||
factor - 1);
|
||||
charformat.setFontOverline(true);
|
||||
|
||||
if (charformat.underlineStyle() ==
|
||||
QTextCharFormat::UnderlineStyle::NoUnderline) {
|
||||
charformat.setUnderlineStyle(
|
||||
QTextCharFormat::UnderlineStyle::DashUnderline);
|
||||
} else {
|
||||
charformat.setUnderlineStyle(
|
||||
QTextCharFormat::UnderlineStyle::WaveUnderline);
|
||||
}
|
||||
|
||||
charformat.setFontWeight(QFont::Bold);
|
||||
textcursor.setCharFormat(charformat);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,13 +47,8 @@ set(QNFA_SRC
|
|||
lib/qnfa/xml2qnfa.cpp lib/qnfa/qnfa.cpp lib/qnfa/qnfadefinition.cpp)
|
||||
|
||||
set(SNIPPET_SRC
|
||||
lib/snippets/qsnippet.cpp
|
||||
lib/snippets/qsnippet.h
|
||||
lib/snippets/qsnippet_p.h
|
||||
lib/snippets/qsnippetbinding.cpp
|
||||
lib/snippets/qsnippetbinding.h
|
||||
lib/snippets/qsnippetmanager.cpp
|
||||
lib/snippets/qsnippetmanager.h
|
||||
lib/snippets/qsnippet.cpp lib/snippets/qsnippet.h lib/snippets/qsnippet_p.h
|
||||
lib/snippets/qsnippetmanager.cpp lib/snippets/qsnippetmanager.h
|
||||
lib/snippets/qsnippetpatternloader.h)
|
||||
|
||||
set(SOURCE_FILES
|
||||
|
@ -61,8 +56,6 @@ set(SOURCE_FILES
|
|||
lib/qcodecompletionengine.h
|
||||
lib/qcodeedit.h
|
||||
lib/qeditor.h
|
||||
lib/qeditorinputbinding.h
|
||||
lib/qeditorinputbindinginterface.h
|
||||
lib/qeditsession.h
|
||||
lib/qformat.h
|
||||
lib/qformatfactory.h
|
||||
|
@ -75,7 +68,6 @@ set(SOURCE_FILES
|
|||
lib/qcodecompletionengine.cpp
|
||||
lib/qcodeedit.cpp
|
||||
lib/qeditor.cpp
|
||||
lib/qeditorinputbinding.cpp
|
||||
lib/qeditsession.cpp
|
||||
lib/qformatscheme.cpp
|
||||
lib/qlanguagedefinition.cpp
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
\brief Implementation of the QEditor class
|
||||
*/
|
||||
|
||||
#include "qeditorinputbindinginterface.h"
|
||||
|
||||
#include "qdocument.h"
|
||||
#include "qdocument_p.h"
|
||||
#include "qdocumentcursor.h"
|
||||
|
@ -176,67 +174,6 @@
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QList<QEditor *> QEditor::m_editors;
|
||||
QEditorInputBindingInterface *QEditor::m_defaultBinding = 0;
|
||||
QHash<QString, QEditorInputBindingInterface *> QEditor::m_registeredBindings;
|
||||
|
||||
/*!
|
||||
\return A list of available input bindings
|
||||
*/
|
||||
QStringList QEditor::registeredInputBindingIds() {
|
||||
return m_registeredBindings.keys();
|
||||
}
|
||||
|
||||
/*!
|
||||
\return the name of the default input binding
|
||||
|
||||
\note The "Default" name (or its translation, obtained via
|
||||
QEditor::tr()) is used to indicate that no default input binding has been
|
||||
set.
|
||||
*/
|
||||
QString QEditor::defaultInputBindingId() {
|
||||
return m_defaultBinding ? m_defaultBinding->name() : tr("Default");
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Add an input binding to make it available for all editors
|
||||
*/
|
||||
void QEditor::registerInputBinding(QEditorInputBindingInterface *b) {
|
||||
m_registeredBindings[b->id()] = b;
|
||||
|
||||
for (auto &e : m_editors)
|
||||
e->updateBindingsMenu();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Remove an input binding from the pool of publicly available ones
|
||||
*/
|
||||
void QEditor::unregisterInputBinding(QEditorInputBindingInterface *b) {
|
||||
m_registeredBindings.remove(b->id());
|
||||
|
||||
for (auto &e : m_editors)
|
||||
e->updateBindingsMenu();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set the default input binding
|
||||
|
||||
\note This does not change the current input binding of existing editors
|
||||
*/
|
||||
void QEditor::setDefaultInputBinding(QEditorInputBindingInterface *b) {
|
||||
m_defaultBinding = b;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set the default input binding
|
||||
|
||||
\note If no binding of the given name is available the default (null)
|
||||
binding will be set back as default binding.
|
||||
|
||||
\note This does not change the current input binding of existing editors
|
||||
*/
|
||||
void QEditor::setDefaultInputBinding(const QString &b) {
|
||||
m_defaultBinding = m_registeredBindings.value(b);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -390,8 +327,7 @@ void QEditor::setDefaultCodec(const QString &name, int update) {
|
|||
\note Creates builtin menus/actions
|
||||
*/
|
||||
QEditor::QEditor(QWidget *p)
|
||||
: QAbstractScrollArea(p), pMenu(nullptr), m_bindingsMenu(nullptr),
|
||||
aDefaultBinding(nullptr), m_bindingsActions(nullptr), m_doc(nullptr),
|
||||
: QAbstractScrollArea(p), pMenu(nullptr), m_doc(nullptr),
|
||||
m_codec(m_defaultCodecName), m_definition(nullptr), m_curPlaceHolder(-1),
|
||||
m_state(defaultFlags()) {
|
||||
m_editors << this;
|
||||
|
@ -406,8 +342,7 @@ QEditor::QEditor(QWidget *p)
|
|||
\param actions Whether builtin actions and menus should be created
|
||||
*/
|
||||
QEditor::QEditor(bool actions, QWidget *p)
|
||||
: QAbstractScrollArea(p), pMenu(nullptr), m_bindingsMenu(nullptr),
|
||||
aDefaultBinding(nullptr), m_bindingsActions(nullptr), m_doc(nullptr),
|
||||
: QAbstractScrollArea(p), pMenu(nullptr), m_doc(nullptr),
|
||||
m_codec(m_defaultCodecName), m_definition(nullptr), m_curPlaceHolder(-1),
|
||||
m_state(defaultFlags()) {
|
||||
m_editors << this;
|
||||
|
@ -487,10 +422,6 @@ void QEditor::init(bool actions) {
|
|||
m_cursor = QDocumentCursor(m_doc);
|
||||
m_cursor.setAutoUpdated(true);
|
||||
|
||||
if (m_defaultBinding) {
|
||||
m_bindings << m_defaultBinding;
|
||||
}
|
||||
|
||||
pMenu = new QMenu;
|
||||
|
||||
if (actions) {
|
||||
|
@ -605,13 +536,6 @@ void QEditor::init(bool actions) {
|
|||
|
||||
addAction(a, "&Search", "Search");
|
||||
|
||||
a = new QAction(tr("Fin&d next"), pMenu);
|
||||
a->setObjectName("findNext");
|
||||
Q_SHORTCUT(a, "F3", "Search");
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(findNext()));
|
||||
|
||||
addAction(a, "&Search", "Search");
|
||||
|
||||
a = new QAction(QIcon(":/qeditor/replace.png"), tr("&Replace"), this);
|
||||
a->setObjectName("replace");
|
||||
Q_SHORTCUT(a, "Ctrl+R", "Search");
|
||||
|
@ -630,50 +554,9 @@ void QEditor::init(bool actions) {
|
|||
|
||||
addAction(a, "&Search", "Search");
|
||||
|
||||
sep = new QAction(this);
|
||||
sep->setSeparator(true);
|
||||
addAction(sep, "&Edit", "");
|
||||
|
||||
a = new QAction(tr("Dynamic line wrapping"), this);
|
||||
a->setObjectName("wrap");
|
||||
a->setCheckable(true);
|
||||
a->setChecked(flag(LineWrap));
|
||||
|
||||
addAction(a, "&Edit", "");
|
||||
|
||||
Q_SHORTCUT(a, "F10", "Edit");
|
||||
connect(a, SIGNAL(toggled(bool)), this, SLOT(setLineWrapping(bool)));
|
||||
|
||||
m_bindingsMenu = new QMenu(tr("Input binding"), this);
|
||||
m_bindingsActions = new QActionGroup(m_bindingsMenu);
|
||||
// m_bindingsActions->setExclusive(true);
|
||||
|
||||
connect(m_bindingsActions, &QActionGroup::triggered, this,
|
||||
&QEditor::bindingSelected);
|
||||
|
||||
aDefaultBinding = new QAction(tr("Default"), m_bindingsMenu);
|
||||
aDefaultBinding->setCheckable(true);
|
||||
aDefaultBinding->setData("default");
|
||||
|
||||
m_bindingsMenu->addAction(aDefaultBinding);
|
||||
m_bindingsMenu->addSeparator();
|
||||
m_bindingsActions->addAction(aDefaultBinding);
|
||||
m_registeredBindings["default"] = 0;
|
||||
|
||||
updateBindingsMenu();
|
||||
|
||||
m_bindingsMenu->menuAction()->setObjectName("bindings");
|
||||
addAction(m_bindingsMenu->menuAction(), "&Edit", "");
|
||||
|
||||
sep = new QAction(this);
|
||||
sep->setSeparator(true);
|
||||
addAction(sep, QString());
|
||||
|
||||
/*
|
||||
sep = new QAction(this);
|
||||
sep->setSeparator(true);
|
||||
addAction(sep, QString());
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1083,12 +966,6 @@ void QEditor::retranslate() {
|
|||
|
||||
if (m_completionEngine)
|
||||
m_completionEngine->retranslate();
|
||||
|
||||
if (m_bindingsMenu)
|
||||
m_bindingsMenu->setTitle(tr("Input binding"));
|
||||
|
||||
if (aDefaultBinding)
|
||||
aDefaultBinding->setText(tr("Default"));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1276,154 +1153,6 @@ void QEditor::highlight() {
|
|||
// updateContent(0, m_doc->lines());
|
||||
}
|
||||
|
||||
/*!
|
||||
\return the current InputBinding
|
||||
*/
|
||||
QList<QEditorInputBindingInterface *> QEditor::inputBindings() const {
|
||||
return m_bindings;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set the current input binding
|
||||
*/
|
||||
void QEditor::addInputBinding(QEditorInputBindingInterface *b) {
|
||||
if (b)
|
||||
m_bindings << b;
|
||||
|
||||
if (!aDefaultBinding || !m_bindingsActions)
|
||||
return;
|
||||
|
||||
QString id = b ? b->id() : QString();
|
||||
aDefaultBinding->setChecked(!b);
|
||||
|
||||
if (!b)
|
||||
return;
|
||||
|
||||
QList<QAction *> actions = m_bindingsActions->actions();
|
||||
|
||||
for (auto &a : actions) {
|
||||
if (a->data().toString() != id)
|
||||
a->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set the current input binding
|
||||
*/
|
||||
void QEditor::removeInputBinding(QEditorInputBindingInterface *b) {
|
||||
int n = m_bindings.removeAll(b);
|
||||
|
||||
if (!aDefaultBinding || !m_bindingsActions || !n)
|
||||
return;
|
||||
|
||||
QString id = b ? b->id() : QString();
|
||||
aDefaultBinding->setChecked(!b);
|
||||
|
||||
if (!b)
|
||||
return;
|
||||
|
||||
QList<QAction *> actions = m_bindingsActions->actions();
|
||||
|
||||
for (auto &a : actions) {
|
||||
if (a->data().toString() != id)
|
||||
a->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set the current input binding
|
||||
*/
|
||||
void QEditor::setInputBinding(QEditorInputBindingInterface *b) {
|
||||
m_bindings.clear();
|
||||
|
||||
if (b)
|
||||
m_bindings << b;
|
||||
|
||||
if (!aDefaultBinding || !m_bindingsActions)
|
||||
return;
|
||||
|
||||
QString id = b ? b->id() : QString();
|
||||
aDefaultBinding->setChecked(!b);
|
||||
|
||||
if (!b)
|
||||
return;
|
||||
|
||||
QList<QAction *> actions = m_bindingsActions->actions();
|
||||
|
||||
for (auto &a : actions) {
|
||||
if (a)
|
||||
a->setChecked(a->data().toString() != id);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QEditor::updateBindingsMenu() {
|
||||
if (!aDefaultBinding || !m_bindingsMenu || !m_bindingsActions)
|
||||
return;
|
||||
|
||||
QStringList bindings = registeredInputBindingIds();
|
||||
QList<QAction *> actions = m_bindingsActions->actions();
|
||||
|
||||
aDefaultBinding->setChecked(m_bindings.contains(m_defaultBinding));
|
||||
|
||||
for (auto &a : actions) {
|
||||
int idx = bindings.indexOf(a->data().toString());
|
||||
|
||||
if (idx == -1) {
|
||||
m_bindingsMenu->removeAction(a);
|
||||
m_bindingsActions->removeAction(a);
|
||||
delete a;
|
||||
} else {
|
||||
bindings.removeAt(idx);
|
||||
|
||||
for (auto &b : m_bindings)
|
||||
if (a->data().toString() == b->id())
|
||||
a->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
bindings.removeAll("default");
|
||||
|
||||
for (auto &s : bindings) {
|
||||
QEditorInputBindingInterface *b = m_registeredBindings.value(s);
|
||||
|
||||
if (!b)
|
||||
continue;
|
||||
|
||||
QAction *a = new QAction(b->name(), m_bindingsMenu);
|
||||
a->setData(b->id());
|
||||
a->setCheckable(true);
|
||||
|
||||
m_bindingsActions->addAction(a);
|
||||
m_bindingsMenu->addAction(a);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QEditor::bindingSelected(QAction *a) {
|
||||
// a = m_bindingsActions->checkedAction();
|
||||
|
||||
if (!a)
|
||||
return;
|
||||
|
||||
QEditorInputBindingInterface *b =
|
||||
m_registeredBindings.value(a->data().toString());
|
||||
|
||||
if (a->isChecked())
|
||||
addInputBinding(b);
|
||||
else
|
||||
removeInputBinding(b);
|
||||
|
||||
// qDebug("setting binding to %s [0x%x]", qPrintable(a->data().toString()),
|
||||
// m_binding);
|
||||
|
||||
updateMicroFocus();
|
||||
}
|
||||
|
||||
/*!
|
||||
\return the current cursor
|
||||
*/
|
||||
|
@ -2368,10 +2097,6 @@ void QEditor::createSimpleBasicContextMenu(bool shortcut, bool extTool) {
|
|||
\internal
|
||||
*/
|
||||
void QEditor::keyPressEvent(QKeyEvent *e) {
|
||||
for (auto &b : m_bindings)
|
||||
if (b->keyPressEvent(e, this))
|
||||
return;
|
||||
|
||||
forever {
|
||||
bool leave = false;
|
||||
|
||||
|
@ -2585,19 +2310,12 @@ void QEditor::keyPressEvent(QKeyEvent *e) {
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto &b : m_bindings)
|
||||
b->postKeyPressEvent(e, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QEditor::inputMethodEvent(QInputMethodEvent *e) {
|
||||
for (auto &b : m_bindings)
|
||||
if (b->inputMethodEvent(e, this))
|
||||
return;
|
||||
|
||||
if (flag(ReadOnly)) {
|
||||
e->ignore();
|
||||
return;
|
||||
|
@ -2609,19 +2327,12 @@ void QEditor::inputMethodEvent(QInputMethodEvent *e) {
|
|||
m_cursor.insertText(e->commitString());
|
||||
|
||||
m_cursor.endEditBlock();
|
||||
|
||||
for (auto &b : m_bindings)
|
||||
b->postInputMethodEvent(e, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QEditor::mouseMoveEvent(QMouseEvent *e) {
|
||||
for (auto &b : m_bindings)
|
||||
if (b->mouseMoveEvent(e, this))
|
||||
return;
|
||||
|
||||
forever {
|
||||
if (!(e->buttons() & Qt::LeftButton))
|
||||
break;
|
||||
|
@ -2702,19 +2413,12 @@ void QEditor::mouseMoveEvent(QMouseEvent *e) {
|
|||
repaintCursor();
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto &b : m_bindings)
|
||||
b->postMouseMoveEvent(e, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QEditor::mousePressEvent(QMouseEvent *e) {
|
||||
for (auto &b : m_bindings)
|
||||
if (b->mousePressEvent(e, this))
|
||||
return;
|
||||
|
||||
forever {
|
||||
if (!(e->buttons() & Qt::LeftButton))
|
||||
break;
|
||||
|
@ -2831,19 +2535,12 @@ void QEditor::mousePressEvent(QMouseEvent *e) {
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (QEditorInputBindingInterface *b, m_bindings)
|
||||
b->postMousePressEvent(e, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QEditor::mouseReleaseEvent(QMouseEvent *e) {
|
||||
foreach (QEditorInputBindingInterface *b, m_bindings)
|
||||
if (b->mouseReleaseEvent(e, this))
|
||||
return;
|
||||
|
||||
m_scroll.stop();
|
||||
|
||||
repaintCursor();
|
||||
|
@ -2875,19 +2572,12 @@ void QEditor::mouseReleaseEvent(QMouseEvent *e) {
|
|||
|
||||
if (m_drag.isActive())
|
||||
m_drag.stop();
|
||||
|
||||
for (auto &b : m_bindings)
|
||||
b->postMouseReleaseEvent(e, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QEditor::mouseDoubleClickEvent(QMouseEvent *e) {
|
||||
for (auto &b : m_bindings)
|
||||
if (b->mouseDoubleClickEvent(e, this))
|
||||
return;
|
||||
|
||||
forever {
|
||||
if (e->button() != Qt::LeftButton) {
|
||||
e->ignore();
|
||||
|
@ -2928,9 +2618,6 @@ void QEditor::mouseDoubleClickEvent(QMouseEvent *e) {
|
|||
m_click.start(qApp->doubleClickInterval(), this);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (QEditorInputBindingInterface *b, m_bindings)
|
||||
b->postMouseDoubleClickEvent(e, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -3171,10 +2858,6 @@ void QEditor::focusOutEvent(QFocusEvent *e) {
|
|||
default.
|
||||
*/
|
||||
void QEditor::contextMenuEvent(QContextMenuEvent *e) {
|
||||
foreach (QEditorInputBindingInterface *b, m_bindings)
|
||||
if (b->contextMenuEvent(e, this))
|
||||
return;
|
||||
|
||||
if (!pMenu) {
|
||||
e->ignore();
|
||||
return;
|
||||
|
@ -3716,6 +3399,7 @@ bool QEditor::processCursor(QDocumentCursor &c, QKeyEvent *e, bool &b) {
|
|||
text + m_cursor.selectedText() + getPairedCloseChar(text);
|
||||
c.replaceSelectedText(content);
|
||||
c.clearSelection();
|
||||
c.movePosition(-1);
|
||||
} else {
|
||||
if (text == QStringLiteral("\"") ||
|
||||
text == QStringLiteral("'")) {
|
||||
|
@ -3729,7 +3413,13 @@ bool QEditor::processCursor(QDocumentCursor &c, QKeyEvent *e, bool &b) {
|
|||
} else {
|
||||
auto ch = c.nextChar();
|
||||
if (ch == QChar('"') || ch == QChar('\'')) {
|
||||
c.movePosition(1);
|
||||
if (c.previousChar() == QChar('\\')) {
|
||||
c.beginEditBlock();
|
||||
insertText(c, text);
|
||||
c.endEditBlock();
|
||||
} else {
|
||||
c.movePosition(1);
|
||||
}
|
||||
} else {
|
||||
c.beginEditBlock();
|
||||
insertText(c, text + text);
|
||||
|
@ -3739,6 +3429,13 @@ bool QEditor::processCursor(QDocumentCursor &c, QKeyEvent *e, bool &b) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (isPairedCloseChar(text)) {
|
||||
if (c.previousChar() == getPairedBeginChar(text)) {
|
||||
c.movePosition(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
c.beginEditBlock();
|
||||
insertText(c, text);
|
||||
c.endEditBlock();
|
||||
|
@ -4322,6 +4019,25 @@ bool QEditor::isAutoCloseChar(const QString &ch) {
|
|||
ch == QStringLiteral("(");
|
||||
}
|
||||
|
||||
bool QEditor::isPairedCloseChar(const QString &ch) {
|
||||
// auto close: {} [] ()
|
||||
return ch == QStringLiteral("}") || ch == QStringLiteral("]") ||
|
||||
ch == QStringLiteral(")");
|
||||
}
|
||||
|
||||
QString QEditor::getPairedBeginChar(const QString &ch) {
|
||||
// auto close: {} [] ()
|
||||
if (ch == QStringLiteral("}")) {
|
||||
return QStringLiteral("{");
|
||||
} else if (ch == QStringLiteral("]")) {
|
||||
return QStringLiteral("[");
|
||||
} else if (ch == QStringLiteral(")")) {
|
||||
return QStringLiteral("(");
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
QString QEditor::getPairedCloseChar(const QString &ch) {
|
||||
// auto close: {} [] ()
|
||||
if (ch == QStringLiteral("{")) {
|
||||
|
|
|
@ -45,8 +45,6 @@ class QDocumentLineHandle;
|
|||
class QLanguageDefinition;
|
||||
class QCodeCompletionEngine;
|
||||
|
||||
class QEditorInputBindingInterface;
|
||||
|
||||
class QCE_EXPORT QEditor : public QAbstractScrollArea {
|
||||
friend class QEditConfig;
|
||||
friend class QEditorFactory;
|
||||
|
@ -135,8 +133,6 @@ public:
|
|||
QString codecName() const;
|
||||
QDocument *document() const;
|
||||
|
||||
QList<QEditorInputBindingInterface *> inputBindings() const;
|
||||
|
||||
bool isCursorVisible() const;
|
||||
QDocumentCursor cursor() const;
|
||||
|
||||
|
@ -207,15 +203,6 @@ public:
|
|||
static QString defaultCodecName();
|
||||
static void setDefaultCodec(const QString &name, int update);
|
||||
|
||||
static QEditorInputBindingInterface *
|
||||
registeredInputBinding(const QString &n);
|
||||
static QString defaultInputBindingId();
|
||||
static QStringList registeredInputBindingIds();
|
||||
static void registerInputBinding(QEditorInputBindingInterface *b);
|
||||
static void unregisterInputBinding(QEditorInputBindingInterface *b);
|
||||
static void setDefaultInputBinding(QEditorInputBindingInterface *b);
|
||||
static void setDefaultInputBinding(const QString &b);
|
||||
|
||||
static inline const QList<QEditor *> &editors() { return m_editors; }
|
||||
|
||||
public slots:
|
||||
|
@ -265,10 +252,6 @@ public slots:
|
|||
|
||||
void setDocument(QDocument *d);
|
||||
|
||||
void addInputBinding(QEditorInputBindingInterface *b);
|
||||
void removeInputBinding(QEditorInputBindingInterface *b);
|
||||
void setInputBinding(QEditorInputBindingInterface *b);
|
||||
|
||||
void setCursor(const QDocumentCursor &c);
|
||||
|
||||
void setLanguageDefinition(QLanguageDefinition *d);
|
||||
|
@ -413,6 +396,9 @@ private:
|
|||
|
||||
bool isAutoCloseChar(const QString &ch);
|
||||
|
||||
bool isPairedCloseChar(const QString &ch);
|
||||
|
||||
QString getPairedBeginChar(const QString &ch);
|
||||
QString getPairedCloseChar(const QString &ch);
|
||||
|
||||
protected slots:
|
||||
|
@ -424,29 +410,21 @@ protected slots:
|
|||
|
||||
void emitMarkChanged(QDocumentLineHandle *l, int mark, bool on);
|
||||
|
||||
void bindingSelected(QAction *a);
|
||||
|
||||
protected:
|
||||
enum SaveState { Undefined, Saving, Saved, Conflict };
|
||||
|
||||
void init(bool actions = true);
|
||||
void updateBindingsMenu();
|
||||
|
||||
QString m_name, m_fileName;
|
||||
|
||||
QMenu *pMenu;
|
||||
QHash<QString, QAction *> m_actions;
|
||||
|
||||
QMenu *m_bindingsMenu;
|
||||
QAction *aDefaultBinding;
|
||||
QActionGroup *m_bindingsActions;
|
||||
|
||||
char m_saveState;
|
||||
quint16 m_checksum;
|
||||
|
||||
QDocument *m_doc;
|
||||
QString m_codec;
|
||||
QList<QEditorInputBindingInterface *> m_bindings;
|
||||
|
||||
QLanguageDefinition *m_definition;
|
||||
QPointer<QCodeCompletionEngine> m_completionEngine;
|
||||
|
@ -476,8 +454,6 @@ protected:
|
|||
static QString m_defaultCodecName;
|
||||
|
||||
static QList<QEditor *> m_editors;
|
||||
static QEditorInputBindingInterface *m_defaultBinding;
|
||||
static QHash<QString, QEditorInputBindingInterface *> m_registeredBindings;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QEditor::State);
|
||||
|
|
|
@ -1,275 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qeditorinputbinding.h"
|
||||
|
||||
#include "qdocument.h"
|
||||
#include "qdocumentcursor.h"
|
||||
#include "qeditor.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
/*!
|
||||
\class QEditorInputBindingInterface
|
||||
\brief A class designed to allow extending user input in a transparent
|
||||
way
|
||||
|
||||
An input binding interface, when set to an editor, can intercept all the
|
||||
events the editor receive and radically change the behavior.
|
||||
|
||||
The main purpose of this class is twofold :
|
||||
<ul>
|
||||
<li>Allow vi-like (or emacs-like, ...) editing to be implemented with
|
||||
little extra work. And allow the user to easily switch between input
|
||||
modes</li> <li>Allow applications using QCE to easily add extra features (e.g
|
||||
extended code navigation within projects, jump to documentation, ...) with
|
||||
little extra work</li>
|
||||
</ul>
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QEditorInputBinding
|
||||
\brief A "managed" input binding interface
|
||||
|
||||
This subclass of QEditorInputBindingInterface is meant to make the
|
||||
creatio of input bindings easier and more intuitive by abstracting away most
|
||||
of the low-level event handling logic.
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QEditorInputBinding::MotionCommand::MotionCommand(
|
||||
QDocumentCursor::MoveOperation op, QDocumentCursor::MoveMode m, int n)
|
||||
: count(n), mode(m), operation(op) {}
|
||||
|
||||
void QEditorInputBinding::MotionCommand::exec(QEditor *e) {
|
||||
QDocumentCursor c = e->cursor();
|
||||
c.movePosition(count, operation, mode);
|
||||
e->setCursor(c);
|
||||
}
|
||||
|
||||
QEditorInputBinding::EditCommand::EditCommand(Operation op) : operation(op) {}
|
||||
|
||||
void QEditorInputBinding::EditCommand::exec(QEditor *e) {
|
||||
QDocumentCursor c = e->cursor();
|
||||
|
||||
switch (operation) {
|
||||
case ClearSelection:
|
||||
c.clearSelection();
|
||||
break;
|
||||
|
||||
case SelectWord:
|
||||
c.select(QDocumentCursor::WordUnderCursor);
|
||||
break;
|
||||
|
||||
case SelectLine:
|
||||
c.select(QDocumentCursor::LineUnderCursor);
|
||||
break;
|
||||
|
||||
case SelectDocument:
|
||||
c.movePosition(1, QDocumentCursor::Start, QDocumentCursor::MoveAnchor);
|
||||
c.movePosition(1, QDocumentCursor::End, QDocumentCursor::KeepAnchor);
|
||||
break;
|
||||
|
||||
case DeleteChar:
|
||||
c.deleteChar();
|
||||
break;
|
||||
|
||||
case DeletePreviousChar:
|
||||
c.deletePreviousChar();
|
||||
break;
|
||||
|
||||
case DeleteLine:
|
||||
c.eraseLine();
|
||||
break;
|
||||
|
||||
case DeleteSelection:
|
||||
c.removeSelectedText();
|
||||
break;
|
||||
|
||||
case InsertLine:
|
||||
c.insertLine();
|
||||
break;
|
||||
|
||||
case InsertClipBoard:
|
||||
e->paste();
|
||||
return;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
e->setCursor(c);
|
||||
}
|
||||
|
||||
QEditorInputBinding::WriteCommand::WriteCommand(const QString &t) : text(t) {}
|
||||
|
||||
void QEditorInputBinding::WriteCommand::exec(QEditor *e) { e->write(text); }
|
||||
|
||||
void QEditorInputBinding::GroupCommand::addCommand(Command *c) {
|
||||
commands << c;
|
||||
}
|
||||
|
||||
void QEditorInputBinding::GroupCommand::exec(QEditor *e) {
|
||||
foreach (Command *c, commands)
|
||||
c->exec(e);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QEditorInputBinding::QEditorInputBinding() {}
|
||||
|
||||
QEditorInputBinding::~QEditorInputBinding() { qDeleteAll(m_actions); }
|
||||
|
||||
void QEditorInputBinding::setMapping(const QKeySequence &ks, Command *cmd) {
|
||||
for (int i = 0; i < m_keys.count(); ++i) {
|
||||
if (m_keys.at(i) == ks) {
|
||||
delete m_actions[i];
|
||||
m_actions[i] = cmd;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_index << 0;
|
||||
m_keys << ks;
|
||||
m_actions << cmd;
|
||||
}
|
||||
|
||||
bool QEditorInputBinding::isExclusive() const { return false; }
|
||||
|
||||
bool QEditorInputBinding::keyPressEvent(QKeyEvent *event, QEditor *editor) {
|
||||
bool filter = false;
|
||||
|
||||
for (int i = 0; i < m_keys.count(); ++i) {
|
||||
int idx = m_index.at(i);
|
||||
const QKeySequence &ks = m_keys.at(i);
|
||||
|
||||
if (idx < ks.count()) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (ks[idx].key() == event->key()) {
|
||||
#else
|
||||
if (ks[idx] == event->key()) {
|
||||
#endif
|
||||
++idx;
|
||||
|
||||
if (idx == ks.count()) {
|
||||
// qDebug("match");
|
||||
|
||||
// key sequence matched
|
||||
m_actions.at(i)->exec(editor);
|
||||
|
||||
// cancel other in progress matches ?
|
||||
m_index.fill(0);
|
||||
|
||||
// return true;
|
||||
} else {
|
||||
// qDebug("step");
|
||||
m_index[i] = idx;
|
||||
}
|
||||
|
||||
// filter out the event
|
||||
filter = true;
|
||||
} else {
|
||||
m_index[i] = 0;
|
||||
}
|
||||
} else {
|
||||
m_index[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
void QEditorInputBinding::postKeyPressEvent(QKeyEvent *event, QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
}
|
||||
|
||||
bool QEditorInputBinding::inputMethodEvent(QInputMethodEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QEditorInputBinding::postInputMethodEvent(QInputMethodEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
}
|
||||
|
||||
bool QEditorInputBinding::mouseMoveEvent(QMouseEvent *event, QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QEditorInputBinding::postMouseMoveEvent(QMouseEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
}
|
||||
|
||||
bool QEditorInputBinding::mousePressEvent(QMouseEvent *event, QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QEditorInputBinding::postMousePressEvent(QMouseEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
}
|
||||
|
||||
bool QEditorInputBinding::mouseReleaseEvent(QMouseEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QEditorInputBinding::postMouseReleaseEvent(QMouseEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
}
|
||||
|
||||
bool QEditorInputBinding::mouseDoubleClickEvent(QMouseEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QEditorInputBinding::postMouseDoubleClickEvent(QMouseEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
}
|
||||
|
||||
bool QEditorInputBinding::contextMenuEvent(QContextMenuEvent *event,
|
||||
QEditor *editor) {
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(editor)
|
||||
|
||||
return false;
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QEDITOR_INPUT_BINDING_H_
|
||||
#define _QEDITOR_INPUT_BINDING_H_
|
||||
|
||||
#include "qeditorinputbindinginterface.h"
|
||||
|
||||
#include "qdocumentcursor.h"
|
||||
|
||||
#include <QKeySequence>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
class QCE_EXPORT QEditorInputBinding : public QEditorInputBindingInterface {
|
||||
public:
|
||||
class Command {
|
||||
public:
|
||||
virtual ~Command() {}
|
||||
|
||||
virtual void exec(QEditor *e) = 0;
|
||||
};
|
||||
|
||||
class MotionCommand : public Command {
|
||||
public:
|
||||
MotionCommand(QDocumentCursor::MoveOperation op,
|
||||
QDocumentCursor::MoveMode m, int n = 1);
|
||||
|
||||
virtual void exec(QEditor *e);
|
||||
|
||||
private:
|
||||
int count;
|
||||
QDocumentCursor::MoveMode mode;
|
||||
QDocumentCursor::MoveOperation operation;
|
||||
};
|
||||
|
||||
class EditCommand : public Command {
|
||||
public:
|
||||
enum Operation {
|
||||
ClearSelection,
|
||||
SelectWord,
|
||||
SelectLine,
|
||||
SelectDocument,
|
||||
|
||||
DeleteChar,
|
||||
DeletePreviousChar,
|
||||
DeleteSelection,
|
||||
DeleteLine,
|
||||
|
||||
InsertLine,
|
||||
InsertClipBoard,
|
||||
};
|
||||
|
||||
EditCommand(Operation op);
|
||||
|
||||
virtual void exec(QEditor *e);
|
||||
|
||||
private:
|
||||
Operation operation;
|
||||
};
|
||||
|
||||
class WriteCommand : public Command {
|
||||
public:
|
||||
WriteCommand(const QString &t);
|
||||
|
||||
virtual void exec(QEditor *e);
|
||||
|
||||
private:
|
||||
QString text;
|
||||
};
|
||||
|
||||
class GroupCommand : public Command {
|
||||
public:
|
||||
void addCommand(Command *c);
|
||||
|
||||
virtual void exec(QEditor *e);
|
||||
|
||||
private:
|
||||
QList<Command *> commands;
|
||||
};
|
||||
|
||||
QEditorInputBinding();
|
||||
~QEditorInputBinding();
|
||||
|
||||
void setMapping(const QKeySequence &ks, Command *cmd);
|
||||
|
||||
virtual bool isExclusive() const;
|
||||
|
||||
virtual bool keyPressEvent(QKeyEvent *event, QEditor *editor);
|
||||
virtual void postKeyPressEvent(QKeyEvent *event, QEditor *editor);
|
||||
|
||||
virtual bool inputMethodEvent(QInputMethodEvent *event, QEditor *editor);
|
||||
virtual void postInputMethodEvent(QInputMethodEvent *event,
|
||||
QEditor *editor);
|
||||
|
||||
virtual bool mouseMoveEvent(QMouseEvent *event, QEditor *editor);
|
||||
virtual void postMouseMoveEvent(QMouseEvent *event, QEditor *editor);
|
||||
|
||||
virtual bool mousePressEvent(QMouseEvent *event, QEditor *editor);
|
||||
virtual void postMousePressEvent(QMouseEvent *event, QEditor *editor);
|
||||
|
||||
virtual bool mouseReleaseEvent(QMouseEvent *event, QEditor *editor);
|
||||
virtual void postMouseReleaseEvent(QMouseEvent *event, QEditor *editor);
|
||||
|
||||
virtual bool mouseDoubleClickEvent(QMouseEvent *event, QEditor *editor);
|
||||
virtual void postMouseDoubleClickEvent(QMouseEvent *event, QEditor *editor);
|
||||
|
||||
virtual bool contextMenuEvent(QContextMenuEvent *event, QEditor *editor);
|
||||
|
||||
private:
|
||||
QVector<int> m_index;
|
||||
QVector<Command *> m_actions;
|
||||
QVector<QKeySequence> m_keys;
|
||||
};
|
||||
|
||||
#endif // _QEDITOR_INPUT_BINDING_H_
|
|
@ -1,63 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QEDITOR_INPUT_BINDING_INTERFACE_H_
|
||||
#define _QEDITOR_INPUT_BINDING_INTERFACE_H_
|
||||
|
||||
#include "qce-config.h"
|
||||
|
||||
class QEditor;
|
||||
|
||||
class QString;
|
||||
class QKeyEvent;
|
||||
class QMouseEvent;
|
||||
class QInputMethodEvent;
|
||||
class QContextMenuEvent;
|
||||
|
||||
class QEditorInputBindingInterface {
|
||||
public:
|
||||
virtual ~QEditorInputBindingInterface() {}
|
||||
|
||||
virtual QString id() const = 0;
|
||||
virtual QString name() const = 0;
|
||||
|
||||
virtual bool isExclusive() const = 0;
|
||||
|
||||
virtual bool keyPressEvent(QKeyEvent *event, QEditor *editor) = 0;
|
||||
virtual void postKeyPressEvent(QKeyEvent *event, QEditor *editor) = 0;
|
||||
|
||||
virtual bool inputMethodEvent(QInputMethodEvent *event,
|
||||
QEditor *editor) = 0;
|
||||
virtual void postInputMethodEvent(QInputMethodEvent *event,
|
||||
QEditor *editor) = 0;
|
||||
|
||||
virtual bool mouseMoveEvent(QMouseEvent *event, QEditor *editor) = 0;
|
||||
virtual void postMouseMoveEvent(QMouseEvent *event, QEditor *editor) = 0;
|
||||
|
||||
virtual bool mousePressEvent(QMouseEvent *event, QEditor *editor) = 0;
|
||||
virtual void postMousePressEvent(QMouseEvent *event, QEditor *editor) = 0;
|
||||
|
||||
virtual bool mouseReleaseEvent(QMouseEvent *event, QEditor *editor) = 0;
|
||||
virtual void postMouseReleaseEvent(QMouseEvent *event, QEditor *editor) = 0;
|
||||
|
||||
virtual bool mouseDoubleClickEvent(QMouseEvent *event, QEditor *editor) = 0;
|
||||
virtual void postMouseDoubleClickEvent(QMouseEvent *event,
|
||||
QEditor *editor) = 0;
|
||||
|
||||
virtual bool contextMenuEvent(QContextMenuEvent *event,
|
||||
QEditor *editor) = 0;
|
||||
};
|
||||
|
||||
#endif // _QEDITOR_INPUT_BINDING_INTERFACE_H_
|
|
@ -1,114 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qsnippetbinding.h"
|
||||
|
||||
/*!
|
||||
\file qsnippetbinding.cpp
|
||||
\brief Implementation of the QSnippetBinding class
|
||||
*/
|
||||
|
||||
#include "qsnippet.h"
|
||||
#include "qsnippetmanager.h"
|
||||
|
||||
#include "qdocumentcursor.h"
|
||||
#include "qeditor.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
/*
|
||||
class QSnippetCommand : public QEditorInputBinding::Command
|
||||
{
|
||||
public:
|
||||
QSnippetCommand(QSnippetManager *m, int idx)
|
||||
: index(idx), manager(m)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual void exec(QEditor *e)
|
||||
{
|
||||
if ( index < manager->snippetCount() )
|
||||
manager->snippet(index)->insert(e);
|
||||
}
|
||||
|
||||
private:
|
||||
int index;
|
||||
QSnippetManager *manager;
|
||||
};
|
||||
*/
|
||||
|
||||
class QSnippetCommand : public QEditorInputBinding::Command {
|
||||
public:
|
||||
QSnippetCommand(QSnippet *s) : snip(s) {}
|
||||
|
||||
virtual void exec(QEditor *e) { snip->insert(e); }
|
||||
|
||||
private:
|
||||
QSnippet *snip;
|
||||
};
|
||||
|
||||
QSnippetBinding::QSnippetBinding(QSnippetManager *manager)
|
||||
: m_manager(manager) {
|
||||
// for ( int i = 0; i < 10; ++i )
|
||||
// setMapping(QKeySequence(Qt::Key_F1 + i), new SnippetCommand(manager,
|
||||
// i));
|
||||
}
|
||||
|
||||
QString QSnippetBinding::id() const { return "snippet binding"; }
|
||||
|
||||
QString QSnippetBinding::name() const { return "snippet binding"; }
|
||||
|
||||
bool QSnippetBinding::keyPressEvent(QKeyEvent *event, QEditor *editor) {
|
||||
/*
|
||||
if ( event->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
for ( int i = 0; i < qMin(10, m->snippetCount()); ++i )
|
||||
{
|
||||
if ( event->key() == (Qt::Key_F1 + i) )
|
||||
{
|
||||
m->snippet(i)->insert(editor);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ((event->modifiers() & Qt::AltModifier) &&
|
||||
(event->key() == Qt::Key_Space || event->text() == " ")) {
|
||||
QDocumentCursor c = editor->cursor();
|
||||
|
||||
// c.select(QDocumentCursor::SelectWord);
|
||||
|
||||
if (!c.hasSelection()) {
|
||||
c.movePosition(1, QDocumentCursor::PreviousWord,
|
||||
QDocumentCursor::KeepAnchor);
|
||||
editor->setCursor(c);
|
||||
}
|
||||
|
||||
QString s = c.selectedText();
|
||||
|
||||
for (int i = 0; i < m_manager->snippetCount(); ++i) {
|
||||
QSnippet *snip = m_manager->snippet(i);
|
||||
|
||||
if (snip->name() == s) {
|
||||
snip->insert(editor);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QEditorInputBinding::keyPressEvent(event, editor);
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QSNIPPET_BINDING_H_
|
||||
#define _QSNIPPET_BINDING_H_
|
||||
|
||||
#include "qce-config.h"
|
||||
|
||||
/*!
|
||||
\file qsnippetbinding.h
|
||||
\brief Definition of the QSnippetBinding class
|
||||
*/
|
||||
|
||||
#include "qeditorinputbinding.h"
|
||||
|
||||
class QSnippetManager;
|
||||
|
||||
class QCE_EXPORT QSnippetBinding : public QEditorInputBinding {
|
||||
public:
|
||||
QSnippetBinding(QSnippetManager *manager);
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString name() const;
|
||||
|
||||
virtual bool keyPressEvent(QKeyEvent *event, QEditor *editor);
|
||||
|
||||
private:
|
||||
QSnippetManager *m_manager;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -227,8 +227,6 @@ set(CLASS_SRC
|
|||
src/class/asdebugger.cpp
|
||||
src/class/scriptconsolemachine.h
|
||||
src/class/scriptconsolemachine.cpp
|
||||
src/class/wingangelapi.h
|
||||
src/class/wingangelapi.cpp
|
||||
src/class/angelobjstring.h
|
||||
src/class/angelobjstring.cpp
|
||||
src/class/scripteditortheme.h
|
||||
|
@ -238,6 +236,8 @@ set(CLASS_SRC
|
|||
src/class/angelscripthelper.h
|
||||
src/class/qasparser.cpp
|
||||
src/class/qasparser.h
|
||||
src/class/qascodeparser.h
|
||||
src/class/qascodeparser.cpp
|
||||
src/class/ascompletion.cpp
|
||||
src/class/ascompletion.h
|
||||
src/class/asbuilder.h
|
||||
|
@ -261,6 +261,11 @@ set(CLASS_SRC
|
|||
src/class/richtextitemdelegate.h
|
||||
src/class/richtextitemdelegate.cpp)
|
||||
|
||||
set(INTERNAL_PLG_SRC
|
||||
src/class/wingangelapi.h src/class/wingangelapi.cpp
|
||||
src/class/ctypeparser.cpp src/class/ctypeparser.h src/class/wingcstruct.h
|
||||
src/class/wingcstruct.cpp)
|
||||
|
||||
if(WINGHEX_USE_FRAMELESS)
|
||||
set(WIDGET_FRAME_SRC
|
||||
src/widgetframe/windowbar.cpp src/widgetframe/windowbar.h
|
||||
|
@ -444,6 +449,7 @@ set(PROJECT_SOURCES
|
|||
${WIDGET_FRAME_SRC}
|
||||
${RIBBON_SRC}
|
||||
${CLASS_SRC}
|
||||
${INTERNAL_PLG_SRC}
|
||||
${MODEL_SRC}
|
||||
${DIALOG_SRC}
|
||||
${PLUGIN_SRC}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"Id" : "shmem",
|
||||
"Name" : "ShareMemoryDrv",
|
||||
"Version" : "0.0.1",
|
||||
"Vendor" : "WingCloudStudio",
|
||||
"Author" : "wingsummer",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"Id": "testplugin2",
|
||||
"Name": "TestPlugin",
|
||||
"Id": "TestPlugin",
|
||||
"Version": "0.0.1",
|
||||
"Vendor": "WingCloudStudio",
|
||||
"Dependencies": [
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
|
@ -785,7 +785,7 @@
|
|||
<context>
|
||||
<name>LangService</name>
|
||||
<message>
|
||||
<location filename="../../src/class/langservice.cpp" line="86"/>
|
||||
<location filename="../../src/class/langservice.cpp" line="82"/>
|
||||
<source>Default</source>
|
||||
<translation>默认</translation>
|
||||
</message>
|
||||
|
@ -2185,12 +2185,12 @@
|
|||
<context>
|
||||
<name>PluginSystem</name>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="72"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="73"/>
|
||||
<source>LoadingPlugin</source>
|
||||
<translation>加载插件中:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="90"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="91"/>
|
||||
<source>InvalidPluginBrokenInfo</source>
|
||||
<translation>加载插件失败:损坏的插件数据</translation>
|
||||
</message>
|
||||
|
@ -2199,6 +2199,11 @@
|
|||
<source>AppClosingCanceled:</source>
|
||||
<translation>程序关闭被取消:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="583"/>
|
||||
<source>- PluginID:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="616"/>
|
||||
<source>FoundDrvPluginCount</source>
|
||||
|
@ -2225,82 +2230,72 @@
|
|||
<translation>插件加载失败:非法插件名称!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="903"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="899"/>
|
||||
<source>ErrLoadInitPlugin</source>
|
||||
<translation>插件加载失败:初始化插件失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="910"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="906"/>
|
||||
<source>PluginName :</source>
|
||||
<translation>插件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="911"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="907"/>
|
||||
<source>PluginAuthor :</source>
|
||||
<translation>插件作者:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="912"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="908"/>
|
||||
<source>PluginWidgetRegister</source>
|
||||
<translation>注册插件对象中……</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1016"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1012"/>
|
||||
<source>ErrLoadExtPluginSign</source>
|
||||
<translation>设备拓展插件加载失败:非法插件签名!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1020"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1016"/>
|
||||
<source>ErrLoadExtPluginSDKVersion</source>
|
||||
<translation>设备拓展插件加载失败:非法插件 SDK 版本!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1024"/>
|
||||
<source>ErrLoadExtPluginNoName</source>
|
||||
<translation>设备拓展插件加载失败:非法插件名称!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1027"/>
|
||||
<source>ExtPluginName :</source>
|
||||
<translation>设备拓展插件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1028"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1019"/>
|
||||
<source>ExtPluginAuthor :</source>
|
||||
<translation>设备拓展插件作者:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1029"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1020"/>
|
||||
<source>ExtPluginWidgetRegister</source>
|
||||
<translation>设备拓展注册插件对象中……</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1048"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1036"/>
|
||||
<source>ErrLoadInitExtPlugin</source>
|
||||
<translation>设备拓展插件加载失败:初始化插件失败!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1115"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1103"/>
|
||||
<source>EmptyNameDockWidget:</source>
|
||||
<translation>空的贴边组件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1125"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1113"/>
|
||||
<source>InvalidNameDockWidget:</source>
|
||||
<translation>无效贴边组件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1133"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1121"/>
|
||||
<source>InvalidNullDockWidget:</source>
|
||||
<translation>无效空贴边组件:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1273"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1261"/>
|
||||
<source>[EvilCall]</source>
|
||||
<translation>【恶意调用】</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="2798"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="2786"/>
|
||||
<source>Not allowed operation in non-UI thread</source>
|
||||
<translation>该操作在非 UI 线程非法</translation>
|
||||
</message>
|
||||
|
@ -2310,12 +2305,12 @@
|
|||
<translation>不安全的插件目录,请将插件目录设置为仅管理员账户可写</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="97"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="98"/>
|
||||
<source>InvalidPluginID</source>
|
||||
<translation>加载插件失败:非法插件标识符</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="100"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="101"/>
|
||||
<source>InvalidDupPlugin</source>
|
||||
<translation>加载插件失败:重复的插件标识符</translation>
|
||||
</message>
|
||||
|
@ -2329,11 +2324,6 @@
|
|||
<source>PluginLoadingFailedSummary</source>
|
||||
<translation>有依赖插件加载失败总结</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="583"/>
|
||||
<source>- PluginName:</source>
|
||||
<translation>- 插件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="584"/>
|
||||
<source>- Dependencies:</source>
|
||||
|
@ -2517,123 +2507,104 @@ Restart from the begining ?</source>
|
|||
<translation>视图(&V)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="197"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="654"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1091"/>
|
||||
<source>Default</source>
|
||||
<translation>默认</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="499"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1064"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2265"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="430"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="947"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1994"/>
|
||||
<source>&Undo</source>
|
||||
<translation>撤销(&U)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="508"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1065"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2275"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="439"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="948"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2004"/>
|
||||
<source>&Redo</source>
|
||||
<translation>恢复(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="521"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1067"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2291"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="452"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="950"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2020"/>
|
||||
<source>Cu&t</source>
|
||||
<translation>剪切(&T)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="530"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1068"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2302"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="461"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="951"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2031"/>
|
||||
<source>&Copy</source>
|
||||
<translation>复制(&C)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="539"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1069"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2313"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="470"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="952"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2042"/>
|
||||
<source>&Paste</source>
|
||||
<translation>粘贴(&P)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="554"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1071"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="485"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="954"/>
|
||||
<source>&Indent</source>
|
||||
<translation>缩进(&I)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="561"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1072"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="492"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="955"/>
|
||||
<source>&Unindent</source>
|
||||
<translation>取消缩进(&U)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="572"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1073"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="503"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="956"/>
|
||||
<source>Co&mment</source>
|
||||
<translation>批注(&M)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="579"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1074"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="510"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="957"/>
|
||||
<source>Unc&omment</source>
|
||||
<translation>取消批注(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="590"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1076"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="521"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="959"/>
|
||||
<source>&Select all</source>
|
||||
<translation>全选(&S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="601"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1078"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2330"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="532"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="961"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2059"/>
|
||||
<source>&Find</source>
|
||||
<translation>查找(&F)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="608"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1079"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2338"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="962"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2067"/>
|
||||
<source>Fin&d next</source>
|
||||
<translation>查找下一个(&D)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="615"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1080"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2346"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="539"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="963"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2075"/>
|
||||
<source>&Replace</source>
|
||||
<translation>替换(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="626"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1082"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2357"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="550"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="965"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2086"/>
|
||||
<source>&Goto line...</source>
|
||||
<translation>跳转到行(&G)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="637"/>
|
||||
<source>Dynamic line wrapping</source>
|
||||
<translation>自动换行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="647"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1088"/>
|
||||
<source>Input binding</source>
|
||||
<translation>输入绑定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="801"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="684"/>
|
||||
<source>Conflict!</source>
|
||||
<translation>冲突!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="802"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="685"/>
|
||||
<source>%1
|
||||
has been modified by another application.
|
||||
Press "Save" to overwrite the file on disk
|
||||
|
@ -2647,12 +2618,12 @@ Press "Discard" to ignore this warning.
|
|||
按“放弃”忽略此警告。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="939"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="822"/>
|
||||
<source>File changed</source>
|
||||
<translation>文件被修改</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="940"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="823"/>
|
||||
<source>%1
|
||||
has been modified by another application.
|
||||
|
||||
|
@ -2665,7 +2636,7 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
您是否希望通过重新加载文件来保持最新状态?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="3242"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2925"/>
|
||||
<source>untitled</source>
|
||||
<translation>未命名</translation>
|
||||
</message>
|
||||
|
@ -3028,7 +2999,7 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="50"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="209"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="212"/>
|
||||
<source>NoHistoryDel</source>
|
||||
<translation>无打开历史项目可删除!</translation>
|
||||
</message>
|
||||
|
@ -3073,12 +3044,12 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
<translation>【结束】</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="185"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="188"/>
|
||||
<source>FileNotExistClean</source>
|
||||
<translation>文件不存在,该选项已被清除!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="219"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="222"/>
|
||||
<source>HistoryClearFinished</source>
|
||||
<translation>打开历史记录完成!</translation>
|
||||
</message>
|
||||
|
@ -5368,6 +5339,69 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
<source>NotSupportedQMetaType:</source>
|
||||
<translation>不支持的 QT 数据元类型:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingangelapi.cpp" line="1755"/>
|
||||
<source>Get Exception While ScriptCall: (%1) %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingangelapi.cpp" line="1763"/>
|
||||
<source>InvalidRetType: need </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WingCStruct</name>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="47"/>
|
||||
<source>WingCStruct</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="50"/>
|
||||
<source>Providing basic support for analyzing file structures</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="292"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="304"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="317"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="326"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="339"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="347"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="359"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="367"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="374"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="386"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="398"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="423"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="443"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="463"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="483"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="499"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="519"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="539"/>
|
||||
<source>InvalidParamsCount</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="296"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="308"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="330"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="351"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="378"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="390"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="410"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="432"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="452"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="472"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="489"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="508"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="528"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="547"/>
|
||||
<source>InvalidParam</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ads::CAutoHideTab</name>
|
||||
|
|
|
@ -785,7 +785,7 @@
|
|||
<context>
|
||||
<name>LangService</name>
|
||||
<message>
|
||||
<location filename="../../src/class/langservice.cpp" line="86"/>
|
||||
<location filename="../../src/class/langservice.cpp" line="82"/>
|
||||
<source>Default</source>
|
||||
<translation>默認</translation>
|
||||
</message>
|
||||
|
@ -2185,12 +2185,12 @@
|
|||
<context>
|
||||
<name>PluginSystem</name>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="72"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="73"/>
|
||||
<source>LoadingPlugin</source>
|
||||
<translation>加載插件中:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="90"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="91"/>
|
||||
<source>InvalidPluginBrokenInfo</source>
|
||||
<translation>加載插件失敗:損壞的插件數據</translation>
|
||||
</message>
|
||||
|
@ -2199,6 +2199,11 @@
|
|||
<source>AppClosingCanceled:</source>
|
||||
<translation>程式關閉被取消:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="583"/>
|
||||
<source>- PluginID:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="616"/>
|
||||
<source>FoundDrvPluginCount</source>
|
||||
|
@ -2225,82 +2230,72 @@
|
|||
<translation>插件加載失敗:非法插件名稱!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="903"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="899"/>
|
||||
<source>ErrLoadInitPlugin</source>
|
||||
<translation>插件加載失敗:初始化插件失敗!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="910"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="906"/>
|
||||
<source>PluginName :</source>
|
||||
<translation>插件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="911"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="907"/>
|
||||
<source>PluginAuthor :</source>
|
||||
<translation>插件作者:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="912"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="908"/>
|
||||
<source>PluginWidgetRegister</source>
|
||||
<translation>註冊插件對象中……</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1016"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1012"/>
|
||||
<source>ErrLoadExtPluginSign</source>
|
||||
<translation>設備拓展插件加載失敗:非法插件簽名!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1020"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1016"/>
|
||||
<source>ErrLoadExtPluginSDKVersion</source>
|
||||
<translation>設備拓展插件加載失敗:非法插件 SDK 版本!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1024"/>
|
||||
<source>ErrLoadExtPluginNoName</source>
|
||||
<translation>設備拓展插件加載失敗:非法插件名稱!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1027"/>
|
||||
<source>ExtPluginName :</source>
|
||||
<translation>設備拓展插件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1028"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1019"/>
|
||||
<source>ExtPluginAuthor :</source>
|
||||
<translation>設備拓展插件作者:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1029"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1020"/>
|
||||
<source>ExtPluginWidgetRegister</source>
|
||||
<translation>設備拓展註冊插件對象中……</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1048"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1036"/>
|
||||
<source>ErrLoadInitExtPlugin</source>
|
||||
<translation>設備拓展插件加載失敗:初始化插件失敗!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1115"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1103"/>
|
||||
<source>EmptyNameDockWidget:</source>
|
||||
<translation>空的貼邊組件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1125"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1113"/>
|
||||
<source>InvalidNameDockWidget:</source>
|
||||
<translation>無效貼邊組件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1133"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1121"/>
|
||||
<source>InvalidNullDockWidget:</source>
|
||||
<translation>無效空貼邊組件:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1273"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="1261"/>
|
||||
<source>[EvilCall]</source>
|
||||
<translation>【惡意調用】</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="2798"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="2786"/>
|
||||
<source>Not allowed operation in non-UI thread</source>
|
||||
<translation>該操作在非 UI 線程非法</translation>
|
||||
</message>
|
||||
|
@ -2310,12 +2305,12 @@
|
|||
<translation>不安全的插件目錄,請將插件目錄設置為僅管理員帳戶可寫</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="97"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="98"/>
|
||||
<source>InvalidPluginID</source>
|
||||
<translation>加載插件失敗:非法插件識別字</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="100"/>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="101"/>
|
||||
<source>InvalidDupPlugin</source>
|
||||
<translation>加載插件失敗:重複的插件識別字</translation>
|
||||
</message>
|
||||
|
@ -2329,11 +2324,6 @@
|
|||
<source>PluginLoadingFailedSummary</source>
|
||||
<translation>有依賴插件加載失敗總結</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="583"/>
|
||||
<source>- PluginName:</source>
|
||||
<translation>- 插件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/plugin/pluginsystem.cpp" line="584"/>
|
||||
<source>- Dependencies:</source>
|
||||
|
@ -2517,123 +2507,104 @@ Restart from the begining ?</source>
|
|||
<translation>視圖(&V)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="197"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="654"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1091"/>
|
||||
<source>Default</source>
|
||||
<translation>默認</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="499"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1064"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2265"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="430"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="947"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1994"/>
|
||||
<source>&Undo</source>
|
||||
<translation>撤銷(&U)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="508"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1065"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2275"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="439"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="948"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2004"/>
|
||||
<source>&Redo</source>
|
||||
<translation>恢復(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="521"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1067"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2291"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="452"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="950"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2020"/>
|
||||
<source>Cu&t</source>
|
||||
<translation>剪切(&T)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="530"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1068"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2302"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="461"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="951"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2031"/>
|
||||
<source>&Copy</source>
|
||||
<translation>複製(&C)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="539"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1069"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2313"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="470"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="952"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2042"/>
|
||||
<source>&Paste</source>
|
||||
<translation>粘貼(&P)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="554"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1071"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="485"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="954"/>
|
||||
<source>&Indent</source>
|
||||
<translation>縮進(&I)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="561"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1072"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="492"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="955"/>
|
||||
<source>&Unindent</source>
|
||||
<translation>取消縮進(&U)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="572"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1073"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="503"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="956"/>
|
||||
<source>Co&mment</source>
|
||||
<translation>批註(&M)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="579"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1074"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="510"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="957"/>
|
||||
<source>Unc&omment</source>
|
||||
<translation>取消批註(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="590"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1076"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="521"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="959"/>
|
||||
<source>&Select all</source>
|
||||
<translation>全選(&S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="601"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1078"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2330"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="532"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="961"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2059"/>
|
||||
<source>&Find</source>
|
||||
<translation>查找(&F)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="608"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1079"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2338"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="962"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2067"/>
|
||||
<source>Fin&d next</source>
|
||||
<translation>查找下一個(&D)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="615"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1080"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2346"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="539"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="963"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2075"/>
|
||||
<source>&Replace</source>
|
||||
<translation>替換(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="626"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1082"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2357"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="550"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="965"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2086"/>
|
||||
<source>&Goto line...</source>
|
||||
<translation>跳轉到行(&G)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="637"/>
|
||||
<source>Dynamic line wrapping</source>
|
||||
<translation>自動換行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="647"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1088"/>
|
||||
<source>Input binding</source>
|
||||
<translation>輸入綁定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="801"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="684"/>
|
||||
<source>Conflict!</source>
|
||||
<translation>衝突!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="802"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="685"/>
|
||||
<source>%1
|
||||
has been modified by another application.
|
||||
Press "Save" to overwrite the file on disk
|
||||
|
@ -2647,12 +2618,12 @@ Press "Discard" to ignore this warning.
|
|||
按“放棄”忽略此警告。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="939"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="822"/>
|
||||
<source>File changed</source>
|
||||
<translation>檔被修改</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="940"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="823"/>
|
||||
<source>%1
|
||||
has been modified by another application.
|
||||
|
||||
|
@ -2665,7 +2636,7 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
您是否希望通過重新加載檔來保持最新狀態?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="3242"/>
|
||||
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="2925"/>
|
||||
<source>untitled</source>
|
||||
<translation>未命名</translation>
|
||||
</message>
|
||||
|
@ -3028,7 +2999,7 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="50"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="209"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="212"/>
|
||||
<source>NoHistoryDel</source>
|
||||
<translation>無打開歷史專案可刪除!</translation>
|
||||
</message>
|
||||
|
@ -3073,12 +3044,12 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
<translation>【結束】</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="185"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="188"/>
|
||||
<source>FileNotExistClean</source>
|
||||
<translation>檔不存在,該選項已被清除!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="219"/>
|
||||
<location filename="../../src/class/recentfilemanager.cpp" line="222"/>
|
||||
<source>HistoryClearFinished</source>
|
||||
<translation>打開歷史記錄完成!</translation>
|
||||
</message>
|
||||
|
@ -5368,6 +5339,69 @@ Do you wish to keep up to date by reloading the file?</source>
|
|||
<source>NotSupportedQMetaType:</source>
|
||||
<translation>不支持的 QT 數據元類型:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingangelapi.cpp" line="1755"/>
|
||||
<source>Get Exception While ScriptCall: (%1) %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingangelapi.cpp" line="1763"/>
|
||||
<source>InvalidRetType: need </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WingCStruct</name>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="47"/>
|
||||
<source>WingCStruct</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="50"/>
|
||||
<source>Providing basic support for analyzing file structures</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="292"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="304"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="317"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="326"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="339"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="347"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="359"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="367"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="374"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="386"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="398"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="423"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="443"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="463"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="483"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="499"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="519"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="539"/>
|
||||
<source>InvalidParamsCount</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="296"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="308"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="330"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="351"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="378"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="390"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="410"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="432"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="452"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="472"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="489"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="508"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="528"/>
|
||||
<location filename="../../src/class/wingcstruct.cpp" line="547"/>
|
||||
<source>InvalidParam</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ads::CAutoHideTab</name>
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
<file>images/snippt.png</file>
|
||||
<file>images/soft.png</file>
|
||||
<file>images/sponsor.png</file>
|
||||
<file>images/structure.png</file>
|
||||
<file>images/sum.png</file>
|
||||
<file>images/undo.png</file>
|
||||
<file>images/unlock.png</file>
|
||||
|
@ -113,6 +114,7 @@
|
|||
<file>images/writable.png</file>
|
||||
<file>src/TESTCODE.as</file>
|
||||
<file>src/class/WingAngelAPI.json</file>
|
||||
<file>src/class/WingCStruct.json</file>
|
||||
<file>src/components.md</file>
|
||||
<file>src/translist.md</file>
|
||||
</qresource>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
{
|
||||
"Id": "WingAngelAPI",
|
||||
"Name": "WingAngelAPI",
|
||||
"Author": "wingsummer",
|
||||
"Version": "2.1.0",
|
||||
"Vendor": "WingCloudStudio",
|
||||
"Copyright": "wingsummer",
|
||||
"License": "AGPL-3.0",
|
||||
"Url": "https://github.com/Wing-summer/WingHexExplorer2"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Id" : "WingCStruct",
|
||||
"Version" : "0.0.1",
|
||||
"Vendor" : "WingCloudStudio",
|
||||
"Author" : "wingsummer",
|
||||
"License" : "AGPL-v3.0",
|
||||
"Url" : "https://github.com/Wing-summer/WingHexExplorer2"
|
||||
}
|
|
@ -1,3 +1,20 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "clangformatmanager.h"
|
||||
#include "settings/settings.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef CLANGFORMATMANAGER_H
|
||||
#define CLANGFORMATMANAGER_H
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,227 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef CTYPE_PARSER_H
|
||||
#define CTYPE_PARSER_H
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <QString>
|
||||
|
||||
/// @beief Struct for variable declaration
|
||||
///
|
||||
/// A variable declaration may contain 4 parts
|
||||
/// (take this statement as example: char* argv[2]):
|
||||
/// - data_type: char
|
||||
/// - var_name: argv
|
||||
/// - array_size: 2
|
||||
/// - is_pointer: true
|
||||
/// @note Only one-demension array is supported here, but it's easy to extend
|
||||
/// with this awareness
|
||||
///
|
||||
typedef struct {
|
||||
QString data_type; ///< name of a data type, either basic type or
|
||||
///< user-defined type
|
||||
QString var_name; ///< variable name
|
||||
qsizetype offset; ///< member offset in struct: 0 for non-struct
|
||||
qsizetype array_size; ///< array size: 0 for non-array
|
||||
bool is_pointer; ///< true when it's a pointer
|
||||
qsizetype var_size; ///< size in bytes
|
||||
} VariableDeclaration;
|
||||
|
||||
/// @enum type for token types
|
||||
enum TokenTypes {
|
||||
kUnresolvedToken,
|
||||
|
||||
// keywords
|
||||
kStructKeyword,
|
||||
kUnionKeyword,
|
||||
kEnumKeyword,
|
||||
kTypedefKeyword,
|
||||
|
||||
kBasicDataType,
|
||||
kAbstractType,
|
||||
kComplexType,
|
||||
kQualifier,
|
||||
|
||||
// user-defined tokens
|
||||
kStructName,
|
||||
kUnionName,
|
||||
kEnumName,
|
||||
|
||||
};
|
||||
|
||||
/// @enum type for sigle character tokens
|
||||
enum SingleToken : char {
|
||||
kBlockStart = '{',
|
||||
kBlockEnd = '}',
|
||||
kPoundSign = '#',
|
||||
|
||||
kComma = ',',
|
||||
kSemicolon = ';',
|
||||
kEqual = '=',
|
||||
kSlash = '/',
|
||||
kAsterisk = '*',
|
||||
kQuotation = '\"',
|
||||
};
|
||||
|
||||
enum class PointerMode { X86, X64 };
|
||||
|
||||
class CTypeParser {
|
||||
public:
|
||||
explicit CTypeParser();
|
||||
virtual ~CTypeParser();
|
||||
|
||||
public:
|
||||
void parseFiles();
|
||||
void parseFile(const QString &file);
|
||||
void parseSource(const QString &src);
|
||||
|
||||
QStringList includePaths() const;
|
||||
void setIncludePaths(const QStringList &newInclude_paths);
|
||||
|
||||
public:
|
||||
qsizetype padAlignment() const;
|
||||
void setPadAlignment(qsizetype newKAlignment);
|
||||
|
||||
PointerMode pointerMode() const;
|
||||
void setPointerMode(PointerMode newPmode);
|
||||
|
||||
QHash<QString, QList<VariableDeclaration>> structDefs() const;
|
||||
|
||||
QHash<QString, QList<QPair<QString, int>>> enumDefs() const;
|
||||
|
||||
QHash<QString, qsizetype> typeSizes() const;
|
||||
|
||||
QHash<QString, long> constDefs() const;
|
||||
|
||||
QHash<QString, QList<VariableDeclaration>> unionDefs() const;
|
||||
|
||||
TokenTypes getTokenType(const QString &token) const;
|
||||
|
||||
public:
|
||||
void dumpTypeDefs() const;
|
||||
|
||||
private:
|
||||
QString mergeAllLines(const QStringList &lines) const;
|
||||
bool getNextToken(QString src, qsizetype &pos, QString &token,
|
||||
bool cross_line = true) const;
|
||||
bool getNextLine(QString src, qsizetype &pos, QString &line) const;
|
||||
bool getRestLine(const QString &src, qsizetype &pos, QString &line) const;
|
||||
void skipCurrentLine(const QString &src, qsizetype &pos,
|
||||
QString &line) const;
|
||||
qsizetype splitLineIntoTokens(QString line, QStringList &tokens) const;
|
||||
|
||||
bool parseDeclaration(const QString &line, VariableDeclaration &decl) const;
|
||||
bool parseEnumDeclaration(const QString &line, int &last_value,
|
||||
QPair<QString, int> &decl,
|
||||
bool &is_last_member) const;
|
||||
bool parseAssignExpression(const QString &line);
|
||||
|
||||
void parsePreProcDirective(const QString &src, qsizetype &pos);
|
||||
bool parseStructUnion(const bool is_struct, const bool is_typedef,
|
||||
const QString &src, qsizetype &pos,
|
||||
VariableDeclaration &var_decl, bool &is_decl);
|
||||
bool parseEnum(const bool is_typedef, const QString &src, qsizetype &pos,
|
||||
VariableDeclaration &var_decl, bool &is_decl);
|
||||
|
||||
VariableDeclaration makePadField(const qsizetype size) const;
|
||||
qsizetype padStructMembers(QList<VariableDeclaration> &members);
|
||||
qsizetype calcUnionSize(const QList<VariableDeclaration> &members) const;
|
||||
|
||||
void storeStructUnionDef(const bool is_struct, const QString &type_name,
|
||||
QList<VariableDeclaration> &members);
|
||||
|
||||
private:
|
||||
/// read in basic data such as keywords/qualifiers, and basic data type
|
||||
/// sizes
|
||||
void initialize();
|
||||
|
||||
void findHeaderFiles(const QString &path);
|
||||
QString getFile(QString &filename) const;
|
||||
|
||||
// pre-processing
|
||||
QString preprocess(QFile &ifs) const;
|
||||
void stripComments(QStringList &lines) const;
|
||||
void wrapLines(QStringList &lines) const;
|
||||
|
||||
// utility functions
|
||||
QString getNextToken(const QString &line, qsizetype &pos) const;
|
||||
bool isIgnorable(const QString &token) const;
|
||||
|
||||
bool isNumericToken(const QString &token, long &number) const;
|
||||
int getTypeSize(const QString &data_type) const;
|
||||
|
||||
/// class members
|
||||
private:
|
||||
static const char EOL =
|
||||
'$'; ///< end of line, used to delimit the source lines within a string
|
||||
|
||||
qsizetype kAlignment_ = 1; ///< alignment
|
||||
|
||||
static const QString kAnonymousTypePrefix;
|
||||
static const QRegularExpression kTokenDelimiters;
|
||||
static const QString kPaddingFieldName;
|
||||
|
||||
private:
|
||||
QStringList include_paths_;
|
||||
|
||||
/// basic data that're needed in parsing
|
||||
QStringList qualifiers_;
|
||||
QHash<QString, TokenTypes> keywords_;
|
||||
|
||||
PointerMode _pmode;
|
||||
|
||||
/// header files to parse
|
||||
/// key - filename with relative/absolute path
|
||||
/// bool - whether the file is parsed
|
||||
QHash<QString, bool> header_files_;
|
||||
|
||||
/// Size of C data types and also user-defined struct/union types
|
||||
/// @note All enum types have fixed size, so they're not stored
|
||||
QHash<QString, qsizetype> type_maps_;
|
||||
|
||||
/// Parsing result - extracted type definitions
|
||||
/// for below 3 maps:
|
||||
/// key - type name
|
||||
/// value - type members
|
||||
|
||||
/// struct definitions
|
||||
QHash<QString, QList<VariableDeclaration>> struct_defs_;
|
||||
|
||||
/// union definitions
|
||||
QHash<QString, QList<VariableDeclaration>> union_defs_;
|
||||
|
||||
/// enum definitions
|
||||
QHash<QString, QList<QPair<QString, int>>> enum_defs_;
|
||||
|
||||
/// constants and macros that have integer values
|
||||
/// key - constant/macro name
|
||||
/// value - an integer (all types of number are cast to long type for
|
||||
/// convenience)
|
||||
QHash<QString, long> const_defs_;
|
||||
};
|
||||
|
||||
#endif // _TYPE_PARSER_H_
|
|
@ -34,8 +34,10 @@ void LangService::init(asIScriptEngine *engine) {
|
|||
|
||||
m_language = new QLanguageFactory(format, this);
|
||||
m_language->addDefinitionPath(QStringLiteral(":/qcodeedit"));
|
||||
_completion = new AsCompletion(engine, this);
|
||||
m_language->addCompletionEngine(_completion);
|
||||
|
||||
// TODO: disable COMPLETION for it's werid, fix later
|
||||
// _completion = new AsCompletion(engine, this);
|
||||
// m_language->addCompletionEngine(_completion);
|
||||
|
||||
m_snippetManager = new QSnippetManager(this);
|
||||
QDir snippetDir(Utilities::getAppDataPath());
|
||||
|
@ -47,18 +49,12 @@ void LangService::init(asIScriptEngine *engine) {
|
|||
m_snippetManager->loadSnippetsFromDirectory(snippetDir.absolutePath());
|
||||
}
|
||||
|
||||
m_snipbind = new QSnippetBinding(m_snippetManager);
|
||||
|
||||
initAdditionalFormatScheme();
|
||||
}
|
||||
|
||||
LangService::LangService() : QObject(nullptr) {}
|
||||
|
||||
LangService::~LangService() {
|
||||
delete m_snipbind;
|
||||
m_snipbind = nullptr;
|
||||
qDeleteAll(_formatSchemes);
|
||||
}
|
||||
LangService::~LangService() { qDeleteAll(_formatSchemes); }
|
||||
|
||||
void LangService::initAdditionalFormatScheme() {
|
||||
QDir appDataDir(Utilities::getAppDataPath());
|
||||
|
@ -117,7 +113,4 @@ QLanguageFactory *LangService::languageFactory() const { return m_language; }
|
|||
void LangService::applyLanguageSerivce(QEditor *editor) {
|
||||
Q_ASSERT(editor);
|
||||
m_language->setLanguage(editor, QStringLiteral("AngelScript"));
|
||||
editor->addInputBinding(m_snipbind);
|
||||
}
|
||||
|
||||
QSnippetBinding *LangService::snippetBinding() const { return m_snipbind; }
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#include "class/ascompletion.h"
|
||||
#include "qlanguagefactory.h"
|
||||
#include "qsnippetbinding.h"
|
||||
|
||||
#include "angelscript.h"
|
||||
#include "qsnippetmanager.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
@ -17,8 +17,6 @@ public:
|
|||
|
||||
void init(asIScriptEngine *engine);
|
||||
|
||||
QSnippetBinding *snippetBinding() const;
|
||||
|
||||
QLanguageFactory *languageFactory() const;
|
||||
|
||||
void applyLanguageSerivce(QEditor *editor);
|
||||
|
@ -41,7 +39,6 @@ private:
|
|||
void initAdditionalFormatScheme();
|
||||
|
||||
private:
|
||||
QSnippetBinding *m_snipbind = nullptr;
|
||||
QLanguageFactory *m_language = nullptr;
|
||||
QSnippetManager *m_snippetManager = nullptr;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,178 @@
|
|||
#ifndef QASCODEPARSER_H
|
||||
#define QASCODEPARSER_H
|
||||
|
||||
#include "AngelScript/sdk/angelscript/source/as_scriptnode.h"
|
||||
#include "class/qcodenode.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QAsCodeParser {
|
||||
public:
|
||||
QAsCodeParser(asCScriptEngine *engine);
|
||||
~QAsCodeParser();
|
||||
|
||||
public:
|
||||
enum class SymbolType {
|
||||
Invalid,
|
||||
Value, // a common value
|
||||
Variable, // a variable
|
||||
Enum, // an enum
|
||||
Class, // a class type
|
||||
Namespace, // a namespace
|
||||
Function, // a function
|
||||
TypeDef, // a typedef
|
||||
};
|
||||
|
||||
struct Symbol;
|
||||
|
||||
struct Symbol {
|
||||
SymbolType type = SymbolType::Invalid;
|
||||
QString name;
|
||||
qsizetype typeID; // if not a Variable, -1
|
||||
QList<Symbol> content; // only avaliable for enums and classes
|
||||
|
||||
QStringList ns; // namespaces
|
||||
|
||||
size_t group = 0; // 0 for all
|
||||
size_t scope = 0; // 0 for all
|
||||
};
|
||||
|
||||
using SymbolTable = QMap<size_t, Symbol>;
|
||||
|
||||
public:
|
||||
void parse(const QString &codes);
|
||||
|
||||
private:
|
||||
void ParseScript(bool inBlock);
|
||||
|
||||
QString getSymbolString(const sToken &t);
|
||||
|
||||
// parse tokens
|
||||
sToken ParseIdentifier();
|
||||
sToken ParseToken(int token);
|
||||
sToken ParseRealType();
|
||||
sToken ParseDataType(bool allowVariableType = false,
|
||||
bool allowAuto = false);
|
||||
sToken ParseOneOf(int *tokens, int count);
|
||||
sToken ParseType(bool allowConst, bool allowVariableType = false,
|
||||
bool allowAuto = false);
|
||||
|
||||
// Statements
|
||||
sToken SuperficiallyParseVarInit();
|
||||
|
||||
// parse and get symbols
|
||||
void ParseImport();
|
||||
void ParseEnumeration();
|
||||
void ParseTypedef();
|
||||
void ParseClass();
|
||||
void ParseMixin();
|
||||
void ParseInterface();
|
||||
void ParseFuncDef();
|
||||
void ParseNamespace();
|
||||
void ParseReturn();
|
||||
void ParseBreak();
|
||||
void ParseContinue();
|
||||
void ParseTryCatch();
|
||||
void ParseIf();
|
||||
void ParseLambda();
|
||||
void ParseStatement();
|
||||
void ParseFunction(bool isMethod = false);
|
||||
void ParseExpressionStatement();
|
||||
void ParseListPattern();
|
||||
void ParseStatementBlock();
|
||||
|
||||
void ParseAssignment();
|
||||
void ParseAssignOperator();
|
||||
void ParseSwitch();
|
||||
void ParseCase();
|
||||
void ParseFor();
|
||||
void ParseWhile();
|
||||
void ParseDoWhile();
|
||||
void ParseCondition();
|
||||
void ParseExpression();
|
||||
void ParseExprTerm();
|
||||
void ParseExprOperator();
|
||||
void ParseExprPreOp();
|
||||
void ParseExprPostOp();
|
||||
void ParseExprValue();
|
||||
|
||||
void ParseOptionalScope();
|
||||
|
||||
Symbol ParseVirtualPropertyDecl(bool isMethod, bool isInterface);
|
||||
QList<Symbol> ParseParameterList();
|
||||
|
||||
// parse but not get symbols
|
||||
void ParseTypeMod(bool isParam);
|
||||
void ParseFunctionCall();
|
||||
void SuperficiallyParseStatementBlock();
|
||||
void ParseInitList();
|
||||
void ParseCast();
|
||||
void ParseVariableAccess();
|
||||
void ParseConstructCall();
|
||||
void ParseConstant();
|
||||
|
||||
private:
|
||||
void Reset();
|
||||
|
||||
bool IsVarDecl();
|
||||
bool IsVirtualPropertyDecl();
|
||||
bool IsFuncDecl(bool isMethod);
|
||||
bool IsLambda();
|
||||
bool IsFunctionCall();
|
||||
|
||||
void GetToken(sToken *token);
|
||||
void RewindTo(const sToken *token);
|
||||
void RewindErrorTo(sToken *token);
|
||||
void SetPos(size_t pos);
|
||||
|
||||
bool IsRealType(int tokenType);
|
||||
bool IdentifierIs(const sToken &t, const char *str);
|
||||
bool IsDataType(const sToken &token);
|
||||
|
||||
private:
|
||||
bool CheckTemplateType(const sToken &t);
|
||||
bool ParseTemplTypeList(bool required = true);
|
||||
void ParseMethodAttributes();
|
||||
|
||||
void ParseArgList(bool withParenthesis = true);
|
||||
|
||||
void SuperficiallyParseExpression();
|
||||
|
||||
private:
|
||||
bool FindTokenAfterType(sToken &nextToken);
|
||||
bool FindIdentifierAfterScope(sToken &nextToken);
|
||||
bool IsConstant(int tokenType);
|
||||
bool IsOperator(int tokenType);
|
||||
bool IsPreOperator(int tokenType);
|
||||
bool IsPostOperator(int tokenType);
|
||||
bool IsAssignOperator(int tokenType);
|
||||
|
||||
bool DoesTypeExist(const QString &t);
|
||||
|
||||
void ParseFunctionDefinition();
|
||||
|
||||
void ParseDeclaration(bool isClassProp = false, bool isGlobalVar = false);
|
||||
|
||||
void ParseInterfaceMethod();
|
||||
|
||||
void ParseStringConstant();
|
||||
|
||||
private:
|
||||
bool errorWhileParsing;
|
||||
bool isSyntaxError;
|
||||
bool checkValidTypes;
|
||||
bool isParsingAppInterface;
|
||||
|
||||
asCScriptEngine *engine;
|
||||
|
||||
QStringList _curns; // current namespaces
|
||||
SymbolTable _symtable;
|
||||
|
||||
QString code;
|
||||
QString tempString; // Used for reduzing amount of dynamic allocations
|
||||
|
||||
sToken lastToken;
|
||||
size_t sourcePos;
|
||||
};
|
||||
|
||||
#endif // QASCODEPARSER_H
|
|
@ -93,7 +93,7 @@ private:
|
|||
|
||||
private:
|
||||
asIScriptEngine *_engine;
|
||||
QScopedPointer<asCScriptCode> m_code;
|
||||
// QScopedPointer<asCScriptCode> m_code;
|
||||
QList<QCodeNode *> _nodes;
|
||||
|
||||
QHash<QString, QCodeNode *> _buffer;
|
||||
|
|
|
@ -71,8 +71,8 @@ void RecentFileManager::apply(QWidget *parent, const QList<RecentInfo> &files) {
|
|||
|
||||
m_menu->addSeparator();
|
||||
|
||||
for (auto &item : files) {
|
||||
addRecentFile(item);
|
||||
for (auto pitem = files.rbegin(); pitem != files.rend(); ++pitem) {
|
||||
addRecentFile(*pitem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,6 +153,9 @@ void RecentFileManager::addRecentFile(const RecentInfo &info) {
|
|||
a->setToolTip(getDisplayTooltip(info));
|
||||
if (info.isWorkSpace) {
|
||||
a->setIcon(ICONRES(QStringLiteral("pro")));
|
||||
auto font = a->font();
|
||||
font.setUnderline(true);
|
||||
a->setFont(font);
|
||||
} else {
|
||||
a->setIcon(
|
||||
Utilities::getIconFromFile(qApp->style(), info.fileName));
|
||||
|
|
|
@ -1702,7 +1702,8 @@ void WingAngelAPI::script_call(asIScriptGeneric *gen) {
|
|||
params.append(obj);
|
||||
}
|
||||
|
||||
auto ret = p->_sfns.at(id).fn(params);
|
||||
auto &fns = p->_sfns.at(id);
|
||||
auto ret = fns.fn(params);
|
||||
auto op = [](asIScriptGeneric *gen, void *addr, QMetaType::Type type) {
|
||||
auto b = isTempBuffered(type);
|
||||
if (b) {
|
||||
|
@ -1746,6 +1747,49 @@ void WingAngelAPI::script_call(asIScriptGeneric *gen) {
|
|||
}
|
||||
};
|
||||
|
||||
// Check return type
|
||||
auto ctx = asGetActiveContext();
|
||||
if (ret.canConvert<WingHex::IWingPlugin::ScriptCallError>()) {
|
||||
auto err = ret.value<WingHex::IWingPlugin::ScriptCallError>();
|
||||
|
||||
auto errmsg = tr("Get Exception While ScriptCall: (%1) %2")
|
||||
.arg(err.errorCode)
|
||||
.arg(err.errmsg);
|
||||
ctx->SetException(errmsg.toUtf8());
|
||||
return;
|
||||
}
|
||||
|
||||
auto rettype = fns.ret;
|
||||
auto msg = tr("InvalidRetType: need ");
|
||||
switch (rettype) {
|
||||
case WingHex::IWingPlugin::Void: {
|
||||
if (!ret.isNull()) {
|
||||
auto e = msg.arg("void");
|
||||
ctx->SetException(e.toUtf8());
|
||||
}
|
||||
} break;
|
||||
case WingHex::IWingPlugin::Bool:
|
||||
case WingHex::IWingPlugin::Int:
|
||||
case WingHex::IWingPlugin::UInt:
|
||||
case WingHex::IWingPlugin::Int8:
|
||||
case WingHex::IWingPlugin::UInt8:
|
||||
case WingHex::IWingPlugin::Int16:
|
||||
case WingHex::IWingPlugin::UInt16:
|
||||
case WingHex::IWingPlugin::Int64:
|
||||
case WingHex::IWingPlugin::UInt64:
|
||||
case WingHex::IWingPlugin::Float:
|
||||
case WingHex::IWingPlugin::Double:
|
||||
case WingHex::IWingPlugin::String:
|
||||
case WingHex::IWingPlugin::Char:
|
||||
case WingHex::IWingPlugin::Color:
|
||||
case WingHex::IWingPlugin::MetaMax:
|
||||
case WingHex::IWingPlugin::MetaTypeMask:
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
qvariantCastOp(
|
||||
engine, ret,
|
||||
std::bind(op, gen, std::placeholders::_1, std::placeholders::_2));
|
||||
|
|
|
@ -0,0 +1,553 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "wingcstruct.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
WingCStruct::WingCStruct()
|
||||
: WingHex::IWingPlugin(),
|
||||
_colortable({Qt::red, Qt::green, Qt::yellow, Qt::cyan}) {
|
||||
qRegisterMetaType<QVector<QColor>>();
|
||||
}
|
||||
|
||||
WingCStruct::~WingCStruct() {}
|
||||
|
||||
int WingCStruct::sdkVersion() const { return WingHex::SDKVERSION; }
|
||||
|
||||
const QString WingCStruct::signature() const { return WingHex::WINGSUMMER; }
|
||||
|
||||
bool WingCStruct::init(const std::unique_ptr<QSettings> &set) {
|
||||
// load color table
|
||||
|
||||
_curColor = _colortable.cbegin();
|
||||
resetEnv();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WingCStruct::unload(std::unique_ptr<QSettings> &set) {
|
||||
// save color table
|
||||
}
|
||||
|
||||
const QString WingCStruct::pluginName() const { return tr("WingCStruct"); }
|
||||
|
||||
const QString WingCStruct::pluginComment() const {
|
||||
return tr("Providing basic support for analyzing file structures");
|
||||
}
|
||||
|
||||
QIcon WingCStruct::pluginIcon() const { return ICONRES("structure"); }
|
||||
|
||||
WingCStruct::RegisteredEvents WingCStruct::registeredEvents() const {
|
||||
return RegisteredEvent::ScriptPragma;
|
||||
}
|
||||
|
||||
QHash<WingHex::SettingPage *, bool>
|
||||
WingCStruct::registeredSettingPages() const {
|
||||
return _setpgs;
|
||||
}
|
||||
|
||||
QHash<QString, WingCStruct::ScriptFnInfo>
|
||||
WingCStruct::registeredScriptFns() const {
|
||||
return _scriptfns;
|
||||
}
|
||||
|
||||
bool WingCStruct::eventOnScriptPragma(const QStringList &comments) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WingCStruct::eventScriptPragmaLineStep(const QString &codes) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WingCStruct::eventScriptPragmaFinished() {}
|
||||
|
||||
bool WingCStruct::addStruct(const QString &header) { return true; }
|
||||
|
||||
bool WingCStruct::addStructFromFile(const QString &fileName) { return true; }
|
||||
|
||||
void WingCStruct::resetEnv() { _parser = CTypeParser(); }
|
||||
|
||||
bool WingCStruct::setColorTable(const QVector<QColor> &table) {
|
||||
// only main thread can modified it
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (table.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto r = std::find_if_not(table.begin(), table.end(), [](const QColor &c) {
|
||||
return c.isValid() && c.alpha() == 255;
|
||||
});
|
||||
|
||||
if (r != table.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_colortable = table;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<QColor> WingCStruct::colorTable() { return _colortable; }
|
||||
|
||||
bool WingCStruct::setStructPadding(int padding) {
|
||||
if (padding < 1 || padding > 8) {
|
||||
return false;
|
||||
}
|
||||
_parser.setPadAlignment(padding);
|
||||
return true;
|
||||
}
|
||||
|
||||
int WingCStruct::structPadding() { return _parser.padAlignment(); }
|
||||
|
||||
QStringList WingCStruct::structTypes() { return _parser.structDefs().keys(); }
|
||||
|
||||
qsizetype WingCStruct::sizeofStruct(const QString &type) {
|
||||
return _parser.typeSizes().value(type, -1);
|
||||
}
|
||||
|
||||
bool WingCStruct::existStruct(const QString &type) {
|
||||
return _parser.structDefs().contains(type);
|
||||
}
|
||||
|
||||
bool WingCStruct::metadata(qsizetype offset, const QString &type,
|
||||
const QColor &fg, const QColor &bg,
|
||||
const QString &comment) {
|
||||
if (!(fg.isValid() && bg.isValid() && !comment.isEmpty())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto len = sizeofStruct(type);
|
||||
if (len < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!emit reader.isCurrentDocEditing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (offset < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto doclen = emit reader.documentBytes();
|
||||
if (doclen < 0 || offset + len >= doclen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto handle = emit controller.openCurrent();
|
||||
if (handle < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto ret =
|
||||
emit controller.beginMarco(QStringLiteral("WingCStruct::metadata"));
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto struc = _parser.structDefs().value(type);
|
||||
for (auto &m : struc) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
emit controller.endMarco();
|
||||
emit controller.closeHandle(handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WingCStruct::foreground(qsizetype offset, const QString &type,
|
||||
const QColor &color) {
|
||||
return metadata(offset, type, color, QColor(), QString());
|
||||
}
|
||||
|
||||
bool WingCStruct::background(qsizetype offset, const QString &type,
|
||||
const QColor &color) {
|
||||
return metadata(offset, type, QColor(), color, QString());
|
||||
}
|
||||
|
||||
bool WingCStruct::comment(qsizetype offset, const QString &type,
|
||||
const QString &comment) {
|
||||
return metadata(offset, type, QColor(), QColor(), comment);
|
||||
}
|
||||
|
||||
QVariantHash WingCStruct::read(qsizetype offset, const QString &type) {
|
||||
auto len = sizeofStruct(type);
|
||||
if (len < 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!emit reader.isCurrentDocEditing()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (offset < 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto doclen = emit reader.documentBytes();
|
||||
if (doclen < 0 || offset + len >= doclen) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto struc = _parser.structDefs().value(type);
|
||||
|
||||
// ok, begin reading
|
||||
QVariantHash content;
|
||||
|
||||
// first read all bytes
|
||||
auto raw = emit reader.readBytes(offset, len);
|
||||
|
||||
// then slice and parse
|
||||
|
||||
for (auto &m : struc) {
|
||||
auto t = _parser.getTokenType(m.data_type);
|
||||
if (t == kBasicDataType) {
|
||||
|
||||
} else if (t == kStructName) {
|
||||
|
||||
} else if (t == kUnionName) {
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
bool WingCStruct::write(qsizetype offset, const QString &type,
|
||||
const QVariantHash &content) {
|
||||
auto len = sizeofStruct(type);
|
||||
if (len < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!emit reader.isCurrentDocEditing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return emit controller.writeBytes(offset, getRawData(type, content));
|
||||
}
|
||||
|
||||
bool WingCStruct::insert(qsizetype offset, const QString &type,
|
||||
const QVariantHash &content) {
|
||||
auto len = sizeofStruct(type);
|
||||
if (len < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!emit reader.isCurrentDocEditing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return emit controller.insertBytes(offset, getRawData(type, content));
|
||||
}
|
||||
|
||||
bool WingCStruct::append(const QString &type, const QVariantHash &content) {
|
||||
auto len = sizeofStruct(type);
|
||||
if (len < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!emit reader.isCurrentDocEditing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return emit controller.appendBytes(getRawData(type, content));
|
||||
}
|
||||
|
||||
QByteArray WingCStruct::getRawData(const QString &type,
|
||||
const QVariantHash &content) {
|
||||
// TODO
|
||||
return {};
|
||||
}
|
||||
|
||||
QColor WingCStruct::getNextColor() {
|
||||
auto color = *_curColor;
|
||||
_curColor++;
|
||||
if (_curColor == _colortable.end()) {
|
||||
_curColor = _colortable.begin();
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
QVariant WingCStruct::addStruct(const QVariantList ¶ms) {
|
||||
if (params.size() != 1) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto header_v = params.at(0);
|
||||
if (!header_v.canConvert<QString>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
auto header = header_v.toString();
|
||||
return addStruct(header);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::addStructFromFile(const QVariantList ¶ms) {
|
||||
if (params.size() != 1) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto fileName_v = params.at(0);
|
||||
if (!fileName_v.canConvert<QString>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto fileName = fileName_v.toString();
|
||||
return addStructFromFile(fileName);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::resetEnv(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
resetEnv();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant WingCStruct::setColorTable(const QVariantList ¶ms) {
|
||||
if (params.size() != 1) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto table_v = params.at(0);
|
||||
if (!table_v.canConvert<QVector<QColor>>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto table = table_v.value<QVector<QColor>>();
|
||||
return setColorTable(table);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::colorTable(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
return QVariant::fromValue(colorTable());
|
||||
}
|
||||
|
||||
QVariant WingCStruct::setStructPadding(const QVariantList ¶ms) {
|
||||
if (params.size() != 1) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto padding_v = params.at(0);
|
||||
if (!padding_v.canConvert<int>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
auto padding = padding_v.toInt();
|
||||
return setStructPadding(padding);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::structPadding(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
return structPadding();
|
||||
}
|
||||
|
||||
QVariant WingCStruct::structTypes(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
return structTypes();
|
||||
}
|
||||
|
||||
QVariant WingCStruct::sizeofStruct(const QVariantList ¶ms) {
|
||||
if (params.size() != 1) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto type_v = params.at(0);
|
||||
if (!type_v.canConvert<QString>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
auto type = type_v.toString();
|
||||
return sizeofStruct(type);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::existStruct(const QVariantList ¶ms) {
|
||||
if (params.size() != 1) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto type_v = params.at(0);
|
||||
if (!type_v.canConvert<QString>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
auto type = type_v.toString();
|
||||
return existStruct(type);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::metadata(const QVariantList ¶ms) {
|
||||
if (params.size() != 5) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto offset_v = params.at(0);
|
||||
auto type_v = params.at(1);
|
||||
auto fg_v = params.at(2);
|
||||
auto bg_v = params.at(3);
|
||||
auto comment_v = params.at(4);
|
||||
|
||||
if (!offset_v.canConvert<qsizetype>() || !type_v.canConvert<QString>() ||
|
||||
!fg_v.canConvert<QColor>() || !bg_v.canConvert<QColor>() ||
|
||||
!comment_v.canConvert<QString>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto offset = offset_v.value<qsizetype>();
|
||||
auto type = type_v.toString();
|
||||
auto fg = fg_v.value<QColor>();
|
||||
auto bg = bg_v.value<QColor>();
|
||||
auto comment = comment_v.toString();
|
||||
return metadata(offset, type, fg, bg, comment);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::foreground(const QVariantList ¶ms) {
|
||||
if (params.size() != 3) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto offset_v = params.at(0);
|
||||
auto type_v = params.at(1);
|
||||
auto color_v = params.at(2);
|
||||
|
||||
if (!offset_v.canConvert<qsizetype>() || !type_v.canConvert<QString>() ||
|
||||
!color_v.canConvert<QColor>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto offset = offset_v.value<qsizetype>();
|
||||
auto type = type_v.toString();
|
||||
auto color = color_v.value<QColor>();
|
||||
return foreground(offset, type, color);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::background(const QVariantList ¶ms) {
|
||||
if (params.size() != 3) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto offset_v = params.at(0);
|
||||
auto type_v = params.at(1);
|
||||
auto color_v = params.at(2);
|
||||
|
||||
if (!offset_v.canConvert<qsizetype>() || !type_v.canConvert<QString>() ||
|
||||
!color_v.canConvert<QColor>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto offset = offset_v.value<qsizetype>();
|
||||
auto type = type_v.toString();
|
||||
auto color = color_v.value<QColor>();
|
||||
return background(offset, type, color);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::comment(const QVariantList ¶ms) {
|
||||
if (params.size() != 3) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto offset_v = params.at(0);
|
||||
auto type_v = params.at(1);
|
||||
auto comment_v = params.at(2);
|
||||
|
||||
if (!offset_v.canConvert<qsizetype>() || !type_v.canConvert<QString>() ||
|
||||
!comment_v.canConvert<QString>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto offset = offset_v.value<qsizetype>();
|
||||
auto type = type_v.toString();
|
||||
auto comment = comment_v.toString();
|
||||
return this->comment(offset, type, comment);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::read(const QVariantList ¶ms) {
|
||||
if (params.size() != 2) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto offset_v = params.at(0);
|
||||
auto type_v = params.at(1);
|
||||
if (!offset_v.canConvert<qsizetype>() || !type_v.canConvert<QString>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto offset = offset_v.value<qsizetype>();
|
||||
auto type = type_v.toString();
|
||||
return read(offset, type);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::write(const QVariantList ¶ms) {
|
||||
if (params.size() != 3) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto offset_v = params.at(0);
|
||||
auto type_v = params.at(1);
|
||||
auto content_v = params.at(2);
|
||||
|
||||
if (!offset_v.canConvert<qsizetype>() || !type_v.canConvert<QString>() ||
|
||||
!content_v.canConvert<QVariantHash>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto offset = offset_v.value<qsizetype>();
|
||||
auto type = type_v.toString();
|
||||
auto content = content_v.toHash();
|
||||
return write(offset, type, content);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::insert(const QVariantList ¶ms) {
|
||||
if (params.size() != 3) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto offset_v = params.at(0);
|
||||
auto type_v = params.at(1);
|
||||
auto content_v = params.at(2);
|
||||
|
||||
if (!offset_v.canConvert<qsizetype>() || !type_v.canConvert<QString>() ||
|
||||
!content_v.canConvert<QVariantHash>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto offset = offset_v.value<qsizetype>();
|
||||
auto type = type_v.toString();
|
||||
auto content = content_v.toHash();
|
||||
return insert(offset, type, content);
|
||||
}
|
||||
|
||||
QVariant WingCStruct::append(const QVariantList ¶ms) {
|
||||
if (params.size() != 2) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto type_v = params.at(0);
|
||||
auto content_v = params.at(1);
|
||||
|
||||
if (!type_v.canConvert<QString>() ||
|
||||
!content_v.canConvert<QVariantHash>()) {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
|
||||
auto type = type_v.toString();
|
||||
auto content = content_v.toHash();
|
||||
return append(type, content);
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef WINGCSTRUCT_H
|
||||
#define WINGCSTRUCT_H
|
||||
|
||||
#include "ctypeparser.h"
|
||||
#include "plugin/iwingplugin.h"
|
||||
|
||||
class WingCStruct : public WingHex::IWingPlugin {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WingCStruct();
|
||||
virtual ~WingCStruct();
|
||||
|
||||
// IWingPluginBase interface
|
||||
public:
|
||||
virtual int sdkVersion() const override;
|
||||
virtual const QString signature() const override;
|
||||
virtual bool init(const std::unique_ptr<QSettings> &set) override;
|
||||
virtual void unload(std::unique_ptr<QSettings> &set) override;
|
||||
virtual const QString pluginName() const override;
|
||||
virtual const QString pluginComment() const override;
|
||||
virtual QIcon pluginIcon() const override;
|
||||
|
||||
// IWingPlugin interface
|
||||
public:
|
||||
virtual RegisteredEvents registeredEvents() const override;
|
||||
virtual QHash<WingHex::SettingPage *, bool>
|
||||
registeredSettingPages() const override;
|
||||
virtual QHash<QString, ScriptFnInfo> registeredScriptFns() const override;
|
||||
virtual bool eventOnScriptPragma(const QStringList &comments) override;
|
||||
virtual bool eventScriptPragmaLineStep(const QString &codes) override;
|
||||
virtual void eventScriptPragmaFinished() override;
|
||||
|
||||
private:
|
||||
// basic
|
||||
WING_SERVICE bool addStruct(const QString &header);
|
||||
WING_SERVICE bool addStructFromFile(const QString &fileName);
|
||||
WING_SERVICE void resetEnv();
|
||||
|
||||
WING_SERVICE bool setColorTable(const QVector<QColor> &table);
|
||||
WING_SERVICE QVector<QColor> colorTable();
|
||||
|
||||
WING_SERVICE bool setStructPadding(int padding); // [1,8]
|
||||
WING_SERVICE int structPadding();
|
||||
|
||||
// lookup
|
||||
WING_SERVICE QStringList structTypes();
|
||||
WING_SERVICE qsizetype sizeofStruct(const QString &type);
|
||||
WING_SERVICE bool existStruct(const QString &type);
|
||||
|
||||
// metadata
|
||||
WING_SERVICE bool metadata(qsizetype offset, const QString &type,
|
||||
const QColor &fg, const QColor &bg,
|
||||
const QString &comment);
|
||||
WING_SERVICE bool foreground(qsizetype offset, const QString &type,
|
||||
const QColor &color);
|
||||
WING_SERVICE bool background(qsizetype offset, const QString &type,
|
||||
const QColor &color);
|
||||
WING_SERVICE bool comment(qsizetype offset, const QString &type,
|
||||
const QString &comment);
|
||||
|
||||
// read / write
|
||||
WING_SERVICE QVariantHash read(qsizetype offset, const QString &type);
|
||||
WING_SERVICE bool write(qsizetype offset, const QString &type,
|
||||
const QVariantHash &content);
|
||||
WING_SERVICE bool insert(qsizetype offset, const QString &type,
|
||||
const QVariantHash &content);
|
||||
WING_SERVICE bool append(const QString &type, const QVariantHash &content);
|
||||
|
||||
private:
|
||||
QByteArray getRawData(const QString &type, const QVariantHash &content);
|
||||
|
||||
QColor getNextColor();
|
||||
|
||||
private:
|
||||
// wrapper for WingAngelApi
|
||||
QVariant addStruct(const QVariantList ¶ms);
|
||||
QVariant addStructFromFile(const QVariantList ¶ms);
|
||||
QVariant resetEnv(const QVariantList ¶ms);
|
||||
|
||||
QVariant setColorTable(const QVariantList ¶ms);
|
||||
QVariant colorTable(const QVariantList ¶ms);
|
||||
|
||||
QVariant setStructPadding(const QVariantList ¶ms);
|
||||
QVariant structPadding(const QVariantList ¶ms);
|
||||
|
||||
QVariant structTypes(const QVariantList ¶ms);
|
||||
QVariant sizeofStruct(const QVariantList ¶ms);
|
||||
QVariant existStruct(const QVariantList ¶ms);
|
||||
|
||||
QVariant metadata(const QVariantList ¶ms);
|
||||
QVariant foreground(const QVariantList ¶ms);
|
||||
QVariant background(const QVariantList ¶ms);
|
||||
QVariant comment(const QVariantList ¶ms);
|
||||
|
||||
QVariant read(const QVariantList ¶ms);
|
||||
QVariant write(const QVariantList ¶ms);
|
||||
QVariant insert(const QVariantList ¶ms);
|
||||
QVariant append(const QVariantList ¶ms);
|
||||
|
||||
private:
|
||||
CTypeParser _parser;
|
||||
|
||||
QVector<QColor> _colortable;
|
||||
QVector<QColor>::const_iterator _curColor;
|
||||
|
||||
QHash<WingHex::SettingPage *, bool> _setpgs;
|
||||
QHash<QString, WingCStruct::ScriptFnInfo> _scriptfns;
|
||||
};
|
||||
|
||||
#endif // WINGCSTRUCT_H
|
|
@ -86,18 +86,12 @@ bool WorkSpaceManager::loadWorkSpace(const QString &filename, QString &file,
|
|||
if (!b || nend >= maxbytes || nend < 0)
|
||||
continue;
|
||||
|
||||
static auto NO_COLOR = QStringLiteral("-");
|
||||
|
||||
QColor fcolor, bcolor;
|
||||
auto fgn = fgcolor.toString();
|
||||
if (fgn != NO_COLOR) {
|
||||
fcolor = QColor(fgn);
|
||||
}
|
||||
fcolor = QColor(fgn);
|
||||
|
||||
auto bgn = bgcolor.toString();
|
||||
if (bgn != NO_COLOR) {
|
||||
bcolor = QColor(bgn);
|
||||
}
|
||||
bcolor = QColor(bgn);
|
||||
|
||||
QHexMetadataItem metaitem;
|
||||
metaitem.begin = nbegin;
|
||||
|
@ -166,11 +160,10 @@ bool WorkSpaceManager::loadWorkSpace(const QString &filename, QString &file,
|
|||
}
|
||||
|
||||
QString WorkSpaceManager::getColorString(const QColor &color) {
|
||||
static auto NO_COLOR = QStringLiteral("-");
|
||||
if (color.isValid()) {
|
||||
return color.name();
|
||||
}
|
||||
return NO_COLOR;
|
||||
return {};
|
||||
}
|
||||
|
||||
bool WorkSpaceManager::saveWorkSpace(
|
||||
|
|
|
@ -45,13 +45,13 @@ QVariant MetaDataModel::data(const QModelIndex &index, int role) const {
|
|||
return QString::number(d.end) + QStringLiteral(" - 0x") +
|
||||
QString::number(d.end, 16).toUpper();
|
||||
case 2: {
|
||||
if (d.foreground.alpha() == 0) {
|
||||
if (!d.foreground.isValid()) {
|
||||
return QStringLiteral("-");
|
||||
}
|
||||
return d.foreground.name();
|
||||
}
|
||||
case 3:
|
||||
if (d.background.alpha() == 0) {
|
||||
if (!d.background.isValid()) {
|
||||
return QStringLiteral("-");
|
||||
}
|
||||
return d.background.name();
|
||||
|
@ -65,10 +65,10 @@ QVariant MetaDataModel::data(const QModelIndex &index, int role) const {
|
|||
auto d = b.at(r);
|
||||
switch (index.column()) {
|
||||
case 2:
|
||||
if (d.foreground.alpha() > 0)
|
||||
if (d.foreground.isValid())
|
||||
return d.foreground;
|
||||
case 3:
|
||||
if (d.background.alpha() > 0)
|
||||
if (d.background.isValid())
|
||||
return d.background;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -177,7 +177,7 @@ signals:
|
|||
Q_REQUIRED_RESULT bool setAddressBase(quintptr base);
|
||||
|
||||
Q_REQUIRED_RESULT bool beginMarco(const QString &txt = {});
|
||||
Q_REQUIRED_RESULT bool endMarco();
|
||||
bool endMarco();
|
||||
|
||||
Q_REQUIRED_RESULT bool writeInt8(qsizetype offset, qint8 value);
|
||||
Q_REQUIRED_RESULT bool writeInt16(qsizetype offset, qint16 value);
|
||||
|
@ -461,6 +461,21 @@ public:
|
|||
enum class FileType { Invalid, File, RegionFile, Driver, Extension };
|
||||
Q_ENUM(FileType)
|
||||
|
||||
struct ScriptCallError {
|
||||
int errorCode;
|
||||
QString errmsg;
|
||||
};
|
||||
|
||||
public:
|
||||
QVariant getScriptCallError(int errCode, const QString &msg) {
|
||||
ScriptCallError err;
|
||||
|
||||
err.errorCode = errCode;
|
||||
err.errmsg = msg;
|
||||
|
||||
return QVariant::fromValue(err);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~IWingPlugin() = default;
|
||||
|
||||
|
@ -558,7 +573,7 @@ public:
|
|||
QGenericArgument val6 = QGenericArgument(),
|
||||
QGenericArgument val7 = QGenericArgument(),
|
||||
QGenericArgument val8 = QGenericArgument()) {
|
||||
return emit invokeService(puid, member, Qt::AutoConnection, ret, val0,
|
||||
return emit invokeService(puid, member, Qt::DirectConnection, ret, val0,
|
||||
val1, val2, val3, val4, val5, val6, val7,
|
||||
val8);
|
||||
}
|
||||
|
@ -588,7 +603,7 @@ public:
|
|||
QGenericArgument val6 = QGenericArgument(),
|
||||
QGenericArgument val7 = QGenericArgument(),
|
||||
QGenericArgument val8 = QGenericArgument()) {
|
||||
return emit invokeService(puid, member, Qt::AutoConnection,
|
||||
return emit invokeService(puid, member, Qt::DirectConnection,
|
||||
QGenericReturnArgument(), val0, val1, val2,
|
||||
val3, val4, val5, val6, val7, val8);
|
||||
}
|
||||
|
@ -602,6 +617,7 @@ public:
|
|||
} // namespace WingHex
|
||||
|
||||
Q_DECLARE_METATYPE(WingHex::SenderInfo)
|
||||
Q_DECLARE_METATYPE(WingHex::IWingPlugin::ScriptCallError)
|
||||
Q_DECLARE_INTERFACE(WingHex::IWingPlugin, "com.wingsummer.iwingplugin")
|
||||
|
||||
#endif // IWINGPLUGIN_H
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "class/logger.h"
|
||||
#include "class/settingmanager.h"
|
||||
#include "class/skinmanager.h"
|
||||
#include "class/wingcstruct.h"
|
||||
#include "class/wingfiledialog.h"
|
||||
#include "class/winginputdialog.h"
|
||||
#include "class/wingmessagebox.h"
|
||||
|
@ -180,7 +181,6 @@ PluginSystem::parsePluginMetadata(const QJsonObject &meta) {
|
|||
info.version =
|
||||
QVersionNumber::fromString(meta["Version"].toString().trimmed());
|
||||
|
||||
info.name = meta["Name"].toString().trimmed();
|
||||
info.vendor = meta["Vendor"].toString().trimmed();
|
||||
info.author = meta["Author"].toString().trimmed();
|
||||
info.license = meta["License"].toString().trimmed();
|
||||
|
@ -580,7 +580,7 @@ void PluginSystem::loadExtPlugin() {
|
|||
Logger::newLine();
|
||||
|
||||
for (auto &lplg : errorplg) {
|
||||
Logger::critical(tr("- PluginName:") + lplg.name);
|
||||
Logger::critical(tr("- PluginID:") + lplg.id);
|
||||
Logger::critical(tr("- Dependencies:"));
|
||||
for (auto &d : lplg.dependencies) {
|
||||
Logger::critical(QString(4, ' ') + tr("PUID:") + d.puid);
|
||||
|
@ -660,7 +660,7 @@ void PluginSystem::registerFns(IWingPlugin *plg) {
|
|||
}
|
||||
|
||||
Q_ASSERT(_angelplg);
|
||||
_angelplg->registerScriptFns(plg->metaObject()->className(), rfns);
|
||||
_angelplg->registerScriptFns(_pinfos.value(plg).id, rfns);
|
||||
}
|
||||
|
||||
void PluginSystem::registerEnums(IWingPlugin *plg) {
|
||||
|
@ -882,11 +882,7 @@ void PluginSystem::loadPlugin(IWingPlugin *p, PluginInfo &meta,
|
|||
|
||||
emit pluginLoading(p->pluginName());
|
||||
|
||||
if (meta.name.isEmpty()) {
|
||||
meta.name = p->metaObject()->className();
|
||||
}
|
||||
|
||||
p_tr = LanguageManager::instance().try2LoadPluginLang(meta.name);
|
||||
p_tr = LanguageManager::instance().try2LoadPluginLang(meta.id);
|
||||
|
||||
connectLoadingInterface(p);
|
||||
|
||||
|
@ -894,7 +890,7 @@ void PluginSystem::loadPlugin(IWingPlugin *p, PluginInfo &meta,
|
|||
std::unique_ptr<QSettings> setp(nullptr);
|
||||
if (setdir.has_value()) {
|
||||
setp = std::make_unique<QSettings>(
|
||||
setdir->absoluteFilePath(p->metaObject()->className()),
|
||||
setdir->absoluteFilePath(meta.id),
|
||||
QSettings::Format::IniFormat);
|
||||
}
|
||||
|
||||
|
@ -1020,18 +1016,10 @@ void PluginSystem::loadPlugin(IWingDevice *p, PluginInfo &meta,
|
|||
throw tr("ErrLoadExtPluginSDKVersion");
|
||||
}
|
||||
|
||||
if (meta.name.isEmpty()) {
|
||||
throw tr("ErrLoadExtPluginNoName");
|
||||
}
|
||||
|
||||
Logger::warning(tr("ExtPluginName :") + meta.name);
|
||||
Logger::warning(tr("ExtPluginAuthor :") + meta.author);
|
||||
Logger::warning(tr("ExtPluginWidgetRegister"));
|
||||
|
||||
if (meta.name.isEmpty()) {
|
||||
meta.name = p->metaObject()->className();
|
||||
}
|
||||
p_tr = LanguageManager::instance().try2LoadPluginLang(meta.name);
|
||||
p_tr = LanguageManager::instance().try2LoadPluginLang(meta.id);
|
||||
|
||||
connectLoadingInterface(p);
|
||||
|
||||
|
@ -2835,6 +2823,26 @@ void PluginSystem::loadAllPlugin() {
|
|||
loadPlugin(_angelplg, meta, std::nullopt);
|
||||
}
|
||||
|
||||
{
|
||||
auto cstructplg = new WingCStruct;
|
||||
QFile cstructjson(QStringLiteral(
|
||||
":/com.wingsummer.winghex/src/class/WingCStruct.json"));
|
||||
auto ret = cstructjson.open(QFile::ReadOnly);
|
||||
Q_ASSERT(ret);
|
||||
Q_UNUSED(ret);
|
||||
auto cstruct = cstructjson.readAll();
|
||||
cstructjson.close();
|
||||
|
||||
QJsonDocument doc = QJsonDocument::fromJson(cstruct);
|
||||
auto meta = parsePluginMetadata(doc.object());
|
||||
|
||||
QDir setd(Utilities::getAppDataPath());
|
||||
auto plgset = QStringLiteral("plgset");
|
||||
setd.mkdir(plgset);
|
||||
|
||||
loadPlugin(cstructplg, meta, setd);
|
||||
}
|
||||
|
||||
bool ok;
|
||||
auto displg = qEnvironmentVariableIntValue("WING_DISABLE_PLUGIN", &ok);
|
||||
if (displg > 0 || !set.enablePlugin()) {
|
||||
|
|
|
@ -101,7 +101,6 @@ private:
|
|||
public:
|
||||
struct PluginInfo {
|
||||
QString id;
|
||||
QString name;
|
||||
QVersionNumber version;
|
||||
QString vendor;
|
||||
QList<WingDependency> dependencies;
|
||||
|
|
Loading…
Reference in New Issue