Add static resources collection with pre-constructed QPixmaps & QIcons

* Apart from making the code cleaner when accessing them, creating these
  from strings can be slow if you do it often enough (e.g. once per
  resources for action/action_hover in pipeline state view).
This commit is contained in:
baldurk
2017-02-13 16:10:45 +00:00
parent fa33d883ac
commit f8ed197318
21 changed files with 331 additions and 184 deletions
+4 -3
View File
@@ -26,6 +26,7 @@
#include <QKeyEvent>
#include "3rdparty/flowlayout/FlowLayout.h"
#include "Code/RemoteHost.h"
#include "Code/Resources.h"
#include "Windows/Dialogs/LiveCapture.h"
#include "Windows/MainWindow.h"
#include "ui_RemoteManager.h"
@@ -165,7 +166,7 @@ void RemoteManager::addHost(RemoteHost *host)
QTreeWidgetItem *node = makeTreeNode({host->Hostname, "..."});
setItalic(node, true);
node->setIcon(0, QIcon(QPixmap(QString::fromUtf8(":/hourglass.png"))));
node->setIcon(0, Icons::hourglass());
setRemoteHost(node, host);
ui->hosts->addTopLevelItem(node);
@@ -540,7 +541,7 @@ void RemoteManager::on_refreshAll_clicked()
deleteChildren(n);
setItalic(n, true);
n->setIcon(0, QIcon(QPixmap(QString::fromUtf8(":/hourglass.png"))));
n->setIcon(0, Icons::hourglass());
refreshHost(n);
}
@@ -560,7 +561,7 @@ void RemoteManager::on_refreshOne_clicked()
{
deleteChildren(n);
setItalic(n, true);
n->setIcon(0, QIcon(QPixmap(QString::fromUtf8(":/hourglass.png"))));
n->setIcon(0, Icons::hourglass());
refreshHost(n);
}