Skip to content

Commit

Permalink
* Fixes for Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
trueromanus committed May 12, 2024
1 parent 34b69b7 commit d532dde
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Classes/Models/seenmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void SeenModel::writeToJson(QJsonObject &json) const noexcept
json["timestamp"] = m_Timestamp;
}

void SeenModel::readFromJson(QJsonValue &json)
void SeenModel::readFromJson(QJsonObject &json)
{
setId(json["id"].toInt());
setVideoId(json["videoId"].toInt());
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/Models/seenmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SeenModel
void setTimestamp(const int timestamp) noexcept;

void writeToJson(QJsonObject &json) const noexcept;
void readFromJson(QJsonValue &json);
void readFromJson(QJsonObject &json);
};

#endif // SEENMODEL_H
2 changes: 1 addition & 1 deletion src/Classes/Models/youtubevideomodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void YoutubeVideoModel::writeToJson(QJsonObject &json) const noexcept
json["image"] = m_Image;
}

void YoutubeVideoModel::readFromJson(QJsonValue &json)
void YoutubeVideoModel::readFromJson(QJsonObject &json)
{
setId(json["id"].toInt());
setTitle(json["title"].toString());
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/Models/youtubevideomodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class YoutubeVideoModel
void setTimestamp(const int timestamp) noexcept;

void writeToJson(QJsonObject &json) const noexcept;
void readFromJson(QJsonValue &json);
void readFromJson(QJsonObject &json);

};

Expand Down
4 changes: 2 additions & 2 deletions src/Classes/Services/releaselinkedseries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ void ReleaseLinkedSeries::processReleasesFromDescription(const QString& descript
int watchOrderIndex = description.indexOf(startToken);
if (watchOrderIndex == -1) return;

auto cuttedDescription = description.midRef(watchOrderIndex + startToken.length());
auto cuttedDescription = description.mid(watchOrderIndex + startToken.length());
auto parts = cuttedDescription.split("#").mid(1);

static QRegularExpression linkRegexp(R"(\/release\/(.*)\.html)");
Expand All @@ -505,7 +505,7 @@ void ReleaseLinkedSeries::processReleasesFromDescription(const QString& descript
auto series = new ReleaseSeriesModel();

foreach (auto part, parts) {
auto partString = part.toString();
auto partString = part;

auto match = linkRegexp.match(partString);

Expand Down
4 changes: 2 additions & 2 deletions src/Classes/ViewModels/mainviewmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class MainViewModel : public QObject
QVariantList m_leftToolbar { QVariantList() };
bool m_editLeftToolbar { false };
QVariantList m_otherLeftToolbar { QVariantList() };
QString m_dropIndex { -1 };
QString m_dragIndex { -1 };
QString m_dropIndex { "" };
QString m_dragIndex { "" };
QString m_globalTextFont { "" };
QStringList m_fontFamilies { QStringList() };
const QString addItemButton { "additem" };
Expand Down
6 changes: 4 additions & 2 deletions src/Classes/ViewModels/onlineplayerviewmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QStandardPaths>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QUuid>
#include <QDesktopServices>
#include "../../globalhelpers.h"
Expand Down Expand Up @@ -666,7 +667,7 @@ void OnlinePlayerViewModel::quickSetupForSingleRelease(int releaseId, int custom
m_isStreamingTorrents = false;

QDateTime timestamp;
timestamp.setTime_t(release->timestamp());
timestamp.setSecsSinceEpoch(release->timestamp());
auto year = timestamp.date().year();
m_isReleaseLess2022 = year > 0 && year < 2022;

Expand Down Expand Up @@ -1281,7 +1282,8 @@ void OnlinePlayerViewModel::loadSeens()

foreach (auto item, jsonSeens) {
SeenModel* seenModel = new SeenModel();
seenModel->readFromJson(item);
auto object = item.toObject();
seenModel->readFromJson(object);
if (!m_seenModels->contains(seenModel->id())) {
m_seenModels->insert(seenModel->id(), seenModel);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/ViewModels/torrentnotifierviewmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void TorrentNotifierViewModel::messageReceived(const QString &message)
auto firstSeparator = message.indexOf(":");
if (firstSeparator == -1) return;

auto response = message.midRef(0, firstSeparator);
auto response = message.mid(0, firstSeparator);

if (response == "ds") {
auto document = QJsonDocument::fromJson(message.mid(3).toUtf8());
Expand Down
3 changes: 2 additions & 1 deletion src/Classes/ViewModels/youtubeviewmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ void YoutubeViewModel::readYoutubeItems()
auto items = dataObject["items"].toArray();

foreach (auto item, items) {
auto object = item.toObject();
auto model = new YoutubeVideoModel();
model->readFromJson(item);
model->readFromJson(object);

m_youtubeVideos->append(model);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@

int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QQuickWindow::setSceneGraphBackend("opengl");
#else
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
#endif

#ifdef Q_OS_WIN
Expand Down

0 comments on commit d532dde

Please sign in to comment.