Skip to content

Commit

Permalink
Remove Qt4 stuff from 2.6 branch (#960)
Browse files Browse the repository at this point in the history
* Update libs/OpenFX to latest version.
* Remove Qt4 and unused MinGW packages.
* Remove Qt4 wrappers and Qt4 references in build files.
* Remove QtCompat::toLocalFileUrlFixed() since it was only for Qt4.
* Remove Qt4 code in Global/ and Engine/
* Remove Qt4 code in Gui/ and Tests/
  • Loading branch information
acolwell authored Apr 1, 2024
1 parent 7b07bc0 commit 6e28f2a
Show file tree
Hide file tree
Showing 292 changed files with 84 additions and 51,475 deletions.
3 changes: 1 addition & 2 deletions App/App.pro
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ CONFIG += moc
CONFIG += boost boost-serialization-lib opengl qt cairo python shiboken pyside
CONFIG += static-gui static-engine static-host-support static-breakpadclient static-libmv static-openmvg static-ceres static-qhttpserver static-libtess

QT += gui core opengl network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets concurrent
QT += gui core opengl network widgets concurrent

!noexpat: CONFIG += expat

Expand Down
3 changes: 1 addition & 2 deletions CrashReporter/CrashReporter.pro
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ win32 {

CONFIG += moc
CONFIG += qt
QT += core network gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += core network gui opengl widgets
CONFIG += static-breakpadclient

include(../global.pri)
Expand Down
27 changes: 0 additions & 27 deletions Engine/AppManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@

#include "AppManagerPrivate.h" // include breakpad after Engine, because it includes /usr/include/AssertMacros.h on OS X which defines a check(x) macro, which conflicts with boost

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Q_DECLARE_METATYPE(QAbstractSocket::SocketState)
#endif

NATRON_NAMESPACE_ENTER

AppManager* AppManager::_instance = 0;
Expand Down Expand Up @@ -326,14 +322,6 @@ AppManager::loadFromArgs(const CLArgs& cl)
#endif
#endif

// Ensure Qt knows C-strings are UTF-8 before creating the QApplication for argv
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// be forward compatible: source code is UTF-8, and Qt5 assumes UTF-8 by default
QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF-8") );
QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8") );
#endif


// This needs to be done BEFORE creating qApp because
// on Linux, X11 will create a context that would corrupt
// the XUniqueContext created by Qt
Expand Down Expand Up @@ -2036,18 +2024,10 @@ AppManager::registerPlugin(const QString& resourcesPath,
int minor,
bool isDeprecated)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QRecursiveMutex* pluginMutex = nullptr;
#else
QMutex* pluginMutex = 0;
#endif

if (mustCreateMutex) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
pluginMutex = new QRecursiveMutex();
#else
pluginMutex = new QMutex(QMutex::Recursive);
#endif
}
Plugin* plugin = new Plugin(binary, resourcesPath, pluginID, pluginLabel, pluginIconPath, groupIconPath, groups, pluginMutex, major, minor,
isReader, isWriter, isDeprecated);
Expand Down Expand Up @@ -2529,9 +2509,6 @@ AppManager::registerEngineMetaTypes() const
qRegisterMetaType<ViewSpec>("ViewSpec");
qRegisterMetaType<NodePtr>("NodePtr");
qRegisterMetaType<std::list<double> >("std::list<double>");
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
qRegisterMetaType<QAbstractSocket::SocketState>("SocketState");
#endif
}

void
Expand Down Expand Up @@ -3035,11 +3012,7 @@ AppManager::initPython()
}
// Set QT_API for QtPy
// https://github.com/spyder-ide/qtpy
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
qputenv("QT_API", "pyside");
#else
qputenv("QT_API", "pyside2");
#endif
} // AppManager::initPython

void
Expand Down
9 changes: 2 additions & 7 deletions Engine/AppManagerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,8 @@ AppManagerPrivate::AppManagerPrivate()

runningThreadsCount = 0;

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && defined(__NATRON_LINUX__)
#if defined(__NATRON_LINUX__)
onWayland = qEnvironmentVariableIsSet("WAYLAND_DISPLAY") && !qEnvironmentVariableIsSet("NATRON_DISABLE_WAYLAND");
#else
onWayland = false;
#endif
}

Expand Down Expand Up @@ -607,13 +605,10 @@ AppManagerPrivate::cleanUpCacheDiskStructure(const QString & cachePath, bool isT

QDir cacheFolder(cachePath);

# if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QtCompat::removeRecursively(cachePath);
# else
if ( cacheFolder.exists() ) {
cacheFolder.removeRecursively();
}
#endif

if ( !cacheFolder.exists() ) {
bool success = cacheFolder.mkpath( QChar::fromLatin1('.') );
if (!success) {
Expand Down
3 changes: 0 additions & 3 deletions Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ if(UNIX AND NOT APPLE)
endif()
endif()

if(APPLE)
list(APPEND NatronEngine_SOURCES QUrlFix.mm)
endif()

list(APPEND NatronEngine_SOURCES
${NatronEngine_SOURCES}
Expand Down
15 changes: 1 addition & 14 deletions Engine/CurvePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
#include "Global/Macros.h"

#include <QtCore/QMutex>
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
#include <QtCore/QRecursiveMutex>
#endif

#include "Engine/Variant.h"
#include "Engine/Knob.h"
Expand Down Expand Up @@ -66,11 +64,8 @@ struct CurvePrivate
CurveTypeEnum type;
double xMin, xMax;
double yMin, yMax;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
mutable QRecursiveMutex _lock;
#else
mutable QMutex _lock; //< the plug-ins can call getValueAt at any moment and we must make sure the user is not playing around
#endif

bool isParametric;
bool isPeriodic;

Expand All @@ -86,22 +81,14 @@ struct CurvePrivate
, xMax(std::numeric_limits<double>::infinity())
, yMin(-std::numeric_limits<double>::infinity())
, yMax(std::numeric_limits<double>::infinity())
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
, _lock()
#else
, _lock(QMutex::Recursive)
#endif
, isParametric(false)
, isPeriodic(false)
{
}

CurvePrivate(const CurvePrivate & other)
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
: _lock()
#else
: _lock(QMutex::Recursive)
#endif
{
*this = other;
}
Expand Down
8 changes: 0 additions & 8 deletions Engine/EffectInstancePrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,7 @@ EffectInstance::Implementation::Implementation(EffectInstance* publicInterface)
, metadata()
, runningClipPreferences(false)
, overlaysViewport(0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
, attachedContextsMutex()
#else
, attachedContextsMutex(QMutex::Recursive)
#endif
, attachedContexts()
, mainInstance(0)
, isDoingInstanceSafeRender(false)
Expand Down Expand Up @@ -457,11 +453,7 @@ EffectInstance::Implementation::Implementation(const Implementation& other)
, metadata(other.metadata)
, runningClipPreferences(other.runningClipPreferences)
, overlaysViewport(other.overlaysViewport)
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
, attachedContextsMutex()
#else
, attachedContextsMutex(QMutex::Recursive)
#endif
, attachedContexts()
, mainInstance(other._publicInterface)
, isDoingInstanceSafeRender(false)
Expand Down
7 changes: 1 addition & 6 deletions Engine/EffectInstancePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QWaitCondition>
#include <QtCore/QMutex>
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
#include <QtCore/QRecursiveMutex>
#endif

#include "Global/GlobalDefines.h"

Expand Down Expand Up @@ -227,11 +225,8 @@ class EffectInstance::Implementation

// set during interact actions on main-thread
OverlaySupport* overlaysViewport;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
mutable QRecursiveMutex attachedContextsMutex;
#else
mutable QMutex attachedContextsMutex;
#endif

// A list of context that are currently attached (i.e attachOpenGLContext() has been called on them but not yet dettachOpenGLContext).
// If a plug-in returns false to supportsConcurrentOpenGLRenders() then whenever trying to attach a context, we take a lock in attachOpenGLContext
// that is released in dettachOpenGLContext so that there can only be a single attached OpenGL context at any time.
Expand Down
65 changes: 1 addition & 64 deletions Engine/Engine.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ TEMPLATE = lib
CONFIG += staticlib
CONFIG += moc
CONFIG += boost boost-serialization-lib qt cairo python shiboken pyside
QT += core network
greaterThan(QT_MAJOR_VERSION, 4): QT += concurrent
QT += core network concurrent

ENGINE_WRAPPER_DIR = Qt$${QT_MAJOR_VERSION}/NatronEngine

!noexpat: CONFIG += expat

# Do not uncomment the following: pyside requires QtGui, because PySide/QtCore/pyside_qtcore_python.h includes qtextdocument.h
#QT -= gui

CONFIG += libmv-flags openmvg-flags glad-flags libtess-flags

Expand Down Expand Up @@ -168,7 +165,6 @@ SOURCES += \
PyNodeGroup.cpp \
PyParameter.cpp \
PyRoto.cpp \
PySideCompat.cpp \
PyTracker.cpp \
ReadNode.cpp \
RectD.cpp \
Expand Down Expand Up @@ -490,62 +486,3 @@ for(name, ENGINE_GENERATED_SOURCES) {

OTHER_FILES += \
typesystem_engine.xml

# GENERATED_SOURCES = \
# NatronEngine/animatedparam_wrapper.cpp \
# NatronEngine/app_wrapper.cpp \
# NatronEngine/beziercurve_wrapper.cpp \
# NatronEngine/booleanparam_wrapper.cpp \
# NatronEngine/buttonparam_wrapper.cpp \
# NatronEngine/choiceparam_wrapper.cpp \
# NatronEngine/colorparam_wrapper.cpp \
# NatronEngine/colortuple_wrapper.cpp \
# NatronEngine/double2dparam_wrapper.cpp \
# NatronEngine/double2dtuple_wrapper.cpp \
# NatronEngine/double3dparam_wrapper.cpp \
# NatronEngine/double3dtuple_wrapper.cpp \
# NatronEngine/doubleparam_wrapper.cpp \
# NatronEngine/effect_wrapper.cpp \
# NatronEngine/fileparam_wrapper.cpp \
# NatronEngine/group_wrapper.cpp \
# NatronEngine/groupparam_wrapper.cpp \
# NatronEngine/int2dparam_wrapper.cpp \
# NatronEngine/int2dtuple_wrapper.cpp \
# NatronEngine/int3dparam_wrapper.cpp \
# NatronEngine/int3dtuple_wrapper.cpp \
# NatronEngine/intparam_wrapper.cpp \
# NatronEngine/itembase_wrapper.cpp \
# NatronEngine/layer_wrapper.cpp \
# NatronEngine/natron_wrapper.cpp \
# NatronEngine/natronengine_module_wrapper.cpp \
# NatronEngine/outputfileparam_wrapper.cpp \
# NatronEngine/pageparam_wrapper.cpp \
# NatronEngine/param_wrapper.cpp \
# NatronEngine/parametricparam_wrapper.cpp \
# NatronEngine/pathparam_wrapper.cpp \
# NatronEngine/roto_wrapper.cpp \
# NatronEngine/stringparam_wrapper.cpp \
# NatronEngine/stringparambase_wrapper.cpp

# defineReplace(shibokenWorkaround) {
# SOURCES += $$GENERATED_SOURCES
# return("%_wrapper.cpp")
# }

# isEmpty(SHIBOKEN) {
# SHIBOKEN = shiboken
# }

# SHIBOKEN_FILE = . # Need to give some bogus input
# SHIBOKEN.input = SHIBOKEN_FILE
# SHIBOKEN.output_function = shibokenWorkaround
# SHIBOKEN.commands = $$SHIBOKEN --include-paths=..:$$system(pkg-config --variable=includedir pyside) --typesystem-paths=$$system(pkg-config --variable=typesystemdir pyside) Pyside_Engine_Python.h typesystem_engine.xml
# SHIBOKEN.CONFIG = no_link # don't add the .cpp target file to OBJECTS
# SHIBOKEN.clean = dummy # don't remove the %_wrapper.cpp file by "make clean"

# QMAKE_EXTRA_COMPILERS += SHIBOKEN
macx {

OBJECTIVE_SOURCES += \
QUrlFix.mm
}
4 changes: 0 additions & 4 deletions Engine/FileSystemModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,7 @@ Qt::ItemFlags
FileSystemModel::flags(const QModelIndex &index) const
{
if ( !index.isValid() ) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
return Qt::ItemFlags();
#else
return 0;
#endif
}

// Our model is read only.
Expand Down
8 changes: 0 additions & 8 deletions Engine/Knob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4902,11 +4902,7 @@ struct KnobHolder::KnobHolderPrivate
, isDequeingValuesSet(false)
, paramsEditLevel(eMultipleParamsEditOff)
, paramsEditRecursionLevel(0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
, evaluationBlockedMutex()
#else
, evaluationBlockedMutex(QMutex::Recursive)
#endif
, evaluationBlocked(0)
, canCurrentlySetValue(true)
, knobChanged()
Expand Down Expand Up @@ -4934,11 +4930,7 @@ struct KnobHolder::KnobHolderPrivate
, isDequeingValuesSet(other.isDequeingValuesSet)
, paramsEditLevel(other.paramsEditLevel)
, paramsEditRecursionLevel(other.paramsEditRecursionLevel)
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
, evaluationBlockedMutex()
#else
, evaluationBlockedMutex(QMutex::Recursive)
#endif
, evaluationBlocked(0)
, canCurrentlySetValue(other.canCurrentlySetValue)
, knobChanged()
Expand Down
17 changes: 3 additions & 14 deletions Engine/Knob.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
#include <QtCore/QMutex>
#include <QtCore/QString>
#include <QtCore/QCoreApplication>
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
#include <QtCore/QRecursiveMutex>
#endif

#include "Engine/Variant.h"
#include "Engine/AppManager.h" // for AppManager::createKnob
Expand Down Expand Up @@ -2245,11 +2243,8 @@ class Knob
typedef std::shared_ptr<QueuedSetValueAtTime> QueuedSetValueAtTimePtr;

///Here is all the stuff we couldn't get rid of the template parameter
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
mutable QRecursiveMutex _valueMutex;
#else
mutable QMutex _valueMutex; //< protects _values & _guiValues & _defaultValues & ExprResults
#endif

std::vector<T> _values, _guiValues;

struct DefaultValue
Expand All @@ -2263,19 +2258,13 @@ class Knob
//Only for double and int
mutable QReadWriteLock _minMaxMutex;
std::vector<T> _minimums, _maximums, _displayMins, _displayMaxs;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
mutable QRecursiveMutex _setValuesQueueMutex;
#else
mutable QMutex _setValuesQueueMutex;
#endif

std::list<std::shared_ptr<QueuedSetValue> > _setValuesQueue;

///this flag is to avoid recursive setValue calls
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
mutable QRecursiveMutex _setValueRecursionLevelMutex;
#else
mutable QMutex _setValueRecursionLevelMutex;
#endif

int _setValueRecursionLevel;
};

Expand Down
Loading

0 comments on commit 6e28f2a

Please sign in to comment.