1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#include "audioequalizer.h"
22
#include "preferences.h"
25
#include <QPushButton>
26
#include <QMessageBox>
28
using namespace Global;
30
AudioEqualizer::AudioEqualizer( QWidget* parent, Qt::WindowFlags f)
33
QBoxLayout *bl = new QHBoxLayout; //(0, 4, 2);
35
for (int n = 0; n < 10; n++) {
36
eq[n] = new EqSlider(this);
37
eq[n]->setIcon( QPixmap() );
38
eq[n]->sliderWidget()->setRange(-120, 120);
42
reset_button = new QPushButton( "&Reset", this);
43
connect( reset_button, SIGNAL(clicked()), this, SLOT(reset()) );
45
set_default_button = new QPushButton( "&Set as default values", this );
46
connect( set_default_button, SIGNAL(clicked()), this, SLOT(setDefaults()) );
48
apply_button = new QPushButton( "&Apply", this );
49
connect( apply_button, SIGNAL(clicked()), this, SLOT(applyButtonClicked()) );
51
QBoxLayout *button_layout = new QHBoxLayout; //(0, 4, 2);
52
button_layout->addStretch();
53
button_layout->addWidget(apply_button);
54
button_layout->addWidget(reset_button);
55
button_layout->addWidget(set_default_button);
57
QBoxLayout *layout = new QVBoxLayout(this); //, 4, 2);
58
layout->addLayout(bl);
59
layout->addLayout(button_layout);
64
//setFixedSize( sizeHint() );
67
AudioEqualizer::~AudioEqualizer() {
70
void AudioEqualizer::retranslateStrings() {
71
setWindowTitle( tr("Audio Equalizer") );
72
setWindowIcon( Images::icon("logo") );
74
eq[0]->setLabel( tr("31.25 Hz") );
75
eq[1]->setLabel( tr("62.50 Hz") );
76
eq[2]->setLabel( tr("125.0 Hz") );
77
eq[3]->setLabel( tr("250.0 Hz") );
78
eq[4]->setLabel( tr("500.0 Hz") );
79
eq[5]->setLabel( tr("1.000 kHz") );
80
eq[6]->setLabel( tr("2.000 kHz") );
81
eq[7]->setLabel( tr("4.000 kHz") );
82
eq[8]->setLabel( tr("8.000 kHz") );
83
eq[9]->setLabel( tr("16.00 kHz") );
85
apply_button->setText( tr("&Apply") );
86
reset_button->setText( tr("&Reset") );
87
set_default_button->setText( tr("&Set as default values") );
90
set_default_button->setWhatsThis(
91
tr("Use the current values as default values for new videos.") );
93
reset_button->setWhatsThis( tr("Set all controls to zero.") );
97
void AudioEqualizer::reset() {
98
for (int n = 0; n < 10; n++) {
103
void AudioEqualizer::setDefaults() {
104
AudioEqualizerList l;
105
for (int n = 0; n < 10; n++) {
108
pref->initial_audio_equalizer = l;
110
QMessageBox::information(this, tr("Information"),
111
tr("The current values have been stored to be "
112
"used as default.") );
115
void AudioEqualizer::applyButtonClicked() {
116
AudioEqualizerList l;
117
for (int n = 0; n < 10; n++) {
120
emit applyClicked( l );
123
void AudioEqualizer::hideEvent( QHideEvent * ) {
124
emit visibilityChanged();
127
void AudioEqualizer::showEvent( QShowEvent * ) {
128
emit visibilityChanged();
131
// Language change stuff
132
void AudioEqualizer::changeEvent(QEvent *e) {
133
if (e->type() == QEvent::LanguageChange) {
134
retranslateStrings();
136
QWidget::changeEvent(e);
140
#include "moc_audioequalizer.cpp"