DolphinQt: cache filesystem icons for speed

This commit is contained in:
Tillmann Karras 2019-02-01 00:13:50 +00:00
parent e79f37ceac
commit 5b4a5ca059
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;
};