diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 67c3f6795..e265de612 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -88,6 +88,9 @@ add_library(ui STATIC qt_specifydimensions.h qt_specifydimensions.cpp qt_specifydimensions.ui + qt_soundgain.hpp + qt_soundgain.cpp + qt_soundgain.ui ../qt_resources.qrc ) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 49eb3a951..ad7fa7497 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -2,6 +2,7 @@ #include "ui_qt_mainwindow.h" #include "qt_specifydimensions.h" +#include "qt_soundgain.hpp" extern "C" { #include <86box/86box.h> @@ -1272,3 +1273,9 @@ void MainWindow::on_actionTake_screenshot_triggered() endblit(); device_force_redraw(); } + +void MainWindow::on_actionSound_gain_triggered() +{ + SoundGain gain(this); + gain.exec(); +} diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index b71704831..5a4582442 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -97,6 +97,8 @@ private slots: void getTitle_(wchar_t* title); void on_actionTake_screenshot_triggered(); + void on_actionSound_gain_triggered(); + protected: void keyPressEvent(QKeyEvent* event) override; void keyReleaseEvent(QKeyEvent* event) override; diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index f44841b4f..49f3e7e43 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -81,6 +81,7 @@ + @@ -512,6 +513,11 @@ Take screenshot... + + + Sound gain... + + diff --git a/src/qt/qt_soundgain.cpp b/src/qt/qt_soundgain.cpp new file mode 100644 index 000000000..9f02608e7 --- /dev/null +++ b/src/qt/qt_soundgain.cpp @@ -0,0 +1,35 @@ +#include "qt_soundgain.hpp" +#include "ui_qt_soundgain.h" + +extern "C" +{ +#include <86box/86box.h> +#include <86box/plat.h> +#include <86box/sound.h> +} + +SoundGain::SoundGain(QWidget *parent) : + QDialog(parent), + ui(new Ui::SoundGain) +{ + ui->setupUi(this); + ui->verticalSlider->setValue(sound_gain); + sound_gain_orig = sound_gain; +} + +SoundGain::~SoundGain() +{ + delete ui; +} + +void SoundGain::on_verticalSlider_valueChanged(int value) +{ + sound_gain = value; +} + + +void SoundGain::on_SoundGain_rejected() +{ + sound_gain = sound_gain_orig; +} + diff --git a/src/qt/qt_soundgain.hpp b/src/qt/qt_soundgain.hpp new file mode 100644 index 000000000..0e19bab53 --- /dev/null +++ b/src/qt/qt_soundgain.hpp @@ -0,0 +1,28 @@ +#ifndef QT_SOUNDGAIN_HPP +#define QT_SOUNDGAIN_HPP + +#include + +namespace Ui { +class SoundGain; +} + +class SoundGain : public QDialog +{ + Q_OBJECT + +public: + explicit SoundGain(QWidget *parent = nullptr); + ~SoundGain(); + +private slots: + void on_verticalSlider_valueChanged(int value); + + void on_SoundGain_rejected(); + +private: + Ui::SoundGain *ui; + int sound_gain_orig; +}; + +#endif // QT_SOUNDGAIN_HPP diff --git a/src/qt/qt_soundgain.ui b/src/qt/qt_soundgain.ui new file mode 100644 index 000000000..b15ce911e --- /dev/null +++ b/src/qt/qt_soundgain.ui @@ -0,0 +1,109 @@ + + + SoundGain + + + + 0 + 0 + 262 + 279 + + + + Sound Gain + + + + + 150 + 20 + 81 + 241 + + + + Qt::Vertical + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 30 + 30 + 31 + 231 + + + + 18 + + + 2 + + + 4 + + + Qt::Vertical + + + false + + + QSlider::TicksBothSides + + + + + + 30 + 10 + 54 + 17 + + + + Gain: + + + + + + + buttonBox + accepted() + SoundGain + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SoundGain + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/qt/qt_specifydimensions.ui b/src/qt/qt_specifydimensions.ui index 56240a46e..855b9f3b7 100644 --- a/src/qt/qt_specifydimensions.ui +++ b/src/qt/qt_specifydimensions.ui @@ -11,7 +11,7 @@ - Dialog + Specify Main Window Dimensions