Handle number of M68K cycles used when tracing in debugger mode
[clinton/Virtual-Jaguar-Rx.git] / src / gui / configdialog.cpp
CommitLineData
cf76e892
JPM
1//
2// configdialog.cpp - Configuration dialog
3//
4// by James Hammons
5// (C) 2010 Underground Software
6//
7// JLH = James Hammons <jlhamm@acm.org>
8// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
c4fe5864 9// RG = Richard Goedeken
cf76e892
JPM
10//
11// Who When What
12// --- ---------- ------------------------------------------------------------
13// JLH 01/29/2010 Created this file
14// JLH 06/23/2011 Added initial implementation
15// JLH 10/14/2011 Fixed possibly missing final slash in paths
16// JPM 06/06/2016 Visual Studio support
17// JPM 06/19/2016 Soft debugger support
bc10fc42
JPM
18// JPM 09/ /2017 Added a Keybindings tab
19// JPM 09/03/2018 Added a Models & Bios tab
c4fe5864 20// RG Jan./2021 Linux build fix
cf76e892
JPM
21//
22
23#include "configdialog.h"
cf76e892 24#include "alpinetab.h"
5fe21518 25#include "debugger/debuggertab.h"
cf76e892
JPM
26#include "controllertab.h"
27#include "controllerwidget.h"
28#include "generaltab.h"
bc10fc42 29#include "modelsbiostab.h"
c89f8ff7 30#include "keybindingstab.h"
cf76e892
JPM
31#include "settings.h"
32
33
024bfc46
JPM
34ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/) : QDialog(parent),
35tabWidget(new QTabWidget),
36generalTab(new GeneralTab(this)),
bc10fc42
JPM
37#ifdef NEWMODELSBIOSHANDLER
38modelsbiosTab(new ModelsBiosTab),
39#endif
024bfc46
JPM
40controllerTab1(new ControllerTab(this)),
41keybindingsTab(new KeyBindingsTab(this))
cf76e892
JPM
42{
43// tabWidget = new QTabWidget;
44// generalTab = new GeneralTab(this);
45// controllerTab1 = new ControllerTab(this);
46//// controllerTab2 = new ControllerTab(this);
47
48// if (vjs.hardwareTypeAlpine)
49// alpineTab = new AlpineTab(this);
50
51 tabWidget->addTab(generalTab, tr("General"));
bc10fc42 52#ifdef NEWMODELSBIOSHANDLER
57f40036 53 tabWidget->addTab(modelsbiosTab, tr("Models and BIOS"));
bc10fc42 54#endif
cf76e892
JPM
55 tabWidget->addTab(controllerTab1, tr("Controllers"));
56// tabWidget->addTab(controllerTab2, tr("Controller #2"));
57f40036 57 tabWidget->addTab(keybindingsTab, tr("Key Bindings"));
cf76e892
JPM
58
59 if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger)
60 {
61 alpineTab = new AlpineTab(this);
62 tabWidget->addTab(alpineTab, tr("Alpine"));
63 }
64
65 if (vjs.softTypeDebugger)
66 {
67 debuggerTab = new DebuggerTab(this);
68 tabWidget->addTab(debuggerTab, tr("Debugger"));
69 }
70
71 buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
72
73 connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
74 connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
75
76 QVBoxLayout * mainLayout = new QVBoxLayout;
77 mainLayout->addWidget(tabWidget);
78 mainLayout->addWidget(buttonBox);
79 setLayout(mainLayout);
80
81 setWindowTitle(tr("Virtual Jaguar Settings"));
82 LoadDialogFromSettings();
83}
84
85
86ConfigDialog::~ConfigDialog()
87{
88}
89
90
bc10fc42 91// Load & Update the tabs dialog from the settings
cf76e892
JPM
92void ConfigDialog::LoadDialogFromSettings(void)
93{
024bfc46
JPM
94 // General & Keybindings tab settings
95 generalTab->GetSettings();
96 keybindingsTab->GetSettings();
bc10fc42
JPM
97#ifdef NEWMODELSBIOSHANDLER
98 modelsbiosTab->GetSettings();
99#endif
cf76e892 100
024bfc46 101 // Alpine tab settings (also needed by the Debugger)
cf76e892
JPM
102 if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger)
103 {
024bfc46 104 alpineTab->GetSettings();
cf76e892
JPM
105 }
106
024bfc46 107 // Debugger tab settings
cf76e892
JPM
108 if (vjs.softTypeDebugger)
109 {
024bfc46 110 debuggerTab->GetSettings();
cf76e892
JPM
111 }
112
113#ifdef _MSC_VER
114#pragma message("Warning: !!! Need to load settings from controller profile !!!")
115#else
116#warning "!!! Need to load settings from controller profile !!!"
117#endif // _MSC_VER
118// We do this now, but not here. Need to fix this...
119#if 0
120 for(int i=0; i<21; i++)
121 {
122// We need to find the right profile and load it up here...
123 controllerTab1->controllerWidget->keys[i] = vjs.p1KeyBindings[i];
124// controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i];
125 }
126#endif
127}
128
129
bc10fc42 130// Save & Update the settings from the tabs dialog
cf76e892
JPM
131void ConfigDialog::UpdateVJSettings(void)
132{
024bfc46
JPM
133 generalTab->SetSettings();
134 keybindingsTab->SetSettings();
bc10fc42
JPM
135#ifdef NEWMODELSBIOSHANDLER
136 modelsbiosTab->SetSettings();
137#endif
cf76e892
JPM
138
139 if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger)
140 {
024bfc46 141 alpineTab->SetSettings();
cf76e892
JPM
142 }
143
144 if (vjs.softTypeDebugger)
145 {
024bfc46 146 debuggerTab->SetSettings();
cf76e892
JPM
147 }
148
149#ifdef _MSC_VER
150#pragma message("Warning: !!! Need to save settings to controller profile !!!")
151#else
152#warning "!!! Need to save settings to controller profile !!!"
153#endif // _MSC_VER
154// We do this now, but not here. Need to fix this...
155#if 0
156 for(int i=0; i<21; i++)
157 {
158// We need to find the right profile and load it up here...
159 vjs.p1KeyBindings[i] = controllerTab1->controllerWidget->keys[i];
160// vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i];
161 }
162#endif
163}
164