Skip to content

Commit

Permalink
Disable ASCOM on Qt6-based builds
Browse files Browse the repository at this point in the history
- due to some incomprehensible error apparently out of our hands.
  • Loading branch information
gzotti committed Sep 7, 2024
1 parent ef8dd4b commit dc44dab
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 26 deletions.
11 changes: 7 additions & 4 deletions plugins/TelescopeControl/src/ASCOM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
if(WIN32)
# Due to incomprehensible errors between ASCOM and Qt6OpenGL!QOpenGL2PaintEngineEx::setState(), we must disable ASCOM in QT6-based builds.
# No other code change related to Qt6 has been done so far, only the ASCOM selector has been greyed out.
# Rather sooner than later ASCOM must be replaced by Alpaca.
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
Expand All @@ -11,9 +14,9 @@ SET(TelescopeControl_ASCOM_UIS

IF (${QT_VERSION_MAJOR} EQUAL "5")
QT5_WRAP_UI(TelescopeControl_ASCOM_UIS_H ${TelescopeControl_ASCOM_UIS})
ELSE()
ELSE(${QT_VERSION_MAJOR} EQUAL "5")
QT_WRAP_UI(TelescopeControl_ASCOM_UIS_H ${TelescopeControl_ASCOM_UIS})
ENDIF()
ENDIF(${QT_VERSION_MAJOR} EQUAL "5")

add_library(TelescopeControl_ASCOM STATIC
ASCOMDevice.hpp
Expand All @@ -40,4 +43,4 @@ ENDIF(ENABLE_TESTING)

SET_TARGET_PROPERTIES(TelescopeControl_ASCOM PROPERTIES FOLDER "plugins/TelescopeControl")

ENDIF(WIN32)
ENDIF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
13 changes: 7 additions & 6 deletions plugins/TelescopeControl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ add_subdirectory(Lx200)
add_subdirectory(NexStar)
add_subdirectory(Rts2)
add_subdirectory(INDI)
if(WIN32)
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
add_subdirectory(ASCOM)
endif(WIN32)
endif(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

SET(TelescopeControl_RES ../resources/TelescopeControl.qrc)
IF (${QT_VERSION_MAJOR} EQUAL "5")
Expand Down Expand Up @@ -49,10 +49,11 @@ TARGET_LINK_LIBRARIES(TelescopeControl-static
Qt${QT_VERSION_MAJOR}::SerialPort
)

IF(WIN32)
TARGET_LINK_LIBRARIES(TelescopeControl-static
TelescopeControl_ASCOM)
ENDIF(WIN32)
# Due to incomprehensible errors between ASCOM and Qt6OpenGL!QOpenGL2PaintEngineEx::setState(), we must disable in QT6-based builds.
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
#TARGET_LINK_LIBRARIES(TelescopeControl-static
# TelescopeControl_ASCOM)
ENDIF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins TelescopeControl-static)
Expand Down
6 changes: 4 additions & 2 deletions plugins/TelescopeControl/src/TelescopeClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
#include <QTextStream>
#include <QMessageBox>

#ifdef Q_OS_WIN
#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 <sys/time.h>
Expand Down Expand Up @@ -103,7 +105,7 @@ TelescopeClient *TelescopeClient::create(const QString &url)
{
newTelescope = new TelescopeClientINDI(name, params);
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
else if (type == "ASCOM")
{
newTelescope = new TelescopeClientASCOM(name, params, eq);
Expand Down
4 changes: 2 additions & 2 deletions plugins/TelescopeControl/src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

IF(WIN32)
IF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
SET(TelescopeControl_ASCOM_common_SRC
ASCOMSupport.hpp
ASCOMSupport.cpp
OLE.hpp
OLE.cpp
)
ENDIF()
ENDIF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

add_library(TelescopeControl_common STATIC
LogFile.hpp
Expand Down
4 changes: 2 additions & 2 deletions plugins/TelescopeControl/src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ target_link_libraries(TelescopeControl_gui
TelescopeControl_INDI
)

IF(WIN32)
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
target_link_libraries(TelescopeControl_gui
TelescopeControl_ASCOM
)
ENDIF(WIN32)
ENDif(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

SET_TARGET_PROPERTIES(TelescopeControl_gui PROPERTIES FOLDER "plugins/TelescopeControl")
19 changes: 12 additions & 7 deletions plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "TelescopeControl.hpp"
#include "ui_telescopeConfigurationDialog.h"

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
#include "../common/ASCOMSupport.hpp"
#endif

Expand Down Expand Up @@ -132,7 +132,7 @@ void TelescopeConfigurationDialog::createDialogContent()
ui->setupUi(dialog);

// ASCOM Telescope client widget needs to be dynamically added in order to make use of preprocessors to exclude for non-windows
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
ascomWidget = new TelescopeClientASCOMWidget(ui->scrollAreaWidgetContents);
ui->ASCOMLayout->addWidget(ascomWidget);

Expand All @@ -155,7 +155,12 @@ void TelescopeConfigurationDialog::createDialogContent()
connect(ui->radioButtonTelescopeRTS2, SIGNAL(toggled(bool)), this, SLOT(toggleTypeRTS2(bool)));
connect(ui->radioButtonTelescopeINDI, SIGNAL(toggled(bool)), this, SLOT(toggleTypeINDI(bool)));
#ifdef Q_OS_WIN
connect(ui->radioButtonTelescopeASCOM, SIGNAL(toggled(bool)), this, SLOT(toggleTypeASCOM(bool)));
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
ui->radioButtonTelescopeASCOM->setToolTip(q_("Disabled due to apparent incompatibility. Please use Qt5-based build."));
ui->radioButtonTelescopeASCOM->setDisabled(true);
#else
connect(ui->radioButtonTelescopeASCOM, SIGNAL(toggled(bool)), this, SLOT(toggleTypeASCOM(bool)));
#endif
#else
ui->radioButtonTelescopeASCOM->hide();
#endif
Expand Down Expand Up @@ -193,7 +198,7 @@ void TelescopeConfigurationDialog::initConfigurationDialog()
ui->groupBoxDeviceSettings->hide();
ui->groupBoxRTS2Settings->hide();
ui->INDIProperties->hide();
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
ascomWidget->hide();
#endif

Expand Down Expand Up @@ -347,7 +352,7 @@ void TelescopeConfigurationDialog::initExistingTelescopeConfiguration(int slot)
ui->INDIProperties->setPort(portTCP);
ui->INDIProperties->setSelectedDevice(deviceModelName);
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
else if (connectionType == TelescopeControl::ConnectionASCOM)
{
ui->radioButtonTelescopeASCOM->setChecked(true);
Expand Down Expand Up @@ -456,7 +461,7 @@ void TelescopeConfigurationDialog::toggleTypeINDI(bool enabled)
ui->INDIProperties->setVisible(enabled);
}

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
void TelescopeConfigurationDialog::toggleTypeASCOM(bool enabled)
{
ascomWidget->setVisible(enabled);
Expand Down Expand Up @@ -545,7 +550,7 @@ void TelescopeConfigurationDialog::buttonSavePressed()
telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, ui->INDIProperties->host(),
ui->INDIProperties->port(), delay, connectAtStartup, circles, ui->INDIProperties->selectedDevice());
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
else if (ui->radioButtonTelescopeASCOM->isChecked())
{
type = TelescopeControl::ConnectionASCOM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "StelDialog.hpp"
#include "TelescopeControl.hpp"

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
#include "../ASCOM/TelescopeClientASCOMWidget.hpp"
#endif

Expand Down Expand Up @@ -68,7 +68,7 @@ private slots:
void toggleTypeVirtual(bool);
void toggleTypeRTS2(bool);
void toggleTypeINDI(bool enabled);
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
void toggleTypeASCOM(bool enabled);
#endif

Expand All @@ -87,7 +87,7 @@ private slots:
QRegularExpressionValidator * circleListValidator;
QRegularExpressionValidator * serialPortValidator;

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
TelescopeClientASCOMWidget* ascomWidget;
#endif

Expand Down

0 comments on commit dc44dab

Please sign in to comment.