Migrate to Qt6 (#17167)
* (Qt) Migrate to Qt6 * basic support Qt6 with minimal changes required for compiling * look `moc` in QT_HOST_LIBEXECS * (Qt) Backward compatibility with Qt5
This commit is contained in:
parent
b95c15cfdf
commit
3e2f0131ae
|
@ -249,3 +249,6 @@ param.sfo
|
|||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
||||
# Clazy
|
||||
*.clazy.yaml
|
||||
|
|
|
@ -15,7 +15,9 @@ ifeq ($(HAVE_NOUNUSED_VARIABLE), 1)
|
|||
DEF_FLAGS += $(NOUNUSED_VARIABLE_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_CXX11), 1)
|
||||
ifeq ($(HAVE_QT6), 1)
|
||||
CXXFLAGS += $(CXX17_CFLAGS)
|
||||
else ifeq ($(HAVE_CXX11), 1)
|
||||
CXXFLAGS += $(CXX11_CFLAGS)
|
||||
endif
|
||||
|
||||
|
@ -535,10 +537,18 @@ ifeq ($(HAVE_QT), 1)
|
|||
endif
|
||||
|
||||
DEFINES += -DHAVE_MAIN
|
||||
ifeq ($(HAVE_QT6), 1)
|
||||
CXXFLAGS += -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 $(QT6CORE_CFLAGS) $(QT6GUI_CFLAGS) $(QT6WIDGETS_CFLAGS) $(QT6CONCURRENT_CFLAGS) $(QT6NETWORK_CFLAGS)
|
||||
#DEF_FLAGS += $(QT6WEBENGINE_CFLAGS)
|
||||
LIBS += $(QT6CORE_LIBS) $(QT6GUI_LIBS) $(QT6WIDGETS_LIBS) $(QT6CONCURRENT_LIBS) $(QT6NETWORK_LIBS)
|
||||
#LIBS += $(QT6WEBENGINE_LIBS)
|
||||
else
|
||||
DEF_FLAGS += $(QT5CORE_CFLAGS) $(QT5GUI_CFLAGS) $(QT5WIDGETS_CFLAGS) $(QT5CONCURRENT_CFLAGS) $(QT5NETWORK_CFLAGS)
|
||||
#DEF_FLAGS += $(QT5WEBENGINE_CFLAGS)
|
||||
LIBS += $(QT5CORE_LIBS) $(QT5GUI_LIBS) $(QT5WIDGETS_LIBS) $(QT5CONCURRENT_LIBS) $(QT5NETWORK_LIBS)
|
||||
#LIBS += $(QT5WEBENGINE_LIBS)
|
||||
endif
|
||||
|
||||
NEED_CXX_LINKER = 1
|
||||
|
||||
ifneq ($(findstring Linux,$(OS)),)
|
||||
|
|
|
@ -12,6 +12,7 @@ if [ "$HAVE_C99" = 'no' ]; then
|
|||
fi
|
||||
|
||||
check_switch cxx CXX11 -std=c++11 ''
|
||||
check_switch cxx CXX17 -std=c++17 ''
|
||||
check_switch '' NOUNUSED -Wno-unused-result ''
|
||||
check_switch '' NOUNUSED_VARIABLE -Wno-unused-variable ''
|
||||
|
||||
|
@ -277,30 +278,58 @@ if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then
|
|||
fi
|
||||
|
||||
check_enabled CXX11 CXX C++ 'C++11 support is' false
|
||||
check_enabled CXX17 CXX C++ 'C++17 support is' false
|
||||
|
||||
check_platform Haiku DISCORD 'Discord is' false
|
||||
check_enabled CXX DISCORD discord 'The C++ compiler is' false
|
||||
check_enabled CXX QT 'Qt companion' 'The C++ compiler is' false
|
||||
|
||||
if [ "$HAVE_QT" != 'no' ]; then
|
||||
check_pkgconf QT5CORE Qt5Core 5.2
|
||||
check_pkgconf QT5GUI Qt5Gui 5.2
|
||||
check_pkgconf QT5WIDGETS Qt5Widgets 5.2
|
||||
check_pkgconf QT5CONCURRENT Qt5Concurrent 5.2
|
||||
check_pkgconf QT5NETWORK Qt5Network 5.2
|
||||
#check_pkgconf QT5WEBENGINE Qt5WebEngine 5.4
|
||||
if [ "$HAVE_CXX17" = 'yes' ]; then
|
||||
check_pkgconf QT6CORE Qt6Core 6.2
|
||||
check_pkgconf QT6GUI Qt6Gui 6.2
|
||||
check_pkgconf QT6WIDGETS Qt6Widgets 6.2
|
||||
check_pkgconf QT6CONCURRENT Qt6Concurrent 6.2
|
||||
check_pkgconf QT6NETWORK Qt6Network 6.2
|
||||
#check_pkgconf QT6WEBENGINE Qt6WebEngine 6.2
|
||||
|
||||
# pkg-config is needed to reliably find Qt5 libraries.
|
||||
# pkg-config is needed to reliably find Qt6 libraries.
|
||||
|
||||
check_enabled QT5CORE QT Qt 'Qt5Core is' true
|
||||
check_enabled QT5GUI QT Qt 'Qt5GUI is' true
|
||||
check_enabled QT5WIDGETS QT Qt 'Qt5Widgets is' true
|
||||
check_enabled QT5CONCURRENT QT Qt 'Qt5Concurrent is' true
|
||||
check_enabled QT5NETWORK QT Qt 'Qt5Network is' true
|
||||
#check_enabled QT5WEBENGINE QT Qt 'Qt5Webengine is' true
|
||||
check_enabled QT6CORE QT Qt 'Qt6Core is' true
|
||||
check_enabled QT6GUI QT Qt 'Qt6GUI is' true
|
||||
check_enabled QT6WIDGETS QT Qt 'Qt6Widgets is' true
|
||||
check_enabled QT6CONCURRENT QT Qt 'Qt6Concurrent is' true
|
||||
check_enabled QT6NETWORK QT Qt 'Qt6Network is' true
|
||||
#check_enabled QT6WEBENGINE QT Qt 'Qt6Webengine is' true
|
||||
|
||||
if [ "$HAVE_QT" != yes ]; then
|
||||
die : 'Notice: Qt support disabled, required libraries were not found.'
|
||||
if [ "$HAVE_QT" != yes ]; then
|
||||
die : 'Notice: Qt support disabled, required libraries were not found.'
|
||||
else
|
||||
HAVE_QT6='yes'
|
||||
add_define MAKEFILE HAVE_QT6 1
|
||||
fi
|
||||
fi
|
||||
if [ "$HAVE_QT6" != 'yes' ]; then
|
||||
HAVE_QT='auto'
|
||||
check_pkgconf QT5CORE Qt5Core 5.2
|
||||
check_pkgconf QT5GUI Qt5Gui 5.2
|
||||
check_pkgconf QT5WIDGETS Qt5Widgets 5.2
|
||||
check_pkgconf QT5CONCURRENT Qt5Concurrent 5.2
|
||||
check_pkgconf QT5NETWORK Qt5Network 5.2
|
||||
#check_pkgconf QT5WEBENGINE Qt6WebEngine 5.2
|
||||
|
||||
# pkg-config is needed to reliably find Qt5 libraries.
|
||||
|
||||
check_enabled QT5CORE QT Qt 'Qt5Core is' true
|
||||
check_enabled QT5GUI QT Qt 'Qt5GUI is' true
|
||||
check_enabled QT5WIDGETS QT Qt 'Qt5Widgets is' true
|
||||
check_enabled QT5CONCURRENT QT Qt 'Qt5Concurrent is' true
|
||||
check_enabled QT5NETWORK QT Qt 'Qt5Network is' true
|
||||
#check_enabled QT5WEBENGINE QT Qt 'Qt5Webengine is' true
|
||||
|
||||
if [ "$HAVE_QT" != yes ]; then
|
||||
die : 'Notice: Qt support disabled, required libraries were not found.'
|
||||
fi
|
||||
fi
|
||||
|
||||
check_pkgconf OPENSSL openssl 1.0.0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
QT_VERSION=qt5
|
||||
QT_FLAGS="$CXX11_CFLAGS $QT5CORE_CFLAGS $QT5CORE_LIBS"
|
||||
[ "$HAVE_QT6" = "yes" ] && QT_VERSION=qt6 || QT_VERSION=qt5
|
||||
[ "$HAVE_QT6" = "yes" ] && QT_FLAGS="$CXX17_CFLAGS $QT6CORE_CFLAGS $QT6CORE_LIBS" || QT_FLAGS="$CXX11_CFLAGS $QT5CORE_CFLAGS $QT5CORE_LIBS"
|
||||
|
||||
add_define MAKEFILE QT_VERSION "$QT_VERSION"
|
||||
|
|
|
@ -29,7 +29,11 @@ if [ "$HAVE_QT" = "yes" ]; then
|
|||
>/dev/null 2>&1 &&
|
||||
moc_works=1
|
||||
else
|
||||
for moc in "moc-$QT_VERSION" moc; do
|
||||
if [ "$QT_VERSION" = "qt6" ]; then
|
||||
QMAKE="$(exists qmake6)" || QMAKE="qmake"
|
||||
$QMAKE -query QT_HOST_LIBEXECS && QT_HOST_LIBEXECS="$($QMAKE -query QT_HOST_LIBEXECS)/"
|
||||
fi
|
||||
for moc in "${QT_HOST_LIBEXECS}moc-$QT_VERSION" "${QT_HOST_LIBEXECS}moc"; do
|
||||
MOC="$(exists "$moc")" || MOC=""
|
||||
if [ "$MOC" ]; then
|
||||
QT_SELECT="$QT_VERSION" \
|
||||
|
|
|
@ -391,7 +391,12 @@ void GridView::paintEvent(QPaintEvent*)
|
|||
{
|
||||
QModelIndex index = model()->index(row, 0, rootIndex());
|
||||
QRectF rect = viewportRectForRow(row);
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
QStyleOptionViewItem option;
|
||||
initViewItemOption(&option);
|
||||
#else
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
#endif
|
||||
|
||||
if (!rect.isValid() || rect.bottom() < 0 || rect.y() > viewport()->height())
|
||||
continue;
|
||||
|
|
|
@ -173,8 +173,8 @@ void PlaylistEntryDialog::loadPlaylistOptions()
|
|||
m_coreComboBox->addItem(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_SELECTION_ASK));
|
||||
m_databaseComboBox->addItem(
|
||||
QString("<")
|
||||
+ msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)
|
||||
QString("<")
|
||||
+ msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)
|
||||
+ ">",
|
||||
QFileInfo(m_mainwindow->getCurrentPlaylistPath()).fileName().remove(".lpl"));
|
||||
|
||||
|
@ -381,7 +381,7 @@ void CoreInfoDialog::showCoreInfo()
|
|||
int row = 0;
|
||||
int row_count = m_formLayout->rowCount();
|
||||
int i = 0;
|
||||
QVector<QHash<QString, QString> > info_list
|
||||
QVector<QHash<QString, QString> > info_list
|
||||
= m_mainwindow->getCoreInfo();
|
||||
|
||||
if (row_count > 0)
|
||||
|
@ -392,7 +392,7 @@ void CoreInfoDialog::showCoreInfo()
|
|||
/* removeRow() and takeRow() was only added in 5.8! */
|
||||
m_formLayout->removeRow(0);
|
||||
#else
|
||||
/* something is buggy here...
|
||||
/* something is buggy here...
|
||||
* sometimes items appear duplicated, and other times not */
|
||||
QLayoutItem *item = m_formLayout->itemAt(0);
|
||||
QWidget *w = NULL;
|
||||
|
@ -455,7 +455,7 @@ QColor getLabelColor(const QString& objectName)
|
|||
QLabel dummyColor;
|
||||
dummyColor.setObjectName(objectName);
|
||||
dummyColor.ensurePolished();
|
||||
return dummyColor.palette().color(QPalette::Foreground);
|
||||
return dummyColor.palette().color(QPalette::WindowText);
|
||||
}
|
||||
|
||||
/* stolen from Qt Creator */
|
||||
|
@ -482,7 +482,7 @@ private:
|
|||
|
||||
/* Widget wants to be bigger than available space */
|
||||
if (innerSizeHint.height() > innerSize.height())
|
||||
{
|
||||
{
|
||||
innerSize.setWidth(innerSize.width() - scrollBarWidth());
|
||||
innerSize.setHeight(innerSizeHint.height());
|
||||
}
|
||||
|
@ -536,14 +536,18 @@ ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) :
|
|||
int width;
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
QLabel *m_headerLabel = new QLabel(this);
|
||||
/* Header label with large font and a bit of spacing
|
||||
/* Header label with large font and a bit of spacing
|
||||
* (align with group boxes) */
|
||||
QFont headerLabelFont = m_headerLabel->font();
|
||||
const int pointSize = headerLabelFont.pointSize();
|
||||
QHBoxLayout *headerHLayout = new QHBoxLayout;
|
||||
const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
m_optionsStack->setContentsMargins(0, 0, 0, 0);
|
||||
#else
|
||||
m_optionsStack->setMargin(0);
|
||||
#endif
|
||||
|
||||
headerLabelFont.setBold(true);
|
||||
|
||||
|
@ -576,9 +580,9 @@ ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) :
|
|||
addCategory(new UserCategory(this));
|
||||
addCategory(new DirectoryCategory(this));
|
||||
|
||||
width =
|
||||
m_optionsList->sizeHintForColumn(0)
|
||||
+ m_optionsList->frameWidth() * 2
|
||||
width =
|
||||
m_optionsList->sizeHintForColumn(0)
|
||||
+ m_optionsList->frameWidth() * 2
|
||||
+ 5;
|
||||
width += m_optionsList->verticalScrollBar()->sizeHint().width();
|
||||
|
||||
|
@ -601,9 +605,9 @@ QIcon getIcon(OptionsCategory *category)
|
|||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_dir_assets = settings->paths.directory_assets;
|
||||
QPixmap pixmap = QPixmap(QString(path_dir_assets)
|
||||
+ "/xmb/monochrome/png/"
|
||||
+ category->categoryIconName()
|
||||
QPixmap pixmap = QPixmap(QString(path_dir_assets)
|
||||
+ "/xmb/monochrome/png/"
|
||||
+ category->categoryIconName()
|
||||
+ ".png");
|
||||
return QIcon(getColorizedPixmap(pixmap, getLabelColor("iconColor")));
|
||||
}
|
||||
|
@ -728,7 +732,7 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) :
|
|||
|
||||
m_thumbnailCacheSpinBox->setSuffix(" MB");
|
||||
m_thumbnailCacheSpinBox->setRange(0, 99999);
|
||||
|
||||
|
||||
m_thumbnailDropSizeSpinBox->setSuffix(" px");
|
||||
m_thumbnailDropSizeSpinBox->setRange(0, 99999);
|
||||
|
||||
|
@ -825,7 +829,7 @@ void ViewOptionsWidget::loadViewOptions()
|
|||
int i;
|
||||
int themeIndex = 0;
|
||||
int playlistIndex = 0;
|
||||
QColor highlightColor =
|
||||
QColor highlightColor =
|
||||
m_settings->value("highlight_color",
|
||||
QApplication::palette().highlight().color()).value<QColor>();
|
||||
QPixmap highlightPixmap(m_highlightColorPushButton->iconSize());
|
||||
|
@ -1144,9 +1148,9 @@ void CoreOptionsDialog::buildLayout()
|
|||
|
||||
for (j = 0; j < opts; j++)
|
||||
{
|
||||
QString desc =
|
||||
QString desc =
|
||||
core_option_manager_get_desc(coreopts, j, false);
|
||||
QString val =
|
||||
QString val =
|
||||
core_option_manager_get_val(coreopts, j);
|
||||
QComboBox *combo_box = NULL;
|
||||
QLabel *descLabel = NULL;
|
||||
|
@ -1193,7 +1197,12 @@ void CoreOptionsDialog::buildLayout()
|
|||
}
|
||||
|
||||
for (k = 0; k < option->vals->size; k++)
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
combo_box->addItem(option->vals->elems[k].data, QVariant::fromValue(option->key));
|
||||
#else
|
||||
combo_box->addItem(option->vals->elems[k].data, option->key);
|
||||
#endif
|
||||
|
||||
|
||||
combo_box->setCurrentText(val);
|
||||
combo_box->setProperty("default_index",
|
||||
|
@ -1481,7 +1490,7 @@ void ShaderParamsDialog::onFilterComboBoxIndexChanged(int)
|
|||
if (!ok)
|
||||
return;
|
||||
|
||||
if ( menu_shader
|
||||
if ( menu_shader
|
||||
&& (pass >= 0)
|
||||
&& (pass < static_cast<int>(menu_shader->passes)))
|
||||
{
|
||||
|
@ -1742,23 +1751,23 @@ void ShaderParamsDialog::onShaderLoadPresetClicked()
|
|||
|
||||
filter.append("Shader Preset (");
|
||||
|
||||
/* NOTE: Maybe we should have a way to get a list
|
||||
/* NOTE: Maybe we should have a way to get a list
|
||||
* of all shader types instead of hard-coding this? */
|
||||
if (video_shader_is_supported(RARCH_SHADER_CG))
|
||||
{
|
||||
filter.append(QLatin1Literal(" *"));
|
||||
filter.append(QLatin1String(" *"));
|
||||
filter.append(".cgp");
|
||||
}
|
||||
|
||||
if (video_shader_is_supported(RARCH_SHADER_GLSL))
|
||||
{
|
||||
filter.append(QLatin1Literal(" *"));
|
||||
filter.append(QLatin1String(" *"));
|
||||
filter.append(".glslp");
|
||||
}
|
||||
|
||||
if (video_shader_is_supported(RARCH_SHADER_SLANG))
|
||||
{
|
||||
filter.append(QLatin1Literal(" *"));
|
||||
filter.append(QLatin1String(" *"));
|
||||
filter.append(".slangp");
|
||||
}
|
||||
|
||||
|
@ -1901,16 +1910,16 @@ void ShaderParamsDialog::onShaderAddPassClicked()
|
|||
|
||||
filter.append("Shader (");
|
||||
|
||||
/* NOTE: Maybe we should have a way to get a list
|
||||
/* NOTE: Maybe we should have a way to get a list
|
||||
* of all shader types instead of hard-coding this? */
|
||||
if (video_shader_is_supported(RARCH_SHADER_CG))
|
||||
filter.append(QLatin1Literal(" *.cg"));
|
||||
filter.append(QLatin1String(" *.cg"));
|
||||
|
||||
if (video_shader_is_supported(RARCH_SHADER_GLSL))
|
||||
filter.append(QLatin1Literal(" *.glsl"));
|
||||
filter.append(QLatin1String(" *.glsl"));
|
||||
|
||||
if (video_shader_is_supported(RARCH_SHADER_SLANG))
|
||||
filter.append(QLatin1Literal(" *.slang"));
|
||||
filter.append(QLatin1String(" *.slang"));
|
||||
|
||||
filter.append(")");
|
||||
|
||||
|
@ -2181,28 +2190,28 @@ void ShaderParamsDialog::updateRemovePresetButtonsState()
|
|||
menu_shader_manager_auto_preset_exists(
|
||||
SHADER_PRESET_GLOBAL,
|
||||
path_dir_video_shader,
|
||||
path_dir_menu_config
|
||||
path_dir_menu_config
|
||||
));
|
||||
if (removeCorePresetAction)
|
||||
removeCorePresetAction->setEnabled(
|
||||
menu_shader_manager_auto_preset_exists(
|
||||
SHADER_PRESET_CORE,
|
||||
path_dir_video_shader,
|
||||
path_dir_menu_config
|
||||
path_dir_menu_config
|
||||
));
|
||||
if (removeParentPresetAction)
|
||||
removeParentPresetAction->setEnabled(
|
||||
menu_shader_manager_auto_preset_exists(
|
||||
SHADER_PRESET_PARENT,
|
||||
path_dir_video_shader,
|
||||
path_dir_menu_config
|
||||
path_dir_menu_config
|
||||
));
|
||||
if (removeGamePresetAction)
|
||||
removeGamePresetAction->setEnabled(
|
||||
menu_shader_manager_auto_preset_exists(
|
||||
SHADER_PRESET_GAME,
|
||||
path_dir_video_shader,
|
||||
path_dir_menu_config
|
||||
path_dir_menu_config
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -2235,14 +2244,14 @@ void ShaderParamsDialog::buildLayout()
|
|||
|
||||
getShaders(&menu_shader, &video_shader);
|
||||
|
||||
/* NOTE: For some reason, menu_shader_get() returns a COPY
|
||||
/* NOTE: For some reason, menu_shader_get() returns a COPY
|
||||
* of what get_current_shader() gives us.
|
||||
* And if you want to be able to change shader settings/parameters
|
||||
* And if you want to be able to change shader settings/parameters
|
||||
* from both the raster menu and
|
||||
* Qt at the same time... you must change BOTH or one will
|
||||
* Qt at the same time... you must change BOTH or one will
|
||||
* overwrite the other.
|
||||
*
|
||||
* AND, during a context reset, video_shader will be NULL
|
||||
* AND, during a context reset, video_shader will be NULL
|
||||
* but not menu_shader, so don't totally bail
|
||||
* just because video_shader is NULL.
|
||||
*
|
||||
|
@ -2256,7 +2265,7 @@ void ShaderParamsDialog::buildLayout()
|
|||
if (video_shader->passes == 0)
|
||||
setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS));
|
||||
}
|
||||
/* Normally we'd only use video_shader,
|
||||
/* Normally we'd only use video_shader,
|
||||
* but the Vulkan driver returns a NULL shader when there
|
||||
* are zero passes, so just fall back to menu_shader.
|
||||
*/
|
||||
|
@ -2278,7 +2287,7 @@ void ShaderParamsDialog::buildLayout()
|
|||
|
||||
clearLayout();
|
||||
|
||||
/* Only check video_shader for the path, menu_shader seems stale...
|
||||
/* Only check video_shader for the path, menu_shader seems stale...
|
||||
* e.g. if you remove all the shader passes,
|
||||
* it still has the old path in it, but video_shader does not
|
||||
*/
|
||||
|
|
|
@ -549,8 +549,12 @@ QGroupBox *NetplayPage::createMitmServerGroup()
|
|||
|
||||
groupBox->add(MENU_ENUM_LABEL_NETPLAY_CUSTOM_MITM_SERVER);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
connect(buttonGroup, &QButtonGroup::idClicked, this, &NetplayPage::onRadioButtonClicked);
|
||||
#else
|
||||
connect(buttonGroup, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(onRadioButtonClicked(int)));
|
||||
#endif
|
||||
|
||||
return groupBox;
|
||||
}
|
||||
|
@ -1439,7 +1443,13 @@ QWidget *VideoPage::widget()
|
|||
|
||||
layout->addStretch();
|
||||
|
||||
connect(m_resolutionCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onResolutionComboIndexChanged(const QString&)));
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
void (VideoPage::*cb)(int) = &VideoPage::onResolutionComboIndexChanged;
|
||||
connect(m_resolutionCombo, &QComboBox::currentIndexChanged, this, cb);
|
||||
#else
|
||||
connect(m_resolutionCombo, SIGNAL(currentIndexChanged(const QString&)), this,
|
||||
SLOT(onResolutionComboIndexChanged(const QString&)));
|
||||
#endif
|
||||
|
||||
widget->setLayout(layout);
|
||||
|
||||
|
@ -1574,6 +1584,14 @@ void VideoPage::onResolutionComboIndexChanged(const QString &text)
|
|||
NULL, 0, 0, 0);
|
||||
}
|
||||
|
||||
void VideoPage::onResolutionComboIndexChanged(int index)
|
||||
{
|
||||
const QString& text = m_resolutionCombo->itemText(index);
|
||||
const char *path = text.toUtf8().constData();
|
||||
action_cb_push_dropdown_item_resolution(path,
|
||||
NULL, 0, 0, 0);
|
||||
}
|
||||
|
||||
void CrtSwitchresPage::onCrtSuperResolutionComboIndexChanged(int index)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
};
|
||||
|
||||
/***********************************************************
|
||||
AI Service
|
||||
AI Service
|
||||
************************************************************/
|
||||
class AIServiceCategory : public OptionsCategory
|
||||
{
|
||||
|
@ -154,7 +154,8 @@ public:
|
|||
VideoPage(QObject *parent = nullptr);
|
||||
QWidget *widget();
|
||||
private slots:
|
||||
void onResolutionComboIndexChanged(const QString& value);
|
||||
Q_DECL_DEPRECATED void onResolutionComboIndexChanged(const QString& value);
|
||||
void onResolutionComboIndexChanged(int index);
|
||||
private:
|
||||
QComboBox *m_resolutionCombo;
|
||||
};
|
||||
|
|
|
@ -246,7 +246,11 @@ void PlaylistModel::loadThumbnail(const QModelIndex &index)
|
|||
if (!m_pendingImages.contains(path) && !m_cache.contains(path))
|
||||
{
|
||||
m_pendingImages.insert(path);
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
QtConcurrent::run(&PlaylistModel::loadImage, this, index, path);
|
||||
#else
|
||||
QtConcurrent::run(this, &PlaylistModel::loadImage, index, path);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,7 +570,7 @@ void MainWindow::addFilesToPlaylist(QStringList files)
|
|||
* automatically in setValue() */
|
||||
dialog->setValue(i + 1);
|
||||
|
||||
fileInfo = fileName;
|
||||
fileInfo = QFileInfo(fileName);
|
||||
|
||||
/* Make sure we're looking at a user-specified field
|
||||
* and not just "<multiple>"
|
||||
|
@ -874,7 +878,11 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
|||
for (j = 0; j < m_listWidget->count(); j++)
|
||||
{
|
||||
QListWidgetItem *item = m_listWidget->item(j);
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
bool hidden = item->isHidden();
|
||||
#else
|
||||
bool hidden = m_listWidget->isItemHidden(item);
|
||||
#endif
|
||||
|
||||
if (hidden)
|
||||
{
|
||||
|
@ -1168,19 +1176,19 @@ void MainWindow::reloadPlaylists()
|
|||
allPlaylistsItem->setData(Qt::UserRole, ALL_PLAYLISTS_TOKEN);
|
||||
|
||||
favoritesPlaylistsItem = new QListWidgetItem(m_folderIcon, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES_TAB));
|
||||
favoritesPlaylistsItem->setData(Qt::UserRole, settings->paths.path_content_favorites);
|
||||
favoritesPlaylistsItem->setData(Qt::UserRole, QString(settings->paths.path_content_favorites));
|
||||
|
||||
m_historyPlaylistsItem = new QListWidgetItem(m_folderIcon, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_HISTORY_TAB));
|
||||
m_historyPlaylistsItem->setData(Qt::UserRole, settings->paths.path_content_history);
|
||||
m_historyPlaylistsItem->setData(Qt::UserRole, QString(settings->paths.path_content_history));
|
||||
|
||||
imagePlaylistsItem = new QListWidgetItem(m_folderIcon, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_IMAGES_TAB));
|
||||
imagePlaylistsItem->setData(Qt::UserRole, settings->paths.path_content_image_history);
|
||||
imagePlaylistsItem->setData(Qt::UserRole, QString(settings->paths.path_content_image_history));
|
||||
|
||||
musicPlaylistsItem = new QListWidgetItem(m_folderIcon, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MUSIC_TAB));
|
||||
musicPlaylistsItem->setData(Qt::UserRole, settings->paths.path_content_music_history);
|
||||
musicPlaylistsItem->setData(Qt::UserRole, QString(settings->paths.path_content_music_history));
|
||||
|
||||
videoPlaylistsItem = new QListWidgetItem(m_folderIcon, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_TAB));
|
||||
videoPlaylistsItem->setData(Qt::UserRole, settings->paths.path_content_video_history);
|
||||
videoPlaylistsItem->setData(Qt::UserRole, QString(settings->paths.path_content_video_history));
|
||||
|
||||
m_listWidget->addItem(allPlaylistsItem);
|
||||
m_listWidget->addItem(favoritesPlaylistsItem);
|
||||
|
@ -1491,7 +1499,7 @@ void PlaylistModel::getPlaylistItems(QString path)
|
|||
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);
|
||||
|
||||
pathArray.append(path);
|
||||
pathArray.append(path.toUtf8());
|
||||
pathData = pathArray.constData();
|
||||
if (!string_is_empty(pathData))
|
||||
playlistName = path_basename(pathData);
|
||||
|
|
|
@ -724,7 +724,11 @@ UIntRadioButtons::UIntRadioButtons(rarch_setting_t *setting, QWidget *parent) :
|
|||
*setting->value.target.unsigned_integer = orig_value;
|
||||
}
|
||||
add_sublabel_and_whats_this(this, m_setting);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
connect(m_buttonGroup, &QButtonGroup::idClicked, this, &UIntRadioButtons::onButtonClicked);
|
||||
#else
|
||||
connect(m_buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(onButtonClicked(int)));
|
||||
#endif
|
||||
}
|
||||
|
||||
UIntRadioButtons::UIntRadioButtons(msg_hash_enums enum_idx, QWidget *parent) :
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtCore/QString>
|
||||
#include <QDesktopWidget>
|
||||
#include <QtGlobal>
|
||||
#include <QCloseEvent>
|
||||
#include <QResizeEvent>
|
||||
|
@ -1217,7 +1216,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
,m_thumbnailTimer(new QTimer(this))
|
||||
,m_gridItem(this)
|
||||
,m_currentBrowser(BROWSER_TYPE_PLAYLISTS)
|
||||
,m_searchRegExp()
|
||||
,m_searchRegularExpression()
|
||||
,m_zoomWidget(new QWidget(this))
|
||||
,m_itemsCountLiteral(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ITEMS_COUNT))
|
||||
,m_itemsCountLabel(new QLabel(this))
|
||||
|
@ -1905,7 +1904,11 @@ void MainWindow::onFileBrowserTreeContextMenuRequested(const QPoint&)
|
|||
if (currentDirString.isEmpty())
|
||||
return;
|
||||
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
dir.setPath(currentDirString);
|
||||
#else
|
||||
dir = currentDirString;
|
||||
#endif
|
||||
|
||||
if (!dir.exists())
|
||||
return;
|
||||
|
@ -2619,9 +2622,9 @@ void MainWindow::selectBrowserDir(QString path)
|
|||
/* the directory is filtered out. Remove the filter for a moment.
|
||||
* FIXME: Find a way to not have to do this
|
||||
* (not filtering dirs is one). */
|
||||
m_proxyFileModel->setFilterRegExp(QRegExp());
|
||||
m_proxyFileModel->setFilterRegularExpression(QRegularExpression());
|
||||
m_fileTableView->setRootIndex(m_proxyFileModel->mapFromSource(sourceIndex));
|
||||
m_proxyFileModel->setFilterRegExp(m_searchRegExp);
|
||||
m_proxyFileModel->setFilterRegularExpression(m_searchRegularExpression);
|
||||
}
|
||||
}
|
||||
setCoreActions();
|
||||
|
@ -3108,8 +3111,13 @@ void MainWindow::setCoreActions()
|
|||
if (!found_existing)
|
||||
{
|
||||
QVariantMap comboBoxMap;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
comboBoxMap["core_name"] = QVariant::fromValue(coreInfo->core_name);
|
||||
comboBoxMap["core_path"] = QVariant::fromValue(coreInfo->path);
|
||||
#else
|
||||
comboBoxMap["core_name"] = coreInfo->core_name;
|
||||
comboBoxMap["core_path"] = coreInfo->path;
|
||||
#endif
|
||||
comboBoxMap["core_selection"] = CORE_SELECTION_PLAYLIST_DEFAULT;
|
||||
m_launchWithComboBox->addItem(coreInfo->core_name, QVariant::fromValue(comboBoxMap));
|
||||
}
|
||||
|
@ -3179,8 +3187,8 @@ QComboBox* MainWindow::launchWithComboBox()
|
|||
void MainWindow::onSearchLineEditEdited(const QString &text)
|
||||
{
|
||||
int i;
|
||||
QVector<unsigned> textHiraToKata;
|
||||
QVector<unsigned> textKataToHira;
|
||||
QVector<char32_t> textHiraToKata;
|
||||
QVector<char32_t> textKataToHira;
|
||||
QVector<unsigned> textUnicode = text.toUcs4();
|
||||
bool found_hiragana = false;
|
||||
bool found_katakana = false;
|
||||
|
@ -3207,21 +3215,21 @@ void MainWindow::onSearchLineEditEdited(const QString &text)
|
|||
}
|
||||
|
||||
if (!found_hiragana && !found_katakana)
|
||||
m_searchRegExp = QRegExp(text, Qt::CaseInsensitive);
|
||||
m_searchRegularExpression = QRegularExpression(text, QRegularExpression::CaseInsensitiveOption);
|
||||
else if (found_hiragana && !found_katakana)
|
||||
m_searchRegExp = QRegExp(text + "|"
|
||||
m_searchRegularExpression = QRegularExpression(text + "|"
|
||||
+ QString::fromUcs4(textHiraToKata.constData(),
|
||||
textHiraToKata.size()), Qt::CaseInsensitive);
|
||||
textHiraToKata.size()), QRegularExpression::CaseInsensitiveOption);
|
||||
else if (!found_hiragana && found_katakana)
|
||||
m_searchRegExp = QRegExp(text + "|"
|
||||
m_searchRegularExpression = QRegularExpression(text + "|"
|
||||
+ QString::fromUcs4(textKataToHira.constData(),
|
||||
textKataToHira.size()), Qt::CaseInsensitive);
|
||||
textKataToHira.size()), QRegularExpression::CaseInsensitiveOption);
|
||||
else
|
||||
m_searchRegExp = QRegExp(text + "|"
|
||||
m_searchRegularExpression = QRegularExpression(text + "|"
|
||||
+ QString::fromUcs4(textHiraToKata.constData(),
|
||||
textHiraToKata.size()) + "|" +
|
||||
QString::fromUcs4(textKataToHira.constData(),
|
||||
textKataToHira.size()), Qt::CaseInsensitive);
|
||||
textKataToHira.size()), QRegularExpression::CaseInsensitiveOption);
|
||||
|
||||
applySearch();
|
||||
}
|
||||
|
@ -3231,15 +3239,15 @@ void MainWindow::applySearch()
|
|||
switch (m_currentBrowser)
|
||||
{
|
||||
case BROWSER_TYPE_PLAYLISTS:
|
||||
if (m_proxyModel->filterRegExp() != m_searchRegExp)
|
||||
if (m_proxyModel->filterRegularExpression() != m_searchRegularExpression)
|
||||
{
|
||||
m_proxyModel->setFilterRegExp(m_searchRegExp);
|
||||
m_proxyModel->setFilterRegularExpression(m_searchRegularExpression);
|
||||
updateItemsCount();
|
||||
}
|
||||
break;
|
||||
case BROWSER_TYPE_FILES:
|
||||
if (m_proxyFileModel->filterRegExp() != m_searchRegExp)
|
||||
m_proxyFileModel->setFilterRegExp(m_searchRegExp);
|
||||
if (m_proxyFileModel->filterRegularExpression() != m_searchRegularExpression)
|
||||
m_proxyFileModel->setFilterRegularExpression(m_searchRegularExpression);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3357,7 +3365,7 @@ void MainWindow::renamePlaylistItem(QListWidgetItem *item, QString newName)
|
|||
return;
|
||||
|
||||
playlistPath = item->data(Qt::UserRole).toString();
|
||||
playlistInfo = playlistPath;
|
||||
playlistInfo = QFileInfo(playlistPath);
|
||||
oldName = playlistInfo.completeBaseName();
|
||||
|
||||
/* Don't just compare strings in case there are
|
||||
|
@ -3379,7 +3387,7 @@ void MainWindow::renamePlaylistItem(QListWidgetItem *item, QString newName)
|
|||
oldPath = item->data(Qt::UserRole).toString();
|
||||
|
||||
file.setFileName(oldPath);
|
||||
info = file;
|
||||
info = QFileInfo(file);
|
||||
|
||||
extension = info.suffix();
|
||||
|
||||
|
@ -4217,7 +4225,7 @@ static void* ui_application_qt_initialize(void)
|
|||
|
||||
app_handler = new AppHandler();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
/* HiDpi supported since Qt 5.6 */
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
@ -4261,9 +4269,11 @@ static void* ui_application_qt_initialize(void)
|
|||
|
||||
static void ui_application_qt_process_events(void)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QAbstractEventDispatcher *dispatcher = QApplication::eventDispatcher();
|
||||
if (dispatcher && dispatcher->hasPendingEvents())
|
||||
QApplication::processEvents();
|
||||
#endif
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
static void ui_application_qt_quit(void)
|
||||
|
@ -4316,6 +4326,8 @@ typedef struct ui_companion_qt
|
|||
ui_window_qt_t *window;
|
||||
} ui_companion_qt_t;
|
||||
|
||||
ThumbnailWidget::ThumbnailWidget(QWidget *parent) { }
|
||||
|
||||
ThumbnailWidget::ThumbnailWidget(ThumbnailType type, QWidget *parent) :
|
||||
QStackedWidget(parent)
|
||||
,m_thumbnailType(type)
|
||||
|
@ -4499,7 +4511,7 @@ static void* ui_companion_qt_init(void)
|
|||
QVBoxLayout *launchWithWidgetLayout = NULL;
|
||||
QHBoxLayout *coreComboBoxLayout = NULL;
|
||||
QMenuBar *menu = NULL;
|
||||
QDesktopWidget *desktop = NULL;
|
||||
QScreen *screen = NULL;
|
||||
QMenu *fileMenu = NULL;
|
||||
QMenu *editMenu = NULL;
|
||||
QMenu *viewMenu = NULL;
|
||||
|
@ -4542,8 +4554,8 @@ static void* ui_companion_qt_init(void)
|
|||
(ui_application_qt.initialize());
|
||||
handle->window = static_cast<ui_window_qt_t*>(ui_window_qt.init());
|
||||
|
||||
desktop = qApp->desktop();
|
||||
desktopRect = desktop->availableGeometry();
|
||||
screen = qApp->primaryScreen();
|
||||
desktopRect = screen->availableGeometry();
|
||||
|
||||
mainwindow = handle->window->qtWindow;
|
||||
|
||||
|
@ -5153,7 +5165,11 @@ void LoadCoreWindow::onCoreEnterPressed()
|
|||
Qt::UserRole).toHash();
|
||||
QString path = hash["path"].toString();
|
||||
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
|
||||
pathArray.append(path.toStdString());
|
||||
#else
|
||||
pathArray.append(path);
|
||||
#endif
|
||||
pathData = pathArray.constData();
|
||||
|
||||
loadCore(pathData);
|
||||
|
@ -5183,7 +5199,7 @@ void LoadCoreWindow::onLoadCustomCoreClicked()
|
|||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
pathArray.append(path);
|
||||
pathArray.append(path.toUtf8());
|
||||
pathData = pathArray.constData();
|
||||
|
||||
loadCore(pathData);
|
||||
|
@ -5195,7 +5211,7 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
|
|||
unsigned i;
|
||||
QStringList horizontal_header_labels;
|
||||
core_info_list_t *cores = NULL;
|
||||
QDesktopWidget *desktop = qApp->desktop();
|
||||
QScreen *desktop = qApp->primaryScreen();
|
||||
QRect desktopRect = desktop->availableGeometry();
|
||||
|
||||
horizontal_header_labels << msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NAME);
|
||||
|
@ -5229,7 +5245,7 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
|
|||
|
||||
name_item = new QTableWidgetItem(name);
|
||||
|
||||
hash["path"] = core->path;
|
||||
hash["path"] = QByteArray(core->path);
|
||||
hash["extensions"] = string_split_to_qt(QString(core->supported_extensions), '|');
|
||||
|
||||
name_item->setData(Qt::UserRole, hash);
|
||||
|
|
|
@ -634,7 +634,7 @@ private:
|
|||
QTimer *m_thumbnailTimer;
|
||||
GridItem m_gridItem;
|
||||
BrowserType m_currentBrowser;
|
||||
QRegExp m_searchRegExp;
|
||||
QRegularExpression m_searchRegularExpression;
|
||||
QByteArray m_fileTableHeaderState;
|
||||
QWidget *m_zoomWidget;
|
||||
QString m_itemsCountLiteral;
|
||||
|
|
Loading…
Reference in New Issue