File indexing completed on 2024-05-05 04:47:22

0001 /****************************************************************************************
0002  * Copyright (c) 2009 Casey Link <unnamedrambler@gmail.com>                             *
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 PLAYURLGENERATOR_H
0018 #define PLAYURLGENERATOR_H
0019 
0020 #include "amarok_export.h"
0021 #include "AmarokUrlGenerator.h"
0022 #include "core/meta/forward_declarations.h"
0023 
0024 #include <QString>
0025 
0026 class AmarokUrl;
0027 
0028 /**
0029  * A class used to generate and modify amarok://play/ urls.
0030  *
0031  * The format of a 'play' amarokurl is:
0032  * amarok://play/\<Base 64 Encoded playableUrl() of the track\>/\<integer seconds\>
0033  */
0034 class AMAROK_EXPORT PlayUrlGenerator : public AmarokUrlGenerator
0035 {
0036 public:
0037 
0038     static PlayUrlGenerator * instance();
0039 
0040     AmarokUrl createCurrentTrackBookmark();
0041     AmarokUrl createTrackBookmark( Meta::TrackPtr track, qint64 miliseconds, const QString &name = QString() );
0042 
0043     /**
0044      * Updates the position of the bookmark named @param name to @param newMiliseconds
0045      * for the track @param track .
0046      *
0047      * The name should be a valid bookmark name and should include the trailing "- mm:ss".
0048      * Bookmark is renamed according to track title and new position, too.
0049      */
0050     void moveTrackBookmark( Meta::TrackPtr track, qint64 newMiliseconds, const QString &name );
0051 
0052     QString description() override;
0053     QIcon icon() override;
0054     AmarokUrl createUrl() override;
0055 
0056 private:
0057     PlayUrlGenerator();
0058     ~PlayUrlGenerator() override;
0059 
0060     static PlayUrlGenerator * s_instance;
0061 };
0062 
0063 #endif // PLAYURLGENERATOR_H