1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2017 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 "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::setPlayOnLoad(bool b) {
|
---|
119 | play_on_load_check->setChecked(b);
|
---|
120 | }
|
---|
121 |
|
---|
122 | bool PrefPlaylist::playOnLoad() {
|
---|
123 | return play_on_load_check->isChecked();
|
---|
124 | }
|
---|
125 |
|
---|
126 | void PrefPlaylist::setPlayNextAutomatically(bool b) {
|
---|
127 | play_next_automatically_check->setChecked(b);
|
---|
128 | }
|
---|
129 |
|
---|
130 | bool PrefPlaylist::playNextAutomatically() {
|
---|
131 | return play_next_automatically_check->isChecked();
|
---|
132 | }
|
---|
133 |
|
---|
134 | void PrefPlaylist::setIgnorePlayerErrors(bool b) {
|
---|
135 | ignore_errors_check->setChecked(b);
|
---|
136 | }
|
---|
137 |
|
---|
138 | bool PrefPlaylist::ignorePlayerErrors() {
|
---|
139 | return ignore_errors_check->isChecked();
|
---|
140 | }
|
---|
141 |
|
---|
142 | void PrefPlaylist::setAutoSort(bool b) {
|
---|
143 | autosort_check->setChecked(b);
|
---|
144 | }
|
---|
145 |
|
---|
146 | bool PrefPlaylist::autoSort() {
|
---|
147 | return autosort_check->isChecked();
|
---|
148 | }
|
---|
149 |
|
---|
150 | void PrefPlaylist::setFilterCaseSensitive(bool b) {
|
---|
151 | case_sensitive_search_check->setChecked(b);
|
---|
152 | }
|
---|
153 |
|
---|
154 | bool PrefPlaylist::filterCaseSensitive() {
|
---|
155 | return case_sensitive_search_check->isChecked();
|
---|
156 | }
|
---|
157 |
|
---|
158 | void PrefPlaylist::createHelp() {
|
---|
159 | clearHelp();
|
---|
160 |
|
---|
161 | setWhatsThis(play_from_start_check, tr("Play files from start"),
|
---|
162 | tr("If this option is enabled, all files from the playlist will "
|
---|
163 | "start to play from the beginning instead of resuming from a "
|
---|
164 | "previous playback.") );
|
---|
165 |
|
---|
166 | setWhatsThis(play_on_load_check, tr("Start playback after loading a playlist"),
|
---|
167 | tr("Playback will start just after loading a playlist.") );
|
---|
168 |
|
---|
169 | setWhatsThis(play_next_automatically_check, tr("Play next file automatically"),
|
---|
170 | tr("When a file reaches the end, the next file will be played automatically.") );
|
---|
171 |
|
---|
172 | setWhatsThis(ignore_errors_check, tr("Ignore playback errors"),
|
---|
173 | tr("If this option is enabled, the playlist will ignore playback errors from a previous file "
|
---|
174 | "and will play the next file in the list.") );
|
---|
175 |
|
---|
176 | setWhatsThis(auto_add_to_playlist_check, tr("Add files to the playlist automatically"),
|
---|
177 | tr("If this option is enabled, every time a file is opened, SMPlayer "
|
---|
178 | "will first clear the playlist and then add the file to it. In "
|
---|
179 | "case of DVDs, CDs and VCDs, all titles in the disc will be added "
|
---|
180 | "to the playlist.") );
|
---|
181 |
|
---|
182 | setWhatsThis(media_to_add_combo, tr("Add files from folder"),
|
---|
183 | tr("This option can be used to add files automatically to the playlist:") +"<br>"+
|
---|
184 | tr("<b>None</b>: no files will be added") +"<br>"+
|
---|
185 | tr("<b>Video files</b>: all video files found in the folder will be added") +"<br>"+
|
---|
186 | tr("<b>Audio files</b>: all audio files found in the folder will be added") +"<br>"+
|
---|
187 | tr("<b>Video and audio files</b>: all video and audio files found in the folder will be added") +"<br>"+
|
---|
188 | tr("<b>Consecutive files</b>: consecutive files (like video_1.avi, video_2.avi) will be added") );
|
---|
189 |
|
---|
190 |
|
---|
191 | setWhatsThis(recursive_check, tr("Add files in directories recursively"),
|
---|
192 | tr("Check this option if you want that adding a directory will also "
|
---|
193 | "add the files in subdirectories recursively. Otherwise only the "
|
---|
194 | "files in the selected directory will be added."));
|
---|
195 |
|
---|
196 | setWhatsThis(getinfo_check, tr("Get info automatically about files added"),
|
---|
197 | tr("Check this option to inquire the files to be added to the playlist "
|
---|
198 | "for some info. That allows to show the title name (if available) and "
|
---|
199 | "length of the files. Otherwise this info won't be available until "
|
---|
200 | "the file is actually played. Beware: this option can be slow, "
|
---|
201 | "specially if you add many files."));
|
---|
202 |
|
---|
203 | setWhatsThis(autosort_check, tr("Auto sort"),
|
---|
204 | tr("If this option is enabled the list will be sorted automatically after adding files."));
|
---|
205 |
|
---|
206 | setWhatsThis(case_sensitive_search_check, tr("Case sensitive search"),
|
---|
207 | tr("This option specifies whether the search in the playlist is case sensitive or not."));
|
---|
208 |
|
---|
209 | setWhatsThis(autosave_on_exit_check, tr("Save a copy of the playlist on exit"),
|
---|
210 | tr("If this option is checked, a copy of the playlist will be saved "
|
---|
211 | "in the configuration file when SMPlayer is closed, and it will "
|
---|
212 | "reloaded automatically when SMPlayer is run again."));
|
---|
213 | }
|
---|
214 |
|
---|
215 | #include "moc_prefplaylist.cpp"
|
---|