File indexing completed on 2024-06-02 04:52:44
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Peter ZHOU <peterzhoulei@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 SCRIPT_IMPORTER_H 0018 #define SCRIPT_IMPORTER_H 0019 0020 0021 #include <QObject> 0022 #include <QSet> 0023 #include <QStringList> 0024 #include <QUrl> 0025 0026 class QStringList; 0027 0028 namespace AmarokScript 0029 { 0030 class AmarokScriptEngine; 0031 0032 // SCRIPTDOX: Importer 0033 class ScriptImporter : public QObject 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 ScriptImporter( AmarokScriptEngine *scriptEngine, const QUrl &url ); 0039 0040 Q_INVOKABLE QStringList availableBindings() const; 0041 Q_INVOKABLE bool loadAmarokBinding( const QString &name ); 0042 Q_INVOKABLE void loadExtension( const QString &src ); 0043 Q_INVOKABLE bool loadQtBinding( const QString &binding ); 0044 Q_INVOKABLE bool include( const QString &relativeFile ); 0045 0046 private: 0047 const QUrl m_scriptUrl; 0048 AmarokScriptEngine *m_engine; 0049 QSet<QString> m_importedBindings; 0050 bool m_qtScriptCompat = true; 0051 }; 0052 } 0053 0054 #endif