[Kstars-devel] kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Mon Sep 15 21:19:05 CEST 2003
CVS commit by harris:
made the new KStars::slotSetZoom() code work on KDE 3.0.x and 3.1.x. The
problem was we used KInputDialog, which is new to 3.2. We now use
#if/#else to check the KDE version and use KLineEditDlg instead of
KInputDialog if the version is < 3.1.90.
CCMAIL: kstars-devel at kde.org
M +26 -9 kstarsactions.cpp 1.72
--- kdeedu/kstars/kstars/kstarsactions.cpp #1.71:1.72
@@ -21,5 +21,4 @@
#include <kaccel.h>
#include <kiconloader.h>
-#include <kinputdialog.h>
#include <kio/netaccess.h>
#include <kmessagebox.h>
@@ -34,4 +33,17 @@
#include <qcheckbox.h>
+//keep KDE 3.0.x and 3.1.x compatibility
+//KDE_VERSION changed from decimal to hex during KDE 3.1.x, so have to use
+//the MAJOR/MINOR/RELEASE triplet. We can assume KDE_VERSION_MAJOR >= 3.
+//for KDE_VERSION_RELEASE, I believe the post 3_1_BRANCH stuff started at 90,
+//but I'll use 20 just in case (the highest 3.1.x will likely be x=4).
+#include <kdeversion.h>
+#if ( KDE_VERSION_MINOR >= 1 && KDE_VERSION_RELEASE > 20 )
+#include <kinputdialog.h>
+#else
+#include <klineeditdlg.h>
+#include <qvalidator.h>
+#endif
+
#include "kstars.h"
#include "timedialog.h"
@@ -374,7 +386,4 @@ void KStars::slotRunScript() {
}
- //DEBUG
- kdDebug() << "filename: " << f.name() << endl;
-
if ( !f.open( IO_ReadOnly) ) {
QString message = i18n( "Could not open file %1" ).arg( f.name() );
@@ -405,7 +414,4 @@ void KStars::slotRunScript() {
i18n( "Script Validation Failed!" ) );
} else {
- //DEBUG
- kdDebug() << "running script: " << f.name() << endl;
-
//file is OK, run it!
KProcess p;
@@ -635,10 +641,21 @@ void KStars::slotSetZoom() {
bool ok( false );
double currentAngle = map()->width() / ( options()->ZoomFactor * dms::DegToRad );
+ double angSize = currentAngle;
double minAngle = map()->width() / ( MAXZOOM * dms::DegToRad );
double maxAngle = map()->width() / ( MINZOOM * dms::DegToRad );
- double angSize = KInputDialog::getDouble( i18n( "The user should enter an angle for the field-of-view of the display",
+ //keep KDE 3.0.x and 3.1.x compatibility
+ #if ( KDE_VERSION_MINOR >= 1 && KDE_VERSION_RELEASE > 20 )
+ angSize = KInputDialog::getDouble( i18n( "The user should enter an angle for the field-of-view of the display",
"Enter desired field-of-view angle" ), i18n( "Enter a field-of-view angle in degrees: " ),
currentAngle, minAngle, maxAngle, 0.1, 1, &ok );
+ #else
+ QString sCurrent = QString("%1").arg( currentAngle, 0, 'f', 1 );
+ QString entry = KLineEditDlg::getText( i18n( "The user should enter an angle for the field-of-view of the display",
+ "Enter desired field-of-view angle" ), i18n( "Enter a field-of-view angle in degrees: " ),
+ sCurrent, &ok, 0, &QDoubleValidator( minAngle, maxAngle, 1, 0 ) );
+
+ if ( ok ) angSize = entry.toDouble( &ok );
+ #endif
if ( ok ) {
More information about the Kstars-devel
mailing list