Quantcast
Viewing all articles
Browse latest Browse all 2

GSoC Week Four

AH! Some big progresses and decisions have been made this week. So let's take a quick glance at the new Amarok Scripting interface. Here we go!

var Engine;
Engine = Amarok.Engine;
Engine.Stop( true );
Engine.Play();
Engine.Seek ( 60*1000 );

Image may be NSFW.
Clik here to view.


You can run the QtScript code using the script manager. Is the code simple enough for you? Using the code above, you can control the music engine of Amarok. For the current track info, just use AttriVal = Amarok.Engine.TrackInfo.someAttr.

No need to import libs for using any APIs. Besides, you will also be able to use the entire Qt APIs in the near future!

Now, let's add two menu objects under the "Tool" menu:

function Menu1Clicked()
{
print ("hey, I am menu1!");
}

function Menu2Clicked()
{
print ("hey, I am menu2!");
}

Amarok.Window.addSeparator();
Amarok.Window.addMenu( "testMenu1" ); //you are creating a new object here!
Amarok.Window.addMenu( "testMenu2" );

Amarok.Window.Menu.testMenu1.triggered.connect(Menu1Clicked); //then we can play with the new toy Image may be NSFW.
Clik here to view.
:-)

Amarok.Window.Menu.testMenu2.triggered.connect(Menu2Clicked);

Image may be NSFW.
Clik here to view.


Finally, you can control the OSD and the statusbar widget (in the right bottom corner of the main window) using the code below:

var OSD = Amarok.OSD;
OSD.setText( "Hey there!" );
OSD.show();

var StatusBar = Amarok.Window.Statusbar;
StatusBar.shortMessage( "Hey there!" );

Image may be NSFW.
Clik here to view.


Still a young wolf ah? A lot more APIs need to be implemented, like the playlist, collection, services, some GUI control, and networking APIs...

I am really happy as I am growing with Amarok. Let's pray for an another productive week, and wait for more magics pop up! Image may be NSFW.
Clik here to view.
:-D

Viewing all articles
Browse latest Browse all 2

Trending Articles