From 39fc071ed66219129b6397d1664a1330dba8a625 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 29 Jan 2018 15:59:15 +0100 Subject: [PATCH] defines GUH_* -> NYMEA_* --- libnymea-core/debugserverhandler.cpp | 2 +- .../network/upnp/upnpdiscoveryimplementation.cpp | 6 +++--- libnymea-core/httpreply.cpp | 4 ++-- libnymea-core/jsonrpc/jsonrpcserver.cpp | 4 ++-- libnymea-core/tcpserver.cpp | 2 +- libnymea-core/webserver.cpp | 4 ++-- libnymea-core/websocketserver.cpp | 2 +- libnymea/devicemanager.cpp | 6 +++--- libnymea/libguh.h | 2 +- libnymea/libnymea.pro | 6 +++--- nymea.pri | 14 +++++++------- nymea.pro | 12 ++++++------ plugins/plugins.pri | 2 +- server/guhservice.cpp | 5 +++-- server/main.cpp | 8 ++++---- tests/auto/jsonrpc/testjsonrpc.cpp | 2 +- tests/auto/versioning/testversioning.cpp | 4 ++-- tests/auto/websocketserver/testwebsocketserver.cpp | 2 +- 18 files changed, 44 insertions(+), 43 deletions(-) diff --git a/libnymea-core/debugserverhandler.cpp b/libnymea-core/debugserverhandler.cpp index af37be56..2649e14b 100644 --- a/libnymea-core/debugserverhandler.cpp +++ b/libnymea-core/debugserverhandler.cpp @@ -189,7 +189,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("tr"); //: The server version description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Server version")); - writer.writeTextElement("td", GUH_VERSION_STRING); + writer.writeTextElement("td", NYMEA_VERSION_STRING); writer.writeEndElement(); // tr writer.writeStartElement("tr"); diff --git a/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp b/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp index 4c7e80ac..790993be 100644 --- a/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp +++ b/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp @@ -163,7 +163,7 @@ void UpnpDiscoveryImplementation::respondToSearchRequest(QHostAddress host, int "EXT:\r\n" "CONTENT-LENGTH:0\r\n" "LOCATION: " + locationString.toUtf8() + "\r\n" - "SERVER: guh/" + QByteArray(GUH_VERSION_STRING) + " UPnP/1.1 \r\n" + "SERVER: guh/" + QByteArray(NYMEA_VERSION_STRING) + " UPnP/1.1 \r\n" "ST:upnp:rootdevice\r\n" "USN:uuid:" + uuid + "::urn:schemas-upnp-org:device:Basic:1\r\n" "\r\n"); @@ -381,7 +381,7 @@ void UpnpDiscoveryImplementation::sendByeByeMessage() "NT:urn:schemas-upnp-org:device:Basic:1\r\n" "USN:uuid:" + uuid + "::urn:schemas-upnp-org:device:Basic:1\r\n" "NTS: ssdp:byebye\r\n" - "SERVER: guh/" + QByteArray(GUH_VERSION_STRING) + " UPnP/1.1 \r\n" + "SERVER: guh/" + QByteArray(NYMEA_VERSION_STRING) + " UPnP/1.1 \r\n" "\r\n"); sendToMulticast(byebyeMessage); @@ -427,7 +427,7 @@ void UpnpDiscoveryImplementation::sendAliveMessage() "NT:urn:schemas-upnp-org:device:Basic:1\r\n" "USN:uuid:" + uuid + "::urn:schemas-upnp-org:device:Basic:1\r\n" "NTS: ssdp:alive\r\n" - "SERVER: guh/" + QByteArray(GUH_VERSION_STRING) + " UPnP/1.1 \r\n" + "SERVER: guh/" + QByteArray(NYMEA_VERSION_STRING) + " UPnP/1.1 \r\n" "\r\n"); sendToMulticast(aliveMessage); diff --git a/libnymea-core/httpreply.cpp b/libnymea-core/httpreply.cpp index 2b412e4b..6ab38153 100644 --- a/libnymea-core/httpreply.cpp +++ b/libnymea-core/httpreply.cpp @@ -156,7 +156,7 @@ HttpReply::HttpReply(QObject *parent) : // set known headers setHeader(HttpReply::ContentTypeHeader, "text/plain; charset=\"utf-8\";"); - setHeader(HttpHeaderType::ServerHeader, "guh/" + QByteArray(GUH_VERSION_STRING)); + setHeader(HttpHeaderType::ServerHeader, "guh/" + QByteArray(NYMEA_VERSION_STRING)); setHeader(HttpHeaderType::DateHeader, GuhCore::instance()->timeManager()->currentDateTime().toString("ddd, dd MMM yyyy hh:mm:ss").toUtf8()); setHeader(HttpHeaderType::CacheControlHeader, "no-cache"); setHeader(HttpHeaderType::ConnectionHeader, "Keep-Alive"); @@ -179,7 +179,7 @@ HttpReply::HttpReply(const HttpReply::HttpStatusCode &statusCode, const HttpRepl // set known / default headers setHeader(HttpReply::ContentTypeHeader, "text/plain; charset=\"utf-8\";"); - setHeader(HttpHeaderType::ServerHeader, "guh/" + QByteArray(GUH_VERSION_STRING)); + setHeader(HttpHeaderType::ServerHeader, "guh/" + QByteArray(NYMEA_VERSION_STRING)); setHeader(HttpHeaderType::DateHeader, GuhCore::instance()->timeManager()->currentDateTime().toString("ddd, dd MMM yyyy hh:mm:ss").toUtf8()); setHeader(HttpHeaderType::CacheControlHeader, "no-cache"); setHeader(HttpHeaderType::ConnectionHeader, "Keep-Alive"); diff --git a/libnymea-core/jsonrpc/jsonrpcserver.cpp b/libnymea-core/jsonrpc/jsonrpcserver.cpp index 002a3f79..1571c86e 100644 --- a/libnymea-core/jsonrpc/jsonrpcserver.cpp +++ b/libnymea-core/jsonrpc/jsonrpcserver.cpp @@ -243,7 +243,7 @@ JsonReply* JsonRPCServer::Version(const QVariantMap ¶ms) const Q_UNUSED(params) QVariantMap data; - data.insert("version", GUH_VERSION_STRING); + data.insert("version", NYMEA_VERSION_STRING); data.insert("protocol version", JSON_PROTOCOL_VERSION); return createReply(data); } @@ -432,7 +432,7 @@ QVariantMap JsonRPCServer::createWelcomeMessage(TransportInterface *interface) c handshake.insert("id", 0); handshake.insert("server", "guhIO"); handshake.insert("name", GuhCore::instance()->configuration()->serverName()); - handshake.insert("version", GUH_VERSION_STRING); + handshake.insert("version", NYMEA_VERSION_STRING); handshake.insert("uuid", GuhCore::instance()->configuration()->serverUuid().toString()); handshake.insert("language", GuhCore::instance()->configuration()->locale().name()); handshake.insert("protocol version", JSON_PROTOCOL_VERSION); diff --git a/libnymea-core/tcpserver.cpp b/libnymea-core/tcpserver.cpp index 1c1eb5e9..0e95cb7b 100644 --- a/libnymea-core/tcpserver.cpp +++ b/libnymea-core/tcpserver.cpp @@ -134,7 +134,7 @@ void TcpServer::resetAvahiService() // Note: reversed order QHash txt; txt.insert("jsonrpcVersion", JSON_PROTOCOL_VERSION); - txt.insert("serverVersion", GUH_VERSION_STRING); + txt.insert("serverVersion", NYMEA_VERSION_STRING); txt.insert("manufacturer", "guh GmbH"); txt.insert("uuid", GuhCore::instance()->configuration()->serverUuid().toString()); txt.insert("name", GuhCore::instance()->configuration()->serverName()); diff --git a/libnymea-core/webserver.cpp b/libnymea-core/webserver.cpp index 164e46e1..3edba430 100644 --- a/libnymea-core/webserver.cpp +++ b/libnymea-core/webserver.cpp @@ -529,7 +529,7 @@ void WebServer::resetAvahiService() // Note: reversed order QHash txt; txt.insert("jsonrpcVersion", JSON_PROTOCOL_VERSION); - txt.insert("serverVersion", GUH_VERSION_STRING); + txt.insert("serverVersion", NYMEA_VERSION_STRING); txt.insert("manufacturer", "guh GmbH"); txt.insert("uuid", GuhCore::instance()->configuration()->serverUuid().toString()); txt.insert("name", GuhCore::instance()->configuration()->serverName()); @@ -667,7 +667,7 @@ QByteArray WebServer::createServerXmlDocument(QHostAddress address) writer.writeTextElement("manufacturerURL", "http://guh.io"); writer.writeTextElement("modelDescription", "IoT server"); writer.writeTextElement("modelName", "nymead"); - writer.writeTextElement("modelNumber", GUH_VERSION_STRING); + writer.writeTextElement("modelNumber", NYMEA_VERSION_STRING); writer.writeTextElement("modelURL", "http://guh.io"); // (optional) writer.writeTextElement("UDN", "uuid:" + uuid); diff --git a/libnymea-core/websocketserver.cpp b/libnymea-core/websocketserver.cpp index 782a9940..169258f5 100644 --- a/libnymea-core/websocketserver.cpp +++ b/libnymea-core/websocketserver.cpp @@ -114,7 +114,7 @@ QHash WebSocketServer::createTxtRecord() // Note: reversed order QHash txt; txt.insert("jsonrpcVersion", JSON_PROTOCOL_VERSION); - txt.insert("serverVersion", GUH_VERSION_STRING); + txt.insert("serverVersion", NYMEA_VERSION_STRING); txt.insert("manufacturer", "guh GmbH"); txt.insert("uuid", GuhCore::instance()->configuration()->serverUuid().toString()); txt.insert("name", GuhCore::instance()->configuration()->serverName()); diff --git a/libnymea/devicemanager.cpp b/libnymea/devicemanager.cpp index 1516714b..1794a9bd 100644 --- a/libnymea/devicemanager.cpp +++ b/libnymea/devicemanager.cpp @@ -221,17 +221,17 @@ DeviceManager::~DeviceManager() QStringList DeviceManager::pluginSearchDirs() { QStringList searchDirs; - QByteArray envPath = qgetenv("GUH_PLUGINS_PATH"); + QByteArray envPath = qgetenv("NYMEA_PLUGINS_PATH"); if (!envPath.isEmpty()) { searchDirs << QString(envPath).split(':'); } searchDirs << QCoreApplication::applicationDirPath() + "/../lib/guh/plugins"; searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/"; searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/"; - searchDirs << QString("%1").arg(GUH_PLUGINS_PATH); + searchDirs << QString("%1").arg(NYMEA_PLUGINS_PATH); QString snapDir = QString::fromUtf8(qgetenv("SNAP")); if (!snapDir.isEmpty()) { - searchDirs << QString("%1%2").arg(snapDir).arg(GUH_PLUGINS_PATH); + searchDirs << QString("%1%2").arg(snapDir).arg(NYMEA_PLUGINS_PATH); } return searchDirs; } diff --git a/libnymea/libguh.h b/libnymea/libguh.h index 14ff33f1..a782d313 100644 --- a/libnymea/libguh.h +++ b/libnymea/libguh.h @@ -25,7 +25,7 @@ #include -#if defined(LIBGUH_LIBRARY) +#if defined(LIBNYMEA_LIBRARY) # define LIBGUH_EXPORT Q_DECL_EXPORT #else # define LIBGUH_EXPORT Q_DECL_IMPORT diff --git a/libnymea/libnymea.pro b/libnymea/libnymea.pro index b92c9615..c30cc215 100644 --- a/libnymea/libnymea.pro +++ b/libnymea/libnymea.pro @@ -4,7 +4,7 @@ TARGET = nymea TEMPLATE = lib QT += network bluetooth -DEFINES += LIBGUH_LIBRARY +DEFINES += LIBNYMEA_LIBRARY QMAKE_LFLAGS += -fPIC @@ -128,7 +128,7 @@ SOURCES += devicemanager.cpp \ plugintimer.cpp \ hardwaremanager.cpp \ -# install plugininfo python script for libguh-dev +# install plugininfo python script for libnymea-dev generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo generateplugininfo.path = /usr/bin @@ -136,7 +136,7 @@ INSTALLS += generateplugininfo # install header file with relative subdirectory for(header, HEADERS) { - path = /usr/include/guh/$${dirname(header)} + path = /usr/include/nymea/$${dirname(header)} eval(headers_$${path}.files += $${header}) eval(headers_$${path}.path = $${path}) eval(INSTALLS *= headers_$${path}) diff --git a/nymea.pri b/nymea.pri index e259e8e4..7962f9e5 100644 --- a/nymea.pri +++ b/nymea.pri @@ -1,18 +1,18 @@ -# Parse and export GUH_VERSION_STRING -GUH_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') +# Parse and export NYMEA_VERSION_STRING +NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') # Install path for plugins -GUH_PLUGINS_PATH=/usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')/guh/plugins/ +NYMEA_PLUGINS_PATH=/usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')/nymea/plugins/ # define protocol versions JSON_PROTOCOL_VERSION_MAJOR=1 JSON_PROTOCOL_VERSION_MINOR=2 REST_API_VERSION=1 -DEFINES += GUH_VERSION_STRING=\\\"$${GUH_VERSION_STRING}\\\" \ +DEFINES += NYMEA_VERSION_STRING=\\\"$${NYMEA_VERSION_STRING}\\\" \ JSON_PROTOCOL_VERSION=\\\"$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}\\\" \ REST_API_VERSION=\\\"$${REST_API_VERSION}\\\" \ - GUH_PLUGINS_PATH=\\\"$${GUH_PLUGINS_PATH}\\\" + NYMEA_PLUGINS_PATH=\\\"$${NYMEA_PLUGINS_PATH}\\\" QT *= network websockets bluetooth dbus @@ -62,9 +62,9 @@ coverage { generate-coverage-html.commands = \ "@echo Collecting coverage data"; \ "lcov --directory $${top_srcdir} --capture --output-file coverage.info --no-checksum --compat-libtool"; \ - "lcov --extract coverage.info \"*/server/*.cpp\" --extract coverage.info \"*/libguh-core/*.cpp\" --extract coverage.info \"*/libguh/*.cpp\" -o coverage.info"; \ + "lcov --extract coverage.info \"*/server/*.cpp\" --extract coverage.info \"*/libnymea-core/*.cpp\" --extract coverage.info \"*/libnymea/*.cpp\" -o coverage.info"; \ "lcov --remove coverage.info \"moc_*.cpp\" --remove coverage.info \"*/test/*\" -o coverage.info"; \ - "LANG=C genhtml --prefix $${top_srcdir} --output-directory coverage-html --title \"guh coverage\" --legend --show-details coverage.info" + "LANG=C genhtml --prefix $${top_srcdir} --output-directory coverage-html --title \"nymea coverage\" --legend --show-details coverage.info" clean-coverage-html.depends = clean-gcda clean-coverage-html.commands = \ diff --git a/nymea.pro b/nymea.pro index 454d68c9..295145f6 100644 --- a/nymea.pro +++ b/nymea.pro @@ -33,20 +33,20 @@ lrelease.commands = lrelease $$_FILE_; \ rsync -a $$top_srcdir/translations/*.qm $$top_builddir/translations/; # Install translation files -translations.path = /usr/share/guh/translations +translations.path = /usr/share/nymea/translations translations.files = $$[QT_SOURCE_TREE]/translations/*.qm translations.depends = lrelease INSTALLS += translations QMAKE_EXTRA_TARGETS += licensecheck doc test lupdate lrelease -# Inform about guh build +# Inform about nymea build message(============================================) message("Qt version:" $$[QT_VERSION]) -message("Building guh version $${GUH_VERSION_STRING}") +message("Building nymea version $${NYMEA_VERSION_STRING}") message("JSON-RPC API version $${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}") message("REST API version $${REST_API_VERSION}") -message("Plugin path $${GUH_PLUGINS_PATH}") +message("Plugin path $${NYMEA_PLUGINS_PATH}") message("Source directory: $${top_srcdir}") message("Build directory: $${top_builddir}") @@ -69,8 +69,8 @@ ccache { # Build tests disabletesting { - message("Building guh without tests") + message("Building nymea without tests") } else { - message("Building guh with tests") + message("Building nymea with tests") SUBDIRS += tests } diff --git a/plugins/plugins.pri b/plugins/plugins.pri index b615e5b6..407471f9 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -34,5 +34,5 @@ PRE_TARGETDEPS += compiler_plugininfo_make_all compiler_externplugininfo_make_al QMAKE_EXTRA_COMPILERS += plugininfo externplugininfo # Install plugin -target.path = $$GUH_PLUGINS_PATH +target.path = $$NYMEA_PLUGINS_PATH INSTALLS += target diff --git a/server/guhservice.cpp b/server/guhservice.cpp index 55b1076c..3c53c3f0 100644 --- a/server/guhservice.cpp +++ b/server/guhservice.cpp @@ -49,7 +49,7 @@ GuhService::GuhService(int argc, char **argv): { application()->setOrganizationName("guh"); application()->setApplicationName("nymead"); - application()->setApplicationVersion(GUH_VERSION_STRING); + application()->setApplicationVersion(NYMEA_VERSION_STRING); close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); @@ -71,7 +71,8 @@ void GuhService::start() exit(EXIT_FAILURE); } qCDebug(dcApplication) << "====================================="; - qCDebug(dcApplication) << "nymead" << GUH_VERSION_STRING << "started as daemon."; + + qCDebug(dcApplication) << "nymead" << NYMEA_VERSION_STRING << "started as daemon."; qCDebug(dcApplication) << "====================================="; GuhCore::instance(); } diff --git a/server/main.cpp b/server/main.cpp index 97d97824..117c3962 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) GuhApplication application(argc, argv); application.setOrganizationName("guh"); application.setApplicationName("nymead"); - application.setApplicationVersion(GUH_VERSION_STRING); + application.setApplicationVersion(NYMEA_VERSION_STRING); // logging filers for core and libnymea s_loggingFilters.insert("Application", true); @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) applicationDescription.append(QString("nymead %1 %2 2014-2018 guh GmbH\n" "Released under the GNU GENERAL PUBLIC LICENSE Version 2.\n\n" - "API version: %3\n").arg(GUH_VERSION_STRING).arg(QChar(0xA9)).arg(JSON_PROTOCOL_VERSION)); + "API version: %3\n").arg(NYMEA_VERSION_STRING).arg(QChar(0xA9)).arg(JSON_PROTOCOL_VERSION)); parser.setApplicationDescription(applicationDescription); @@ -257,11 +257,11 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } qCDebug(dcApplication) << "====================================="; - qCDebug(dcApplication) << "nymead" << GUH_VERSION_STRING << "started with user ID" << userId; + qCDebug(dcApplication) << "nymead" << NYMEA_VERSION_STRING << "started with user ID" << userId; qCDebug(dcApplication) << "====================================="; } else { qCDebug(dcApplication) << "====================================="; - qCDebug(dcApplication) << "nymead" << GUH_VERSION_STRING << "started as root."; + qCDebug(dcApplication) << "nymead" << NYMEA_VERSION_STRING << "started as root."; qCDebug(dcApplication) << "====================================="; } diff --git a/tests/auto/jsonrpc/testjsonrpc.cpp b/tests/auto/jsonrpc/testjsonrpc.cpp index eecdefc1..21b52aff 100644 --- a/tests/auto/jsonrpc/testjsonrpc.cpp +++ b/tests/auto/jsonrpc/testjsonrpc.cpp @@ -140,7 +140,7 @@ void TestJSONRPC::testHandshake() QJsonDocument jsonDoc = QJsonDocument::fromJson(spy.first().at(1).toByteArray()); QVariantMap handShake = jsonDoc.toVariant().toMap(); - QString guhVersionString(GUH_VERSION_STRING); + QString guhVersionString(NYMEA_VERSION_STRING); QVERIFY2(handShake.value("version").toString() == guhVersionString, "Handshake version doesn't match Guh version."); // Check whether pushButtonAuth is disabled diff --git a/tests/auto/versioning/testversioning.cpp b/tests/auto/versioning/testversioning.cpp index 4361c93a..6fe2633b 100644 --- a/tests/auto/versioning/testversioning.cpp +++ b/tests/auto/versioning/testversioning.cpp @@ -48,10 +48,10 @@ void TestVersioning::version() QString version = response.toMap().value("params").toMap().value("version").toString(); QVariant protocolVersion = response.toMap().value("params").toMap().value("protocol version"); - qDebug() << "Got version:" << version << "( Expected:" << GUH_VERSION_STRING << ")"; + qDebug() << "Got version:" << version << "( Expected:" << NYMEA_VERSION_STRING << ")"; QVERIFY2(!version.isEmpty(), "Version is empty."); - QCOMPARE(version, QString(GUH_VERSION_STRING)); + QCOMPARE(version, QString(NYMEA_VERSION_STRING)); QVERIFY2(!protocolVersion.toString().isEmpty(), "Protocol version is empty."); QVERIFY2(protocolVersion.canConvert(QVariant::Int), "Protocol version is not an integer."); diff --git a/tests/auto/websocketserver/testwebsocketserver.cpp b/tests/auto/websocketserver/testwebsocketserver.cpp index ecdcfc86..7f720ddc 100644 --- a/tests/auto/websocketserver/testwebsocketserver.cpp +++ b/tests/auto/websocketserver/testwebsocketserver.cpp @@ -98,7 +98,7 @@ void TestWebSocketServer::testHandshake() QJsonDocument jsonDoc = QJsonDocument::fromJson(spy.first().first().toByteArray()); QVariantMap handShake = jsonDoc.toVariant().toMap(); - QString guhVersionString(GUH_VERSION_STRING); + QString guhVersionString(NYMEA_VERSION_STRING); QString jsonProtocolVersionString(JSON_PROTOCOL_VERSION); QCOMPARE(handShake.value("version").toString(), guhVersionString); QCOMPARE(handShake.value("protocol version").toString(), jsonProtocolVersionString);