mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-31 16:10:33 -07:00
Merge pull request #1055 from poixen/sounds
Refreshing Cockatrice Sound
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
<file>resources/icon_config_interface.svg</file>
|
||||
<file>resources/icon_config_messages.svg</file>
|
||||
<file>resources/icon_config_deckeditor.svg</file>
|
||||
<file>resources/icon_config_sound.svg</file>
|
||||
<file>resources/phases/icon_phase_untap.svg</file>
|
||||
<file>resources/phases/icon_phase_upkeep.svg</file>
|
||||
<file>resources/phases/icon_phase_draw.svg</file>
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="62.636364"
|
||||
height="62.090908"
|
||||
id="svg2"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="icon_config_sound.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
version="1.0">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient3802">
|
||||
<stop
|
||||
style="stop-color:#fdfdfd;stop-opacity:0;"
|
||||
offset="0"
|
||||
id="stop3804" />
|
||||
<stop
|
||||
id="stop3814"
|
||||
offset="0.35707802"
|
||||
style="stop-color:#b8b8b8;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3810"
|
||||
offset="0.5"
|
||||
style="stop-color:#717171;stop-opacity:1;" />
|
||||
<stop
|
||||
style="stop-color:#b6b6b6;stop-opacity:1;"
|
||||
offset="0.64876282"
|
||||
id="stop3812" />
|
||||
<stop
|
||||
style="stop-color:#fbfbfb;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop3806" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3797">
|
||||
<stop
|
||||
id="stop3799"
|
||||
offset="0"
|
||||
style="stop-color:#000000;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3801"
|
||||
offset="1"
|
||||
style="stop-color:#656565;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3169">
|
||||
<stop
|
||||
style="stop-color:#0000ff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3171" />
|
||||
<stop
|
||||
style="stop-color:#000067;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3173" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4766">
|
||||
<stop
|
||||
style="stop-color:#784421;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop4768" />
|
||||
<stop
|
||||
style="stop-color:#3d2210;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop4770" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4758">
|
||||
<stop
|
||||
style="stop-color:#a05a2c;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop4760" />
|
||||
<stop
|
||||
style="stop-color:#3d2210;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop4762" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 526.18109 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||
id="perspective10" />
|
||||
<inkscape:perspective
|
||||
id="perspective2484"
|
||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 526.18109 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4758"
|
||||
id="linearGradient4764"
|
||||
x1="466.09601"
|
||||
y1="485.96021"
|
||||
x2="715.14801"
|
||||
y2="485.96021"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4766"
|
||||
id="linearGradient4772"
|
||||
x1="496.548"
|
||||
y1="485.26816"
|
||||
x2="683.31201"
|
||||
y2="485.26816"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3169"
|
||||
id="radialGradient3175"
|
||||
cx="120.07376"
|
||||
cy="56.138123"
|
||||
fx="120.07376"
|
||||
fy="56.138123"
|
||||
r="82.790039"
|
||||
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient6482"
|
||||
id="linearGradient6488"
|
||||
x1="32.18182"
|
||||
y1="3.2835093"
|
||||
x2="32.18182"
|
||||
y2="13.02554"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0281354,0,0,1.0429299,85.21874,131.0326)" />
|
||||
<linearGradient
|
||||
id="linearGradient6482">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6484" />
|
||||
<stop
|
||||
style="stop-color:#00ff00;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop6486" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient6464"
|
||||
id="linearGradient6470"
|
||||
x1="32.090908"
|
||||
y1="1.8181819"
|
||||
x2="31.09091"
|
||||
y2="62.909088"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(0,-0.1818182)" />
|
||||
<linearGradient
|
||||
id="linearGradient6464">
|
||||
<stop
|
||||
style="stop-color:#0061ff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6466" />
|
||||
<stop
|
||||
style="stop-color:#001c4c;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop6468" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
y2="62.909088"
|
||||
x2="31.09091"
|
||||
y1="1.8181819"
|
||||
x1="32.090908"
|
||||
gradientTransform="translate(86.2151,131.5372)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient4477"
|
||||
xlink:href="#linearGradient6464"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3802"
|
||||
id="linearGradient3808"
|
||||
x1="130.53949"
|
||||
y1="179.4781"
|
||||
x2="130.80582"
|
||||
y2="150.92148"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3802"
|
||||
id="linearGradient3031"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="130.53949"
|
||||
y1="179.4781"
|
||||
x2="130.80582"
|
||||
y2="150.92148" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.9415244"
|
||||
inkscape:cx="22.018778"
|
||||
inkscape:cy="29.620124"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="465"
|
||||
inkscape:window-height="423"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-y="584"
|
||||
inkscape:window-maximized="0"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-86.987816,-132.85536)">
|
||||
<rect
|
||||
style="fill:url(#linearGradient4477);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-opacity:1"
|
||||
id="rect6462"
|
||||
width="61.636364"
|
||||
height="61.090908"
|
||||
x="87.487816"
|
||||
y="133.35536"
|
||||
ry="5.6363635" />
|
||||
<rect
|
||||
style="fill:url(#linearGradient6488);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="rect6472"
|
||||
width="59.796619"
|
||||
height="13.251164"
|
||||
x="88.407707"
|
||||
y="134.45705"
|
||||
ry="4.7325583" />
|
||||
<g
|
||||
id="g3023"
|
||||
transform="matrix(-1,0,0,-1,235.53472,326.55032)">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="rect3015"
|
||||
d="m 113.67532,142.79285 0,43.84374 18.5,-13.40625 14.0625,0 0,-16.59374 -13.4375,0 -19.125,-13.84375 z"
|
||||
style="fill:#b6b6b6;fill-opacity:1;fill-rule:nonzero;stroke:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3791"
|
||||
d="m 107.25028,182.88295 c -23.753359,-19.83452 -0.0827,-38.48619 -0.0827,-38.48619"
|
||||
style="fill:none;stroke:#e96800;stroke-width:2.30299997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3791-1"
|
||||
d="M 103.80137,187.75537 C 73.5834,162.52278 103.69616,138.79495 103.69616,138.79495"
|
||||
style="fill:none;stroke:#e96800;stroke-width:2.16618037px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3791-7"
|
||||
d="m 110.74869,177.97273 c -17.104281,-14.28241 -0.0595,-27.71308 -0.0595,-27.71308"
|
||||
style="fill:none;stroke:#e96800;stroke-width:2.15799999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
<path
|
||||
id="rect3015-1"
|
||||
d="m 113.71148,150.58705 0,28.88551 18.50001,-8.83242 14.0625,0 0,-10.93244 -13.4375,0 -19.12501,-9.12065 z"
|
||||
style="fill:url(#linearGradient3031);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
inkscape:connector-curvature="0" />
|
||||
<rect
|
||||
y="142.77277"
|
||||
x="112.37492"
|
||||
height="43.822105"
|
||||
width="1.3598391"
|
||||
id="rect3800"
|
||||
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.3 KiB |
+105
-44
@@ -20,6 +20,8 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QRadioButton>
|
||||
#include <QDebug>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
#include "carddatabase.h"
|
||||
#include "dlg_settings.h"
|
||||
#include "main.h"
|
||||
@@ -449,8 +451,6 @@ void AppearanceSettingsPage::cardBackPicturePathButtonClicked()
|
||||
|
||||
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||
{
|
||||
QIcon deleteIcon(":/resources/icon_delete.svg");
|
||||
|
||||
notificationsEnabledCheckBox.setChecked(settingsCache->getNotificationsEnabled());
|
||||
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotificationsEnabled(int)));
|
||||
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSpecNotificationEnabled(int)));
|
||||
@@ -477,28 +477,6 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||
tapAnimationCheckBox.setChecked(settingsCache->getTapAnimation());
|
||||
connect(&tapAnimationCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setTapAnimation(int)));
|
||||
|
||||
soundEnabledCheckBox.setChecked(settingsCache->getSoundEnabled());
|
||||
connect(&soundEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSoundEnabled(int)));
|
||||
|
||||
soundPathEdit = new QLineEdit(settingsCache->getSoundPath());
|
||||
soundPathEdit->setReadOnly(true);
|
||||
QPushButton *soundPathClearButton = new QPushButton(deleteIcon, QString());
|
||||
connect(soundPathClearButton, SIGNAL(clicked()), this, SLOT(soundPathClearButtonClicked()));
|
||||
QPushButton *soundPathButton = new QPushButton("...");
|
||||
connect(soundPathButton, SIGNAL(clicked()), this, SLOT(soundPathButtonClicked()));
|
||||
connect(&soundTestButton, SIGNAL(clicked()), soundEngine, SLOT(cuckoo()));
|
||||
|
||||
QGridLayout *soundGrid = new QGridLayout;
|
||||
soundGrid->addWidget(&soundEnabledCheckBox, 0, 0, 1, 4);
|
||||
soundGrid->addWidget(&soundPathLabel, 1, 0);
|
||||
soundGrid->addWidget(soundPathEdit, 1, 1);
|
||||
soundGrid->addWidget(soundPathClearButton, 1, 2);
|
||||
soundGrid->addWidget(soundPathButton, 1, 3);
|
||||
soundGrid->addWidget(&soundTestButton, 2, 1);
|
||||
|
||||
soundGroupBox = new QGroupBox;
|
||||
soundGroupBox->setLayout(soundGrid);
|
||||
|
||||
QGridLayout *animationGrid = new QGridLayout;
|
||||
animationGrid->addWidget(&tapAnimationCheckBox, 0, 0);
|
||||
|
||||
@@ -508,7 +486,6 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(generalGroupBox);
|
||||
mainLayout->addWidget(animationGroupBox);
|
||||
mainLayout->addWidget(soundGroupBox);
|
||||
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
@@ -526,27 +503,8 @@ void UserInterfaceSettingsPage::retranslateUi()
|
||||
playToStackCheckBox.setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
|
||||
animationGroupBox->setTitle(tr("Animation settings"));
|
||||
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
||||
soundEnabledCheckBox.setText(tr("Enable &sounds"));
|
||||
soundPathLabel.setText(tr("Path to sounds directory:"));
|
||||
soundTestButton.setText(tr("Test system sound engine"));
|
||||
soundGroupBox->setTitle(tr("Sound settings"));
|
||||
}
|
||||
|
||||
void UserInterfaceSettingsPage::soundPathClearButtonClicked()
|
||||
{
|
||||
soundPathEdit->setText(QString());
|
||||
settingsCache->setSoundPath(QString());
|
||||
}
|
||||
|
||||
void UserInterfaceSettingsPage::soundPathButtonClicked()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Choose path"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
soundPathEdit->setText(path);
|
||||
settingsCache->setSoundPath(path);
|
||||
}
|
||||
|
||||
DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||
{
|
||||
@@ -718,6 +676,102 @@ void MessagesSettingsPage::retranslateUi()
|
||||
hexLabel.setText(tr("(Color is hexadecimal)"));
|
||||
}
|
||||
|
||||
|
||||
SoundSettingsPage::SoundSettingsPage()
|
||||
{
|
||||
QIcon deleteIcon(":/resources/icon_delete.svg");
|
||||
|
||||
soundEnabledCheckBox.setChecked(settingsCache->getSoundEnabled());
|
||||
connect(&soundEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSoundEnabled(int)));
|
||||
|
||||
soundPathEdit = new QLineEdit(settingsCache->getSoundPath());
|
||||
soundPathEdit->setReadOnly(true);
|
||||
QPushButton *soundPathClearButton = new QPushButton(deleteIcon, QString());
|
||||
connect(soundPathClearButton, SIGNAL(clicked()), this, SLOT(soundPathClearButtonClicked()));
|
||||
QPushButton *soundPathButton = new QPushButton("...");
|
||||
connect(soundPathButton, SIGNAL(clicked()), this, SLOT(soundPathButtonClicked()));
|
||||
connect(&soundTestButton, SIGNAL(clicked()), soundEngine, SLOT(cuckoo()));
|
||||
|
||||
masterVolumeSlider = new QSlider(Qt::Horizontal);
|
||||
masterVolumeSlider->setMinimum(0);
|
||||
masterVolumeSlider->setMaximum(100);
|
||||
masterVolumeSlider->setValue(settingsCache->getMasterVolume());
|
||||
masterVolumeSlider->setToolTip(QString::number(settingsCache->getMasterVolume()));
|
||||
connect(settingsCache, SIGNAL(masterVolumeChanged(int)), this, SLOT(masterVolumeChanged(int)));
|
||||
connect(masterVolumeSlider, SIGNAL(sliderReleased()), soundEngine, SLOT(endStep()));
|
||||
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMasterVolume(int)));
|
||||
|
||||
|
||||
|
||||
masterVolumeSpinBox = new QSpinBox();
|
||||
masterVolumeSpinBox->setMinimum(0);
|
||||
masterVolumeSpinBox->setMaximum(100);
|
||||
masterVolumeSpinBox->setValue(settingsCache->getMasterVolume());
|
||||
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), masterVolumeSpinBox, SLOT(setValue(int)));
|
||||
connect(masterVolumeSpinBox, SIGNAL(valueChanged(int)), masterVolumeSlider, SLOT(setValue(int)));
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
masterVolumeSlider->setEnabled(false);
|
||||
masterVolumeSpinBox->setEnabled(false);
|
||||
#endif
|
||||
|
||||
QGridLayout *soundGrid = new QGridLayout;
|
||||
soundGrid->addWidget(&soundEnabledCheckBox, 0, 0, 1, 4);
|
||||
soundGrid->addWidget(&masterVolumeLabel, 1, 0);
|
||||
soundGrid->addWidget(masterVolumeSlider, 1, 1);
|
||||
soundGrid->addWidget(masterVolumeSpinBox, 1, 2);
|
||||
soundGrid->addWidget(&soundPathLabel, 2, 0);
|
||||
soundGrid->addWidget(soundPathEdit, 2, 1);
|
||||
soundGrid->addWidget(soundPathClearButton, 2, 2);
|
||||
soundGrid->addWidget(soundPathButton, 2, 3);
|
||||
soundGrid->addWidget(&soundTestButton, 3, 1);
|
||||
|
||||
soundGroupBox = new QGroupBox;
|
||||
soundGroupBox->setLayout(soundGrid);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(soundGroupBox);
|
||||
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
||||
void SoundSettingsPage::masterVolumeChanged(int value) {
|
||||
masterVolumeSlider->setToolTip(QString::number(value));
|
||||
//QToolTip::showText(masterVolumeSlider->mapToGlobal(QPoint(0, 0)), QString::number(value));
|
||||
// to do
|
||||
// need to set the edit bar to be the same
|
||||
// also need to update the slider to be the same
|
||||
}
|
||||
|
||||
void SoundSettingsPage::soundPathClearButtonClicked()
|
||||
{
|
||||
soundPathEdit->setText(QString());
|
||||
settingsCache->setSoundPath(QString());
|
||||
}
|
||||
|
||||
void SoundSettingsPage::soundPathButtonClicked()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Choose path"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
soundPathEdit->setText(path);
|
||||
settingsCache->setSoundPath(path);
|
||||
}
|
||||
|
||||
void SoundSettingsPage::retranslateUi() {
|
||||
soundEnabledCheckBox.setText(tr("Enable &sounds"));
|
||||
soundPathLabel.setText(tr("Path to sounds directory:"));
|
||||
soundTestButton.setText(tr("Test system sound engine"));
|
||||
soundGroupBox->setTitle(tr("Sound settings"));
|
||||
#if QT_VERSION < 0x050000
|
||||
masterVolumeLabel.setText(tr("Master volume requires QT5"));
|
||||
#else
|
||||
masterVolumeLabel.setText(tr("Master volume"));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
DlgSettings::DlgSettings(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
@@ -737,6 +791,7 @@ DlgSettings::DlgSettings(QWidget *parent)
|
||||
pagesWidget->addWidget(new UserInterfaceSettingsPage);
|
||||
pagesWidget->addWidget(new DeckEditorSettingsPage);
|
||||
pagesWidget->addWidget(new MessagesSettingsPage);
|
||||
pagesWidget->addWidget(new SoundSettingsPage);
|
||||
|
||||
createIcons();
|
||||
contentsWidget->setCurrentRow(0);
|
||||
@@ -785,6 +840,11 @@ void DlgSettings::createIcons()
|
||||
messagesButton->setTextAlignment(Qt::AlignHCenter);
|
||||
messagesButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
messagesButton->setIcon(QIcon(":/resources/icon_config_messages.svg"));
|
||||
|
||||
soundButton = new QListWidgetItem(contentsWidget);
|
||||
soundButton->setTextAlignment(Qt::AlignHCenter);
|
||||
soundButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
soundButton->setIcon(QIcon(":/resources/icon_config_sound.svg"));
|
||||
|
||||
connect(contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem *)));
|
||||
}
|
||||
@@ -894,6 +954,7 @@ void DlgSettings::retranslateUi()
|
||||
userInterfaceButton->setText(tr("User Interface"));
|
||||
deckEditorButton->setText(tr("Deck Editor"));
|
||||
messagesButton->setText(tr("Chat"));
|
||||
soundButton->setText(tr("Sound"));
|
||||
|
||||
for (int i = 0; i < pagesWidget->count(); i++)
|
||||
dynamic_cast<AbstractSettingsPage *>(pagesWidget->widget(i))->retranslateUi();
|
||||
|
||||
@@ -23,6 +23,8 @@ class QCloseEvent;
|
||||
class QSpinBox;
|
||||
class QRadioButton;
|
||||
class QSpinBox;
|
||||
class QSlider;
|
||||
class QSpinBox;
|
||||
|
||||
class AbstractSettingsPage : public QWidget {
|
||||
public:
|
||||
@@ -115,24 +117,16 @@ public:
|
||||
class UserInterfaceSettingsPage : public AbstractSettingsPage {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void soundPathClearButtonClicked();
|
||||
void soundPathButtonClicked();
|
||||
void setSpecNotificationEnabled(int);
|
||||
signals:
|
||||
void soundPathChanged();
|
||||
private:
|
||||
QCheckBox notificationsEnabledCheckBox;
|
||||
QCheckBox specNotificationsEnabledCheckBox;
|
||||
QCheckBox doubleClickToPlayCheckBox;
|
||||
QCheckBox playToStackCheckBox;
|
||||
QCheckBox tapAnimationCheckBox;
|
||||
QCheckBox soundEnabledCheckBox;
|
||||
QLabel soundPathLabel;
|
||||
QLineEdit *soundPathEdit;
|
||||
QGroupBox *generalGroupBox;
|
||||
QGroupBox *animationGroupBox;
|
||||
QGroupBox *soundGroupBox;
|
||||
QPushButton soundTestButton;
|
||||
|
||||
public:
|
||||
UserInterfaceSettingsPage();
|
||||
void retranslateUi();
|
||||
@@ -181,6 +175,28 @@ private:
|
||||
void updateMentionPreview();
|
||||
};
|
||||
|
||||
class SoundSettingsPage : public AbstractSettingsPage {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SoundSettingsPage();
|
||||
void retranslateUi();
|
||||
private:
|
||||
QGroupBox *soundGroupBox;
|
||||
QPushButton soundTestButton;
|
||||
QCheckBox soundEnabledCheckBox;
|
||||
QLabel soundPathLabel;
|
||||
QLineEdit *soundPathEdit;
|
||||
QLabel masterVolumeLabel;
|
||||
QSlider *masterVolumeSlider;
|
||||
QSpinBox *masterVolumeSpinBox;
|
||||
signals:
|
||||
void soundPathChanged();
|
||||
private slots:
|
||||
void masterVolumeChanged(int value);
|
||||
void soundPathClearButtonClicked();
|
||||
void soundPathButtonClicked();
|
||||
};
|
||||
|
||||
class DlgSettings : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -192,7 +208,7 @@ private slots:
|
||||
private:
|
||||
QListWidget *contentsWidget;
|
||||
QStackedWidget *pagesWidget;
|
||||
QListWidgetItem *generalButton, *appearanceButton, *userInterfaceButton, *deckEditorButton, *messagesButton;
|
||||
QListWidgetItem *generalButton, *appearanceButton, *userInterfaceButton, *deckEditorButton, *messagesButton, *soundButton;
|
||||
void createIcons();
|
||||
void retranslateUi();
|
||||
protected:
|
||||
|
||||
@@ -37,6 +37,7 @@ bool MessageLogWidget::userIsFemale() const
|
||||
|
||||
void MessageLogWidget::logGameJoined(int gameId)
|
||||
{
|
||||
soundEngine->playerJoined();
|
||||
if (userIsFemale())
|
||||
appendHtmlServerMessage(tr("You have joined game #%1.", "female").arg("<font color=\"blue\">"+ QString::number(gameId) + "</font>"));
|
||||
else
|
||||
@@ -53,7 +54,7 @@ void MessageLogWidget::logReplayStarted(int gameId)
|
||||
|
||||
void MessageLogWidget::logJoin(Player *player)
|
||||
{
|
||||
soundEngine->cuckoo();
|
||||
soundEngine->playerJoined();
|
||||
if (isFemale(player))
|
||||
appendHtmlServerMessage(tr("%1 has joined the game.", "female").arg(sanitizeHtml(player->getName())));
|
||||
else
|
||||
@@ -171,7 +172,6 @@ void MessageLogWidget::logSpectatorSay(QString spectatorName, UserLevelFlags spe
|
||||
|
||||
void MessageLogWidget::logShuffle(Player *player, CardZone *zone)
|
||||
{
|
||||
soundEngine->shuffle();
|
||||
if (currentContext != MessageContext_Mulligan) {
|
||||
appendHtmlServerMessage((isFemale(player)
|
||||
? tr("%1 shuffles %2.", "female")
|
||||
@@ -194,7 +194,6 @@ void MessageLogWidget::logDrawCards(Player *player, int number)
|
||||
if (currentContext == MessageContext_Mulligan)
|
||||
mulliganPlayer = player;
|
||||
else {
|
||||
soundEngine->draw();
|
||||
if (isFemale(player))
|
||||
appendHtmlServerMessage(tr("%1 draws %2 card(s).", "female").arg(sanitizeHtml(player->getName())).arg("<font color=\"blue\">" + QString::number(number) + "</font>"));
|
||||
else
|
||||
@@ -297,7 +296,6 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
|
||||
|
||||
QString finalStr;
|
||||
if (targetName == "table") {
|
||||
soundEngine->playCard();
|
||||
if (moveCardTapped.value(attributes.card))
|
||||
finalStr = tr("%1 puts %2 into play tapped%3.");
|
||||
else
|
||||
@@ -320,7 +318,6 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
|
||||
} else if (targetName == "sb")
|
||||
finalStr = tr("%1 moves %2%3 to sideboard.");
|
||||
else if (targetName == "stack") {
|
||||
soundEngine->playCard();
|
||||
finalStr = tr("%1 plays %2%3.");
|
||||
}
|
||||
|
||||
@@ -570,8 +567,6 @@ void MessageLogWidget::logSetTapped(Player *player, CardItem *card, bool tapped)
|
||||
{
|
||||
if (tapped)
|
||||
soundEngine->tap();
|
||||
else
|
||||
soundEngine->untap();
|
||||
|
||||
if (currentContext == MessageContext_MoveCard)
|
||||
moveCardTapped.insert(card, tapped);
|
||||
@@ -792,7 +787,6 @@ void MessageLogWidget::logAlwaysRevealTopCard(Player *player, CardZone *zone, bo
|
||||
|
||||
void MessageLogWidget::logSetActivePlayer(Player *player)
|
||||
{
|
||||
soundEngine->notification();
|
||||
|
||||
QString str;
|
||||
if (isFemale(player))
|
||||
@@ -804,7 +798,6 @@ void MessageLogWidget::logSetActivePlayer(Player *player)
|
||||
|
||||
void MessageLogWidget::logSetActivePhase(int phase)
|
||||
{
|
||||
soundEngine->notification();
|
||||
QString phaseName;
|
||||
switch (phase) {
|
||||
case 0: phaseName = tr("untap step"); break;
|
||||
@@ -817,7 +810,7 @@ void MessageLogWidget::logSetActivePhase(int phase)
|
||||
case 7: phaseName = tr("combat damage step"); break;
|
||||
case 8: phaseName = tr("end of combat step"); break;
|
||||
case 9: phaseName = tr("second main phase"); break;
|
||||
case 10: phaseName = tr("ending phase"); break;
|
||||
case 10: phaseName = tr("ending phase"); soundEngine->endStep(); break;
|
||||
}
|
||||
appendHtml("<font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + tr("It is now the %1.").arg(phaseName) + "</b></font>");
|
||||
}
|
||||
|
||||
@@ -79,6 +79,14 @@ SettingsCache::SettingsCache()
|
||||
showMentionPopups = settings->value("chat/showmentionpopups", true).toBool();
|
||||
|
||||
leftJustified = settings->value("interface/leftjustified", false).toBool();
|
||||
|
||||
masterVolume = settings->value("sound/mastervolume", 100).toInt();
|
||||
}
|
||||
|
||||
void SettingsCache::setMasterVolume(int _masterVolume) {
|
||||
masterVolume = _masterVolume;
|
||||
settings->setValue("sound/mastervolume", masterVolume);
|
||||
emit masterVolumeChanged(masterVolume);
|
||||
}
|
||||
|
||||
void SettingsCache::setLeftJustified(const int _leftJustified) {
|
||||
|
||||
@@ -39,6 +39,7 @@ signals:
|
||||
void ignoreUnregisteredUsersChanged();
|
||||
void ignoreUnregisteredUserMessagesChanged();
|
||||
void pixmapCacheSizeChanged(int newSizeInMBs);
|
||||
void masterVolumeChanged(int value);
|
||||
private:
|
||||
QSettings *settings;
|
||||
|
||||
@@ -79,6 +80,7 @@ private:
|
||||
bool showMessagePopups;
|
||||
bool showMentionPopups;
|
||||
bool leftJustified;
|
||||
int masterVolume;
|
||||
public:
|
||||
SettingsCache();
|
||||
const QByteArray &getMainWindowGeometry() const { return mainWindowGeometry; }
|
||||
@@ -134,6 +136,7 @@ public:
|
||||
bool getShowMessagePopup() const { return showMessagePopups; }
|
||||
bool getShowMentionPopup() const { return showMentionPopups; }
|
||||
bool getLeftJustified() const { return leftJustified; }
|
||||
int getMasterVolume() const { return masterVolume; }
|
||||
public slots:
|
||||
void setMainWindowGeometry(const QByteArray &_mainWindowGeometry);
|
||||
void setLang(const QString &_lang);
|
||||
@@ -182,6 +185,7 @@ public slots:
|
||||
void setShowMessagePopups(const int _showMessagePopups);
|
||||
void setShowMentionPopups(const int _showMentionPopups);
|
||||
void setLeftJustified( const int _leftJustified);
|
||||
void setMasterVolume(const int _masterVolume);
|
||||
};
|
||||
|
||||
extern SettingsCache *settingsCache;
|
||||
|
||||
@@ -14,12 +14,15 @@ SoundEngine::SoundEngine(QObject *parent)
|
||||
connect(settingsCache, SIGNAL(soundEnabledChanged()), this, SLOT(soundEnabledChanged()));
|
||||
cacheData();
|
||||
soundEnabledChanged();
|
||||
|
||||
lastTapPlayed = QDateTime::currentDateTime();
|
||||
lastEndStepPlayed = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
void SoundEngine::cacheData()
|
||||
{
|
||||
static const QStringList fileNames = QStringList()
|
||||
<< "notification" << "draw" << "playcard" << "shuffle" << "tap" << "untap" << "cuckoo";
|
||||
<< "end_step" << "tap" << "player_joined";
|
||||
for (int i = 0; i < fileNames.size(); ++i) {
|
||||
QFile file(settingsCache->getSoundPath() + "/" + fileNames[i] + ".raw");
|
||||
if(!file.exists())
|
||||
@@ -64,40 +67,28 @@ void SoundEngine::playSound(const QString &fileName)
|
||||
inputBuffer->close();
|
||||
inputBuffer->setData(audioData[fileName]);
|
||||
inputBuffer->open(QIODevice::ReadOnly);
|
||||
#if QT_VERSION >= 0x050000
|
||||
audio->setVolume(settingsCache->getMasterVolume() / 100.0);
|
||||
#endif
|
||||
audio->start(inputBuffer);
|
||||
|
||||
}
|
||||
|
||||
void SoundEngine::notification()
|
||||
void SoundEngine::endStep()
|
||||
{
|
||||
playSound("notification");
|
||||
}
|
||||
|
||||
void SoundEngine::draw()
|
||||
{
|
||||
playSound("draw");
|
||||
}
|
||||
|
||||
void SoundEngine::playCard()
|
||||
{
|
||||
playSound("playcard");
|
||||
}
|
||||
|
||||
void SoundEngine::shuffle()
|
||||
{
|
||||
playSound("shuffle");
|
||||
if (lastEndStepPlayed.secsTo(QDateTime::currentDateTime()) >= 1)
|
||||
playSound("end_step");
|
||||
lastEndStepPlayed = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
void SoundEngine::tap()
|
||||
{
|
||||
playSound("tap");
|
||||
if (lastTapPlayed.secsTo(QDateTime::currentDateTime()) >= 1)
|
||||
playSound("tap");
|
||||
lastTapPlayed = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
void SoundEngine::untap()
|
||||
void SoundEngine::playerJoined()
|
||||
{
|
||||
playSound("untap");
|
||||
}
|
||||
|
||||
void SoundEngine::cuckoo()
|
||||
{
|
||||
playSound("cuckoo");
|
||||
playSound("player_joined");
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QDateTime>
|
||||
|
||||
class QAudioOutput;
|
||||
class QBuffer;
|
||||
@@ -14,19 +15,17 @@ private:
|
||||
QMap<QString, QByteArray> audioData;
|
||||
QBuffer *inputBuffer;
|
||||
QAudioOutput *audio;
|
||||
QDateTime lastTapPlayed;
|
||||
QDateTime lastEndStepPlayed;
|
||||
private slots:
|
||||
void cacheData();
|
||||
void soundEnabledChanged();
|
||||
public:
|
||||
SoundEngine(QObject *parent = 0);
|
||||
public slots:
|
||||
void notification();
|
||||
void draw();
|
||||
void playCard();
|
||||
void shuffle();
|
||||
void endStep();
|
||||
void tap();
|
||||
void untap();
|
||||
void cuckoo();
|
||||
void playerJoined();
|
||||
};
|
||||
|
||||
extern SoundEngine *soundEngine;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 40 KiB |
Binary file not shown.
Reference in New Issue
Block a user