diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 7e3096d95..e2b3ee427 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -151,11 +151,7 @@ set( SOURCES main.cpp GUI/BoxesList/boxscroller.cpp - #GUI/BrushWidgets/bookmarkedbrushes.cpp - #GUI/BrushWidgets/brushlabel.cpp GUI/ColorWidgets/bookmarkedcolors.cpp - GUI/ColorWidgets/paintcolorwidget.cpp - #GUI/Dialogs/animationtopaintdialog.cpp GUI/Dialogs/dialogsinterfaceimpl.cpp GUI/Expressions/expressiondialog.cpp GUI/Expressions/expressioneditor.cpp @@ -170,7 +166,6 @@ set( GUI/canvasbasewrappernode.cpp GUI/canvaswindowevents.cpp GUI/canvaswrappernode.cpp - #GUI/closesignalingdockwidget.cpp GUI/ekeyfilter.cpp GUI/ewidgetsimpl.cpp GUI/layouthandler.cpp @@ -218,20 +213,14 @@ set( GUI/qrealanimatorvalueslider.cpp GUI/fontswidget.cpp GUI/fillstrokesettings.cpp - #GUI/BrushWidgets/brushselectionwidget.cpp GUI/ColorWidgets/colorwidgetshaders.cpp - #GUI/BrushWidgets/brushwidget.cpp GUI/toolbox.cpp ) set( HEADERS GUI/BoxesList/boxscroller.h - #GUI/BrushWidgets/bookmarkedbrushes.h - #GUI/BrushWidgets/brushlabel.h GUI/ColorWidgets/bookmarkedcolors.h - GUI/ColorWidgets/paintcolorwidget.h - #GUI/Dialogs/animationtopaintdialog.h GUI/Dialogs/dialogsinterfaceimpl.h GUI/Expressions/expressiondialog.h GUI/Expressions/expressioneditor.h @@ -245,7 +234,6 @@ set( GUI/Settings/pluginssettingswidget.h GUI/canvasbasewrappernode.h GUI/canvaswrappernode.h - #GUI/closesignalingdockwidget.h GUI/ekeyfilter.h GUI/ewidgetsimpl.h GUI/layouthandler.h @@ -291,9 +279,7 @@ set( GUI/mainwindow.h GUI/window.h GUI/qrealanimatorvalueslider.h - #GUI/BrushWidgets/brushselectionwidget.h GUI/ColorWidgets/colorwidgetshaders.h - #GUI/BrushWidgets/brushwidget.h ) set( diff --git a/src/app/GUI/ColorWidgets/paintcolorwidget.cpp b/src/app/GUI/ColorWidgets/paintcolorwidget.cpp deleted file mode 100644 index 6530e4d92..000000000 --- a/src/app/GUI/ColorWidgets/paintcolorwidget.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* -# -# 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. -# -*/ - -// Fork of enve - Copyright (C) 2016-2020 Maurycy Liebner - -#include "paintcolorwidget.h" - -#include "colorvaluerect.h" -#include "colorlabel.h" -#include "colorpickingwidget.h" -#include "GUI/mainwindow.h" -#include "widgets/actionbutton.h" -#include - -#include - -PaintColorWidget::PaintColorWidget(QWidget* const parent) : - QWidget(parent) { - rRect = new ColorValueRect(RED_PROGRAM, this); - gRect = new ColorValueRect(GREEN_PROGRAM, this); - bRect = new ColorValueRect(BLUE_PROGRAM, this); - - hRect = new ColorValueRect(HUE_PROGRAM, this); - hsvSatRect = new ColorValueRect(HSV_SATURATION_PROGRAM, this); - vRect = new ColorValueRect(VALUE_PROGRAM, this); - - hslSatRect = new ColorValueRect(HSL_SATURATION_PROGRAM, this); - lRect = new ColorValueRect(LIGHTNESS_PROGRAM, this); - - aRect = new ColorValueRect(ALPHA_PROGRAM, this); - - mColorLabel = new ColorLabel(this); - - connect(rRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromRGB); - connect(gRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromRGB); - connect(bRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromRGB); - - connect(hRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromHSV); - connect(hsvSatRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromHSV); - connect(vRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromHSV); - - connect(hslSatRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromHSL); - connect(lRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromHSL); - - connect(aRect, &ColorValueRect::valueChanged, - this, &PaintColorWidget::updateFromHSV); - - const auto layout = new QVBoxLayout(this); - - layout->addWidget(rRect); - layout->addWidget(gRect); - layout->addWidget(bRect); - - layout->addWidget(hRect); - layout->addWidget(hsvSatRect); - layout->addWidget(vRect); - - layout->addWidget(hslSatRect); - layout->addWidget(lRect); - - layout->addWidget(aRect); - - const QString pickIcon = "toolbarButtons/pickUnchecked.png"; - const auto pickingButton = new ActionButton(pickIcon, "", this); - connect(pickingButton, &ActionButton::released, - this, &PaintColorWidget::startColorPicking); - - const auto colorPickLay = new QHBoxLayout(); - colorPickLay->addWidget(mColorLabel); - colorPickLay->addWidget(pickingButton); - layout->addLayout(colorPickLay); - - setLayout(layout); -} - -void PaintColorWidget::setDisplayedColor(const QColor& color) { - rRect->setDisplayedValue(color.redF()); - gRect->setDisplayedValue(color.greenF()); - bRect->setDisplayedValue(color.blueF()); - - hRect->setDisplayedValue(qBound(0., color.hueF(), 1.)); - hsvSatRect->setDisplayedValue(color.hsvSaturationF()); - vRect->setDisplayedValue(color.valueF()); - - hslSatRect->setDisplayedValue(color.hslSaturationF()); - lRect->setDisplayedValue(color.lightnessF()); - - aRect->setDisplayedValue(color.alphaF()); - - rRect->setColor(color); - gRect->setColor(color); - bRect->setColor(color); - - hRect->setColor(color); - hsvSatRect->setColor(color); - vRect->setColor(color); - - hslSatRect->setColor(color); - lRect->setColor(color); - - aRect->setColor(color); - - mColorLabel->setColor(color); - mColorLabel->setAlpha(color.alphaF()); -} - -void PaintColorWidget::startColorPicking() { - const auto parent = MainWindow::sGetInstance(); - const auto screen = parent->windowHandle()->screen(); - const auto wid = new ColorPickingWidget(screen, parent); - connect(wid, &ColorPickingWidget::colorSelected, - [this](const QColor & color) { - setColor(color); - }); -} - -void PaintColorWidget::setColor(const QColor& color) { - setDisplayedColor(color); - emit colorChanged(color); -} - -void PaintColorWidget::updateFromRGB() { - const qreal red = rRect->value(); - const qreal green = gRect->value(); - const qreal blue = bRect->value(); - const qreal alpha = aRect->value(); - - setColor(QColor::fromRgbF(red, green, blue, alpha)); -} - -void PaintColorWidget::updateFromHSV() { - const qreal hue = hRect->value(); - const qreal saturation = hsvSatRect->value(); - const qreal value = vRect->value(); - const qreal alpha = aRect->value(); - - setColor(QColor::fromHsvF(hue, saturation, value, alpha)); -} - -void PaintColorWidget::updateFromHSL() { - const qreal hue = hRect->value(); - const qreal saturation = hslSatRect->value(); - const qreal lightness = lRect->value(); - const qreal alpha = aRect->value(); - - setColor(QColor::fromHslF(hue, saturation, lightness, alpha)); -} diff --git a/src/app/GUI/ColorWidgets/paintcolorwidget.h b/src/app/GUI/ColorWidgets/paintcolorwidget.h deleted file mode 100644 index c36133f65..000000000 --- a/src/app/GUI/ColorWidgets/paintcolorwidget.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -# -# 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. -# -*/ - -// Fork of enve - Copyright (C) 2016-2020 Maurycy Liebner - -#ifndef PAINTCOLORWIDGET_H -#define PAINTCOLORWIDGET_H - -#include -#include - -class ColorValueRect; -class ColorLabel; - -class PaintColorWidget : public QWidget { - Q_OBJECT -public: - PaintColorWidget(QWidget* const parent = nullptr); - - void setDisplayedColor(const QColor& color); -signals: - void colorChanged(const QColor& color); -private: - void startColorPicking(); - void setColor(const QColor& color); - - void updateFromRGB(); - void updateFromHSV(); - void updateFromHSL(); - - ColorValueRect* rRect; - ColorValueRect* gRect; - ColorValueRect* bRect; - ColorValueRect* hRect; - ColorValueRect* hsvSatRect; - ColorValueRect* vRect; - ColorValueRect* hslSatRect; - ColorValueRect* lRect; - ColorValueRect* aRect; - ColorLabel* mColorLabel; -}; - -#endif // PAINTCOLORWIDGET_H