Sound gain dialog

This commit is contained in:
Cacodemon345
2021-12-12 16:22:35 +06:00
parent 457751d108
commit 080bc8682f
8 changed files with 191 additions and 1 deletions

View File

@@ -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
)

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -81,6 +81,7 @@
<addaction name="actionUpdate_status_bar_icons"/>
<addaction name="separator"/>
<addaction name="actionTake_screenshot"/>
<addaction name="actionSound_gain"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
@@ -512,6 +513,11 @@
<string>Take screenshot...</string>
</property>
</action>
<action name="actionSound_gain">
<property name="text">
<string>Sound gain...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

35
src/qt/qt_soundgain.cpp Normal file
View File

@@ -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;
}

28
src/qt/qt_soundgain.hpp Normal file
View File

@@ -0,0 +1,28 @@
#ifndef QT_SOUNDGAIN_HPP
#define QT_SOUNDGAIN_HPP
#include <QDialog>
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

109
src/qt/qt_soundgain.ui Normal file
View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SoundGain</class>
<widget class="QDialog" name="SoundGain">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>262</width>
<height>279</height>
</rect>
</property>
<property name="windowTitle">
<string>Sound Gain</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>81</width>
<height>241</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QSlider" name="verticalSlider">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>31</width>
<height>231</height>
</rect>
</property>
<property name="maximum">
<number>18</number>
</property>
<property name="singleStep">
<number>2</number>
</property>
<property name="pageStep">
<number>4</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>10</y>
<width>54</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Gain:</string>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SoundGain</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SoundGain</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Specify Main Window Dimensions</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">