mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-03 20:06:58 +03:00
NOISSUE allow using icon themes for instances and instance badges
This commit is contained in:
parent
27e26a656b
commit
f9d94a45ee
56 changed files with 165 additions and 131 deletions
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "MMCIcon.h"
|
||||
#include <QFileInfo>
|
||||
#include <xdgicon.h>
|
||||
|
||||
IconType operator--(IconType &t, int)
|
||||
{
|
||||
|
|
@ -58,7 +59,11 @@ QIcon MMCIcon::icon() const
|
|||
{
|
||||
if (m_current_type == IconType::ToBeDeleted)
|
||||
return QIcon();
|
||||
return m_images[m_current_type].icon;
|
||||
auto & icon = m_images[m_current_type].icon;
|
||||
if(!icon.isNull())
|
||||
return icon;
|
||||
// FIXME: inject this.
|
||||
return XdgIcon::fromTheme(m_images[m_current_type].key);
|
||||
}
|
||||
|
||||
void MMCIcon::remove(IconType rm_type)
|
||||
|
|
@ -78,12 +83,22 @@ void MMCIcon::remove(IconType rm_type)
|
|||
|
||||
void MMCIcon::replace(IconType new_type, QIcon icon, QString path)
|
||||
{
|
||||
QFileInfo foo(path);
|
||||
if (new_type > m_current_type || m_current_type == IconType::ToBeDeleted)
|
||||
{
|
||||
m_current_type = new_type;
|
||||
}
|
||||
m_images[new_type].icon = icon;
|
||||
m_images[new_type].changed = foo.lastModified();
|
||||
m_images[new_type].filename = path;
|
||||
m_images[new_type].key = QString();
|
||||
}
|
||||
|
||||
void MMCIcon::replace(IconType new_type, const QString& key)
|
||||
{
|
||||
if (new_type > m_current_type || m_current_type == IconType::ToBeDeleted)
|
||||
{
|
||||
m_current_type = new_type;
|
||||
}
|
||||
m_images[new_type].icon = QIcon();
|
||||
m_images[new_type].filename = QString();
|
||||
m_images[new_type].key = key;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue