Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Qt5.14 #111

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
8 changes: 7 additions & 1 deletion src/Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Registry.h"
#include <QDir>
#include <QDebug>
#include <QtGlobal>

LibraryItem::LibraryItem(const QString &name, const QString &fileToInstantiate, LibraryItem *parent)
{
Expand Down Expand Up @@ -98,7 +99,12 @@ void Library::populate(LibraryItem *item, QString currentDirectory = ".") {
QDir userDir(Paths::userLibrary() + "/" + currentDirectory);
auto systemLs = systemDir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
auto userLs = userDir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
auto ls = (systemLs + userLs).toSet().toList();
auto lsList = systemLs + userLs;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto ls = lsList.toSet().toList();
#else
auto ls = QSet<QString>(lsList.begin(), lsList.end()).values();
#endif
ls.sort(Qt::CaseInsensitive);
for (auto f = ls.begin(); f != ls.end(); f++) {
auto path = currentDirectory + "/" + *f;
Expand Down
6 changes: 6 additions & 0 deletions src/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QtGlobal>

static QString vnp(VideoNodeSP *videoNode) {
if (videoNode) return QString("%1(%2)").arg((*videoNode)->metaObject()->className()).arg((qintptr)videoNode->data());
Expand Down Expand Up @@ -361,8 +362,13 @@ void Model::flush() {

// Compute the changeset
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto v = QSet<VideoNodeSP *>::fromList(m_vertices);
auto v4r = QSet<VideoNodeSP *>::fromList(m_verticesForRendering);
#else
auto v = QSet<VideoNodeSP *>(m_vertices.begin(), m_vertices.end());
auto v4r = QSet<VideoNodeSP *>(m_verticesForRendering.begin(), m_verticesForRendering.end());
#endif
// TODO Can't use QSet without implementing qHash
//auto e = QSet<Edge>::fromList(m_edges);
//auto e4r = QSet<Edge>::fromList(m_edgesForRendering);
Expand Down
1 change: 1 addition & 0 deletions src/OutputWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <QScreen>
#include <QGuiApplication>
#include <QKeyEvent>

// OutputWindow

Expand Down
41 changes: 9 additions & 32 deletions src/QmlSharedPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <QSharedPointer>
#include <QMetaMethod>
#include <QDebug>
#include <QtGlobal>

template <class T, class B>
class QmlSharedPointer;
Expand Down Expand Up @@ -102,11 +103,7 @@ class QmlSharedPointer
QMetaObject::disconnect(data(), i, this, i);
}
}
static const QMetaObject *gen_superdata();
static const QByteArrayData *gen_stringdata();
static const uint *gen_data();
static const QMetaObject * const *gen_relatedMetaObjects();
static void *gen_extradata();
static void findAndActivateSignal(QObject *_o, int _id, void **_a);

public:
Expand Down Expand Up @@ -286,12 +283,6 @@ template <typename T, typename B> void QmlSharedPointer<T, B>::qt_static_metacal
}
}

template<typename T, typename B>
const QMetaObject *QmlSharedPointer<T, B>::gen_superdata()
{
return &B::staticMetaObject;
}

template<typename T, typename B>
const QByteArrayData *QmlSharedPointer<T, B>::gen_stringdata()
{
Expand All @@ -307,7 +298,11 @@ const QByteArrayData *QmlSharedPointer<T, B>::gen_stringdata()
static QByteArrayData new_stringdata[MAX_N_STRINGS];

for (int i=0; i<MAX_N_STRINGS; i++) {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
new_stringdata[i].ref.atomic.store(-1); // Don't attempt to free
#else
new_stringdata[i].ref.atomic.storeRelaxed(-1); // Don't attempt to free
#endif
}

for (int i=0; i<n_strings; i++) {
Expand All @@ -330,29 +325,11 @@ const QByteArrayData *QmlSharedPointer<T, B>::gen_stringdata()
return new_stringdata;
}

template<typename T, typename B>
const uint *QmlSharedPointer<T, B>::gen_data()
{
return T::staticMetaObject.d.data;
}

template<typename T, typename B>
const QMetaObject * const *QmlSharedPointer<T, B>::gen_relatedMetaObjects()
{
return T::staticMetaObject.d.relatedMetaObjects;
}

template<typename T, typename B>
void *QmlSharedPointer<T, B>::gen_extradata()
{
return T::staticMetaObject.d.extradata;
}

template<typename T, typename B> const QMetaObject QmlSharedPointer<T, B>::staticMetaObject = { {
QmlSharedPointer<T, B>::gen_superdata(),
&B::staticMetaObject,
QmlSharedPointer<T, B>::gen_stringdata(),
QmlSharedPointer<T, B>::gen_data(),
T::staticMetaObject.d.data,
QmlSharedPointer<T, B>::qt_static_metacall,
QmlSharedPointer<T, B>::gen_relatedMetaObjects(),
QmlSharedPointer<T, B>::gen_extradata(),
T::staticMetaObject.d.relatedMetaObjects,
T::staticMetaObject.d.extradata,
} };
9 changes: 7 additions & 2 deletions src/View.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include "View.h"
#include "VideoNode.h"
#include "Paths.h"
#include <QQmlContext>
#include <QQmlProperty>
#include <QFileInfo>
#include <QQueue>
#include "VideoNode.h"
#include "Paths.h"
#include <QtGlobal>

View::View()
: m_model(nullptr)
Expand Down Expand Up @@ -668,7 +669,11 @@ QVariantList View::selectedConnectedComponents() {
QSet<VideoNodeSP *> selectedVerticesSet;
QVector<VideoNodeSP *> selectedVertices;
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto vSet = QSet<VideoNodeSP *>::fromList(vertices);
#else
auto vSet = QSet<VideoNodeSP *>(vertices.begin(), vertices.end());
#endif
for (int i=0; i<m_children.count(); i++) {
if (m_selection.contains(m_children.at(i).item)
&& vSet.contains(m_children.at(i).videoNode)) {
Expand Down