summaryrefslogtreecommitdiffstats
path: root/gui/fileselector.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2015-02-14 20:23:16 +0100
committerthat <github@that.at>2015-02-15 20:36:40 +0100
commitf6ed8fc1f51e368bb76905d9f1d2d3735e70a644 (patch)
treeba66418d418869274d259ce35cca8d4021d8ce4e /gui/fileselector.cpp
parentRetain and display previous selection for image flashing (diff)
downloadandroid_bootable_recovery-f6ed8fc1f51e368bb76905d9f1d2d3735e70a644.tar
android_bootable_recovery-f6ed8fc1f51e368bb76905d9f1d2d3735e70a644.tar.gz
android_bootable_recovery-f6ed8fc1f51e368bb76905d9f1d2d3735e70a644.tar.bz2
android_bootable_recovery-f6ed8fc1f51e368bb76905d9f1d2d3735e70a644.tar.lz
android_bootable_recovery-f6ed8fc1f51e368bb76905d9f1d2d3735e70a644.tar.xz
android_bootable_recovery-f6ed8fc1f51e368bb76905d9f1d2d3735e70a644.tar.zst
android_bootable_recovery-f6ed8fc1f51e368bb76905d9f1d2d3735e70a644.zip
Diffstat (limited to 'gui/fileselector.cpp')
-rw-r--r--gui/fileselector.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index 319b11b96..5c287c34d 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -40,7 +40,6 @@ GUIFileSelector::GUIFileSelector(xml_node<>* node) : GUIScrollList(node)
xml_attribute<>* attr;
xml_node<>* child;
- int mIconWidth = 0, mIconHeight = 0, mFolderIconHeight = 0, mFileIconHeight = 0, mFolderIconWidth = 0, mFileIconWidth = 0;
mFolderIcon = mFileIcon = NULL;
mShowFolders = mShowFiles = mShowNavFolders = 1;
mUpdate = 0;
@@ -109,29 +108,12 @@ GUIFileSelector::GUIFileSelector(xml_node<>* node) : GUIScrollList(node)
// Get folder and file icons if present
child = node->first_node("icon");
if (child) {
- attr = child->first_attribute("folder");
- if (attr)
- mFolderIcon = PageManager::FindResource(attr->value());
- attr = child->first_attribute("file");
- if (attr)
- mFileIcon = PageManager::FindResource(attr->value());
- }
- if (mFolderIcon && mFolderIcon->GetResource()) {
- mFolderIconWidth = gr_get_width(mFolderIcon->GetResource());
- mFolderIconHeight = gr_get_height(mFolderIcon->GetResource());
- if (mFolderIconHeight > mIconHeight)
- mIconHeight = mFolderIconHeight;
- mIconWidth = mFolderIconWidth;
- }
- if (mFileIcon && mFileIcon->GetResource()) {
- mFileIconWidth = gr_get_width(mFileIcon->GetResource());
- mFileIconHeight = gr_get_height(mFileIcon->GetResource());
- if (mFileIconHeight > mIconHeight)
- mIconHeight = mFileIconHeight;
- if (mFileIconWidth > mIconWidth)
- mIconWidth = mFileIconWidth;
+ mFolderIcon = LoadAttrImage(child, "folder");
+ mFileIcon = LoadAttrImage(child, "file");
}
- SetMaxIconSize(mIconWidth, mIconHeight);
+ int iconWidth = std::max(mFolderIcon->GetWidth(), mFileIcon->GetWidth());
+ int iconHeight = std::max(mFolderIcon->GetHeight(), mFileIcon->GetHeight());
+ SetMaxIconSize(iconWidth, iconHeight);
// Fetch the file/folder list
std::string value;
@@ -318,7 +300,7 @@ size_t GUIFileSelector::GetItemCount()
return folderSize + fileSize;
}
-int GUIFileSelector::GetListItem(size_t item_index, Resource*& icon, std::string &text)
+int GUIFileSelector::GetListItem(size_t item_index, ImageResource*& icon, std::string &text)
{
size_t folderSize = mShowFolders ? mFolderList.size() : 0;
size_t fileSize = mShowFiles ? mFileList.size() : 0;