Qt fixes for pre-4.5
authorsvnhieber <svnhieber@f8795833-4959-0410-8ae9-8bcb0cfab428>
Tue, 30 Nov 2010 17:10:11 +0000 (17:10 +0000)
committersvnhieber <svnhieber@f8795833-4959-0410-8ae9-8bcb0cfab428>
Tue, 30 Nov 2010 17:10:11 +0000 (17:10 +0000)
git-svn-id: https://svn.itm.uni-luebeck.de/wisebed/wiselib/trunk/pc_apps/roomba_tests@3643 f8795833-4959-0410-8ae9-8bcb0cfab428

main.cc

diff --git a/main.cc b/main.cc
index 1a181fe..cfba07b 100644 (file)
--- a/main.cc
+++ b/main.cc
 #include <QApplication>
 #include <QInputDialog>
 
+#if QT_VERSION < 0x040500
+#define getInt QInputDialog::getInteger
+#else // QT_VERSION > 0x040500
+#define getInt QInputDialog::getInt
+#endif // QT_VERSION
+
 using namespace std;
 
 // UART port on which we communicate with the Roomba
@@ -60,12 +66,12 @@ void drive(Roomba& roomba, ControlledMotion& ctrl_motion) {
       / float(roomba().capacity) * 100.0));
 
     // new distance to drive
-    input_distance = QInputDialog::getInt(0, "Input distance", chargeText
+    input_distance = getInt(0, "Input distance", chargeText
       + "Input new distance in mm:", input_distance,
       numeric_limits<int>::min(), numeric_limits<int>::max(), 1, &ok);
     if(ok) {
       // new turn velocity
-      velocity = QInputDialog::getInt(0, "Input velocity", chargeText
+      velocity = getInt(0, "Input velocity", chargeText
         + "Input drive velocity in mm/sec:", velocity, -500, 500, 10, &ok);
       if(ok) {
         ctrl_motion.move_distance(input_distance, velocity);
@@ -78,11 +84,11 @@ void drive(Roomba& roomba, ControlledMotion& ctrl_motion) {
     }
 
     // measured deviation
-    deviation_x = QInputDialog::getInt(0, "Input x deviation", chargeText
+    deviation_x = getInt(0, "Input x deviation", chargeText
       + "Input travelled distance on x axis in mm:", deviation_x,
       numeric_limits<int>::min(), numeric_limits<int>::max(), 1, &ok);
     if(ok) {
-      deviation_y = QInputDialog::getInt(0, "Input y deviation", chargeText
+      deviation_y = getInt(0, "Input y deviation", chargeText
         + "Input travelled distance on y axis in mm:", deviation_y,
         numeric_limits<int>::min(), numeric_limits<int>::max(), 1, &ok);
       if(ok) {
@@ -115,12 +121,12 @@ void turn(Roomba& roomba, ControlledMotion& ctrl_motion) {
       / float(roomba().capacity) * 100.0));
 
     // new angle to turn about
-    input_angle = QInputDialog::getInt(0, "Input angle", chargeText
+    input_angle = getInt(0, "Input angle", chargeText
       + "Input new angle in degree to turn about:", input_angle,
       numeric_limits<int>::min(), numeric_limits<int>::max(), 1, &ok);
     if(ok) {
       // new turn velocity
-      velocity = QInputDialog::getInt(0, "Input velocity", chargeText
+      velocity = getInt(0, "Input velocity", chargeText
         + "Input turn velocity in mm/sec:", velocity, -500, 500, 10, &ok);
       if(ok) {
         ctrl_motion.turn_about(Math::degrees_to_radians(input_angle), velocity);
@@ -133,7 +139,7 @@ void turn(Roomba& roomba, ControlledMotion& ctrl_motion) {
     }
 
     // measured angle
-    measured_angle = QInputDialog::getInt(0, "Input measured angle", chargeText
+    measured_angle = getInt(0, "Input measured angle", chargeText
       + "Input measured angle in degree:", input_angle,
       numeric_limits<int>::min(), numeric_limits<int>::max(), 1, &ok);
     if(ok) {
This page took 0.025686 seconds and 4 git commands to generate.