Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Engine/AppManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QTextCodec>
#include <QCoreApplication>
#include <QSettings>
#include <QThreadPool>
Expand Down
5 changes: 3 additions & 2 deletions Engine/CLArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <QDebug>
#include <QFile>
#include <QFileInfo>
#include <QRegularExpression>

#include "Global/GlobalDefines.h"
#include "Global/GitVersion.h"
Expand Down Expand Up @@ -1139,10 +1140,10 @@ CLArgsPrivate::parse()
// A clean solution would be to separate the scriptName and the fileName with a comma.
if ( it != args.end() && !it->startsWith( QChar::fromLatin1('-') ) ) {
// Check that it's neither a python script, a natron project, nor a frame range.
QRegExp re( QString::fromUtf8("[0-9\\-,]*") ); // Matches frame ranges.
QRegularExpression re( QString::fromUtf8("[0-9\\-,]*") ); // Matches frame ranges.
if (!it->endsWith(QString::fromUtf8(".py"), Qt::CaseInsensitive) &&
!it->endsWith(QString::fromUtf8(".ntp"), Qt::CaseInsensitive) &&
!re.exactMatch(*it)) {
!re.match(*it).hasMatch()) {
w.filename = *it;
#ifdef __NATRON_UNIX__
w.filename = AppManager::qt_tildeExpansion(w.filename);
Expand Down
12 changes: 12 additions & 0 deletions Engine/EffectInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4097,7 +4097,11 @@ EffectInstance::attachOpenGLContext_public(const OSGLContextPtr& glContext,
{
NON_RECURSIVE_ACTION();
bool concurrentGLRender = supportsConcurrentOpenGLRenders();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
std::unique_ptr<QMutexLocker<QRecursiveMutex>> locker;
#else
std::unique_ptr<QMutexLocker> locker;
#endif
if (concurrentGLRender) {
locker.reset( new QMutexLocker(&_imp->attachedContextsMutex) );
} else {
Expand Down Expand Up @@ -4131,7 +4135,11 @@ EffectInstance::attachOpenGLContext_public(const OSGLContextPtr& glContext,
void
EffectInstance::dettachAllOpenGLContexts()
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMutexLocker<QRecursiveMutex> locker(&_imp->attachedContextsMutex);
#else
QMutexLocker locker(&_imp->attachedContextsMutex);
#endif

for (EffectInstance::OpenGLContextEffectsMap::iterator it = _imp->attachedContexts.begin(); it != _imp->attachedContexts.end(); ++it) {
OSGLContextPtr context = it->first.lock();
Expand All @@ -4158,7 +4166,11 @@ EffectInstance::dettachOpenGLContext_public(const OSGLContextPtr& glContext, con
{
NON_RECURSIVE_ACTION();
bool concurrentGLRender = supportsConcurrentOpenGLRenders();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
std::unique_ptr<QMutexLocker<QRecursiveMutex>> locker;
#else
std::unique_ptr<QMutexLocker> locker;
#endif
if (concurrentGLRender) {
locker.reset( new QMutexLocker(&_imp->attachedContextsMutex) );
}
Expand Down
13 changes: 13 additions & 0 deletions Engine/EffectInstanceRenderRoI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,12 @@ EffectInstance::renderRoI(const RenderRoIArgs & args,
///locks belongs to an instance)


#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
std::unique_ptr<QMutexLocker<QMutex>> locker;
std::unique_ptr<QMutexLocker<QRecursiveMutex>> recursiveLocker;
#else
std::unique_ptr<QMutexLocker> locker;
#endif


EffectInstancePtr renderInstance;
Expand All @@ -1535,11 +1540,19 @@ EffectInstance::renderRoI(const RenderRoIArgs & args,
assert(renderInstance);

if (safety == eRenderSafetyInstanceSafe) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
locker.reset( new QMutexLocker<QMutex>( &getNode()->getRenderInstancesSharedMutex() ) );
#else
locker.reset( new QMutexLocker( &getNode()->getRenderInstancesSharedMutex() ) );
#endif
} else if (safety == eRenderSafetyUnsafe) {
const Plugin* p = getNode()->getPlugin();
assert(p);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
recursiveLocker.reset( new QMutexLocker<QRecursiveMutex>( p->getPluginLock() ) );
#else
locker.reset( new QMutexLocker( p->getPluginLock() ) );
#endif
} else {
// no need to lock
Q_UNUSED(locker);
Expand Down
8 changes: 8 additions & 0 deletions Engine/EngineFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "Global/Macros.h"

#include <QtGlobal>

#include <memory>
#include <list>
#include <vector>
Expand Down Expand Up @@ -61,7 +63,13 @@ class QNetworkRequest;
class QProcess;
class QSettings;
class QString;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
template<typename T> class QList;
template<typename T> using QVector = QList<T>;
using QStringList = QList<QString>;
#else
class QStringList;
#endif
class QThread;
class QTimer;
class QUrl;
Expand Down
12 changes: 7 additions & 5 deletions Engine/FileSystemModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CLANG_DIAG_OFF(uninitialized)
#include <QDebug>
#include <QUrl>
#include <QMimeData>
#include <QRegularExpression>
CLANG_DIAG_ON(deprecated)
CLANG_DIAG_ON(uninitialized)

Expand Down Expand Up @@ -193,7 +194,7 @@ struct FileSystemModelPrivate
QStringList headers;
QDir::Filters filters;
QString encodedRegexps;
std::list<QRegExp> regexps;
std::list<QRegularExpression> regexps;
mutable QMutex filtersMutex;
mutable QMutex sequenceModeEnabledMutex;
bool sequenceModeEnabled;
Expand Down Expand Up @@ -842,7 +843,7 @@ FileSystemModel::data(const QModelIndex &index,
data = item->fileExtension();
break;
case DateModified:
data = item->getLastModified().toString(Qt::LocalDate);
data = item->getLastModified().toString(QLocale::system().dateTimeFormat());
break;
default:
break;
Expand Down Expand Up @@ -1041,7 +1042,8 @@ FileSystemModel::setRegexpFilters(const QString& filters)
++i;
}
if ( regExp != QString( QLatin1Char('*') ) ) {
QRegExp rx(regExp, Qt::CaseInsensitive, QRegExp::Wildcard);
QRegularExpression rx(QRegularExpression::wildcardToRegularExpression(regExp));
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
if ( rx.isValid() ) {
_imp->regexps.push_back(rx);
}
Expand Down Expand Up @@ -1082,8 +1084,8 @@ FileSystemModel::isAcceptedByRegexps(const QString & path) const
return true;
}

for (std::list<QRegExp>::const_iterator it = _imp->regexps.begin(); it != _imp->regexps.end(); ++it) {
if ( it->exactMatch(path) ) {
for (std::list<QRegularExpression>::const_iterator it = _imp->regexps.begin(); it != _imp->regexps.end(); ++it) {
if ( it->match(path).hasMatch() ) {
return true;
}
}
Expand Down
11 changes: 5 additions & 6 deletions Engine/Markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
CLANG_DIAG_OFF(deprecated)
CLANG_DIAG_OFF(uninitialized)
#include <QTextStream>
#include <QRegExp>
#include <QRegularExpression>
CLANG_DIAG_ON(deprecated)
CLANG_DIAG_ON(uninitialized)

Expand Down Expand Up @@ -79,7 +79,7 @@ QString
Markdown::parseCustomLinksForHTML(const QString& markdown)
{
QString result = markdown;
QRegExp rx( QString::fromUtf8("(\\|html::[^|]*\\|)\\|rst::[^|]*\\|") );
QRegularExpression rx( QString::fromUtf8("(\\|html::[^|]*\\|)\\|rst::[^|]*\\|") );
result.replace( rx, QString::fromUtf8("\\1") );

return result;
Expand All @@ -105,10 +105,9 @@ Markdown::fixSettingsHTML(const QString &html)
QStringList list = html.split( QString::fromUtf8("\n") );
Q_FOREACH(const QString &line, list) {
if ( line.startsWith(QString::fromUtf8("<h2>")) ) {
QRegExp rx( QString::fromUtf8("<h2>(.*)</h2>") );
rx.indexIn(line);
QString header = rx.cap(1);
QString headerLink = header.toLower();
QRegularExpression rx( QString::fromUtf8("<h2>(.*)</h2>") );
QString header(rx.match(line).captured(1));
QString headerLink(header.toLower());
headerLink.replace( QString::fromUtf8(" "), QString::fromUtf8("-") );
result.append(QString::fromUtf8("<h2 id=\"%1\">%2</h2>").arg(headerLink).arg(header));
} else {
Expand Down
1 change: 0 additions & 1 deletion Engine/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <QWaitCondition>
#include <QTextStream>
#include <QFile>
#include <QRegExp>

#include <ofxNatron.h>

Expand Down
3 changes: 2 additions & 1 deletion Engine/NodeDocumentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <QTextStream>
#include <QFile>
#include <QRegularExpression>

#include "Engine/EffectInstance.h"
#include "Engine/KnobTypes.h"
Expand Down Expand Up @@ -409,7 +410,7 @@ Node::makeDocumentation(bool genHTML) const
pluginDescription = NATRON_NAMESPACE::convertFromPlainText(pluginDescription, NATRON_NAMESPACE::WhiteSpaceNormal);

// replace URLs with links
QRegExp re( QString::fromUtf8("((http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?)") );
QRegularExpression re( QString::fromUtf8("((http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?)") );
pluginDescription.replace( re, QString::fromUtf8("<a href=\"\\1\">\\1</a>") );
} else {
pluginDescription = convertFromPlainTextToMarkdown(pluginDescription, genHTML, false);
Expand Down
8 changes: 4 additions & 4 deletions Engine/OSGLContext_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

#include <dlfcn.h>

#include "Engine/AppManager.h"
#include "Engine/OSGLContext.h"
#include "Global/GLIncludes.h"

extern "C"
{
#include <X11/Xlib.h>
Expand All @@ -41,10 +45,6 @@ extern "C"
#include <X11/Xresource.h>
}

#include "Engine/AppManager.h"
#include "Engine/OSGLContext.h"
#include "Global/GLIncludes.h"

#define GLX_VENDOR 1
#define GLX_RGBA_BIT 0x00000001
#define GLX_WINDOW_BIT 0x00000001
Expand Down
4 changes: 2 additions & 2 deletions Engine/OutputEffectInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <QReadWriteLock>
#include <QCoreApplication>
#include <QThread>
#include <QRegExp>
#include <QRegularExpression>
#include <QtConcurrentMap> // QtCore on Qt4, QtConcurrent on Qt5
#include <QtConcurrentRun> // QtCore on Qt4, QtConcurrent on Qt5

Expand Down Expand Up @@ -268,7 +268,7 @@ OutputEffectInstance::renderFullSequence(bool isBlocking,
std::size_t foundHash = pattern.find_first_of("#");
if (foundHash == std::string::npos) {
// Look for printf style numbering
QRegExp exp(QString::fromUtf8("%[0-9]*d"));
QRegularExpression exp(QString::fromUtf8("%[0-9]*d"));
QString qp(QString::fromUtf8(pattern.c_str()));
if (!qp.contains(exp)) {
QString message = tr("You are trying to render the frame range [%1 - %2] but you did not specify any hash ('#') character(s) or printf-like format ('%d') for the padding. This will result in the same image being overwritten multiple times.").arg(first).arg(last);
Expand Down
18 changes: 13 additions & 5 deletions Engine/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <QTextStream>
#include <QHostInfo>
#include <QtConcurrentRun> // QtCore on Qt4, QtConcurrent on Qt5
#include <QRegularExpression>

#include <ofxhXml.h> // OFX::XML::escape

Expand Down Expand Up @@ -504,7 +505,7 @@ findBackups(const QString & filePath)
ret.append(filePath);
}
// find files matching filePath.~[0-9]+~
QRegExp rx(QString::fromUtf8("\\.~(\\d+)~$"));
QRegularExpression rx(QString::fromUtf8("\\.~(\\d+)~$"));
QFileInfo fileInfo(filePath);
QString fileName = fileInfo.fileName();
QDirIterator it(fileInfo.dir());
Expand All @@ -518,7 +519,9 @@ findBackups(const QString & filePath)

// If the filename contains target string - put it in the hitlist
QString fn = file.fileName();
if (fn.startsWith(fileName) && rx.lastIndexIn(fn) == fileName.size()) {
QRegularExpressionMatch match(rx.match(fileName));
qsizetype pos = match.capturedEnd();
if (fn.startsWith(fileName) && pos == fileName.size()) {
ret.append(file.filePath());
}
}
Expand All @@ -532,10 +535,11 @@ findBackups(const QString & filePath)
static QString
nextBackup(const QString & filePath)
{
QRegExp rx(QString::fromUtf8("\\.~(\\d+)~$"));
int pos = rx.lastIndexIn(filePath);
QRegularExpression rx(QString::fromUtf8("\\.~(\\d+)~$"));
QRegularExpressionMatch match(rx.match(filePath));
int pos = match.capturedEnd();
if (pos >= 0) {
int i = rx.cap(1).toInt();
int i = match.captured(1).toInt();
return filePath.left(pos) + QString::fromUtf8(".~%1~").arg(i+1);
} else {
return filePath + QString::fromUtf8(".~1~");
Expand Down Expand Up @@ -756,7 +760,11 @@ Project::onAutoSaveTimerTriggered()
if (canAutoSave) {
std::shared_ptr<QFutureWatcher<void> > watcher = std::make_shared<QFutureWatcher<void> >();
QObject::connect( watcher.get(), SIGNAL(finished()), this, SLOT(onAutoSaveFutureFinished()) );
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
watcher->setFuture( QtConcurrent::run(&Project::autoSave, this) );
#else
watcher->setFuture( QtConcurrent::run(this, &Project::autoSave) );
#endif
_imp->autoSaveFutures.push_back(watcher);
} else {
///If the auto-save failed because a render is in progress, try every 2 seconds to auto-save.
Expand Down
4 changes: 4 additions & 0 deletions Engine/PyGlobalFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ class PyCoreApplication

inline int getBuildNumber() const
{
#ifdef NATRON_BUILD_NUMBER
return NATRON_BUILD_NUMBER;
#else
return 0;
#endif
}

inline bool is64Bit() const
Expand Down
2 changes: 1 addition & 1 deletion Engine/StandardPaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ StandardPaths::writableLocation(StandardLocationEnum type)
path = QStandardPaths::HomeLocation;
break;
case StandardPaths::eStandardLocationData:
path = QStandardPaths::DataLocation;
path = QStandardPaths::AppDataLocation;
break;
case StandardPaths::eStandardLocationCache:
path = QStandardPaths::CacheLocation;
Expand Down
8 changes: 8 additions & 0 deletions Engine/TrackerNodeInteract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,11 @@ TrackerNodeInteract::refreshSelectedMarkerTexture()

imageGetterWatcher = std::make_shared<TrackWatcher>();
QObject::connect( imageGetterWatcher.get(), SIGNAL(finished()), this, SLOT(onTrackImageRenderingFinished()) );
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
imageGetterWatcher->setFuture( QtConcurrent::run(&TrackMarker::getMarkerImage, marker.get(), time, roi) );
#else
imageGetterWatcher->setFuture( QtConcurrent::run(marker.get(), &TrackMarker::getMarkerImage, time, roi) );
#endif
}

void
Expand Down Expand Up @@ -1130,7 +1134,11 @@ TrackerNodeInteract::makeMarkerKeyTexture(int time,
TrackWatcherPtr watcher( new TrackWatcher() );
QObject::connect( watcher.get(), SIGNAL(finished()), this, SLOT(onKeyFrameImageRenderingFinished()) );
trackRequestsMap[k] = watcher;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
watcher->setFuture( QtConcurrent::run(&TrackMarker::getMarkerImage, track.get(), time, k.roi) );
#else
watcher->setFuture( QtConcurrent::run(track.get(), &TrackMarker::getMarkerImage, time, k.roi) );
#endif
}
}

Expand Down
4 changes: 2 additions & 2 deletions Engine/typesystem_engine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,9 @@
<modify-function signature="renderInternal(bool,std::list&lt;Effect*&gt;,std::list&lt;int&gt;,std::list&lt;int&gt;,std::list&lt;int&gt;)" remove="all"/>
<modify-function signature="renderInternal(bool,Effect*,int,int,int)" remove="all"/>
<modify-function signature="render(std::list&lt;Effect*&gt;,std::list&lt;int&gt;,std::list&lt;int&gt;,std::list&lt;int&gt;)">
<modify-argument index="1">
<!--<modify-argument index="1"> This conversion fails to compile in PySide6, luckily Shiboken is smart enough to do it for ourselves
<replace-type modified-type="PyList"/>
</modify-argument>
</modify-argument>-->
<modify-argument index="2">
<remove-argument/>
</modify-argument>
Expand Down
Loading
Loading