Merge pull request #7766 from Tilka/cache_icons

DolphinQt: cache filesystem icons for speed
This commit is contained in:
Mat M 2019-01-31 21:23:50 -05:00 committed by GitHub
commit 4408a0c053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -86,6 +86,10 @@ 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");
auto* disc = new QStandardItem(tr("Disc"));
disc->setEditable(false);
disc->setIcon(Resources::GetScaledIcon("isoproperties_disc"));
@ -131,8 +135,7 @@ void FilesystemWidget::PopulateDirectory(int partition_id, QStandardItem* root,
{
auto* item = new QStandardItem(QString::fromStdString(info.GetName()));
item->setEditable(false);
item->setIcon(Resources::GetScaledIcon(info.IsDirectory() ? "isoproperties_folder" :
"isoproperties_file"));
item->setIcon(info.IsDirectory() ? m_folder_icon : m_file_icon);
if (info.IsDirectory())
PopulateDirectory(partition_id, item, info);

View File

@ -5,6 +5,7 @@
#pragma once
#include <QDialog>
#include <QIcon>
#include <memory>
#include "UICommon/GameFile.h"
@ -53,4 +54,7 @@ private:
UICommon::GameFile m_game;
std::unique_ptr<DiscIO::Volume> m_volume;
QIcon m_folder_icon;
QIcon m_file_icon;
};