Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11785 from shuffle2/qtnext3
DolphinQt: cache icons instead of single pixmaps
  • Loading branch information
AdmiralCurtiss committed Apr 29, 2023
2 parents 79607a0 + 51e528e commit 6e6865a
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 219 deletions.
Binary file removed Data/Sys/Resources/Dolphin.png
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/AboutDialog.cpp
Expand Up @@ -83,7 +83,7 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
"trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way.")));

QLabel* logo = new QLabel();
logo->setPixmap(Resources::GetMisc(Resources::MiscID::LogoLarge));
logo->setPixmap(Resources::GetAppIcon().pixmap(200, 200));
logo->setContentsMargins(30, 0, 30, 0);

QVBoxLayout* main_layout = new QVBoxLayout;
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/DolphinQt/CMakeLists.txt
Expand Up @@ -285,8 +285,6 @@ add_executable(dolphin-emu
QtUtils/UTF8CodePointCountValidator.h
QtUtils/WindowActivationEventFilter.cpp
QtUtils/WindowActivationEventFilter.h
QtUtils/WinIconHelper.cpp
QtUtils/WinIconHelper.h
QtUtils/WrapInScrollArea.cpp
QtUtils/WrapInScrollArea.h
RenderWidget.cpp
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/DolphinQt/Config/FilesystemWidget.cpp
Expand Up @@ -90,12 +90,12 @@ void FilesystemWidget::ConnectWidgets()
void FilesystemWidget::PopulateView()
{
// Cache these two icons, the tree will use them a lot.
m_folder_icon = Resources::GetScaledIcon("isoproperties_folder");
m_file_icon = Resources::GetScaledIcon("isoproperties_file");
m_folder_icon = Resources::GetResourceIcon("isoproperties_folder");
m_file_icon = Resources::GetResourceIcon("isoproperties_file");

auto* disc = new QStandardItem(tr("Disc"));
disc->setEditable(false);
disc->setIcon(Resources::GetScaledIcon("isoproperties_disc"));
disc->setIcon(Resources::GetResourceIcon("isoproperties_disc"));
disc->setData(QVariant::fromValue(EntryType::Disc), ENTRY_TYPE);
m_tree_model->appendRow(disc);
m_tree_view->expand(disc->index());
Expand All @@ -107,7 +107,7 @@ void FilesystemWidget::PopulateView()
auto* item = new QStandardItem;
item->setEditable(false);

item->setIcon(Resources::GetScaledIcon("isoproperties_disc"));
item->setIcon(Resources::GetResourceIcon("isoproperties_disc"));
item->setData(static_cast<qlonglong>(i), ENTRY_PARTITION);
item->setData(QVariant::fromValue(EntryType::Partition), ENTRY_TYPE);

Expand Down
10 changes: 5 additions & 5 deletions Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp
Expand Up @@ -126,11 +126,11 @@ void BreakpointWidget::CreateWidgets()

void BreakpointWidget::UpdateIcons()
{
m_new->setIcon(Resources::GetScaledThemeIcon("debugger_add_breakpoint"));
m_delete->setIcon(Resources::GetScaledThemeIcon("debugger_delete"));
m_clear->setIcon(Resources::GetScaledThemeIcon("debugger_clear"));
m_load->setIcon(Resources::GetScaledThemeIcon("debugger_load"));
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
m_new->setIcon(Resources::GetThemeIcon("debugger_add_breakpoint"));
m_delete->setIcon(Resources::GetThemeIcon("debugger_delete"));
m_clear->setIcon(Resources::GetThemeIcon("debugger_clear"));
m_load->setIcon(Resources::GetThemeIcon("debugger_load"));
m_save->setIcon(Resources::GetThemeIcon("debugger_save"));
}

void BreakpointWidget::closeEvent(QCloseEvent*)
Expand Down
3 changes: 1 addition & 2 deletions Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
Expand Up @@ -379,8 +379,7 @@ void CodeViewWidget::Update(const Core::CPUThreadGuard* guard)

if (debug_interface.IsBreakpoint(addr))
{
auto icon =
Resources::GetScaledThemeIcon("debugger_breakpoint").pixmap(QSize(rowh - 2, rowh - 2));
auto icon = Resources::GetThemeIcon("debugger_breakpoint").pixmap(QSize(rowh - 2, rowh - 2));
if (!m_system.GetPowerPC().GetBreakPoints().IsBreakPointEnable(addr))
{
QPixmap disabled_icon(icon.size());
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp
Expand Up @@ -583,7 +583,7 @@ void MemoryViewWidget::UpdateBreakpointTags()
{
m_table->item(i, 0)->setData(
Qt::DecorationRole,
Resources::GetScaledThemeIcon("debugger_breakpoint")
Resources::GetThemeIcon("debugger_breakpoint")
.pixmap(QSize(m_table->rowHeight(0) - 3, m_table->rowHeight(0) - 3)));
}
else
Expand Down
10 changes: 5 additions & 5 deletions Source/Core/DolphinQt/Debugger/WatchWidget.cpp
Expand Up @@ -131,11 +131,11 @@ void WatchWidget::ConnectWidgets()
void WatchWidget::UpdateIcons()
{
// TODO: Create a "debugger_add_watch" icon
m_new->setIcon(Resources::GetScaledThemeIcon("debugger_add_breakpoint"));
m_delete->setIcon(Resources::GetScaledThemeIcon("debugger_delete"));
m_clear->setIcon(Resources::GetScaledThemeIcon("debugger_clear"));
m_load->setIcon(Resources::GetScaledThemeIcon("debugger_load"));
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
m_new->setIcon(Resources::GetThemeIcon("debugger_add_breakpoint"));
m_delete->setIcon(Resources::GetThemeIcon("debugger_delete"));
m_clear->setIcon(Resources::GetThemeIcon("debugger_clear"));
m_load->setIcon(Resources::GetThemeIcon("debugger_load"));
m_save->setIcon(Resources::GetThemeIcon("debugger_save"));
}

void WatchWidget::UpdateButtonsEnabled()
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/DolphinQt/DolphinQt.vcxproj
Expand Up @@ -183,7 +183,6 @@
<ClCompile Include="QtUtils\PartiallyClosableTabWidget.cpp" />
<ClCompile Include="QtUtils\UTF8CodePointCountValidator.cpp" />
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
<ClCompile Include="QtUtils\WinIconHelper.cpp" />
<ClCompile Include="QtUtils\WrapInScrollArea.cpp" />
<ClCompile Include="RenderWidget.cpp" />
<ClCompile Include="ResourcePackManager.cpp" />
Expand Down Expand Up @@ -240,7 +239,6 @@
<ClInclude Include="QtUtils\QueueOnObject.h" />
<ClInclude Include="QtUtils\RunOnObject.h" />
<ClInclude Include="QtUtils\SignalBlocking.h" />
<ClInclude Include="QtUtils\WinIconHelper.h" />
<ClInclude Include="QtUtils\WrapInScrollArea.h" />
<ClInclude Include="ResourcePackManager.h" />
<ClInclude Include="Resources.h" />
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/DolphinQt/GameList/GameListModel.cpp
Expand Up @@ -62,13 +62,13 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
{
case Column::Platform:
if (role == Qt::DecorationRole)
return Resources::GetPlatform(game.GetPlatform());
return Resources::GetPlatform(game.GetPlatform()).pixmap(32, 32);
if (role == SORT_ROLE)
return static_cast<int>(game.GetPlatform());
break;
case Column::Country:
if (role == Qt::DecorationRole)
return Resources::GetCountry(game.GetCountry());
return Resources::GetCountry(game.GetCountry()).pixmap(32, 22);
if (role == SORT_ROLE)
return static_cast<int>(game.GetCountry());
break;
Expand All @@ -78,7 +78,7 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
// GameCube banners are 96x32, but Wii banners are 192x64.
QPixmap banner = ToQPixmap(game.GetBannerImage());
if (banner.isNull())
banner = Resources::GetMisc(Resources::MiscID::BannerMissing);
banner = Resources::GetMisc(Resources::MiscID::BannerMissing).pixmap(GAMECUBE_BANNER_SIZE);

banner.setDevicePixelRatio(
std::max(static_cast<qreal>(banner.width()) / GAMECUBE_BANNER_SIZE.width(),
Expand Down
93 changes: 0 additions & 93 deletions Source/Core/DolphinQt/QtUtils/WinIconHelper.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions Source/Core/DolphinQt/QtUtils/WinIconHelper.h

This file was deleted.

0 comments on commit 6e6865a

Please sign in to comment.