| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2016 Ricardo Villalba <[email protected]>
|
|---|
| 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 "prefplaylist.h"
|
|---|
| 20 | #include "preferences.h"
|
|---|
| 21 | #include "images.h"
|
|---|
| 22 |
|
|---|
| 23 | PrefPlaylist::PrefPlaylist(QWidget * parent, Qt::WindowFlags f)
|
|---|
| 24 | : PrefWidget(parent, f )
|
|---|
| 25 | {
|
|---|
| 26 | setupUi(this);
|
|---|
| 27 | retranslateStrings();
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | PrefPlaylist::~PrefPlaylist() {
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | QString PrefPlaylist::sectionName() {
|
|---|
| 34 | return tr("Playlist");
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | QPixmap PrefPlaylist::sectionIcon() {
|
|---|
| 38 | return Images::icon("pref_playlist");
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | void PrefPlaylist::retranslateStrings() {
|
|---|
| 42 | retranslateUi(this);
|
|---|
| 43 |
|
|---|
| 44 | int index = media_to_add_combo->currentIndex();
|
|---|
| 45 | media_to_add_combo->clear();
|
|---|
| 46 | media_to_add_combo->addItem(tr("None"), Preferences::NoFiles);
|
|---|
| 47 | media_to_add_combo->addItem(tr("Video files"), Preferences::VideoFiles);
|
|---|
| 48 | media_to_add_combo->addItem(tr("Audio files"), Preferences::AudioFiles);
|
|---|
| 49 | media_to_add_combo->addItem(tr("Video and audio files"), Preferences::MultimediaFiles);
|
|---|
| 50 | media_to_add_combo->addItem(tr("Consecutive files"), Preferences::ConsecutiveFiles);
|
|---|
| 51 | media_to_add_combo->setCurrentIndex(index);
|
|---|
| 52 |
|
|---|
| 53 | createHelp();
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | void PrefPlaylist::setData(Preferences * pref) {
|
|---|
| 57 | setAutoAddFilesToPlaylist( pref->auto_add_to_playlist );
|
|---|
| 58 | setMediaToAdd( pref->media_to_add_to_playlist );
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | void PrefPlaylist::getData(Preferences * pref) {
|
|---|
| 62 | requires_restart = false;
|
|---|
| 63 |
|
|---|
| 64 | pref->auto_add_to_playlist = autoAddFilesToPlaylist();
|
|---|
| 65 | pref->media_to_add_to_playlist = (Preferences::AutoAddToPlaylistFilter) mediaToAdd();
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | void PrefPlaylist::setAutoAddFilesToPlaylist(bool b) {
|
|---|
| 69 | auto_add_to_playlist_check->setChecked(b);
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | bool PrefPlaylist::autoAddFilesToPlaylist() {
|
|---|
| 73 | return auto_add_to_playlist_check->isChecked();
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | void PrefPlaylist::setMediaToAdd(int type) {
|
|---|
| 77 | int i = media_to_add_combo->findData(type);
|
|---|
| 78 | if (i < 0) i = 0;
|
|---|
| 79 | media_to_add_combo->setCurrentIndex(i);
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | int PrefPlaylist::mediaToAdd() {
|
|---|
| 83 | return media_to_add_combo->itemData( media_to_add_combo->currentIndex() ).toInt();
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | void PrefPlaylist::setDirectoryRecursion(bool b) {
|
|---|
| 87 | recursive_check->setChecked(b);
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | bool PrefPlaylist::directoryRecursion() {
|
|---|
| 91 | return recursive_check->isChecked();
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | void PrefPlaylist::setAutoGetInfo(bool b) {
|
|---|
| 95 | getinfo_check->setChecked(b);
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | bool PrefPlaylist::autoGetInfo() {
|
|---|
| 99 | return getinfo_check->isChecked();
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | void PrefPlaylist::setSavePlaylistOnExit(bool b) {
|
|---|
| 103 | autosave_on_exit_check->setChecked(b);
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | bool PrefPlaylist::savePlaylistOnExit() {
|
|---|
| 107 | return autosave_on_exit_check->isChecked();
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | void PrefPlaylist::setPlayFilesFromStart(bool b) {
|
|---|
| 111 | play_from_start_check->setChecked(b);
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | bool PrefPlaylist::playFilesFromStart() {
|
|---|
| 115 | return play_from_start_check->isChecked();
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | void PrefPlaylist::setIgnorePlayerErrors(bool b) {
|
|---|
| 119 | ignore_errors_check->setChecked(b);
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | bool PrefPlaylist::ignorePlayerErrors() {
|
|---|
| 123 | return ignore_errors_check->isChecked();
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | void PrefPlaylist::createHelp() {
|
|---|
| 127 | clearHelp();
|
|---|
| 128 |
|
|---|
| 129 | setWhatsThis(auto_add_to_playlist_check, tr("Automatically add files to playlist"),
|
|---|
| 130 | tr("If this option is enabled, every time a file is opened, SMPlayer "
|
|---|
| 131 | "will first clear the playlist and then add the file to it. In "
|
|---|
| 132 | "case of DVDs, CDs and VCDs, all titles in the disc will be added "
|
|---|
| 133 | "to the playlist.") );
|
|---|
| 134 |
|
|---|
| 135 | setWhatsThis(media_to_add_combo, tr("Add files from folder"),
|
|---|
| 136 | tr("This option allows to add files automatically to the playlist:") +"<br>"+
|
|---|
| 137 | tr("<b>None</b>: no files will be added") +"<br>"+
|
|---|
| 138 | tr("<b>Video files</b>: all video files found in the folder will be added") +"<br>"+
|
|---|
| 139 | tr("<b>Audio files</b>: all audio files found in the folder will be added") +"<br>"+
|
|---|
| 140 | tr("<b>Video and audio files</b>: all video and audio files found in the folder will be added") +"<br>"+
|
|---|
| 141 | tr("<b>Consecutive files</b>: consecutive files (like video_1.avi, video_2.avi) will be added") );
|
|---|
| 142 |
|
|---|
| 143 | setWhatsThis(play_from_start_check, tr("Play files from start"),
|
|---|
| 144 | tr("If this option is enabled, all files from the playlist will "
|
|---|
| 145 | "start to play from the beginning instead of resuming from a "
|
|---|
| 146 | "previous playback.") );
|
|---|
| 147 |
|
|---|
| 148 | setWhatsThis(recursive_check, tr("Add files in directories recursively"),
|
|---|
| 149 | tr("Check this option if you want that adding a directory will also "
|
|---|
| 150 | "add the files in subdirectories recursively. Otherwise only the "
|
|---|
| 151 | "files in the selected directory will be added."));
|
|---|
| 152 |
|
|---|
| 153 | setWhatsThis(getinfo_check, tr("Get info automatically about files added"),
|
|---|
| 154 | tr("Check this option to inquire the files to be added to the playlist "
|
|---|
| 155 | "for some info. That allows to show the title name (if available) and "
|
|---|
| 156 | "length of the files. Otherwise this info won't be available until "
|
|---|
| 157 | "the file is actually played. Beware: this option can be slow, "
|
|---|
| 158 | "specially if you add many files."));
|
|---|
| 159 |
|
|---|
| 160 | setWhatsThis(autosave_on_exit_check, tr("Save copy of playlist on exit"),
|
|---|
| 161 | tr("If this option is checked, a copy of the playlist will be saved "
|
|---|
| 162 | "in the smplayer configuration when smplayer is closed, and it will "
|
|---|
| 163 | "reloaded automatically when smplayer is run again."));
|
|---|
| 164 |
|
|---|
| 165 | setWhatsThis(ignore_errors_check, tr("Play next file even if the previous file failed"),
|
|---|
| 166 | tr("If this option is enabled, the playlist will ignore playback errors from a previous file "
|
|---|
| 167 | "and will play the next file in the list.") );
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | #include "moc_prefplaylist.cpp"
|
|---|