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

XPlanet Fixes and Bundle Defaults

parent 5b4cc61c
......@@ -642,6 +642,11 @@ void copyDataFolderFromAppBundleIfNeeded()
if(!dataLocation.isEmpty()&&!dataSourceLocation.isEmpty()){ //If both the users data directory and the default data directory are found.
KMessageBox::sorry(0, i18n("No Data Directory in /Library/Application Support/, creating a new one"));
KSUtils::copyRecursively(dataSourceLocation, dataLocation);
Options::setIndiServerIsInternal(true);
Options::setAstrometrySolverIsInternal(true);
Options::setAstrometryConfFileIsInternal(true);
Options::setWcsIsInternal(true);
Options::setXplanetIsInternal(true);
} else{
KMessageBox::sorry(0, i18n("Error, no data directories found!"));
}
......
......@@ -968,6 +968,10 @@
</entry>
</group>
<group name="Xplanet">
<entry name="xplanetIsInternal" type="Bool">
<label>Internal or External XPlanet?</label>
<default>false</default>
</entry>
<entry name="XplanetPath" type="String">
<label>Path to xplanet binary</label>
<whatsthis>Xplanet binary path</whatsthis>
......
......@@ -1206,13 +1206,25 @@ void SkyMap::startXplanet( const QString & outputFile ) {
// Run xplanet
//qDebug() << "Run:" << xplanetProc->program().join(" ");
xplanetProc->start(Options::xplanetPath(), args);
QString xPlanetLocation=Options::xplanetPath();
#ifdef Q_OS_OSX
if(Options::xplanetIsInternal()){
xPlanetLocation=QCoreApplication::applicationDirPath()+"/xplanet/bin/xplanet";
QString searchDir=QCoreApplication::applicationDirPath()+"/xplanet/share/xplanet/";
args << "-searchdir" << searchDir;
}
#endif
xplanetProc->start(xPlanetLocation, 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();
} else{
KMessageBox::sorry( this, i18n("XPlanet Program Error"));
}
}
......
......@@ -25,6 +25,17 @@ OpsXplanet::OpsXplanet( KStars *_ks )
{
setupUi( this );
#ifdef Q_OS_OSX
connect(kcfg_xplanetIsInternal, SIGNAL(clicked()), this, SLOT(toggleXPlanetInternal()));
kcfg_xplanetIsInternal->setToolTip(i18n("Internal or External XPlanet?"));
if(Options::xplanetIsInternal())
kcfg_XplanetPath->setEnabled(false);
#else
kcfg_xplanetIsInternal->setVisible(false);
#endif
// Init projections combobox
kcfg_XplanetProjection->addItem( i18nc("Map projection method", "No projection"), "no projection");
kcfg_XplanetProjection->addItem( i18nc("Map projection method", "Ancient"), "ancient");
......@@ -91,6 +102,15 @@ OpsXplanet::OpsXplanet( KStars *_ks )
OpsXplanet::~OpsXplanet()
{}
void OpsXplanet::toggleXPlanetInternal()
{
kcfg_XplanetPath->setEnabled(!kcfg_xplanetIsInternal->isChecked());
if(kcfg_xplanetIsInternal->isChecked())
kcfg_XplanetPath->setText("*Internal XPlanet*");
else
kcfg_XplanetPath->setText("/usr/local/bin/xplanet");
}
void OpsXplanet::slotUpdateWidgets( bool on ) {
kcfg_XplanetWaitValue->setEnabled( on );
textLabelXplanetSecondes->setEnabled( on );
......
......@@ -42,6 +42,7 @@ private slots:
void slotMarkerBoundsWidgets( bool on );
void slotProjectionWidgets( int index );
void slotBackgroundWidgets( bool on );
void toggleXPlanetInternal();
};
#endif // OPSGUIDES_H_
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<width>621</width>
<height>647</height>
</rect>
</property>
......@@ -136,13 +136,6 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="textLabelXplanetPath">
<property name="text">
<string>Xplanet path:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="kcfg_XplanetPath">
<property name="sizePolicy">
......@@ -159,6 +152,30 @@
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="kcfg_xplanetIsInternal">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="textLabelXplanetPath">
<property name="text">
<string>Xplanet path:</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
......@@ -991,12 +1008,6 @@
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
<customwidget>
<class>QTabWidget</class>
<extends>QTabWidget</extends>
<header>ktabwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tab</tabstop>
......
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