1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
|
---|
3 |
|
---|
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.
|
---|
8 |
|
---|
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.
|
---|
13 |
|
---|
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
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include "videoequalizer.h"
|
---|
20 | #include "eqslider.h"
|
---|
21 | #include "images.h"
|
---|
22 | #include "preferences.h"
|
---|
23 | #include "global.h"
|
---|
24 | #include <QLayout>
|
---|
25 | #include <QPushButton>
|
---|
26 | #include <QMessageBox>
|
---|
27 |
|
---|
28 | using namespace Global;
|
---|
29 |
|
---|
30 | VideoEqualizer::VideoEqualizer( QWidget* parent, Qt::WindowFlags f)
|
---|
31 | : QWidget(parent, f)
|
---|
32 | {
|
---|
33 | contrast = new EqSlider(this);
|
---|
34 | brightness = new EqSlider(this);
|
---|
35 | hue = new EqSlider(this);
|
---|
36 | saturation = new EqSlider(this);
|
---|
37 | gamma = new EqSlider(this);
|
---|
38 |
|
---|
39 | QBoxLayout *bl = new QHBoxLayout; //(0, 4, 2);
|
---|
40 | bl->addWidget(contrast);
|
---|
41 | bl->addWidget(brightness);
|
---|
42 | bl->addWidget(hue);
|
---|
43 | bl->addWidget(saturation);
|
---|
44 | bl->addWidget(gamma);
|
---|
45 |
|
---|
46 | reset_button = new QPushButton( "&Reset", this);
|
---|
47 | connect( reset_button, SIGNAL(clicked()), this, SLOT(reset()) );
|
---|
48 | set_default_button = new QPushButton( "&Set as default values", this );
|
---|
49 | connect( set_default_button, SIGNAL(clicked()), this, SLOT(setDefaults()) );
|
---|
50 |
|
---|
51 | QBoxLayout *button_layout = new QVBoxLayout; //(0, 4, 2);
|
---|
52 | button_layout->addWidget(set_default_button);
|
---|
53 | button_layout->addWidget(reset_button);
|
---|
54 |
|
---|
55 | QBoxLayout *layout = new QVBoxLayout(this); //, 4, 2);
|
---|
56 | layout->addLayout(bl);
|
---|
57 | layout->addLayout(button_layout);
|
---|
58 |
|
---|
59 | retranslateStrings();
|
---|
60 |
|
---|
61 | adjustSize();
|
---|
62 | //setFixedSize( sizeHint() );
|
---|
63 | }
|
---|
64 |
|
---|
65 | VideoEqualizer::~VideoEqualizer() {
|
---|
66 | }
|
---|
67 |
|
---|
68 | void VideoEqualizer::retranslateStrings() {
|
---|
69 | setWindowTitle( tr("Video Equalizer") );
|
---|
70 | setWindowIcon( Images::icon("logo") );
|
---|
71 |
|
---|
72 | contrast->setLabel( tr("Contrast") );
|
---|
73 | contrast->setToolTip( tr("Contrast") );
|
---|
74 | contrast->setIcon( Images::icon("contrast") );
|
---|
75 |
|
---|
76 | brightness->setLabel( tr("Brightness") );
|
---|
77 | brightness->setToolTip( tr("Brightness") );
|
---|
78 | brightness->setIcon( Images::icon("brightness") );
|
---|
79 |
|
---|
80 | hue->setLabel( tr("Hue") );
|
---|
81 | hue->setToolTip( tr("Hue") );
|
---|
82 | hue->setIcon( Images::icon("hue") );
|
---|
83 |
|
---|
84 | saturation->setLabel( tr("Saturation") );
|
---|
85 | saturation->setToolTip( tr("Saturation") );
|
---|
86 | saturation->setIcon( Images::icon("saturation") );
|
---|
87 |
|
---|
88 | gamma->setLabel( tr("Gamma") );
|
---|
89 | gamma->setToolTip( tr("Gamma") );
|
---|
90 | gamma->setIcon( Images::icon("gamma") );
|
---|
91 |
|
---|
92 | reset_button->setText( tr("&Reset") );
|
---|
93 | set_default_button->setText( tr("&Set as default values") );
|
---|
94 |
|
---|
95 | // What's this help:
|
---|
96 | set_default_button->setWhatsThis(
|
---|
97 | tr("Use the current values as default values for new videos.") );
|
---|
98 |
|
---|
99 | reset_button->setWhatsThis( tr("Set all controls to zero.") );
|
---|
100 |
|
---|
101 | }
|
---|
102 |
|
---|
103 | void VideoEqualizer::reset() {
|
---|
104 | contrast->setValue(0);
|
---|
105 | brightness->setValue(0);
|
---|
106 | hue->setValue(0);
|
---|
107 | saturation->setValue(0);
|
---|
108 | gamma->setValue(0);
|
---|
109 | }
|
---|
110 |
|
---|
111 | void VideoEqualizer::setDefaults() {
|
---|
112 | pref->initial_contrast = contrast->value();
|
---|
113 | pref->initial_brightness = brightness->value();
|
---|
114 | pref->initial_hue = hue->value();
|
---|
115 | pref->initial_saturation = saturation->value();
|
---|
116 | pref->initial_gamma = gamma->value();
|
---|
117 |
|
---|
118 | QMessageBox::information(this, tr("Information"),
|
---|
119 | tr("The current values have been stored to be "
|
---|
120 | "used as default.") );
|
---|
121 | }
|
---|
122 |
|
---|
123 | void VideoEqualizer::hideEvent( QHideEvent * ) {
|
---|
124 | emit visibilityChanged();
|
---|
125 | }
|
---|
126 |
|
---|
127 | void VideoEqualizer::showEvent( QShowEvent * ) {
|
---|
128 | emit visibilityChanged();
|
---|
129 | }
|
---|
130 |
|
---|
131 | // Language change stuff
|
---|
132 | void VideoEqualizer::changeEvent(QEvent *e) {
|
---|
133 | if (e->type() == QEvent::LanguageChange) {
|
---|
134 | retranslateStrings();
|
---|
135 | } else {
|
---|
136 | QWidget::changeEvent(e);
|
---|
137 | }
|
---|
138 | }
|
---|
139 |
|
---|
140 | #include "moc_videoequalizer.cpp"
|
---|