From f27de28ee9709586c6a3a42ca996b59db096e08a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 24 Mar 2020 21:10:03 +0100 Subject: [PATCH] Qt: add open file location to screenshot preview Remove duplicate slash from screenshot path --- rpcs3/rpcs3qt/gs_frame.cpp | 2 +- rpcs3/rpcs3qt/screenshot_manager_dialog.cpp | 2 +- rpcs3/rpcs3qt/screenshot_preview.cpp | 3 ++- rpcs3/rpcs3qt/screenshot_preview.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index b576e22d5e..9fabd6312b 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -301,7 +301,7 @@ void gs_frame::take_screenshot(const std::vector sshot_data, const u32 sshot std::thread( [sshot_width, sshot_height](const std::vector sshot_data) { - std::string screen_path = fs::get_config_dir() + "/screenshots/"; + std::string screen_path = fs::get_config_dir() + "screenshots/"; if (!fs::create_dir(screen_path) && fs::g_tls_error != fs::error::exist) { diff --git a/rpcs3/rpcs3qt/screenshot_manager_dialog.cpp b/rpcs3/rpcs3qt/screenshot_manager_dialog.cpp index 0f8df5511e..58dff9597d 100644 --- a/rpcs3/rpcs3qt/screenshot_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/screenshot_manager_dialog.cpp @@ -21,7 +21,7 @@ screenshot_manager_dialog::screenshot_manager_dialog(QWidget* parent) : QDialog( m_grid->setIconSize(QSize(160, 90)); m_grid->setGridSize(m_grid->iconSize() + QSize(10, 10)); - const std::string screen_path = fs::get_config_dir() + "/screenshots/"; + const std::string screen_path = fs::get_config_dir() + "screenshots/"; const QStringList filter{ QStringLiteral("*.png") }; QDirIterator dir_iter(QString::fromStdString(screen_path), filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); diff --git a/rpcs3/rpcs3qt/screenshot_preview.cpp b/rpcs3/rpcs3qt/screenshot_preview.cpp index 979f38ebbc..f91ffe0732 100644 --- a/rpcs3/rpcs3qt/screenshot_preview.cpp +++ b/rpcs3/rpcs3qt/screenshot_preview.cpp @@ -27,13 +27,14 @@ screenshot_preview::screenshot_preview(const QString& filepath, QWidget* parent) connect(this, &screenshot_preview::customContextMenuRequested, this, &screenshot_preview::show_context_menu); } -#include void screenshot_preview::show_context_menu(const QPoint & pos) { QMenu* menu = new QMenu(); menu->addAction(tr("&Copy"), [this]() { QGuiApplication::clipboard()->setImage(m_image); }); menu->addSeparator(); + menu->addAction(tr("&Open file location"), [this]() { gui::utils::open_dir(m_filepath); }); + menu->addSeparator(); QAction* reset_act = menu->addAction(tr("To &Normal Size"), [this]() { scale(m_image.size()); }); reset_act->setEnabled(pixmap()->size() != m_image.size()); diff --git a/rpcs3/rpcs3qt/screenshot_preview.h b/rpcs3/rpcs3qt/screenshot_preview.h index f9a813997a..a02990a447 100644 --- a/rpcs3/rpcs3qt/screenshot_preview.h +++ b/rpcs3/rpcs3qt/screenshot_preview.h @@ -11,7 +11,7 @@ public: screenshot_preview(const QString& filepath, QWidget* parent = nullptr); protected: - void resizeEvent(QResizeEvent* event); + void resizeEvent(QResizeEvent* event) override; private Q_SLOTS: void show_context_menu(const QPoint& pos);