1 /**************************************************************************************** 2 * Copyright (c) 2008 Peter ZHOU <peterzhoulei@gmail.com> * 3 * * 4 * This program is free software; you can redistribute it and/or modify it under * 5 * the terms of the GNU General Public License as published by the Free Software * 6 * Foundation; either version 2 of the License, or (at your option) any later * 7 * version. * 8 * * 9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 12 * * 13 * You should have received a copy of the GNU General Public License along with * 14 * this program. If not, see <http://www.gnu.org/licenses/>. * 15 ****************************************************************************************/ 16 17 #ifndef AMAROK_OSD_SCRIPT_H 18 #define AMAROK_OSD_SCRIPT_H 19 20 #include <QObject> 21 22 class QColor; 23 class QImage; 24 class QJSEngine; 25 26 namespace AmarokScript 27 { 28 // SCRIPTDOX: Amarok.Window.OSD 29 class AmarokOSDScript : public QObject 30 { 31 Q_OBJECT 32 33 Q_PROPERTY ( bool osdEnabled READ osdEnabled WRITE setOsdEnabled ) 34 35 public: 36 explicit AmarokOSDScript( QJSEngine* scriptEngine ); 37 38 /** 39 * Show an OSD for the currently playing track, even if the OSD 40 * has been disabled by the user. 41 */ 42 Q_INVOKABLE void showCurrentTrack(); 43 44 /** 45 * Forces an OSD update. 46 * OSD settings changes do not take effect until the next time 47 * the OSD is shown. 48 * To show an OSD with the current settings, call show(); 49 */ 50 Q_INVOKABLE void show(); 51 52 /** 53 * Set the OSD duration 54 */ 55 Q_INVOKABLE void setDuration( int ms ); 56 57 /** 58 * Set the OSD textcolor 59 */ 60 Q_INVOKABLE void setTextColor( const QColor &color ); 61 62 /** 63 * Set the OSD's y-offset. 64 */ 65 Q_INVOKABLE void setOffset( int y ); 66 67 /** 68 * Set the image to be shown in the OSD. 69 */ 70 Q_INVOKABLE void setImage( const QImage &image ); 71 72 /** 73 * Set the screen on which to show the OSD. 74 */ 75 Q_INVOKABLE void setScreen( int screen ); 76 77 /** 78 * Set the OSD text 79 */ 80 Q_INVOKABLE void setText( const QString &text ); 81 82 /** 83 * Set the number of half-stars to be shown in the OSD. 84 * Amarok must be playing a track for the stars to show. 85 */ 86 Q_INVOKABLE void setRating( const short rating ); 87 88 private: 89 void setOsdEnabled( bool enable ); 90 bool osdEnabled(); 91 }; 92 } 93 94 #endif 95