DolphinQt: cache filesystem icons for speed
This commit is contained in:
parent
e79f37ceac
commit
5b4a5ca059
|
@ -86,6 +86,10 @@ void FilesystemWidget::ConnectWidgets()
|
||||||
|
|
||||||
void FilesystemWidget::PopulateView()
|
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"));
|
auto* disc = new QStandardItem(tr("Disc"));
|
||||||
disc->setEditable(false);
|
disc->setEditable(false);
|
||||||
disc->setIcon(Resources::GetScaledIcon("isoproperties_disc"));
|
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()));
|
auto* item = new QStandardItem(QString::fromStdString(info.GetName()));
|
||||||
item->setEditable(false);
|
item->setEditable(false);
|
||||||
item->setIcon(Resources::GetScaledIcon(info.IsDirectory() ? "isoproperties_folder" :
|
item->setIcon(info.IsDirectory() ? m_folder_icon : m_file_icon);
|
||||||
"isoproperties_file"));
|
|
||||||
|
|
||||||
if (info.IsDirectory())
|
if (info.IsDirectory())
|
||||||
PopulateDirectory(partition_id, item, info);
|
PopulateDirectory(partition_id, item, info);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QIcon>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "UICommon/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
@ -53,4 +54,7 @@ private:
|
||||||
|
|
||||||
UICommon::GameFile m_game;
|
UICommon::GameFile m_game;
|
||||||
std::unique_ptr<DiscIO::Volume> m_volume;
|
std::unique_ptr<DiscIO::Volume> m_volume;
|
||||||
|
|
||||||
|
QIcon m_folder_icon;
|
||||||
|
QIcon m_file_icon;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue