Skip to content

Commit

Permalink
Add stricter definitions in order to be included in other projects as…
Browse files Browse the repository at this point in the history
… submodule
  • Loading branch information
dantti authored and Allen Winter committed Jan 3, 2024
1 parent 2f876ae commit 685b397
Show file tree
Hide file tree
Showing 45 changed files with 305 additions and 302 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- windows-2022
- macos-12
- ubuntu-latest
- windows-latest
- macos-latest
build_type:
- Debug
- Release
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# general
build*/
*.kdev4
*~
*.rej
Expand Down
31 changes: 18 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ project(
DESCRIPTION "A framework for creating Qt State Machine metacode using a graphical user interface"
HOMEPAGE_URL "https://github.com/KDAB/KDStateMachineEditor"
LANGUAGES CXX C
VERSION 1.99.50
)

add_definitions(
-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_FROM_ASCII
-DQT_STRICT_ITERATORS
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_USE_QSTRINGBUILDER
-DQT_USE_FAST_OPERATOR_PLUS
)

set(KDSME_VERSION_MAJOR "1")
set(KDSME_VERSION_MINOR "99")
set(KDSME_VERSION_PATCH "50")
set(KDSME_VERSION ${KDSME_VERSION_MAJOR}.${KDSME_VERSION_MINOR}.${KDSME_VERSION_PATCH})
set(PROJECT_VERSION ${KDSME_VERSION}) #PROJECT_VERSION is needed by some ECM modules
set(${PROJECT_NAME}_SOVERSION ${KDSME_VERSION_MAJOR})
set(KDSME_SOVERSION "2") #means the 2.x ABI is frozen. ABI changes will must go to version 3

include(FeatureSummary)
Expand Down Expand Up @@ -395,7 +400,7 @@ endif()
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(${PROJECT_NAME}_IS_ROOT_PROJECT TRUE)

message(STATUS "Building ${PROJECT_NAME} ${KDSME_VERSION} in ${CMAKE_BUILD_TYPE} mode. "
message(STATUS "Building ${PROJECT_NAME} ${PROJECT_VERSION} in ${CMAKE_BUILD_TYPE} mode. "
"Installing to ${CMAKE_INSTALL_PREFIX}"
)
else()
Expand Down Expand Up @@ -428,7 +433,7 @@ set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/${CONFIG_DIR})
# Generate library version files
include(ECMSetupVersion)
ecm_setup_version(
${KDSME_VERSION}
${PROJECT_VERSION}
VARIABLE_PREFIX
KDSME
VERSION_HEADER
Expand Down Expand Up @@ -465,16 +470,16 @@ if(${PROJECT_NAME}_IS_ROOT_PROJECT)
set(README_FILE "README.md")

#CPACK
set(CPACK_PACKAGE_VERSION_MAJOR "${KDSME_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${KDSME_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${KDSME_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${KDSME_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_VENDOR "KDAB")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/${README_FILE}")
if(WIN32)
set(CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "KDStateMachineEditor")
set(CPACK_PACKAGE_FILE_NAME "KDStateMachineEditor-${KDSME_VERSION}")
set(CPACK_PACKAGE_FILE_NAME "KDStateMachineEditor-${PROJECT_VERSION}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSES/${LICENSE_FILE}")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY "${BIN_INSTALL_DIR}")
set(CPACK_NSIS_URL_INFO_ABOUT "https://www.kdab.com/")
Expand Down
6 changes: 3 additions & 3 deletions docs/api/Doxyfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "KDStateMachineEditor API Documentation"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = @KDSME_VERSION_MAJOR@.@KDSME_VERSION_MINOR@
PROJECT_NUMBER = @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down Expand Up @@ -1413,7 +1413,7 @@ QCH_FILE = "@DOXYGEN_OUTPUT_DIR@/qch/kdstatemachineeditor-api.qch"
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.

QHP_NAMESPACE = com.kdab.KDStateMachineEditor.api.@KDSME_VERSION@
QHP_NAMESPACE = com.kdab.KDStateMachineEditor.api.@PROJECT_VERSION@

# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
Expand All @@ -1422,7 +1422,7 @@ QHP_NAMESPACE = com.kdab.KDStateMachineEditor.api.@KDSME_VERSION@
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.

QHP_VIRTUAL_FOLDER = KDStateMachineEditor-@KDSME_VERSION@
QHP_VIRTUAL_FOLDER = KDStateMachineEditor-@PROJECT_VERSION@

# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
Expand Down
6 changes: 3 additions & 3 deletions examples/export/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ int main()

//! [Construct the state machine]
StateMachine machine;
machine.setLabel("root");
machine.setLabel(QStringLiteral("root"));
State s1(&machine);
s1.setLabel("s1");
s1.setLabel(QStringLiteral("s1"));
State s2(&machine);
s2.setLabel("s2");
s2.setLabel(QStringLiteral("s2"));
s1.addSignalTransition(&s2);
//! [Construct the state machine]

Expand Down
2 changes: 1 addition & 1 deletion examples/layoutexport/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main()
QTextStream qErr(stderr);
QTextStream qOut(stdout);

const QString fileName = TEST_DATA_DIR "/scxml/trafficlight_alternative.scxml";
const QString fileName = QStringLiteral(TEST_DATA_DIR) + u"/scxml/trafficlight_alternative.scxml";
QFile file(fileName);
if (!file.exists()) {
qErr << "File does not exist:" << file.fileName();
Expand Down
2 changes: 1 addition & 1 deletion examples/qscxmldebugger/trafficlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ TrafficLight::TrafficLight(QScxmlStateMachine *machine, QWidget *parent)

void TrafficLight::toggleWorking(bool pause)
{
m_machine->submitEvent(pause ? "smash" : "repair");
m_machine->submitEvent(pause ? QStringLiteral("smash") : QStringLiteral("repair"));
}

LightWidget::LightWidget(const QString &image, QWidget *parent)
Expand Down
8 changes: 4 additions & 4 deletions examples/qsmdebugger/trafficlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ TrafficLight::TrafficLight(QWidget *parent)

QStateMachine *machine = new QStateMachine(this);
QState *redGoingYellow = createLightState(widget->redLight(), 3000);
redGoingYellow->setObjectName("redGoingYellow");
redGoingYellow->setObjectName(QStringLiteral("redGoingYellow"));
QState *yellowGoingGreen = createLightState(widget->yellowLight(), 1000);
yellowGoingGreen->setObjectName("yellowGoingGreen");
yellowGoingGreen->setObjectName(QStringLiteral("yellowGoingGreen"));
redGoingYellow->addTransition(redGoingYellow, SIGNAL(finished()), yellowGoingGreen);
QState *greenGoingYellow = createLightState(widget->greenLight(), 3000);
greenGoingYellow->setObjectName("greenGoingYellow");
greenGoingYellow->setObjectName(QStringLiteral("greenGoingYellow"));
yellowGoingGreen->addTransition(yellowGoingGreen, SIGNAL(finished()), greenGoingYellow);
QState *yellowGoingRed = createLightState(widget->yellowLight(), 1000);
yellowGoingRed->setObjectName("yellowGoingRed");
yellowGoingRed->setObjectName(QStringLiteral("yellowGoingRed"));
greenGoingYellow->addTransition(greenGoingYellow, SIGNAL(finished()), yellowGoingRed);
yellowGoingRed->addTransition(yellowGoingRed, SIGNAL(finished()), redGoingYellow);

Expand Down
2 changes: 1 addition & 1 deletion examples/scxmlimport/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main(int argc, char **argv)
{
QApplication app(argc, argv);

const QString fileName = TEST_DATA_DIR "/scxml/microwave.scxml";
const QString fileName = QStringLiteral(TEST_DATA_DIR "/scxml/microwave.scxml");
QFile file(fileName);
if (!file.exists()) {
qWarning() << "File does not exist:" << file.fileName();
Expand Down
4 changes: 2 additions & 2 deletions examples/simplestatemachine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ int main(int argc, char **argv)
//! [Display the state machine]
StateMachine machine;
State s1(&machine);
s1.setLabel("s1");
s1.setLabel(QStringLiteral("s1"));
State s2(&machine);
s2.setLabel("s2");
s2.setLabel(QStringLiteral("s2"));
s1.addSignalTransition(&s2);

StateMachineView view;
Expand Down
14 changes: 7 additions & 7 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace {

QString presetsLocation()
{
const QString presetsLocation = qgetenv("KDSME_PRESETS_LOCATION");
const QString presetsLocation = qEnvironmentVariable("KDSME_PRESETS_LOCATION");
if (!presetsLocation.isEmpty()) {
return presetsLocation;
}
Expand All @@ -40,7 +40,7 @@ QString presetsLocation()

QString scxmlPresetsLocation()
{
return presetsLocation() + "/scxml";
return presetsLocation() + u"/scxml";
}

}
Expand All @@ -51,15 +51,15 @@ int main(int argc, char **argv)
QQmlDebuggingEnabler enabler;

QApplication app(argc, argv);
app.setOrganizationName("KDAB");
app.setApplicationName("kdsme");
app.setApplicationVersion("0.1");
app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("kdsme"));
app.setApplicationVersion(QStringLiteral("0.1"));

QCommandLineParser parser;
parser.setApplicationDescription("State Machine Editor");
parser.setApplicationDescription(QStringLiteral("State Machine Editor"));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("source", QCoreApplication::translate("main", "SCXML file"));
parser.addPositionalArgument(QStringLiteral("source"), QCoreApplication::translate("main", "SCXML file"));
parser.process(app);
const QStringList args = parser.positionalArguments();
const QString source = args.value(0);
Expand Down
Loading

0 comments on commit 685b397

Please sign in to comment.