Skip to content

Commit

Permalink
Merge pull request #43 from LelCP/master
Browse files Browse the repository at this point in the history
Fixes to icon theme support
  • Loading branch information
shundhammer committed Feb 21, 2018
2 parents d4a4022 + ef250ad commit 094f30f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION.cmake
@@ -1,6 +1,6 @@
SET( VERSION_MAJOR "2" )
SET( VERSION_MINOR "45" )
SET( VERSION_PATCH "14" )
SET( VERSION_PATCH "15" )
SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )

##### This is need for the libyui core, ONLY.
Expand Down
6 changes: 6 additions & 0 deletions package/libyui-qt-pkg.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Feb 21 13:54:46 UTC 2018 - letcp@protonmail.com

- Contribution by LelCP: Add support for icon themes
- 2.45.15

-------------------------------------------------------------------
Tue Aug 8 08:51:50 UTC 2017 - mvidner@suse.com

Expand Down
10 changes: 9 additions & 1 deletion src/YQPkgPackageKitGroupsFilterView.cc
Expand Up @@ -430,8 +430,16 @@ YQPkgPackageKitGroup::YQPkgPackageKitGroup( YQPkgPackageKitGroupsFilterView * pa
setFont(0,f);

string iconName = groupIcon( group );
QString icon = QString::fromStdString(iconName);
if ( QIcon::hasThemeIcon(icon) )
{
setIcon( 0, QIcon::fromTheme(icon) );
}
else
{
setIcon( 0, QIcon( QString( YQPackageSelector::iconPath( iconName, 32 ).c_str() ) ) );
}
setText( 0, translatedText( group ) );
setIcon( 0, QIcon( QString( YQPackageSelector::iconPath( iconName, 32 ).c_str() ) ) );
}


Expand Down
13 changes: 11 additions & 2 deletions src/YQPkgPatternList.cc
Expand Up @@ -472,10 +472,19 @@ YQPkgPatternListItem::init()
icon.empty() )
icon = "pattern-generic";

std::string iconpath = YQPackageSelector::iconPath(icon, 32);

//std::cout << icon << " | "<< iconpath << std::endl;

QString iconName = QString::fromStdString(icon);
if ( QIcon::hasThemeIcon(iconName) )
{
setIcon( _patternList->iconCol(), QIcon::fromTheme(iconName) );
}
else
{
std::string iconpath = YQPackageSelector::iconPath(icon, 32);
setIcon(_patternList->iconCol(), QIcon(QString(iconpath.c_str())));
}


}

Expand Down
8 changes: 6 additions & 2 deletions src/YQPkgRepoList.cc
Expand Up @@ -269,8 +269,12 @@ YQPkgRepoListItem::YQPkgRepoListItem( YQPkgRepoList * repoList,
if ( repo.isSystemRepo() )
iconName = "yast-host";


setIcon( 0, QIcon( iconPath.sprintf("/usr/share/icons/hicolor/48x48/apps/%s.png", iconName.toUtf8().data()) ));
if ( QIcon::hasThemeIcon(iconName) )
{
setIcon( 0, QIcon::fromTheme(iconName) );
}
else
setIcon( 0, QIcon( iconPath.sprintf("/usr/share/icons/hicolor/48x48/apps/%s.png", iconName.toUtf8().data()) ));
}


Expand Down

0 comments on commit 094f30f

Please sign in to comment.