mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 03:40:24 +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;
|
||||
QHash<QString, QString> hash;
|
||||
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_display_name"] = core->display_name;
|
||||
@ -278,8 +278,7 @@ const QStringList PlaylistEntryDialog::getSelectedExtensions()
|
||||
|
||||
/* Otherwise it would create a QStringList with a single blank entry... */
|
||||
if (!text.isEmpty())
|
||||
list = text.split(' ');
|
||||
|
||||
list = string_split_to_qt(text, ' ');
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QButtonGroup>
|
||||
|
||||
#include "settingswidgets.h"
|
||||
#include "../ui_qt.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -442,7 +443,7 @@ StringComboBox::StringComboBox(rarch_setting_t *setting, QWidget *parent) :
|
||||
,m_setting(setting)
|
||||
,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&)));
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "ui_qt_load_core_window.h"
|
||||
#include "../ui_qt.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QDesktopWidget>
|
||||
@ -235,8 +236,7 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
|
||||
name_item = new QTableWidgetItem(name);
|
||||
|
||||
hash["path"] = core->path;
|
||||
hash["extensions"] = QString(
|
||||
core->supported_extensions).split("|");
|
||||
hash["extensions"] = string_split_to_qt(QString(core->supported_extensions), '|');
|
||||
|
||||
name_item->setData(Qt::UserRole, hash);
|
||||
name_item->setFlags(name_item->flags() & ~Qt::ItemIsEditable);
|
||||
|
@ -764,3 +764,26 @@ ui_companion_driver_t ui_companion_qt = {
|
||||
&ui_application_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;
|
||||
} ui_window_qt_t;
|
||||
|
||||
QStringList string_split_to_qt(QString str, char delim);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user