Skip to content

Commit

Permalink
Render widgets: UI/UX stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Aug 15, 2024
1 parent f860013 commit 9fa2d14
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/app/GUI/RenderWidgets/closablecontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ ClosableContainer::ClosableContainer(QWidget *parent) : QWidget(parent) {
mContWidget->setLayout(mContLayout);
//mContLayout->setMargin(0);
mContLayout->setAlignment(Qt::AlignTop);
mContLayout->setContentsMargins(0, 0, 0, 0);
mContLayout->setSpacing(0);
mVLayout->setSpacing(0);
mVLayout->setMargin(0);
mVLayout->setContentsMargins(0, 0, 0, 0);
Expand Down
40 changes: 26 additions & 14 deletions src/app/GUI/RenderWidgets/renderinstancewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ void RenderInstanceWidget::iniGUI()
setObjectName("darkWidget");
mNameLabel = new QLineEdit(this);
mNameLabel->setFocusPolicy(Qt::NoFocus);
mNameLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
mNameLabel->setFixedHeight(eSizesUI::button);
mNameLabel->setObjectName("RenderTitleWidget");
//mNameLabel->setObjectName("RenderTitleWidget");
mNameLabel->setReadOnly(true);
//mNameLabel->setFrame(false);

Expand Down Expand Up @@ -161,7 +162,7 @@ void RenderInstanceWidget::iniGUI()
this);
//mPlayButton->setObjectName("FlatButton");
mPlayButton->setFocusPolicy(Qt::NoFocus);
mPlayButton->setToolTip(tr("Open in default application"));
mPlayButton->setToolTip(tr("View/Play in default application"));
connect(mPlayButton, &QPushButton::pressed,
this, [this]() {
QString dst = mOutputDestinationLineEdit->text();
Expand All @@ -176,7 +177,7 @@ void RenderInstanceWidget::iniGUI()
QSizePolicy::Preferred);
mOutputDestinationLineEdit->setReadOnly(true);
mOutputDestinationLineEdit->setPlaceholderText(tr("Destination ..."));
mOutputDestinationLineEdit->setObjectName(QString::fromUtf8("OutputDestinationLineEdit"));
//mOutputDestinationLineEdit->setObjectName(QString::fromUtf8("OutputDestinationLineEdit"));

eSizesUI::widget.add(mOutputSettingsProfilesButton, [this](const int size) {
Q_UNUSED(size)
Expand All @@ -194,8 +195,8 @@ void RenderInstanceWidget::iniGUI()
outputDesinationLayout->setMargin(0);

outputDesinationLayout->addWidget(mOutputDestinationButton);
outputDesinationLayout->addWidget(mPlayButton);
outputDesinationLayout->addWidget(mOutputDestinationLineEdit);
outputDesinationLayout->addWidget(mPlayButton);

outputSettingsLayout->addWidget(outputDestinationWidget);

Expand Down Expand Up @@ -267,23 +268,34 @@ RenderInstanceSettings &RenderInstanceWidget::getSettings() {
return mSettings;
}

void RenderInstanceWidget::mousePressEvent(QMouseEvent *e) {
if(e->button() == Qt::RightButton) {
void RenderInstanceWidget::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::RightButton) {
QMenu menu(this);
menu.addAction("Duplicate");

const auto state = mSettings.getCurrentState();
const bool deletable = state != RenderState::rendering &&
state != RenderState::paused;
menu.addAction("Delete")->setEnabled(deletable);
const bool deletable = (state != RenderState::rendering && state != RenderState::paused);

const auto dupAct = menu.addAction(QIcon::fromTheme("duplicate"), tr("Duplicate"));
dupAct->setData(0);

const auto delAct = menu.addAction(QIcon::fromTheme("minus"), tr("Remove"));
delAct->setData(1);
delAct->setEnabled(deletable);

const auto act = menu.exec(e->globalPos());
if(act) {
if(act->text() == "Duplicate") {
if (act) {
switch (act->data().toInt()) {
case 0:
emit duplicate(mSettings);
} else if(act->text() == "Delete") {
break;
case 1:
deleteLater();
break;
default:;
}
}
} else return ClosableContainer::mousePressEvent(e);
} else { return ClosableContainer::mousePressEvent(e); }
}

void RenderInstanceWidget::openOutputSettingsDialog() {
Expand Down

0 comments on commit 9fa2d14

Please sign in to comment.