Use QString instead of std::string where applicable

This commit is contained in:
unknown 2019-02-08 14:18:41 +01:00
parent 996ddb202b
commit f27c65eb91

View file

@ -1071,21 +1071,16 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
ASSERT(program_id != 0); ASSERT(program_id != 0);
std::string transferable_shader_cache_file_path;
constexpr char open_target[] = "Transferable Shader Cache"; constexpr char open_target[] = "Transferable Shader Cache";
const std::string tranferable_shader_cache_folder = const QString tranferable_shader_cache_folder_path =
FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir) + "opengl" + DIR_SEP "transferable"; QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir)) + "opengl" +
DIR_SEP + "transferable";
transferable_shader_cache_file_path.append(tranferable_shader_cache_folder); const QString transferable_shader_cache_file_path =
transferable_shader_cache_file_path.append(DIR_SEP); tranferable_shader_cache_folder_path + DIR_SEP +
transferable_shader_cache_file_path.append(fmt::format("{:016X}", program_id)); QString::fromStdString(fmt::format("{:016X}", program_id)) + ".bin";
transferable_shader_cache_file_path.append(".bin");
const QString qpath_transferable_shader_cache_file = if (!QFile(transferable_shader_cache_file_path).exists()) {
QString::fromStdString(transferable_shader_cache_file_path);
const QFile qfile(qpath_transferable_shader_cache_file);
if (!qfile.exists()) {
QMessageBox::warning(this, QMessageBox::warning(this,
tr("Error Opening %1 File").arg(QString::fromStdString(open_target)), tr("Error Opening %1 File").arg(QString::fromStdString(open_target)),
tr("File does not exist!")); tr("File does not exist!"));
@ -1099,14 +1094,13 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const QString explorer = "explorer"; const QString explorer = "explorer";
QStringList param; QStringList param;
if (!QFileInfo(qpath_transferable_shader_cache_file).isDir()) if (!QFileInfo(transferable_shader_cache_file_path).isDir()) {
param << QLatin1String("/select,"); param << QLatin1String("/select,");
param << QDir::toNativeSeparators(qpath_transferable_shader_cache_file); }
param << QDir::toNativeSeparators(transferable_shader_cache_file_path);
QProcess::startDetached(explorer, param); QProcess::startDetached(explorer, param);
#else #else
const QString qpath_transferable_shader_cache_folder = QDesktopServices::openUrl(QUrl::fromLocalFile(tranferable_shader_cache_folder_path));
QString::fromStdString(tranferable_shader_cache_folder);
QDesktopServices::openUrl(QUrl::fromLocalFile(qpath_transferable_shader_cache_folder));
#endif #endif
} }