From 4689d26967160c2e968f4ccbfa507f47bd1a5cd8 Mon Sep 17 00:00:00 2001 From: Jonathan Goyvaerts Date: Sun, 23 Aug 2020 16:20:59 +0200 Subject: [PATCH] [Qt] Fix more Qt string conversions --- src/xenia/ui/qt/tabs/home_tab.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/xenia/ui/qt/tabs/home_tab.cc b/src/xenia/ui/qt/tabs/home_tab.cc index 155609673..86889a5f2 100644 --- a/src/xenia/ui/qt/tabs/home_tab.cc +++ b/src/xenia/ui/qt/tabs/home_tab.cc @@ -168,10 +168,6 @@ void HomeTab::PlayTriggered() { QString path = path_index.data().toString(); - /*wchar_t* title_w = new wchar_t[title.length() + 1]; - title.toWCharArray(title_w); - title_w[title.length()] = '\0';*/ - auto win = qobject_cast(window()); app::EmulatorWindow* wnd = new app::EmulatorWindow(win->loop(), ""); /*wnd->resize(1280, 720); @@ -187,14 +183,9 @@ void HomeTab::OpenFileTriggered() { this, "Open Game", "", tr("All Xbox 360 Files (*.xex *.iso);;Xbox 360 Executable (*.xex);;Disc Image (*.iso);;All Files (*)")); if (!file_name.isEmpty()) { - // this manual conversion seems to be required as Qt's std::(w)string impl - // and the one i've been linking to seem incompatible - wchar_t* path_w = new wchar_t[file_name.length() + 1]; - file_name.toWCharArray(path_w); - path_w[file_name.length()] = '\0'; XGameLibrary* lib = XGameLibrary::Instance(); - lib->ScanPath(path_w); + lib->ScanPath(file_name.toUtf8().constData()); list_view_->RefreshGameList(); } @@ -203,11 +194,6 @@ void HomeTab::OpenFileTriggered() { void HomeTab::ImportFolderTriggered() { QString path = QFileDialog::getExistingDirectory(this, "Open Folder", ""); if (!path.isEmpty()) { - // this manual conversion seems to be required as Qt's std::(w)string impl - // and the one i've been linking to seem incompatible - wchar_t* path_w = new wchar_t[path.length() + 1]; - path.toWCharArray(path_w); - path_w[path.length()] = '\0'; QWidget* progress_widget = new QWidget(); QHBoxLayout* layout = new QHBoxLayout(); @@ -232,7 +218,8 @@ void HomeTab::ImportFolderTriggered() { window->AddStatusBarWidget(progress_widget); XGameLibrary* lib = XGameLibrary::Instance(); - lib->ScanPathAsync(path_w, [=](double progress, const XGameEntry& entry) { + lib->ScanPathAsync(path.toUtf8().constData(), [=](double progress, + const XGameEntry& entry) { // update progress bar on main UI thread QMetaObject::invokeMethod( bar,