Revert "Revert Qt5 implementation (#17202)" (#17211)

This reverts commit 6de5ebadf9462ea48978850c811fea592e592aaf.
This commit is contained in:
LibretroAdmin 2024-11-26 06:20:39 -06:00 committed by GitHub
parent 0b05b1e3f4
commit 03c8c12740
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 42 deletions

View File

@ -391,7 +391,7 @@ void GridView::paintEvent(QPaintEvent*)
{ {
QModelIndex index = model()->index(row, 0, rootIndex()); QModelIndex index = model()->index(row, 0, rootIndex());
QRectF rect = viewportRectForRow(row); QRectF rect = viewportRectForRow(row);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
QStyleOptionViewItem option; QStyleOptionViewItem option;
initViewItemOption(&option); initViewItemOption(&option);
#else #else

View File

@ -543,7 +543,7 @@ ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) :
QHBoxLayout *headerHLayout = new QHBoxLayout; QHBoxLayout *headerHLayout = new QHBoxLayout;
const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin); const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
m_optionsStack->setContentsMargins(0, 0, 0, 0); m_optionsStack->setContentsMargins(0, 0, 0, 0);
#else #else
m_optionsStack->setMargin(0); m_optionsStack->setMargin(0);

View File

@ -1440,7 +1440,7 @@ QWidget *VideoPage::widget()
layout->addStretch(); layout->addStretch();
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
void (VideoPage::*cb)(int) = &VideoPage::onResolutionComboIndexChanged; void (VideoPage::*cb)(int) = &VideoPage::onResolutionComboIndexChanged;
connect(m_resolutionCombo, &QComboBox::currentIndexChanged, this, cb); connect(m_resolutionCombo, &QComboBox::currentIndexChanged, this, cb);
#else #else

View File

@ -246,7 +246,7 @@ void PlaylistModel::loadThumbnail(const QModelIndex &index)
if (!m_pendingImages.contains(path) && !m_cache.contains(path)) if (!m_pendingImages.contains(path) && !m_cache.contains(path))
{ {
m_pendingImages.insert(path); m_pendingImages.insert(path);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
QtConcurrent::run(&PlaylistModel::loadImage, this, index, path); QtConcurrent::run(&PlaylistModel::loadImage, this, index, path);
#else #else
QtConcurrent::run(this, &PlaylistModel::loadImage, index, path); QtConcurrent::run(this, &PlaylistModel::loadImage, index, path);
@ -878,7 +878,7 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
for (j = 0; j < m_listWidget->count(); j++) for (j = 0; j < m_listWidget->count(); j++)
{ {
QListWidgetItem *item = m_listWidget->item(j); QListWidgetItem *item = m_listWidget->item(j);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
bool hidden = item->isHidden(); bool hidden = item->isHidden();
#else #else
bool hidden = m_listWidget->isItemHidden(item); bool hidden = m_listWidget->isItemHidden(item);
@ -1499,11 +1499,7 @@ void PlaylistModel::getPlaylistItems(QString path)
playlist_config.fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match; playlist_config.fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
playlist_config_set_base_content_directory(&playlist_config, settings->bools.playlist_portable_paths ? settings->paths.directory_menu_content : NULL); playlist_config_set_base_content_directory(&playlist_config, settings->bools.playlist_portable_paths ? settings->paths.directory_menu_content : NULL);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
pathArray.append(path.toUtf8()); pathArray.append(path.toUtf8());
#else
pathArray.append(path);
#endif
pathData = pathArray.constData(); pathData = pathArray.constData();
if (!string_is_empty(pathData)) if (!string_is_empty(pathData))
playlistName = path_basename(pathData); playlistName = path_basename(pathData);

View File

@ -20,11 +20,6 @@
#include <QtWidgets/QFileDialog> #include <QtWidgets/QFileDialog>
#include <QtWidgets/QMessageBox> #include <QtWidgets/QMessageBox>
#include <QtCore/QString> #include <QtCore/QString>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QDesktopWidget>
#endif
#include <QtGlobal> #include <QtGlobal>
#include <QCloseEvent> #include <QCloseEvent>
#include <QResizeEvent> #include <QResizeEvent>
@ -1913,7 +1908,7 @@ void MainWindow::onFileBrowserTreeContextMenuRequested(const QPoint&)
if (currentDirString.isEmpty()) if (currentDirString.isEmpty())
return; return;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
dir.setPath(currentDirString); dir.setPath(currentDirString);
#else #else
dir = currentDirString; dir = currentDirString;
@ -2634,13 +2629,13 @@ void MainWindow::selectBrowserDir(QString path)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
m_proxyFileModel->setFilterRegularExpression(QRegularExpression()); m_proxyFileModel->setFilterRegularExpression(QRegularExpression());
#else #else
m_proxyFileModel->setFilterRegExp(QRegExp()); m_proxyFileModel->setFilterRegExp(QRegExp());
#endif #endif
m_fileTableView->setRootIndex(m_proxyFileModel->mapFromSource(sourceIndex)); m_fileTableView->setRootIndex(m_proxyFileModel->mapFromSource(sourceIndex));
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
m_proxyFileModel->setFilterRegularExpression(m_searchRegularExpression); m_proxyFileModel->setFilterRegularExpression(m_searchRegularExpression);
#else #else
m_proxyFileModel->setFilterRegExp(m_searchRegExp); m_proxyFileModel->setFilterRegExp(m_searchRegExp);
#endif #endif
} }
} }
@ -3199,13 +3194,8 @@ QComboBox* MainWindow::launchWithComboBox()
void MainWindow::onSearchLineEditEdited(const QString &text) void MainWindow::onSearchLineEditEdited(const QString &text)
{ {
int i; int i;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QVector<char32_t> textHiraToKata; QVector<char32_t> textHiraToKata;
QVector<char32_t> textKataToHira; QVector<char32_t> textKataToHira;
#else
QVector<unsigned> textHiraToKata;
QVector<unsigned> textKataToHira;
#endif
QVector<unsigned> textUnicode = text.toUcs4(); QVector<unsigned> textUnicode = text.toUcs4();
bool found_hiragana = false; bool found_hiragana = false;
bool found_katakana = false; bool found_katakana = false;
@ -4322,7 +4312,7 @@ static void ui_application_qt_process_events(void)
QAbstractEventDispatcher *dispatcher = QApplication::eventDispatcher(); QAbstractEventDispatcher *dispatcher = QApplication::eventDispatcher();
if (dispatcher && dispatcher->hasPendingEvents()) if (dispatcher && dispatcher->hasPendingEvents())
#endif #endif
QApplication::processEvents(); QApplication::processEvents();
} }
static void ui_application_qt_quit(void) static void ui_application_qt_quit(void)
@ -4560,11 +4550,7 @@ static void* ui_companion_qt_init(void)
QVBoxLayout *launchWithWidgetLayout = NULL; QVBoxLayout *launchWithWidgetLayout = NULL;
QHBoxLayout *coreComboBoxLayout = NULL; QHBoxLayout *coreComboBoxLayout = NULL;
QMenuBar *menu = NULL; QMenuBar *menu = NULL;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QScreen *screen = NULL; QScreen *screen = NULL;
#else
QDesktopWidget *desktop = NULL;
#endif
QMenu *fileMenu = NULL; QMenu *fileMenu = NULL;
QMenu *editMenu = NULL; QMenu *editMenu = NULL;
QMenu *viewMenu = NULL; QMenu *viewMenu = NULL;
@ -4607,13 +4593,8 @@ static void* ui_companion_qt_init(void)
(ui_application_qt.initialize()); (ui_application_qt.initialize());
handle->window = static_cast<ui_window_qt_t*>(ui_window_qt.init()); handle->window = static_cast<ui_window_qt_t*>(ui_window_qt.init());
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
screen = qApp->primaryScreen(); screen = qApp->primaryScreen();
desktopRect = screen->availableGeometry(); desktopRect = screen->availableGeometry();
#else
desktop = qApp->desktop();
desktopRect = desktop->availableGeometry();
#endif
mainwindow = handle->window->qtWindow; mainwindow = handle->window->qtWindow;
@ -5223,7 +5204,7 @@ void LoadCoreWindow::onCoreEnterPressed()
Qt::UserRole).toHash(); Qt::UserRole).toHash();
QString path = hash["path"].toString(); QString path = hash["path"].toString();
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
pathArray.append(path.toStdString()); pathArray.append(path.toStdString());
#else #else
pathArray.append(path); pathArray.append(path);
@ -5257,11 +5238,7 @@ void LoadCoreWindow::onLoadCustomCoreClicked()
if (path.isEmpty()) if (path.isEmpty())
return; return;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
pathArray.append(path.toUtf8()); pathArray.append(path.toUtf8());
#else
pathArray.append(path);
#endif
pathData = pathArray.constData(); pathData = pathArray.constData();
loadCore(pathData); loadCore(pathData);
@ -5273,11 +5250,7 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
unsigned i; unsigned i;
QStringList horizontal_header_labels; QStringList horizontal_header_labels;
core_info_list_t *cores = NULL; core_info_list_t *cores = NULL;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) QScreen *desktop = qApp->primaryScreen();
QScreen *desktop = qApp->primaryScreen();
#else
QDesktopWidget *desktop = qApp->desktop();
#endif
QRect desktopRect = desktop->availableGeometry(); QRect desktopRect = desktop->availableGeometry();
horizontal_header_labels << msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NAME); horizontal_header_labels << msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NAME);