1
0
Fork 0
forked from blue/squawk

Merge pull request 'fix: use fallback icons on buttons, when no supported theme is installed' (#53) from shunf4/squawk:fix/btn_icons into messageFeed

Reviewed-on: blue/squawk#53
This commit is contained in:
Blue 2021-10-16 15:36:57 +00:00
commit e47ba603e0
6 changed files with 48 additions and 28 deletions

View file

@ -292,8 +292,12 @@ void Conversation::addAttachedFile(const QString& path)
QMimeDatabase db;
QMimeType type = db.mimeTypeForFile(path);
QFileInfo info(path);
Badge* badge = new Badge(path, info.fileName(), QIcon::fromTheme(type.iconName()));
QIcon fileIcon = QIcon::fromTheme(type.iconName());
if (fileIcon.isNull()) {
fileIcon.addFile(QString::fromUtf8(":/images/fallback/dark/big/mail-attachment.svg"), QSize(), QIcon::Normal, QIcon::Off);
}
Badge* badge = new Badge(path, info.fileName(), fileIcon);
connect(badge, &Badge::close, this, &Conversation::onBadgeClose);
try {

View file

@ -271,8 +271,8 @@
<string/>
</property>
<property name="icon">
<iconset theme="smiley-shape">
<normaloff>.</normaloff>.</iconset>
<iconset theme="smiley-shape" resource="../../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/unfavorite.svg</normaloff>:/images/fallback/dark/big/unfavorite.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
@ -298,8 +298,8 @@
<string/>
</property>
<property name="icon">
<iconset theme="mail-attachment-symbolic">
<normaloff>.</normaloff>.</iconset>
<iconset theme="mail-attachment-symbolic" resource="../../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/mail-attachment.svg</normaloff>:/images/fallback/dark/big/mail-attachment.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
@ -312,8 +312,8 @@
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all">
<normaloff>.</normaloff>.</iconset>
<iconset theme="edit-clear-all" resource="../../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/clean.svg</normaloff>:/images/fallback/dark/big/clean.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
@ -332,8 +332,8 @@
<string/>
</property>
<property name="icon">
<iconset theme="document-send">
<normaloff>.</normaloff>.</iconset>
<iconset theme="document-send" resource="../../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/send.svg</normaloff>:/images/fallback/dark/big/send.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
@ -419,6 +419,8 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -164,6 +164,9 @@ void Preview::applyNewSize()
break;
default: {
QIcon icon = QIcon::fromTheme(info.mime.iconName());
if (icon.isNull()) {
icon.addFile(QString::fromUtf8(":/images/fallback/dark/big/mail-attachment.svg"), QSize(), QIcon::Normal, QIcon::Off);
}
widget->setPixmap(icon.pixmap(actualSize));
widget->resize(actualSize);
}
@ -264,6 +267,10 @@ void Preview::initializeElements()
break;
default: {
QIcon icon = QIcon::fromTheme(info.mime.iconName());
if (icon.isNull()) {
icon.addFile(QString::fromUtf8(":/images/fallback/dark/big/mail-attachment.svg"), QSize(), QIcon::Normal, QIcon::Off);
}
widget = new QLabel(parent);
widget->setPixmap(icon.pixmap(actualSize));
widget->show();

View file

@ -482,8 +482,8 @@
<string/>
</property>
<property name="icon">
<iconset theme="user">
<normaloff>.</normaloff>.</iconset>
<iconset theme="user" resource="../../../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/user.svg</normaloff>:/images/fallback/dark/big/user.svg</iconset>
</property>
<property name="iconSize">
<size>
@ -852,8 +852,8 @@
</layout>
<action name="actionSetAvatar">
<property name="icon">
<iconset theme="photo">
<normaloff>.</normaloff>.</iconset>
<iconset theme="photo" resource="../../../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/edit-rename.svg</normaloff>:/images/fallback/dark/big/edit-rename.svg</iconset>
</property>
<property name="text">
<string>Set avatar</string>
@ -861,8 +861,8 @@
</action>
<action name="actionClearAvatar">
<property name="icon">
<iconset theme="edit-clear-all">
<normaloff>.</normaloff>.</iconset>
<iconset theme="edit-clear-all" resource="../../../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/clean.svg</normaloff>:/images/fallback/dark/big/clean.svg</iconset>
</property>
<property name="text">
<string>Clear avatar</string>
@ -886,7 +886,7 @@
<tabstop>description</tabstop>
</tabstops>
<resources>
<include location="../../resources/resources.qrc"/>
<include location="../../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>