Skip to content

Commit

Permalink
Merge branch 'nui'
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Mar 5, 2024
2 parents 99c7266 + 66e14b3 commit c907446
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ build-*
ffmpeg
*.7z
distfiles
backup
1 change: 1 addition & 0 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ set(
boxtypemenu.h
GUI/Settings/labeledslider.h
GUI/uilayout.h
GUI/vlabel.h
)

set(
Expand Down
6 changes: 3 additions & 3 deletions src/app/GUI/RenderWidgets/renderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ RenderWidget::RenderWidget(QWidget *parent)
mMainLayout->setSpacing(0);
setLayout(mMainLayout);

QWidget *bottomWidget = new QWidget(this);
const auto bottomWidget = new QWidget(this);
bottomWidget->setContentsMargins(0, 0, 0, 0);
const auto bottomLayout = new QHBoxLayout(bottomWidget);

const auto darkPal= AppSupport::getDarkPalette();
const auto darkPal = AppSupport::getDarkPalette();
bottomWidget->setAutoFillBackground(true);
bottomWidget->setPalette(darkPal);
bottomWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
Expand Down Expand Up @@ -137,8 +137,8 @@ RenderWidget::RenderWidget(QWidget *parent)
mScrollArea->setWidgetResizable(true);
mScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

bottomLayout->addWidget(mRenderProgressBar);
bottomLayout->addWidget(mStartRenderButton);
bottomLayout->addWidget(mRenderProgressBar);
bottomLayout->addWidget(mStopRenderButton);
bottomLayout->addWidget(mAddRenderButton);
bottomLayout->addWidget(mClearQueueButton);
Expand Down
10 changes: 6 additions & 4 deletions src/app/GUI/qdoubleslider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ void SliderEdit::lineEditingFinished() {

QDoubleSlider::QDoubleSlider(const qreal minVal, const qreal maxVal,
const qreal prefferedStep,
QWidget * const parent) : QWidget(parent) {
QWidget * const parent,
bool autoAdjust) : QWidget(parent) {
mAutoAdjustWidth = autoAdjust;
mMinValue = minVal;
mMaxValue = maxVal;
mPrefferedValueStep = prefferedStep;
Expand Down Expand Up @@ -142,7 +144,7 @@ void QDoubleSlider::setValueSliderVisible(const bool valueSliderVisible) {

void QDoubleSlider::setNameVisible(const bool nameVisible) {
mShowName = nameVisible;
fitWidthToContent();
if (mAutoAdjustWidth) { fitWidthToContent(); }
}

void QDoubleSlider::setName(const QString &name) {
Expand All @@ -152,7 +154,7 @@ void QDoubleSlider::setName(const QString &name) {

void QDoubleSlider::setNumberDecimals(const int decimals) {
mDecimals = decimals;
fitWidthToContent();
if (mAutoAdjustWidth) { fitWidthToContent(); }
updateValueString();
}

Expand All @@ -172,7 +174,7 @@ void QDoubleSlider::setValueRange(const qreal min, const qreal max) {
mMinValue = min;
mMaxValue = max;
setDisplayedValue(clamped(mValue));
fitWidthToContent();
if (mAutoAdjustWidth) { fitWidthToContent(); }
}

void QDoubleSlider::paint(QPainter * const p, const bool enabled) {
Expand Down
4 changes: 3 additions & 1 deletion src/app/GUI/qdoubleslider.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class QDoubleSlider : public QWidget {
QDoubleSlider(const qreal minVal,
const qreal maxVal,
const qreal prefferedStep,
QWidget * const parent = nullptr);
QWidget * const parent = nullptr,
bool autoAdjust = true);
QDoubleSlider(const QString& name,
const qreal minVal,
const qreal maxVal,
Expand Down Expand Up @@ -147,6 +148,7 @@ class QDoubleSlider : public QWidget {
QPoint mGlobalPressPos;
qreal mLastValue;
bool mShowValueSlider = true;
bool mAutoAdjustWidth = true;
};

#endif // QDOUBLESLIDER_H
61 changes: 61 additions & 0 deletions src/app/GUI/vlabel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
#
# Friction - https://friction.graphics
#
# Copyright (c) Friction contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# See 'README.md' for more information.
#
*/

#ifndef VLABEL_H
#define VLABEL_H

#include <QLabel>
#include <QStylePainter>
#include <QPaintEvent>

class VLabel : public QLabel
{
Q_OBJECT

public:
explicit VLabel(QWidget *parent = nullptr)
: QLabel(parent) {}
explicit VLabel(const QString &text,
QWidget *parent = nullptr)
: QLabel(text, parent) {}

protected:
void paintEvent(QPaintEvent*)
{
QStylePainter painter(this);
painter.rotate(90);
painter.drawText(0, -(sizeHint().width() / 2)-2, text());
}
QSize sizeHint() const
{
const auto s = QLabel::sizeHint();
return QSize(s.height(), s.width());
}
QSize minimumSizeHint() const
{
const auto s = QLabel::minimumSizeHint();
return QSize(s.height(), s.width());
}
};

#endif // VLABEL_H
23 changes: 23 additions & 0 deletions src/scripts/git-backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -e -x

CWD=`pwd`
DIR=${CWD}/backup
DATE=`date +%s`
URL=https://github.com/friction2d
BACKUP_DIR=${DIR}/friction-git-backup-${DATE}
REPOS="
friction
friction2d.github.io
skia
gperftools
sfntly
friction-shader-plugins
mxe
"

mkdir -p ${BACKUP_DIR}
cd ${BACKUP_DIR}
for repo in ${REPOS}; do
git clone --mirror ${URL}/${repo}.git
done

0 comments on commit c907446

Please sign in to comment.