Skip to content

Commit 497c615

Browse files
committed
b176 SCXML module made optional
1 parent 1711be3 commit 497c615

12 files changed

+85
-48
lines changed

INSTALL

+7-3
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,19 @@ folder for the shared libraries: QXMLEDIT_INST_LIB_DIR
4343
folder for the language translations: QXMLEDIT_INST_TRANSLATIONS_DIR
4444
folder for the includes of the xml edit widget: QXMLEDIT_INST_INCLUDE_DIR
4545
disable the precompiled headers by setting the value to non empty string: QXMLEDIT_INST_AVOID_PRECOMP_HEADERS
46-
disable the link with QwtPlot3D setting QXMLEDIT_NO_QWTPLOT to non empty string
47-
enable C++11 compiler option defining QXMLEDIT_INST_USE_C11=y (default: not enabled)
46+
disable the link with QwtPlot3D setting QXMLEDIT_NO_QWTPLOT to non empty string.
47+
enable C++11 compiler option defining QXMLEDIT_INST_USE_C11=y (default: not enabled).
4848
disable tips management: QXMLEDIT_COMPILE_DISABLE_TIPS non void (default: tips enabled).
49-
to append the version suffix to libraries set QXMLEDIT_VERSIONED to a value
49+
disable the Qt SCXML module setting QXMLEDIT_DISABLE_SCXML to non empty string (default: SCXML enabled if Qt >= 5.7.0).
50+
to append the version suffix to libraries set QXMLEDIT_VERSIONED to a value.
5051

5152
QwtPlot3D library is linked (statically) by default unless QXMLEDIT_NO_QWTPLOT environment variable is defined and not empty.
5253
It is used as an optional component and can be excluded without compromising QXmlEdit functionalities.
5354
Warning: QwtPlot3D library requires OpenGL.
5455

56+
The Qt module SCXML is enabled by default when the Qt version is greater then 5.7.0, but can be
57+
disabled via compiler options.
58+
5559
To force the executable name all lowercase (qxmledit) as in Unix style, the following enviroment variable
5660
must be set to 1:
5761
QXMLEDIT_UNIX_LOWERCASE_NAME

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
0.9.13
2+
Qt SCXML module made optional.
23

34
0.9.12
45
Used the right extension in the fragment extraction preview.

scripts/linux/compile_override.sh

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export QXMLEDIT_INST_USE_C11=y
1616
export QXMLEDIT_INST_AVOID_PRECOMP_HEADERS=Y
1717
export QXMLEDIT_UNIX_LOWERCASE_NAME=0
1818
export QXMLEDIT_VERSIONED=Y
19+
export QXMLEDIT_DISABLE_SCXML=Y
1920

2021
qmake "CONFIG+=release" \
2122
"QXMLEDIT_INST_DATA_DIR = /mnt/ramdisk/override/INST_DATA_DIR" \
@@ -29,6 +30,7 @@ qmake "CONFIG+=release" \
2930
"QXMLEDIT_INST_AVOID_PRECOMP_HEADERS = override_INST_AVOID_PRECOMP_HEADERS" \
3031
"QXMLEDIT_INST_USE_C11 = override_INST_USE_C11 " \
3132
"QXMLEDIT_VERSIONED = override_QXMLEDIT_VERSIONED" \
33+
"QXMLEDIT_DISABLE_SCXML = override_QXMLEDIT_DISABLE_SCXML" \
3234
"QXMLEDIT_UNIX_LOWERCASE_NAME = override_QXMLEDIT_UNIX_LOWERCASE_NAME"
3335
make $1
3436

scripts/linux/compile_test_params.sh

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export QXMLEDIT_NO_QWTPLOT=Y
1515
export QXMLEDIT_INST_USE_C11=y
1616
export QXMLEDIT_INST_AVOID_PRECOMP_HEADERS=Y
1717
export QXMLEDIT_UNIX_LOWERCASE_NAME=0
18+
export QXMLEDIT_DISABLE_SCXML=Y
1819
export LIB_VERSIONED=Y
1920

2021
qmake "CONFIG+=release"

singleapp/app.pro

+2-9
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,8 @@ greaterThan(QT_MAJOR_VERSION, 4) {
5757
QT += printsupport widgets core
5858
}
5959

60-
greaterThan(QT_MAJOR_VERSION, 4) {
61-
equals(QT_MAJOR_VERSION, 5) {
62-
greaterThan(QT_MINOR_VERSION, 6) {
63-
QT += scxml
64-
}
65-
}
66-
greaterThan(QT_MAJOR_VERSION, 5) {
67-
QT += scxml
68-
}
60+
isEqual(ENABLE_SCXML, "Y") {
61+
QT += scxml
6962
}
7063

7164
greaterThan(QT_MAJOR_VERSION, 4) {

src/QXmlEdit.pro

+2-10
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,12 @@ RESOURCES = risorse.qrc
6969
CONFIG += qt \
7070
warn_on
7171

72-
7372
greaterThan(QT_MAJOR_VERSION, 4) {
7473
QT += printsupport gui widgets core
7574
}
7675

77-
greaterThan(QT_MAJOR_VERSION, 4) {
78-
equals(QT_MAJOR_VERSION, 5) {
79-
greaterThan(QT_MINOR_VERSION, 6) {
80-
QT += scxml
81-
}
82-
}
83-
greaterThan(QT_MAJOR_VERSION, 5) {
84-
QT += scxml
85-
}
76+
isEqual(ENABLE_SCXML, "Y") {
77+
QT += scxml
8678
}
8779

8880
greaterThan(QT_MAJOR_VERSION, 4) {

src/QXmlEditWidget.pro

-12
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,12 @@ equals(QXMLEDIT_LIB_SUFFIX, "") {
4747
VERSION=""
4848
}
4949

50-
5150
QT += xml xmlpatterns network svg
5251

5352
greaterThan(QT_MAJOR_VERSION, 4) {
5453
QT += printsupport gui widgets core
5554
}
5655

57-
greaterThan(QT_MAJOR_VERSION, 4) {
58-
equals(QT_MAJOR_VERSION, 5) {
59-
greaterThan(QT_MINOR_VERSION, 6) {
60-
QT += scxml
61-
}
62-
}
63-
greaterThan(QT_MAJOR_VERSION, 5) {
64-
QT += scxml
65-
}
66-
}
67-
6856
TARGET = QXmlEditWidget$${QXMLEDIT_LIB_SUFFIX}
6957
os2:TARGET = QXmlEdtW
7058
TEMPLATE = lib

src/aboutdialog.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ void AboutDialog::setupPaths()
111111
addPath(tr("Resources folder"), ApplicationData::getResourceDir(), labelFont);
112112
addPath(tr("Style folder"), _data->getStylesDirStandard(), labelFont);
113113
addPath(tr("User Manual"), _data->userManualFilePath(), labelFont);
114+
#ifdef QXMLEDIT_QT_SCXML_ENABLED
115+
addPath(tr("Qt SCXML Module"), tr("enabled"), labelFont);
116+
#else
117+
addPath(tr("Qt SCXML Module"), tr("disaabled"), labelFont);
118+
#endif
114119
//---
115120
ui->tablePaths->horizontalHeader()->setStretchLastSection(true);
116121
ui->tablePaths->resizeColumnsToContents();

src/cconfig.pri

+29
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,35 @@ isEmpty(COMPILE_DISABLE_TIPS) {
130130
message("Tips enabled")
131131
}
132132

133+
###########################################
134+
ENABLE_SCXML="N"
135+
greaterThan(QT_MAJOR_VERSION, 4) {
136+
equals(QT_MAJOR_VERSION, 5) {
137+
greaterThan(QT_MINOR_VERSION, 6) {
138+
ENABLE_SCXML="Y"
139+
}
140+
}
141+
greaterThan(QT_MAJOR_VERSION, 5) {
142+
ENABLE_SCXML="Y"
143+
}
144+
}
145+
146+
DISABLE_SCXML=$$(QXMLEDIT_DISABLE_SCXML)
147+
!isEmpty(DISABLE_SCXML) {
148+
ENABLE_SCXML="N"
149+
}
150+
!isEmpty(QXMLEDIT_DISABLE_SCXML) {
151+
ENABLE_SCXML="N"
152+
}
153+
154+
isEqual(ENABLE_SCXML, "Y") {
155+
DEFINES += "QXMLEDIT_QT_SCXML_ENABLED"
156+
message("SCXML enabled")
157+
}
158+
159+
!isEqual(ENABLE_SCXML, "Y") {
160+
message("SCXML disabled")
161+
}
133162
###########################################
134163

135164
USE_QWTPLOT="Y"

src/mainwndcontroller.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#include "modules/messages/sourceerror.h"
5050
#include "sourcemessagemanager.h"
5151
#include "modules/messages/sourcerelatedmessages.h"
52-
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
52+
#ifdef QXMLEDIT_QT_SCXML_ENABLED
5353
#include <QtScxml/QScxmlStateMachine>
5454
#endif
5555
//----------
@@ -351,8 +351,8 @@ void MainWndController::sourceDecode(QBuffer *dataStream, QList<SourceMessage*>
351351

352352
bool MainWndController::checkSCXML()
353353
{
354-
#if QT_VERSION < QT_VERSION_CHECK(5,7,0)
355-
Utils::error(_w, tr("SCXML test is supported only starting from Qt 5.7.0"));
354+
#ifndef QXMLEDIT_QT_SCXML_ENABLED
355+
Utils::error(_w, tr("SCXML test is supported only starting from Qt 5.7.0 and must be enabled at compilie time."));
356356
return false;
357357
#else
358358
Regola *regola = _w->getRegola();

test/test.pro

+31-9
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,35 @@ isEmpty(INST_USE_C11) {
5454

5555
###########################################
5656

57+
ENABLE_SCXML="N"
58+
greaterThan(QT_MAJOR_VERSION, 4) {
59+
equals(QT_MAJOR_VERSION, 5) {
60+
greaterThan(QT_MINOR_VERSION, 6) {
61+
ENABLE_SCXML="Y"
62+
}
63+
}
64+
greaterThan(QT_MAJOR_VERSION, 5) {
65+
ENABLE_SCXML="Y"
66+
}
67+
}
68+
69+
DISABLE_SCXML=$$(QXMLEDIT_DISABLE_SCXML)
70+
!isEmpty(DISABLE_SCXML) {
71+
ENABLE_SCXML="N"
72+
}
73+
!isEmpty(QXMLEDIT_DISABLE_SCXML) {
74+
ENABLE_SCXML="N"
75+
}
76+
77+
isEqual(ENABLE_SCXML, "Y") {
78+
DEFINES += "QXMLEDIT_QT_SCXML_ENABLED"
79+
message("SCXML enabled")
80+
}
81+
82+
!isEqual(ENABLE_SCXML, "Y") {
83+
message("SCXML disabled")
84+
}
85+
##############################################3
5786

5887
# This is necessary to build the test executable as an app
5988
DEFINES += LIBQXMLEDIT_LIBRARY_STATIC
@@ -71,15 +100,8 @@ greaterThan(QT_MAJOR_VERSION, 4) {
71100
QT += printsupport widgets core
72101
}
73102

74-
greaterThan(QT_MAJOR_VERSION, 4) {
75-
equals(QT_MAJOR_VERSION, 5) {
76-
greaterThan(QT_MINOR_VERSION, 6) {
77-
QT += scxml
78-
}
79-
}
80-
greaterThan(QT_MAJOR_VERSION, 5) {
81-
QT += scxml
82-
}
103+
isEqual(ENABLE_SCXML, "Y") {
104+
QT += scxml
83105
}
84106

85107
greaterThan(QT_MAJOR_VERSION, 4) {

test/testscxml.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#include "sourcemessagemanager.h"
4949
#include "modules/messages/sourcerelatedmessages.h"
5050
#include <QListWidget>
51-
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
51+
#ifdef QXMLEDIT_QT_SCXML_ENABLED
5252
#include <QScxmlStateMachine>
5353
#include <QScxmlError>
5454
#endif
@@ -225,7 +225,7 @@ bool TestSCXML::testTemplates()
225225
bool TestSCXML::testTemplatesCompile()
226226
{
227227
_testName = "testTemplatesCompile" ;
228-
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
228+
#ifdef QXMLEDIT_QT_SCXML_ENABLED
229229
bool isError = false;
230230
QString msg;
231231
QScxmlStateMachine *testMachine = QScxmlStateMachine::fromFile(":/templates/templateSCXML");

0 commit comments

Comments
 (0)