mirror of https://github.com/mgba-emu/mgba.git
Qt: Move shader settings into main settings window
This commit is contained in:
parent
780f36c837
commit
f920afdfe2
1
CHANGES
1
CHANGES
|
@ -168,6 +168,7 @@ Misc:
|
|||
- GBA Timer: Improve accuracy of timers
|
||||
- Qt: Minor test fixes
|
||||
- PSP2: Update toolchain to use vita.cmake
|
||||
- Qt: Move shader settings into main settings window
|
||||
|
||||
0.6 beta 1: (2017-06-29)
|
||||
- Initial beta for 0.6
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "GBAApp.h"
|
||||
#include "GBAKeyEditor.h"
|
||||
#include "InputController.h"
|
||||
#include "ShaderSelector.h"
|
||||
#include "ShortcutView.h"
|
||||
|
||||
#include <mgba/core/serialize.h>
|
||||
|
@ -185,6 +186,20 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
|
|||
m_ui.tabs->addItem(tr("Shortcuts"));
|
||||
}
|
||||
|
||||
SettingsView::~SettingsView() {
|
||||
if (m_shader) {
|
||||
m_ui.stackedWidget->removeWidget(m_shader);
|
||||
m_shader->setParent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
|
||||
m_shader = shaderSelector;
|
||||
m_ui.stackedWidget->addWidget(m_shader);
|
||||
m_ui.tabs->addItem(tr("Shaders"));
|
||||
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved);
|
||||
}
|
||||
|
||||
void SettingsView::selectBios(QLineEdit* bios) {
|
||||
QString filename = GBAApp::app()->getOpenFileName(this, tr("Select BIOS"));
|
||||
if (!filename.isEmpty()) {
|
||||
|
|
|
@ -17,12 +17,16 @@ namespace QGBA {
|
|||
class ConfigController;
|
||||
class InputController;
|
||||
class ShortcutController;
|
||||
class ShaderSelector;
|
||||
|
||||
class SettingsView : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, QWidget* parent = nullptr);
|
||||
~SettingsView();
|
||||
|
||||
void setShaderSelector(ShaderSelector* shaderSelector);
|
||||
|
||||
signals:
|
||||
void biosLoaded(int platform, const QString&);
|
||||
|
@ -42,6 +46,7 @@ private:
|
|||
|
||||
ConfigController* m_controller;
|
||||
InputController* m_input;
|
||||
ShaderSelector* m_shader = nullptr;
|
||||
|
||||
void saveSetting(const char* key, const QAbstractButton*);
|
||||
void saveSetting(const char* key, const QComboBox*);
|
||||
|
|
|
@ -39,6 +39,9 @@ ShaderSelector::ShaderSelector(Display* display, ConfigController* config, QWidg
|
|||
connect(m_ui.load, &QAbstractButton::clicked, this, &ShaderSelector::selectShader);
|
||||
connect(m_ui.unload, &QAbstractButton::clicked, this, &ShaderSelector::clearShader);
|
||||
connect(m_ui.buttonBox, &QDialogButtonBox::clicked, this, &ShaderSelector::buttonPressed);
|
||||
connect(this, &ShaderSelector::saved, [this]() {
|
||||
m_config->setOption("shader", m_shaderPath);
|
||||
});
|
||||
}
|
||||
|
||||
ShaderSelector::~ShaderSelector() {
|
||||
|
@ -86,7 +89,6 @@ void ShaderSelector::clearShader() {
|
|||
m_display->clearShaders();
|
||||
refreshShaders();
|
||||
m_shaderPath = "";
|
||||
m_config->setOption("shader", nullptr);
|
||||
}
|
||||
|
||||
void ShaderSelector::refreshShaders() {
|
||||
|
@ -115,6 +117,10 @@ void ShaderSelector::refreshShaders() {
|
|||
disconnect(this, &ShaderSelector::reset, 0, 0);
|
||||
disconnect(this, &ShaderSelector::resetToDefault, 0, 0);
|
||||
|
||||
connect(this, &ShaderSelector::saved, [this]() {
|
||||
m_config->setOption("shader", m_shaderPath);
|
||||
});
|
||||
|
||||
#if !defined(_WIN32) || defined(USE_EPOXY)
|
||||
if (m_shaders->preprocessShader) {
|
||||
m_ui.passes->addTab(makePage(static_cast<mGLES2Shader*>(m_shaders->preprocessShader), "default", 0), tr("Preprocessing"));
|
||||
|
@ -264,7 +270,6 @@ void ShaderSelector::buttonPressed(QAbstractButton* button) {
|
|||
emit reset();
|
||||
break;
|
||||
case QDialogButtonBox::Ok:
|
||||
m_config->setOption("shader", m_shaderPath);
|
||||
emit saved();
|
||||
close();
|
||||
break;
|
||||
|
|
|
@ -81,33 +81,36 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="unload">
|
||||
<property name="text">
|
||||
<string>Unload Shader</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="load">
|
||||
<property name="text">
|
||||
<string>Load New Shader</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -177,7 +177,6 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
|
|||
connect(this, &Window::shutdown, m_display, &Display::stopDrawing);
|
||||
connect(this, &Window::shutdown, m_controller, &GameController::closeGame);
|
||||
connect(this, &Window::shutdown, m_logView, &QWidget::hide);
|
||||
connect(this, &Window::shutdown, m_shaderView, &QWidget::hide);
|
||||
connect(this, &Window::audioBufferSamplesChanged, m_controller, &GameController::setAudioBufferSamples);
|
||||
connect(this, &Window::sampleRateChanged, m_controller, &GameController::setAudioSampleRate);
|
||||
connect(this, &Window::fpsTargetChanged, m_controller, &GameController::setFPSTarget);
|
||||
|
@ -460,6 +459,9 @@ void Window::exportSharkport() {
|
|||
|
||||
void Window::openSettingsWindow() {
|
||||
SettingsView* settingsWindow = new SettingsView(m_config, &m_inputController, m_shortcutController);
|
||||
if (m_display->supportsShaders()) {
|
||||
settingsWindow->setShaderSelector(m_shaderView);
|
||||
}
|
||||
connect(settingsWindow, &SettingsView::biosLoaded, m_controller, &GameController::loadBIOS);
|
||||
connect(settingsWindow, &SettingsView::audioDriverChanged, m_controller, &GameController::reloadAudioDriver);
|
||||
connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::mustRestart);
|
||||
|
@ -1296,13 +1298,6 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
}
|
||||
m_config->updateOption("frameskip");
|
||||
|
||||
QAction* shaderView = new QAction(tr("Shader options..."), avMenu);
|
||||
connect(shaderView, &QAction::triggered, m_shaderView, &QWidget::show);
|
||||
if (!m_display->supportsShaders()) {
|
||||
shaderView->setEnabled(false);
|
||||
}
|
||||
addControlledAction(avMenu, shaderView, "shaderSelector");
|
||||
|
||||
avMenu->addSeparator();
|
||||
|
||||
ConfigOption* mute = m_config->addOption("mute");
|
||||
|
|
Loading…
Reference in New Issue