mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-14 12:32:52 +00:00
game_list: Remove unnecessary conversion to std::string in ValidateEntry()
We can just use the file interfaces that Qt provides to prevent needing to convert to std::string.
This commit is contained in:
parent
a5ac53dd4c
commit
10d693b9c2
|
@ -258,18 +258,20 @@ void GameList::AddEntry(const QList<QStandardItem*>& entry_items) {
|
||||||
|
|
||||||
void GameList::ValidateEntry(const QModelIndex& item) {
|
void GameList::ValidateEntry(const QModelIndex& item) {
|
||||||
// We don't care about the individual QStandardItem that was selected, but its row.
|
// We don't care about the individual QStandardItem that was selected, but its row.
|
||||||
int row = item_model->itemFromIndex(item)->row();
|
const int row = item_model->itemFromIndex(item)->row();
|
||||||
QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME);
|
const QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME);
|
||||||
QString file_path = child_file->data(GameListItemPath::FullPathRole).toString();
|
const QString file_path = child_file->data(GameListItemPath::FullPathRole).toString();
|
||||||
|
|
||||||
if (file_path.isEmpty())
|
if (file_path.isEmpty())
|
||||||
return;
|
return;
|
||||||
std::string std_file_path(file_path.toStdString());
|
|
||||||
if (!FileUtil::Exists(std_file_path))
|
if (!QFileInfo::exists(file_path))
|
||||||
return;
|
return;
|
||||||
if (FileUtil::IsDirectory(std_file_path)) {
|
|
||||||
QDir dir(std_file_path.c_str());
|
const QFileInfo file_info{file_path};
|
||||||
QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
|
if (file_info.isDir()) {
|
||||||
|
const QDir dir{file_path};
|
||||||
|
const QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
|
||||||
if (matching_main.size() == 1) {
|
if (matching_main.size() == 1) {
|
||||||
emit GameChosen(dir.path() + DIR_SEP + matching_main[0]);
|
emit GameChosen(dir.path() + DIR_SEP + matching_main[0]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue