Compare commits

...

5 Commits

Author SHA1 Message Date
VolcaEM
72c4ca3253 Merge branch 'master' into open-configuration 2020-07-18 17:35:17 +02:00
VolcaEM
f517d37a4d Add missing function declaration 2020-07-11 16:15:50 +02:00
VolcaEM
97938c8681 Address review comments 2020-07-11 15:49:45 +02:00
VolcaEM
a58b671f88 Update game_list.cpp 2020-07-11 15:46:40 +02:00
VolcaEM
777e40cba3 Add a "Open Configuration" button 2020-07-11 15:39:56 +02:00
4 changed files with 41 additions and 13 deletions

View File

@@ -477,6 +477,7 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string pat
QAction* open_lfs_location = context_menu.addAction(tr("Open Mod Data Location"));
QAction* open_transferable_shader_cache =
context_menu.addAction(tr("Open Transferable Shader Cache"));
QAction* open_configuration = context_menu.addAction(tr("Open Config Location"));
context_menu.addSeparator();
QAction* dump_romfs = context_menu.addAction(tr("Dump RomFS"));
QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard"));
@@ -496,6 +497,8 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string pat
});
connect(open_transferable_shader_cache, &QAction::triggered,
[this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); });
connect(open_configuration, &QAction::triggered,
[this, program_id]() { emit OpenConfigurationRequested(program_id); });
connect(dump_romfs, &QAction::triggered,
[this, program_id, path]() { emit DumpRomFSRequested(program_id, path); });
connect(copy_tid, &QAction::triggered,

View File

@@ -75,6 +75,7 @@ signals:
void ShouldCancelWorker();
void OpenFolderRequested(GameListOpenTarget target, const std::string& game_path);
void OpenTransferableShaderCacheRequested(u64 program_id);
void OpenConfigurationRequested(u64 program_id);
void DumpRomFSRequested(u64 program_id, const std::string& game_path);
void CopyTIDRequested(u64 program_id);
void NavigateToGamedbEntryRequested(u64 program_id,

View File

@@ -847,6 +847,8 @@ void GMainWindow::ConnectWidgetEvents() {
connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder);
connect(game_list, &GameList::OpenTransferableShaderCacheRequested, this,
&GMainWindow::OnTransferableShaderCacheOpenFile);
connect(game_list, &GameList::OpenConfigurationRequested, this,
&GMainWindow::OnConfigurationOpenFile);
connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS);
connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID);
connect(game_list, &GameList::NavigateToGamedbEntryRequested, this,
@@ -1338,20 +1340,24 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
return;
}
// Windows supports opening a folder with selecting a specified file in explorer. On every other
// OS we just open the transferable shader cache folder without preselecting the transferable
// shader cache file for the selected game.
#if defined(Q_OS_WIN)
const QString explorer = QStringLiteral("explorer");
QStringList param;
if (!QFileInfo(transferable_shader_cache_file_path).isDir()) {
param << QStringLiteral("/select,");
OpenFolderSpecifyingFile(tranferable_shader_cache_folder_path);
}
void GMainWindow::OnConfigurationOpenFile(u64 program_id) {
ASSERT(program_id != 0);
const QString config_dir =
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir));
const QString config_file_path =
config_dir + QString::fromStdString(fmt::format("{:016X}.ini", program_id));
if (!QFile::exists(config_file_path)) {
QMessageBox::warning(this, tr("Error Opening Configuration"),
tr("A configuration file for this title does not exist."));
return;
}
param << QDir::toNativeSeparators(transferable_shader_cache_file_path);
QProcess::startDetached(explorer, param);
#else
QDesktopServices::openUrl(QUrl::fromLocalFile(tranferable_shader_cache_folder_path));
#endif
OpenFolderSpecifyingFile(config_file_path);
}
static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) {
@@ -1971,6 +1977,22 @@ void GMainWindow::OnOpenFAQ() {
OpenURL(QUrl(QStringLiteral("https://yuzu-emu.org/wiki/faq/")));
}
void GMainWindow::OpenFolderSpecifyingFile(const QString& file) {
// Windows supports opening a folder with selecting a specified file in explorer. On every other
// OS we just open the folder without preselecting the file.
#if defined(Q_OS_WIN)
const QString explorer = QStringLiteral("explorer");
QStringList param;
if (!QFileInfo(file).isDir()) {
param.push_back(QStringLiteral("/select,"));
}
param.push_back(QDir::toNativeSeparators(file));
QProcess::startDetached(explorer, param);
#else
QDesktopServices::openUrl(QUrl::fromLocalFile(file));
#endif
}
void GMainWindow::ToggleFullscreen() {
if (!emulation_running) {
return;

View File

@@ -198,6 +198,7 @@ private slots:
void OnGameListLoadFile(QString game_path);
void OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path);
void OnTransferableShaderCacheOpenFile(u64 program_id);
void OnConfigurationOpenFile(u64 program_id);
void OnGameListDumpRomFS(u64 program_id, const std::string& game_path);
void OnGameListCopyTID(u64 program_id);
void OnGameListNavigateToGamedbEntry(u64 program_id,
@@ -239,6 +240,7 @@ private:
void HideMouseCursor();
void ShowMouseCursor();
void OpenURL(const QUrl& url);
void OpenFolderSpecifyingFile(const QString& file);
void LoadTranslation();
Ui::MainWindow ui;