From 8ae8510c9a188ac4714ca54d8b99a18b6f1dc4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Sun, 3 Mar 2024 01:37:29 +0100 Subject: [PATCH 1/5] Update renderwidget.cpp --- src/app/GUI/RenderWidgets/renderwidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/GUI/RenderWidgets/renderwidget.cpp b/src/app/GUI/RenderWidgets/renderwidget.cpp index 33921e75f..46aca8044 100755 --- a/src/app/GUI/RenderWidgets/renderwidget.cpp +++ b/src/app/GUI/RenderWidgets/renderwidget.cpp @@ -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); @@ -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); From 2b024d1df64ceb431bb8db814dad11e01568346a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Sun, 3 Mar 2024 01:48:21 +0100 Subject: [PATCH 2/5] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 41d5353ff..ccc8bcad8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ build-* ffmpeg *.7z distfiles +backup From f4b7c20887245750b42973c81b963b327df4129f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Sun, 3 Mar 2024 01:50:19 +0100 Subject: [PATCH 3/5] Create git-backup.sh --- src/scripts/git-backup.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/scripts/git-backup.sh diff --git a/src/scripts/git-backup.sh b/src/scripts/git-backup.sh new file mode 100644 index 000000000..13a6ef193 --- /dev/null +++ b/src/scripts/git-backup.sh @@ -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 From 0dffa5542b733a657b95ce6353ea45344badcc4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Mon, 4 Mar 2024 21:24:20 +0100 Subject: [PATCH 4/5] Added VLabel --- src/app/CMakeLists.txt | 1 + src/app/GUI/vlabel.h | 61 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/app/GUI/vlabel.h diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 7fce4f659..e47f0114f 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -404,6 +404,7 @@ set( boxtypemenu.h GUI/Settings/labeledslider.h GUI/uilayout.h + GUI/vlabel.h ) set( diff --git a/src/app/GUI/vlabel.h b/src/app/GUI/vlabel.h new file mode 100644 index 000000000..d7e6b2797 --- /dev/null +++ b/src/app/GUI/vlabel.h @@ -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 . +# +# See 'README.md' for more information. +# +*/ + +#ifndef VLABEL_H +#define VLABEL_H + +#include +#include +#include + +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 From 66e14b36823c6bb49a7a2f53e3d7d19e1def921f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Tue, 5 Mar 2024 11:04:20 +0100 Subject: [PATCH 5/5] Update qdoubleslider Make fitWidthToContent an option, we don't want that function for all widgets. --- src/app/GUI/qdoubleslider.cpp | 10 ++++++---- src/app/GUI/qdoubleslider.h | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app/GUI/qdoubleslider.cpp b/src/app/GUI/qdoubleslider.cpp index bc562d722..782260269 100755 --- a/src/app/GUI/qdoubleslider.cpp +++ b/src/app/GUI/qdoubleslider.cpp @@ -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; @@ -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) { @@ -152,7 +154,7 @@ void QDoubleSlider::setName(const QString &name) { void QDoubleSlider::setNumberDecimals(const int decimals) { mDecimals = decimals; - fitWidthToContent(); + if (mAutoAdjustWidth) { fitWidthToContent(); } updateValueString(); } @@ -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) { diff --git a/src/app/GUI/qdoubleslider.h b/src/app/GUI/qdoubleslider.h index 1cd5bd974..8b150170c 100755 --- a/src/app/GUI/qdoubleslider.h +++ b/src/app/GUI/qdoubleslider.h @@ -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, @@ -147,6 +148,7 @@ class QDoubleSlider : public QWidget { QPoint mGlobalPressPos; qreal mLastValue; bool mShowValueSlider = true; + bool mAutoAdjustWidth = true; }; #endif // QDOUBLESLIDER_H