Merge pull request #7071 from spycrab/qt_gamelist_refresh
Qt: Add Refresh button
This commit is contained in:
commit
8675fa09b8
|
@ -27,6 +27,8 @@ GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent)
|
||||||
connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory);
|
connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory);
|
||||||
connect(&Settings::Instance(), &Settings::PathReloadRequested, &m_tracker,
|
connect(&Settings::Instance(), &Settings::PathReloadRequested, &m_tracker,
|
||||||
&GameTracker::ReloadDirectory);
|
&GameTracker::ReloadDirectory);
|
||||||
|
connect(&Settings::Instance(), &Settings::TitleDBReloadRequested, this,
|
||||||
|
[this] { m_title_database = Core::TitleDatabase(); });
|
||||||
|
|
||||||
for (const QString& dir : Settings::Instance().GetPaths())
|
for (const QString& dir : Settings::Instance().GetPaths())
|
||||||
m_tracker.AddDirectory(dir);
|
m_tracker.AddDirectory(dir);
|
||||||
|
|
|
@ -442,6 +442,7 @@ void MainWindow::ConnectToolBar()
|
||||||
addToolBar(m_tool_bar);
|
addToolBar(m_tool_bar);
|
||||||
|
|
||||||
connect(m_tool_bar, &ToolBar::OpenPressed, this, &MainWindow::Open);
|
connect(m_tool_bar, &ToolBar::OpenPressed, this, &MainWindow::Open);
|
||||||
|
connect(m_tool_bar, &ToolBar::RefreshPressed, this, &MainWindow::RefreshGameList);
|
||||||
|
|
||||||
connect(m_tool_bar, &ToolBar::PlayPressed, this, [this]() { Play(); });
|
connect(m_tool_bar, &ToolBar::PlayPressed, this, [this]() { Play(); });
|
||||||
connect(m_tool_bar, &ToolBar::PausePressed, this, &MainWindow::Pause);
|
connect(m_tool_bar, &ToolBar::PausePressed, this, &MainWindow::Pause);
|
||||||
|
@ -516,6 +517,14 @@ void MainWindow::ConnectStack()
|
||||||
tabifyDockWidget(m_log_widget, m_jit_widget);
|
tabifyDockWidget(m_log_widget, m_jit_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::RefreshGameList()
|
||||||
|
{
|
||||||
|
Settings::Instance().ReloadTitleDB();
|
||||||
|
|
||||||
|
for (const auto& path : Settings::Instance().GetPaths())
|
||||||
|
Settings::Instance().ReloadPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
QString MainWindow::PromptFileName()
|
QString MainWindow::PromptFileName()
|
||||||
{
|
{
|
||||||
return QFileDialog::getOpenFileName(
|
return QFileDialog::getOpenFileName(
|
||||||
|
|
|
@ -68,6 +68,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Open();
|
void Open();
|
||||||
|
void RefreshGameList();
|
||||||
void Play(const std::optional<std::string>& savestate_path = {});
|
void Play(const std::optional<std::string>& savestate_path = {});
|
||||||
void Pause();
|
void Pause();
|
||||||
void TogglePause();
|
void TogglePause();
|
||||||
|
|
|
@ -128,6 +128,11 @@ void Settings::ReloadPath(const QString& qpath)
|
||||||
emit PathReloadRequested(qpath);
|
emit PathReloadRequested(qpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::ReloadTitleDB()
|
||||||
|
{
|
||||||
|
emit TitleDBReloadRequested();
|
||||||
|
}
|
||||||
|
|
||||||
QString Settings::GetDefaultGame() const
|
QString Settings::GetDefaultGame() const
|
||||||
{
|
{
|
||||||
return QString::fromStdString(SConfig::GetInstance().m_strDefaultISO);
|
return QString::fromStdString(SConfig::GetInstance().m_strDefaultISO);
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
QString GetDefaultGame() const;
|
QString GetDefaultGame() const;
|
||||||
void SetDefaultGame(QString path);
|
void SetDefaultGame(QString path);
|
||||||
void ReloadPath(const QString& qpath);
|
void ReloadPath(const QString& qpath);
|
||||||
|
void ReloadTitleDB();
|
||||||
|
|
||||||
// Emulation
|
// Emulation
|
||||||
int GetStateSlot() const;
|
int GetStateSlot() const;
|
||||||
|
@ -135,6 +136,7 @@ signals:
|
||||||
void PathRemoved(const QString&);
|
void PathRemoved(const QString&);
|
||||||
void DefaultGameChanged(const QString&);
|
void DefaultGameChanged(const QString&);
|
||||||
void PathReloadRequested(const QString&);
|
void PathReloadRequested(const QString&);
|
||||||
|
void TitleDBReloadRequested();
|
||||||
void HideCursorChanged();
|
void HideCursorChanged();
|
||||||
void KeepWindowOnTopChanged(bool top);
|
void KeepWindowOnTopChanged(bool top);
|
||||||
void VolumeChanged(int volume);
|
void VolumeChanged(int volume);
|
||||||
|
|
|
@ -99,6 +99,10 @@ void ToolBar::MakeActions()
|
||||||
m_set_pc_action = AddAction(this, tr("Set PC"), this, &ToolBar::SetPCPressed);
|
m_set_pc_action = AddAction(this, tr("Set PC"), this, &ToolBar::SetPCPressed);
|
||||||
|
|
||||||
m_open_action = AddAction(this, tr("Open"), this, &ToolBar::OpenPressed);
|
m_open_action = AddAction(this, tr("Open"), this, &ToolBar::OpenPressed);
|
||||||
|
m_refresh_action = AddAction(this, tr("Refresh"), this, &ToolBar::RefreshPressed);
|
||||||
|
|
||||||
|
addSeparator();
|
||||||
|
|
||||||
m_pause_play_action = AddAction(this, tr("Play"), this, &ToolBar::PlayPressed);
|
m_pause_play_action = AddAction(this, tr("Play"), this, &ToolBar::PlayPressed);
|
||||||
|
|
||||||
m_stop_action = AddAction(this, tr("Stop"), this, &ToolBar::StopPressed);
|
m_stop_action = AddAction(this, tr("Stop"), this, &ToolBar::StopPressed);
|
||||||
|
@ -160,6 +164,7 @@ void ToolBar::UpdateIcons()
|
||||||
m_set_pc_action->setIcon(Resources::GetScaledThemeIcon("debugger_show_pc"));
|
m_set_pc_action->setIcon(Resources::GetScaledThemeIcon("debugger_show_pc"));
|
||||||
|
|
||||||
m_open_action->setIcon(Resources::GetScaledThemeIcon("open"));
|
m_open_action->setIcon(Resources::GetScaledThemeIcon("open"));
|
||||||
|
m_refresh_action->setIcon(Resources::GetScaledThemeIcon("refresh"));
|
||||||
|
|
||||||
const Core::State state = Core::GetState();
|
const Core::State state = Core::GetState();
|
||||||
const bool playing = state != Core::State::Uninitialized && state != Core::State::Paused;
|
const bool playing = state != Core::State::Uninitialized && state != Core::State::Paused;
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
signals:
|
signals:
|
||||||
void OpenPressed();
|
void OpenPressed();
|
||||||
|
void RefreshPressed();
|
||||||
void PlayPressed();
|
void PlayPressed();
|
||||||
void PausePressed();
|
void PausePressed();
|
||||||
void StopPressed();
|
void StopPressed();
|
||||||
|
@ -49,6 +50,7 @@ private:
|
||||||
void UpdatePausePlayButtonState(bool playing_state);
|
void UpdatePausePlayButtonState(bool playing_state);
|
||||||
|
|
||||||
QAction* m_open_action;
|
QAction* m_open_action;
|
||||||
|
QAction* m_refresh_action;
|
||||||
QAction* m_pause_play_action;
|
QAction* m_pause_play_action;
|
||||||
QAction* m_stop_action;
|
QAction* m_stop_action;
|
||||||
QAction* m_fullscreen_action;
|
QAction* m_fullscreen_action;
|
||||||
|
|
Loading…
Reference in New Issue