File indexing completed on 2024-04-28 12:34:45

0001 /****************************************************************************************
0002  * Copyright (C) 2010 Ralf Engels <ralf-engels@gmx.de>                                  *
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 AMAROK_METATAGLIB_H
0018 #define AMAROK_METATAGLIB_H
0019 
0020 #include "MetaValues.h"
0021 #include "amarokshared_export.h"
0022 
0023 #include <QString>
0024 
0025 /* This file exists because we need to share the implementation between
0026  * amaroklib and amarokcollectionscanner (which doesn't link to amaroklib).
0027  */
0028 namespace Meta
0029 {
0030     namespace Tag
0031     {
0032         AMAROKSHARED_EXPORT Meta::FieldHash readTags( const QString &path, bool useCharsetDetector = true );
0033 
0034         /**
0035          * Writes tags stored in @param changes back to file. Respects
0036          * AmarokConfig::writeBack() and AmarokConfig::writeBackStatistics().
0037          *
0038          * If you are about to call this from the main thread, you should really think
0039          * of using WriteTagsJob instead.
0040          *
0041          * Changed in 2.8: this method no longer checks AmarokConfig::writeBack()
0042          *
0043          * @param path path of the file to write the tags to
0044          * @param changes Meta:val* key to value map of tags to write
0045          * @param writeStatistics whether to include statistics-related tags when writing
0046          *
0047          * @see WriteTagsJob
0048          */
0049         AMAROKSHARED_EXPORT void writeTags( const QString &path,
0050                                             const Meta::FieldHash &changes,
0051                                             bool writeStatistics );
0052 
0053         // the utilities don't need to handle images
0054         AMAROKSHARED_EXPORT QImage embeddedCover( const QString &path );
0055 
0056         /**
0057          * Writes embedded cover back to file. Overwrites any possible existing covers.
0058          * This function doesn't take any configuration any account.
0059          *
0060          * If you are about to call this from the main thread, you should really think
0061          * of using WriteTagsJob instead.
0062          *
0063          * @see WriteTagsJob
0064          */
0065         AMAROKSHARED_EXPORT void setEmbeddedCover( const QString &path, const QImage &cover );
0066     }
0067 }
0068 
0069 #endif // AMAROK_METATAGLIB_H