feat: 完善脚本调试器;完善脚本编辑器;

This commit is contained in:
寂静的羽夏 2024-09-19 20:20:52 +08:00
parent 7b1a77ae60
commit 598c20ac1a
20 changed files with 619 additions and 763 deletions

@ -1 +1 @@
Subproject commit b2af78b2b0a9d9370a69f0f762fd0f405cf63e41 Subproject commit f2034769ce887367e97a5fbaced5b14aa8039fd3

View File

@ -76,7 +76,7 @@
#endif #endif
#ifdef Q_GL_EDITOR #ifdef Q_GL_EDITOR
#include <QGLWidget> #include <QtOpenGLWidgets/QOpenGLWidget>
#endif #endif
#define QCE_ACTION(name, action) \ #define QCE_ACTION(name, action) \
@ -444,7 +444,7 @@ QEditor::~QEditor() {
*/ */
void QEditor::init(bool actions) { void QEditor::init(bool actions) {
#ifdef Q_GL_EDITOR #ifdef Q_GL_EDITOR
setViewport(new QGLWidget); setViewport(new QOpenGLWidget);
#endif #endif
viewport()->setCursor(Qt::IBeamCursor); viewport()->setCursor(Qt::IBeamCursor);
@ -512,7 +512,7 @@ void QEditor::init(bool actions) {
QAction *a, *sep; QAction *a, *sep;
a = new QAction(QIcon(":/undo.png"), tr("&Undo"), this); a = new QAction(QIcon(":/qeditor/undo.png"), tr("&Undo"), this);
a->setObjectName("undo"); a->setObjectName("undo");
Q_SHORTCUT(a, "Ctrl+Z", "Edit"); Q_SHORTCUT(a, "Ctrl+Z", "Edit");
a->setEnabled(false); a->setEnabled(false);
@ -521,7 +521,7 @@ void QEditor::init(bool actions) {
addAction(a, "&Edit", "Edit"); addAction(a, "&Edit", "Edit");
a = new QAction(QIcon(":/redo.png"), tr("&Redo"), this); a = new QAction(QIcon(":/qeditor/redo.png"), tr("&Redo"), this);
a->setObjectName("redo"); a->setObjectName("redo");
Q_SHORTCUT(a, "Ctrl+Y", "Edit"); Q_SHORTCUT(a, "Ctrl+Y", "Edit");
a->setEnabled(false); a->setEnabled(false);
@ -534,7 +534,7 @@ void QEditor::init(bool actions) {
sep->setSeparator(true); sep->setSeparator(true);
addAction(sep, "&Edit", "Edit"); addAction(sep, "&Edit", "Edit");
a = new QAction(QIcon(":/cut.png"), tr("Cu&t"), this); a = new QAction(QIcon(":/qeditor/cut.png"), tr("Cu&t"), this);
a->setObjectName("cut"); a->setObjectName("cut");
Q_SHORTCUT(a, "Ctrl+X", "Edit"); Q_SHORTCUT(a, "Ctrl+X", "Edit");
a->setEnabled(false); a->setEnabled(false);
@ -543,7 +543,7 @@ void QEditor::init(bool actions) {
addAction(a, "&Edit", "Edit"); addAction(a, "&Edit", "Edit");
a = new QAction(QIcon(":/copy.png"), tr("&Copy"), this); a = new QAction(QIcon(":/qeditor/copy.png"), tr("&Copy"), this);
a->setObjectName("copy"); a->setObjectName("copy");
Q_SHORTCUT(a, "Ctrl+C", "Edit"); Q_SHORTCUT(a, "Ctrl+C", "Edit");
a->setEnabled(false); a->setEnabled(false);
@ -552,7 +552,7 @@ void QEditor::init(bool actions) {
addAction(a, "&Edit", "Edit"); addAction(a, "&Edit", "Edit");
a = new QAction(QIcon(":/paste.png"), tr("&Paste"), this); a = new QAction(QIcon(":/qeditor/paste.png"), tr("&Paste"), this);
a->setObjectName("paste"); a->setObjectName("paste");
// aPaste->setEnabled(QApplication::clipboard()->text().count()); // aPaste->setEnabled(QApplication::clipboard()->text().count());
Q_SHORTCUT(a, "Ctrl+V", "Edit"); Q_SHORTCUT(a, "Ctrl+V", "Edit");
@ -567,14 +567,14 @@ void QEditor::init(bool actions) {
sep->setSeparator(true); sep->setSeparator(true);
addAction(sep, "&Edit", "Edit"); addAction(sep, "&Edit", "Edit");
a = new QAction(QIcon(":/indent.png"), tr("&Indent"), this); a = new QAction(tr("&Indent"), this);
a->setObjectName("indent"); a->setObjectName("indent");
Q_SHORTCUT(a, "Ctrl+I", "Edit"); Q_SHORTCUT(a, "Ctrl+I", "Edit");
connect(a, SIGNAL(triggered()), this, SLOT(indentSelection())); connect(a, SIGNAL(triggered()), this, SLOT(indentSelection()));
addAction(a, "&Edit", "Edit"); addAction(a, "&Edit", "Edit");
a = new QAction(QIcon(":/unindent.png"), tr("&Unindent"), this); a = new QAction(tr("&Unindent"), this);
a->setObjectName("unindent"); a->setObjectName("unindent");
Q_SHORTCUT(a, "Ctrl+Shift+I", "Edit"); Q_SHORTCUT(a, "Ctrl+Shift+I", "Edit");
connect(a, SIGNAL(triggered()), this, SLOT(unindentSelection())); connect(a, SIGNAL(triggered()), this, SLOT(unindentSelection()));
@ -585,14 +585,14 @@ void QEditor::init(bool actions) {
sep->setSeparator(true); sep->setSeparator(true);
addAction(sep, "&Edit", ""); addAction(sep, "&Edit", "");
a = new QAction(QIcon(":/comment.png"), tr("Co&mment"), this); a = new QAction(tr("Co&mment"), this);
a->setObjectName("comment"); a->setObjectName("comment");
Q_SHORTCUT(a, "Ctrl+D", "Edit"); Q_SHORTCUT(a, "Ctrl+D", "Edit");
connect(a, SIGNAL(triggered()), this, SLOT(commentSelection())); connect(a, SIGNAL(triggered()), this, SLOT(commentSelection()));
addAction(a, "&Edit", "Edit"); addAction(a, "&Edit", "Edit");
a = new QAction(QIcon(":/uncomment.png"), tr("Unc&omment"), this); a = new QAction(tr("Unc&omment"), this);
a->setObjectName("uncomment"); a->setObjectName("uncomment");
Q_SHORTCUT(a, "Ctrl+Shift+D", "Edit"); Q_SHORTCUT(a, "Ctrl+Shift+D", "Edit");
connect(a, SIGNAL(triggered()), this, SLOT(uncommentSelection())); connect(a, SIGNAL(triggered()), this, SLOT(uncommentSelection()));
@ -614,21 +614,21 @@ void QEditor::init(bool actions) {
sep->setSeparator(true); sep->setSeparator(true);
addAction(sep, QString()); addAction(sep, QString());
a = new QAction(QIcon(":/find.png"), tr("&Find"), this); a = new QAction(QIcon(":/qeditor/find.png"), tr("&Find"), this);
a->setObjectName("find"); a->setObjectName("find");
Q_SHORTCUT(a, "Ctrl+F", "Search"); Q_SHORTCUT(a, "Ctrl+F", "Search");
connect(a, SIGNAL(triggered()), this, SLOT(find())); connect(a, SIGNAL(triggered()), this, SLOT(find()));
addAction(a, "&Search", "Search"); addAction(a, "&Search", "Search");
a = new QAction(QIcon(":/next.png"), tr("Fin&d next"), pMenu); a = new QAction(tr("Fin&d next"), pMenu);
a->setObjectName("findNext"); a->setObjectName("findNext");
Q_SHORTCUT(a, "F3", "Search"); Q_SHORTCUT(a, "F3", "Search");
connect(a, SIGNAL(triggered()), this, SLOT(findNext())); connect(a, SIGNAL(triggered()), this, SLOT(findNext()));
addAction(a, "&Search", "Search"); addAction(a, "&Search", "Search");
a = new QAction(QIcon(":/replace.png"), tr("&Replace"), this); a = new QAction(QIcon(":/qeditor/replace.png"), tr("&Replace"), this);
a->setObjectName("replace"); a->setObjectName("replace");
Q_SHORTCUT(a, "Ctrl+R", "Search"); Q_SHORTCUT(a, "Ctrl+R", "Search");
connect(a, SIGNAL(triggered()), this, SLOT(replace())); connect(a, SIGNAL(triggered()), this, SLOT(replace()));
@ -639,7 +639,7 @@ void QEditor::init(bool actions) {
sep->setSeparator(true); sep->setSeparator(true);
addAction(sep, "&Search", "Search"); addAction(sep, "&Search", "Search");
a = new QAction(QIcon(":/goto.png"), tr("&Goto line..."), this); a = new QAction(QIcon(":/qeditor/goto.png"), tr("&Goto line..."), this);
a->setObjectName("goto"); a->setObjectName("goto");
Q_SHORTCUT(a, "Ctrl+G", "Search"); Q_SHORTCUT(a, "Ctrl+G", "Search");
connect(a, SIGNAL(triggered()), this, SLOT(gotoLine())); connect(a, SIGNAL(triggered()), this, SLOT(gotoLine()));

View File

@ -156,23 +156,12 @@ void QLineMarkPanel::mouseReleaseEvent(QMouseEvent *e) {
} }
// QMessageBox::warning(0, 0, "clik."); // QMessageBox::warning(0, 0, "clik.");
QDocumentLine l;
QLanguageDefinition *d = editor()->languageDefinition();
const int id =
QLineMarksInfoCenter::instance()->markTypeId(d->defaultLineMark());
if (id < 0)
return;
e->accept(); e->accept();
for (int i = 0; i < m_rects.count(); ++i) { for (int i = 0; i < m_rects.count(); ++i) {
if (m_rects.at(i).contains(e->pos())) { if (m_rects.at(i).contains(e->pos())) {
l = editor()->document()->line(m_lines.at(i)); auto l = editor()->document()->line(m_lines.at(i));
l.toggleMark(id); emit onToggleMark(i);
// m->toggleDefaultMark(l, -1);
break; break;
} }
} }

View File

@ -41,6 +41,9 @@ public:
virtual QString type() const; virtual QString type() const;
signals:
void onToggleMark(int lineIndex);
protected: protected:
virtual bool paint(QPainter *p, QEditor *e); virtual bool paint(QPainter *p, QEditor *e);
virtual void mousePressEvent(QMouseEvent *e); virtual void mousePressEvent(QMouseEvent *e);

View File

@ -45,6 +45,7 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
option(QWINDOWKIT_BUILD_STATIC "Build static libraries" TRUE) option(QWINDOWKIT_BUILD_STATIC "Build static libraries" TRUE)
option(QWINDOWKIT_INSTALL "Install library" OFF) option(QWINDOWKIT_INSTALL "Install library" OFF)
set(ADS_VERSION 4.3.1) set(ADS_VERSION 4.3.1)
option(BUILD_EXAMPLES "Build the examples" FALSE)
add_subdirectory(3rdparty/qwindowkit) add_subdirectory(3rdparty/qwindowkit)
add_subdirectory(3rdparty/QHexView) add_subdirectory(3rdparty/QHexView)
@ -287,8 +288,6 @@ set(CODEEDIT_WIDGET
src/qcodeeditwidget/qeditconfig.h src/qcodeeditwidget/qeditconfig.h
src/qcodeeditwidget/qeditconfig.cpp src/qcodeeditwidget/qeditconfig.cpp
src/qcodeeditwidget/qeditconfig.ui src/qcodeeditwidget/qeditconfig.ui
src/qcodeeditwidget/qstatuspanel.cpp
src/qcodeeditwidget/qstatuspanel.h
src/qcodeeditwidget/qformatconfig.h src/qcodeeditwidget/qformatconfig.h
src/qcodeeditwidget/qformatconfig.cpp src/qcodeeditwidget/qformatconfig.cpp
src/qcodeeditwidget/qformatconfig.ui) src/qcodeeditwidget/qformatconfig.ui)

View File

@ -1818,7 +1818,7 @@
<location filename="../../3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp" line="38"/> <location filename="../../3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp" line="38"/>
<location filename="../../3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp" line="57"/> <location filename="../../3rdparty/qcodeedit2/lib/qcodecompletionengine.cpp" line="57"/>
<source>&amp;Trigger completion</source> <source>&amp;Trigger completion</source>
<translation type="unfinished"></translation> <translation>&amp;T</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1941,25 +1941,30 @@ Restart from the begining ?</source>
<source>Preserve trailing indent</source> <source>Preserve trailing indent</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<location filename="../../src/qcodeeditwidget/qeditconfig.cpp" line="193"/>
<source>Edit</source>
<translation></translation>
</message>
</context> </context>
<context> <context>
<name>QEditor</name> <name>QEditor</name>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qcodeedit.cpp" line="240"/> <location filename="../../3rdparty/qcodeedit2/lib/qcodeedit.cpp" line="240"/>
<source>Panels</source> <source>Panels</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qcodeedit.cpp" line="243"/> <location filename="../../3rdparty/qcodeedit2/lib/qcodeedit.cpp" line="243"/>
<source>&amp;View</source> <source>&amp;View</source>
<translation type="unfinished"></translation> <translation>&amp;V</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="210"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="210"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="670"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="670"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1129"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1129"/>
<source>Default</source> <source>Default</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="515"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="515"/>
@ -1995,102 +2000,102 @@ Restart from the begining ?</source>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="570"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="570"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1109"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1109"/>
<source>&amp;Indent</source> <source>&amp;Indent</source>
<translation type="unfinished"></translation> <translation>&amp;I</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="577"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="577"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1110"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1110"/>
<source>&amp;Unindent</source> <source>&amp;Unindent</source>
<translation type="unfinished"></translation> <translation>&amp;U</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="588"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="588"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1111"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1111"/>
<source>Co&amp;mment</source> <source>Co&amp;mment</source>
<translation type="unfinished"></translation> <translation>&amp;M</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="595"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="595"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1112"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1112"/>
<source>Unc&amp;omment</source> <source>Unc&amp;omment</source>
<translation type="unfinished"></translation> <translation>&amp;O</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="606"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="606"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1114"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1114"/>
<source>&amp;Select all</source> <source>&amp;Select all</source>
<translation type="unfinished"></translation> <translation>&amp;S</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="617"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="617"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1116"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1116"/>
<source>&amp;Find</source> <source>&amp;Find</source>
<translation type="unfinished"></translation> <translation>&amp;F</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="624"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="624"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1117"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1117"/>
<source>Fin&amp;d next</source> <source>Fin&amp;d next</source>
<translation type="unfinished"></translation> <translation>&amp;D</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="631"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="631"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1118"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1118"/>
<source>&amp;Replace</source> <source>&amp;Replace</source>
<translation type="unfinished"></translation> <translation>&amp;R</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="642"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="642"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1120"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1120"/>
<source>&amp;Goto line...</source> <source>&amp;Goto line...</source>
<translation type="unfinished"></translation> <translation>&amp;G</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="653"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="653"/>
<source>Dynamic line wrapping</source> <source>Dynamic line wrapping</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="663"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="663"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1126"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1126"/>
<source>Input binding</source> <source>Input binding</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="688"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="688"/>
<source>Line endings</source> <source>Line endings</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="695"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="695"/>
<source>Conservative</source> <source>Conservative</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="697"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="697"/>
<source>Local</source> <source>Local</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="698"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="698"/>
<source>Unix/Linux</source> <source>Unix/Linux</source>
<translation type="unfinished">Unix/Linux</translation> <translation>Unix/Linux</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="699"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="699"/>
<source>Dos/Windows</source> <source>Dos/Windows</source>
<translation type="unfinished"></translation> <translation>Dos/Windows</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="700"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="700"/>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1295"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1295"/>
<source>Old Mac</source> <source>Old Mac</source>
<translation type="unfinished"> Mac</translation> <translation> Mac</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="839"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="839"/>
<source>Conflict!</source> <source>Conflict!</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="840"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="840"/>
@ -2100,12 +2105,16 @@ Press &quot;Save&quot; to overwrite the file on disk
Press &quot;Reset&quot;to be reload the file from disk. Press &quot;Reset&quot;to be reload the file from disk.
Press &quot;Discard&quot; to ignore this warning. Press &quot;Discard&quot; to ignore this warning.
</source> </source>
<translation type="unfinished"></translation> <translation>%1
</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="977"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="977"/>
<source>File changed</source> <source>File changed</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="978"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="978"/>
@ -2114,37 +2123,41 @@ has been modified by another application.
Undo/Redo stack would be discarded by the auto-reload. Undo/Redo stack would be discarded by the auto-reload.
Do you wish to keep up to date by reloading the file?</source> Do you wish to keep up to date by reloading the file?</source>
<translation type="unfinished"></translation> <translation>%1
/
</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1132"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1132"/>
<source>&amp;Edit</source> <source>&amp;Edit</source>
<translation type="unfinished"></translation> <translation>&amp;E</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1133"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1133"/>
<source>&amp;Search</source> <source>&amp;Search</source>
<translation type="unfinished"></translation> <translation>&amp;S</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1135"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1135"/>
<source>Edit</source> <source>Edit</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1136"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1136"/>
<source>Search</source> <source>Search</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1293"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1293"/>
<source>Windows</source> <source>Windows</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1297"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="1297"/>
<source>Unix</source> <source>Unix</source>
<translation type="unfinished"></translation> <translation>Unix</translation>
</message> </message>
<message> <message>
<location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="3262"/> <location filename="../../3rdparty/qcodeedit2/lib/qeditor.cpp" line="3262"/>
@ -2180,59 +2193,64 @@ Do you wish to keep up to date by reloading the file?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="266"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="104"/>
<source>Format</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="268"/>
<source>Bold</source> <source>Bold</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="272"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="274"/>
<source>Italic</source> <source>Italic</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="278"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="280"/>
<source>Underline</source> <source>Underline</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="284"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="286"/>
<source>Overline</source> <source>Overline</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="290"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="292"/>
<source>Strikeout</source> <source>Strikeout</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="297"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="299"/>
<source>Wave underline</source> <source>Wave underline</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="303"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="305"/>
<source>Text color (aka foreground)</source> <source>Text color (aka foreground)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="308"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="310"/>
<source>Background color</source> <source>Background color</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="314"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="316"/>
<source>Lines color (used by all lines formatting : underline, overline, ...)</source> <source>Lines color (used by all lines formatting : underline, overline, ...)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="426"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="428"/>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="446"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="448"/>
<source>Unsaved changes</source> <source>Unsaved changes</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="427"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="429"/>
<location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="447"/> <location filename="../../src/qcodeeditwidget/qformatconfig.cpp" line="449"/>
<source>There are unsaved changes in this format scheme. <source>There are unsaved changes in this format scheme.
Do you want them to be saved?</source> Do you want them to be saved?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -2452,29 +2470,6 @@ Do you want them to be saved?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>QStatusPanel</name>
<message>
<location filename="../../src/qcodeeditwidget/qstatuspanel.cpp" line="100"/>
<source>Line : %1 Visual column : %2 Text column : %3</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/qcodeeditwidget/qstatuspanel.cpp" line="124"/>
<source>OVERWRITE</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/qcodeeditwidget/qstatuspanel.cpp" line="124"/>
<source>INSERT</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/qcodeeditwidget/qstatuspanel.cpp" line="131"/>
<source>Conflict</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>RecentFileManager</name> <name>RecentFileManager</name>
<message> <message>
@ -4298,353 +4293,354 @@ Do you want them to be saved?</source>
<context> <context>
<name>ScriptingDialog</name> <name>ScriptingDialog</name>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="89"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="91"/>
<source>ScriptEditor</source> <source>ScriptEditor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="170"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="199"/>
<source>File</source> <source>File</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="171"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="200"/>
<source>Edit</source> <source>Edit</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="173"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="202"/>
<source>Debugger</source> <source>Debugger</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="174"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="206"/>
<source>Setting</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="175"/>
<source>About</source> <source>About</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="188"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="219"/>
<source>Basic</source> <source>Basic</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="189"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="220"/>
<source>New</source> <source>New</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="192"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="223"/>
<source>OpenF</source> <source>OpenF</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="195"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="226"/>
<source>RecentFiles</source> <source>RecentFiles</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="199"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="230"/>
<source>Reload</source> <source>Reload</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="204"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="235"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="206"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="237"/>
<source>Save</source> <source>Save</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="211"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="242"/>
<source>SaveAs</source> <source>SaveAs</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="223"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="254"/>
<source>General</source> <source>General</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="225"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="256"/>
<source>Undo</source> <source>Undo</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="230"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="261"/>
<source>Redo</source> <source>Redo</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="236"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="267"/>
<source>Cut</source> <source>Cut</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="240"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="271"/>
<source>Copy</source> <source>Copy</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="245"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="276"/>
<source>Paste</source> <source>Paste</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="249"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="280"/>
<source>Delete</source> <source>Delete</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="255"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="286"/>
<source>Lookup</source> <source>Lookup</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="256"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="287"/>
<source>Find</source> <source>Find</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="260"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="291"/>
<source>Replace</source> <source>Replace</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="265"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="296"/>
<source>Goto</source> <source>Goto</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="277"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="308"/>
<source>Display</source> <source>Display</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="304"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="335"/>
<source>Scale</source> <source>Scale</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="306"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="337"/>
<source>ResetScale</source> <source>ResetScale</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="312"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="343"/>
<source>Window</source> <source>Window</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="315"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="346"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="380"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="426"/>
<source>Editor</source> <source>Editor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="319"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="350"/>
<source>Tools</source> <source>Tools</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="363"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="409"/>
<source>BreakPoint</source> <source>BreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="365"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="411"/>
<source>ToggleBreakPoint</source> <source>ToggleBreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="368"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="414"/>
<source>AddBreakPoint</source> <source>AddBreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="378"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="424"/>
<source>Settings</source> <source>Settings</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="414"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="460"/>
<source>Local</source> <source>Local</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="420"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="466"/>
<source>Global</source> <source>Global</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="423"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="469"/>
<source>Variables</source> <source>Variables</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="436"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="482"/>
<source>BreakPoints</source> <source>BreakPoints</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="448"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="494"/>
<source>ConsoleOutput</source> <source>ConsoleOutput</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="462"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="508"/>
<source>StackTrace</source> <source>StackTrace</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="476"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="522"/>
<source>Watch</source> <source>Watch</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="560"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="606"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="743"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="812"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="787"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="920"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="823"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="956"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="838"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="971"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="863"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="996"/>
<source>Error</source> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="561"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="607"/>
<source>Too much opened files</source> <source>Too much opened files</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="766"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="899"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="802"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="935"/>
<source>ChooseFile</source> <source>ChooseFile</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="743"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="812"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="787"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="920"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="838"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="971"/>
<source>FilePermission</source> <source>FilePermission</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="821"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="954"/>
<source>ReloadSuccessfully</source> <source>ReloadSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="823"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="956"/>
<source>ReloadUnSuccessfully</source> <source>ReloadUnSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="850"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="983"/>
<source>ChooseSaveFile</source> <source>ChooseSaveFile</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="836"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="969"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="861"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="994"/>
<source>SaveSuccessfully</source> <source>SaveSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="863"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="996"/>
<source>SaveUnSuccessfully</source> <source>SaveUnSuccessfully</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1057"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="1098"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1113"/>
<source>CannotSave2RunScript</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1233"/>
<source>ScriptStillRunning</source> <source>ScriptStillRunning</source>
<translation>退</translation> <translation>退</translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="172"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="201"/>
<source>View</source> <source>View</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="328"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="359"/>
<source>Debug</source> <source>Debug</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="330"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="362"/>
<source>Run</source> <source>Run</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="334"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="367"/>
<source>RunWithDbg</source> <source>RunWithDbg</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="337"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="373"/>
<source>Pause</source> <source>Pause</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="340"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="378"/>
<source>Continue</source> <source>Continue</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="343"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="383"/>
<source>Stop</source> <source>Stop</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="346"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="387"/>
<source>Restart</source> <source>Restart</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="349"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="392"/>
<source>StepInto</source> <source>StepInto</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="352"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="397"/>
<source>StepOver</source> <source>StepOver</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="355"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="401"/>
<source>StepOut</source> <source>StepOut</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="371"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="417"/>
<source>RemoveBreakPoint</source> <source>RemoveBreakPoint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="387"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="433"/>
<source>Info</source> <source>Info</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="389"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="435"/>
<source>Software</source> <source>Software</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="392"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="438"/>
<source>Sponsor</source> <source>Sponsor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="395"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="441"/>
<source>Wiki</source> <source>Wiki</source>
<translation> Wiki</translation> <translation> Wiki</translation>
</message> </message>
<message> <message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="398"/> <location filename="../../src/dialog/scriptingdialog.cpp" line="444"/>
<source>AboutQT</source> <source>AboutQT</source>
<translation> QT</translation> <translation> QT</translation>
</message> </message>
@ -4924,29 +4920,29 @@ Do you want them to be saved?</source>
<message> <message>
<location filename="../../src/class/asbuilder.cpp" line="139"/> <location filename="../../src/class/asbuilder.cpp" line="139"/>
<source>Failed to open script file </source> <source>Failed to open script file </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/class/asbuilder.cpp" line="405"/> <location filename="../../src/class/asbuilder.cpp" line="405"/>
<location filename="../../src/class/asbuilder.cpp" line="455"/> <location filename="../../src/class/asbuilder.cpp" line="455"/>
<source>Invalid file name for #include; it contains a line-break: </source> <source>Invalid file name for #include; it contains a line-break: </source>
<translation type="unfinished"></translation> <translation>#include </translation>
</message> </message>
<message> <message>
<location filename="../../src/class/asbuilder.cpp" line="472"/> <location filename="../../src/class/asbuilder.cpp" line="472"/>
<source>Invalid file name for #include; it contains a line-break or unpaired symbol</source> <source>Invalid file name for #include; it contains a line-break or unpaired symbol</source>
<translation type="unfinished"></translation> <translation>#include </translation>
</message> </message>
<message> <message>
<location filename="../../src/class/asbuilder.cpp" line="499"/> <location filename="../../src/class/asbuilder.cpp" line="499"/>
<source>Invalid #pragma directive</source> <source>Invalid #pragma directive</source>
<translation type="unfinished"></translation> <translation>#pragma </translation>
</message> </message>
</context> </context>
<context> <context>
<name>asDebugger</name> <name>asDebugger</name>
<message> <message>
<location filename="../../src/class/asdebugger.cpp" line="397"/> <location filename="../../src/class/asdebugger.cpp" line="413"/>
<source>{no engine}</source> <source>{no engine}</source>
<translation>{}</translation> <translation>{}</translation>
</message> </message>

View File

@ -110,4 +110,15 @@
<file alias="as_light.qxf">src/qxs/as_light.qxf</file> <file alias="as_light.qxf">src/qxs/as_light.qxf</file>
<file alias="marks.qxm">src/qxs/marks.qxm</file> <file alias="marks.qxm">src/qxs/marks.qxm</file>
</qresource> </qresource>
<qresource prefix="/qeditor">
<file alias="copy.png">images/copy.png</file>
<file alias="cut.png">images/cut.png</file>
<file alias="find.png">images/find.png</file>
<file alias="paste.png">images/paste.png</file>
<file alias="redo.png">images/redo.png</file>
<file alias="replace.png">images/replace.png</file>
<file alias="undo.png">images/undo.png</file>
<file alias="goto.png">images/goto.png</file>
</qresource>
</RCC> </RCC>

View File

@ -21,10 +21,6 @@ void asDebugger::registerToStringCallback(const asITypeInfo *ti,
m_toStringCallbacks.insert(ti, callback); m_toStringCallbacks.insert(ti, callback);
} }
void asDebugger::registerBreakPointHitCallback(BreakPointHitCallback callback) {
m_bphitCallback = callback;
}
void asDebugger::takeCommands(asIScriptContext *ctx) { void asDebugger::takeCommands(asIScriptContext *ctx) {
emit onPullVariables(globalVariables(ctx), localVariables(ctx)); emit onPullVariables(globalVariables(ctx), localVariables(ctx));
emit onPullCallStack(retriveCallstack(ctx)); emit onPullCallStack(retriveCallstack(ctx));
@ -38,11 +34,14 @@ void asDebugger::takeCommands(asIScriptContext *ctx) {
ctx->Abort(); ctx->Abort();
return; return;
case PAUSE: case PAUSE:
Q_ASSERT(false);
break; break;
case STEP_OVER: case STEP_OVER:
case STEP_OUT:
m_lastCommandAtStackLevel = ctx ? ctx->GetCallstackSize() : 1; m_lastCommandAtStackLevel = ctx ? ctx->GetCallstackSize() : 1;
break; break;
case STEP_OUT:
m_lastCommandAtStackLevel = ctx ? ctx->GetCallstackSize() : 0;
break;
case CONTINUE: case CONTINUE:
case STEP_INTO: case STEP_INTO:
break; break;
@ -56,6 +55,25 @@ void asDebugger::lineCallback(asIScriptContext *ctx) {
if (ctx == nullptr) if (ctx == nullptr)
return; return;
const char *file = 0;
int lineNbr = ctx->GetLineNumber(0, nullptr, &file);
// why?
// LineCallBack will be called each only a sentence,
// just like a bytecode level debugger
// for(auto i = 0; i < 5 ; i++) this line will break twice at first
if (ctx->GetUserData() == nullptr) {
auto dbgContext = new ContextDbgInfo;
ctx->SetUserData(dbgContext);
} else {
auto dbgContext =
reinterpret_cast<ContextDbgInfo *>(ctx->GetUserData());
if (dbgContext->line == lineNbr && dbgContext->file == file &&
dbgContext->stackCount == ctx->GetCallstackSize()) {
return;
}
}
// By default we ignore callbacks when the context is not active. // By default we ignore callbacks when the context is not active.
// An application might override this to for example disconnect the // An application might override this to for example disconnect the
// debugger as the execution finished. // debugger as the execution finished.
@ -64,18 +82,14 @@ void asDebugger::lineCallback(asIScriptContext *ctx) {
switch (m_action) { switch (m_action) {
case ABORT: case ABORT:
ctx->Abort();
return; return;
case PAUSE: case PAUSE:
break; return;
case CONTINUE: case CONTINUE:
if (!checkBreakPoint(ctx)) if (!checkBreakPoint(ctx))
return; return;
break; break;
case STEP_INTO: case STEP_INTO:
// Always break, but we call the check break point anyway
// to tell user when break point has been reached
checkBreakPoint(ctx);
m_action = PAUSE; m_action = PAUSE;
break; break;
case STEP_OVER: case STEP_OVER:
@ -89,8 +103,12 @@ void asDebugger::lineCallback(asIScriptContext *ctx) {
break; break;
} }
const char *file = 0; auto dbgContext = reinterpret_cast<ContextDbgInfo *>(ctx->GetUserData());
int lineNbr = ctx->GetLineNumber(0, nullptr, &file); Q_ASSERT(dbgContext);
dbgContext->file = file;
dbgContext->line = lineNbr;
dbgContext->stackCount = ctx->GetCallstackSize();
emit onRunCurrentLine(file, lineNbr); emit onRunCurrentLine(file, lineNbr);
takeCommands(ctx); takeCommands(ctx);
@ -213,7 +231,7 @@ void asDebugger::listMemberProperties(asIScriptContext *ctx) {
} }
bool asDebugger::checkBreakPoint(asIScriptContext *ctx) { bool asDebugger::checkBreakPoint(asIScriptContext *ctx) {
if (ctx == 0) if (ctx == nullptr)
return false; return false;
const char *tmp = 0; const char *tmp = 0;
@ -272,8 +290,6 @@ bool asDebugger::checkBreakPoint(asIScriptContext *ctx) {
#else #else
bpName == file) { bpName == file) {
#endif #endif
ctx->Suspend();
m_bphitCallback(m_breakPoints[n], this);
m_action = PAUSE; // hit and pause script m_action = PAUSE; // hit and pause script
return true; return true;
} }
@ -414,6 +430,8 @@ asDebugger::GCStatistic asDebugger::gcStatistics() {
void asDebugger::runDebugAction(DebugAction action) { m_action = action; } void asDebugger::runDebugAction(DebugAction action) { m_action = action; }
asDebugger::DebugAction asDebugger::currentState() const { return m_action; }
void asDebugger::setEngine(asIScriptEngine *engine) { void asDebugger::setEngine(asIScriptEngine *engine) {
if (m_engine != engine) { if (m_engine != engine) {
if (m_engine) if (m_engine)

View File

@ -78,10 +78,6 @@ public:
void registerToStringCallback(const asITypeInfo *ti, void registerToStringCallback(const asITypeInfo *ti,
ToStringCallback callback); ToStringCallback callback);
typedef void (*BreakPointHitCallback)(const BreakPoint &bp,
asDebugger *dbg);
void registerBreakPointHitCallback(BreakPointHitCallback callback);
// Commands // Commands
void addFileBreakPoint(const QString &file, int lineNbr); void addFileBreakPoint(const QString &file, int lineNbr);
void removeFileBreakPoint(const QString &file, int lineNbr); void removeFileBreakPoint(const QString &file, int lineNbr);
@ -108,6 +104,8 @@ public:
void runDebugAction(DebugAction action); void runDebugAction(DebugAction action);
DebugAction currentState() const;
private: private:
QVector<VariablesInfo> globalVariables(asIScriptContext *ctx); QVector<VariablesInfo> globalVariables(asIScriptContext *ctx);
QVector<VariablesInfo> localVariables(asIScriptContext *ctx); QVector<VariablesInfo> localVariables(asIScriptContext *ctx);
@ -131,6 +129,13 @@ signals:
void onPullCallStack(const QList<CallStackItem> &callstacks); void onPullCallStack(const QList<CallStackItem> &callstacks);
void onRunCurrentLine(const QString &file, int lineNr); void onRunCurrentLine(const QString &file, int lineNr);
private:
struct ContextDbgInfo {
QString file;
int line = -1;
int stackCount = -1;
};
private: private:
std::atomic<DebugAction> m_action; std::atomic<DebugAction> m_action;
@ -143,7 +148,6 @@ private:
// Registered callbacks for converting types to strings // Registered callbacks for converting types to strings
QMap<const asITypeInfo *, ToStringCallback> m_toStringCallbacks; QMap<const asITypeInfo *, ToStringCallback> m_toStringCallbacks;
BreakPointHitCallback m_bphitCallback;
QStringList m_watchVars; QStringList m_watchVars;

View File

@ -31,12 +31,16 @@ ScriptEditor::ScriptEditor(QWidget *parent)
auto lineMark = new QLineMarkPanel(editor); auto lineMark = new QLineMarkPanel(editor);
m_editor->addPanel(lineMark, QCodeEdit::West, true); m_editor->addPanel(lineMark, QCodeEdit::West, true);
connect(lineMark, &QLineMarkPanel::onToggleMark, this,
&ScriptEditor::onToggleMark);
auto lineNum = new QLineNumberPanel(editor); auto lineNum = new QLineNumberPanel(editor);
lineNum->setVerboseMode(true); lineNum->setVerboseMode(true);
m_editor->addPanel(lineNum, QCodeEdit::West, true); m_editor->addPanel(lineNum, QCodeEdit::West, true);
m_editor->addPanel(QStringLiteral("Fold Panel"), QCodeEdit::West, true); m_editor->addPanel(QStringLiteral("Fold Panel"), QCodeEdit::West, true);
m_editor->addPanel(QStringLiteral("Line Change Panel"), QCodeEdit::West,
true);
m_editor->addPanel(QStringLiteral("Goto Line Panel"), QCodeEdit::South, m_editor->addPanel(QStringLiteral("Goto Line Panel"), QCodeEdit::South,
true); true);
m_editor->addPanel(QStringLiteral("Search Replace Panel"), QCodeEdit::South, m_editor->addPanel(QStringLiteral("Search Replace Panel"), QCodeEdit::South,

View File

@ -15,6 +15,9 @@ public:
QEditor *editor() const; QEditor *editor() const;
signals:
void onToggleMark(int lineIndex);
public slots: public slots:
bool openFile(const QString &filename); bool openFile(const QString &filename);

View File

@ -57,6 +57,8 @@ ScriptingDialog::ScriptingDialog(QWidget *parent)
layout->addWidget(m_status); layout->addWidget(m_status);
buildUpContent(cw); buildUpContent(cw);
buildUpSettingDialog();
QFormatScheme *format = nullptr; QFormatScheme *format = nullptr;
switch (SkinManager::instance().currentTheme()) { switch (SkinManager::instance().currentTheme()) {
@ -98,7 +100,9 @@ void ScriptingDialog::initConsole() {
m_consoleout->init(); m_consoleout->init();
auto machine = m_consoleout->machine(); auto machine = m_consoleout->machine();
connect(machine, &ScriptMachine::onDebugFinished, this, [=] { connect(machine, &ScriptMachine::onDebugFinished, this, [=] {
this->setRunDebugMode(false); _DebugingScript.clear();
this->updateRunDebugMode();
m_callstack->updateData({}); m_callstack->updateData({});
// clean up // clean up
@ -106,23 +110,28 @@ void ScriptingDialog::initConsole() {
// no need // no need
return; return;
} }
QLineMark mrk(_lastCurLine.first, _lastCurLine.second,
m_symID.value(Symbols::DbgRunCurrentLine)); auto bpMark = m_symID.value(Symbols::BreakPoint);
QLineMarksInfoCenter::instance()->removeLineMark(mrk); auto curMark = m_symID.value(Symbols::DbgRunCurrentLine);
auto curHitMark = m_symID.value(Symbols::DbgRunHitBreakPoint);
// remove the last mark
if (!_lastCurLine.first.isEmpty() && _lastCurLine.second >= 0) {
auto lastCur = QCodeEdit::managed(_lastCurLine.first);
auto doc = lastCur->document();
auto line = doc->line(_lastCurLine.second - 1);
if (line.hasMark(curMark)) {
line.removeMark(curMark);
} else if (line.hasMark(curHitMark)) {
line.removeMark(curHitMark);
line.addMark(bpMark);
}
}
_lastCurLine.first.clear(); _lastCurLine.first.clear();
_lastCurLine.second = -1; _lastCurLine.second = -1;
}); });
auto dbg = machine->debugger(); auto dbg = machine->debugger();
Q_ASSERT(dbg); Q_ASSERT(dbg);
dbg->setProperty("scriptdlg", QVariant::fromValue(this));
dbg->registerBreakPointHitCallback(
[](const asDebugger::BreakPoint &bp, asDebugger *dbg) {
auto p = dbg->property("scriptdlg");
if (p.isValid()) {
auto dlg = p.value<ScriptingDialog *>();
QMessageBox::information(dlg, "", "Hint");
}
});
connect(dbg, &asDebugger::onAdjustBreakPointLine, this, connect(dbg, &asDebugger::onAdjustBreakPointLine, this,
[=](const asDebugger::BreakPoint &old, int newLineNr) { [=](const asDebugger::BreakPoint &old, int newLineNr) {
@ -152,16 +161,36 @@ void ScriptingDialog::initConsole() {
} }
} }
// remove the last mark auto bpMark = m_symID.value(Symbols::BreakPoint);
QLineMark mrk(_lastCurLine.first, _lastCurLine.second,
m_symID.value(Symbols::DbgRunCurrentLine));
QLineMarksInfoCenter::instance()->removeLineMark(mrk);
auto doc = e->editor()->document();
auto curMark = m_symID.value(Symbols::DbgRunCurrentLine); auto curMark = m_symID.value(Symbols::DbgRunCurrentLine);
auto curHitMark = m_symID.value(Symbols::DbgRunHitBreakPoint);
// remove the last mark
if (!_lastCurLine.first.isEmpty() && _lastCurLine.second >= 0) {
auto lastCur = QCodeEdit::managed(_lastCurLine.first);
auto doc = lastCur->document();
auto line = doc->line(_lastCurLine.second - 1);
if (line.hasMark(curMark)) {
line.removeMark(curMark);
} else if (line.hasMark(curHitMark)) {
line.removeMark(curHitMark);
line.addMark(bpMark);
}
}
// add the new mark
auto doc = e->editor()->document();
auto line = doc->line(lineNr - 1); auto line = doc->line(lineNr - 1);
line.addMark(curMark); if (line.hasMark(bpMark)) {
line.removeMark(bpMark);
line.addMark(curHitMark);
} else {
line.addMark(curMark);
}
_lastCurLine = {file, lineNr}; _lastCurLine = {file, lineNr};
updateRunDebugMode();
}); });
} }
@ -171,7 +200,9 @@ void ScriptingDialog::buildUpRibbonBar() {
m_editStateWidgets << buildEditPage(m_ribbon->addTab(tr("Edit"))); m_editStateWidgets << buildEditPage(m_ribbon->addTab(tr("Edit")));
buildViewPage(m_ribbon->addTab(tr("View"))); buildViewPage(m_ribbon->addTab(tr("View")));
m_editStateWidgets << buildDebugPage(m_ribbon->addTab(tr("Debugger"))); m_editStateWidgets << buildDebugPage(m_ribbon->addTab(tr("Debugger")));
buildSettingPage(m_ribbon->addTab(tr("Setting")));
// TODO: not available for v1.0.0
// buildSettingPage(m_ribbon->addTab(tr("Setting")));
buildAboutPage(m_ribbon->addTab(tr("About"))); buildAboutPage(m_ribbon->addTab(tr("About")));
connect(m_ribbon, &Ribbon::onDragDropFiles, this, connect(m_ribbon, &Ribbon::onDragDropFiles, this,
@ -326,35 +357,50 @@ RibbonTabContent *ScriptingDialog::buildViewPage(RibbonTabContent *tab) {
RibbonTabContent *ScriptingDialog::buildDebugPage(RibbonTabContent *tab) { RibbonTabContent *ScriptingDialog::buildDebugPage(RibbonTabContent *tab) {
{ {
auto pannel = tab->addGroup(tr("Debug")); auto pannel = tab->addGroup(tr("Debug"));
m_Tbtneditors[ToolButtonIndex::DBG_RUN] = m_Tbtneditors.insert(
ToolButtonIndex::DBG_RUN_ACTION,
addPannelAction(pannel, QStringLiteral("dbgrun"), tr("Run"), addPannelAction(pannel, QStringLiteral("dbgrun"), tr("Run"),
&ScriptingDialog::on_runscript, &ScriptingDialog::on_runscript,
QKeySequence(Qt::CTRL | Qt::Key_F5)); QKeySequence(Qt::CTRL | Qt::Key_F5)));
m_Tbtneditors[ToolButtonIndex::DBG_RUN_DBG] = addPannelAction( m_Tbtneditors.insert(ToolButtonIndex::DBG_RUN_DBG_ACTION,
pannel, QStringLiteral("dbgdebug"), tr("RunWithDbg"), addPannelAction(pannel, QStringLiteral("dbgdebug"),
&ScriptingDialog::on_rundbgscript, QKeySequence(Qt::Key_F5)); tr("RunWithDbg"),
m_dbgStateWidgets << addPannelAction(pannel, QStringLiteral("dbgpause"), &ScriptingDialog::on_rundbgscript,
QKeySequence(Qt::Key_F5)));
m_Tbtneditors.insert(ToolButtonIndex::DBG_PAUSE_ACTION,
addPannelAction(pannel, QStringLiteral("dbgpause"),
tr("Pause"), tr("Pause"),
&ScriptingDialog::on_pausescript); &ScriptingDialog::on_pausescript));
m_dbgStateWidgets << addPannelAction( m_Tbtneditors.insert(
pannel, QStringLiteral("dbgcontinue"), tr("Continue"), ToolButtonIndex::DBG_CONTINUE_ACTION,
&ScriptingDialog::on_continuescript); addPannelAction(pannel, QStringLiteral("dbgcontinue"),
m_dbgStateWidgets << addPannelAction(pannel, QStringLiteral("dbgstop"), tr("Continue"),
&ScriptingDialog::on_continuescript));
m_Tbtneditors.insert(ToolButtonIndex::DBG_STOP_ACTION,
addPannelAction(pannel, QStringLiteral("dbgstop"),
tr("Stop"), tr("Stop"),
&ScriptingDialog::on_stopscript); &ScriptingDialog::on_stopscript));
m_dbgStateWidgets << addPannelAction( m_Tbtneditors.insert(
pannel, QStringLiteral("dbgrestart"), tr("Restart"), ToolButtonIndex::DBG_RESTART_ACTION,
&ScriptingDialog::on_restartscript); addPannelAction(pannel, QStringLiteral("dbgrestart"), tr("Restart"),
m_dbgStateWidgets << addPannelAction( &ScriptingDialog::on_restartscript));
pannel, QStringLiteral("dbgstepinto"), tr("StepInto"), m_Tbtneditors.insert(
&ScriptingDialog::on_stepinscript, QKeySequence(Qt::Key_F11)); ToolButtonIndex::DBG_STEPINTO_ACTION,
m_dbgStateWidgets << addPannelAction( addPannelAction(pannel, QStringLiteral("dbgstepinto"),
pannel, QStringLiteral("dbgstepover"), tr("StepOver"), tr("StepInto"), &ScriptingDialog::on_stepinscript,
&ScriptingDialog::on_stepoverscript, QKeySequence(Qt::Key_F10)); QKeySequence(Qt::Key_F11)));
m_dbgStateWidgets << addPannelAction( m_Tbtneditors.insert(
pannel, QStringLiteral("dbgstepout"), tr("StepOut"), ToolButtonIndex::DBG_STEPOVER_ACTION,
&ScriptingDialog::on_stepoutscript, addPannelAction(pannel, QStringLiteral("dbgstepover"),
QKeySequence(Qt::SHIFT | Qt::Key_F11)); tr("StepOver"), &ScriptingDialog::on_stepoverscript,
QKeySequence(Qt::Key_F10)));
m_Tbtneditors.insert(
ToolButtonIndex::DBG_STEPOUT_ACTION,
addPannelAction(pannel, QStringLiteral("dbgstepout"), tr("StepOut"),
&ScriptingDialog::on_stepoutscript,
QKeySequence(Qt::SHIFT | Qt::Key_F11)));
m_editStateWidgets << pannel; m_editStateWidgets << pannel;
} }
@ -590,7 +636,7 @@ void ScriptingDialog::registerEditorView(ScriptEditor *editor) {
auto m = m_consoleout->machine(); auto m = m_consoleout->machine();
if (m->isInDebugMode()) { if (m->isInDebugMode()) {
auto dbg = m->debugger(); // TODO
} }
m_views.removeOne(editor); m_views.removeOne(editor);
@ -637,12 +683,7 @@ void ScriptingDialog::updateEditModeEnabled() {
item->setEnabled(b); item->setEnabled(b);
} }
auto runner = m_consoleout->machine(); updateRunDebugMode();
if (runner) {
setRunDebugMode(runner->isRunning(), runner->isInDebugMode());
} else {
setRunDebugMode(false);
}
} }
ScriptEditor *ScriptingDialog::currentEditor() const { return m_curEditor; } ScriptEditor *ScriptingDialog::currentEditor() const { return m_curEditor; }
@ -653,6 +694,7 @@ void ScriptingDialog::swapEditor(ScriptEditor *old, ScriptEditor *cur) {
} }
if (old != nullptr) { if (old != nullptr) {
old->disconnect(SLOT(onToggleMark(int)));
auto editor = old->editor(); auto editor = old->editor();
editor->disconnect(SLOT(copyAvailable(bool))); editor->disconnect(SLOT(copyAvailable(bool)));
editor->disconnect(SLOT(contentModified(bool))); editor->disconnect(SLOT(contentModified(bool)));
@ -672,6 +714,11 @@ void ScriptingDialog::swapEditor(ScriptEditor *old, ScriptEditor *cur) {
m_Tbtneditors.value(ToolButtonIndex::COPY_ACTION) m_Tbtneditors.value(ToolButtonIndex::COPY_ACTION)
->setEnabled(editor->cursor().hasSelection()); ->setEnabled(editor->cursor().hasSelection());
connect(cur, &ScriptEditor::onToggleMark, this, [=](int lineIndex) {
auto editor = qobject_cast<ScriptEditor *>(sender());
Q_ASSERT(editor);
toggleBreakPoint(editor, lineIndex);
});
connect(editor, &QEditor::copyAvailable, connect(editor, &QEditor::copyAvailable,
m_Tbtneditors.value(ToolButtonIndex::COPY_ACTION), m_Tbtneditors.value(ToolButtonIndex::COPY_ACTION),
&QToolButton::setEnabled); &QToolButton::setEnabled);
@ -695,12 +742,34 @@ void ScriptingDialog::swapEditor(ScriptEditor *old, ScriptEditor *cur) {
m_curEditor = cur; m_curEditor = cur;
} }
void ScriptingDialog::setRunDebugMode(bool isRun, bool isDebug) { void ScriptingDialog::updateRunDebugMode() {
m_Tbtneditors.value(ToolButtonIndex::DBG_RUN)->setEnabled(!isRun); auto runner = m_consoleout->machine();
m_Tbtneditors.value(ToolButtonIndex::DBG_RUN_DBG)->setEnabled(!isRun); bool isRun = false;
for (auto &w : m_dbgStateWidgets) { bool isDbg = false;
w->setEnabled(isRun && isDebug); bool isPaused = false;
if (runner) {
isRun = runner->isRunning();
isDbg = runner->isInDebugMode();
auto dbg = runner->debugger();
isPaused = dbg->currentState() == asDebugger::PAUSE;
} }
m_Tbtneditors.value(ToolButtonIndex::DBG_RUN_ACTION)->setEnabled(!isRun);
m_Tbtneditors.value(ToolButtonIndex::DBG_RUN_DBG_ACTION)
->setEnabled(!isRun);
m_Tbtneditors.value(ToolButtonIndex::DBG_RESTART_ACTION)
->setEnabled(isRun && isDbg);
m_Tbtneditors.value(ToolButtonIndex::DBG_STOP_ACTION)->setEnabled(isRun);
m_Tbtneditors.value(ToolButtonIndex::DBG_PAUSE_ACTION)
->setEnabled(isRun && isDbg && !isPaused);
auto dbgop = isRun && isDbg && isPaused;
m_Tbtneditors.value(ToolButtonIndex::DBG_CONTINUE_ACTION)
->setEnabled(dbgop);
m_Tbtneditors.value(ToolButtonIndex::DBG_STEPINTO_ACTION)
->setEnabled(dbgop);
m_Tbtneditors.value(ToolButtonIndex::DBG_STEPOVER_ACTION)
->setEnabled(dbgop);
m_Tbtneditors.value(ToolButtonIndex::DBG_STEPOUT_ACTION)->setEnabled(dbgop);
} }
ScriptEditor *ScriptingDialog::findEditorView(const QString &filename) { ScriptEditor *ScriptingDialog::findEditorView(const QString &filename) {
@ -758,6 +827,70 @@ void ScriptingDialog::runDbgCommand(asDebugger::DebugAction action) {
} }
} }
void ScriptingDialog::buildUpSettingDialog() {
m_setdialog = new SettingDialog(this);
auto edit = new QEditConfig(m_setdialog);
m_setdialog->addPage(edit);
m_setdialog->build();
}
void ScriptingDialog::startDebugScript(const QString &fileName) {
m_consoleout->clear();
// add breakpoints
auto marks = QLineMarksInfoCenter::instance()->marks(
fileName, m_symID.value(Symbols::BreakPoint));
auto dbg = m_consoleout->machine()->debugger();
for (auto &bp : marks) {
dbg->addFileBreakPoint(bp.file, bp.line);
}
m_consoleout->machine()->executeScript(fileName, true);
updateRunDebugMode();
}
void ScriptingDialog::toggleBreakPoint(ScriptEditor *editor, int lineIndex) {
Q_ASSERT(editor);
auto curLine = lineIndex + 1;
#ifdef Q_OS_WIN
if (m_consoleout->machine()->isInDebugMode() &&
editor->fileName().compare(_lastCurLine.first, Qt::CaseInsensitive) == 0
#else
if (editor->fileName() == _lastCurLine.first
#endif
&& _lastCurLine.second == curLine) {
auto line = editor->editor()->document()->line(lineIndex);
auto bpMark = m_symID.value(Symbols::BreakPoint);
auto hitCur = m_symID.value(Symbols::DbgRunHitBreakPoint);
auto curSym = m_symID.value(Symbols::DbgRunCurrentLine);
auto dbg = m_consoleout->machine()->debugger();
if (line.hasMark(hitCur)) {
line.removeMark(hitCur);
line.addMark(curSym);
dbg->removeFileBreakPoint(editor->fileName(), curLine);
} else if (line.hasMark(curSym)) {
line.removeMark(curSym);
line.addMark(hitCur);
dbg->addFileBreakPoint(editor->fileName(), curLine);
} else {
if (line.hasMark(bpMark)) {
line.removeMark(bpMark);
dbg->removeFileBreakPoint(editor->fileName(), curLine);
} else {
line.addMark(bpMark);
dbg->addFileBreakPoint(editor->fileName(), curLine);
}
}
} else {
QLineMark mrk(editor->fileName(), curLine,
m_symID.value(Symbols::BreakPoint));
QLineMarksInfoCenter::instance()->toggleLineMark(mrk);
}
}
void ScriptingDialog::on_newfile() { void ScriptingDialog::on_newfile() {
if (!newOpenFileSafeCheck()) { if (!newOpenFileSafeCheck()) {
return; return;
@ -927,11 +1060,7 @@ void ScriptingDialog::on_gotoline() {
} }
} }
void ScriptingDialog::on_setting() { void ScriptingDialog::on_setting() { m_setdialog->showConfig(); }
// TODO
QEditConfig cfg;
cfg.show();
}
void ScriptingDialog::on_about() { AboutSoftwareDialog().exec(); } void ScriptingDialog::on_about() { AboutSoftwareDialog().exec(); }
@ -964,12 +1093,14 @@ void ScriptingDialog::on_runscript() {
auto editor = currentEditor(); auto editor = currentEditor();
if (editor) { if (editor) {
auto e = editor->editor(); auto e = editor->editor();
m_consoleout->clear(); if (!e->save()) {
setRunDebugMode(true, false); WingMessageBox::critical(this, qAppName(),
if (!m_consoleout->machine()->executeScript(e->fileName())) { tr("CannotSave2RunScript"));
setRunDebugMode(false); return;
} }
setRunDebugMode(false); m_consoleout->clear();
m_consoleout->machine()->executeScript(e->fileName());
updateRunDebugMode();
} }
} }
@ -977,20 +1108,12 @@ void ScriptingDialog::on_rundbgscript() {
auto editor = currentEditor(); auto editor = currentEditor();
if (editor) { if (editor) {
auto e = editor->editor(); auto e = editor->editor();
m_consoleout->clear(); if (!e->save()) {
setRunDebugMode(true, true); WingMessageBox::critical(this, qAppName(),
tr("CannotSave2RunScript"));
// add breakpoints return;
auto marks = QLineMarksInfoCenter::instance()->marks(
e->fileName(), m_symID.value(Symbols::BreakPoint));
auto dbg = m_consoleout->machine()->debugger();
for (auto &bp : marks) {
dbg->addFileBreakPoint(bp.file, bp.line);
}
if (!m_consoleout->machine()->executeScript(e->fileName(), true)) {
setRunDebugMode(false);
} }
startDebugScript(e->fileName());
} }
} }
@ -1002,7 +1125,10 @@ void ScriptingDialog::on_continuescript() {
void ScriptingDialog::on_stopscript() { runDbgCommand(asDebugger::ABORT); } void ScriptingDialog::on_stopscript() { runDbgCommand(asDebugger::ABORT); }
void ScriptingDialog::on_restartscript() {} void ScriptingDialog::on_restartscript() {
on_stopscript();
startDebugScript(_DebugingScript);
}
void ScriptingDialog::on_stepinscript() { void ScriptingDialog::on_stepinscript() {
runDbgCommand(asDebugger::STEP_INTO); runDbgCommand(asDebugger::STEP_INTO);
@ -1019,21 +1145,44 @@ void ScriptingDialog::on_stepoverscript() {
void ScriptingDialog::on_togglebreakpoint() { void ScriptingDialog::on_togglebreakpoint() {
auto editor = currentEditor(); auto editor = currentEditor();
if (editor) { if (editor) {
QLineMark mrk(editor->fileName(), toggleBreakPoint(editor, editor->editor()->cursor().lineNumber());
editor->editor()->cursor().lineNumber() + 1,
m_symID.value(Symbols::BreakPoint));
QLineMarksInfoCenter::instance()->toggleLineMark(mrk);
} }
} }
void ScriptingDialog::on_addbreakpoint() { void ScriptingDialog::on_addbreakpoint() {
auto editor = currentEditor(); auto editor = currentEditor();
if (editor) { if (editor) {
auto line = editor->editor()->document()->line( auto curLineInd = editor->editor()->cursor().lineNumber();
editor->editor()->cursor().lineNumber()); auto bpMark = m_symID.value(Symbols::BreakPoint);
auto id = m_symID.value(Symbols::BreakPoint);
if (!line.hasMark(id)) { #ifdef Q_OS_WIN
line.addMark(id); if (m_consoleout->machine()->isInDebugMode() &&
editor->fileName().compare(_lastCurLine.first,
Qt::CaseInsensitive) == 0
#else
if (editor->fileName() == _lastCurLine.first
#endif
&& _lastCurLine.second == curLineInd + 1) {
auto line = editor->editor()->document()->line(curLineInd);
auto hitCur = m_symID.value(Symbols::DbgRunHitBreakPoint);
auto curSym = m_symID.value(Symbols::DbgRunCurrentLine);
auto dbg = m_consoleout->machine()->debugger();
if (line.hasMark(curSym)) {
line.removeMark(curSym);
line.addMark(hitCur);
dbg->addFileBreakPoint(editor->fileName(), curLineInd + 1);
} else {
if (!line.hasMark(bpMark)) {
line.addMark(bpMark);
dbg->addFileBreakPoint(editor->fileName(), curLineInd + 1);
}
}
} else {
auto line = editor->editor()->document()->line(curLineInd);
if (!line.hasMark(bpMark)) {
line.addMark(bpMark);
}
} }
} }
} }
@ -1041,11 +1190,38 @@ void ScriptingDialog::on_addbreakpoint() {
void ScriptingDialog::on_removebreakpoint() { void ScriptingDialog::on_removebreakpoint() {
auto editor = currentEditor(); auto editor = currentEditor();
if (editor) { if (editor) {
auto line = editor->editor()->document()->line( auto curLineInd = editor->editor()->cursor().lineNumber();
editor->editor()->cursor().lineNumber()); auto bpMark = m_symID.value(Symbols::BreakPoint);
auto id = m_symID.value(Symbols::BreakPoint);
if (line.hasMark(id)) { #ifdef Q_OS_WIN
line.removeMark(id); if (m_consoleout->machine()->isInDebugMode() &&
editor->fileName().compare(_lastCurLine.first,
Qt::CaseInsensitive) == 0
#else
if (editor->fileName() == _lastCurLine.first
#endif
&& _lastCurLine.second == curLineInd + 1) {
auto line = editor->editor()->document()->line(curLineInd);
auto hitCur = m_symID.value(Symbols::DbgRunHitBreakPoint);
auto curSym = m_symID.value(Symbols::DbgRunCurrentLine);
auto dbg = m_consoleout->machine()->debugger();
if (line.hasMark(hitCur)) {
line.removeMark(hitCur);
line.addMark(curSym);
dbg->removeFileBreakPoint(editor->fileName(), curLineInd + 1);
} else {
if (line.hasMark(bpMark)) {
line.removeMark(bpMark);
dbg->removeFileBreakPoint(editor->fileName(),
curLineInd + 1);
}
}
} else {
auto line = editor->editor()->document()->line(curLineInd);
if (line.hasMark(bpMark)) {
line.removeMark(bpMark);
}
} }
} }
} }
@ -1059,7 +1235,7 @@ void ScriptingDialog::closeEvent(QCloseEvent *event) {
event->ignore(); event->ignore();
return; return;
} }
// TODO stop the script on_stopscript();
} }
auto &set = SettingManager::instance(); auto &set = SettingManager::instance();

View File

@ -2,6 +2,7 @@
#define SCRIPTINGDIALOG_H #define SCRIPTINGDIALOG_H
#include "control/scriptingconsole.h" #include "control/scriptingconsole.h"
#include "dialog/settingdialog.h"
#include "framelessmainwindow.h" #include "framelessmainwindow.h"
#include "QWingRibbon/ribbon.h" #include "QWingRibbon/ribbon.h"
@ -29,8 +30,15 @@ private:
REDO_ACTION, REDO_ACTION,
SAVE_ACTION, SAVE_ACTION,
COPY_ACTION, COPY_ACTION,
DBG_RUN, DBG_RUN_ACTION,
DBG_RUN_DBG, DBG_RUN_DBG_ACTION,
DBG_PAUSE_ACTION,
DBG_CONTINUE_ACTION,
DBG_STOP_ACTION,
DBG_RESTART_ACTION,
DBG_STEPINTO_ACTION,
DBG_STEPOVER_ACTION,
DBG_STEPOUT_ACTION,
EDITOR_VIEWS, EDITOR_VIEWS,
TOOL_VIEWS TOOL_VIEWS
}; };
@ -153,7 +161,7 @@ private:
ScriptEditor *currentEditor() const; ScriptEditor *currentEditor() const;
void swapEditor(ScriptEditor *old, ScriptEditor *cur); void swapEditor(ScriptEditor *old, ScriptEditor *cur);
void setRunDebugMode(bool isRun, bool isDebug = false); void updateRunDebugMode();
ScriptEditor *findEditorView(const QString &filename); ScriptEditor *findEditorView(const QString &filename);
@ -165,6 +173,12 @@ private:
void runDbgCommand(asDebugger::DebugAction action); void runDbgCommand(asDebugger::DebugAction action);
void buildUpSettingDialog();
void startDebugScript(const QString &fileName);
void toggleBreakPoint(ScriptEditor *editor, int lineIndex);
private slots: private slots:
void on_newfile(); void on_newfile();
void on_openfile(); void on_openfile();
@ -213,13 +227,13 @@ private:
ScriptEditor *m_curEditor = nullptr; ScriptEditor *m_curEditor = nullptr;
QList<QWidget *> m_editStateWidgets; QList<QWidget *> m_editStateWidgets;
QList<QWidget *> m_dbgStateWidgets;
QMap<ToolButtonIndex, QToolButton *> m_Tbtneditors; QMap<ToolButtonIndex, QToolButton *> m_Tbtneditors;
QMenu *m_recentMenu = nullptr; QMenu *m_recentMenu = nullptr;
RecentFileManager *m_recentmanager = nullptr; RecentFileManager *m_recentmanager = nullptr;
Ribbon *m_ribbon = nullptr; Ribbon *m_ribbon = nullptr;
SettingDialog *m_setdialog = nullptr;
size_t m_newIndex = 1; size_t m_newIndex = 1;
QPair<QString, int> _lastCurLine = {QString(), -1}; QPair<QString, int> _lastCurLine = {QString(), -1};
@ -236,6 +250,8 @@ private:
DbgVarShowModel *m_watch = nullptr; DbgVarShowModel *m_watch = nullptr;
DbgCallStackModel *m_callstack = nullptr; DbgCallStackModel *m_callstack = nullptr;
QString _DebugingScript;
QStatusBar *m_status = nullptr; QStatusBar *m_status = nullptr;
}; };

View File

@ -26,6 +26,7 @@
#include "qdocument_p.h" #include "qdocument_p.h"
#include "qeditor.h" #include "qeditor.h"
#include "ui_qeditconfig.h" #include "ui_qeditconfig.h"
#include "utilities.h"
#include <QDebug> #include <QDebug>
@ -39,108 +40,14 @@
*/ */
QEditConfig::QEditConfig(QWidget *w) QEditConfig::QEditConfig(QWidget *w)
: QWidget(w), ui(new Ui::QEditConfig()), m_direct(false) { : WingHex::SettingPage(w), ui(new Ui::QEditConfig()) {
ui->setupUi(this); ui->setupUi(this);
restore(); reset();
} }
QEditConfig::~QEditConfig() { delete ui; } QEditConfig::~QEditConfig() { delete ui; }
/*!
\brief run-time translation entry point
*/
void QEditConfig::retranslate() { ui->retranslateUi(this); }
/*!
\brief
*/
bool QEditConfig::hasUnsavedChanges() const {
if (m_direct)
return false;
QFont font = ui->cbFont->currentFont();
// font.setPointSize(spnFontSize->value());
const QFont &docFont = QDocument::font();
if (font.family() != docFont.family() ||
ui->spnFontSize->value() != docFont.pointSize()) {
// qDebug("font!");
return true;
}
if (ui->spnTabWidth->value() != QDocument::tabStop()) {
// qDebug("tab stop!");
return true;
}
QDocument::LineEnding le = QDocument::defaultLineEnding();
if (ui->chkDetectLE->isChecked()) {
if (le != QDocument::Conservative) {
// qDebug("conservative line endings! : %i", le);
return true;
}
} else {
if (le !=
QDocument::LineEnding(ui->cbLineEndings->currentIndex() + 1)) {
// qDebug("line endings!");
return true;
}
}
QDocument::WhiteSpaceMode ws = QDocument::ShowNone;
if (ui->chkShowLeadingWhitespace->isChecked())
ws |= QDocument::ShowLeading;
if (ui->chkShowTrailingWhitespace->isChecked())
ws |= QDocument::ShowTrailing;
if (ui->chkShowTabsInText->isChecked())
ws |= QDocument::ShowTabs;
if (ws != QDocument::showSpaces()) {
// qDebug("spaces!");
return true;
}
int flags = QEditor::defaultFlags();
if (ui->chkReplaceTabs->isChecked())
flags |= QEditor::ReplaceTabs;
else
flags &= ~QEditor::ReplaceTabs;
if (ui->chkAutoRemoveTrailingWhitespace->isChecked())
flags |= QEditor::RemoveTrailing;
else
flags &= ~QEditor::RemoveTrailing;
if (ui->chkPreserveTrailingIndent->isChecked())
flags |= QEditor::PreserveTrailingIndent;
else
flags &= ~QEditor::PreserveTrailingIndent;
if (flags != QEditor::defaultFlags()) {
// qDebug("flags!");
return true;
}
return false;
}
/*!
\return whether user changes are immediately applied
*/
bool QEditConfig::applyImmediately() const { return m_direct; }
/*!
\brief Set whether user changes are immediately applied
*/
void QEditConfig::setApplyImmediately(bool y) { m_direct = y; }
/*! /*!
\brief Apply changes \brief Apply changes
*/ */
@ -199,11 +106,6 @@ void QEditConfig::apply() {
*/ */
void QEditConfig::cancel() { void QEditConfig::cancel() {
// reload the current config // reload the current config
bool oldDir = m_direct;
m_direct = false;
ui->cbFont->setFont(QDocument::font()); ui->cbFont->setFont(QDocument::font());
ui->spnFontSize->setValue(QDocument::font().pointSize()); ui->spnFontSize->setValue(QDocument::font().pointSize());
@ -224,10 +126,6 @@ void QEditConfig::cancel() {
QEditor::RemoveTrailing); QEditor::RemoveTrailing);
ui->chkPreserveTrailingIndent->setChecked(flags & ui->chkPreserveTrailingIndent->setChecked(flags &
QEditor::PreserveTrailingIndent); QEditor::PreserveTrailingIndent);
auto c = QEditor::defaultCodecName();
m_direct = oldDir;
} }
/*! /*!
@ -235,13 +133,9 @@ void QEditConfig::cancel() {
\note The widgets are changed but these changes are NOT applied. \note The widgets are changed but these changes are NOT applied.
*/ */
void QEditConfig::restore() { void QEditConfig::reset() {
// restore default configuration // restore default configuration
bool oldDir = m_direct;
m_direct = false;
QFont font("Monospace", 10); QFont font("Monospace", 10);
font.setStyleHint(QFont::Courier); font.setStyleHint(QFont::Courier);
@ -260,8 +154,6 @@ void QEditConfig::restore() {
ui->chkReplaceTabs->setChecked(false); ui->chkReplaceTabs->setChecked(false);
ui->chkAutoRemoveTrailingWhitespace->setChecked(false); ui->chkAutoRemoveTrailingWhitespace->setChecked(false);
ui->chkPreserveTrailingIndent->setChecked(true); ui->chkPreserveTrailingIndent->setChecked(true);
m_direct = oldDir;
} }
/*! /*!
@ -296,6 +188,12 @@ QMap<QString, QVariant> QEditConfig::dumpKeys() const {
return m; return m;
} }
QIcon QEditConfig::categoryIcon() const { return ICONRES("file"); }
QString QEditConfig::name() const { return tr("Edit"); }
bool QEditConfig::isInPluginPage() const { return false; }
/*! /*!
\brief Fills the widget subcontrols from a settings map \brief Fills the widget subcontrols from a settings map
@ -314,40 +212,31 @@ void QEditConfig::loadKeys(const QMap<QString, QVariant> &keys) {
ui->cbFont->setCurrentFont(f); ui->cbFont->setCurrentFont(f);
ui->spnFontSize->setValue(f.pointSize()); ui->spnFontSize->setValue(f.pointSize());
if (m_direct) QDocument::setFont(f);
QDocument::setFont(f);
ui->lblSampleText->setFont(f); ui->lblSampleText->setFont(f);
} else if (it.key() == "tab_width") { } else if (it.key() == "tab_width") {
ui->spnTabWidth->setValue(it->toInt()); ui->spnTabWidth->setValue(it->toInt());
on_spnTabWidth_valueChanged(it->toInt());
if (m_direct)
on_spnTabWidth_valueChanged(it->toInt());
} else if (it.key() == "replace_tabs") { } else if (it.key() == "replace_tabs") {
ui->chkReplaceTabs->setChecked(it->toBool()); ui->chkReplaceTabs->setChecked(it->toBool());
if (m_direct) on_chkReplaceTabs_toggled(it->toBool());
on_chkReplaceTabs_toggled(it->toBool());
} else if (it.key() == "remove_trailing") { } else if (it.key() == "remove_trailing") {
ui->chkAutoRemoveTrailingWhitespace->setChecked(it->toBool()); ui->chkAutoRemoveTrailingWhitespace->setChecked(it->toBool());
if (m_direct) on_chkAutoRemoveTrailingWhitespace_toggled(it->toBool());
on_chkAutoRemoveTrailingWhitespace_toggled(it->toBool());
} else if (it.key() == "preserve_trailing_indent") { } else if (it.key() == "preserve_trailing_indent") {
ui->chkPreserveTrailingIndent->setChecked(it->toBool()); ui->chkPreserveTrailingIndent->setChecked(it->toBool());
if (m_direct) on_chkPreserveTrailingIndent_toggled(it->toBool());
on_chkPreserveTrailingIndent_toggled(it->toBool());
} else if (it.key() == "show_tabs_in_text") { } else if (it.key() == "show_tabs_in_text") {
ui->chkShowTabsInText->setChecked(it->toBool()); ui->chkShowTabsInText->setChecked(it->toBool());
if (m_direct) on_chkShowTabsInText_toggled(it->toBool());
on_chkShowTabsInText_toggled(it->toBool());
} else if (it.key() == "show_leading_whitespace") { } else if (it.key() == "show_leading_whitespace") {
ui->chkShowLeadingWhitespace->setChecked(it->toBool()); ui->chkShowLeadingWhitespace->setChecked(it->toBool());
if (m_direct) on_chkShowLeadingWhitespace_toggled(it->toBool());
on_chkShowLeadingWhitespace_toggled(it->toBool());
} else if (it.key() == "show_trailing_whitespace") { } else if (it.key() == "show_trailing_whitespace") {
ui->chkShowTrailingWhitespace->setChecked(it->toBool()); ui->chkShowTrailingWhitespace->setChecked(it->toBool());
if (m_direct) on_chkShowTrailingWhitespace_toggled(it->toBool());
on_chkShowTrailingWhitespace_toggled(it->toBool());
} else if (it.key() == "line_endings") { } else if (it.key() == "line_endings") {
int le = it->toInt(); int le = it->toInt();
@ -379,10 +268,8 @@ void QEditConfig::on_spnFontSize_valueChanged(int size) {
ui->lblSampleText->setFont(font); ui->lblSampleText->setFont(font);
if (m_direct) { QDocument::setFont(font);
QDocument::setFont(font); emit keyChanged("font", font);
emit keyChanged("font", font);
}
} }
/*! /*!
@ -392,90 +279,76 @@ void QEditConfig::on_cbFont_currentFontChanged(QFont font) {
font.setPointSize(ui->spnFontSize->value()); font.setPointSize(ui->spnFontSize->value());
ui->lblSampleText->setFont(font); ui->lblSampleText->setFont(font);
if (m_direct) { QDocument::setFont(font);
QDocument::setFont(font); emit keyChanged("font", font);
emit keyChanged("font", font);
}
} }
/*! /*!
\brief Slot used to apply tab width settings \brief Slot used to apply tab width settings
*/ */
void QEditConfig::on_spnTabWidth_valueChanged(int n) { void QEditConfig::on_spnTabWidth_valueChanged(int n) {
if (m_direct) {
QDocument::setTabStop(n); QDocument::setTabStop(n);
emit keyChanged("tab_width", n); emit keyChanged("tab_width", n);
}
} }
/*! /*!
\brief Slot used to apply tabs replacement settings \brief Slot used to apply tabs replacement settings
*/ */
void QEditConfig::on_chkReplaceTabs_toggled(bool y) { void QEditConfig::on_chkReplaceTabs_toggled(bool y) {
if (m_direct) { // FIXME
// FIXME foreach (QEditor *e, QEditor::m_editors) {
foreach (QEditor *e, QEditor::m_editors) { e->setFlag(QEditor::ReplaceTabs, y);
e->setFlag(QEditor::ReplaceTabs, y);
}
emit keyChanged("replace_tabs", y);
} }
emit keyChanged("replace_tabs", y);
} }
/*! /*!
\brief Slot used to apply tabs display settings \brief Slot used to apply tabs display settings
*/ */
void QEditConfig::on_chkShowTabsInText_toggled(bool y) { void QEditConfig::on_chkShowTabsInText_toggled(bool y) {
if (m_direct) { if (y)
if (y) QDocument::setShowSpaces(QDocument::showSpaces() | QDocument::ShowTabs);
QDocument::setShowSpaces(QDocument::showSpaces() | else
QDocument::ShowTabs); QDocument::setShowSpaces(QDocument::showSpaces() &
else ~QDocument::ShowTabs);
QDocument::setShowSpaces(QDocument::showSpaces() &
~QDocument::ShowTabs);
emit keyChanged("show_tabs_in_text", y); emit keyChanged("show_tabs_in_text", y);
}
} }
/*! /*!
\brief Slot used to apply trailing whitespace display settings \brief Slot used to apply trailing whitespace display settings
*/ */
void QEditConfig::on_chkShowLeadingWhitespace_toggled(bool y) { void QEditConfig::on_chkShowLeadingWhitespace_toggled(bool y) {
if (m_direct) { if (y)
if (y) QDocument::setShowSpaces(QDocument::showSpaces() |
QDocument::setShowSpaces(QDocument::showSpaces() | QDocument::ShowLeading);
QDocument::ShowLeading); else
else QDocument::setShowSpaces(QDocument::showSpaces() &
QDocument::setShowSpaces(QDocument::showSpaces() & ~QDocument::ShowLeading);
~QDocument::ShowLeading);
emit keyChanged("show_leading_whitespace", y); emit keyChanged("show_leading_whitespace", y);
}
} }
/*! /*!
\brief Slot used to apply leading whitespace display settings \brief Slot used to apply leading whitespace display settings
*/ */
void QEditConfig::on_chkShowTrailingWhitespace_toggled(bool y) { void QEditConfig::on_chkShowTrailingWhitespace_toggled(bool y) {
if (m_direct) { if (y)
if (y) QDocument::setShowSpaces(QDocument::showSpaces() |
QDocument::setShowSpaces(QDocument::showSpaces() | QDocument::ShowTrailing);
QDocument::ShowTrailing); else
else QDocument::setShowSpaces(QDocument::showSpaces() &
QDocument::setShowSpaces(QDocument::showSpaces() & ~QDocument::ShowTrailing);
~QDocument::ShowTrailing);
emit keyChanged("show_trailing_whitespace", y); emit keyChanged("show_trailing_whitespace", y);
}
} }
void QEditConfig::on_cbLineEndings_currentIndexChanged(int idx) { void QEditConfig::on_cbLineEndings_currentIndexChanged(int idx) {
QDocument::LineEnding le = QDocument::LineEnding(idx + 1); QDocument::LineEnding le = QDocument::LineEnding(idx + 1);
if (m_direct) { QDocument::setDefaultLineEnding(le);
QDocument::setDefaultLineEnding(le); emit keyChanged("line_endings", (int)le);
emit keyChanged("line_endings", (int)le);
}
} }
/*! /*!
@ -488,36 +361,30 @@ void QEditConfig::on_chkDetectLE_toggled(bool y) {
le = QDocument::LineEnding(ui->cbLineEndings->currentIndex() + 1); le = QDocument::LineEnding(ui->cbLineEndings->currentIndex() + 1);
} }
if (m_direct) { QDocument::setDefaultLineEnding(le);
QDocument::setDefaultLineEnding(le); emit keyChanged("line_endings", (int)le);
emit keyChanged("line_endings", (int)le);
}
} }
/*! /*!
\brief Slot used to apply trailing space removal settings \brief Slot used to apply trailing space removal settings
*/ */
void QEditConfig::on_chkAutoRemoveTrailingWhitespace_toggled(bool y) { void QEditConfig::on_chkAutoRemoveTrailingWhitespace_toggled(bool y) {
if (m_direct) { // FIXME
// FIXME foreach (QEditor *e, QEditor::m_editors) {
foreach (QEditor *e, QEditor::m_editors) { e->setFlag(QEditor::RemoveTrailing, y);
e->setFlag(QEditor::RemoveTrailing, y);
}
emit keyChanged("remove_trailing", y);
} }
emit keyChanged("remove_trailing", y);
} }
/*! /*!
\brief Slot used to indent preservation settings \brief Slot used to indent preservation settings
*/ */
void QEditConfig::on_chkPreserveTrailingIndent_toggled(bool y) { void QEditConfig::on_chkPreserveTrailingIndent_toggled(bool y) {
if (m_direct) { // FIXME
// FIXME foreach (QEditor *e, QEditor::m_editors) {
foreach (QEditor *e, QEditor::m_editors) { e->setFlag(QEditor::PreserveTrailingIndent, y);
e->setFlag(QEditor::PreserveTrailingIndent, y);
}
emit keyChanged("preserve_trailing_indent", y);
} }
emit keyChanged("preserve_trailing_indent", y);
} }
/*! @} */ /*! @} */

View File

@ -1,36 +1,34 @@
#ifndef QEDITCONFIG_H #ifndef QEDITCONFIG_H
#define QEDITCONFIG_H #define QEDITCONFIG_H
#include "plugin/settingpage.h"
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {
class QEditConfig; class QEditConfig;
} }
class QEditConfig : public QWidget { class QEditConfig : public WingHex::SettingPage {
Q_OBJECT Q_OBJECT
public: public:
explicit QEditConfig(QWidget *parent = nullptr); explicit QEditConfig(QWidget *parent = nullptr);
virtual ~QEditConfig(); virtual ~QEditConfig();
bool hasUnsavedChanges() const;
bool applyImmediately() const;
QMap<QString, QVariant> dumpKeys() const; QMap<QString, QVariant> dumpKeys() const;
public:
virtual QIcon categoryIcon() const override;
virtual QString name() const override;
virtual bool isInPluginPage() const override;
virtual void apply() override;
virtual void cancel() override;
virtual void reset() override;
public slots: public slots:
void retranslate();
void apply();
void cancel();
void restore();
void loadKeys(const QMap<QString, QVariant> &keys); void loadKeys(const QMap<QString, QVariant> &keys);
void setApplyImmediately(bool y);
signals: signals:
void keyChanged(const QString &key, const QVariant &value); void keyChanged(const QString &key, const QVariant &value);
@ -53,8 +51,6 @@ private slots:
private: private:
Ui::QEditConfig *ui; Ui::QEditConfig *ui;
bool m_direct;
}; };
#endif // QEDITCONFIG_H #endif // QEDITCONFIG_H

View File

@ -37,6 +37,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include "class/wingmessagebox.h" #include "class/wingmessagebox.h"
#include "utilities.h"
/*! /*!
\ingroup dialogs \ingroup dialogs
@ -48,7 +49,7 @@
*/ */
QFormatConfig::QFormatConfig(QWidget *w) QFormatConfig::QFormatConfig(QWidget *w)
: QWidget(w), ui(new Ui::QFormatConfig()), m_autonomous(false), : WingHex::SettingPage(w), ui(new Ui::QFormatConfig()), m_autonomous(false),
m_currentScheme(0) { m_currentScheme(0) {
ui->setupUi(this); ui->setupUi(this);
@ -72,11 +73,6 @@ QFormatConfig::QFormatConfig(QWidget *w)
QFormatConfig::~QFormatConfig() { delete ui; } QFormatConfig::~QFormatConfig() { delete ui; }
/*!
\brief run-time translation entry point
*/
void QFormatConfig::retranslate() { ui->retranslateUi(this); }
/*! /*!
\return Whether the format config widget is in "autonomous" mode \return Whether the format config widget is in "autonomous" mode
*/ */
@ -103,6 +99,12 @@ bool QFormatConfig::hasUnsavedChanges() const {
*/ */
QList<QFormatScheme *> QFormatConfig::schemes() const { return m_schemes; } QList<QFormatScheme *> QFormatConfig::schemes() const { return m_schemes; }
QIcon QFormatConfig::categoryIcon() const { return ICONRES(""); }
QString QFormatConfig::name() const { return tr("Format"); }
bool QFormatConfig::isInPluginPage() const { return false; }
/*! /*!
\brief Add a format scheme to the config widget \brief Add a format scheme to the config widget
@ -325,7 +327,7 @@ void QFormatConfig::cancel() {
\note The widgets are changed but these changes are NOT applied. \note The widgets are changed but these changes are NOT applied.
*/ */
void QFormatConfig::restore() { void QFormatConfig::reset() {
// restoring what? this is only provided for API consistency and in case // restoring what? this is only provided for API consistency and in case
// (very unlikely to ever happen) design changes make restore() a sensible // (very unlikely to ever happen) design changes make restore() a sensible
// thing to do on format schemes // thing to do on format schemes

View File

@ -1,6 +1,7 @@
#ifndef QFORMATCONFIG_H #ifndef QFORMATCONFIG_H
#define QFORMATCONFIG_H #define QFORMATCONFIG_H
#include "plugin/settingpage.h"
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {
@ -9,7 +10,7 @@ class QFormatConfig;
class QFormatScheme; class QFormatScheme;
class QFormatConfig : public QWidget { class QFormatConfig : public WingHex::SettingPage {
Q_OBJECT Q_OBJECT
public: public:
@ -22,13 +23,15 @@ public:
QList<QFormatScheme *> schemes() const; QList<QFormatScheme *> schemes() const;
public:
virtual QIcon categoryIcon() const override;
virtual QString name() const override;
virtual bool isInPluginPage() const override;
virtual void apply() override;
virtual void cancel() override;
virtual void reset() override;
public slots: public slots:
void retranslate();
void apply();
void cancel();
void restore();
void setAutonomous(bool y); void setAutonomous(bool y);
void addScheme(const QString &name, QFormatScheme *scheme); void addScheme(const QString &name, QFormatScheme *scheme);
@ -37,7 +40,7 @@ public slots:
void setCurrentScheme(QFormatScheme *scheme); void setCurrentScheme(QFormatScheme *scheme);
protected: protected:
virtual void hideEvent(QHideEvent *e); virtual void hideEvent(QHideEvent *e) override;
private slots: private slots:
void on_m_selector_currentIndexChanged(int idx); void on_m_selector_currentIndexChanged(int idx);

View File

@ -1,177 +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 "qstatuspanel.h"
/*!
\file qstatuspanel.cpp
\brief Implementation of the QStatusPanel class.
\see QStatusPanel
*/
#include "qeditor.h"
#include "qdocument.h"
#include "qdocumentcursor.h"
#include "qdocumentline.h"
#include <QApplication>
#include <QDateTime>
#include <QFontMetrics>
#include <QPaintEvent>
#include <QPainter>
#include <QTimer>
/*!
\ingroup widgets
@{
*/
/*!
\class QStatusPanel
\brief A panel that display some status informations
*/
QCE_AUTO_REGISTER(QStatusPanel)
/*!
\brief Constructor
*/
QStatusPanel::QStatusPanel(QWidget *p) : QPanel(p) {
setFixedHeight(fontMetrics().lineSpacing() + 4);
}
/*!
\brief Empty destructor
*/
QStatusPanel::~QStatusPanel() {}
/*!
*/
QString QStatusPanel::type() const { return "Status"; }
/*!
*/
void QStatusPanel::editorChange(QEditor *e) {
if (editor()) {
disconnect(editor(), SIGNAL(cursorPositionChanged()), this,
SLOT(update()));
}
if (e) {
connect(e, SIGNAL(cursorPositionChanged()), this, SLOT(update()));
}
}
/*!
*/
bool QStatusPanel::paint(QPainter *p, QEditor *e) {
// qDebug("drawing status panel... [%i, %i, %i, %i]",
// geometry().x(),
// geometry().y(),
// geometry().width(),
// geometry().height());
static QPixmap _warn(":/warning.png"), _mod(":/save.png");
QString s;
int xpos = 10;
QDocumentCursor c = e->cursor();
const QFontMetrics fm(fontMetrics());
const int ls = fm.lineSpacing();
const int ascent = fm.ascent() + 3;
s = tr("Line : %1 Visual column : %2 Text column : %3")
.arg(c.lineNumber() + 1)
.arg(c.visualColumnNumber())
.arg(c.columnNumber());
p->drawText(xpos, ascent, s);
xpos += fm.horizontalAdvance(s) + 10;
int sz = qMin(height(), _mod.height());
// int lastMod = d->lastModified().secsTo(QDateTime::currentDateTime());
// QString timeDiff = tr("(%1 min %2 s ago)").arg(lastMod / 60).arg(lastMod
// % 60);
// xpos += 10;
if (e->isContentModified()) {
p->drawPixmap(xpos, (height() - sz) / 2, sz, sz, _mod);
// xpos += sz;
// xpos += 10;
// p->drawText(xpos, ascent, timeDiff);
}
xpos += sz + 10;
// xpos += fm.width(timeDiff);
// xpos += 20;
s = editor()->flag(QEditor::Overwrite) ? tr("OVERWRITE") : tr("INSERT");
p->drawText(xpos, ascent, s);
xpos += fm.horizontalAdvance(s) + 10;
m_conflictSpot = 0;
if (editor()->isInConflict()) {
s = tr("Conflict");
int w = fm.horizontalAdvance(s) + 30;
if (xpos + w + _warn.width() < width()) {
m_conflictSpot = width() - (w + _warn.width());
p->drawText(width() - w + 15, ascent, s);
p->drawPixmap(m_conflictSpot, (ls - _warn.height()) / 2 + 2, _warn);
} else if (xpos + _warn.width() < width()) {
m_conflictSpot = width() - _warn.width();
p->drawPixmap(m_conflictSpot, (ls - _warn.height()) / 2 + 2, _warn);
}
}
setFixedHeight(ls + 4);
QTimer::singleShot(1000, this, SLOT(update()));
return true;
}
/*!
*/
void QStatusPanel::mousePressEvent(QMouseEvent *e) {
if (!editor() || (e->button() != Qt::LeftButton) || !m_conflictSpot ||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
e->position().x() < m_conflictSpot) {
#else
e->x() < m_conflictSpot) {
#endif
editor()->setFocus();
return;
}
editor()->save();
}
/*!
*/
void QStatusPanel::mouseReleaseEvent(QMouseEvent *e) {
Q_UNUSED(e)
editor()->setFocus();
}
/*! @} */

View File

@ -1,54 +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 _QSTATUS_PANEL_H_
#define _QSTATUS_PANEL_H_
#include "qpanel.h"
/*!
\file qstatuspanel.h
\brief Definition of the QStatusPanel class.
\see QStatusPanel
*/
class QLabel;
class QDocumentLine;
class QCE_EXPORT QStatusPanel : public QPanel {
Q_OBJECT
public:
Q_PANEL(QStatusPanel, "Status Panel")
QStatusPanel(QWidget *p = nullptr);
virtual ~QStatusPanel();
virtual QString type() const;
protected:
virtual void editorChange(QEditor *e);
virtual bool paint(QPainter *p, QEditor *e);
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e);
private:
int m_conflictSpot;
};
#endif // _QSTATUS_PANEL_H_

View File

@ -1,7 +1,7 @@
#ifndef GENERALSETTINGDIALOG_H #ifndef GENERALSETTINGDIALOG_H
#define GENERALSETTINGDIALOG_H #define GENERALSETTINGDIALOG_H
#include "../plugin/settingpage.h" #include "plugin/settingpage.h"
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {