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