[Kstars-devel] KDE/kdeedu/kstars/kstars
Jasem Mutlaq
mutlaqja at ikarustech.com
Sun Sep 16 16:18:30 CEST 2007
SVN commit 713152 by mutlaqja:
Running script from the file menu now works, it only took an ! to get it
working. Added progress dialog to fits loading, since loading large fits
files may block KStars.
CCMAIL:kstars-devel at kde.org
M +6 -0 fitshistogramui.ui
M +39 -17 fitsimage.cpp
M +1 -1 kstarsactions.cpp
--- trunk/KDE/kdeedu/kstars/kstars/fitshistogramui.ui #713151:713152
@@ -220,6 +220,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="0" column="4" >
@@ -263,6 +266,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="1" column="0" >
--- trunk/KDE/kdeedu/kstars/kstars/fitsimage.cpp #713151:713152
@@ -19,30 +19,26 @@
#include "fitsimage.h"
-#include <klocale.h>
-#include <kmessagebox.h>
-#include <kfiledialog.h>
-#include <kaction.h>
-#include <kactioncollection.h>
-#include <kdebug.h>
-#include <ktoolbar.h>
-#include <kglobal.h>
-#include <ktemporaryfile.h>
-#include <kmenubar.h>
-#include <kprogressdialog.h>
-#include <kstatusbar.h>
+#include <math.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <netinet/in.h>
+#include <QApplication>
#include <QPaintEvent>
#include <QScrollArea>
#include <QFile>
#include <QCursor>
+#include <KDebug>
+#include <KLocale>
+#include <KAction>
+#include <KActionCollection>
+#include <KStatusBar>
+#include <KProgressDialog>
+#include <KMessageBox>
+#include <KFileDialog>
-#include <math.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-
#include "indi/libs/indicom.h"
#include "fitsviewer.h"
#include "ksutils.h"
@@ -130,6 +126,14 @@
long fpixel[2], nelements, naxes[2];
char error_status[32];
+ KProgressDialog fitsProg(NULL, i18n("Loading FITS"), i18n("Please hold while loading FITS file..."));
+ fitsProg.setAllowCancel(true);
+ fitsProg.progressBar()->setRange(0, 100);
+ fitsProg.progressBar()->setValue(40);
+ fitsProg.show();
+
+ qApp->processEvents();
+
if (fits_open_image(&fptr, filename.toAscii(), READONLY, &status))
{
fits_report_error(stderr, status);
@@ -138,6 +142,9 @@
return -1;
}
+ fitsProg.progressBar()->setValue(60);
+ qApp->processEvents();
+
if (fits_get_img_param(fptr, 2, &(stats.bitpix), &(stats.ndim), naxes, &status))
{
fits_report_error(stderr, status);
@@ -154,6 +161,9 @@
return -1;
}
+ fitsProg.progressBar()->setValue(70);
+ qApp->processEvents();
+
stats.dim[0] = naxes[0];
stats.dim[1] = naxes[1];
@@ -166,6 +176,9 @@
displayImage = new QImage(stats.dim[0], stats.dim[1], QImage::Format_Indexed8);
+ fitsProg.progressBar()->setValue(80);
+ qApp->processEvents();
+
displayImage->setNumColors(256);
for (int i=0; i < 256; i++)
@@ -181,6 +194,9 @@
return -1;
}
+ fitsProg.progressBar()->setValue(90);
+ qApp->processEvents();
+
currentZoom = 100;
currentWidth = stats.dim[0];
currentHeight = stats.dim[1];
@@ -189,7 +205,13 @@
if (rescale(ZOOM_FIT_WINDOW))
return -1;
+ fitsProg.progressBar()->setValue(95);
+ qApp->processEvents();
+
calculateStats();
+
+ fitsProg.progressBar()->setValue(100);
+ qApp->processEvents();
setAlignment(Qt::AlignCenter);
--- trunk/KDE/kdeedu/kstars/kstars/kstarsactions.cpp #713151:713152
@@ -593,7 +593,7 @@
if( !p.waitForStarted() )
return;
- while ( p.waitForFinished( 10 ) )
+ while ( !p.waitForFinished( 10 ) )
{
qApp->processEvents(); //otherwise tempfile may get deleted before script completes.
if( p.state() != QProcess::Running )
More information about the Kstars-devel
mailing list