1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
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 "tristatecombo.h"
|
---|
20 | #include <QEvent>
|
---|
21 |
|
---|
22 | TristateCombo::TristateCombo( QWidget * parent ) : QComboBox(parent)
|
---|
23 | {
|
---|
24 | retranslateStrings();
|
---|
25 | }
|
---|
26 |
|
---|
27 | TristateCombo::~TristateCombo() {
|
---|
28 | }
|
---|
29 |
|
---|
30 | void TristateCombo::retranslateStrings() {
|
---|
31 | int i = currentIndex();
|
---|
32 |
|
---|
33 | clear();
|
---|
34 | addItem( tr("Auto"), Preferences::Detect );
|
---|
35 | addItem( tr("Yes"), Preferences::Enabled );
|
---|
36 | addItem( tr("No"), Preferences::Disabled );
|
---|
37 |
|
---|
38 | setCurrentIndex(i);
|
---|
39 | }
|
---|
40 |
|
---|
41 | void TristateCombo::setState( Preferences::OptionState v ) {
|
---|
42 | setCurrentIndex( findData(v) );
|
---|
43 | }
|
---|
44 |
|
---|
45 | Preferences::OptionState TristateCombo::state() {
|
---|
46 | return (Preferences::OptionState) itemData( currentIndex() ).toInt();
|
---|
47 | }
|
---|
48 |
|
---|
49 | // Language change stuff
|
---|
50 | void TristateCombo::changeEvent(QEvent *e) {
|
---|
51 | if (e->type() == QEvent::LanguageChange) {
|
---|
52 | retranslateStrings();
|
---|
53 | } else {
|
---|
54 | QComboBox::changeEvent(e);
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | #include "moc_tristatecombo.cpp"
|
---|