2 // debuggertab.cpp: "Debugger" tab on the settings dialog
6 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
9 // --- ---------- ------------------------------------------------------------
10 // JPM Sept./2016 Created this file, and added Soft debugger support
11 // JPM 10/09/2018 Added source file search paths
14 #include "debuggertab.h"
19 DebuggerTab::DebuggerTab(QWidget
* parent
/*= 0*/): QWidget(parent
)
21 // Number of disassembly lines
22 QLabel
*label3
= new QLabel("Disassembly lines:");
23 QVBoxLayout
*layout1
= new QVBoxLayout
;
24 layout1
->addWidget(label3
);
25 QVBoxLayout
*layout2
= new QVBoxLayout
;
26 nbrdisasmlines
= new QLineEdit("");
27 nbrdisasmlines
->setPlaceholderText("Number of disassembly lines");
28 layout2
->addWidget(nbrdisasmlines
);
31 QLabel
*label4
= new QLabel("Source file search paths:");
32 QVBoxLayout
*layout5
= new QVBoxLayout
;
33 layout5
->addWidget(label4
);
34 QVBoxLayout
*layout6
= new QVBoxLayout
;
35 sourcefilesearchpaths
= new QLineEdit("");
36 sourcefilesearchpaths
->setMaxLength(sizeof(vjs
.sourcefilesearchPaths
));
37 sourcefilesearchpaths
->setPlaceholderText("Each path must be separate by a ';', search is recursive and based on each path");
38 layout6
->addWidget(sourcefilesearchpaths
);
40 QHBoxLayout
*layout3
= new QHBoxLayout
;
41 layout3
->addLayout(layout1
);
42 layout3
->addLayout(layout2
);
43 QHBoxLayout
*layout7
= new QHBoxLayout
;
44 layout7
->addLayout(layout5
);
45 layout7
->addLayout(layout6
);
47 QVBoxLayout
*layout4
= new QVBoxLayout
;
48 layout4
->addLayout(layout3
);
49 layout4
->addLayout(layout7
);
52 displayHWlabels
= new QCheckBox(tr("Display HW labels"));
53 disasmopcodes
= new QCheckBox(tr("Display M68000 opcodes"));
54 displayFullSourceFilename
= new QCheckBox(tr("Display source filename"));
55 disasmopcodes
->setDisabled(false);
56 displayHWlabels
->setDisabled(false);
57 displayFullSourceFilename
->setDisabled(false);
59 layout4
->addWidget(disasmopcodes
);
60 layout4
->addWidget(displayHWlabels
);
61 layout4
->addWidget(displayFullSourceFilename
);
68 DebuggerTab::~DebuggerTab()
73 // Save / Update the settings from the tabs dialog
74 void DebuggerTab::SetSettings(void)
78 strcpy(vjs
.debuggerROMPath
, vjs
.alpineROMPath
);
79 strcpy(vjs
.sourcefilesearchPaths
, CheckForTrailingSlash(sourcefilesearchpaths
->text()).toUtf8().data());
80 vjs
.nbrdisasmlines
= nbrdisasmlines
->text().toUInt(&ok
, 10);
81 vjs
.displayHWlabels
= displayHWlabels
->isChecked();
82 vjs
.disasmopcodes
= disasmopcodes
->isChecked();
83 vjs
.displayFullSourceFilename
= displayFullSourceFilename
->isChecked();
87 // Load / Update the tabs dialog from the settings
88 void DebuggerTab::GetSettings(void)
90 QVariant
v(vjs
.nbrdisasmlines
);
91 nbrdisasmlines
->setText(v
.toString());
92 sourcefilesearchpaths
->setText(vjs
.sourcefilesearchPaths
);
93 displayHWlabels
->setChecked(vjs
.displayHWlabels
);
94 disasmopcodes
->setChecked(vjs
.disasmopcodes
);
95 displayFullSourceFilename
->setChecked(vjs
.displayFullSourceFilename
);
99 // Remove the last character if slash or backslash at the end of each string
100 // Depend the platform transform slashes or backslashes
101 QString
DebuggerTab::CheckForTrailingSlash(QString s
)
103 if (s
.endsWith('/') || s
.endsWith('\\'))
105 s
.remove(s
.length() - 1, 1);
108 s
.replace(QString("/"), QString("\\"));
109 s
.replace(QString("\\;"), QString(";"));
111 s
.replace(QString("\\"), QString("/"));
112 s
.replace(QString("/;"), QString(";"));