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
+61
View File
@@ -0,0 +1,61 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "Resources.h"
#include <QDebug>
#include <QDirIterator>
Resources::ResourceSet *Resources::resources = NULL;
void Resources::Initialise()
{
QList<QString> filenames;
resources = new Resources::ResourceSet();
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) \
filenames.push_back(":/" filename); \
resources->name##_data.pixmap = QPixmap(QString::fromUtf8(":/" filename)); \
resources->name##_data.icon = QIcon(resources->name##_data.pixmap);
RESOURCE_LIST();
QDirIterator it(":");
while(it.hasNext())
{
QString filename = it.next();
if(filenames.contains(filename))
continue;
if(!filename.contains(".png"))
continue;
qCritical() << "Resource not configured for" << filename;
}
}
Resources::~Resources()
{
delete resources;
}
+141
View File
@@ -0,0 +1,141 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#include <QIcon>
#include <QPixmap>
#define RESOURCE_LIST() \
RESOURCE_DEF(logo128, "logo128.png") \
RESOURCE_DEF(accept, "accept.png") \
RESOURCE_DEF(add, "add.png") \
RESOURCE_DEF(arrow_in, "arrow_in.png") \
RESOURCE_DEF(arrow_join, "arrow_join.png") \
RESOURCE_DEF(arrow_undo, "arrow_undo.png") \
RESOURCE_DEF(asterisk_orange, "asterisk_orange.png") \
RESOURCE_DEF(back, "back.png") \
RESOURCE_DEF(chart_curve, "chart_curve.png") \
RESOURCE_DEF(cog, "cog.png") \
RESOURCE_DEF(cog_go, "cog_go.png") \
RESOURCE_DEF(color_wheel, "color_wheel.png") \
RESOURCE_DEF(connect, "connect.png") \
RESOURCE_DEF(cross, "cross.png") \
RESOURCE_DEF(crosshatch, "crosshatch.png") \
RESOURCE_DEF(del, "del.png") \
RESOURCE_DEF(disconnect, "disconnect.png") \
RESOURCE_DEF(down_arrow, "down_arrow.png") \
RESOURCE_DEF(find, "find.png") \
RESOURCE_DEF(fit_window, "fit_window.png") \
RESOURCE_DEF(flag_green, "flag_green.png") \
RESOURCE_DEF(flip_y, "flip_y.png") \
RESOURCE_DEF(folder_page, "folder_page.png") \
RESOURCE_DEF(forward, "forward.png") \
RESOURCE_DEF(hourglass, "hourglass.png") \
RESOURCE_DEF(house, "house.png") \
RESOURCE_DEF(information, "information.png") \
RESOURCE_DEF(new_window, "new_window.png") \
RESOURCE_DEF(page_white_code, "page_white_code.png") \
RESOURCE_DEF(page_white_database, "page_white_database.png") \
RESOURCE_DEF(page_white_delete, "page_white_delete.png") \
RESOURCE_DEF(page_white_edit, "page_white_edit.png") \
RESOURCE_DEF(page_white_link, "page_white_link.png") \
RESOURCE_DEF(plugin_add, "plugin_add.png") \
RESOURCE_DEF(red_x_16, "red_x_16.png") \
RESOURCE_DEF(runback, "runback.png") \
RESOURCE_DEF(runcursor, "runcursor.png") \
RESOURCE_DEF(runfwd, "runfwd.png") \
RESOURCE_DEF(runnaninf, "runnaninf.png") \
RESOURCE_DEF(runsample, "runsample.png") \
RESOURCE_DEF(save, "save.png") \
RESOURCE_DEF(stepnext, "stepnext.png") \
RESOURCE_DEF(stepprev, "stepprev.png") \
RESOURCE_DEF(tick, "tick.png") \
RESOURCE_DEF(time, "time.png") \
RESOURCE_DEF(timeline_marker, "timeline_marker.png") \
RESOURCE_DEF(up_arrow, "up_arrow.png") \
RESOURCE_DEF(upfolder, "upfolder.png") \
RESOURCE_DEF(wand, "wand.png") \
RESOURCE_DEF(wireframe_mesh, "wireframe_mesh.png") \
RESOURCE_DEF(wrench, "wrench.png") \
RESOURCE_DEF(zoom, "zoom.png") \
RESOURCE_DEF(topo_linelist, "topologies/topo_linelist.png") \
RESOURCE_DEF(topo_linelist_adj, "topologies/topo_linelist_adj.png") \
RESOURCE_DEF(topo_linestrip, "topologies/topo_linestrip.png") \
RESOURCE_DEF(topo_linestrip_adj, "topologies/topo_linestrip_adj.png") \
RESOURCE_DEF(topo_patch, "topologies/topo_patch.png") \
RESOURCE_DEF(topo_pointlist, "topologies/topo_pointlist.png") \
RESOURCE_DEF(topo_trilist, "topologies/topo_trilist.png") \
RESOURCE_DEF(topo_trilist_adj, "topologies/topo_trilist_adj.png") \
RESOURCE_DEF(topo_tristrip, "topologies/topo_tristrip.png") \
RESOURCE_DEF(topo_tristrip_adj, "topologies/topo_tristrip_adj.png") \
RESOURCE_DEF(action, "action.png") \
RESOURCE_DEF(action_hover, "action_hover.png")
struct Resource
{
QIcon icon;
QPixmap pixmap;
};
class Resources
{
public:
static void Initialise();
~Resources();
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) \
static const Resource &name() { return resources->name##_data; }
RESOURCE_LIST()
private:
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) Resource name##_data;
struct ResourceSet
{
RESOURCE_LIST();
};
static ResourceSet *resources;
};
// helper forwarding structs
struct Pixmaps
{
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) \
static const QPixmap &name() { return Resources::name().pixmap; }
RESOURCE_LIST()
};
struct Icons
{
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) \
static const QIcon &name() { return Resources::name().icon; }
RESOURCE_LIST()
};
+3
View File
@@ -30,6 +30,7 @@
#include <QStandardPaths>
#include "Code/CaptureContext.h"
#include "Code/QRDUtils.h"
#include "Code/Resources.h"
#include "Windows/MainWindow.h"
void sharedLogOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
@@ -141,6 +142,8 @@ int main(int argc, char *argv[])
config.SetupFormatting();
Resources::Initialise();
GUIInvoke::init();
CaptureContext ctx(filename, remoteHost, remoteIdent, temp, config);

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 715 B

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

+2 -2
View File
@@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/">
<file>128.png</file>
<file>logo128.png</file>
<file>accept.png</file>
<file>add.png</file>
<file>arrow_in.png</file>
@@ -15,7 +15,7 @@
<file>connect.png</file>
<file>cross.png</file>
<file>crosshatch.png</file>
<file>delete.png</file>
<file>del.png</file>
<file>disconnect.png</file>
<file>down_arrow.png</file>
<file>find.png</file>
+1 -1
View File
@@ -23,7 +23,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/128.png</pixmap>
<pixmap resource="../../Resources/resources.qrc">:/logo128.png</pixmap>
</property>
</widget>
</item>
+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);
@@ -26,6 +26,7 @@
#include <QKeyEvent>
#include <QToolButton>
#include "Code/QRDUtils.h"
#include "Code/Resources.h"
#include "ui_OrderedListEditor.h"
OrderedListEditor::OrderedListEditor(const QString &windowName, const QString &itemName,
@@ -69,7 +70,7 @@ QToolButton *OrderedListEditor::makeBrowseButton()
{
QToolButton *ret = new QToolButton(this);
ret->setIcon(QIcon(QPixmap(QString::fromUtf8(":/folder_page.png"))));
ret->setIcon(Icons::folder_page());
ret->setAutoRaise(true);
QObject::connect(ret, &QToolButton::clicked, this, &OrderedListEditor::browse_clicked);
+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);
}
@@ -24,6 +24,7 @@
#include "SuggestRemoteDialog.h"
#include <QMenu>
#include "Code/Resources.h"
#include "ui_SuggestRemoteDialog.h"
SuggestRemoteDialog::SuggestRemoteDialog(const QString &driver, const QString &machineIdent,
@@ -69,7 +70,7 @@ void SuggestRemoteDialog::remotesAdded()
tr("the capture locally?"));
ui->remote->setEnabled(true);
ui->remote->setIcon(QIcon(QPixmap(QString::fromUtf8(":/down_arrow.png"))));
ui->remote->setIcon(Icons::down_arrow());
ui->remote->setText("Remote");
}
@@ -31,6 +31,7 @@
#include <QSortFilterProxyModel>
#include "Code/CaptureContext.h"
#include "Code/RenderManager.h"
#include "Code/Resources.h"
#include "ui_VirtualFileDialog.h"
class RemoteFileModel : public QAbstractItemModel
@@ -50,9 +51,9 @@ public:
RemoteFileModel(RenderManager &r, QObject *parent = NULL)
: Renderer(r), QAbstractItemModel(parent)
{
makeIconStates(fileIcon, QString::fromUtf8(":/page_white_database.png"));
makeIconStates(exeIcon, QString::fromUtf8(":/page_white_code.png"));
makeIconStates(dirIcon, QString::fromUtf8(":/folder_page.png"));
makeIconStates(fileIcon, Pixmaps::page_white_database());
makeIconStates(exeIcon, Pixmaps::page_white_code());
makeIconStates(dirIcon, Pixmaps::folder_page());
Renderer.GetHomeFolder(true, [this](const char *path, const rdctype::array<DirectoryFile> &files) {
QString homeDir = QString::fromUtf8(path);
@@ -365,9 +366,8 @@ private:
QIcon exeIcon[2];
QIcon fileIcon[2];
void makeIconStates(QIcon *icon, const QString &iconSource)
void makeIconStates(QIcon *icon, const QPixmap &normalPixmap)
{
QPixmap normalPixmap(iconSource);
QPixmap disabledPixmap(normalPixmap.size());
disabledPixmap.fill(Qt::transparent);
QPainter p(&disabledPixmap);
+14 -20
View File
@@ -31,6 +31,7 @@
#include <QToolButton>
#include "Code/CaptureContext.h"
#include "Code/QRDUtils.h"
#include "Code/Resources.h"
#include "PipelineState/PipelineStateViewer.h"
#include "Resources/resource.h"
#include "Widgets/Extended/RDLabel.h"
@@ -109,7 +110,7 @@ MainWindow::MainWindow(CaptureContext &ctx) : QMainWindow(NULL), ui(new Ui::Main
contextChooser = new QToolButton(this);
contextChooser->setText(tr("Replay Context: %1").arg("Local"));
contextChooser->setIcon(QIcon(QPixmap(QString::fromUtf8(":/house.png"))));
contextChooser->setIcon(Icons::house());
contextChooser->setAutoRaise(true);
contextChooser->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
contextChooser->setPopupMode(QToolButton::InstantPopup);
@@ -838,10 +839,9 @@ void MainWindow::setLogHasErrors(bool errors)
QString filename = QFileInfo(m_Ctx.LogFilename()).fileName();
if(errors)
{
QPixmap icon(QString::fromUtf8(":/delete.png"));
QPixmap empty(icon.width(), icon.height());
QPixmap empty(Pixmaps::del().width(), Pixmaps::del().height());
empty.fill(Qt::transparent);
statusIcon->setPixmap(m_messageAlternate ? empty : icon);
statusIcon->setPixmap(m_messageAlternate ? empty : Pixmaps::del());
QString text;
text = tr("%1 loaded. Log has %2 errors, warnings or performance notes. "
@@ -854,7 +854,7 @@ void MainWindow::setLogHasErrors(bool errors)
}
else
{
statusIcon->setPixmap(QPixmap(QString::fromUtf8(":/tick.png")));
statusIcon->setPixmap(Pixmaps::tick());
statusText->setText(tr("%1 loaded. No problems detected.").arg(filename));
}
}
@@ -910,7 +910,7 @@ void MainWindow::messageCheck()
}
if(m_Ctx.Renderer().remote() && !m_Ctx.Renderer().remote()->ServerRunning)
contextChooser->setIcon(QIcon(QPixmap(QString::fromUtf8(":/cross.png"))));
contextChooser->setIcon(Icons::cross());
if(!msgs.empty())
{
@@ -935,7 +935,7 @@ void MainWindow::messageCheck()
GUIInvoke::call([this]() {
if(m_Ctx.Renderer().remote() && !m_Ctx.Renderer().remote()->ServerRunning)
{
contextChooser->setIcon(QIcon(QPixmap(QString::fromUtf8(":/cross.png"))));
contextChooser->setIcon(Icons::cross());
contextChooser->setText(tr("Replay Context: %1").arg("Local"));
statusText->setText(
tr("Remote server disconnected. To attempt to reconnect please select it again."));
@@ -950,9 +950,6 @@ void MainWindow::FillRemotesMenu(QMenu *menu, bool includeLocalhost)
{
menu->clear();
QIcon tick(QPixmap(QString::fromUtf8(":/tick.png")));
QIcon cross(QPixmap(QString::fromUtf8(":/cross.png")));
for(int i = 0; i < m_Ctx.Config.RemoteHosts.count(); i++)
{
RemoteHost *host = m_Ctx.Config.RemoteHosts[i];
@@ -963,7 +960,7 @@ void MainWindow::FillRemotesMenu(QMenu *menu, bool includeLocalhost)
QAction *action = new QAction(menu);
action->setIcon(host->ServerRunning && !host->VersionMismatch ? tick : cross);
action->setIcon(host->ServerRunning && !host->VersionMismatch ? Icons::tick() : Icons::cross());
if(host->Connected)
action->setText(tr("%1 (Connected)").arg(host->Hostname));
else if(host->ServerRunning && host->VersionMismatch)
@@ -989,7 +986,7 @@ void MainWindow::FillRemotesMenu(QMenu *menu, bool includeLocalhost)
QAction *localContext = new QAction(menu);
localContext->setText("Local");
localContext->setIcon(QIcon(QPixmap(QString::fromUtf8(":/house.png"))));
localContext->setIcon(Icons::house());
QObject::connect(localContext, &QAction::triggered, this, &MainWindow::switchContext);
localContext->setData(-1);
@@ -1049,7 +1046,7 @@ void MainWindow::switchContext()
if(!host)
{
contextChooser->setIcon(QIcon(QPixmap(QString::fromUtf8(":/house.png"))));
contextChooser->setIcon(Icons::house());
contextChooser->setText(tr("Replay Context: %1").arg("Local"));
ui->action_Inject_into_Process->setEnabled(true);
@@ -1061,9 +1058,7 @@ void MainWindow::switchContext()
else
{
contextChooser->setText(tr("Replay Context: %1").arg(host->Hostname));
contextChooser->setIcon(host->ServerRunning
? QIcon(QPixmap(QString::fromUtf8(":/connect.png")))
: QIcon(QPixmap(QString::fromUtf8(":/disconnect.png"))));
contextChooser->setIcon(host->ServerRunning ? Icons::connect() : Icons::disconnect());
// disable until checking is done
contextChooser->setEnabled(false);
@@ -1096,13 +1091,12 @@ void MainWindow::switchContext()
}
GUIInvoke::call([this, host, status]() {
contextChooser->setIcon(host->ServerRunning && !host->Busy
? QIcon(QPixmap(QString::fromUtf8(":/connect.png")))
: QIcon(QPixmap(QString::fromUtf8(":/disconnect.png"))));
contextChooser->setIcon(host->ServerRunning && !host->Busy ? Icons::connect()
: Icons::disconnect());
if(status != eReplayCreate_Success)
{
contextChooser->setIcon(QIcon(QPixmap(QString::fromUtf8(":/cross.png"))));
contextChooser->setIcon(Icons::cross());
contextChooser->setText(tr("Replay Context: %1").arg("Local"));
statusText->setText(tr("Connection failed: %1").arg(ToQStr(status)));
}
@@ -26,6 +26,7 @@
#include <float.h>
#include <QScrollBar>
#include "3rdparty/toolwindowmanager/ToolWindowManager.h"
#include "Code/Resources.h"
#include "Windows/BufferViewer.h"
#include "Windows/ConstantBufferPreviewer.h"
#include "Windows/MainWindow.h"
@@ -505,8 +506,8 @@ void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT
void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderResource *shaderInput,
RDTreeWidget *resources)
{
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
const D3D11PipelineState::ShaderStage::ResourceView &r = view.res;
@@ -724,8 +725,8 @@ void D3D11PipelineStateViewer::clearState()
ui->csUAVs->clear();
QPixmap tick(QString::fromUtf8(":/tick.png"));
QPixmap cross(QString::fromUtf8(":/cross.png"));
const QPixmap &tick = Pixmaps::tick();
const QPixmap &cross = Pixmaps::cross();
ui->fillMode->setText(tr("Solid", "Fill Mode"));
ui->cullMode->setText(tr("Front", "Cull Mode"));
@@ -773,9 +774,6 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11PipelineState::ShaderSt
{
ShaderReflection *shaderDetails = stage.ShaderDetails;
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
if(stage.Shader == ResourceId())
shader->setText(tr("Unbound Shader"));
else
@@ -1028,11 +1026,11 @@ void D3D11PipelineStateViewer::setState()
const D3D11PipelineState &state = m_Ctx.CurD3D11PipelineState;
const FetchDrawcall *draw = m_Ctx.CurDrawcall();
QPixmap tick(QString::fromUtf8(":/tick.png"));
QPixmap cross(QString::fromUtf8(":/cross.png"));
const QPixmap &tick = Pixmaps::tick();
const QPixmap &cross = Pixmaps::cross();
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
////////////////////////////////////////////////
// Vertex Input
@@ -1211,40 +1209,24 @@ void D3D11PipelineStateViewer::setState()
switch(topo)
{
case eTopology_PointList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_pointlist.png")));
break;
case eTopology_LineList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linelist.png")));
break;
case eTopology_LineStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linestrip.png")));
break;
case eTopology_TriangleList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_trilist.png")));
break;
case eTopology_TriangleStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_tristrip.png")));
break;
case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break;
case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break;
case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break;
case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break;
case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break;
case eTopology_LineList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linelist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj());
break;
case eTopology_LineStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linestrip_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj());
break;
case eTopology_TriangleList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_trilist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj());
break;
case eTopology_TriangleStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_tristrip_adj.png")));
break;
default:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_patch.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj());
break;
default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break;
}
bool ibufferUsed = draw && (draw->flags & eDraw_UseIBuffer);
@@ -26,6 +26,7 @@
#include <float.h>
#include <QScrollBar>
#include "3rdparty/toolwindowmanager/ToolWindowManager.h"
#include "Code/Resources.h"
#include "Windows/BufferViewer.h"
#include "Windows/ConstantBufferPreviewer.h"
#include "Windows/MainWindow.h"
@@ -566,8 +567,8 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view,
const D3D12PipelineState::ShaderStage *stage,
RDTreeWidget *resources)
{
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
const D3D12PipelineState::ResourceView &r = view.res;
bool uav = view.type == ViewTag::UAV;
@@ -817,8 +818,8 @@ void D3D12PipelineStateViewer::clearState()
clearShaderState(ui->psShader, ui->psResources, ui->psSamplers, ui->psCBuffers, ui->psUAVs);
clearShaderState(ui->csShader, ui->csResources, ui->csSamplers, ui->csCBuffers, ui->csUAVs);
QPixmap tick(QString::fromUtf8(":/tick.png"));
QPixmap cross(QString::fromUtf8(":/cross.png"));
const QPixmap &tick = Pixmaps::tick();
const QPixmap &cross = Pixmaps::cross();
ui->fillMode->setText(tr("Solid", "Fill Mode"));
ui->cullMode->setText(tr("Front", "Cull Mode"));
@@ -866,9 +867,6 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::ShaderSt
ShaderReflection *shaderDetails = stage.ShaderDetails;
const D3D12PipelineState &state = m_Ctx.CurD3D12PipelineState;
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
if(stage.Shader == ResourceId())
shader->setText(tr("Unbound Shader"));
else if(state.customName)
@@ -1164,11 +1162,11 @@ void D3D12PipelineStateViewer::setState()
const D3D12PipelineState &state = m_Ctx.CurD3D12PipelineState;
const FetchDrawcall *draw = m_Ctx.CurDrawcall();
QPixmap tick(QString::fromUtf8(":/tick.png"));
QPixmap cross(QString::fromUtf8(":/cross.png"));
const QPixmap &tick = Pixmaps::tick();
const QPixmap &cross = Pixmaps::cross();
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
////////////////////////////////////////////////
// Vertex Input
@@ -1252,40 +1250,24 @@ void D3D12PipelineStateViewer::setState()
switch(topo)
{
case eTopology_PointList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_pointlist.png")));
break;
case eTopology_LineList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linelist.png")));
break;
case eTopology_LineStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linestrip.png")));
break;
case eTopology_TriangleList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_trilist.png")));
break;
case eTopology_TriangleStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_tristrip.png")));
break;
case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break;
case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break;
case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break;
case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break;
case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break;
case eTopology_LineList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linelist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj());
break;
case eTopology_LineStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linestrip_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj());
break;
case eTopology_TriangleList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_trilist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj());
break;
case eTopology_TriangleStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_tristrip_adj.png")));
break;
default:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_patch.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj());
break;
default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break;
}
bool ibufferUsed = draw && (draw->flags & eDraw_UseIBuffer);
@@ -26,6 +26,7 @@
#include <float.h>
#include <QScrollBar>
#include "3rdparty/toolwindowmanager/ToolWindowManager.h"
#include "Code/Resources.h"
#include "Windows/BufferViewer.h"
#include "Windows/ConstantBufferPreviewer.h"
#include "Windows/MainWindow.h"
@@ -461,8 +462,8 @@ void GLPipelineStateViewer::clearState()
clearShaderState(ui->csShader, ui->csTextures, ui->csSamplers, ui->csUBOs, ui->csSubroutines,
ui->csReadWrite);
QPixmap tick(QString::fromUtf8(":/tick.png"));
QPixmap cross(QString::fromUtf8(":/cross.png"));
const QPixmap &tick = Pixmaps::tick();
const QPixmap &cross = Pixmaps::cross();
ui->fillMode->setText(tr("Solid", "Fill Mode"));
ui->cullMode->setText(tr("Front", "Cull Mode"));
@@ -522,8 +523,8 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s
const ShaderBindpointMapping &mapping = stage.BindpointMapping;
const GLPipelineState &state = m_Ctx.CurGLPipelineState;
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
if(stage.Shader == ResourceId())
{
@@ -1033,11 +1034,11 @@ void GLPipelineStateViewer::setState()
bool showDisabled = ui->showDisabled->isChecked();
bool showEmpty = ui->showEmpty->isChecked();
QPixmap tick(QString::fromUtf8(":/tick.png"));
QPixmap cross(QString::fromUtf8(":/cross.png"));
const QPixmap &tick = Pixmaps::tick();
const QPixmap &cross = Pixmaps::cross();
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
bool usedBindings[128] = {};
@@ -1133,40 +1134,24 @@ void GLPipelineStateViewer::setState()
switch(topo)
{
case eTopology_PointList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_pointlist.png")));
break;
case eTopology_LineList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linelist.png")));
break;
case eTopology_LineStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linestrip.png")));
break;
case eTopology_TriangleList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_trilist.png")));
break;
case eTopology_TriangleStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_tristrip.png")));
break;
case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break;
case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break;
case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break;
case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break;
case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break;
case eTopology_LineList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linelist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj());
break;
case eTopology_LineStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linestrip_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj());
break;
case eTopology_TriangleList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_trilist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj());
break;
case eTopology_TriangleStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_tristrip_adj.png")));
break;
default:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_patch.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj());
break;
default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break;
}
vs = ui->viBuffers->verticalScrollBar()->value();
@@ -26,6 +26,7 @@
#include <float.h>
#include <QScrollBar>
#include "3rdparty/toolwindowmanager/ToolWindowManager.h"
#include "Code/Resources.h"
#include "Windows/BufferViewer.h"
#include "Windows/ConstantBufferPreviewer.h"
#include "Windows/MainWindow.h"
@@ -520,7 +521,7 @@ void VulkanPipelineStateViewer::clearState()
clearShaderState(ui->fsShader, ui->fsResources, ui->fsUBOs);
clearShaderState(ui->csShader, ui->csResources, ui->csUBOs);
QPixmap tick(QString::fromUtf8(":/tick.png"));
const QPixmap &tick = Pixmaps::tick();
ui->fillMode->setText(tr("Solid", "Fill Mode"));
ui->cullMode->setText(tr("Front", "Cull Mode"));
@@ -654,8 +655,8 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails,
const ShaderResource *shaderRes = NULL;
const BindpointMap *bindMap = NULL;
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
bool isrw = false;
uint bindPoint = 0;
@@ -1034,8 +1035,8 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta
const ConstantBlock *cblock = NULL;
const BindpointMap *bindMap = NULL;
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
uint32_t slot = ~0U;
if(shaderDetails != NULL)
@@ -1212,8 +1213,8 @@ void VulkanPipelineStateViewer::setShaderState(const VulkanPipelineState::Shader
{
ShaderReflection *shaderDetails = stage.ShaderDetails;
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
if(stage.Shader == ResourceId())
shader->setText(tr("Unbound Shader"));
@@ -1420,11 +1421,11 @@ void VulkanPipelineStateViewer::setState()
bool showDisabled = ui->showDisabled->isChecked();
bool showEmpty = ui->showEmpty->isChecked();
QPixmap tick(QString::fromUtf8(":/tick.png"));
QPixmap cross(QString::fromUtf8(":/cross.png"));
const QPixmap &tick = Pixmaps::tick();
const QPixmap &cross = Pixmaps::cross();
QIcon action(QPixmap(QString::fromUtf8(":/action.png")));
QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png")));
const QIcon &action = Icons::action();
const QIcon &action_hover = Icons::action_hover();
bool usedBindings[128] = {};
@@ -1499,40 +1500,24 @@ void VulkanPipelineStateViewer::setState()
switch(topo)
{
case eTopology_PointList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_pointlist.png")));
break;
case eTopology_LineList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linelist.png")));
break;
case eTopology_LineStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_linestrip.png")));
break;
case eTopology_TriangleList:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_trilist.png")));
break;
case eTopology_TriangleStrip:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_tristrip.png")));
break;
case eTopology_PointList: ui->topologyDiagram->setPixmap(Pixmaps::topo_pointlist()); break;
case eTopology_LineList: ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist()); break;
case eTopology_LineStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip()); break;
case eTopology_TriangleList: ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist()); break;
case eTopology_TriangleStrip: ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip()); break;
case eTopology_LineList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linelist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linelist_adj());
break;
case eTopology_LineStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_linestrip_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_linestrip_adj());
break;
case eTopology_TriangleList_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_trilist_adj.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_trilist_adj());
break;
case eTopology_TriangleStrip_Adj:
ui->topologyDiagram->setPixmap(
QPixmap(QString::fromUtf8(":/topologies/topo_tristrip_adj.png")));
break;
default:
ui->topologyDiagram->setPixmap(QPixmap(QString::fromUtf8(":/topologies/topo_patch.png")));
ui->topologyDiagram->setPixmap(Pixmaps::topo_tristrip_adj());
break;
default: ui->topologyDiagram->setPixmap(Pixmaps::topo_patch()); break;
}
vs = ui->viBuffers->verticalScrollBar()->value();
+1 -1
View File
@@ -829,7 +829,7 @@
</property>
<property name="icon">
<iconset resource="../Resources/resources.qrc">
<normaloff>:/delete.png</normaloff>:/delete.png</iconset>
<normaloff>:/del.png</normaloff>:/del.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
+2
View File
@@ -107,6 +107,7 @@ SOURCES += Code/qrenderdoc.cpp \
Code/QRDUtils.cpp \
Code/FormatElement.cpp \
Code/RemoteHost.cpp \
Code/Resources.cpp \
Windows/Dialogs/AboutDialog.cpp \
Windows/MainWindow.cpp \
Windows/EventBrowser.cpp \
@@ -154,6 +155,7 @@ HEADERS += Code/CaptureContext.h \
Code/ScintillaSyntax.h \
Code/RemoteHost.h \
Code/QRDUtils.h \
Code/Resources.h \
Windows/Dialogs/AboutDialog.h \
Windows/MainWindow.h \
Windows/EventBrowser.h \
+2
View File
@@ -642,6 +642,7 @@
<ClCompile Include="Code\qprocessinfo.cpp" />
<ClCompile Include="Code\QRDUtils.cpp" />
<ClCompile Include="Code\RemoteHost.cpp" />
<ClCompile Include="Code\Resources.cpp" />
<ClCompile Include="Code\ScintillaSyntax.cpp" />
<ClCompile Include="generated\moc_AboutDialog.cpp" />
<ClCompile Include="generated\moc_APIInspector.cpp" />
@@ -857,6 +858,7 @@
<Outputs>generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h" />
<ClInclude Include="Code\Resources.h" />
<ClInclude Include="generated\ui_AboutDialog.h" />
<ClInclude Include="generated\ui_APIInspector.h" />
<ClInclude Include="generated\ui_BufferFormatSpecifier.h" />
@@ -522,6 +522,9 @@
<ClCompile Include="Widgets\Extended\RDTreeView.cpp">
<Filter>Widgets\Extended</Filter>
</ClCompile>
<ClCompile Include="Code\Resources.cpp">
<Filter>Code</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h">
@@ -797,6 +800,9 @@
<ClInclude Include="generated\ui_PixelHistoryView.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="Code\Resources.h">
<Filter>Code</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Resources\128.png">