Qt: Improved the shown path in overlay message "Recording stopped"

This commit is contained in:
brian218 2022-12-09 22:58:15 +08:00 committed by Megamouse
parent bf37087a10
commit 681a6ef73c
1 changed files with 14 additions and 2 deletions

View File

@ -353,7 +353,19 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
gui_log.warning("The video provider could not release the image sink. A sink with higher priority must have been set."); gui_log.warning("The video provider could not release the image sink. A sink with higher priority must have been set.");
} }
rsx::overlays::queue_message(tr("Recording stopped: %0").arg(QString::fromStdString(m_video_encoder->path())).toStdString()); // Play a sound
if (const std::string sound_path = fs::get_config_dir() + "sounds/snd_recording.wav"; fs::is_file(sound_path))
{
QSound::play(qstr(sound_path));
}
else
{
QApplication::beep();
}
ensure(m_video_encoder->path().starts_with(fs::get_config_dir()));
const std::string shortpath = m_video_encoder->path().substr(fs::get_config_dir().size() - 1); // -1 for /
rsx::overlays::queue_message(tr("Recording saved: %0").arg(QString::fromStdString(shortpath)).toStdString());
} }
else else
{ {
@ -927,7 +939,7 @@ void gs_frame::take_screenshot(std::vector<u8> data, const u32 sshot_width, cons
} }
}); });
ensure(filename.find(fs::get_config_dir()) != filename.npos); ensure(filename.starts_with(fs::get_config_dir()));
const std::string shortpath = filename.substr(fs::get_config_dir().size() - 1); // -1 for / const std::string shortpath = filename.substr(fs::get_config_dir().size() - 1); // -1 for /
rsx::overlays::queue_message(tr("Screenshot saved: %0").arg(QString::fromStdString(shortpath)).toStdString()); rsx::overlays::queue_message(tr("Screenshot saved: %0").arg(QString::fromStdString(shortpath)).toStdString());