Commit 1934a839 authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq
Browse files

OSX and XPlanet fixes

parent ca6c4018
......@@ -27,6 +27,10 @@
#include <QUrl>
#include <QStandardPaths>
#ifndef KSTARS_LITE
#include <KMessageBox>
#endif
#include <cmath>
#include "auxiliary/kspaths.h"
......
......@@ -225,8 +225,8 @@ namespace KSUtils {
};
#ifdef Q_OS_OSX
static void copyDataFolderFromAppBundleIfNeeded();
static bool copyRecursively(QString sourceFolder, QString destFolder);
void copyDataFolderFromAppBundleIfNeeded();
bool copyRecursively(QString sourceFolder, QString destFolder);
#endif
}
......
......@@ -3569,7 +3569,7 @@ QImage FITSData::FITSToImage(const QString &filename)
}
else
{
double val=0,rval=0,gval=0,bval=0;
double rval=0,gval=0,bval=0;
QRgb value;
/* Fill in pixel values using indexed map, linear scale */
for (int j = 0; j < h; j++)
......
......@@ -342,11 +342,11 @@ void KSPopupMenu::initPopupMenu( SkyObject *obj, QString name, QString type, QSt
addSeparator();
#ifdef HAVE_XPLANET
if ( obj->isSolarSystem() && obj->type() != SkyObject::COMET ) { // FIXME: We now have asteroids -- so should this not be isMajorPlanet() || Pluto?
QMenu *xplanetSubmenu = new QMenu();
xplanetSubmenu->setTitle( i18n( "Print Xplanet view" ) );
xplanetSubmenu->addAction( i18n( "To screen" ), map, SLOT( slotXplanetToScreen() ) );
xplanetSubmenu->addAction( i18n( "To file..." ), map, SLOT( slotXplanetToFile() ) );
addMenu( xplanetSubmenu );
//QMenu *xplanetSubmenu = new QMenu();
//xplanetSubmenu->setTitle( i18n( "Print Xplanet view" ) );
addAction( i18n( "View in XPlanet" ), map, SLOT( slotXplanetToWindow() ) );
//xplanetSubmenu->addAction( i18n( "To file..." ), map, SLOT( slotXplanetToFile() ) );
//addMenu( xplanetSubmenu );
}
#endif
addSeparator();
......
......@@ -45,6 +45,7 @@
#include "Options.h"
#include "kstars.h"
#include "kspaths.h"
#include "kstarsdata.h"
#include "ksutils.h"
#include "ksdssdownloader.h"
......@@ -1206,10 +1207,21 @@ void SkyMap::startXplanet( const QString & outputFile ) {
// Run xplanet
//qDebug() << "Run:" << xplanetProc->program().join(" ");
xplanetProc->start(Options::xplanetPath(), args);
if(xplanetProc){
xplanetProc->waitForFinished(1000);
ImageViewer *iv = new ImageViewer( QUrl::fromLocalFile(outputFile),
"XPlanet View: "+ clickedObject()->name() + ", " + data->lt().date().toString() + ", "+ data->lt().time().toString(),
this );
iv->show();
}
}
void SkyMap::slotXplanetToScreen() {
startXplanet();
void SkyMap::slotXplanetToWindow() {
QDir writableDir;
QString xPlanetDirPath=KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "xplanet";
writableDir.mkpath(xPlanetDirPath);
QString xPlanetPath=xPlanetDirPath + QDir::separator() + clickedObject()->name() + ".png";
startXplanet(xPlanetPath);
}
void SkyMap::slotXplanetToFile() {
......
......@@ -437,8 +437,8 @@ public slots:
#endif
#ifdef HAVE_XPLANET
/** Run Xplanet to print a view on the screen*/
void slotXplanetToScreen();
/** Run Xplanet to print a view in a Window*/
void slotXplanetToWindow();
/** Run Xplanet to print a view in a file */
void slotXplanetToFile();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment