Qt: Add camera driver option
Vicki Pfau vi@endrift.com
Fri, 28 Jul 2017 13:44:47 -0700
4 files changed,
193 insertions(+),
0 deletions(-)
M
src/platform/qt/SettingsView.cpp
→
src/platform/qt/SettingsView.cpp
@@ -130,15 +130,40 @@ m_ui.displayDriver->setCurrentIndex(m_ui.displayDriver->count() - 1);
} #endif + // TODO: Move to reloadConfig() + QVariant cameraDriver = m_controller->getQtOption("cameraDriver"); + m_ui.cameraDriver->addItem(tr("None (Still Image)"), static_cast<int>(InputController::CameraDriver::NONE)); + if (cameraDriver.isNull() || cameraDriver.toInt() == static_cast<int>(InputController::CameraDriver::NONE)) { + m_ui.cameraDriver->setCurrentIndex(m_ui.cameraDriver->count() - 1); + } + +#ifdef BUILD_QT_MULTIMEDIA + m_ui.cameraDriver->addItem(tr("Qt Multimedia"), static_cast<int>(InputController::CameraDriver::QT_MULTIMEDIA)); + if (!cameraDriver.isNull() && cameraDriver.toInt() == static_cast<int>(InputController::CameraDriver::QT_MULTIMEDIA)) { + m_ui.cameraDriver->setCurrentIndex(m_ui.cameraDriver->count() - 1); + } +#endif + +#ifdef M_CORE_GBA connect(m_ui.gbaBiosBrowse, &QPushButton::clicked, [this]() { selectBios(m_ui.gbaBios); }); +#else + m_ui.gbaBiosBrowse->hide(); +#endif + +#ifdef M_CORE_GB connect(m_ui.gbBiosBrowse, &QPushButton::clicked, [this]() { selectBios(m_ui.gbBios); }); connect(m_ui.gbcBiosBrowse, &QPushButton::clicked, [this]() { selectBios(m_ui.gbcBios); }); +#else + m_ui.gbBiosBrowse->hide(); + m_ui.gbcBiosBrowse->hide(); + m_ui.gb->hide(); +#endif GBAKeyEditor* editor = new GBAKeyEditor(inputController, InputController::KEYBOARD, QString(), this); m_ui.stackedWidget->addWidget(editor);@@ -292,6 +317,12 @@ m_controller->setQtOption("displayDriver", displayDriver);
Display::setDriver(static_cast<Display::Driver>(displayDriver.toInt())); setShaderSelector(nullptr); emit displayDriverChanged(); + } + + QVariant cameraDriver = m_ui.cameraDriver->itemData(m_ui.cameraDriver->currentIndex()); + if (cameraDriver != m_controller->getQtOption("cameraDriver")) { + m_controller->setQtOption("cameraDriver", cameraDriver); + emit cameraDriverChanged(); } QLocale language = m_ui.languages->itemData(m_ui.languages->currentIndex()).toLocale();
M
src/platform/qt/SettingsView.h
→
src/platform/qt/SettingsView.h
@@ -32,6 +32,7 @@ signals:
void biosLoaded(int platform, const QString&); void audioDriverChanged(); void displayDriverChanged(); + void cameraDriverChanged(); void pathsChanged(); void languageChanged(); void libraryCleared();
M
src/platform/qt/SettingsView.ui
→
src/platform/qt/SettingsView.ui
@@ -65,6 +65,11 @@ <property name="text">
<string>Paths</string> </property> </item> + <item> + <property name="text"> + <string>Game Boy</string> + </property> + </item> </widget> </item> <item row="2" column="0" colspan="2">@@ -1005,6 +1010,161 @@ <item row="11" column="1">
<widget class="QCheckBox" name="patchSameDir"> <property name="text"> <string>Same directory as the ROM</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="gb"> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_29"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Default model</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="gbModel"> + <property name="enabled"> + <bool>false</bool> + </property> + <item> + <property name="text"> + <string>Autodetect</string> + </property> + </item> + <item> + <property name="text"> + <string>Game Boy (DMG)</string> + </property> + </item> + <item> + <property name="text"> + <string>Game Boy Color (CGB)</string> + </property> + </item> + <item> + <property name="text"> + <string>Game Boy Advance (AGB)</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_28"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Default colors</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <item> + <widget class="QFrame" name="color0"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="color1"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="color2"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="color3"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0" colspan="2"> + <widget class="Line" name="line_11"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_27"> + <property name="text"> + <string>Camera driver</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="cameraDriver"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> </widget> </item>
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -402,6 +402,7 @@ }
#endif connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::reloadDisplayDriver); connect(settingsWindow, &SettingsView::audioDriverChanged, this, &Window::reloadAudioDriver); + connect(settingsWindow, &SettingsView::cameraDriverChanged, this, &Window::mustRestart); connect(settingsWindow, &SettingsView::languageChanged, this, &Window::mustRestart); connect(settingsWindow, &SettingsView::pathsChanged, this, &Window::reloadConfig); connect(settingsWindow, &SettingsView::libraryCleared, m_libraryView, &LibraryController::clear);