mirror of
https://github.com/RPCS3/rpcs3
synced 2024-09-05 16:05:25 +00:00
Qt: Enable all play options for the last played game on StartUp
- main_window::CreateThumbnailToolbar into main_window::Init - also moved the log message for "Recent Game Not Valid" from Error to Warning (only the common occurance)
This commit is contained in:
parent
6b3eebc907
commit
4e8ce7fac0
|
@ -89,11 +89,6 @@ void rpcs3_app::Init()
|
|||
|
||||
RPCS3MainWin->Init();
|
||||
|
||||
RPCS3MainWin->show();
|
||||
|
||||
// Create the thumbnail toolbar after the main_window is created
|
||||
RPCS3MainWin->CreateThumbnailToolbar();
|
||||
|
||||
if (guiSettings->GetValue(gui::ib_show_welcome).toBool())
|
||||
{
|
||||
welcome_dialog* welcome = new welcome_dialog();
|
||||
|
|
|
@ -69,14 +69,6 @@ main_window::~main_window()
|
|||
#endif
|
||||
}
|
||||
|
||||
auto Pause = []()
|
||||
{
|
||||
if (Emu.IsReady()) Emu.Run();
|
||||
else if (Emu.IsPaused()) Emu.Resume();
|
||||
else if (Emu.IsRunning()) Emu.Pause();
|
||||
else if (!Emu.GetBoot().empty()) Emu.Load();
|
||||
};
|
||||
|
||||
/* An init method is used so that RPCS3App can create the necessary connects before calling init (specifically the stylesheet connect).
|
||||
* Simplifies logic a bit.
|
||||
*/
|
||||
|
@ -150,18 +142,29 @@ void main_window::Init()
|
|||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main_window::CreateThumbnailToolbar()
|
||||
{
|
||||
show(); // needs to be done before creating the thumbnail toolbar
|
||||
|
||||
// enable play options if a recent game exists
|
||||
const bool enable_play_last = !m_recentGameActs.isEmpty();
|
||||
|
||||
if (enable_play_last)
|
||||
{
|
||||
ui->sysPauseAct->setEnabled(true);
|
||||
ui->sysPauseAct->setText(tr("&Start last played game\tCtrl+E"));
|
||||
ui->toolbar_start->setToolTip(tr("Start last played game"));
|
||||
ui->toolbar_start->setEnabled(true);
|
||||
}
|
||||
|
||||
// create tool buttons for the taskbar thumbnail
|
||||
#ifdef _WIN32
|
||||
m_thumb_bar = new QWinThumbnailToolBar(this);
|
||||
m_thumb_bar->setWindow(windowHandle());
|
||||
|
||||
m_thumb_playPause = new QWinThumbnailToolButton(m_thumb_bar);
|
||||
m_thumb_playPause->setToolTip(tr("Pause"));
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_pause);
|
||||
m_thumb_playPause->setEnabled(false);
|
||||
m_thumb_playPause->setToolTip(enable_play_last ? tr("Start last played game") : tr("Start emulation"));
|
||||
m_thumb_playPause->setIcon(m_icon_thumb_play);
|
||||
m_thumb_playPause->setEnabled(enable_play_last);
|
||||
|
||||
m_thumb_stop = new QWinThumbnailToolButton(m_thumb_bar);
|
||||
m_thumb_stop->setToolTip(tr("Stop"));
|
||||
|
@ -181,7 +184,7 @@ void main_window::CreateThumbnailToolbar()
|
|||
|
||||
connect(m_thumb_stop, &QWinThumbnailToolButton::clicked, [=]() { Emu.Stop(); });
|
||||
connect(m_thumb_restart, &QWinThumbnailToolButton::clicked, [=]() { Emu.Restart(); });
|
||||
connect(m_thumb_playPause, &QWinThumbnailToolButton::clicked, Pause);
|
||||
connect(m_thumb_playPause, &QWinThumbnailToolButton::clicked, this, &main_window::OnPlayOrPause);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -235,6 +238,30 @@ void main_window::SetAppIconFromPath(const std::string& path)
|
|||
m_appIcon = QApplication::windowIcon();
|
||||
}
|
||||
|
||||
void main_window::OnPlayOrPause()
|
||||
{
|
||||
if (Emu.IsReady())
|
||||
{
|
||||
Emu.Run();
|
||||
}
|
||||
else if (Emu.IsPaused())
|
||||
{
|
||||
Emu.Resume();
|
||||
}
|
||||
else if (Emu.IsRunning())
|
||||
{
|
||||
Emu.Pause();
|
||||
}
|
||||
else if (!Emu.GetBoot().empty())
|
||||
{
|
||||
Emu.Load();
|
||||
}
|
||||
else if (Emu.IsStopped() && !m_recentGameActs.isEmpty())
|
||||
{
|
||||
BootRecentAction(m_recentGameActs.first());
|
||||
}
|
||||
}
|
||||
|
||||
void main_window::Boot(const std::string& path, bool direct, bool add_only)
|
||||
{
|
||||
SetAppIconFromPath(path);
|
||||
|
@ -926,7 +953,7 @@ QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint&
|
|||
{
|
||||
if (m_rg_entries.contains(entry))
|
||||
{
|
||||
LOG_ERROR(GENERAL, "Recent Game not valid, removing from Boot Recent list: %s", sstr(entry.first));
|
||||
LOG_WARNING(GENERAL, "Recent Game not valid, removing from Boot Recent list: %s", sstr(entry.first));
|
||||
|
||||
int idx = m_rg_entries.indexOf(entry);
|
||||
m_rg_entries.removeAt(idx);
|
||||
|
@ -1129,7 +1156,7 @@ void main_window::CreateConnects()
|
|||
connect(ui->bootInstallPkgAct, &QAction::triggered, [this] {InstallPkg(); });
|
||||
connect(ui->bootInstallPupAct, &QAction::triggered, [this] {InstallPup(); });
|
||||
connect(ui->exitAct, &QAction::triggered, this, &QWidget::close);
|
||||
connect(ui->sysPauseAct, &QAction::triggered, Pause);
|
||||
connect(ui->sysPauseAct, &QAction::triggered, this, &main_window::OnPlayOrPause);
|
||||
connect(ui->sysStopAct, &QAction::triggered, [=]() { Emu.Stop(); });
|
||||
connect(ui->sysRebootAct, &QAction::triggered, [=]() { Emu.Restart(); });
|
||||
|
||||
|
@ -1344,7 +1371,7 @@ void main_window::CreateConnects()
|
|||
connect(ui->toolbar_disc, &QAction::triggered, this, &main_window::BootGame);
|
||||
connect(ui->toolbar_refresh, &QAction::triggered, [=]() { m_gameListFrame->Refresh(true); });
|
||||
connect(ui->toolbar_stop, &QAction::triggered, [=]() { Emu.Stop(); });
|
||||
connect(ui->toolbar_start, &QAction::triggered, Pause);
|
||||
connect(ui->toolbar_start, &QAction::triggered, this, &main_window::OnPlayOrPause);
|
||||
|
||||
connect(ui->toolbar_fullscreen, &QAction::triggered, [=]
|
||||
{
|
||||
|
@ -1452,6 +1479,7 @@ void main_window::ConfigureGuiFromSettings(bool configure_all)
|
|||
ui->bootRecentMenu->removeAction(act);
|
||||
}
|
||||
m_recentGameActs.clear();
|
||||
|
||||
// Fill the recent games menu
|
||||
for (int i = 0; i < m_rg_entries.count(); i++)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
explicit main_window(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget *parent = 0);
|
||||
void Init();
|
||||
~main_window();
|
||||
void CreateThumbnailToolbar();
|
||||
QIcon GetAppIcon();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
@ -87,6 +86,7 @@ public Q_SLOTS:
|
|||
void RepaintGui();
|
||||
|
||||
private Q_SLOTS:
|
||||
void OnPlayOrPause();
|
||||
void Boot(const std::string& path, bool direct = false, bool add_only = false);
|
||||
void BootElf();
|
||||
void BootGame();
|
||||
|
|
Loading…
Reference in a new issue