citra-qt: Polish the pica tracing widget.

Changed start/stop button to reflect current tracing status.
Properly labeled column headers.
This commit is contained in:
Tony Wasserka 2014-10-26 11:40:12 +01:00
parent bf6b23f4a0
commit 706f9c5574
2 changed files with 26 additions and 1 deletions

View File

@ -49,6 +49,24 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const
return QVariant();
}
QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
switch(role) {
case Qt::DisplayRole:
{
if (section == 0) {
return tr("Command Name");
} else if (section == 1) {
return tr("Data");
}
break;
}
}
return QVariant();
}
void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace)
{
beginResetModel();
@ -70,7 +88,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
list_widget->setFont(QFont("monospace"));
list_widget->setRootIsDecorated(false);
QPushButton* toggle_tracing = new QPushButton(tr("Start Tracing"));
toggle_tracing = new QPushButton(tr("Start Tracing"));
connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing()));
connect(this, SIGNAL(TracingFinished(const Pica::DebugUtils::PicaTrace&)),
@ -88,8 +106,10 @@ void GPUCommandListWidget::OnToggleTracing()
{
if (!Pica::DebugUtils::IsPicaTracing()) {
Pica::DebugUtils::StartPicaTracing();
toggle_tracing->setText(tr("Stop Tracing"));
} else {
pica_trace = Pica::DebugUtils::FinishPicaTracing();
emit TracingFinished(*pica_trace);
toggle_tracing->setText(tr("Start Tracing"));
}
}

View File

@ -10,6 +10,8 @@
#include "video_core/gpu_debugger.h"
#include "video_core/debug_utils/debug_utils.h"
class QPushButton;
class GPUCommandListModel : public QAbstractListModel
{
Q_OBJECT
@ -20,6 +22,7 @@ public:
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
public slots:
void OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace);
@ -43,4 +46,6 @@ signals:
private:
std::unique_ptr<Pica::DebugUtils::PicaTrace> pica_trace;
QPushButton* toggle_tracing;
};