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 |
|
---|
20 | #ifndef HELPER_H
|
---|
21 | #define HELPER_H
|
---|
22 |
|
---|
23 | #include <QString>
|
---|
24 | #include <QStringList>
|
---|
25 | #include "audioequalizerlist.h"
|
---|
26 | #include "preferences.h"
|
---|
27 |
|
---|
28 | #ifdef Q_OS_WIN
|
---|
29 | #include "config.h"
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | class Helper {
|
---|
33 |
|
---|
34 | public:
|
---|
35 |
|
---|
36 | // Format a time (hh:mm:ss)
|
---|
37 | static QString formatTime(int secs);
|
---|
38 |
|
---|
39 | // Format a time (hh:mm:ss.cc)
|
---|
40 | static QString formatTime2(double secs);
|
---|
41 |
|
---|
42 | static QString timeForJumps(int secs);
|
---|
43 |
|
---|
44 | // Give a name for config (group name) based on dvd id
|
---|
45 | /* static QString dvdForPref(const QString & dvd_id, int title); */
|
---|
46 |
|
---|
47 | #ifdef Q_OS_WIN
|
---|
48 | static QString shortPathName(QString long_path);
|
---|
49 |
|
---|
50 | //! Enable or disables the screensaver
|
---|
51 | /* static void setScreensaverEnabled(bool b); */
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | static void msleep(int ms);
|
---|
55 |
|
---|
56 | //! Change filenames like "C:/Program Files/" to "C:\Program Files\"
|
---|
57 | static QString changeSlashes(QString filename);
|
---|
58 |
|
---|
59 | static bool directoryContainsDVD(QString directory);
|
---|
60 |
|
---|
61 | //! Returns an int with the version number of Qt at run-time.
|
---|
62 | //! If version is 4.3.2 it returns 40302.
|
---|
63 | static int qtVersion();
|
---|
64 |
|
---|
65 | //! Returns a string to be passed to mplayer with the audio equalizer
|
---|
66 | //! values.
|
---|
67 | static QString equalizerListToString(AudioEqualizerList values);
|
---|
68 |
|
---|
69 | static QStringList filesForPlaylist(const QString & initial_file, Preferences::AutoAddToPlaylistFilter filter);
|
---|
70 |
|
---|
71 | #ifdef Q_OS_WIN
|
---|
72 | static QStringList resolveSymlinks(const QStringList & files);
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #ifndef Q_OS_WIN
|
---|
76 | //! Tries to find the executable in the path.
|
---|
77 | //! Returns the path if found or QString::null if not.
|
---|
78 | static QString findExecutable(const QString & name);
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | private:
|
---|
82 | static QStringList searchForConsecutiveFiles(const QString & initial_file);
|
---|
83 | static QStringList filesInDirectory(const QString & initial_file, const QStringList & filter);
|
---|
84 | };
|
---|
85 |
|
---|
86 | #endif
|
---|