1
0
Fork 0
forked from suyu/suyu

Limit the size of directory icons, fix text when icon size is none

This commit is contained in:
fearlessTobi 2019-07-11 23:02:18 +02:00 committed by FearlessTobi
parent 13891fd62d
commit 053da44ecd
2 changed files with 3 additions and 4 deletions

View file

@ -230,7 +230,7 @@ void GameList::onUpdateThemedIcons() {
for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) { for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) {
QStandardItem* child = item_model->invisibleRootItem()->child(i); QStandardItem* child = item_model->invisibleRootItem()->child(i);
const int icon_size = UISettings::values.icon_size; const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) { switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) {
case GameListItemType::SdmcDir: case GameListItemType::SdmcDir:
child->setData( child->setData(
@ -300,7 +300,6 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide
tree_view->setHorizontalScrollMode(QHeaderView::ScrollPerPixel); tree_view->setHorizontalScrollMode(QHeaderView::ScrollPerPixel);
tree_view->setSortingEnabled(true); tree_view->setSortingEnabled(true);
tree_view->setEditTriggers(QHeaderView::NoEditTriggers); tree_view->setEditTriggers(QHeaderView::NoEditTriggers);
tree_view->setUniformRowHeights(true);
tree_view->setContextMenuPolicy(Qt::CustomContextMenu); tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }"));

View file

@ -221,7 +221,7 @@ public:
UISettings::GameDir* game_dir = &directory; UISettings::GameDir* game_dir = &directory;
setData(QVariant::fromValue(game_dir), GameDirRole); setData(QVariant::fromValue(game_dir), GameDirRole);
const int icon_size = UISettings::values.icon_size; const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
switch (dir_type) { switch (dir_type) {
case GameListItemType::SdmcDir: case GameListItemType::SdmcDir:
setData( setData(
@ -272,7 +272,7 @@ public:
explicit GameListAddDir() { explicit GameListAddDir() {
setData(type(), TypeRole); setData(type(), TypeRole);
const int icon_size = UISettings::values.icon_size; const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
setData(QIcon::fromTheme(QStringLiteral("plus")) setData(QIcon::fromTheme(QStringLiteral("plus"))
.pixmap(icon_size) .pixmap(icon_size)
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),