summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Lancaster <rlancaste@gmail.com>2016-11-02 14:04:12 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-11-02 14:04:12 (GMT)
commit05b8f16b749b9f1637e31a10ed7c0a1aab80112f (patch)
tree41b0e876fd2779bb98c0e086655ef3d25813d1e6
parent203e5b24eb1bc713212f57daf5ec14af85f394a4 (diff)
OSX Bundling patch
-rw-r--r--kstars/ekos/opsekos.cpp42
-rw-r--r--kstars/ekos/opsekos.h3
-rw-r--r--kstars/ekos/opsekos.ui99
-rw-r--r--kstars/indi/devicemanager.cpp8
-rw-r--r--kstars/indi/drivermanager.cpp10
-rw-r--r--kstars/indi/indidriver.cpp10
-rw-r--r--kstars/indi/opsindi.cpp30
-rw-r--r--kstars/indi/opsindi.h2
-rw-r--r--kstars/indi/opsindi.ui21
-rw-r--r--kstars/indi/servermanager.cpp51
-rw-r--r--kstars/kstars.cpp4
11 files changed, 228 insertions, 52 deletions
diff --git a/kstars/ekos/opsekos.cpp b/kstars/ekos/opsekos.cpp
index 001f672..9e0dd8e 100644
--- a/kstars/ekos/opsekos.cpp
+++ b/kstars/ekos/opsekos.cpp
@@ -31,6 +31,21 @@ OpsEkos::OpsEkos()
//Get a pointer to the KConfigDialog
m_ConfigDialog = KConfigDialog::exists( "settings" );
+#ifdef Q_OS_OSX
+connect(solverInternal, SIGNAL(clicked()), this, SLOT(toggleSolverInternal()));
+solverInternal->setToolTip(i18n("Internal or External Plate Solver."));
+
+connect(configInternal, SIGNAL(clicked()), this, SLOT(toggleConfigInternal()));
+configInternal->setToolTip(i18n("Internal or External Astrometry.cfg."));
+
+connect(wcsInternal, SIGNAL(clicked()), this, SLOT(toggleWCSInternal()));
+wcsInternal->setToolTip(i18n("Internal or External WCS Info."));
+#else
+solverInternal->setVisible(false);
+configInternal->setVisible(false);
+wcsInternal->setVisible(false);
+#endif
+
connect( m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL( clicked() ), SLOT( slotApply() ) );
connect( m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), SLOT( slotApply() ) );
connect( m_ConfigDialog->button(QDialogButtonBox::Cancel), SIGNAL( clicked() ), SLOT( slotCancel() ) );
@@ -39,6 +54,33 @@ OpsEkos::OpsEkos()
OpsEkos::~OpsEkos() {}
+void OpsEkos::toggleSolverInternal()
+{
+ kcfg_astrometrySolver->setEnabled(!solverInternal->isChecked());
+ if(solverInternal->isChecked())
+ kcfg_astrometrySolver->setText("*Internal Solver*");
+ else
+ kcfg_astrometrySolver->setText("/usr/local/bin/solve-field");
+}
+
+void OpsEkos::toggleConfigInternal()
+{
+ kcfg_astrometryConfFile->setEnabled(!configInternal->isChecked());
+ if(configInternal->isChecked())
+ kcfg_astrometryConfFile->setText("*Internal astrometry.cfg*");
+ else
+ kcfg_astrometryConfFile->setText("/etc/astrometry.cfg");
+}
+
+void OpsEkos::toggleWCSInternal()
+{
+ kcfg_astrometryWCSInfo->setEnabled(!wcsInternal->isChecked());
+ if(wcsInternal->isChecked())
+ kcfg_astrometryWCSInfo->setText("*Internal wcsinfo*");
+ else
+ kcfg_astrometryWCSInfo->setText("/usr/local/bin/wcsinfo");
+}
+
void OpsEkos::slotApply()
{
EkosManager *ekosManager = KStars::Instance()->ekosManager();
diff --git a/kstars/ekos/opsekos.h b/kstars/ekos/opsekos.h
index 9764414..59b4137 100644
--- a/kstars/ekos/opsekos.h
+++ b/kstars/ekos/opsekos.h
@@ -33,6 +33,9 @@ public:
private slots:
void slotApply();
+ void toggleSolverInternal();
+ void toggleConfigInternal();
+ void toggleWCSInternal();
private:
KConfigDialog *m_ConfigDialog;
diff --git a/kstars/ekos/opsekos.ui b/kstars/ekos/opsekos.ui
index d472203..f1cbe52 100644
--- a/kstars/ekos/opsekos.ui
+++ b/kstars/ekos/opsekos.ui
@@ -6,15 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
- <width>504</width>
- <height>372</height>
+ <width>658</width>
+ <height>506</height>
</rect>
</property>
<property name="windowTitle">
<string>TabWidget</string>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="generalTab">
<attribute name="title">
@@ -359,48 +359,54 @@
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_15">
+ <item row="0" column="2">
+ <widget class="QLineEdit" name="kcfg_astrometrySolver">
+ <property name="toolTip">
+ <string>Astrometry.net solve-field binary</string>
+ </property>
<property name="text">
- <string>solver:</string>
+ <string/>
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="kcfg_astrometrySolver">
+ <item row="1" column="5">
+ <widget class="QLineEdit" name="kcfg_astrometryAPIKey">
<property name="toolTip">
- <string>Astrometry.net solve-field binary</string>
+ <string>Astrometry.net configuration file</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_16">
+ <item row="2" column="5">
+ <widget class="QCheckBox" name="kcfg_astrometryUseJPEG">
+ <property name="toolTip">
+ <string>Use JPEG format, instead of FITS, to upload images to the online astrometry.net service</string>
+ </property>
<property name="text">
- <string>wcsinfo:</string>
+ <string>Use JPG for upload</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
- <widget class="QLineEdit" name="kcfg_astrometryWCSInfo">
- <property name="toolTip">
- <string>Astrometry.net wcsinfo binary</string>
- </property>
+ <widget class="QCheckBox" name="wcsInternal">
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_14">
+ <item row="1" column="4">
+ <widget class="QLabel" name="label_17">
<property name="text">
- <string>config:</string>
+ <string>API Key:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="1" column="2">
<widget class="QLineEdit" name="kcfg_astrometryConfFile">
<property name="toolTip">
<string>Astrometry.net configuration file</string>
@@ -410,31 +416,52 @@
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QLabel" name="label_17">
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_14">
<property name="text">
- <string>API Key:</string>
+ <string>config:</string>
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="QLineEdit" name="kcfg_astrometryAPIKey">
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_18">
+ <property name="text">
+ <string>API URL:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="5">
+ <widget class="QLineEdit" name="kcfg_astrometryWCSInfo">
<property name="toolTip">
- <string>Astrometry.net configuration file</string>
+ <string>Astrometry.net wcsinfo binary</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_18">
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="configInternal">
<property name="text">
- <string>API URL:</string>
+ <string/>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>solver:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QLabel" name="label_16">
+ <property name="text">
+ <string>wcsinfo:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
<widget class="QLineEdit" name="kcfg_astrometryAPIURL">
<property name="toolTip">
<string>Astrometry.net configuration file</string>
@@ -444,16 +471,10 @@
</property>
</widget>
</item>
- <item row="2" column="3">
- <widget class="QCheckBox" name="kcfg_astrometryUseJPEG">
- <property name="toolTip">
- <string>Use JPEG format, instead of FITS, to upload images to the online astrometry.net service</string>
- </property>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="solverInternal">
<property name="text">
- <string>Use JPG for upload</string>
- </property>
- <property name="checked">
- <bool>true</bool>
+ <string/>
</property>
</widget>
</item>
diff --git a/kstars/indi/devicemanager.cpp b/kstars/indi/devicemanager.cpp
index 553d862..2ac90b5 100644
--- a/kstars/indi/devicemanager.cpp
+++ b/kstars/indi/devicemanager.cpp
@@ -85,8 +85,12 @@ void DeviceManager::startServer()
kWarning() << "managed_devices was not set! Cannot start server!";
return;
}
-
- *serverProcess << Options::indiServer();
+ #ifdef Q_OS_OSX
+ if(Options::indiServer()=="*Internal INDI Server*")
+ *serverProcess << QCoreApplication::applicationDirPath()+"/indi/indiserver";
+ else
+ #endif
+ *serverProcess << Options::indiServer();
*serverProcess << "-v" << "-p" << QString::number(port);
diff --git a/kstars/indi/drivermanager.cpp b/kstars/indi/drivermanager.cpp
index 2cd57f4..9d8a768 100644
--- a/kstars/indi/drivermanager.cpp
+++ b/kstars/indi/drivermanager.cpp
@@ -951,7 +951,13 @@ bool DriverManager::readXMLDrivers()
QDir indiDir;
QString driverName;
- if (indiDir.cd(Options::indiDriversDir()) == false)
+ QString driversDir=Options::indiDriversDir();
+ #ifdef Q_OS_OSX
+ if(driversDir=="*Internal INDI Drivers*")
+ driversDir=QCoreApplication::applicationDirPath()+"/indi";
+ #endif
+
+ if (indiDir.cd(driversDir) == false)
{
KMessageBox::error(0, i18n("Unable to find INDI Drivers directory: %1\nPlease make sure to set the correct path in KStars configuration", Options::indiDriversDir()));
return false;
@@ -980,7 +986,7 @@ bool DriverManager::readXMLDrivers()
}
}
- driverName = QString("%1/%2").arg(Options::indiDriversDir()).arg(fileInfo.fileName());
+ driverName = QString("%1/%2").arg(driversDir).arg(fileInfo.fileName());
processXMLDriver(driverName);
}
diff --git a/kstars/indi/indidriver.cpp b/kstars/indi/indidriver.cpp
index 1ff8cba..ae7da0f 100644
--- a/kstars/indi/indidriver.cpp
+++ b/kstars/indi/indidriver.cpp
@@ -497,7 +497,13 @@ bool INDIDriver::readXMLDrivers()
QDir indiDir;
QString driverName;
- if (indiDir.cd(Options::indiDriversDir()) == false)
+ QString driversDir=Options::indiDriversDir();
+ #ifdef Q_OS_OSX
+ if(driversDir=="*Internal INDI Drivers*")
+ driversDir=QCoreApplication::applicationDirPath()+"/indi";
+ #endif
+
+ if (indiDir.cd(driversDir) == false)
{
KMessageBox::error(0, xi18n("Unable to find INDI Drivers directory: %1\nPlease make sure to set the correct path in KStars configuration", Options::indiDriversDir()));
return false;
@@ -526,7 +532,7 @@ bool INDIDriver::readXMLDrivers()
}
}
- driverName = QString("%1/%2").arg(Options::indiDriversDir()).arg(fileInfo.fileName());
+ driverName = QString("%1/%2").arg(driversDir).arg(fileInfo.fileName());
processXMLDriver(driverName);
}
diff --git a/kstars/indi/opsindi.cpp b/kstars/indi/opsindi.cpp
index 6332af0..823a968 100644
--- a/kstars/indi/opsindi.cpp
+++ b/kstars/indi/opsindi.cpp
@@ -41,7 +41,19 @@ OpsINDI::OpsINDI()
kcfg_fitsDir->setText ( Options::fitsDir());
selectFITSDirB->setIcon( QIcon::fromTheme( "document-open-folder", QIcon(":/icons/breeze/default/document-open-folder.svg")) );
+ selectFITSDirB->setAttribute(Qt::WA_LayoutUsesWidgetRect);
selectDriversDirB->setIcon( QIcon::fromTheme( "document-open-folder", QIcon(":/icons/breeze/default/document-open-folder.svg")) );
+ selectDriversDirB->setAttribute(Qt::WA_LayoutUsesWidgetRect);
+
+ #ifdef Q_OS_OSX
+ connect(indiInternal, SIGNAL(clicked()), this, SLOT(toggleINDIInternal()));
+ indiInternal->setToolTip(i18n("Internal or External INDI Server."));
+ connect(driversInternal, SIGNAL(clicked()), this, SLOT(toggleDriversInternal()));
+ driversInternal->setToolTip(i18n("Internal or External INDI Drivers."));
+ #else
+ indiInternal->setVisible(false);
+ driversInternal->setVisible(false);
+ #endif
connect(selectFITSDirB, SIGNAL(clicked()), this, SLOT(saveFITSDirectory()));
connect(selectDriversDirB, SIGNAL(clicked()), this, SLOT(saveDriversDirectory()));
@@ -55,6 +67,24 @@ OpsINDI::OpsINDI()
OpsINDI::~OpsINDI() {}
+void OpsINDI::toggleINDIInternal()
+{
+ kcfg_indiServer->setEnabled(!indiInternal->isChecked());
+ if(indiInternal->isChecked())
+ kcfg_indiServer->setText("*Internal INDI Server*");
+ else
+ kcfg_indiServer->setText("/usr/local/bin/indiserver");
+}
+
+void OpsINDI::toggleDriversInternal()
+{
+ kcfg_indiDriversDir->setEnabled(!driversInternal->isChecked());
+ if(driversInternal->isChecked())
+ kcfg_indiDriversDir->setText("*Internal INDI Drivers*");
+ else
+ kcfg_indiDriversDir->setText("/usr/local/bin/");
+}
+
void OpsINDI::saveFITSDirectory()
{
QString dir = QFileDialog::getExistingDirectory(KStars::Instance(), i18n("FITS Default Directory"), kcfg_fitsDir->text());
diff --git a/kstars/indi/opsindi.h b/kstars/indi/opsindi.h
index d3cbf50..83ec708 100644
--- a/kstars/indi/opsindi.h
+++ b/kstars/indi/opsindi.h
@@ -34,6 +34,8 @@ private slots:
void saveFITSDirectory();
void saveDriversDirectory();
void slotShowLogFiles();
+ void toggleINDIInternal();
+ void toggleDriversInternal();
private:
KConfigDialog *m_ConfigDialog;
diff --git a/kstars/indi/opsindi.ui b/kstars/indi/opsindi.ui
index 6656465..af63efd 100644
--- a/kstars/indi/opsindi.ui
+++ b/kstars/indi/opsindi.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>444</width>
- <height>350</height>
+ <width>543</width>
+ <height>417</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -20,6 +20,13 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
+ <widget class="QCheckBox" name="indiInternal">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="videoLabel_2">
<property name="toolTip">
<string>Default INDI video port</string>
@@ -40,6 +47,16 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
+ <property name="spacing">
+ <number>-1</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="driversInternal">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QLabel" name="videoLabel_3">
<property name="toolTip">
diff --git a/kstars/indi/servermanager.cpp b/kstars/indi/servermanager.cpp
index 124971b..1a1826e 100644
--- a/kstars/indi/servermanager.cpp
+++ b/kstars/indi/servermanager.cpp
@@ -71,8 +71,23 @@ bool ServerManager::start()
bool connected=false;
int fd=0;
- if (serverProcess == NULL)
+ if (serverProcess == NULL){
serverProcess = new QProcess(this);
+ #ifdef Q_OS_OSX
+ QString driversDir=Options::indiDriversDir();
+ if(driversDir=="*Internal INDI Drivers*")
+ driversDir=QCoreApplication::applicationDirPath()+"/indi";
+ QString indiServerDir=Options::indiServer();
+ if(indiServerDir=="*Internal INDI Server*")
+ indiServerDir=QCoreApplication::applicationDirPath()+"/indi";
+ else if(indiServerDir.length()>10)
+ indiServerDir=Options::indiServer().mid(0,Options::indiServer().length()-10);
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ QStringList envlist = env.toStringList();
+ envlist.replaceInStrings(QRegularExpression("^(?i)PATH=(.*)"), "PATH=/usr/bin:/usr/local/bin:" + driversDir + ":" + indiServerDir + ":\\1");
+ serverProcess->setEnvironment(envlist);
+ #endif
+ }
QStringList args;
@@ -101,7 +116,13 @@ bool ServerManager::start()
serverProcess->setProcessChannelMode(QProcess::SeparateChannels);
serverProcess->setReadChannel(QProcess::StandardError);
- serverProcess->start(Options::indiServer(), args);
+ #ifdef Q_OS_OSX
+ if(Options::indiServer()=="*Internal INDI Server*")
+ serverProcess->start(QCoreApplication::applicationDirPath()+"/indi/indiserver", args);
+ else
+ #endif
+ serverProcess->start(Options::indiServer(), args);
+
connected = serverProcess->waitForStarted();
@@ -147,18 +168,38 @@ bool ServerManager::startDriver(DriverInfo *dv)
managedDrivers.append(dv);
dv->setServerManager(this);
+
+ QString driversDir=Options::indiDriversDir();
+ QString indiServerDir=Options::indiServer();
+
+
+ #ifdef Q_OS_OSX
+ if(driversDir=="*Internal INDI Drivers*")
+ driversDir=QCoreApplication::applicationDirPath()+"/indi";
+ if(indiServerDir=="*Internal INDI Server*")
+ indiServerDir=QCoreApplication::applicationDirPath()+"/indi";
+ else if(indiServerDir.length()>10)
+ indiServerDir=Options::indiServer().mid(0,Options::indiServer().length()-10);
+ #endif
+
+ QStringList paths;
+ paths << "/usr/bin" << "/usr/local/bin" << driversDir << indiServerDir;
+
if (QStandardPaths::findExecutable(dv->getDriver()).isEmpty())
{
- KMessageBox::error(NULL, i18n("Driver %1 was not found on the system. Please make sure the package that provides the '%1' binary is installed.", dv->getDriver()));
- return false;
+ if(QStandardPaths::findExecutable(dv->getDriver(),paths).isEmpty()){
+ KMessageBox::error(NULL, i18n("Driver %1 was not found on the system. Please make sure the package that provides the '%1' binary is installed.", dv->getDriver()));
+ return false;
+ }
}
+
out << "start " << dv->getDriver();
if (dv->getUniqueLabel().isEmpty() == false)
out << " -n \"" << dv->getUniqueLabel() << "\"";
if (dv->getSkeletonFile().isEmpty() == false)
- out << " -s \"" << Options::indiDriversDir() << QDir::separator() << dv->getSkeletonFile() << "\"";
+ out << " -s \"" << driversDir << QDir::separator() << dv->getSkeletonFile() << "\"";
out << endl;
out.flush();
diff --git a/kstars/kstars.cpp b/kstars/kstars.cpp
index 01b9b02..a508a94 100644
--- a/kstars/kstars.cpp
+++ b/kstars/kstars.cpp
@@ -75,6 +75,10 @@ KStars::KStars( bool doSplash, bool clockrun, const QString &startdate )
//Note: You need to make sure the environment variables for KStars are set correctly to get this running properly.
#ifdef Q_OS_OSX
QProcess* klauncher = new QProcess(this);
+ // QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ // QString stringPath = QCoreApplication::applicationDirPath();
+ // env.insert("QT_PLUGIN_PATH", stringPath + "/../plugins");
+ // klauncher->setProcessEnvironment(env);
klauncher->start("kdeinit5");
#endif