34
34
#include " machineprocess.h"
35
35
#include " settingstab.h"
36
36
#include " machineview.h"
37
+ #include " usbpage.h"
38
+ #include " usbmodel.h"
37
39
38
40
#include < QFileDialog>
41
+ #include < QStandardItemModel>
39
42
40
43
ControlPanel::ControlPanel (MachineTab *parent)
41
44
: QWidget(parent)
@@ -45,6 +48,12 @@ ControlPanel::ControlPanel(MachineTab *parent)
45
48
config = parent->machineConfigObject ;
46
49
registerObjects ();
47
50
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);
48
57
}
49
58
50
59
@@ -58,6 +67,7 @@ void ControlPanel::makeConnections()
58
67
connect (mediaButton, SIGNAL (clicked ()), this , SLOT (mediaActivate ()));
59
68
// connect(optionButton, SIGNAL(clicked()), this, SLOT(optionActivate()));
60
69
connect (displayButton, SIGNAL (clicked ()), this , SLOT (displayActivate ()));
70
+ connect (usbButton, SIGNAL (clicked ()), this , SLOT (usbActivate ()));
61
71
62
72
// action connections
63
73
connect (cdReloadButton, SIGNAL (clicked ()), parent->machineProcess , SLOT (changeCdrom ()));
@@ -81,14 +91,14 @@ void ControlPanel::mediaActivate()
81
91
controlStack->setCurrentIndex (0 );
82
92
}
83
93
84
- void ControlPanel::optionActivate ()
94
+ void ControlPanel::displayActivate ()
85
95
{
86
- controlStack->setCurrentIndex (1 );
96
+ controlStack->setCurrentIndex (2 );
87
97
}
88
98
89
- void ControlPanel::displayActivate ()
99
+ void ControlPanel::usbActivate ()
90
100
{
91
- controlStack->setCurrentIndex (2 );
101
+ controlStack->setCurrentIndex (1 );
92
102
}
93
103
94
104
void ControlPanel::registerObjects ()
@@ -97,7 +107,11 @@ void ControlPanel::registerObjects()
97
107
config->registerObject (floppyCombo, " floppy" );
98
108
config->registerObject (mouseButton, " mouse" );
99
109
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
+
101
115
}
102
116
103
117
void ControlPanel::saveScreenshot ()
@@ -122,3 +136,11 @@ void ControlPanel::stopped()
122
136
fullscreenButton->setEnabled (false );
123
137
screenshotButton->setEnabled (false );
124
138
}
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
+ }
0 commit comments