[112] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[112] | 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 "preftv.h"
|
---|
| 20 | #include "preferences.h"
|
---|
| 21 | #include "images.h"
|
---|
| 22 | #include "mediasettings.h"
|
---|
| 23 |
|
---|
| 24 | PrefTV::PrefTV(QWidget * parent, Qt::WindowFlags f)
|
---|
| 25 | : PrefWidget(parent, f )
|
---|
| 26 | {
|
---|
| 27 | setupUi(this);
|
---|
| 28 |
|
---|
| 29 | #ifdef Q_OS_WIN
|
---|
| 30 | rescan_check->hide();
|
---|
| 31 | #endif
|
---|
| 32 |
|
---|
| 33 | retranslateStrings();
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | PrefTV::~PrefTV()
|
---|
| 37 | {
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | QString PrefTV::sectionName() {
|
---|
| 41 | return tr("TV and radio");
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | QPixmap PrefTV::sectionIcon() {
|
---|
[181] | 45 | return Images::icon("pref_tv");
|
---|
[112] | 46 | }
|
---|
| 47 |
|
---|
| 48 | void PrefTV::retranslateStrings() {
|
---|
| 49 | retranslateUi(this);
|
---|
| 50 |
|
---|
| 51 | int deinterlace_item = deinterlace_combo->currentIndex();
|
---|
| 52 | deinterlace_combo->clear();
|
---|
| 53 | deinterlace_combo->addItem( tr("None"), MediaSettings::NoDeinterlace );
|
---|
| 54 | deinterlace_combo->addItem( tr("Lowpass5"), MediaSettings::L5 );
|
---|
| 55 | deinterlace_combo->addItem( tr("Yadif (normal)"), MediaSettings::Yadif );
|
---|
| 56 | deinterlace_combo->addItem( tr("Yadif (double framerate)"), MediaSettings::Yadif_1 );
|
---|
| 57 | deinterlace_combo->addItem( tr("Linear Blend"), MediaSettings::LB );
|
---|
| 58 | deinterlace_combo->addItem( tr("Kerndeint"), MediaSettings::Kerndeint );
|
---|
| 59 | deinterlace_combo->setCurrentIndex(deinterlace_item);
|
---|
| 60 |
|
---|
| 61 | createHelp();
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | void PrefTV::setData(Preferences * pref) {
|
---|
| 65 | setInitialDeinterlace( pref->initial_tv_deinterlace );
|
---|
| 66 | setRescan( pref->check_channels_conf_on_startup );
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | void PrefTV::getData(Preferences * pref) {
|
---|
| 70 | requires_restart = false;
|
---|
| 71 |
|
---|
| 72 | pref->initial_tv_deinterlace = initialDeinterlace();
|
---|
| 73 | pref->check_channels_conf_on_startup = rescan();
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | void PrefTV::setInitialDeinterlace(int ID) {
|
---|
| 77 | int pos = deinterlace_combo->findData(ID);
|
---|
| 78 | if (pos != -1) {
|
---|
| 79 | deinterlace_combo->setCurrentIndex(pos);
|
---|
| 80 | } else {
|
---|
| 81 | qWarning("PrefTV::setInitialDeinterlace: ID: %d not found in combo", ID);
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | int PrefTV::initialDeinterlace() {
|
---|
| 86 | if (deinterlace_combo->currentIndex() != -1) {
|
---|
| 87 | return deinterlace_combo->itemData( deinterlace_combo->currentIndex() ).toInt();
|
---|
| 88 | } else {
|
---|
| 89 | qWarning("PrefTV::initialDeinterlace: no item selected");
|
---|
| 90 | return 0;
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | void PrefTV::setRescan(bool b) {
|
---|
| 95 | rescan_check->setChecked(b);
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | bool PrefTV::rescan() {
|
---|
| 99 | return rescan_check->isChecked();
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | void PrefTV::createHelp() {
|
---|
| 103 | clearHelp();
|
---|
| 104 |
|
---|
| 105 | setWhatsThis(deinterlace_combo, tr("Deinterlace by default for TV"),
|
---|
| 106 | tr("Select the deinterlace filter that you want to be used for TV channels.") );
|
---|
| 107 |
|
---|
| 108 | #ifndef Q_OS_WIN
|
---|
| 109 | setWhatsThis(rescan_check, tr("Rescan ~/.mplayer/channels.conf on startup"),
|
---|
| 110 | tr("If this option is enabled, SMPlayer will look for new TV and radio "
|
---|
| 111 | "channels on ~/.mplayer/channels.conf.ter or ~/.mplayer/channels.conf.") );
|
---|
| 112 | #endif
|
---|
| 113 | }
|
---|
| 114 |
|
---|
| 115 | #include "moc_preftv.cpp"
|
---|