[154] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[154] | 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 "prefupdates.h"
|
---|
| 20 | #include "preferences.h"
|
---|
| 21 | #include "images.h"
|
---|
[176] | 22 | #include "updatecheckerdata.h"
|
---|
[154] | 23 |
|
---|
| 24 | PrefUpdates::PrefUpdates(QWidget * parent, Qt::WindowFlags f)
|
---|
| 25 | : PrefWidget(parent, f )
|
---|
| 26 | {
|
---|
| 27 | setupUi(this);
|
---|
| 28 |
|
---|
| 29 | createHelp();
|
---|
| 30 |
|
---|
| 31 | #ifndef UPDATE_CHECKER
|
---|
| 32 | updates_check->hide();
|
---|
| 33 | days_frame->hide();
|
---|
| 34 | #endif
|
---|
| 35 |
|
---|
| 36 | #ifndef CHECK_UPGRADED
|
---|
| 37 | open_page_check->hide();
|
---|
| 38 | #endif
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | PrefUpdates::~PrefUpdates()
|
---|
| 42 | {
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | QString PrefUpdates::sectionName() {
|
---|
| 46 | return tr("Updates");
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | QPixmap PrefUpdates::sectionIcon() {
|
---|
[181] | 50 | return Images::icon("pref_updates");
|
---|
[154] | 51 | }
|
---|
| 52 |
|
---|
| 53 | void PrefUpdates::retranslateStrings() {
|
---|
| 54 | retranslateUi(this);
|
---|
| 55 | createHelp();
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | void PrefUpdates::setData(Preferences * pref) {
|
---|
| 59 | #ifdef UPDATE_CHECKER
|
---|
| 60 | updates_check->setChecked(pref->update_checker_data.enabled);
|
---|
| 61 | days_spin->setValue(pref->update_checker_data.days_to_check);
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | #ifdef CHECK_UPGRADED
|
---|
| 65 | open_page_check->setChecked(pref->check_if_upgraded);
|
---|
| 66 | #endif
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | void PrefUpdates::getData(Preferences * pref) {
|
---|
| 70 | requires_restart = false;
|
---|
| 71 |
|
---|
| 72 | #ifdef UPDATE_CHECKER
|
---|
| 73 | pref->update_checker_data.enabled = updates_check->isChecked();
|
---|
| 74 | pref->update_checker_data.days_to_check = days_spin->value();
|
---|
| 75 | #endif
|
---|
| 76 |
|
---|
| 77 | #ifdef CHECK_UPGRADED
|
---|
| 78 | pref->check_if_upgraded = open_page_check->isChecked();
|
---|
| 79 | #endif
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | void PrefUpdates::createHelp() {
|
---|
| 83 | clearHelp();
|
---|
| 84 |
|
---|
| 85 | #ifdef UPDATE_CHECKER
|
---|
| 86 | setWhatsThis(updates_check, tr("Check for updates"),
|
---|
| 87 | tr("If this option is enabled, SMPlayer will check for updates "
|
---|
| 88 | "and display a notification if a new version is available.") );
|
---|
| 89 |
|
---|
| 90 | setWhatsThis(days_frame, tr("Check interval"),
|
---|
| 91 | tr("You can enter here the interval (in days) for the update checks.") );
|
---|
| 92 | #endif
|
---|
| 93 |
|
---|
| 94 | #ifdef CHECK_UPGRADED
|
---|
[170] | 95 | setWhatsThis(open_page_check, tr("Open an informative page after an upgrade"),
|
---|
| 96 | tr("If this option is enabled, an informative page about SMPlayer "
|
---|
| 97 | "will be opened after an upgrade.") );
|
---|
[154] | 98 | #endif
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | #include "moc_prefupdates.cpp"
|
---|