| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2016 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 | static QString timeForJumps(int secs);
|
|---|
| 40 |
|
|---|
| 41 | // Give a name for config (group name) based on dvd id
|
|---|
| 42 | /* static QString dvdForPref(const QString & dvd_id, int title); */
|
|---|
| 43 |
|
|---|
| 44 | #ifdef Q_OS_WIN
|
|---|
| 45 | static QString shortPathName(QString long_path);
|
|---|
| 46 |
|
|---|
| 47 | //! Enable or disables the screensaver
|
|---|
| 48 | /* static void setScreensaverEnabled(bool b); */
|
|---|
| 49 | #endif
|
|---|
| 50 |
|
|---|
| 51 | static void msleep(int ms);
|
|---|
| 52 |
|
|---|
| 53 | //! Change filenames like "C:/Program Files/" to "C:\Program Files\"
|
|---|
| 54 | static QString changeSlashes(QString filename);
|
|---|
| 55 |
|
|---|
| 56 | static bool directoryContainsDVD(QString directory);
|
|---|
| 57 |
|
|---|
| 58 | //! Returns an int with the version number of Qt at run-time.
|
|---|
| 59 | //! If version is 4.3.2 it returns 40302.
|
|---|
| 60 | static int qtVersion();
|
|---|
| 61 |
|
|---|
| 62 | //! Returns a string to be passed to mplayer with the audio equalizer
|
|---|
| 63 | //! values.
|
|---|
| 64 | static QString equalizerListToString(AudioEqualizerList values);
|
|---|
| 65 |
|
|---|
| 66 | static QStringList filesForPlaylist(const QString & initial_file, Preferences::AutoAddToPlaylistFilter filter);
|
|---|
| 67 |
|
|---|
| 68 | #ifdef Q_OS_WIN
|
|---|
| 69 | static QStringList resolveSymlinks(const QStringList & files);
|
|---|
| 70 | #endif
|
|---|
| 71 |
|
|---|
| 72 | #ifndef Q_OS_WIN
|
|---|
| 73 | //! Tries to find the executable in the path.
|
|---|
| 74 | //! Returns the path if found or QString::null if not.
|
|---|
| 75 | static QString findExecutable(const QString & name);
|
|---|
| 76 | #endif
|
|---|
| 77 |
|
|---|
| 78 | private:
|
|---|
| 79 | static QStringList searchForConsecutiveFiles(const QString & initial_file);
|
|---|
| 80 | static QStringList filesInDirectory(const QString & initial_file, const QStringList & filter);
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | #endif
|
|---|