From 4ef7357545b2baf8badf0b10d6a1932932c030bf Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 24 May 2023 02:17:38 +0200 Subject: [PATCH] rename macro to CARLA_UTILS_USE_QT, cleanup use Signed-off-by: falkTX --- source/backend/utils/CachedPlugins.cpp | 11 +---------- source/backend/utils/Information.cpp | 6 +----- source/utils/CarlaBinaryUtils.hpp | 10 +++++----- source/utils/CarlaLv2Utils.hpp | 10 +++++----- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/source/backend/utils/CachedPlugins.cpp b/source/backend/utils/CachedPlugins.cpp index 1255985d9..2533b4c34 100644 --- a/source/backend/utils/CachedPlugins.cpp +++ b/source/backend/utils/CachedPlugins.cpp @@ -36,11 +36,7 @@ # include "CarlaJsfxUtils.hpp" #endif -#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) -# include -#else -# include "water/files/File.h" -#endif +#include "water/files/File.h" namespace CB = CARLA_BACKEND_NAMESPACE; @@ -208,13 +204,8 @@ static const CarlaCachedPluginInfo* get_cached_plugin_lv2(Lv2WorldClass& lv2Worl if (char* const bundle = lilv_file_uri_parse(lilvPlugin.get_bundle_uri().as_uri(), nullptr)) { - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) - const QFileInfo fbundle(QString::fromUtf8(bundle)); - suri = (fbundle.fileName() + CARLA_OS_SEP).toUtf8().constData() + suri; - #else const water::File fbundle(bundle); suri = (fbundle.getFileName() + CARLA_OS_SEP).toRawUTF8() + suri; - #endif lilv_free(bundle); } else diff --git a/source/backend/utils/Information.cpp b/source/backend/utils/Information.cpp index c406fd66e..08192f06b 100644 --- a/source/backend/utils/Information.cpp +++ b/source/backend/utils/Information.cpp @@ -44,9 +44,7 @@ # pragma GCC diagnostic pop #endif -#if !(defined(USE_QT) || defined(BUILDING_CARLA_OBS)) -# include "water/files/File.h" -#endif +#include "water/files/File.h" // ------------------------------------------------------------------------------------------------------------------- @@ -245,7 +243,6 @@ const char* const* carla_get_supported_features() // ------------------------------------------------------------------------------------------------------------------- -#if !(defined(USE_QT) || defined(BUILDING_CARLA_OBS)) const char* carla_get_library_filename() { carla_debug("carla_get_library_filename()"); @@ -275,6 +272,5 @@ const char* carla_get_library_folder() return ret; } -#endif // ------------------------------------------------------------------------------------------------------------------- diff --git a/source/utils/CarlaBinaryUtils.hpp b/source/utils/CarlaBinaryUtils.hpp index dbbefad6e..193d6ccd3 100644 --- a/source/utils/CarlaBinaryUtils.hpp +++ b/source/utils/CarlaBinaryUtils.hpp @@ -21,7 +21,7 @@ #include "CarlaBackend.h" #include "CarlaScopeUtils.hpp" -#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) +#if defined(CARLA_UTILS_USE_QT) # include # include #else @@ -132,7 +132,7 @@ BinaryType getBinaryTypeFromFile(const char* const filename) } #endif - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) + #if defined(CARLA_UTILS_USE_QT) QFile file(QString::fromUtf8(filename)); CARLA_SAFE_ASSERT_RETURN(file.open(QIODevice::ReadOnly), BINARY_NATIVE); #else @@ -148,7 +148,7 @@ BinaryType getBinaryTypeFromFile(const char* const filename) // See https://github.com/Ardour/ardour/blob/master/libs/ardour/plugin_manager.cc#L867,L925 // Copyright (C) 2000-2006 Paul Davis - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) + #if defined(CARLA_UTILS_USE_QT) char buf[68]; if (file.read(buf, 68) != 68) #else @@ -163,14 +163,14 @@ BinaryType getBinaryTypeFromFile(const char* const filename) const int32_t* const pe_hdr_off_ptr = (int32_t*)&buf[60]; const int32_t pe_hdr_off = *pe_hdr_off_ptr; - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) + #if defined(CARLA_UTILS_USE_QT) if (! file.seek(pe_hdr_off)) #else if (! stream->setPosition(pe_hdr_off)) #endif return BINARY_NATIVE; - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) + #if defined(CARLA_UTILS_USE_QT) if (file.read(buf, 6) != 6) #else if (stream->read(buf, 6) != 6) diff --git a/source/utils/CarlaLv2Utils.hpp b/source/utils/CarlaLv2Utils.hpp index f9c4662d6..6622451e0 100644 --- a/source/utils/CarlaLv2Utils.hpp +++ b/source/utils/CarlaLv2Utils.hpp @@ -1,6 +1,6 @@ /* * Carla LV2 utils - * Copyright (C) 2011-2022 Filipe Coelho + * Copyright (C) 2011-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -83,7 +83,7 @@ #include "lv2_rdf.hpp" -#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) +#if defined(CARLA_UTILS_USE_QT) # include #else # include "water/text/StringArray.h" @@ -1822,7 +1822,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets) if (replaceNode.is_uri()) { - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) + #if defined(CARLA_UTILS_USE_QT) const QString replaceURI(replaceNode.as_uri()); if (replaceURI.startsWith("urn:")) @@ -2752,7 +2752,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets) if (presetNodes.size() > 0) { // create a list of preset URIs (for sorting and unique-ness) - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) + #if defined(CARLA_UTILS_USE_QT) QStringList presetListURIs; LILV_FOREACH(nodes, it, presetNodes) @@ -2813,7 +2813,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets) if (presetLabelNodes.size() > 0) { - #if defined(USE_QT) || defined(BUILDING_CARLA_OBS) + #if defined(CARLA_UTILS_USE_QT) const int index = presetListURIs.indexOf(QString(presetURI)); #else const int index = presetListURIs.indexOf(water::String(presetURI));