Skip to content

Commit c560cfb

Browse files
committed
full usb support, does not yet disable in the control panel
1 parent 252870e commit c560cfb

File tree

10 files changed

+299
-199
lines changed

10 files changed

+299
-199
lines changed

controlpanel.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
#include "machineprocess.h"
3535
#include "settingstab.h"
3636
#include "machineview.h"
37+
#include "usbpage.h"
38+
#include "usbmodel.h"
3739

3840
#include <QFileDialog>
41+
#include <QStandardItemModel>
3942

4043
ControlPanel::ControlPanel(MachineTab *parent)
4144
: QWidget(parent)
@@ -45,6 +48,12 @@ ControlPanel::ControlPanel(MachineTab *parent)
4548
config = parent->machineConfigObject;
4649
registerObjects();
4750
makeConnections();
51+
52+
QPalette listPalette = usbView->palette();
53+
QColor transparent = QColor();
54+
transparent.setAlpha(0);
55+
listPalette.setColor(QPalette::Base, transparent);
56+
usbView->setPalette(listPalette);
4857
}
4958

5059

@@ -58,6 +67,7 @@ void ControlPanel::makeConnections()
5867
connect(mediaButton, SIGNAL(clicked()), this, SLOT(mediaActivate()));
5968
//connect(optionButton, SIGNAL(clicked()), this, SLOT(optionActivate()));
6069
connect(displayButton, SIGNAL(clicked()), this, SLOT(displayActivate()));
70+
connect(usbButton, SIGNAL(clicked()), this, SLOT(usbActivate()));
6171

6272
//action connections
6373
connect(cdReloadButton, SIGNAL(clicked()), parent->machineProcess, SLOT(changeCdrom()));
@@ -81,14 +91,14 @@ void ControlPanel::mediaActivate()
8191
controlStack->setCurrentIndex(0);
8292
}
8393

84-
void ControlPanel::optionActivate()
94+
void ControlPanel::displayActivate()
8595
{
86-
controlStack->setCurrentIndex(1);
96+
controlStack->setCurrentIndex(2);
8797
}
8898

89-
void ControlPanel::displayActivate()
99+
void ControlPanel::usbActivate()
90100
{
91-
controlStack->setCurrentIndex(2);
101+
controlStack->setCurrentIndex(1);
92102
}
93103

94104
void ControlPanel::registerObjects()
@@ -97,7 +107,11 @@ void ControlPanel::registerObjects()
97107
config->registerObject(floppyCombo, "floppy");
98108
config->registerObject(mouseButton, "mouse");
99109
config->registerObject(scaleButton, "scaleEmbeddedDisplay");
100-
110+
config->registerObject(addDevices, "autoAddDevices");
111+
112+
//connect the usb view to the model.
113+
usbView->setModel(parent->settingsTab->getUsbPage()->getModel());
114+
101115
}
102116

103117
void ControlPanel::saveScreenshot()
@@ -122,3 +136,11 @@ void ControlPanel::stopped()
122136
fullscreenButton->setEnabled(false);
123137
screenshotButton->setEnabled(false);
124138
}
139+
140+
void ControlPanel::optionChanged(const QString &nodeType, const QString &nodeName, const QString &optionName, const QVariant &value)
141+
{
142+
if(optionName == "autoAddDevices")
143+
{
144+
usbView->setEnabled(config->getOption("autoAddDevices", true).toBool());
145+
}
146+
}

controlpanel.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ Q_OBJECT
5656
MachineConfigObject *config;
5757
private slots:
5858
void mediaActivate();
59-
void optionActivate();
6059
void displayActivate();
60+
void usbActivate();
6161
void saveScreenshot();
6262
void running();
6363
void stopped();
64+
65+
void optionChanged(const QString &nodeType, const QString &nodeName, const QString &optionName, const QVariant &value);
6466
};
6567

6668
#endif

settingstab.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,8 @@ void SettingsTab::disableUnsupportedOptions()
223223
// netPage->netAccelCheck->setChecked(false);
224224
}
225225
}
226+
227+
UsbPage* SettingsTab::getUsbPage()
228+
{
229+
return usbPageWidget;
230+
}

settingstab.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Q_OBJECT
4444

4545
~SettingsTab();
4646

47+
UsbPage *getUsbPage();
48+
4749
public slots:
4850
void setNewCdImagePath();
4951
void setNewFloppyImagePath();

0 commit comments

Comments
 (0)