Skip to content
Permalink
Browse files

DolphinQt: cache filesystem icons for speed

  • Loading branch information...
Tilka committed Feb 1, 2019
1 parent e79f37c commit 5b4a5ca05925a9127508601f8cca88aff8acc9c0
@@ -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);
@@ -5,6 +5,7 @@
#pragma once

#include <QDialog>
#include <QIcon>
#include <memory>

#include "UICommon/GameFile.h"
@@ -53,4 +54,7 @@ class FilesystemWidget final : public QWidget

UICommon::GameFile m_game;
std::unique_ptr<DiscIO::Volume> m_volume;

QIcon m_folder_icon;
QIcon m_file_icon;
};

0 comments on commit 5b4a5ca

Please sign in to comment.
You can’t perform that action at this time.