source: smplayer/trunk/src/extensions.cpp@ 188

Last change on this file since 188 was 188, checked in by Silvan Scherrer, 8 years ago

SMPlayer: update trunk to version 17.1.0

  • Property svn:eol-style set to LF
File size: 2.9 KB
Line 
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 "extensions.h"
20#include <QDebug>
21
22ExtensionList::ExtensionList() : QStringList()
23{
24}
25
26QString ExtensionList::forFilter() {
27 QString s;
28 for (int n=0; n < count(); n++) {
29 s = s + "*." + at(n) + " ";
30 }
31 if (!s.isEmpty()) s = " (" + s + ")";
32 return s;
33}
34
35QStringList ExtensionList::forDirFilter() {
36 QStringList l;
37 for (int n=0; n < count(); n++) {
38 QString s = "*." + at(n);
39 l << s;
40 }
41 return l;
42}
43
44QString ExtensionList::forRegExp() {
45 QString s;
46 for (int n=0; n < count(); n++) {
47 if (!s.isEmpty()) s = s + "|";
48 s = s + "^" + at(n) + "$";
49 }
50 return s;
51}
52
53Extensions::Extensions()
54{
55 _video << "avi" << "vfw" << "divx"
56 << "mpg" << "mpeg" << "m1v" << "m2v" << "mpv" << "dv" << "3gp"
57 << "mov" << "mp4" << "m4v" << "mqv"
58 << "dat" << "vcd"
59 << "ogg" << "ogm" << "ogv" << "ogx"
60 << "asf" << "wmv"
61 << "bin" << "iso" << "vob"
62 << "mkv" << "nsv" << "ram" << "flv"
63 << "rm" << "swf"
64 << "ts" << "rmvb" << "dvr-ms" << "m2t" << "m2ts" << "mts" << "rec" << "wtv"
65 << "f4v" << "hdmov" << "webm" << "vp8"
66 << "bik" << "smk" << "m4b" << "wtv";
67
68 _audio << "mp3" << "ogg" << "oga" << "wav" << "wma" << "aac" << "ac3" << "dts" << "ra" << "ape" << "flac" << "thd" << "mka" << "m4a";
69
70 _subtitles << "srt" << "sub" << "ssa" << "ass" << "idx" << "txt" << "smi"
71 << "rt" << "utf" << "aqt";
72
73 _playlist << "m3u" << "m3u8" << "pls" << "xspf";
74
75 _multimedia = _video;
76 for (int n = 0; n < _audio.count(); n++) {
77 if (!_multimedia.contains(_audio[n])) _multimedia << _audio[n];
78 }
79
80 _all_playable << _multimedia << _playlist;
81}
82
83Extensions::~Extensions() {
84}
85
86QString Extensions::extensionFromUrl(const QString & url) {
87 //qDebug() << "Extensions::extensionFromUrl:" << url;
88
89 QString extension;
90 int pos = url.lastIndexOf(".");
91 if (pos != -1) {
92 extension = url.mid(pos+1).toLower();
93 // Check if extension contains a '?' and remove everything after it
94 pos = extension.lastIndexOf("?");
95 if (pos != -1) {
96 extension = extension.left(pos);
97 }
98 }
99
100 //qDebug() << "Extensions::extensionFromUrl: extension:" << extension;
101 return extension;
102}
103
Note: See TracBrowser for help on using the repository browser.