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: #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

@ -184,8 +184,8 @@
</widget>
<action name="actionAccounts">
<property name="icon">
<iconset theme="system-users">
<normaloff>.</normaloff>.</iconset>
<iconset theme="system-users" resource="../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/group.svg</normaloff>:/images/fallback/dark/big/group.svg</iconset>
</property>
<property name="text">
<string>Accounts</string>
@ -193,8 +193,8 @@
</action>
<action name="actionQuit">
<property name="icon">
<iconset theme="application-exit">
<normaloff>.</normaloff>.</iconset>
<iconset theme="application-exit" resource="../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/edit-none.svg</normaloff>:/images/fallback/dark/big/edit-none.svg</iconset>
</property>
<property name="text">
<string>Quit</string>
@ -205,8 +205,8 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset theme="list-add-user">
<normaloff>.</normaloff>.</iconset>
<iconset theme="list-add-user" resource="../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/add.svg</normaloff>:/images/fallback/dark/big/add.svg</iconset>
</property>
<property name="text">
<string>Add contact</string>
@ -217,14 +217,16 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset theme="resource-group-new">
<normaloff>.</normaloff>.</iconset>
<iconset theme="resource-group-new" resource="../resources/resources.qrc">
<normaloff>:/images/fallback/dark/big/group-new.svg</normaloff>:/images/fallback/dark/big/group-new.svg</iconset>
</property>
<property name="text">
<string>Add conference</string>
</property>
</action>
</widget>
<resources/>
<resources>
<include location="../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -32,7 +32,12 @@ Badge::Badge(const QString& p_id, const QString& p_text, const QIcon& icon, QWid
setFrameShadow(QFrame::Raised);
image->setPixmap(icon.pixmap(25, 25));
closeButton->setIcon(QIcon::fromTheme("tab-close"));
QIcon tabCloseIcon = QIcon::fromTheme("tab-close");
if (tabCloseIcon.isNull()) {
tabCloseIcon.addFile(QString::fromUtf8(":/images/fallback/dark/big/edit-none.svg"), QSize(), QIcon::Normal, QIcon::Off);
}
closeButton->setIcon(tabCloseIcon);
closeButton->setMaximumHeight(25);
closeButton->setMaximumWidth(25);

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>