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
12 // JPM 04/06/2019 Added ELF sections check
15 #include "debuggertab.h"
20 DebuggerTab::DebuggerTab(QWidget
* parent
/*= 0*/): QWidget(parent
)
22 // Number of disassembly lines
23 QLabel
*label3
= new QLabel("Disassembly lines:");
24 QVBoxLayout
*layout1
= new QVBoxLayout
;
25 layout1
->addWidget(label3
);
26 QVBoxLayout
*layout2
= new QVBoxLayout
;
27 nbrdisasmlines
= new QLineEdit("");
28 nbrdisasmlines
->setPlaceholderText("Number of disassembly lines");
29 layout2
->addWidget(nbrdisasmlines
);
32 QLabel
*label4
= new QLabel("Source file search paths:");
33 QVBoxLayout
*layout5
= new QVBoxLayout
;
34 layout5
->addWidget(label4
);
35 QVBoxLayout
*layout6
= new QVBoxLayout
;
36 sourcefilesearchpaths
= new QLineEdit("");
37 sourcefilesearchpaths
->setMaxLength(sizeof(vjs
.sourcefilesearchPaths
));
38 sourcefilesearchpaths
->setPlaceholderText("Each path must be separate by a ';', search is recursive and based on each path");
39 layout6
->addWidget(sourcefilesearchpaths
);
41 QHBoxLayout
*layout3
= new QHBoxLayout
;
42 layout3
->addLayout(layout1
);
43 layout3
->addLayout(layout2
);
44 QHBoxLayout
*layout7
= new QHBoxLayout
;
45 layout7
->addLayout(layout5
);
46 layout7
->addLayout(layout6
);
48 QVBoxLayout
*layout4
= new QVBoxLayout
;
49 layout4
->addLayout(layout3
);
50 layout4
->addLayout(layout7
);
53 displayHWlabels
= new QCheckBox(tr("Display HW labels"));
54 disasmopcodes
= new QCheckBox(tr("Display M68000 opcodes"));
55 displayFullSourceFilename
= new QCheckBox(tr("Display source filename"));
56 ELFSectionsCheck
= new QCheckBox(tr("ELF sections check"));
57 disasmopcodes
->setDisabled(false);
58 displayHWlabels
->setDisabled(false);
59 displayFullSourceFilename
->setDisabled(false);
60 ELFSectionsCheck
->setDisabled(false);
62 layout4
->addWidget(disasmopcodes
);
63 layout4
->addWidget(displayHWlabels
);
64 layout4
->addWidget(displayFullSourceFilename
);
65 layout4
->addWidget(ELFSectionsCheck
);
72 DebuggerTab::~DebuggerTab()
77 // Save / Update the settings from the tabs dialog
78 void DebuggerTab::SetSettings(void)
82 strcpy(vjs
.debuggerROMPath
, vjs
.alpineROMPath
);
83 strcpy(vjs
.sourcefilesearchPaths
, CheckForTrailingSlash(sourcefilesearchpaths
->text()).toUtf8().data());
84 vjs
.nbrdisasmlines
= nbrdisasmlines
->text().toUInt(&ok
, 10);
85 vjs
.displayHWlabels
= displayHWlabels
->isChecked();
86 vjs
.disasmopcodes
= disasmopcodes
->isChecked();
87 vjs
.displayFullSourceFilename
= displayFullSourceFilename
->isChecked();
88 vjs
.ELFSectionsCheck
= ELFSectionsCheck
->isChecked();
92 // Load / Update the tabs dialog from the settings
93 void DebuggerTab::GetSettings(void)
95 QVariant
v(vjs
.nbrdisasmlines
);
96 nbrdisasmlines
->setText(v
.toString());
97 sourcefilesearchpaths
->setText(vjs
.sourcefilesearchPaths
);
98 displayHWlabels
->setChecked(vjs
.displayHWlabels
);
99 disasmopcodes
->setChecked(vjs
.disasmopcodes
);
100 displayFullSourceFilename
->setChecked(vjs
.displayFullSourceFilename
);
101 ELFSectionsCheck
->setChecked(vjs
.ELFSectionsCheck
);
105 // Remove the last character if slash or backslash at the end of each string
106 // Depend the platform transform slashes or backslashes
107 QString
DebuggerTab::CheckForTrailingSlash(QString s
)
109 if (s
.endsWith('/') || s
.endsWith('\\'))
111 s
.remove(s
.length() - 1, 1);
114 s
.replace(QString("/"), QString("\\"));
115 s
.replace(QString("\\;"), QString(";"));
117 s
.replace(QString("\\"), QString("/"));
118 s
.replace(QString("/;"), QString(";"));