add fallback icons for buttons

This commit is contained in:
shunf4 2021-10-06 22:45:10 +08:00
parent 8b3752ef47
commit ebeb4089eb
6 changed files with 48 additions and 28 deletions

View File

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

View File

@ -32,7 +32,12 @@ Badge::Badge(const QString& p_id, const QString& p_text, const QIcon& icon, QWid
setFrameShadow(QFrame::Raised); setFrameShadow(QFrame::Raised);
image->setPixmap(icon.pixmap(25, 25)); 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->setMaximumHeight(25);
closeButton->setMaximumWidth(25); closeButton->setMaximumWidth(25);

View File

@ -255,8 +255,12 @@ void Conversation::addAttachedFile(const QString& path)
QMimeDatabase db; QMimeDatabase db;
QMimeType type = db.mimeTypeForFile(path); QMimeType type = db.mimeTypeForFile(path);
QFileInfo info(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); connect(badge, &Badge::close, this, &Conversation::onBadgeClose);
try { try {

View File

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

View File

@ -164,6 +164,9 @@ void Preview::applyNewSize()
break; break;
default: { default: {
QIcon icon = QIcon::fromTheme(info.mime.iconName()); 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->setPixmap(icon.pixmap(actualSize));
widget->resize(actualSize); widget->resize(actualSize);
} }
@ -264,6 +267,10 @@ void Preview::initializeElements()
break; break;
default: { default: {
QIcon icon = QIcon::fromTheme(info.mime.iconName()); 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 = new QLabel(parent);
widget->setPixmap(icon.pixmap(actualSize)); widget->setPixmap(icon.pixmap(actualSize));
widget->show(); widget->show();

View File

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