rename macro to CARLA_UTILS_USE_QT, cleanup use

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2023-05-24 02:17:38 +02:00
parent d1234e591f
commit 4ef7357545
No known key found for this signature in database
GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 12 additions and 25 deletions

View File

@ -36,11 +36,7 @@
# include "CarlaJsfxUtils.hpp" # include "CarlaJsfxUtils.hpp"
#endif #endif
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #include "water/files/File.h"
# include <QtCore/QFileInfo>
#else
# include "water/files/File.h"
#endif
namespace CB = CARLA_BACKEND_NAMESPACE; 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 (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); const water::File fbundle(bundle);
suri = (fbundle.getFileName() + CARLA_OS_SEP).toRawUTF8() + suri; suri = (fbundle.getFileName() + CARLA_OS_SEP).toRawUTF8() + suri;
#endif
lilv_free(bundle); lilv_free(bundle);
} }
else else

View File

@ -44,9 +44,7 @@
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif
#if !(defined(USE_QT) || defined(BUILDING_CARLA_OBS)) #include "water/files/File.h"
# include "water/files/File.h"
#endif
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
@ -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() const char* carla_get_library_filename()
{ {
carla_debug("carla_get_library_filename()"); carla_debug("carla_get_library_filename()");
@ -275,6 +272,5 @@ const char* carla_get_library_folder()
return ret; return ret;
} }
#endif
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------

View File

@ -21,7 +21,7 @@
#include "CarlaBackend.h" #include "CarlaBackend.h"
#include "CarlaScopeUtils.hpp" #include "CarlaScopeUtils.hpp"
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #if defined(CARLA_UTILS_USE_QT)
# include <QtCore/QFile> # include <QtCore/QFile>
# include <QtCore/QString> # include <QtCore/QString>
#else #else
@ -132,7 +132,7 @@ BinaryType getBinaryTypeFromFile(const char* const filename)
} }
#endif #endif
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #if defined(CARLA_UTILS_USE_QT)
QFile file(QString::fromUtf8(filename)); QFile file(QString::fromUtf8(filename));
CARLA_SAFE_ASSERT_RETURN(file.open(QIODevice::ReadOnly), BINARY_NATIVE); CARLA_SAFE_ASSERT_RETURN(file.open(QIODevice::ReadOnly), BINARY_NATIVE);
#else #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 // See https://github.com/Ardour/ardour/blob/master/libs/ardour/plugin_manager.cc#L867,L925
// Copyright (C) 2000-2006 Paul Davis // Copyright (C) 2000-2006 Paul Davis
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #if defined(CARLA_UTILS_USE_QT)
char buf[68]; char buf[68];
if (file.read(buf, 68) != 68) if (file.read(buf, 68) != 68)
#else #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* const pe_hdr_off_ptr = (int32_t*)&buf[60];
const int32_t pe_hdr_off = *pe_hdr_off_ptr; 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)) if (! file.seek(pe_hdr_off))
#else #else
if (! stream->setPosition(pe_hdr_off)) if (! stream->setPosition(pe_hdr_off))
#endif #endif
return BINARY_NATIVE; return BINARY_NATIVE;
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #if defined(CARLA_UTILS_USE_QT)
if (file.read(buf, 6) != 6) if (file.read(buf, 6) != 6)
#else #else
if (stream->read(buf, 6) != 6) if (stream->read(buf, 6) != 6)

View File

@ -1,6 +1,6 @@
/* /*
* Carla LV2 utils * Carla LV2 utils
* Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com> * Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@ -83,7 +83,7 @@
#include "lv2_rdf.hpp" #include "lv2_rdf.hpp"
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #if defined(CARLA_UTILS_USE_QT)
# include <QtCore/QStringList> # include <QtCore/QStringList>
#else #else
# include "water/text/StringArray.h" # 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 (replaceNode.is_uri())
{ {
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #if defined(CARLA_UTILS_USE_QT)
const QString replaceURI(replaceNode.as_uri()); const QString replaceURI(replaceNode.as_uri());
if (replaceURI.startsWith("urn:")) 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) if (presetNodes.size() > 0)
{ {
// create a list of preset URIs (for sorting and unique-ness) // 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; QStringList presetListURIs;
LILV_FOREACH(nodes, it, presetNodes) 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 (presetLabelNodes.size() > 0)
{ {
#if defined(USE_QT) || defined(BUILDING_CARLA_OBS) #if defined(CARLA_UTILS_USE_QT)
const int index = presetListURIs.indexOf(QString(presetURI)); const int index = presetListURIs.indexOf(QString(presetURI));
#else #else
const int index = presetListURIs.indexOf(water::String(presetURI)); const int index = presetListURIs.indexOf(water::String(presetURI));