#!/usr/bin/env kjscmd StdDirs.addResourceType("madminute", StdDirs.kde_default("data") + "/madminute"); try { //var view = Factory.loadui( StdDirs.findResource("madminute", "madminute.ui"), this, mw ); var view = Factory.loadui( "madminute.ui" ); } catch( err ) { alert( err ); exit(0); } var Addition = 1; var Subtraction = 2; var config = new Config("madminute"); config.setGroup("Game Options"); // Timer var timer = new QTimer(this); // Current Argument 1 var arg1 = 0; // Current Argument 2 var arg2 = 0; // Current Operation var operation = Addition; // Acceptable operations 1 = Addition 2 = Subtraction 3 = Both var operations = config.readNumEntry("Operations", Addition); // Time to run the drill var drillTime = config.readNumEntry("Drill Time", 60); // maxInput is maximum value for the numbers in the question var maxInput = config.readNumEntry("Maximum Input", 10); var total = 0; view.connect(view.fileExitAction, 'activated()', application, 'quit()'); view.connect(view.fileGoAction, 'activated()', this, 'start'); view.connect(view.editPreferencesAction, 'activated()', this, 'configure'); view.connect(view.helpAboutAction, 'activated()', this, 'about'); view.connect(view.helpHelpAction, 'activated()', this, 'helpDialog'); view.connect( view.qt_central_widget.answer, 'returnPressed()', this, 'checkAnswer' ); view.connect( timer, 'timeout()', this, 'countdown'); view.qt_central_widget.answer.enabled = false; view.show(); // Run the main event loop. application.exec(); function configure() { //var configUI = Factory.loadui( StdDirs.findResource("madminute", "configdialog.ui"), this, mw ); var configUI = Factory.loadui( "configdialog.ui" ); configUI.connect( configUI.buttonHelp, 'clicked()', this, 'helpDialog'); configUI.addition.checked = false; configUI.subtraction.checked == false; configUI.time.value = drillTime; configUI.maximum.value = maxInput; if( operations == 1 ) configUI.addition.checked = true; if( operations == 2 ) configUI.subtraction.checked = true; if( operations == 3 ) { configUI.addition.checked = true; configUI.subtraction.checked = true; } if ( configUI.exec() == 1 ) { operations = 0; if( configUI.addition.checked == true ) operations += 1; if( configUI.subtraction.checked == true ) operations += 2; drillTime = configUI.time.value; maxInput = configUI.maximum.value; config.setGroup("Game Options"); config.writeNumEntry("Operations",operations); config.writeNumEntry("Drill Time", drillTime ); config.writeNumEntry("Maximum Input", maxInput ); config.sync(); } } function about() { alert("