Skip to content

Commit 1bd57fd

Browse files
committed
NO_GUI mode for AngleMeasure and ArchaeoLines plugins
1 parent 21d4a49 commit 1bd57fd

File tree

6 files changed

+54
-13
lines changed

6 files changed

+54
-13
lines changed

plugins/AngleMeasure/src/AngleMeasure.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ AngleMeasure::AngleMeasure()
8080
, flagShowHorizontalStartSkylinked(false)
8181
, flagShowHorizontalEndSkylinked(false)
8282
, angleHorizontal(0.)
83+
#ifndef NO_GUI
8384
, toolbarButton(Q_NULLPTR)
85+
#endif
8486
{
8587
startPoint.set(0.,0.,0.);
8688
endPoint.set(0.,0.,0.);
@@ -98,7 +100,9 @@ AngleMeasure::AngleMeasure()
98100

99101
setObjectName("AngleMeasure");
100102

103+
#ifndef NO_GUI
101104
configDialog = new AngleMeasureDialog();
105+
#endif
102106
conf = StelApp::getInstance().getSettings();
103107

104108
messageTimer = new QTimer(this);
@@ -110,14 +114,20 @@ AngleMeasure::AngleMeasure()
110114

111115
AngleMeasure::~AngleMeasure()
112116
{
117+
#ifndef NO_GUI
113118
delete configDialog;
119+
#endif
114120
}
115121

116122
bool AngleMeasure::configureGui(bool show)
117123
{
124+
#ifdef NO_GUI
125+
return false;
126+
#else
118127
if (show)
119128
configDialog->setVisible(true);
120129
return true;
130+
#endif
121131
}
122132

123133
//! Determine which "layer" the plugin's drawing will happen on.
@@ -141,13 +151,15 @@ void AngleMeasure::init()
141151

142152
// Create action for enable/disable & hook up signals
143153
addAction("actionShow_Angle_Measure", N_("Angle Measure"), N_("Angle measure"), "enabled", "Ctrl+A");
154+
#ifndef NO_GUI
144155
addAction("actionShow_Angle_Measure_dialog", N_("Angle Measure"), N_("Angle measure settings"), configDialog, "visible" ); // no default hotkey
145-
156+
#endif
146157
// Initialize the message strings and make sure they are translated when
147158
// the language changes.
148159
updateMessageText();
149160
connect(&app, SIGNAL(languageChanged()), this, SLOT(updateMessageText()));
150161

162+
#ifndef NO_GUI
151163
// Add a toolbar button
152164
try
153165
{
@@ -168,6 +180,7 @@ void AngleMeasure::init()
168180
{
169181
qWarning() << "Unable create toolbar button for AngleMeasure plugin: " << e.what();
170182
}
183+
#endif
171184
}
172185

173186
// handle time updates

plugins/AngleMeasure/src/AngleMeasure.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ private slots:
205205
Vec3d perp2EndPointHor;
206206
double angleHorizontal;
207207

208+
#ifndef NO_GUI
209+
AngleMeasureDialog* configDialog;
208210
StelButton* toolbarButton;
211+
#endif
209212

210213
void calculateEnds();
211214
void calculateEndsOneLine(const Vec3d &start, const Vec3d &end, Vec3d &perp1Start, Vec3d &perp1End, Vec3d &perp2Start, Vec3d &perp2End, double &angleEquatorial);
@@ -220,8 +223,6 @@ private slots:
220223

221224
QSettings* conf;
222225

223-
// GUI
224-
AngleMeasureDialog* configDialog;
225226
};
226227

227228
#include <QObject>

plugins/AngleMeasure/src/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,29 @@ LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src)
44
SET(AngleMeasure_SRCS
55
AngleMeasure.hpp
66
AngleMeasure.cpp
7+
)
8+
IF (STELLARIUM_GUI_MODE STREQUAL "Standard")
9+
LIST(APPEND AngleMeasure_SRCS
710
gui/AngleMeasureDialog.hpp
811
gui/AngleMeasureDialog.cpp
912
)
1013

1114
SET(AngleMeasure_UIS
1215
gui/angleMeasureDialog.ui
1316
)
17+
ENDIF (STELLARIUM_GUI_MODE STREQUAL "Standard")
1418

1519
################# compiles resources files ############
1620
SET(AngleMeasure_RES ../AngleMeasure.qrc)
1721
IF (${QT_VERSION_MAJOR} EQUAL "5")
18-
QT5_WRAP_UI(AngleMeasure_UIS_H ${AngleMeasure_UIS})
22+
IF (STELLARIUM_GUI_MODE STREQUAL "Standard")
23+
QT5_WRAP_UI(AngleMeasure_UIS_H ${AngleMeasure_UIS})
24+
ENDIF()
1925
QT5_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES})
2026
ELSE()
21-
QT_WRAP_UI(AngleMeasure_UIS_H ${AngleMeasure_UIS})
27+
IF (STELLARIUM_GUI_MODE STREQUAL "Standard")
28+
QT_WRAP_UI(AngleMeasure_UIS_H ${AngleMeasure_UIS})
29+
ENDIF()
2230
QT_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES})
2331
ENDIF()
2432

plugins/ArchaeoLines/src/ArchaeoLines.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ ArchaeoLines::ArchaeoLines()
9595
, flagShowCustomDeclination1(false)
9696
, flagShowCustomDeclination2(false)
9797
, lastJDE(0.0)
98+
#ifndef NO_GUI
9899
, toolbarButton(Q_NULLPTR)
100+
#endif
99101
{
100102
setObjectName("ArchaeoLines");
101103
core=StelApp::getInstance().getCore();
@@ -140,7 +142,9 @@ ArchaeoLines::ArchaeoLines()
140142
customDeclination1Line = new ArchaeoLine(ArchaeoLine::CustomDeclination1, 0.0);
141143
customDeclination2Line = new ArchaeoLine(ArchaeoLine::CustomDeclination2, 0.0);
142144

145+
#ifndef NO_GUI
143146
configDialog = new ArchaeoLinesDialog();
147+
#endif
144148
conf = StelApp::getInstance().getSettings();
145149

146150
connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(updateObserverLocation(StelLocation)));
@@ -180,14 +184,20 @@ ArchaeoLines::~ArchaeoLines()
180184
delete customDeclination1Line; customDeclination1Line=Q_NULLPTR;
181185
delete customDeclination2Line; customDeclination2Line=Q_NULLPTR;
182186

187+
#ifndef NO_GUI
183188
delete configDialog; configDialog=Q_NULLPTR;
189+
#endif
184190
}
185191

186192
bool ArchaeoLines::configureGui(bool show)
187193
{
194+
#ifdef NO_GUI
195+
return false;
196+
#else
188197
if (show)
189198
configDialog->setVisible(true);
190199
return true;
200+
#endif
191201
}
192202

193203
//! Determine which "layer" the plugin's drawing will happen on.
@@ -269,8 +279,8 @@ void ArchaeoLines::init()
269279
// Create action for enable/disable & hook up signals
270280
QString section=N_("ArchaeoLines");
271281
addAction("actionShow_ArchaeoLines", section, N_("ArchaeoLines"), "enabled", "Ctrl+U");
282+
#ifndef NO_GUI
272283
addAction("actionShow_ArchaeoLines_dialog", section, N_("Show settings dialog"), configDialog, "visible", "Ctrl+Shift+U");
273-
274284
// Add a toolbar button
275285
StelApp& app=StelApp::getInstance();
276286
try
@@ -292,6 +302,7 @@ void ArchaeoLines::init()
292302
{
293303
qWarning() << "Unable to create toolbar button for ArchaeoLines plugin: " << e.what();
294304
}
305+
#endif
295306
addAction("actionAL_showEquinoxLine", section, N_("Show Line for Equinox"), "flagShowEquinox" ); // No Shortcuts configured.
296307
addAction("actionAL_showSolsticeLines", section, N_("Show Line for Solstices"), "flagShowSolstices" ); // No Shortcuts configured.
297308
addAction("actionAL_showCrossquarterLines", section, N_("Show Line for Crossquarter"), "flagShowCrossquarters" ); // No Shortcuts configured.

plugins/ArchaeoLines/src/ArchaeoLines.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,15 +568,15 @@ private slots:
568568
ArchaeoLine * customAltitude2Line;
569569
ArchaeoLine * customDeclination1Line;
570570
ArchaeoLine * customDeclination2Line;
571-
572-
StelButton* toolbarButton;
573571

574572
QSettings* conf;
575-
576-
// GUI
577-
ArchaeoLinesDialog* configDialog;
578573
StelCore* core; // used quite often, better keep a reference...
579574
StelObjectMgr* objMgr;
575+
576+
#ifndef NO_GUI
577+
ArchaeoLinesDialog* configDialog;
578+
StelButton* toolbarButton;
579+
#endif
580580
};
581581

582582

plugins/ArchaeoLines/src/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src)
44
SET(ArchaeoLines_SRCS
55
ArchaeoLines.hpp
66
ArchaeoLines.cpp
7+
)
8+
IF (STELLARIUM_GUI_MODE STREQUAL "Standard")
9+
LIST(APPEND ArchaeoLines_SRCS
710
gui/ArchaeoLinesDialog.hpp
811
gui/ArchaeoLinesDialog.cpp
912
gui/ArchaeoLinesDialogLocations.hpp
@@ -14,14 +17,19 @@ SET(ArchaeoLines_UIS
1417
gui/archaeoLinesDialog.ui
1518
gui/archaeoLinesDialogLocations.ui
1619
)
20+
ENDIF (STELLARIUM_GUI_MODE STREQUAL "Standard")
1721

1822
################# compiles resources files ############
1923
SET(ArchaeoLines_RES ../ArchaeoLines.qrc)
2024
IF (${QT_VERSION_MAJOR} EQUAL "5")
21-
QT5_WRAP_UI(ArchaeoLines_UIS_H ${ArchaeoLines_UIS})
25+
IF (STELLARIUM_GUI_MODE STREQUAL "Standard")
26+
QT5_WRAP_UI(ArchaeoLines_UIS_H ${ArchaeoLines_UIS})
27+
ENDIF()
2228
QT5_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES})
2329
ELSE()
24-
QT_WRAP_UI(ArchaeoLines_UIS_H ${ArchaeoLines_UIS})
30+
IF (STELLARIUM_GUI_MODE STREQUAL "Standard")
31+
QT_WRAP_UI(ArchaeoLines_UIS_H ${ArchaeoLines_UIS})
32+
ENDIF()
2533
QT_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES})
2634
ENDIF()
2735

0 commit comments

Comments
 (0)