Changeset 165 for smplayer/trunk/src/videoequalizer.cpp
- Timestamp:
- May 16, 2014, 9:51:55 AM (11 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 163
- Property svn:mergeinfo changed
-
smplayer/trunk/src/videoequalizer.cpp
r142 r165 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 3Ricardo Villalba <rvm@users.sourceforge.net>2 Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 18 18 19 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 20 28 using namespace Global; 29 30 VideoEqualizer::VideoEqualizer( QWidget* parent, Qt::WindowFlags f) 21 VideoEqualizer::VideoEqualizer( QWidget* parent, Qt::WindowFlags f ) 31 22 : QWidget(parent, f) 32 23 { 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); 24 setupUi(this); 38 25 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); 26 /* 27 contrast_indicator->setNum(0); 28 brightness_indicator->setNum(0); 29 hue_indicator->setNum(0); 30 saturation_indicator->setNum(0); 31 gamma_indicator->setNum(0); 32 */ 45 33 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()) ); 34 connect( contrast_slider, SIGNAL(valueChanged(int)), 35 contrast_indicator, SLOT(setNum(int)) ); 50 36 51 QBoxLayout *button_layout = new QVBoxLayout; //(0, 4, 2); 52 button_layout->addWidget(set_default_button); 53 button_layout->addWidget(reset_button); 37 connect( brightness_slider, SIGNAL(valueChanged(int)), 38 brightness_indicator, SLOT(setNum(int)) ); 54 39 55 QBoxLayout *layout = new QVBoxLayout(this); //, 4, 2); 56 layout->addLayout(bl); 57 layout->addLayout(button_layout); 40 connect( hue_slider, SIGNAL(valueChanged(int)), 41 hue_indicator, SLOT(setNum(int)) ); 58 42 59 retranslateStrings(); 43 connect( saturation_slider, SIGNAL(valueChanged(int)), 44 saturation_indicator, SLOT(setNum(int)) ); 45 46 connect( gamma_slider, SIGNAL(valueChanged(int)), 47 gamma_indicator, SLOT(setNum(int)) ); 48 49 // Reemit signals 50 connect( contrast_slider, SIGNAL(valueChanged(int)), 51 this, SIGNAL(contrastChanged(int)) ); 52 connect( brightness_slider, SIGNAL(valueChanged(int)), 53 this, SIGNAL(brightnessChanged(int)) ); 54 connect( hue_slider, SIGNAL(valueChanged(int)), 55 this, SIGNAL(hueChanged(int)) ); 56 connect( saturation_slider, SIGNAL(valueChanged(int)), 57 this, SIGNAL(saturationChanged(int)) ); 58 connect( gamma_slider, SIGNAL(valueChanged(int)), 59 this, SIGNAL(gammaChanged(int)) ); 60 61 connect( makedefault_button, SIGNAL(clicked()), 62 this, SIGNAL(requestToChangeDefaultValues()) ); 60 63 61 64 adjustSize(); 62 //setFixedSize( sizeHint() );63 65 } 64 66 … … 66 68 } 67 69 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 70 void VideoEqualizer::reset() { 71 setContrast(0); 72 setBrightness(0); 73 setHue(0); 74 setSaturation(0); 75 setGamma(0); 101 76 } 102 77 103 void VideoEqualizer::reset() { 104 contrast->setValue(0); 105 brightness->setValue(0); 106 hue->setValue(0); 107 saturation->setValue(0); 108 gamma->setValue(0); 78 void VideoEqualizer::on_reset_button_clicked() { 79 qDebug("VideoEqualizer::on_reset_button_clicked"); 80 reset(); 109 81 } 110 82 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.") ); 83 void VideoEqualizer::on_bysoftware_check_stateChanged(int state) { 84 qDebug("VideoEqualizer::on_bysoftware_check_stateChanged"); 85 emit bySoftwareChanged(state == Qt::Checked); 121 86 } 122 87 … … 127 92 void VideoEqualizer::showEvent( QShowEvent * ) { 128 93 emit visibilityChanged(); 94 } 95 96 void VideoEqualizer::retranslateStrings() { 97 retranslateUi(this); 98 99 // What's this help: 100 makedefault_button->setWhatsThis( 101 tr("Use the current values as default values for new videos.") ); 102 103 reset_button->setWhatsThis( tr("Set all controls to zero.") ); 129 104 } 130 105
Note:
See TracChangeset
for help on using the changeset viewer.