-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
57 lines (46 loc) · 1.56 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Importer.loadQtBinding( "qt.core" );
Importer.loadQtBinding( "qt.sql" );
Importer.loadQtBinding( "qt.gui");
Importer.include("configuration.js");
Importer.include("window.js");
Importer.include("playlist.js");
function msg( str ){
Amarok.debug(str);
}
function sql_exec(query){
msg("[SQL] " + query);
var res = Amarok.Collection.query(query);
msg(res);
return res;
}
function qsTr(msg){
return QCoreApplication.translate("Rating Statistics", msg);
}
function quit(){
stWindow.close();
config.close();
msg("script finished");
Amarok.end(); //FIXME: http://bugs.kde.org/show_bug.cgi?id=175049 on older versions crashes amarok:
}
function showWindowCallback() {
msg("Creating new translator");
this.trans = new QTranslator;
var localeFile = Amarok.Info.scriptPath() + "/translations/qm/amarok_rating_statistics_" + QLocale.system().name() + ".qm";
msg("locale File: " + localeFile);
msg(this.trans.load(localeFile));
QCoreApplication.installTranslator(this.trans);
msg("Showing main window...");
var stWindow = new StatisticsWindow();
stWindow.show();
msg("done");
}
if (Amarok.Window.addToolsMenu("rating_statistics", "Rating Statistics", "emblem-favorite-amarok")){
var rating_statistics_button = Amarok.Window.ToolsMenu.rating_statistics;
rating_statistics_button['triggered()'].connect(showWindowCallback);
} else {
msg("Rating Statistics menu already exists!");
}
var config = new Configuration;
var playlistImporter = new PlaylistImporter;
config.loadConfiguration();
//showWindowCallback();