Skip to content

Commit

Permalink
INDI support in Telescope Control plugin is optional now
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-w committed Nov 13, 2024
1 parent bc2bc2a commit 33b7ae3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ List of supported parameters (passed as `-DPARAMETER=VALUE`):
| ENABLE_RELEASE_BUILD | bool | OFF | This option flags the build as an official release
| ENABLE_TESTING | bool | OFF | Enable unit tests
| ENABLE_QTWEBENGINE | bool | ON | Enable QtWebEngine module support if it installed
| ENABLE_INDI | bool | ON | Activate support for INDI client in Telescope Control plugin
| USE_BUNDLED_QTCOMPRESS | bool | ON | Use bundled version of qtcompress
| USE_PLUGIN_ANGLEMEASURE | bool | ON | Enable building the Angle Measure plugin
| USE_PLUGIN_ARCHAEOLINES | bool | ON | Enable building the ArchaeoLines plugin
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,17 @@ IF(ENABLE_XLSX)
ADD_DEFINITIONS(-DENABLE_XLSX)
ENDIF()

# Activate support for INDI client in Telescope Control plugin
IF(WIN32)
# Disable support for INDI client in Windows
SET(ENABLE_INDI 0)
ELSE()
SET(ENABLE_INDI 1 CACHE BOOL "Define whether to use INDI client in Telescope Control plugin.")
ENDIF()
IF(ENABLE_INDI)
ADD_DEFINITIONS(-DENABLE_INDI)
ENDIF()

# SPOUT allows relaying the Stellarium OpenGL framebuffer as DirectX texture in other programs.
# It exists on Windows only. Syphon is a similar system for MacOS, this might be added by a Mac developer.
IF(WIN32)
Expand Down
8 changes: 4 additions & 4 deletions plugins/TelescopeControl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ add_subdirectory(gui)
add_subdirectory(Lx200)
add_subdirectory(NexStar)
add_subdirectory(Rts2)
IF(NOT WIN32)
IF(ENABLE_INDI)
add_subdirectory(INDI)
ENDIF()
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
Expand Down Expand Up @@ -50,9 +50,9 @@ TARGET_LINK_LIBRARIES(TelescopeControl-static
Qt${QT_VERSION_MAJOR}::SerialPort
)

IF(NOT WIN32)
TARGET_LINK_LIBRARIES(TelescopeControl-static
TelescopeControl_INDI
IF(ENABLE_INDI)
TARGET_LINK_LIBRARIES(TelescopeControl-static
TelescopeControl_INDI
)
ENDIF()

Expand Down
7 changes: 5 additions & 2 deletions plugins/TelescopeControl/src/TelescopeClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@
#include <QTextStream>
#include <QMessageBox>

#ifdef ENABLE_INDI
#include "INDI/TelescopeClientINDI.hpp"
#endif

#if defined(Q_OS_WIN)
#if QT_VERSION<QT_VERSION_CHECK(6,0,0)
#include "ASCOM/TelescopeClientASCOM.hpp"
#endif
#include <Windows.h> // GetSystemTimeAsFileTime()
#else
#include "INDI/TelescopeClientINDI.hpp"
#include <sys/time.h>
#endif

Expand Down Expand Up @@ -101,7 +104,7 @@ TelescopeClient *TelescopeClient::create(const QString &url)
{
newTelescope= new TelescopeClientDirectNexStar(name, params, eq);
}
#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
else if (type == "INDI")
{
newTelescope = new TelescopeClientINDI(name, params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void TelescopeConfigurationDialog::createDialogContent()
}
#endif

#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
indiWidget = new TelescopeClientINDIWidget(ui->scrollAreaWidgetContents);
ui->INDILayout->addWidget(indiWidget);
#else
Expand All @@ -160,7 +160,7 @@ void TelescopeConfigurationDialog::createDialogContent()
connect(ui->radioButtonTelescopeConnection, SIGNAL(toggled(bool)), this, SLOT(toggleTypeConnection(bool)));
connect(ui->radioButtonTelescopeVirtual, SIGNAL(toggled(bool)), this, SLOT(toggleTypeVirtual(bool)));
connect(ui->radioButtonTelescopeRTS2, SIGNAL(toggled(bool)), this, SLOT(toggleTypeRTS2(bool)));
#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
connect(ui->radioButtonTelescopeINDI, SIGNAL(toggled(bool)), this, SLOT(toggleTypeINDI(bool)));
#endif
#ifdef Q_OS_WIN
Expand Down Expand Up @@ -206,7 +206,7 @@ void TelescopeConfigurationDialog::initConfigurationDialog()
ui->groupBoxConnectionSettings->hide();
ui->groupBoxDeviceSettings->hide();
ui->groupBoxRTS2Settings->hide();
#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
indiWidget->hide();
#endif
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
Expand Down Expand Up @@ -356,7 +356,7 @@ void TelescopeConfigurationDialog::initExistingTelescopeConfiguration(int slot)
ui->lineEditRTS2Password->setText(rts2Password);
ui->doubleSpinBoxRTS2Refresh->setValue(SECONDS_FROM_MICROSECONDS(rts2Refresh));
}
#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
else if (connectionType == TelescopeControl::ConnectionINDI)
{
ui->radioButtonTelescopeINDI->setChecked(true);
Expand Down Expand Up @@ -469,7 +469,7 @@ void TelescopeConfigurationDialog::toggleTypeRTS2(bool isChecked)
}
}

#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
void TelescopeConfigurationDialog::toggleTypeINDI(bool enabled)
{
indiWidget->setVisible(enabled);
Expand Down Expand Up @@ -559,7 +559,7 @@ void TelescopeConfigurationDialog::buttonSavePressed()
ui->lineEditRTS2Username->text(), ui->lineEditRTS2Password->text(),
qRound(MICROSECONDS_FROM_SECONDS(ui->doubleSpinBoxRTS2Refresh->value())));
}
#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
else if (ui->radioButtonTelescopeINDI->isChecked())
{
type = TelescopeControl::ConnectionINDI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "../ASCOM/TelescopeClientASCOMWidget.hpp"
#endif

#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
#include "../INDI/TelescopeClientINDIWidget.hpp"
#endif

Expand Down Expand Up @@ -71,7 +71,7 @@ private slots:
void toggleTypeConnection(bool);
void toggleTypeVirtual(bool);
void toggleTypeRTS2(bool);
#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
void toggleTypeINDI(bool enabled);
#endif
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
Expand All @@ -97,7 +97,7 @@ private slots:
TelescopeClientASCOMWidget* ascomWidget;
#endif

#ifndef Q_OS_WIN
#ifdef ENABLE_INDI
TelescopeClientINDIWidget* indiWidget;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ IF(USE_BUNDLED_QTCOMPRESS)
ENDIF()

################################# INDI ################################
IF(USE_PLUGIN_TELESCOPECONTROL AND NOT WIN32)
IF(USE_PLUGIN_TELESCOPECONTROL AND ENABLE_INDI)
SET(PREFER_SYSTEM_INDILIB 1 CACHE BOOL "Use system-provided INDI instead of the bundled version")
find_library(INDICLIENT_LIB indiclient)
if(INDICLIENT_LIB AND PREFER_SYSTEM_INDILIB)
Expand Down

0 comments on commit 33b7ae3

Please sign in to comment.