converted all calls to QIcon("somefile.png") into FilesDefs::getIconFromQtResourcePath("somefile.png") to save memory duplicated by Qt

This commit is contained in:
csoler 2020-08-15 22:17:52 +02:00
parent dcbcc95e41
commit 209355b9a5
63 changed files with 330 additions and 291 deletions

View file

@ -18,6 +18,7 @@
* *
*******************************************************************************/
#include "gui/common/FilesDefs.h"
#include <QMessageBox>
#include <QCloseEvent>
#include <QClipboard>
@ -696,7 +697,7 @@ void MessageComposer::contextMenuFileList(QPoint)
{
QMenu contextMnu(this);
QAction *action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteRecommended()));
QAction *action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteRecommended()));
action->setDisabled(RSLinkClipboard::empty(RetroShareLink::TYPE_FILE));
contextMnu.exec(QCursor::pos());
@ -805,7 +806,7 @@ void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
{
QTableWidgetItem *item = ui.recipientWidget->item(row, COLUMN_RECIPIENT_ICON);
if (item)
item->setIcon(QIcon(StatusDefs::imageUser(status)));
item->setIcon(FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(status)));
}
}
}
@ -1606,7 +1607,7 @@ void MessageComposer::setRecipientToRow(int row, enumType type, destinationType
switch(dest_type)
{
case PEER_TYPE_GROUP: {
icon = QIcon(IMAGE_GROUP16);
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_GROUP16);
RsGroupInfo groupInfo;
if (rsPeers->getGroupInfo(RsNodeGroupId(id), groupInfo)) {
@ -1652,7 +1653,7 @@ void MessageComposer::setRecipientToRow(int row, enumType type, destinationType
// No check of return value. Non existing status info is handled as offline.
rsStatus->getStatus(RsPeerId(id), peerStatusInfo);
icon = QIcon(StatusDefs::imageUser(peerStatusInfo.status));
icon = FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(peerStatusInfo.status));
}
break ;
default:
@ -1928,7 +1929,7 @@ void MessageComposer::setupFileActions()
connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
menu->addAction(a);
/*a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("Print Preview..."), this);
/*a = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/textedit/fileprint.png"), tr("Print Preview..."), this);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
menu->addAction(a);*/
@ -2021,7 +2022,7 @@ void MessageComposer::setupContactActions()
connect(mActionAddBCC, SIGNAL(triggered(bool)), this, SLOT(addBcc()));
mActionAddRecommend = new QAction(tr("Add as Recommend"), this);
connect(mActionAddRecommend, SIGNAL(triggered(bool)), this, SLOT(addRecommend()));
mActionContactDetails = new QAction(QIcon(IMAGE_FRIENDINFO), tr("Details"), this);
mActionContactDetails = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_FRIENDINFO), tr("Details"), this);
connect(mActionContactDetails, SIGNAL(triggered(bool)), this, SLOT(contactDetails()));
ui.friendSelectionWidget->addContextMenuAction(mActionAddTo);
@ -2435,9 +2436,9 @@ void MessageComposer::on_contactsdockWidget_visibilityChanged(bool visible)
void MessageComposer::updatecontactsviewicons()
{
if(!ui.contactsdockWidget->isVisible()){
ui.actionContactsView->setIcon(QIcon(":/icons/mail/contacts.png"));
ui.actionContactsView->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/mail/contacts.png"));
}else{
ui.actionContactsView->setIcon(QIcon(":/icons/mail/contacts.png"));
ui.actionContactsView->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/mail/contacts.png"));
}
}