Added search paths in case of missing DWARF directories information
[clinton/Virtual-Jaguar-Rx.git] / src / debugger / debuggertab.cpp
CommitLineData
024bfc46
JPM
1//\r
2// debuggertab.cpp: "Debugger" tab on the settings dialog\r
3//\r
4// by Jean-Paul Mari\r
5//\r
6// JPM = Jean-Paul Mari <djipi.mari@gmail.com>\r
7//\r
8// WHO WHEN WHAT\r
9// --- ---------- ------------------------------------------------------------\r
f0dd2f7b
JPM
10// JPM Sept./2016 Created this file, and added Soft debugger support\r
11// JPM 10/09/2018 Added source file search paths\r
bc10fc42 12//\r
024bfc46
JPM
13\r
14#include "debuggertab.h"\r
15#include "settings.h"\r
16\r
17\r
f0dd2f7b 18// \r
024bfc46
JPM
19DebuggerTab::DebuggerTab(QWidget * parent/*= 0*/): QWidget(parent)\r
20{\r
f0dd2f7b
JPM
21 // Number of disassembly lines\r
22 QLabel *label3 = new QLabel("Disassembly lines:");\r
23 QVBoxLayout *layout1 = new QVBoxLayout;\r
024bfc46 24 layout1->addWidget(label3);\r
f0dd2f7b
JPM
25 QVBoxLayout *layout2 = new QVBoxLayout;\r
26 nbrdisasmlines = new QLineEdit("");\r
27 nbrdisasmlines->setPlaceholderText("Number of disassembly lines");\r
28 layout2->addWidget(nbrdisasmlines);\r
29\r
30 // Sources code paths\r
31 QLabel *label4 = new QLabel("Source file search paths:");\r
32 QVBoxLayout *layout5 = new QVBoxLayout;\r
33 layout5->addWidget(label4);\r
34 QVBoxLayout *layout6 = new QVBoxLayout;\r
35 sourcefilesearchpaths = new QLineEdit("");\r
36 sourcefilesearchpaths->setMaxLength(sizeof(vjs.sourcefilesearchPaths));\r
37 sourcefilesearchpaths->setPlaceholderText("Each path must be separate by a ';', search is recursive and based on each path");\r
38 layout6->addWidget(sourcefilesearchpaths);\r
39\r
40 QHBoxLayout *layout3 = new QHBoxLayout;\r
024bfc46
JPM
41 layout3->addLayout(layout1);\r
42 layout3->addLayout(layout2);\r
f0dd2f7b
JPM
43 QHBoxLayout *layout7 = new QHBoxLayout;\r
44 layout7->addLayout(layout5);\r
45 layout7->addLayout(layout6);\r
024bfc46 46\r
f0dd2f7b 47 QVBoxLayout *layout4 = new QVBoxLayout;\r
024bfc46 48 layout4->addLayout(layout3);\r
f0dd2f7b 49 layout4->addLayout(layout7);\r
024bfc46 50\r
f0dd2f7b 51 // Checkboxes\r
024bfc46
JPM
52 displayHWlabels = new QCheckBox(tr("Display HW labels"));\r
53 disasmopcodes = new QCheckBox(tr("Display M68000 opcodes"));\r
54 displayFullSourceFilename = new QCheckBox(tr("Display source filename"));\r
55 disasmopcodes->setDisabled(false);\r
56 displayHWlabels->setDisabled(false);\r
57 displayFullSourceFilename->setDisabled(false);\r
58\r
59 layout4->addWidget(disasmopcodes);\r
60 layout4->addWidget(displayHWlabels);\r
61 layout4->addWidget(displayFullSourceFilename);\r
62\r
63 setLayout(layout4);\r
64}\r
65\r
66\r
f0dd2f7b 67// \r
024bfc46
JPM
68DebuggerTab::~DebuggerTab()\r
69{\r
70}\r
71\r
72\r
2d0121d4
JPM
73// Save / Update the settings from the tabs dialog\r
74void DebuggerTab::SetSettings(void)\r
75{\r
76 bool ok;\r
77\r
d9989fae 78 strcpy(vjs.debuggerROMPath, vjs.alpineROMPath);\r
f0dd2f7b
JPM
79 strcpy(vjs.sourcefilesearchPaths, CheckForTrailingSlash(sourcefilesearchpaths->text()).toUtf8().data());\r
80 vjs.nbrdisasmlines = nbrdisasmlines->text().toUInt(&ok, 10);\r
2d0121d4
JPM
81 vjs.displayHWlabels = displayHWlabels->isChecked();\r
82 vjs.disasmopcodes = disasmopcodes->isChecked();\r
83 vjs.displayFullSourceFilename = displayFullSourceFilename->isChecked();\r
84}\r
85\r
86\r
87// Load / Update the tabs dialog from the settings\r
88void DebuggerTab::GetSettings(void)\r
89{\r
90 QVariant v(vjs.nbrdisasmlines);\r
f0dd2f7b
JPM
91 nbrdisasmlines->setText(v.toString());\r
92 sourcefilesearchpaths->setText(vjs.sourcefilesearchPaths);\r
2d0121d4
JPM
93 displayHWlabels->setChecked(vjs.displayHWlabels);\r
94 disasmopcodes->setChecked(vjs.disasmopcodes);\r
95 displayFullSourceFilename->setChecked(vjs.displayFullSourceFilename);\r
96}\r
97\r
f0dd2f7b
JPM
98\r
99// Remove the last character if slash or backslash at the end of each string\r
100// Depend the platform transform slashes or backslashes\r
101QString DebuggerTab::CheckForTrailingSlash(QString s)\r
102{\r
103 if (s.endsWith('/') || s.endsWith('\\'))\r
104 {\r
105 s.remove(s.length() - 1, 1);\r
106 }\r
107#ifdef _WIN32\r
108 s.replace(QString("/"), QString("\\"));\r
109 s.replace(QString("\\;"), QString(";"));\r
110#else\r
111 s.replace(QString("\\"), QString("/"));\r
112 s.replace(QString("/;"), QString(";"));\r
113#endif\r
114 return s;\r
115}\r