mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(Qt) Avoid QString::split - version incompatibilities
This commit is contained in:
parent
3fdf93a273
commit
00e840e99d
@ -141,7 +141,7 @@ void PlaylistEntryDialog::loadPlaylistOptions()
|
|||||||
QString ui_display_name;
|
QString ui_display_name;
|
||||||
QHash<QString, QString> hash;
|
QHash<QString, QString> hash;
|
||||||
const core_info_t *core = &core_info_list->list[i];
|
const core_info_t *core = &core_info_list->list[i];
|
||||||
QStringList databases = QString(core->databases).split("|");
|
QStringList databases = string_split_to_qt(QString(core->databases), '|');
|
||||||
|
|
||||||
hash["core_name"] = core->core_name;
|
hash["core_name"] = core->core_name;
|
||||||
hash["core_display_name"] = core->display_name;
|
hash["core_display_name"] = core->display_name;
|
||||||
@ -278,8 +278,7 @@ const QStringList PlaylistEntryDialog::getSelectedExtensions()
|
|||||||
|
|
||||||
/* Otherwise it would create a QStringList with a single blank entry... */
|
/* Otherwise it would create a QStringList with a single blank entry... */
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
list = text.split(' ');
|
list = string_split_to_qt(text, ' ');
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
|
||||||
#include "settingswidgets.h"
|
#include "settingswidgets.h"
|
||||||
|
#include "../ui_qt.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@ -442,7 +443,7 @@ StringComboBox::StringComboBox(rarch_setting_t *setting, QWidget *parent) :
|
|||||||
,m_setting(setting)
|
,m_setting(setting)
|
||||||
,m_value(setting->value.target.string)
|
,m_value(setting->value.target.string)
|
||||||
{
|
{
|
||||||
addItems(QString(setting->values).split("|"));
|
addItems(string_split_to_qt(QString(setting->values), '|'));
|
||||||
|
|
||||||
connect(this, SIGNAL(currentTextChanged(const QString&)), this, SLOT(onCurrentTextChanged(const QString&)));
|
connect(this, SIGNAL(currentTextChanged(const QString&)), this, SLOT(onCurrentTextChanged(const QString&)));
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ui_qt_load_core_window.h"
|
#include "ui_qt_load_core_window.h"
|
||||||
|
#include "../ui_qt.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
@ -235,8 +236,7 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
|
|||||||
name_item = new QTableWidgetItem(name);
|
name_item = new QTableWidgetItem(name);
|
||||||
|
|
||||||
hash["path"] = core->path;
|
hash["path"] = core->path;
|
||||||
hash["extensions"] = QString(
|
hash["extensions"] = string_split_to_qt(QString(core->supported_extensions), '|');
|
||||||
core->supported_extensions).split("|");
|
|
||||||
|
|
||||||
name_item->setData(Qt::UserRole, hash);
|
name_item->setData(Qt::UserRole, hash);
|
||||||
name_item->setFlags(name_item->flags() & ~Qt::ItemIsEditable);
|
name_item->setFlags(name_item->flags() & ~Qt::ItemIsEditable);
|
||||||
|
@ -764,3 +764,26 @@ ui_companion_driver_t ui_companion_qt = {
|
|||||||
&ui_application_qt,
|
&ui_application_qt,
|
||||||
"qt",
|
"qt",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QStringList string_split_to_qt(QString str, char delim)
|
||||||
|
{
|
||||||
|
int at;
|
||||||
|
QStringList list = QStringList();
|
||||||
|
|
||||||
|
for (at = 0;;)
|
||||||
|
{
|
||||||
|
/* Find next split */
|
||||||
|
int spl = str.indexOf(delim, at);
|
||||||
|
|
||||||
|
/* Store split into list of extensions */
|
||||||
|
list << str.mid(at, (spl < 0 ? str.length() : spl));
|
||||||
|
|
||||||
|
/* No more splits */
|
||||||
|
if (spl < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
at = spl + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
@ -678,6 +678,8 @@ typedef struct ui_window_qt
|
|||||||
MainWindow *qtWindow;
|
MainWindow *qtWindow;
|
||||||
} ui_window_qt_t;
|
} ui_window_qt_t;
|
||||||
|
|
||||||
|
QStringList string_split_to_qt(QString str, char delim);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user