mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
Add check for space module to avoid compile errors
This commit is contained in:
@@ -121,7 +121,11 @@ target_link_libraries(
|
||||
openspace-ui-launcher
|
||||
PUBLIC
|
||||
openspace-core
|
||||
Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network
|
||||
openspace-module-collection
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
|
||||
@@ -26,11 +26,14 @@
|
||||
#define __OPENSPACE_UI_LAUNCHER___HORIZONS___H__
|
||||
|
||||
#include <openspace/json.h>
|
||||
#include <../modules/space/horizonsfile.h>
|
||||
#include <QDialog>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
#ifdef OPENSPACE_MODULE_SPACE_ENABLED
|
||||
#include <../modules/space/horizonsfile.h>
|
||||
#endif // OPENSPACE_MODULE_SPACE_ENABLED
|
||||
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QDateTimeEdit;
|
||||
@@ -48,6 +51,8 @@ public:
|
||||
* Constructor for HorizonsDialog class
|
||||
*/
|
||||
HorizonsDialog(QWidget* parent);
|
||||
|
||||
#ifdef OPENSPACE_MODULE_SPACE_ENABLED
|
||||
std::filesystem::path file() const;
|
||||
|
||||
private slots:
|
||||
@@ -103,6 +108,7 @@ private:
|
||||
QPlainTextEdit* _log = nullptr;
|
||||
|
||||
QLabel* _errorMsg = nullptr;
|
||||
#endif // OPENSPACE_MODULE_SPACE_ENABLED
|
||||
};
|
||||
|
||||
#endif // __OPENSPACE_UI_LAUNCHER___HORIZONS___H__
|
||||
|
||||
@@ -125,9 +125,18 @@ void AssetEdit::openComponent() {
|
||||
this,
|
||||
&AssetEdit::openHorizons
|
||||
);
|
||||
generateButton->setCursor(Qt::PointingHandCursor);
|
||||
container->addWidget(generateButton);
|
||||
|
||||
// In order to generate a Horizons File the Space module is required
|
||||
#ifndef OPENSPACE_MODULE_SPACE_ENABLED
|
||||
generateButton->setEnabled(false);
|
||||
generateButton->setToolTip(
|
||||
"Connot generate Horizons file without the space module enabled"
|
||||
);
|
||||
#else
|
||||
generateButton->setCursor(Qt::PointingHandCursor);
|
||||
#endif // OPENSPACE_MODULE_SPACE_ENABLED
|
||||
|
||||
container->addWidget(generateButton);
|
||||
horizonsLayout->addLayout(container);
|
||||
}
|
||||
horizonsLayout->addWidget(new Line);
|
||||
@@ -153,10 +162,12 @@ void AssetEdit::openHorizonsFile() {
|
||||
|
||||
void AssetEdit::openHorizons() {
|
||||
_errorMsg->clear();
|
||||
#ifdef OPENSPACE_MODULE_SPACE_ENABLED
|
||||
HorizonsDialog* horizonsDialog = new HorizonsDialog(this);
|
||||
horizonsDialog->exec();
|
||||
_horizonsFile = horizonsDialog->file();
|
||||
_horizonsFileEdit->setText(QString(_horizonsFile.string().c_str()));
|
||||
#endif // OPENSPACE_MODULE_SPACE_ENABLED
|
||||
}
|
||||
|
||||
void AssetEdit::approved() {
|
||||
|
||||
@@ -113,12 +113,16 @@ namespace {
|
||||
HorizonsDialog::HorizonsDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
#ifdef OPENSPACE_MODULE_SPACE_ENABLED
|
||||
_manager = new QNetworkAccessManager(this);
|
||||
|
||||
setWindowTitle("Horizons");
|
||||
createWidgets();
|
||||
#endif // OPENSPACE_MODULE_SPACE_ENABLED
|
||||
}
|
||||
|
||||
#ifdef OPENSPACE_MODULE_SPACE_ENABLED
|
||||
|
||||
std::filesystem::path HorizonsDialog::file() const {
|
||||
return _horizonsFile.file();
|
||||
}
|
||||
@@ -127,7 +131,7 @@ void HorizonsDialog::createWidgets() {
|
||||
QBoxLayout* wholeLayout = new QHBoxLayout(this);
|
||||
QBoxLayout* layout = new QVBoxLayout(this);
|
||||
{
|
||||
QLabel* generateLabel = new QLabel("Generate a new Horizons file:", this);
|
||||
QLabel* generateLabel = new QLabel("Generate a new Horizons file", this);
|
||||
generateLabel->setObjectName("heading");
|
||||
layout->addWidget(generateLabel);
|
||||
|
||||
@@ -892,3 +896,5 @@ void HorizonsDialog::approved() {
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
#endif // OPENSPACE_MODULE_SPACE_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user