Commit 46cfa929 authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

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
parent a79f4667
......@@ -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);
}
}
}
......
......@@ -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)
{
......
......@@ -123,7 +123,8 @@ public:
void clearServers();
private:
DriverManager();
DriverManager(QWidget *parent);
~DriverManager();
static DriverManager * _DriverManager;
......
......@@ -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*/)
......
......@@ -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++)
......
......@@ -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;
......
......@@ -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">
......@@ -356,6 +356,13 @@
</property>
</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">
......
......@@ -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");
}
......
......@@ -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>
......
......@@ -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);
}
......@@ -47,6 +47,7 @@ private slots:
void slotToggleHideOptions();
void slotToggleVerbosityOptions();
void slotToggleOutputOptions();
void slotShowLogFiles();
};
#endif //OPSADVANCED_H_
......
......@@ -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>
......
Supports Markdown
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