source: smplayer/vendor/current/src/prefplaylist.cpp@ 175

Last change on this file since 175 was 175, checked in by Silvan Scherrer, 10 years ago

smplayer: update vendor to version 16.4

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