2 // debuggertab.cpp: "Debugger" tab on the settings dialog
6 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
7 // RG = Richard Goedeken
10 // --- ---------- ------------------------------------------------------------
11 // JPM Sept./2016 Created this file, and added Soft debugger support
12 // JPM 10/09/2018 Added source file search paths
13 // JPM 04/06/2019 Added ELF sections check
14 // RG Jan./2021 Linux build fix
17 #include "debuggertab.h"
22 DebuggerTab::DebuggerTab(QWidget
* parent
/*= 0*/): QWidget(parent
)
24 // Number of disassembly lines
25 QLabel
*label3
= new QLabel("Disassembly lines:");
26 QVBoxLayout
*layout1
= new QVBoxLayout
;
27 layout1
->addWidget(label3
);
28 QVBoxLayout
*layout2
= new QVBoxLayout
;
29 nbrdisasmlines
= new QLineEdit("");
30 nbrdisasmlines
->setPlaceholderText("Number of disassembly lines");
31 layout2
->addWidget(nbrdisasmlines
);
34 QLabel
*label4
= new QLabel("Source file search paths:");
35 QVBoxLayout
*layout5
= new QVBoxLayout
;
36 layout5
->addWidget(label4
);
37 QVBoxLayout
*layout6
= new QVBoxLayout
;
38 sourcefilesearchpaths
= new QLineEdit("");
39 sourcefilesearchpaths
->setMaxLength(sizeof(vjs
.sourcefilesearchPaths
));
40 sourcefilesearchpaths
->setPlaceholderText("Each path must be separate by a ';', search is recursive and based on each path");
41 layout6
->addWidget(sourcefilesearchpaths
);
43 QHBoxLayout
*layout3
= new QHBoxLayout
;
44 layout3
->addLayout(layout1
);
45 layout3
->addLayout(layout2
);
46 QHBoxLayout
*layout7
= new QHBoxLayout
;
47 layout7
->addLayout(layout5
);
48 layout7
->addLayout(layout6
);
50 QVBoxLayout
*layout4
= new QVBoxLayout
;
51 layout4
->addLayout(layout3
);
52 layout4
->addLayout(layout7
);
55 displayHWlabels
= new QCheckBox(tr("Display HW labels"));
56 disasmopcodes
= new QCheckBox(tr("Display M68000 opcodes"));
57 displayFullSourceFilename
= new QCheckBox(tr("Display source filename"));
58 ELFSectionsCheck
= new QCheckBox(tr("ELF sections check"));
59 disasmopcodes
->setDisabled(false);
60 displayHWlabels
->setDisabled(false);
61 displayFullSourceFilename
->setDisabled(false);
62 ELFSectionsCheck
->setDisabled(false);
64 layout4
->addWidget(disasmopcodes
);
65 layout4
->addWidget(displayHWlabels
);
66 layout4
->addWidget(displayFullSourceFilename
);
67 layout4
->addWidget(ELFSectionsCheck
);
74 DebuggerTab::~DebuggerTab()
79 // Save / Update the settings from the tabs dialog
80 void DebuggerTab::SetSettings(void)
84 strcpy(vjs
.debuggerROMPath
, vjs
.alpineROMPath
);
85 strcpy(vjs
.sourcefilesearchPaths
, CheckForTrailingSlash(sourcefilesearchpaths
->text()).toUtf8().data());
86 vjs
.nbrdisasmlines
= nbrdisasmlines
->text().toUInt(&ok
, 10);
87 vjs
.displayHWlabels
= displayHWlabels
->isChecked();
88 vjs
.disasmopcodes
= disasmopcodes
->isChecked();
89 vjs
.displayFullSourceFilename
= displayFullSourceFilename
->isChecked();
90 vjs
.ELFSectionsCheck
= ELFSectionsCheck
->isChecked();
94 // Load / Update the tabs dialog from the settings
95 void DebuggerTab::GetSettings(void)
97 QVariant
v((qulonglong
) vjs
.nbrdisasmlines
);
98 nbrdisasmlines
->setText(v
.toString());
99 sourcefilesearchpaths
->setText(vjs
.sourcefilesearchPaths
);
100 displayHWlabels
->setChecked(vjs
.displayHWlabels
);
101 disasmopcodes
->setChecked(vjs
.disasmopcodes
);
102 displayFullSourceFilename
->setChecked(vjs
.displayFullSourceFilename
);
103 ELFSectionsCheck
->setChecked(vjs
.ELFSectionsCheck
);
107 // Remove the last character if slash or backslash at the end of each string
108 // Depend the platform transform slashes or backslashes
109 QString
DebuggerTab::CheckForTrailingSlash(QString s
)
111 if (s
.endsWith('/') || s
.endsWith('\\'))
113 s
.remove(s
.length() - 1, 1);
116 s
.replace(QString("/"), QString("\\"));
117 s
.replace(QString("\\;"), QString(";"));
119 s
.replace(QString("\\"), QString("/"));
120 s
.replace(QString("/;"), QString(";"));