mapping of Qt::Orientation to be used in linear layouts

update slider position in dataUpdate

svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=906312
This commit is contained in:
Marco Martin 2009-01-05 22:30:30 +00:00
parent 8040abf0b9
commit 8ddb49f755
2 changed files with 10 additions and 3 deletions

View File

@ -42,6 +42,7 @@ class AppletInterface : public QObject
Q_ENUMS(FormFactor) Q_ENUMS(FormFactor)
Q_ENUMS(Location) Q_ENUMS(Location)
Q_ENUMS(AspectRatioMode) Q_ENUMS(AspectRatioMode)
Q_ENUMS(QtOrientation)
public: public:
AppletInterface(SimpleJavaScriptApplet *parent); AppletInterface(SimpleJavaScriptApplet *parent);
~AppletInterface(); ~AppletInterface();
@ -89,6 +90,11 @@ enum AspectRatioMode {
FixedSize = 4 /** The applet cannot be resized */ FixedSize = 4 /** The applet cannot be resized */
}; };
//From Qt namespace
enum QtOrientation {
QtHorizontal= Qt::Horizontal,
QtVertical = Qt::Vertical
};
//------------------------------------------------------------------- //-------------------------------------------------------------------

View File

@ -6,7 +6,8 @@ controller = service("nowplaying", watchingPlayer);
plasmoid.dataUpdate = function(a, b) plasmoid.dataUpdate = function(a, b)
{ {
label.text = "Playing " + b.Title + " by " + b.Artist + ". time: " + label.text = "Playing " + b.Title + " by " + b.Artist + ". time: " +
parseInt(b.Position/60) + ":" + (parseInt(b.Position)%60); parseInt(parseInt(b.Position)/60) + ":" + (parseInt(b.Position)%60);
progress.value = b.Position;
} }
plasmoid.stop = function() plasmoid.stop = function()
@ -34,7 +35,7 @@ plasmoid.setProgress = function(progress)
} }
layout = new LinearLayout(plasmoid); layout = new LinearLayout(plasmoid);
layout.setOrientation(Vertical); layout.setOrientation(QtVertical);
label = new Label(); label = new Label();
layout.addItem(label); layout.addItem(label);
@ -47,7 +48,7 @@ controller.associateWidget(stop, "stop");
stop["clicked()"].connect(plasmoid.stop); stop["clicked()"].connect(plasmoid.stop);
progress = new Slider(); progress = new Slider();
progress.orientation = Horizontal; progress.orientation = QtHorizontal;
layout.addItem(progress); layout.addItem(progress);
controller.associateWidget(progress, "progress"); controller.associateWidget(progress, "progress");