#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
/ 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);
}
// 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) {
/ 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);
}
// 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) {