Skip to content

Commit

Permalink
Set bg color
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKepzie committed Aug 27, 2015
1 parent 3368907 commit 14f3486
Showing 1 changed file with 72 additions and 24 deletions.
96 changes: 72 additions & 24 deletions Gui/RenderStatsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ using namespace Natron;
#define COL_RENDERED_TILES 11
#define COL_RENDERED_PLANES 12
#define COL_NB_CACHE_HIT 13
#define COL_NB_CACHE_HIT_DOWNSCALED 15
#define COL_NB_CACHE_MISS 14
#define COL_NB_CACHE_HIT_DOWNSCALED 14
#define COL_NB_CACHE_MISS 15

#define NUM_COLS 15
#define NUM_COLS 16


enum ItemsRoleEnum
Expand Down Expand Up @@ -255,6 +255,14 @@ class StatsTableModel : public TableModel
insertRow(row);
}

QColor c;
boost::shared_ptr<NodeGui> nodeUi = boost::dynamic_pointer_cast<NodeGui>(node->getNodeGui());
if (nodeUi) {
double r,g,b;
nodeUi->getColor(&r, &g, &b);
c.setRgbF(r, g, b);
}

{
TableItem* item;
if (exists) {
Expand All @@ -269,10 +277,6 @@ class StatsTableModel : public TableModel
assert(item);
boost::shared_ptr<NodeGui> nodeUi = boost::dynamic_pointer_cast<NodeGui>(node->getNodeGui());
if (nodeUi) {
double r,g,b;
nodeUi->getColor(&r, &g, &b);
QColor c;
c.setRgbF(r, g, b);
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
Expand All @@ -294,6 +298,10 @@ class StatsTableModel : public TableModel
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
assert(item);
if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setText(node->getPluginID().c_str());
if (!exists) {
view->setItem(row, COL_PLUGIN_ID, item);
Expand All @@ -315,6 +323,10 @@ class StatsTableModel : public TableModel
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
assert(item);
if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setData((int)eItemsRoleTime, timeSoFar);
item->setText(Timer::printAsTime(timeSoFar,false));

Expand All @@ -340,7 +352,10 @@ class StatsTableModel : public TableModel
str = "No";
}
item->setText(str);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
if (!exists) {
view->setItem(row, COL_SUPPORT_TILES, item);
}
Expand All @@ -365,7 +380,10 @@ class StatsTableModel : public TableModel
str = "No";
}
item->setText(str);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
if (!exists) {
view->setItem(row, COL_SUPPORT_RS, item);
}
Expand All @@ -389,7 +407,10 @@ class StatsTableModel : public TableModel
str.append(' ');
}
item->setText(str);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
if (!exists) {
view->setItem(row, COL_MIPMAP_LEVEL, item);
}
Expand Down Expand Up @@ -422,7 +443,10 @@ class StatsTableModel : public TableModel
str.append("A");
}
item->setText(str);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
if (!exists) {
view->setItem(row, COL_CHANNELS, item);
}
Expand Down Expand Up @@ -452,7 +476,10 @@ class StatsTableModel : public TableModel
break;
}
item->setText(str);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
if (!exists) {
view->setItem(row, COL_PREMULT, item);
}
Expand All @@ -472,7 +499,10 @@ class StatsTableModel : public TableModel
const RectD& rod = stats.getRoD();
str = QString("(%1, %2, %3, %4)").arg(rod.x1).arg(rod.y1).arg(rod.x2).arg(rod.y2);
item->setText(str);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
if (!exists) {
view->setItem(row, COL_ROD, item);
}
Expand All @@ -497,7 +527,10 @@ class StatsTableModel : public TableModel
str = "-";
}
item->setText(str);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
if (!exists) {
view->setItem(row, COL_IDENTITY, item);
}
Expand Down Expand Up @@ -532,7 +565,10 @@ class StatsTableModel : public TableModel
item->setData((int)eItemsRoleIdentityTilesInfo, tilesInfo);

QString str = QString::number(nbIdentityTiles) + QString(" tiles...");

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setText(str);
if (!exists) {
view->setItem(row, COL_IDENTITY_TILES, item);
Expand Down Expand Up @@ -568,7 +604,10 @@ class StatsTableModel : public TableModel
item->setData((int)eItemsRoleRenderedTilesInfo, tilesInfo);

QString str = QString::number(nbTiles) + QString(" tiles...");

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setText(str);
if (!exists) {
view->setItem(row, COL_RENDERED_TILES, item);
Expand All @@ -595,7 +634,10 @@ class StatsTableModel : public TableModel
planesInfo.append(it->c_str());
}


if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setText(planesInfo);
if (!exists) {
view->setItem(row, COL_RENDERED_PLANES, item);
Expand All @@ -605,7 +647,6 @@ class StatsTableModel : public TableModel
TableItem* item;

int nb = 0;
QString tilesInfo;
if (exists) {
item = view->item(row, COL_NB_CACHE_HIT);
nb = item->text().toInt();
Expand All @@ -621,7 +662,10 @@ class StatsTableModel : public TableModel
nb += nbCacheHits;

QString str = QString::number(nb);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setText(str);
if (!exists) {
view->setItem(row, COL_NB_CACHE_HIT, item);
Expand All @@ -631,7 +675,6 @@ class StatsTableModel : public TableModel
TableItem* item;

int nb = 0;
QString tilesInfo;
if (exists) {
item = view->item(row, COL_NB_CACHE_HIT_DOWNSCALED);
nb = item->text().toInt();
Expand All @@ -648,7 +691,10 @@ class StatsTableModel : public TableModel
nb += nbCacheHitButDown;

QString str = QString::number(nb);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setText(str);
if (!exists) {
view->setItem(row, COL_NB_CACHE_HIT_DOWNSCALED, item);
Expand All @@ -658,7 +704,6 @@ class StatsTableModel : public TableModel
TableItem* item;

int nb = 0;
QString tilesInfo;
if (exists) {
item = view->item(row, COL_NB_CACHE_MISS);
nb = item->text().toInt();
Expand All @@ -674,7 +719,10 @@ class StatsTableModel : public TableModel
nb += nbCacheMiss;

QString str = QString::number(nb);

if (nodeUi) {
item->setTextColor(Qt::black);
item->setBackgroundColor(c);
}
item->setText(str);
if (!exists) {
view->setItem(row, COL_NB_CACHE_MISS, item);
Expand Down Expand Up @@ -945,7 +993,7 @@ RenderStatsDialog::RenderStatsDialog(Gui* gui)
#endif
_imp->view->header()->setStretchLastSection(true);
_imp->view->setUniformRowHeights(true);
_imp->view->setSortingEnabled(true);
_imp->view->setSortingEnabled(false);
_imp->view->sortByColumn(COL_TIME, Qt::DescendingOrder);
refreshAdvancedColsVisibility();
QItemSelectionModel* selModel = _imp->view->selectionModel();
Expand Down

0 comments on commit 14f3486

Please sign in to comment.