~ubuntu-branches/ubuntu/gutsy/smplayer/gutsy-backports

« back to all changes in this revision

Viewing changes to src/eqslider.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Breuil Cyril
  • Date: 2007-05-06 17:09:35 UTC
  • Revision ID: james.westby@ubuntu.com-20070506170935-d83qqn48tv1muk7j
Tags: upstream-0.4.12
ImportĀ upstreamĀ versionĀ 0.4.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  smplayer, GUI front-end for mplayer.
 
2
    Copyright (C) 2007 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 "eqslider.h"
 
20
#include <qslider.h>
 
21
#include <qlabel.h>
 
22
#include <qpixmap.h>
 
23
#include "verticaltext.h"
 
24
#include "qt3_4_compat.h"
 
25
 
 
26
EqSlider::EqSlider( QWidget* parent, const char* name, WFlags fl) 
 
27
        : EqSliderBase(parent, name, fl)
 
28
{
 
29
        _icon->setText( QString::null );
 
30
        _slider->setFocusPolicy( STRONGFOCUS );
 
31
        _slider->setTickmarks( QSlider::Right );
 
32
        _slider->setTickInterval( 10 );
 
33
        _slider->setLineStep( 1 );
 
34
        _slider->setPageStep( 10 );
 
35
 
 
36
        connect( _slider, SIGNAL(valueChanged(int)),
 
37
             this, SLOT(sliderValueChanged(int)) );
 
38
}
 
39
 
 
40
EqSlider::~EqSlider() {
 
41
}
 
42
 
 
43
 
 
44
void EqSlider::languageChange() {
 
45
}
 
46
 
 
47
void EqSlider::setIcon( QPixmap i) {
 
48
        _icon->setPixmap(i);
 
49
}
 
50
 
 
51
const QPixmap * EqSlider::icon() const {
 
52
        return _icon->pixmap();
 
53
}
 
54
 
 
55
void EqSlider::setLabel( QString s) {
 
56
        _label->setText(s);
 
57
}
 
58
 
 
59
QString EqSlider::label() const {
 
60
        return _label->text();
 
61
}
 
62
 
 
63
void EqSlider::setValue(int value) {
 
64
    #if QT_VERSION >= 0x040000
 
65
        _slider->setValue(value);
 
66
        #else
 
67
        // QSlider in Qt 3works upside-down!
 
68
        _slider->setValue(-value);
 
69
        #endif
 
70
}
 
71
 
 
72
int EqSlider::value() const {
 
73
    #if QT_VERSION >= 0x040000
 
74
        return _slider->value();
 
75
        #else
 
76
        // QSlider in Qt 3 works upside-down!
 
77
        return - _slider->value();
 
78
        #endif
 
79
}
 
80
 
 
81
void EqSlider::sliderValueChanged(int v) {
 
82
    #if QT_VERSION >= 0x040000
 
83
        emit valueChanged( v );
 
84
        #else
 
85
        // QSlider in Qt 3 works upside-down!
 
86
        emit valueChanged( -v );
 
87
        #endif
 
88
}