Qt: Add cover refresh menu option
This commit is contained in:
parent
43b0d84a1d
commit
692c2d4aff
|
@ -97,6 +97,12 @@ void GameListModel::setCoverScale(float scale)
|
||||||
m_cover_scale = scale;
|
m_cover_scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameListModel::refreshCovers()
|
||||||
|
{
|
||||||
|
m_cover_pixmap_cache.clear();
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
int GameListModel::getCoverArtWidth() const
|
int GameListModel::getCoverArtWidth() const
|
||||||
{
|
{
|
||||||
return std::max(static_cast<int>(static_cast<float>(COVER_ART_WIDTH) * m_cover_scale), 1);
|
return std::max(static_cast<int>(static_cast<float>(COVER_ART_WIDTH) * m_cover_scale), 1);
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
int getCoverArtWidth() const;
|
int getCoverArtWidth() const;
|
||||||
int getCoverArtHeight() const;
|
int getCoverArtHeight() const;
|
||||||
int getCoverArtSpacing() const;
|
int getCoverArtSpacing() const;
|
||||||
|
void refreshCovers();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadCommonImages();
|
void loadCommonImages();
|
||||||
|
|
|
@ -92,8 +92,8 @@ void GameListWidget::initialize(QtHostInterface* host_interface)
|
||||||
|
|
||||||
connect(m_list_view->selectionModel(), &QItemSelectionModel::currentChanged, this,
|
connect(m_list_view->selectionModel(), &QItemSelectionModel::currentChanged, this,
|
||||||
&GameListWidget::onSelectionModelCurrentChanged);
|
&GameListWidget::onSelectionModelCurrentChanged);
|
||||||
connect(m_list_view, &GameListGridListView::zoomIn, this, &GameListWidget::listZoomIn);
|
connect(m_list_view, &GameListGridListView::zoomIn, this, &GameListWidget::gridZoomIn);
|
||||||
connect(m_list_view, &GameListGridListView::zoomOut, this, &GameListWidget::listZoomOut);
|
connect(m_list_view, &GameListGridListView::zoomOut, this, &GameListWidget::gridZoomOut);
|
||||||
connect(m_list_view, &QListView::doubleClicked, this, &GameListWidget::onListViewItemDoubleClicked);
|
connect(m_list_view, &QListView::doubleClicked, this, &GameListWidget::onListViewItemDoubleClicked);
|
||||||
connect(m_list_view, &QListView::customContextMenuRequested, this, &GameListWidget::onListViewContextMenuRequested);
|
connect(m_list_view, &QListView::customContextMenuRequested, this, &GameListWidget::onListViewContextMenuRequested);
|
||||||
|
|
||||||
|
@ -218,16 +218,21 @@ void GameListWidget::listZoom(float delta)
|
||||||
m_model->refresh();
|
m_model->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListWidget::listZoomIn()
|
void GameListWidget::gridZoomIn()
|
||||||
{
|
{
|
||||||
listZoom(0.05f);
|
listZoom(0.05f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListWidget::listZoomOut()
|
void GameListWidget::gridZoomOut()
|
||||||
{
|
{
|
||||||
listZoom(-0.05f);
|
listZoom(-0.05f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameListWidget::refreshGridCovers()
|
||||||
|
{
|
||||||
|
m_model->refreshCovers();
|
||||||
|
}
|
||||||
|
|
||||||
void GameListWidget::showGameList()
|
void GameListWidget::showGameList()
|
||||||
{
|
{
|
||||||
if (currentIndex() == 0)
|
if (currentIndex() == 0)
|
||||||
|
|
|
@ -60,8 +60,9 @@ public Q_SLOTS:
|
||||||
void showGameList();
|
void showGameList();
|
||||||
void showGameGrid();
|
void showGameGrid();
|
||||||
void setShowCoverTitles(bool enabled);
|
void setShowCoverTitles(bool enabled);
|
||||||
void listZoomIn();
|
void gridZoomIn();
|
||||||
void listZoomOut();
|
void gridZoomOut();
|
||||||
|
void refreshGridCovers();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event);
|
void resizeEvent(QResizeEvent* event);
|
||||||
|
|
|
@ -698,12 +698,14 @@ void MainWindow::connectSignals()
|
||||||
connect(m_ui.actionGridViewShowTitles, &QAction::triggered, m_game_list_widget, &GameListWidget::setShowCoverTitles);
|
connect(m_ui.actionGridViewShowTitles, &QAction::triggered, m_game_list_widget, &GameListWidget::setShowCoverTitles);
|
||||||
connect(m_ui.actionGridViewZoomIn, &QAction::triggered, m_game_list_widget, [this]() {
|
connect(m_ui.actionGridViewZoomIn, &QAction::triggered, m_game_list_widget, [this]() {
|
||||||
if (isShowingGameList())
|
if (isShowingGameList())
|
||||||
m_game_list_widget->listZoomIn();
|
m_game_list_widget->gridZoomIn();
|
||||||
});
|
});
|
||||||
connect(m_ui.actionGridViewZoomOut, &QAction::triggered, m_game_list_widget, [this]() {
|
connect(m_ui.actionGridViewZoomOut, &QAction::triggered, m_game_list_widget, [this]() {
|
||||||
if (isShowingGameList())
|
if (isShowingGameList())
|
||||||
m_game_list_widget->listZoomOut();
|
m_game_list_widget->gridZoomOut();
|
||||||
});
|
});
|
||||||
|
connect(m_ui.actionGridViewRefreshCovers, &QAction::triggered, m_game_list_widget,
|
||||||
|
&GameListWidget::refreshGridCovers);
|
||||||
|
|
||||||
connect(m_host_interface, &QtHostInterface::errorReported, this, &MainWindow::reportError,
|
connect(m_host_interface, &QtHostInterface::errorReported, this, &MainWindow::reportError,
|
||||||
Qt::BlockingQueuedConnection);
|
Qt::BlockingQueuedConnection);
|
||||||
|
|
|
@ -189,6 +189,7 @@
|
||||||
<addaction name="actionGridViewShowTitles"/>
|
<addaction name="actionGridViewShowTitles"/>
|
||||||
<addaction name="actionGridViewZoomIn"/>
|
<addaction name="actionGridViewZoomIn"/>
|
||||||
<addaction name="actionGridViewZoomOut"/>
|
<addaction name="actionGridViewZoomOut"/>
|
||||||
|
<addaction name="actionGridViewRefreshCovers"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Tools">
|
<widget class="QMenu" name="menu_Tools">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -658,7 +659,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionViewGameList">
|
<action name="actionViewGameList">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Game List</string>
|
<string>Game &List</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionViewSystemDisplay">
|
<action name="actionViewSystemDisplay">
|
||||||
|
@ -676,7 +677,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionViewGameGrid">
|
<action name="actionViewGameGrid">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Game Grid</string>
|
<string>Game &Grid</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionGridViewShowTitles">
|
<action name="actionGridViewShowTitles">
|
||||||
|
@ -692,7 +693,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionGridViewZoomIn">
|
<action name="actionGridViewZoomIn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Zoom In (Grid View)</string>
|
<string>Zoom &In (Grid View)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl++</string>
|
<string>Ctrl++</string>
|
||||||
|
@ -700,12 +701,17 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionGridViewZoomOut">
|
<action name="actionGridViewZoomOut">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Zoom Out (Grid View)</string>
|
<string>Zoom &Out (Grid View)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+-</string>
|
<string>Ctrl+-</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionGridViewRefreshCovers">
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh &Covers (Grid View)</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources/resources.qrc"/>
|
<include location="resources/resources.qrc"/>
|
||||||
|
|
Loading…
Reference in New Issue