Qt: Hook up screenshot button. (#6070)

Qt: Implemented hotkey as well.
This commit is contained in:
arcum42 2022-05-12 14:53:40 -07:00 committed by GitHub
parent 9dd579a6d5
commit e456fb8f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -896,7 +896,8 @@ BEGIN_HOTKEY_LIST(g_host_hotkeys)
DEFINE_HOTKEY("Screenshot", "General", "Save Screenshot", [](bool pressed) { DEFINE_HOTKEY("Screenshot", "General", "Save Screenshot", [](bool pressed) {
if (!pressed) if (!pressed)
{ {
// TODO Host::AddOSDMessage("Saved Screenshot.", 10.0f);
GSmakeSnapshot(EmuFolders::Snapshots.ToString().char_str());
} }
}) })
DEFINE_HOTKEY("ShutdownVM", "System", "Shut Down Virtual Machine", [](bool pressed) { DEFINE_HOTKEY("ShutdownVM", "System", "Shut Down Virtual Machine", [](bool pressed) {

View File

@ -45,6 +45,8 @@
#include "Settings/InterfaceSettingsWidget.h" #include "Settings/InterfaceSettingsWidget.h"
#include "SettingWidgetBinder.h" #include "SettingWidgetBinder.h"
extern u32 GSmakeSnapshot(char* path);
static constexpr char DISC_IMAGE_FILTER[] = static constexpr char DISC_IMAGE_FILTER[] =
QT_TRANSLATE_NOOP("MainWindow", "All File Types (*.bin *.iso *.cue *.chd *.cso *.gz *.elf *.irx *.m3u *.gs *.gs.xz);;" QT_TRANSLATE_NOOP("MainWindow", "All File Types (*.bin *.iso *.cue *.chd *.cso *.gz *.elf *.irx *.m3u *.gs *.gs.xz);;"
"Single-Track Raw Images (*.bin *.iso);;" "Single-Track Raw Images (*.bin *.iso);;"
@ -148,6 +150,7 @@ void MainWindow::connectSignals()
connect(m_ui.actionLoadState, &QAction::triggered, this, [this]() { m_ui.menuLoadState->exec(QCursor::pos()); }); connect(m_ui.actionLoadState, &QAction::triggered, this, [this]() { m_ui.menuLoadState->exec(QCursor::pos()); });
connect(m_ui.actionSaveState, &QAction::triggered, this, [this]() { m_ui.menuSaveState->exec(QCursor::pos()); }); connect(m_ui.actionSaveState, &QAction::triggered, this, [this]() { m_ui.menuSaveState->exec(QCursor::pos()); });
connect(m_ui.actionExit, &QAction::triggered, this, &MainWindow::close); connect(m_ui.actionExit, &QAction::triggered, this, &MainWindow::close);
connect(m_ui.actionScreenshot, &QAction::triggered, this, &MainWindow::onScreenshotActionTriggered);
connect(m_ui.menuLoadState, &QMenu::aboutToShow, this, &MainWindow::onLoadStateMenuAboutToShow); connect(m_ui.menuLoadState, &QMenu::aboutToShow, this, &MainWindow::onLoadStateMenuAboutToShow);
connect(m_ui.menuSaveState, &QMenu::aboutToShow, this, &MainWindow::onSaveStateMenuAboutToShow); connect(m_ui.menuSaveState, &QMenu::aboutToShow, this, &MainWindow::onSaveStateMenuAboutToShow);
connect(m_ui.actionSettings, &QAction::triggered, [this]() { doSettings(); }); connect(m_ui.actionSettings, &QAction::triggered, [this]() { doSettings(); });
@ -509,6 +512,12 @@ void MainWindow::setIconThemeFromSettings()
QIcon::setThemeName(icon_theme); QIcon::setThemeName(icon_theme);
} }
void MainWindow::onScreenshotActionTriggered()
{
Host::AddOSDMessage("Saved Screenshot.", 10.0f);
GSmakeSnapshot(EmuFolders::Snapshots.ToString().char_str());
}
void MainWindow::saveStateToConfig() void MainWindow::saveStateToConfig()
{ {
{ {

View File

@ -133,6 +133,7 @@ private Q_SLOTS:
void onThemeChanged(); void onThemeChanged();
void onThemeChangedFromSettings(); void onThemeChangedFromSettings();
void onLoggingOptionChanged(); void onLoggingOptionChanged();
void onScreenshotActionTriggered();
void onVMStarting(); void onVMStarting();
void onVMStarted(); void onVMStarted();