File indexing completed on 2025-01-05 04:26:50

0001 /****************************************************************************************
0002  * Copyright (c) 2008 Ian Monroe <ian@monroe.nu>                                        *
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) version 3 or        *
0007  * any later version accepted by the membership of KDE e.V. (or its successor approved  *
0008  * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of  *
0009  * version 3 of the license.                                                            *
0010  *                                                                                      *
0011  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0013  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0014  *                                                                                      *
0015  * You should have received a copy of the GNU General Public License along with         *
0016  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0017  ****************************************************************************************/
0018 
0019 #ifndef AMAROK_INFO_SCRIPT_H
0020 #define AMAROK_INFO_SCRIPT_H
0021 
0022 #include <QObject>
0023 #include <QUrl>
0024 
0025 
0026 namespace AmarokScript
0027 {
0028     class AmarokScriptEngine;
0029 
0030     // SCRIPTDOX Amarok.Info
0031     class InfoScript : public QObject
0032     {
0033         Q_OBJECT
0034 
0035         public:
0036             // SCRIPTDOX enum Amarok.Info.IconSizes
0037             enum IconSizes {
0038                 Small=16,
0039                 SmallMedium=22,
0040                 Medium=32,
0041                 Large=48,
0042                 Huge=64,
0043                 Enormous=128
0044             };
0045             Q_ENUM( IconSizes )
0046 
0047             InfoScript( const QUrl &scriptUrl, AmarokScriptEngine *engine );
0048 
0049             /**
0050              * The directory where the script's main.js file is located
0051              */
0052             Q_INVOKABLE QString scriptPath() const;
0053 
0054             /**
0055              * Return the location of the specified config
0056              */
0057             Q_INVOKABLE QString scriptConfigPath( const QString& name ) const;
0058 
0059             /**
0060              * Return the path to the standard icon with the given name.
0061              * Icons will be searched in current icon theme and all its base themes.
0062              * @param name The name of the icon, without extension. If an absolute
0063              * path is supplied for this parameter, iconPath will return it
0064              * directly.
0065              * @param size Search icons whose size is @p size.
0066              * See Info.IconSizes
0067              */
0068             Q_INVOKABLE QString iconPath( const QString& name, int size ) const;
0069 
0070             /**
0071              * The current Amarok version.
0072              */
0073             Q_INVOKABLE QString version() const;
0074 
0075         private:
0076             const QUrl m_scriptUrl;
0077     };
0078 
0079 } // namespace AmarokScript
0080 
0081 #endif