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

Feature/qt6 - Remove usage of Core5Compat library #710

Open
wants to merge 1 commit into
base: feature/qt6
Choose a base branch
from
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
10 changes: 1 addition & 9 deletions src/bin/apps/rv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@ SET(CMAKE_AUTORCC
ON
)

IF(RV_VFX_PLATFORM STREQUAL CY2024)
# TODO_QT: Core5Compat is temporary to fix issue with QTextCodec and other things = faster build to test.
# https://doc.qt.io/qt-6.5/qtcore5compat-module.html
SET(_main_qt_components Core5Compat)
SET(_main_link_libraries Qt6::Core5Compat)
ENDIF()

FIND_PACKAGE(
${RV_QT_PACKAGE_NAME}
COMPONENTS Core Gui Widgets OpenGL ${_main_qt_components}
COMPONENTS Core Gui Widgets OpenGL
REQUIRED
)

Expand Down Expand Up @@ -112,7 +105,6 @@ TARGET_LINK_LIBRARIES(
TwkGLF
arg
stl_ext
${_main_link_libraries}
)

IF(RV_TARGET_WINDOWS)
Expand Down
7 changes: 6 additions & 1 deletion src/bin/apps/rv/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
#include <IPCore/ImageRenderer.h>
#endif

#if defined(RV_VFX_CY2023)
#include <QTextCodec>
#endif
#include <QtWidgets/QtWidgets>
#include <QtGui/QtGui>
#include <RvCommon/RvDocument.h>
Expand Down Expand Up @@ -338,7 +340,10 @@ int utf8Main(int argc, char* argv[])

setPlatformSpecificLocale();

QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
// Refresh the locale using the environment variable set by
// setPlatformSpecificLocale.
QLocale::setDefault(QLocale::system());

TwkFB::ThreadPool::initialize();

// Qt 5.12.1 specific
Expand Down
13 changes: 1 addition & 12 deletions src/lib/app/RvCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,11 @@ SET(CMAKE_AUTORCC
ON
)

IF(RV_VFX_PLATFORM STREQUAL CY2024)
# TODO_QT: Core5Compat is temporary to fix issue with QTextCodec. https://doc.qt.io/qt-6.5/qtcore5compat-module.html
SET(_rvcommon_core5compat_component
Core5Compat
)
SET(_rvcommon_core5compat_link_libraries
Qt6::Core5Compat
)
ENDIF()

#
# This find_package statement is also required to find QT's build tools like 'uic' required just below. Keep this line before 'qt5_wrap_ui'
FIND_PACKAGE(
${RV_QT_PACKAGE_NAME}
COMPONENTS Core Gui OpenGL Widgets ${QT6_QOPENGLWIDGET_COMPONENT} ${_rvcommon_core5compat_component}
COMPONENTS Core Gui OpenGL Widgets ${QT6_QOPENGLWIDGET_COMPONENT}
REQUIRED
)

Expand Down Expand Up @@ -236,7 +226,6 @@ TARGET_LINK_LIBRARIES(
Qt::Widgets
Qt::OpenGL
${QT6_QOPENGLWIDGET_TARGET}
${_rvcommon_core5compat_link_libraries}
PRIVATE Python::Python
IPBaseNodes
${RV_QT_MU_TARGET}
Expand Down
18 changes: 15 additions & 3 deletions src/lib/app/RvCommon/RvWebManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <IPCore/Session.h>
#include <QtCore/QUrl>
#include <QtCore/QDir>

#if defined(RV_VFX_CY2023)
#include <QTextCodec>
#endif

#include <QtCore/QStandardPaths>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
Expand Down Expand Up @@ -156,7 +160,7 @@ namespace Rv
reply->setReadBufferSize(0); // unlimited

connect(reply, SIGNAL(readyRead()), this, SLOT(replyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this,
SLOT(replyError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this,
SLOT(replySSLErrors(QList<QSslError>)));
Expand Down Expand Up @@ -226,7 +230,7 @@ namespace Rv
reply->setReadBufferSize(0); // unlimited

connect(reply, SIGNAL(readyRead()), this, SLOT(replyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this,
SLOT(replyError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this,
SLOT(replySSLErrors(QList<QSslError>)));
Expand Down Expand Up @@ -300,7 +304,7 @@ namespace Rv
reply->setReadBufferSize(0); // unlimited

connect(reply, SIGNAL(readyRead()), this, SLOT(replyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this,
SLOT(replyError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this,
SLOT(replySSLErrors(QList<QSslError>)));
Expand Down Expand Up @@ -366,8 +370,16 @@ namespace Rv
// Text, convert to UTF-8 for Mu
//

#if defined(RV_VFX_CY2023)
QTextCodec* codec = QTextCodec::codecForHtml(array);
QString u = codec->toUnicode(array);
#else
// Assume that the data is utf-8 encoded because about 98-99% of
// websites uses utf-8. The second closest is ISO-8859-1
// with 1.1%.
QStringDecoder decoder(QStringDecoder::Utf8);
QString u = decoder.decode(array);
#endif
Comment on lines +373 to +382
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bernie-laberge @eloisebrosseau Is this a reasonable assumption?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I believe this is a valid assumption.
In any case, this code path is no longer used by RV anymore. So I think this is good enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick search, and I also believe we can make that assumption

QByteArray utf8 = u.toUtf8();
if (!replyErrorString.isEmpty())
utf8 = replyErrorString.toUtf8();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mu/MuQt5/RvNetworkAccessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ QNetworkReply* RvNetworkAccessManager::createRequest(
//
if (printErrors)
{
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this,
SLOT(errorReplySlot(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this,
SLOT(sslErrorsReplySlot(QList<QSslError>)));
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mu/MuQt6/RvNetworkAccessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ QNetworkReply* RvNetworkAccessManager::createRequest(
//
if (printErrors)
{
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this,
SLOT(errorReplySlot(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this,
SLOT(sslErrorsReplySlot(QList<QSslError>)));
Expand Down
Loading