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 19:20:22 +00:00
parent fa33d883ac
commit f8ed197318
21 changed files with 331 additions and 184 deletions
+6 -5
View File
@@ -31,6 +31,7 @@
#include <QToolBar>
#include <QToolButton>
#include "3rdparty/toolwindowmanager/ToolWindowManager.h"
#include "Code/Resources.h"
#include "Code/qprocessinfo.h"
#include "Widgets/Extended/RDLabel.h"
#include "Windows/MainWindow.h"
@@ -74,7 +75,7 @@ LiveCapture::LiveCapture(CaptureContext &ctx, const QString &hostname, uint32_t
setTitle(tr("Connecting.."));
ui->connectionStatus->setText(tr("Connecting.."));
ui->connectionIcon->setPixmap(QPixmap(QString::fromUtf8(":/hourglass.png")));
ui->connectionIcon->setPixmap(Pixmaps::hourglass());
{
QToolBar *bottomTools = new QToolBar(this);
@@ -922,7 +923,7 @@ void LiveCapture::connectionThreadEntry()
GUIInvoke::call([this]() {
setTitle("Connection failed");
ui->connectionStatus->setText(tr("Connection failed"));
ui->connectionIcon->setPixmap(QPixmap(QString::fromUtf8(":/delete.png")));
ui->connectionIcon->setPixmap(Pixmaps::del());
connectionClosed();
});
@@ -949,7 +950,7 @@ void LiveCapture::connectionThreadEntry()
tr("Connection established to %1 [PID %2] (%3)").arg(target).arg(pid).arg(api));
setTitle(QString("%1 [PID %2]").arg(target).arg(pid));
}
ui->connectionIcon->setPixmap(QPixmap(QString::fromUtf8(":/connect.png")));
ui->connectionIcon->setPixmap(Pixmaps::connect());
});
while(m_Connection && m_Connection->Connected())
@@ -1011,7 +1012,7 @@ void LiveCapture::connectionThreadEntry()
tr("Connection established to %1 [PID %2] (%3)").arg(target).arg(pid).arg(api));
setTitle(QString("%1 [PID %2]").arg(target).arg(pid));
}
ui->connectionIcon->setPixmap(QPixmap(QString::fromUtf8(":/connect.png")));
ui->connectionIcon->setPixmap(Pixmaps::connect());
});
}
@@ -1058,7 +1059,7 @@ void LiveCapture::connectionThreadEntry()
GUIInvoke::call([this]() {
ui->connectionStatus->setText(tr("Connection closed"));
ui->connectionIcon->setPixmap(QPixmap(QString::fromUtf8(":/disconnect.png")));
ui->connectionIcon->setPixmap(Pixmaps::disconnect());
ui->numFrames->setEnabled(false);
ui->captureDelay->setEnabled(false);