File indexing completed on 2022-08-04 15:34:41

0001 /**
0002  * Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify it under
0005  * the terms of the GNU General Public License as published by the Free Software
0006  * Foundation; either version 2 of the License, or (at your option) any later
0007  * version.
0008  *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
0012  *
0013  * You should have received a copy of the GNU General Public License along with
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.
0015  */
0016 
0017 #ifndef JUK_MEDIAFILES_H
0018 #define JUK_MEDIAFILES_H
0019 
0020 #include <QList>
0021 #include <QUrl>
0022 #include <QStringList>
0023 
0024 class QWidget;
0025 class QString;
0026 
0027 namespace TagLib {
0028     class File;
0029 }
0030 
0031 #include <taglib_config.h>
0032 
0033 /**
0034  * A namespace for file JuK's file related functions.  The goal is to hide
0035  * all specific knowledge of mimetypes and file extensions here.
0036  */
0037 namespace MediaFiles
0038 {
0039     /**
0040      * Returns a list of selected music files to open, or an empty list if
0041      * canceled.
0042      */
0043     QStringList openDialog(QWidget *parent = nullptr);
0044 
0045     /**
0046      * Returns the file name to use to save the playlist with the given name,
0047      * or an empty string if canceled.
0048      */
0049     QString savePlaylistDialog(const QString &playlistName, QWidget *parent = nullptr);
0050 
0051     /**
0052      * Returns a pointer to a new appropriate subclass of TagLib::File, or
0053      * a null pointer if there is no appropriate subclass for the given
0054      * file.
0055      */
0056     TagLib::File *fileFactoryByType(const QString &fileName);
0057 
0058     /**
0059      * Returns true if fileName is a supported media file.
0060      */
0061     bool isMediaFile(const QString &fileName);
0062 
0063     /**
0064      * Returns true if fileName is a supported playlist file.
0065      */
0066     bool isPlaylistFile(const QString &fileName);
0067 
0068     /**
0069      * Returns a list of all supported mimetypes.
0070      */
0071     QStringList mimeTypes();
0072 
0073     /**
0074      * Returns true if fileName is a mp3 file.
0075      */
0076     bool isMP3(const QString &fileName);
0077 
0078     /**
0079      * Returns true if fileName is a mpc (aka musepack) file.
0080      */
0081     bool isMPC(const QString &fileName);
0082 
0083     /**
0084      * Returns true if fileName is an Ogg file.
0085      */
0086     bool isOgg(const QString &fileName);
0087 
0088     /**
0089      * Returns true if fileName is a FLAC file.
0090      */
0091     bool isFLAC(const QString &fileName);
0092 
0093     /**
0094      * Returns true if fileName is an Ogg/Vorbis file.
0095      */
0096     bool isVorbis(const QString &fileName);
0097 
0098     /**
0099      * Returns true if fileName is an ASF file.
0100      */
0101     bool isASF(const QString &fileName);
0102 
0103     /**
0104      * Returns true if fileName is a MP4 file.
0105      */
0106     bool isMP4(const QString &fileName);
0107 
0108     /**
0109      * Returns true if fileName is an Ogg/FLAC file.
0110      */
0111     bool isOggFLAC(const QString &fileName);
0112 
0113     /**
0114      * Returns a list of absolute local filenames, mapped from \p urlList.
0115      * Any URLs in urlList that aren't really local files will be stripped
0116      * from the result (so result.size() may be < urlList.size()).
0117      *
0118      * @param urlList list of file names or URLs to convert.
0119      * @param w KIO may need the widget to handle user interaction.
0120      * @return list of all local files in urlList, converted to absolute paths.
0121      */
0122     QStringList convertURLsToLocal(const QList<QUrl> &urlList, QWidget *w = nullptr);
0123 }
0124 
0125 #endif
0126 
0127 // vim: set et sw=4 tw=0 sta: