Skip to content

Commit

Permalink
Merge branch 'main' into xml
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Mar 6, 2024
2 parents ce273ab + c907446 commit d80892b
Show file tree
Hide file tree
Showing 47 changed files with 427 additions and 259 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ build-*
*.diff
*.patch
ffmpeg

*.7z
distfiles
backup
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[submodule "src/skia"]
[submodule "src/engine/skia"]
path = src/engine/skia
url = https://github.com/friction2d/skia
[submodule "src/gperftools"]
path = src/gperftools
url = https://github.com/friction2d/gperftools
[submodule "src/plugins/shaders"]
path = src/plugins/shaders
url = https://github.com/friction2d/friction-shader-plugins
[submodule "docs"]
path = docs
url = https://github.com/friction2d/friction2d.github.io
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.12)
project(friction.graphics)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/src/cmake")
Expand All @@ -31,13 +31,13 @@ if(UNIX AND NOT APPLE)
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_NAME ${FRICTION_NAME})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_SUMMARY})
set(CPACK_PACKAGE_VENDOR ${PROJECT_COPYRIGHT})
set(CPACK_STRIP_FILES TRUE)

set(CPACK_RPM_SPEC_MORE_DEFINE "%define _build_id_links none")
set(CPACK_RPM_PACKAGE_LICENSE ${PROJECT_LICENSE})
set(CPACK_RPM_PACKAGE_SUMMARY ${PROJECT_DESCRIPTION})
set(CPACK_RPM_PACKAGE_SUMMARY ${PROJECT_SUMMARY})
set(CPACK_RPM_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})
set(CPACK_RPM_PACKAGE_URL ${PROJECT_HOMEPAGE_URL})
set(CPACK_RPM_FILE_NAME "${FRICTION_NAME}.rpm")
Expand All @@ -53,6 +53,7 @@ endif()

add_subdirectory(src/engine)
if(UNIX)
option(BUILD_TESTING "Don't build gperftools tests" OFF)
add_subdirectory(src/gperftools)
endif()
add_subdirectory(src/core)
Expand Down
2 changes: 1 addition & 1 deletion docs
7 changes: 4 additions & 3 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# See 'README.md' for more information.
#

cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.12)
project(friction LANGUAGES CXX)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
Expand Down Expand Up @@ -92,9 +92,9 @@ if(WIN32)
set(WINDOWS_ICON_FILE ${FRICTION_NAME}.ico)
set(ICON_FILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${FRICTION_NAME}.ico)
set(GUI_TYPE WIN32)
set(PRODUCT_COMMENTS "${FRICTION_DISPLAY_NAME} ${PROJECT_DESCRIPTION}")
set(PRODUCT_COMMENTS "${FRICTION_DISPLAY_NAME}")
set(PRODUCT_COMPANY_NAME ${FRICTION_DISPLAY_NAME})
set(PRODUCT_FILE_DESCRIPTION "${FRICTION_DISPLAY_NAME} ${PROJECT_DESCRIPTION}")
set(PRODUCT_FILE_DESCRIPTION "${FRICTION_DISPLAY_NAME}")
set(PRODUCT_VERSION "${PROJECT_VERSION}")
set(PRODUCT_INTERNAL_NAME ${FRICTION_DISPLAY_NAME})
set(PRODUCT_COMPANY_COPYRIGHT ${PROJECT_COPYRIGHT})
Expand Down Expand Up @@ -404,6 +404,7 @@ set(
boxtypemenu.h
GUI/Settings/labeledslider.h
GUI/uilayout.h
GUI/vlabel.h
)

set(
Expand Down
9 changes: 9 additions & 0 deletions src/app/GUI/ColorWidgets/colorlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ void ColorLabel::setAlpha(const qreal alpha_t) {
update();
}

void ColorLabel::addBookmark()
{
const QColor col = QColor::fromHsvF(qreal(mHue),
qreal(mSaturation),
qreal(mValue),
mAlpha);
Document::sInstance->addBookmarkColor(col);
}

void ColorLabel::paintGL() {
qreal pixelRatio = devicePixelRatioF();
glClear(GL_COLOR_BUFFER_BIT);
Expand Down
2 changes: 2 additions & 0 deletions src/app/GUI/ColorWidgets/colorlabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class ColorLabel : public ColorWidget {
void setLastColorHSV(GLfloat h, GLfloat s, GLfloat v);
void mousePressEvent(QMouseEvent *e);
void setAlpha(const qreal alpha_t);
void addBookmark();

private:
void paintGL();
qreal mAlpha = 1;
Expand Down
10 changes: 10 additions & 0 deletions src/app/GUI/ColorWidgets/colorsettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include "GUI/global.h"
#include "GUI/actionbutton.h"
#include "GUI/ColorWidgets/savedcolorswidget.h"
#include "appsupport.h"

#include <QShortcut>

void ColorSettingsWidget::updateWidgetTargets()
{
Expand Down Expand Up @@ -275,6 +278,13 @@ ColorSettingsWidget::ColorSettingsWidget(QWidget *parent) : QWidget(parent) {
mColorLabel->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);

const auto book = new QShortcut(QKeySequence(AppSupport::getSettings("shortcuts",
"colorBookmark",
"B").toString()),
this);
connect(book, &QShortcut::activated,
mColorLabel, &ColorLabel::addBookmark);

// mWheelWidget->setLayout(mWheelLayout);
// mWheelLayout->setAlignment(Qt::AlignTop);
// wheel_triangle_widget = new H_Wheel_SV_Triangle(this);
Expand Down
10 changes: 10 additions & 0 deletions src/app/GUI/RenderWidgets/renderinstancewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "renderinstancewidget.h"
#include "GUI/global.h"
#include <QMenu>
#include "canvas.h"
#include "outputsettingsdialog.h"
#include "outputsettingsprofilesdialog.h"
#include "outputsettingsdisplaywidget.h"
Expand Down Expand Up @@ -389,6 +390,15 @@ void RenderInstanceWidget::read(eReadStream &src) {
setChecked(checked);
}

void RenderInstanceWidget::updateRenderSettings()
{
const RenderSettings &renderSettings = mSettings.getRenderSettings();
mRenderSettingsDisplayWidget->setRenderSettings(mSettings.getTargetCanvas(),
renderSettings);
const auto label = mSettings.getTargetCanvas()->prp_getName();
if (!label.isEmpty()) { mNameLabel->setText(label); }
}

#include "Private/esettings.h"
OutputProfilesListButton::OutputProfilesListButton(RenderInstanceWidget *parent) :
QPushButton(parent) {
Expand Down
2 changes: 2 additions & 0 deletions src/app/GUI/RenderWidgets/renderinstancewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class RenderInstanceWidget : public ClosableContainer {

void write(eWriteStream &dst) const;
void read(eReadStream &src);
void updateRenderSettings();

protected:
void mousePressEvent(QMouseEvent* e);
private:
Expand Down
13 changes: 10 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 Expand Up @@ -289,6 +289,13 @@ void RenderWidget::read(eReadStream &src)
}
}

void RenderWidget::updateRenderSettings()
{
for (const auto &wid: mRenderInstanceWidgets) {
wid->updateRenderSettings();
}
}

void RenderWidget::render(RenderInstanceSettings &settings)
{
const RenderSettings &renderSettings = settings.getRenderSettings();
Expand Down
1 change: 1 addition & 0 deletions src/app/GUI/RenderWidgets/renderwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class RenderWidget : public QWidget
void clearRenderQueue();
void write(eWriteStream& dst) const;
void read(eReadStream& src);
void updateRenderSettings();

signals:
void progress(int frame, int total);
Expand Down
3 changes: 3 additions & 0 deletions src/app/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,9 @@ void MainWindow::setupToolBar()
mLocalPivotAct = new QAction(mDocument.fLocalPivot ? QIcon::fromTheme("pivotLocal") : QIcon::fromTheme("pivotGlobal"),
tr("Pivot Global / Local"),
this);
mLocalPivotAct->setShortcut(QKeySequence(AppSupport::getSettings("shortcuts",
"localPivot",
"P").toString()));
connect(mLocalPivotAct, &QAction::triggered,
this, [this]() {
mDocument.fLocalPivot = !mDocument.fLocalPivot;
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
Loading

0 comments on commit d80892b

Please sign in to comment.