feat: 完善脚本编辑窗体;调整打包脚本;

This commit is contained in:
寂静的羽夏 2024-09-21 18:39:55 +08:00
parent 276787df09
commit cb7923e4f8
8 changed files with 233 additions and 178 deletions

View File

@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROJECT_VERSION 1.0.0~beta)
set(PROJECT_VERSION 1.0.0)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network Concurrent
PrintSupport LinguistTools)

View File

@ -3,7 +3,8 @@
  维护一个好用的工具并不是一个人能做到了,更重要的是大家共同维护,如下是对本仓库代码有贡献的同志,特此感谢:
> 吉位招租
* oPengLuo (大大的力量)
## 赞助鸣谢

View File

@ -4293,354 +4293,375 @@ Do you want them to be saved?</source>
<context>
<name>ScriptingDialog</name>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="91"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="92"/>
<source>ScriptEditor</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="199"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="173"/>
<source>ScriptPermissionDenied</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="219"/>
<source>File</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="200"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="220"/>
<source>Edit</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="202"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="222"/>
<source>Debugger</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="206"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="226"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="219"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="239"/>
<source>Basic</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="220"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="240"/>
<source>New</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="223"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="243"/>
<source>OpenF</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="226"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="246"/>
<source>RecentFiles</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="230"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="250"/>
<source>Reload</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="235"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="237"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="255"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="257"/>
<source>Save</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="242"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="262"/>
<source>SaveAs</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="254"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="274"/>
<source>General</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="256"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="276"/>
<source>Undo</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="261"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="281"/>
<source>Redo</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="267"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="287"/>
<source>Cut</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="271"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="291"/>
<source>Copy</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="276"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="296"/>
<source>Paste</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="280"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="300"/>
<source>Delete</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="286"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="306"/>
<source>Lookup</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="287"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="307"/>
<source>Find</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="291"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="311"/>
<source>Replace</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="296"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="316"/>
<source>Goto</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="308"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="328"/>
<source>Display</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="335"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="355"/>
<source>Scale</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="337"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="357"/>
<source>ResetScale</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="343"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="363"/>
<source>Window</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="346"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="426"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="366"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="454"/>
<source>Editor</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="350"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="370"/>
<source>Tools</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="409"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="375"/>
<source>Layout</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="376"/>
<source>Fullscreen</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="378"/>
<source>RestoreLayout</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="437"/>
<source>BreakPoint</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="411"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="439"/>
<source>ToggleBreakPoint</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="414"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="442"/>
<source>AddBreakPoint</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="424"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="452"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="460"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="488"/>
<source>Local</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="466"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="494"/>
<source>Global</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="469"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="497"/>
<source>Variables</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="482"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="510"/>
<source>BreakPoints</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="494"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="522"/>
<source>ConsoleOutput</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="508"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="536"/>
<source>StackTrace</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="522"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="550"/>
<source>Watch</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="606"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="812"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="920"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="956"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="971"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="996"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="639"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="849"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1013"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1049"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1064"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1089"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="607"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="640"/>
<source>Too much opened files</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="899"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="935"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="988"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1028"/>
<source>ChooseFile</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="812"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="920"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="971"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="849"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1013"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1064"/>
<source>FilePermission</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="954"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1047"/>
<source>ReloadSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="956"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1049"/>
<source>ReloadUnSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="983"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1076"/>
<source>ChooseSaveFile</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="969"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="994"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1062"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1087"/>
<source>SaveSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="996"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1089"/>
<source>SaveUnSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1098"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1113"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1197"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1212"/>
<source>CannotSave2RunScript</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1233"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="672"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="1272"/>
<source>ScriptStillRunning</source>
<translation>退</translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="201"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="221"/>
<source>View</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="359"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="387"/>
<source>Debug</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="362"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="390"/>
<source>Run</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="367"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="395"/>
<source>RunWithDbg</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="373"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="401"/>
<source>Pause</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="378"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="406"/>
<source>Continue</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="383"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="411"/>
<source>Stop</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="387"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="415"/>
<source>Restart</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="392"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="420"/>
<source>StepInto</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="397"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="425"/>
<source>StepOver</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="401"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="429"/>
<source>StepOut</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="417"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="445"/>
<source>RemoveBreakPoint</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="433"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="461"/>
<source>Info</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="435"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="463"/>
<source>Software</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="438"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="466"/>
<source>Sponsor</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="441"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="469"/>
<source>Wiki</source>
<translation> Wiki</translation>
</message>
<message>
<location filename="../../src/dialog/scriptingdialog.cpp" line="444"/>
<location filename="../../src/dialog/scriptingdialog.cpp" line="472"/>
<source>AboutQT</source>
<translation> QT</translation>
</message>

View File

@ -89,7 +89,7 @@ def main():
package_name = "WingHexExplorer2"
architecture = detect_architecture()
depends = ""
depends = r"${shlibs:Depends}, ${misc:Depends}"
# start parsing build directory
projectdeb = os.path.abspath(args.folder)

View File

@ -45,6 +45,8 @@ def main():
"folder", help="A folder that has contained the binary build")
parser.add_argument("-c", "--cc", help="where ISCC.exe locates", default="C:\Program Files (x86)\Inno Setup 6\ISCC.exe")
parser.add_argument("-o", "--output", help="where to put the installer")
parser.add_argument("--build", action='store_false')
args = parser.parse_args()
# checking build toolkits
@ -267,17 +269,19 @@ Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChang
with codecs.open(script_src,'w', "utf-8-sig") as iss:
iss.write(iss_content)
print(Fore.GREEN + ">> Copying finished, running ISCC building..." + Style.RESET_ALL)
pak_out = ""
if args.output is None:
pak_out = exeDebPath
else:
pak_out = args.output
ret = run_command_interactive([args.cc, f'/O{pak_out}', script_src])
exit(ret)
if(args.build):
print(Fore.GREEN + ">> Copying finished, running ISCC building..." + Style.RESET_ALL)
pak_out = ""
if args.output is None:
pak_out = exeDebPath
else:
pak_out = args.output
ret = run_command_interactive([args.cc, f'/O{pak_out}', script_src])
exit(ret)
exit(0)
if __name__ == "__main__":
main()

View File

@ -2761,6 +2761,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
auto &set = SettingManager::instance();
set.setDockLayout(m_dock->saveState());
m_scriptDialog->saveDockLayout();
set.setRecentFiles(m_recentmanager->saveRecent());
set.save();

View File

@ -51,6 +51,7 @@ ScriptingDialog::ScriptingDialog(QWidget *parent)
layout->addWidget(q_check_ptr(m_ribbon));
buildUpDockSystem(cw);
_defaultLayout = m_dock->saveState();
layout->addWidget(m_dock, 1);
m_status = new QStatusBar(this);
@ -92,6 +93,10 @@ ScriptingDialog::ScriptingDialog(QWidget *parent)
this->setWindowIcon(ICONRES(QStringLiteral("script")));
this->setMinimumSize(800, 600);
// load saved docking layout
auto &set = SettingManager::instance();
m_dock->restoreState(set.scriptDockLayout());
this->setUpdatesEnabled(true);
}
@ -104,6 +109,8 @@ void ScriptingDialog::initConsole() {
this->updateRunDebugMode();
m_callstack->updateData({});
m_varshow->updateData({});
m_gvarshow->updateData({});
// clean up
if (_lastCurLine.first.isEmpty() || _lastCurLine.second < 0) {
@ -134,7 +141,11 @@ void ScriptingDialog::initConsole() {
Q_ASSERT(dbg);
connect(dbg, &asDebugger::onAdjustBreakPointLine, this,
[=](const asDebugger::BreakPoint &old, int newLineNr) {
auto editor = QCodeEdit::managed(old.name);
if (editor) {
removeBreakPoint(editor, old.lineNbr - 1);
addBreakPoint(editor, newLineNr - 1);
}
});
connect(dbg, &asDebugger::onPullVariables, this,
[=](const QVector<asDebugger::VariablesInfo> &globalvars,
@ -158,7 +169,9 @@ void ScriptingDialog::initConsole() {
e->setFocus();
e->raise();
} else {
// TODO error permission
WingMessageBox::critical(this, this->windowTitle(),
tr("ScriptPermissionDenied"));
return;
}
}
@ -358,6 +371,14 @@ RibbonTabContent *ScriptingDialog::buildViewPage(RibbonTabContent *tab) {
new QMenu(this)));
}
{
auto pannel = tab->addGroup(tr("Layout"));
addPannelAction(pannel, QStringLiteral("fullscreen"), tr("Fullscreen"),
&ScriptingDialog::on_fullScreen);
addPannelAction(pannel, QStringLiteral("layout"), tr("RestoreLayout"),
&ScriptingDialog::on_restoreLayout);
}
return tab;
}
@ -591,12 +612,13 @@ void ScriptingDialog::buildUpDockSystem(QWidget *container) {
splitter->setSizes({height() - bottomHeight, bottomHeight});
}
buildUpStackShowDock(m_dock, ads::CenterDockWidgetArea, bottomArea);
buildUpStackShowDock(m_dock, ads::RightDockWidgetArea, bottomArea);
auto rightArea = buildUpBreakpointShowDock(m_dock, ads::RightDockWidgetArea,
m_editorViewArea);
buildUpVarShowDock(m_dock, ads::CenterDockWidgetArea, rightArea);
// TODO
buildUpBreakpointShowDock(m_dock, ads::RightDockWidgetArea);
buildUpVarShowDock(m_dock, ads::RightDockWidgetArea);
buildUpWatchDock(m_dock, ads::CenterDockWidgetArea);
// not avaliable for v1.0.0
// buildUpWatchDock(m_dock, ads::CenterDockWidgetArea, rightArea);
// set the first tab visible
for (auto &item : m_dock->openedDockAreas()) {
@ -732,7 +754,7 @@ void ScriptingDialog::swapEditor(ScriptEditor *old, ScriptEditor *cur) {
connect(cur, &ScriptEditor::onToggleMark, this, [=](int lineIndex) {
auto editor = qobject_cast<ScriptEditor *>(sender());
Q_ASSERT(editor);
toggleBreakPoint(editor, lineIndex);
toggleBreakPoint(editor->editor(), lineIndex);
});
connect(editor, &QEditor::copyAvailable,
m_Tbtneditors.value(ToolButtonIndex::COPY_ACTION),
@ -865,18 +887,70 @@ void ScriptingDialog::startDebugScript(const QString &fileName) {
updateRunDebugMode();
}
void ScriptingDialog::toggleBreakPoint(ScriptEditor *editor, int lineIndex) {
void ScriptingDialog::addBreakPoint(QEditor *editor, int lineIndex) {
Q_ASSERT(editor);
auto bpMark = m_symID.value(Symbols::BreakPoint);
auto curLine = lineIndex + 1;
if (m_consoleout->machine()->isInDebugMode()) {
auto line = editor->document()->line(lineIndex);
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(), curLine);
} else {
if (!line.hasMark(bpMark)) {
line.addMark(bpMark);
dbg->addFileBreakPoint(editor->fileName(), curLine);
}
}
} else {
auto line = editor->document()->line(lineIndex);
if (!line.hasMark(bpMark)) {
line.addMark(bpMark);
}
}
}
void ScriptingDialog::removeBreakPoint(QEditor *editor, int lineIndex) {
Q_ASSERT(editor);
auto bpMark = m_symID.value(Symbols::BreakPoint);
auto curLine = lineIndex + 1;
if (m_consoleout->machine()->isInDebugMode()) {
auto line = editor->document()->line(lineIndex);
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(bpMark)) {
line.removeMark(bpMark);
dbg->removeFileBreakPoint(editor->fileName(), curLine);
}
}
} else {
auto line = editor->document()->line(lineIndex);
if (line.hasMark(bpMark)) {
line.removeMark(bpMark);
}
}
}
void ScriptingDialog::toggleBreakPoint(QEditor *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);
if (m_consoleout->machine()->isInDebugMode()) {
auto line = 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);
@ -1108,6 +1182,12 @@ void ScriptingDialog::on_wiki() {
"doc_script.html")));
}
void ScriptingDialog::on_fullScreen() { this->showFullScreen(); }
void ScriptingDialog::on_restoreLayout() {
m_dock->restoreState(_defaultLayout);
}
void ScriptingDialog::on_runscript() {
auto editor = currentEditor();
if (editor) {
@ -1164,84 +1244,24 @@ void ScriptingDialog::on_stepoverscript() {
void ScriptingDialog::on_togglebreakpoint() {
auto editor = currentEditor();
if (editor) {
toggleBreakPoint(editor, editor->editor()->cursor().lineNumber());
auto e = editor->editor();
toggleBreakPoint(e, e->cursor().lineNumber());
}
}
void ScriptingDialog::on_addbreakpoint() {
auto editor = currentEditor();
if (editor) {
auto curLineInd = editor->editor()->cursor().lineNumber();
auto bpMark = m_symID.value(Symbols::BreakPoint);
#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 == 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);
}
}
auto e = editor->editor();
addBreakPoint(e, e->cursor().lineNumber());
}
}
void ScriptingDialog::on_removebreakpoint() {
auto editor = currentEditor();
if (editor) {
auto curLineInd = editor->editor()->cursor().lineNumber();
auto bpMark = m_symID.value(Symbols::BreakPoint);
#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 == 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);
}
}
auto e = editor->editor();
removeBreakPoint(e, e->cursor().lineNumber());
}
}

View File

@ -179,7 +179,11 @@ private:
void startDebugScript(const QString &fileName);
void toggleBreakPoint(ScriptEditor *editor, int lineIndex);
void addBreakPoint(QEditor *editor, int lineIndex);
void removeBreakPoint(QEditor *editor, int lineIndex);
void toggleBreakPoint(QEditor *editor, int lineIndex);
private slots:
void on_newfile();
@ -205,6 +209,9 @@ private slots:
void on_sponsor();
void on_wiki();
void on_fullScreen();
void on_restoreLayout();
void on_runscript();
void on_rundbgscript();
void on_pausescript();
@ -226,6 +233,7 @@ private:
ads::CDockManager *m_dock = nullptr;
ads::CDockAreaWidget *m_editorViewArea = nullptr;
QLanguageFactory *m_language = nullptr;
QByteArray _defaultLayout;
ScriptEditor *m_curEditor = nullptr;
QList<QWidget *> m_editStateWidgets;