Skip to content

Commit

Permalink
rti tab progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Apr 29, 2024
1 parent 714b5b6 commit 2fdc64c
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 39 deletions.
8 changes: 8 additions & 0 deletions relightlab/css/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ QPushButton.large, QToolButton.large {
max-width:200px;
}

QPushButton:checked {
background-color: rgba(42, 130, 218, 255);
}

QCommandLinkButton {
font-size:15px;
}


QLabel.recent {
font-size:9pt;
Expand Down
23 changes: 7 additions & 16 deletions relightlab/qlabelbutton.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
#ifndef QLABELBUTTON_H
#define QLABELBUTTON_H

#include <QPushButton>
#include <QCommandLinkButton>
#include <QLabel>
#include <QDebug>

class QLabelButton: public QPushButton {
class QLabelButton: public QCommandLinkButton {
public:
QLabelButton(QString text, QWidget *parent = nullptr): QPushButton(parent) {
init(text, QRect(10, 10, 130, 80));
QLabelButton(QString text, QString description = "", QWidget *parent = nullptr): QCommandLinkButton(text, description, parent) {
setCheckable(true);
setIcon(QIcon());
setMinimumWidth(200);
}
QLabelButton(QString text, QRect rect, QWidget *parent = nullptr): QPushButton(parent) {
init(text, rect);
}
void init(QString text, QRect rect) {
setGeometry(rect);
setFixedSize(150, 100);
label = new QLabel(this);
label->setGeometry(rect);
label->setText(text);
}
private:
QLabel *label = nullptr;
};

#endif // QLABELBUTTON_H
101 changes: 78 additions & 23 deletions relightlab/rtiplan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,40 @@
#include <QVBoxLayout>
#include <QSpinBox>
#include <QLineEdit>
#include <QButtonGroup>
#include <QComboBox>

RtiBasisRow::RtiBasisRow(QFrame *parent): QFrame(parent) {
QHBoxLayout *layout = new QHBoxLayout(this);
HelpLabel *label = new HelpLabel("Basis:", "rti/basis");
label->setFixedWidth(200);
layout->addWidget(label, 0, Qt::AlignLeft);

QHBoxLayout *buttons = new QHBoxLayout;
layout->addLayout(buttons, 1);
buttons->setSpacing(20);
layout->addStretch(1);

buttons->addStretch(1);
buttons->addWidget(new QLabelButton("PTM"), 0, Qt::AlignCenter);
buttons->addWidget(new QLabelButton("HSH"), 0, Qt::AlignCenter);
buttons->addWidget(new QLabelButton("RBF"), 0, Qt::AlignCenter);
buttons->addWidget(new QLabelButton("BNL"), 0, Qt::AlignCenter);
buttons->addStretch(1);
QButtonGroup *group = new QButtonGroup(this);

auto *ptm = new QLabelButton("PTM", "Polynomial Texture Map\nThis is a test");
group->addButton(ptm);
layout->addWidget(ptm, 0, Qt::AlignCenter);
connect(ptm, &QAbstractButton::clicked, this, [this](){emit basisChanged(Rti::PTM);});

auto *hsh = new QLabelButton("HSH", "HemiSpherical Harmonics");
group->addButton(hsh);
layout->addWidget(hsh, 0, Qt::AlignCenter);
connect(hsh, &QAbstractButton::clicked, this, [this](){emit basisChanged(Rti::HSH);});

auto *rbf = new QLabelButton("RBF", "Radial Basis Functions + PCA");
group->addButton(rbf);
layout->addWidget(rbf, 0, Qt::AlignCenter);
connect(rbf, &QAbstractButton::clicked, this, [this](){emit basisChanged(Rti::RBF);});

auto *bnl = new QLabelButton("BNL", "Bilinear interplation + PCA");
group->addButton(bnl);
layout->addWidget(bnl, 0, Qt::AlignCenter);
connect(bnl, &QAbstractButton::clicked, this, [this](){emit basisChanged(Rti::BILINEAR);});

layout->addStretch(1);
}

void RtiBasisRow::init(Rti::Type basis) {
Expand All @@ -34,10 +51,30 @@ RtiColorSpaceRow::RtiColorSpaceRow(QFrame *parent): QFrame(parent) {
HelpLabel *label = new HelpLabel("Color space:","rti/colorspace");
label->setFixedWidth(200);
layout->addWidget(label, 0, Qt::AlignLeft);
//layout->addWidget(new HelpLabel(""));
layout->addWidget(new QLabelButton("RGB"));
layout->addWidget(new QLabelButton("LRGB"));
layout->addWidget(new QLabelButton("YCC"));
layout->setSpacing(20);


layout->addStretch(1);


QButtonGroup *group = new QButtonGroup(this);
auto *rgb = new QLabelButton("RGB", "Standard");
group->addButton(rgb);
layout->addWidget(rgb, 0, Qt::AlignCenter);
connect(rgb, &QAbstractButton::clicked, this, [this](){emit colorspaceChanged(Rti::RGB);});

auto *lrgb = new QLabelButton("LRGB", "Albedo * Luminance.");
group->addButton(lrgb);
layout->addWidget(lrgb, 0, Qt::AlignCenter);
connect(lrgb, &QAbstractButton::clicked, this, [this](){emit colorspaceChanged(Rti::LRGB);});

auto *ycc = new QLabelButton("YCC", "Dedicated chrooma coefficients.");
group->addButton(ycc);
layout->addWidget(ycc, 0, Qt::AlignCenter);
connect(ycc, &QAbstractButton::clicked, this, [this](){emit colorspaceChanged(Rti::YCC);});

layout->addStretch(1);

}

void RtiColorSpaceRow::init(Rti::ColorSpace colorspace) {
Expand All @@ -47,16 +84,32 @@ void RtiColorSpaceRow::init(Rti::ColorSpace colorspace) {

RtiPlanesRow::RtiPlanesRow(QFrame *parent): QFrame(parent) {
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(new HelpLabel("Planes:", "rti/planes"));
layout->addWidget(new QLabelButton("12 coefficients"));
layout->addWidget(new QLabelButton("15 coefficients"));
layout->addWidget(new QLabelButton("18 coefficients"));
layout->addWidget(new QLabelButton("21 coefficients"));
layout->addWidget(new QLabelButton("24 coefficients"));
layout->addWidget(new QLabelButton("27 coefficients"));
layout->addWidget(new QLabelButton("0 chroma dedicated"));
layout->addWidget(new QLabelButton("1 chroma dedicated"));
layout->addWidget(new QLabelButton("2 chroma dedicated"));
HelpLabel *label = new HelpLabel("Planes:", "rti/planes");
label->setFixedWidth(200);
layout->addWidget(label, 0, Qt::AlignLeft);

layout->addStretch(1);
layout->addWidget(new QLabel("Total number of images:"));
auto *total_images = new QComboBox;
total_images->setFixedWidth(100);
int nimages[] = { 3, 4, 5, 6, 7, 8, 9 };
for(int i = 0; i < 7; i++) {
total_images->addItem(QString::number(nimages[i]));
}
layout->addWidget(total_images);

layout->addStretch(1);
layout->addWidget(new QLabel("Number of dedicated chroma images:"));
auto *chroma = new QComboBox;
chroma->setFixedWidth(100);
int nchroma[] = { 1, 2, 3 };
for(int i = 0; i < 3; i++) {
chroma->addItem(QString::number(nchroma[i]));
}
layout->addWidget(chroma);

layout->addStretch(1);

}

void RtiPlanesRow::init(int nplanes, int nchroma) {
Expand Down Expand Up @@ -101,6 +154,8 @@ RtiPlan::RtiPlan(QWidget *parent): QFrame(parent) {
layout->addWidget(format_row);
connect(format_row, &RtiFormatRow::formatChanged, this, &RtiPlan::formatChanged);

layout->addStretch();

}

void RtiPlan::basisChanged(Rti::Type basis) {
Expand Down

0 comments on commit 2fdc64c

Please sign in to comment.