summaryrefslogtreecommitdiffstats
path: root/tdejava/koala/test/kprogress/KProgressTest.java
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2014-01-08 20:06:00 +0100
committerSlávek Banko <slavek.banko@axis.cz>2014-01-08 20:06:00 +0100
commit636f509299122d02087c6fd62e1e4a46dbd22026 (patch)
tree70e43efceeb5b00e7f19cdac8da44928bd2fb459 /tdejava/koala/test/kprogress/KProgressTest.java
parent719b61750c08343f530068ed4127623aeac71cf0 (diff)
downloadtdebindings-636f509299122d02087c6fd62e1e4a46dbd22026.tar.gz
tdebindings-636f509299122d02087c6fd62e1e4a46dbd22026.zip
Rename many classes to avoid conflicts with KDE
Diffstat (limited to 'tdejava/koala/test/kprogress/KProgressTest.java')
-rw-r--r--tdejava/koala/test/kprogress/KProgressTest.java88
1 files changed, 88 insertions, 0 deletions
diff --git a/tdejava/koala/test/kprogress/KProgressTest.java b/tdejava/koala/test/kprogress/KProgressTest.java
new file mode 100644
index 00000000..0e5c1208
--- /dev/null
+++ b/tdejava/koala/test/kprogress/KProgressTest.java
@@ -0,0 +1,88 @@
+import org.trinitydesktop.qt.*;
+import org.trinitydesktop.koala.*;
+
+/**
+ * Class to test KProgress widget.
+ *
+ * This is a translation to java from kprogresstest.cpp in the tests library
+ * of tdeui source.
+ *
+ * @see KProgress
+ * @see TDEApplication
+ *
+ * @author orignal unknown, java translation Kenneth J. Pouncey, kjpou@hotmail.com
+ * @version 0.1
+ */
+
+public class KProgressTest {
+
+ static String description = "Java KProgress test program";
+ static String[][] options = { };
+ static String VERSION = "0.1";
+
+ public static void main(String[] cmdLineArgs) {
+
+ TDEAboutData aboutData = new TDEAboutData( "kprogresstest", "KProgressTest",
+ VERSION, description, TDEAboutData.License_GPL,
+ "(c) 2002, Kenneth J. Pouncey");
+ aboutData.addAuthor("Kenneth J. Pouncey",null, "kjpou@hotmail.com");
+ TDECmdLineArgs.init( cmdLineArgs, aboutData );
+ TDECmdLineArgs.addCmdLineOptions( options ); // Add our own options.
+
+ TDEApplication app = new TDEApplication();
+
+ // parse the args
+ TDECmdLineArgs args = TDECmdLineArgs.parsedArgs();
+
+ MyWidget mine = new MyWidget();
+
+ mine.setCaption(description);
+
+ app.setMainWidget(mine);
+ mine.show();
+
+ app.exec();
+
+ return;
+ }
+
+ private static class MyWidget extends TQWidget {
+
+ private KProgress Progress;
+ static int fwd = 0;
+ static int back = 1;
+ static int direction = fwd;
+
+ public MyWidget () {
+ super();
+ setFixedSize(440, 80);
+ Progress = new KProgress(this);
+ Progress.resize(400, 40);
+ Progress.move(20, 20);
+ startTimer(50);
+ }
+
+ public void timerEvent(TQTimerEvent timer) {
+
+ if (direction == fwd) {
+ if (Progress.progress() == Progress.totalSteps())
+ direction = back;
+ else
+ Progress.advance(1);
+ }
+ else {
+ if (Progress.progress() == 0) { /*Progress.minValue()*/
+ direction = fwd;
+ }
+ else
+ Progress.advance(-1);
+ }
+ }
+ }
+
+ static {
+ qtjava.initialize();
+ tdejava.initialize();
+ }
+
+}