summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-30 09:32:13 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-30 09:32:13 (GMT)
commit46cfa929fa84dec93e9d0d6f207a7eb7a202bc4b (patch)
tree660623b615cc45e364898c796cf6fc4e0b4f4c4a
parenta79f4667b59a25a3f35f2b3da3e210d7de545f47 (diff)
1. Making INDI Control Panel independent as an option
2. Reparent stuff to avoid problems closing them down after KStars is shutdown 3. Add show logs button to advanced options
-rw-r--r--kstars/fitsviewer/fitsviewer.cpp30
-rw-r--r--kstars/indi/drivermanager.cpp11
-rw-r--r--kstars/indi/drivermanager.h3
-rw-r--r--kstars/indi/guimanager.cpp23
-rw-r--r--kstars/indi/indilistener.cpp9
-rw-r--r--kstars/indi/indilistener.h3
-rw-r--r--kstars/indi/opsindi.ui9
-rw-r--r--kstars/kstars.cpp10
-rw-r--r--kstars/kstars.kcfg4
-rw-r--r--kstars/options/opsadvanced.cpp9
-rw-r--r--kstars/options/opsadvanced.h1
-rw-r--r--kstars/options/opsadvanced.ui143
12 files changed, 159 insertions, 96 deletions
diff --git a/kstars/fitsviewer/fitsviewer.cpp b/kstars/fitsviewer/fitsviewer.cpp
index 4c71348..e21e420 100644
--- a/kstars/fitsviewer/fitsviewer.cpp
+++ b/kstars/fitsviewer/fitsviewer.cpp
@@ -222,25 +222,35 @@ FITSViewer::~FITSViewer()
void FITSViewer::closeEvent(QCloseEvent * /*event*/)
{
- QAction *a = KStars::Instance()->actionCollection()->action( "show_fits_viewer" );
- QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
+ KStars *ks = KStars::Instance();
- if (a && viewers.count() == 1)
+ if (ks)
{
- a->setEnabled(false);
- a->setChecked(false);
+ QAction *a = KStars::Instance()->actionCollection()->action( "show_fits_viewer" );
+ QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
+
+ if (a && viewers.count() == 1)
+ {
+ a->setEnabled(false);
+ a->setChecked(false);
+ }
}
}
void FITSViewer::hideEvent(QHideEvent * /*event*/)
{
- QAction *a = KStars::Instance()->actionCollection()->action( "show_fits_viewer" );
- if (a)
+ KStars *ks = KStars::Instance();
+
+ if (ks)
{
- QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
+ QAction *a = KStars::Instance()->actionCollection()->action( "show_fits_viewer" );
+ if (a)
+ {
+ QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
- if (viewers.count() == 1)
- a->setChecked(false);
+ if (viewers.count() == 1)
+ a->setChecked(false);
+ }
}
}
diff --git a/kstars/indi/drivermanager.cpp b/kstars/indi/drivermanager.cpp
index 45bfcb4..9bce7f7 100644
--- a/kstars/indi/drivermanager.cpp
+++ b/kstars/indi/drivermanager.cpp
@@ -82,13 +82,13 @@ DriverManager * DriverManager::_DriverManager = NULL;
DriverManager * DriverManager::Instance()
{
if (_DriverManager == NULL)
- _DriverManager = new DriverManager();
+ _DriverManager = new DriverManager(KStars::Instance());
return _DriverManager;
}
-DriverManager::DriverManager()
- : QDialog( KStars::Instance() )
+DriverManager::DriverManager(QWidget *parent)
+ : QDialog( parent )
{
currentPort = Options::serverPortStart().toInt()-1;
@@ -136,6 +136,11 @@ DriverManager::DriverManager()
#endif
}
+DriverManager::~DriverManager()
+{
+ clearServers();
+}
+
void DriverManager::processDeviceStatus(DriverInfo *dv)
{
diff --git a/kstars/indi/drivermanager.h b/kstars/indi/drivermanager.h
index 62753d0..16a9205 100644
--- a/kstars/indi/drivermanager.h
+++ b/kstars/indi/drivermanager.h
@@ -123,7 +123,8 @@ public:
void clearServers();
private:
- DriverManager();
+ DriverManager(QWidget *parent);
+ ~DriverManager();
static DriverManager * _DriverManager;
diff --git a/kstars/indi/guimanager.cpp b/kstars/indi/guimanager.cpp
index e5b42fa..ca80b1f 100644
--- a/kstars/indi/guimanager.cpp
+++ b/kstars/indi/guimanager.cpp
@@ -40,6 +40,8 @@
#include "driverinfo.h"
#include "deviceinfo.h"
+#include "Options.h"
+
extern const char *libindi_strings_context;
GUIManager * GUIManager::_GUIManager = NULL;
@@ -47,7 +49,7 @@ GUIManager * GUIManager::_GUIManager = NULL;
GUIManager * GUIManager::Instance()
{
if (_GUIManager == NULL)
- _GUIManager = new GUIManager(KStars::Instance());
+ _GUIManager = new GUIManager(Options::independentWindowINDI() ? NULL : KStars::Instance());
return _GUIManager;
}
@@ -85,14 +87,25 @@ GUIManager::GUIManager(QWidget *parent) : QWidget(parent, Qt::Window)
void GUIManager::closeEvent(QCloseEvent * /*event*/)
{
- QAction *a = KStars::Instance()->actionCollection()->action( "show_control_panel" );
- a->setChecked(false);
+ KStars *ks = KStars::Instance();
+
+ if (ks)
+ {
+ QAction *a = KStars::Instance()->actionCollection()->action( "show_control_panel" );
+ a->setChecked(false);
+ }
+
}
void GUIManager::hideEvent(QHideEvent * /*event*/)
{
- QAction *a = KStars::Instance()->actionCollection()->action( "show_control_panel" );
- a->setChecked(false);
+ KStars *ks = KStars::Instance();
+
+ if (ks)
+ {
+ QAction *a = KStars::Instance()->actionCollection()->action( "show_control_panel" );
+ a->setChecked(false);
+ }
}
void GUIManager::showEvent(QShowEvent * /*event*/)
diff --git a/kstars/indi/indilistener.cpp b/kstars/indi/indilistener.cpp
index 40f45a6..bccfbcb 100644
--- a/kstars/indi/indilistener.cpp
+++ b/kstars/indi/indilistener.cpp
@@ -49,16 +49,21 @@ INDIListener * INDIListener::_INDIListener = NULL;
INDIListener * INDIListener::Instance()
{
if (_INDIListener == NULL)
- _INDIListener = new INDIListener();
+ _INDIListener = new INDIListener(KStars::Instance());
return _INDIListener;
}
-INDIListener::INDIListener()
+INDIListener::INDIListener(QObject *parent) : QObject(parent)
{
}
+INDIListener::~INDIListener()
+{
+ qDeleteAll(devices);
+}
+
bool INDIListener::isStandardProperty(const QString &name)
{
for (int i=0; i < NINDI_STD; i++)
diff --git a/kstars/indi/indilistener.h b/kstars/indi/indilistener.h
index ab0a084..1676ca0 100644
--- a/kstars/indi/indilistener.h
+++ b/kstars/indi/indilistener.h
@@ -49,7 +49,8 @@ public:
bool isStandardProperty(const QString &name);
private:
- INDIListener();
+ INDIListener(QObject *parent);
+ ~INDIListener();
static INDIListener * _INDIListener;
QList<ClientManager *> clients;
QList<ISD::GDInterface *> devices;
diff --git a/kstars/indi/opsindi.ui b/kstars/indi/opsindi.ui
index 95e61e5..6a17013 100644
--- a/kstars/indi/opsindi.ui
+++ b/kstars/indi/opsindi.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>435</width>
- <height>337</height>
+ <height>350</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -357,6 +357,13 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="kcfg_independentWindowINDI">
+ <property name="text">
+ <string>Independent Window</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/kstars/kstars.cpp b/kstars/kstars.cpp
index c468cf9..63ce484 100644
--- a/kstars/kstars.cpp
+++ b/kstars/kstars.cpp
@@ -48,6 +48,7 @@
#ifdef HAVE_INDI
#include "indi/drivermanager.h"
+#include "indi/guimanager.h"
#include "ekos/ekosmanager.h"
#endif
@@ -162,15 +163,14 @@ KStars::~KStars()
{
Q_ASSERT( pinstance );
+ delete m_KStarsData;
+ pinstance = 0;
+
#ifdef HAVE_INDI
delete m_EkosManager;
- DriverManager::Instance()->clearServers();
- DriverManager::Instance()->close();
+ GUIManager::Instance()->close();
#endif
- delete m_KStarsData;
- pinstance = 0;
-
QSqlDatabase::removeDatabase("userdb");
QSqlDatabase::removeDatabase("skydb");
}
diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index 523e661..b51b9e4 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -142,6 +142,10 @@
<label>Automatically updates time and date?</label>
<default>true</default>
</entry>
+ <entry name="independentWindowINDI" type="Bool">
+ <label>Make INDI Control Panel window independent of KStars main window</label>
+ <default>false</default>
+ </entry>
<entry name="showTargetCrosshair" type="Bool">
<label>Draw crosshairs at telescope position in the sky map?</label>
<whatsthis>Toggle display of crosshairs centered at telescope's pointed position in the KStars sky map.</whatsthis>
diff --git a/kstars/options/opsadvanced.cpp b/kstars/options/opsadvanced.cpp
index 98a1397..72ebe6d 100644
--- a/kstars/options/opsadvanced.cpp
+++ b/kstars/options/opsadvanced.cpp
@@ -21,6 +21,7 @@
#include <QLabel>
#include <QCheckBox>
#include <QRadioButton>
+#include <QDesktopServices>
#include "Options.h"
#include "kstars.h"
@@ -48,6 +49,8 @@ OpsAdvanced::OpsAdvanced()
connect(kcfg_LogToFile, SIGNAL(toggled(bool)), this, SLOT(slotToggleOutputOptions()));
+ connect(showLogsB, SIGNAL(clicked()), this, SLOT(slotShowLogFiles()));
+
foreach(QAbstractButton *b, modulesGroup->buttons())
b->setEnabled(kcfg_VerboseLogging->isChecked());
}
@@ -89,3 +92,9 @@ void OpsAdvanced::slotToggleOutputOptions()
KSUtils::Logging::UseFile();
}
+void OpsAdvanced::slotShowLogFiles()
+{
+ QUrl path = QUrl::fromLocalFile(KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "logs");
+
+ QDesktopServices::openUrl(path);
+}
diff --git a/kstars/options/opsadvanced.h b/kstars/options/opsadvanced.h
index ab64b50..f779791 100644
--- a/kstars/options/opsadvanced.h
+++ b/kstars/options/opsadvanced.h
@@ -47,6 +47,7 @@ private slots:
void slotToggleHideOptions();
void slotToggleVerbosityOptions();
void slotToggleOutputOptions();
+ void slotShowLogFiles();
};
#endif //OPSADVANCED_H_
diff --git a/kstars/options/opsadvanced.ui b/kstars/options/opsadvanced.ui
index 3e6e81f..d5f5979 100644
--- a/kstars/options/opsadvanced.ui
+++ b/kstars/options/opsadvanced.ui
@@ -254,22 +254,6 @@
<string>Logging Output</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="3">
- <widget class="QRadioButton" name="kcfg_DisableLogging">
- <property name="toolTip">
- <string>Disable all logging output</string>
- </property>
- <property name="text">
- <string>Disable</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">verbosityButtonGroup</string>
- </attribute>
- </widget>
- </item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
@@ -277,16 +261,16 @@
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QRadioButton" name="kcfg_VerboseLogging">
+ <item row="1" column="2">
+ <widget class="QRadioButton" name="kcfg_LogToFile">
<property name="toolTip">
- <string>Enable verbose debug output</string>
+ <string>Log output to log file</string>
</property>
<property name="text">
- <string>&amp;Verbose</string>
+ <string>File</string>
</property>
<attribute name="buttonGroup">
- <string notr="true">verbosityButtonGroup</string>
+ <string notr="true">logbuttonGroup</string>
</attribute>
</widget>
</item>
@@ -306,13 +290,26 @@
</attribute>
</widget>
</item>
- <item row="2" column="3">
- <widget class="QCheckBox" name="kcfg_CaptureLogging">
+ <item row="2" column="5">
+ <widget class="QCheckBox" name="kcfg_AlignmentLogging">
<property name="toolTip">
- <string>Log Ekos Capture module activity</string>
+ <string>Log Ekos Alignment module activity</string>
</property>
<property name="text">
- <string>Capture</string>
+ <string>Alignment</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">modulesGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QCheckBox" name="kcfg_INDILogging">
+ <property name="toolTip">
+ <string>Log INDI devices activity</string>
+ </property>
+ <property name="text">
+ <string>INDI</string>
</property>
<attribute name="buttonGroup">
<string notr="true">modulesGroup</string>
@@ -326,120 +323,130 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QRadioButton" name="kcfg_LogToDefault">
+ <item row="0" column="3">
+ <widget class="QRadioButton" name="kcfg_DisableLogging">
<property name="toolTip">
- <string>Log debug messages to default output device used by the platform (e.g. Standard Error)</string>
+ <string>Disable all logging output</string>
</property>
<property name="text">
- <string>Default</string>
+ <string>Disable</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<attribute name="buttonGroup">
- <string notr="true">logbuttonGroup</string>
+ <string notr="true">verbosityButtonGroup</string>
</attribute>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QRadioButton" name="kcfg_LogToFile">
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="kcfg_VerboseLogging">
<property name="toolTip">
- <string>Log output to log file</string>
+ <string>Enable verbose debug output</string>
</property>
<property name="text">
- <string>File</string>
+ <string>&amp;Verbose</string>
</property>
<attribute name="buttonGroup">
- <string notr="true">logbuttonGroup</string>
+ <string notr="true">verbosityButtonGroup</string>
</attribute>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Modules:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="kcfg_FITSLogging">
+ <item row="2" column="4">
+ <widget class="QCheckBox" name="kcfg_FocusLogging">
<property name="toolTip">
- <string>Log FITS processing activity</string>
+ <string>Log Ekos Focus module activity</string>
</property>
<property name="text">
- <string>FITS</string>
+ <string>Focus</string>
</property>
<attribute name="buttonGroup">
<string notr="true">modulesGroup</string>
</attribute>
</widget>
</item>
- <item row="2" column="2">
- <widget class="QCheckBox" name="kcfg_INDILogging">
+ <item row="2" column="6">
+ <widget class="QCheckBox" name="kcfg_GuideLogging">
<property name="toolTip">
- <string>Log INDI devices activity</string>
+ <string>Log Ekos Guide module activity</string>
</property>
<property name="text">
- <string>INDI</string>
+ <string>Guide</string>
</property>
<attribute name="buttonGroup">
<string notr="true">modulesGroup</string>
</attribute>
</widget>
</item>
- <item row="2" column="4">
- <widget class="QCheckBox" name="kcfg_FocusLogging">
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Modules:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="kcfg_FITSLogging">
<property name="toolTip">
- <string>Log Ekos Focus module activity</string>
+ <string>Log FITS processing activity</string>
</property>
<property name="text">
- <string>Focus</string>
+ <string>FITS</string>
</property>
<attribute name="buttonGroup">
<string notr="true">modulesGroup</string>
</attribute>
</widget>
</item>
- <item row="2" column="5">
- <widget class="QCheckBox" name="kcfg_AlignmentLogging">
+ <item row="1" column="1">
+ <widget class="QRadioButton" name="kcfg_LogToDefault">
<property name="toolTip">
- <string>Log Ekos Alignment module activity</string>
+ <string>Log debug messages to default output device used by the platform (e.g. Standard Error)</string>
</property>
<property name="text">
- <string>Alignment</string>
+ <string>Default</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
<attribute name="buttonGroup">
- <string notr="true">modulesGroup</string>
+ <string notr="true">logbuttonGroup</string>
</attribute>
</widget>
</item>
- <item row="2" column="6">
- <widget class="QCheckBox" name="kcfg_GuideLogging">
+ <item row="2" column="7">
+ <widget class="QCheckBox" name="kcfg_MountLogging">
<property name="toolTip">
- <string>Log Ekos Guide module activity</string>
+ <string>Log Ekos Mount module activity</string>
</property>
<property name="text">
- <string>Guide</string>
+ <string>Mount</string>
</property>
<attribute name="buttonGroup">
<string notr="true">modulesGroup</string>
</attribute>
</widget>
</item>
- <item row="2" column="7">
- <widget class="QCheckBox" name="kcfg_MountLogging">
+ <item row="2" column="3">
+ <widget class="QCheckBox" name="kcfg_CaptureLogging">
<property name="toolTip">
- <string>Log Ekos Mount module activity</string>
+ <string>Log Ekos Capture module activity</string>
</property>
<property name="text">
- <string>Mount</string>
+ <string>Capture</string>
</property>
<attribute name="buttonGroup">
<string notr="true">modulesGroup</string>
</attribute>
</widget>
</item>
+ <item row="0" column="7">
+ <widget class="QPushButton" name="showLogsB">
+ <property name="text">
+ <string>Show Logs</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>