Skip to content

Commit

Permalink
Move OptimalScrollArea to ui
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Mar 15, 2024
1 parent af194d2 commit ad4d0dc
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 29 deletions.
12 changes: 0 additions & 12 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ endif()
set(
SOURCES
main.cpp
GUI/BoxesList/OptimalScrollArea/scrollvisiblepartbase.cpp
GUI/BoxesList/boxscroller.cpp
#GUI/BrushWidgets/bookmarkedbrushes.cpp
#GUI/BrushWidgets/brushlabel.cpp
Expand Down Expand Up @@ -217,10 +216,6 @@ set(
evfileio.cpp
iconloader.cpp
renderhandler.cpp
GUI/BoxesList/OptimalScrollArea/scrollarea.cpp
GUI/BoxesList/OptimalScrollArea/scrollwidget.cpp
GUI/BoxesList/OptimalScrollArea/scrollwidgetvisiblepart.cpp
GUI/BoxesList/OptimalScrollArea/singlewidget.cpp
GUI/BoxesList/boxsinglewidget.cpp
GUI/BoxesList/boxscrollwidget.cpp
GUI/BoxesList/boolpropertywidget.cpp
Expand All @@ -233,7 +228,6 @@ set(
GUI/GradientWidgets/currentgradientwidget.cpp
GUI/RenderWidgets/closablecontainer.cpp
GUI/BoxesList/boxtargetwidget.cpp
GUI/BoxesList/OptimalScrollArea/minimalscrollwidget.cpp
GUI/BoxesList/boxscrollarea.cpp
GUI/RenderWidgets/outputsettingsprofilesdialog.cpp
GUI/RenderWidgets/outputsettingsdisplaywidget.cpp
Expand All @@ -260,7 +254,6 @@ set(

set(
HEADERS
GUI/BoxesList/OptimalScrollArea/scrollvisiblepartbase.h
GUI/BoxesList/boxscroller.h
#GUI/BrushWidgets/bookmarkedbrushes.h
#GUI/BrushWidgets/brushlabel.h
Expand Down Expand Up @@ -315,10 +308,6 @@ set(
eimporters.h
iconloader.h
renderhandler.h
GUI/BoxesList/OptimalScrollArea/scrollarea.h
GUI/BoxesList/OptimalScrollArea/scrollwidget.h
GUI/BoxesList/OptimalScrollArea/scrollwidgetvisiblepart.h
GUI/BoxesList/OptimalScrollArea/singlewidget.h
GUI/BoxesList/boxsinglewidget.h
GUI/BoxesList/boxscrollwidget.h
GUI/BoxesList/boolpropertywidget.h
Expand All @@ -331,7 +320,6 @@ set(
GUI/GradientWidgets/currentgradientwidget.h
GUI/RenderWidgets/closablecontainer.h
GUI/BoxesList/boxtargetwidget.h
GUI/BoxesList/OptimalScrollArea/minimalscrollwidget.h
GUI/BoxesList/boxscrollarea.h
GUI/RenderWidgets/outputsettingsprofilesdialog.h
GUI/RenderWidgets/outputsettingsdisplaywidget.h
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/BoxesList/boxscrollarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#ifndef BOXSCROLLAREA_H
#define BOXSCROLLAREA_H
#include "OptimalScrollArea/scrollarea.h"
#include "optimalscrollarena/scrollarea.h"

class BoxScrollArea : public ScrollArea {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/BoxesList/boxscroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define BOXSCROLLWIDGETVISIBLEPART_H

#include <QWidget>
#include "OptimalScrollArea/scrollwidgetvisiblepart.h"
#include "optimalscrollarena/scrollwidgetvisiblepart.h"
#include "singlewidgettarget.h"
#include "framerange.h"

Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/BoxesList/boxscrollwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// Fork of enve - Copyright (C) 2016-2020 Maurycy Liebner

#include "boxscrollwidget.h"
#include "GUI/BoxesList/OptimalScrollArea/scrollarea.h"
#include "optimalscrollarena/scrollarea.h"
#include "Boxes/boundingbox.h"
#include "boxscroller.h"
#include "GUI/canvaswindow.h"
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/BoxesList/boxscrollwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef BOXSCROLLWIDGET_H
#define BOXSCROLLWIDGET_H

#include "OptimalScrollArea/scrollwidget.h"
#include "optimalscrollarena/scrollwidget.h"
#include "GUI/keyfocustarget.h"
class BoxScroller;
class ScrollArea;
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/BoxesList/boxsinglewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "boxsinglewidget.h"
#include "swt_abstraction.h"
#include "singlewidgettarget.h"
#include "OptimalScrollArea/scrollwidgetvisiblepart.h"
#include "optimalscrollarena/scrollwidgetvisiblepart.h"
#include "GUI/ColorWidgets/colorsettingswidget.h"

#include "Boxes/containerbox.h"
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/BoxesList/boxsinglewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef BOXSINGLEWIDGET_H
#define BOXSINGLEWIDGET_H

#include "OptimalScrollArea/singlewidget.h"
#include "optimalscrollarena/singlewidget.h"
#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/GradientWidgets/gradientslistwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef GRADIENTSLISTWIDGET_H
#define GRADIENTSLISTWIDGET_H

#include "GUI/BoxesList/OptimalScrollArea/scrollarea.h"
#include "optimalscrollarena/scrollarea.h"
class GradientWidget;
class DisplayedGradientsWidget;

Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/RenderWidgets/renderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "canvas.h"
#include "GUI/global.h"
#include "renderinstancewidget.h"
#include "GUI/BoxesList/OptimalScrollArea/scrollarea.h"
#include "optimalscrollarena/scrollarea.h"
#include "videoencoder.h"
#include "renderhandler.h"
#include "videoencoder.h"
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "canvaswindow.h"
#include "GUI/BoxesList/boxscrollwidget.h"
#include "clipboardcontainer.h"
#include "GUI/BoxesList/OptimalScrollArea/scrollarea.h"
#include "optimalscrollarena/scrollarea.h"
#include "GUI/BoxesList/boxscroller.h"
#include "GUI/RenderWidgets/renderwidget.h"
#include "fontswidget.h"
Expand Down
12 changes: 12 additions & 0 deletions src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ include_directories(
set(
SOURCES
dialogs/scenesettingsdialog.cpp
optimalscrollarena/minimalscrollwidget.cpp
optimalscrollarena/scrollarea.cpp
optimalscrollarena/scrollvisiblepartbase.cpp
optimalscrollarena/scrollwidget.cpp
optimalscrollarena/scrollwidgetvisiblepart.cpp
optimalscrollarena/singlewidget.cpp
widgets/actionbutton.cpp
widgets/alignwidget.cpp
widgets/assetswidget.cpp
Expand All @@ -58,6 +64,12 @@ set(
HEADERS
ui_global.h
dialogs/scenesettingsdialog.h
optimalscrollarena/minimalscrollwidget.h
optimalscrollarena/scrollarea.h
optimalscrollarena/scrollvisiblepartbase.h
optimalscrollarena/scrollwidget.h
optimalscrollarena/scrollwidgetvisiblepart.h
optimalscrollarena/singlewidget.h
widgets/actionbutton.h
widgets/alignwidget.h
widgets/assetswidget.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@
#ifndef MINIMALSCROLLWIDGET_H
#define MINIMALSCROLLWIDGET_H

#include "ui_global.h"

#include <QWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QtMath>
#include <functional>

class SingleWidget;
class ScrollVisiblePartBase;
class ScrollArea;

class MinimalScrollWidget : public QWidget {
class UI_EXPORT MinimalScrollWidget : public QWidget
{
Q_OBJECT
public:
explicit MinimalScrollWidget(ScrollVisiblePartBase * const visiblePart,
Expand All @@ -51,9 +54,11 @@ class MinimalScrollWidget : public QWidget {
void setWidth(const int width);

int minHeight() const;

protected:
ScrollVisiblePartBase* visiblePartWidget() const
{ return mVisiblePartWidget; }

private:
ScrollVisiblePartBase * const mVisiblePartWidget;
ScrollArea * const mParentScrollArea;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,28 @@

#ifndef SCROLLAREA_H
#define SCROLLAREA_H

#include "ui_global.h"

#include <QScrollArea>

class ScrollArea : public QScrollArea {
class UI_EXPORT ScrollArea : public QScrollArea
{
Q_OBJECT

public:
ScrollArea(QWidget * const parent = nullptr);

void scrollBy(const int x, const int y);
void callWheelEvent(QWheelEvent *event);

signals:
void heightChanged(int);
void widthChanged(int);

protected:
void resizeEvent(QResizeEvent *e);

private:
int mLastHeight = 0;
int mLastWidth = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#include "singlewidget.h"
#include "scrollwidget.h"
#include "singlewidgettarget.h"
#include "GUI/mainwindow.h"
#include "GUI/global.h"
#include <QApplication>

ScrollVisiblePartBase::ScrollVisiblePartBase(
MinimalScrollWidget * const parent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@

#ifndef SCROLLVISIBLEPARTBASE_H
#define SCROLLVISIBLEPARTBASE_H

#include "ui_global.h"

class MinimalScrollWidget;
class SingleWidget;

#include <QWidget>

class ScrollVisiblePartBase : public QWidget {
class UI_EXPORT ScrollVisiblePartBase : public QWidget
{
public:
ScrollVisiblePartBase(MinimalScrollWidget * const parent);

Expand Down Expand Up @@ -62,8 +67,10 @@ class ScrollVisiblePartBase : public QWidget {

const QList<QWidget*>& widgets() const
{ return mSingleWidgets; }

protected:
bool event(QEvent* event);

private:
void postUpdateEvent();

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@
#ifndef SCROLLWIDGET_H
#define SCROLLWIDGET_H

#include "ui_global.h"

#include <QWidget>
#include <QVBoxLayout>
#include <QLabel>
#include "minimalscrollwidget.h"
#include "smartPointers/ememory.h"
#include "swt_rulescollection.h"

class SingleWidget;
class ScrollWidgetVisiblePart;
class SWT_Abstraction;
Expand All @@ -42,8 +45,10 @@ enum class SWT_BoxRule : short;
enum class SWT_Target : short;
enum class SWT_Type : short;

class ScrollWidget : public MinimalScrollWidget {
class UI_EXPORT ScrollWidget : public MinimalScrollWidget
{
Q_OBJECT

public:
explicit ScrollWidget(ScrollWidgetVisiblePart* const visiblePart,
ScrollArea * const parent);
Expand Down Expand Up @@ -74,9 +79,11 @@ class ScrollWidget : public MinimalScrollWidget {

void updateVisible();
const QList<QWidget*> &visibleWidgets();

protected:
ScrollWidgetVisiblePart* visiblePartWidget() const
{ return mVisiblePartWidget; }

private:
void updateAbstraction();
void updateHeightAfterScrollAreaResize(const int parentHeight);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "singlewidget.h"
#include "scrollwidget.h"
#include "singlewidgettarget.h"
#include "GUI/mainwindow.h"
#include "GUI/global.h"

int ScrollWidgetVisiblePart::sNextId = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,23 @@
#ifndef SCROLLWIDGETVISIBLEPART_H
#define SCROLLWIDGETVISIBLEPART_H

#include "ui_global.h"

#include "scrollvisiblepartbase.h"
#include <QWidget>
#include <QVBoxLayout>
#include <QtMath>
#include <memory>
#include "smartPointers/ememory.h"
#include "singlewidgettarget.h"

class ScrollWidget;
class SingleWidgetTarget;

class ScrollWidgetVisiblePart : public ScrollVisiblePartBase {
class UI_EXPORT ScrollWidgetVisiblePart : public ScrollVisiblePartBase
{
Q_OBJECT

public:
ScrollWidgetVisiblePart(ScrollWidget * const parent);

Expand Down Expand Up @@ -71,6 +76,7 @@ class ScrollWidgetVisiblePart : public ScrollVisiblePartBase {

SWT_Abstraction* getMainAbstration() const
{ return mMainAbstraction; }

private:
void setupUpdateFuncs();
void scheduleSearchUpdate();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,25 @@
#ifndef SINGLEWIDGET_H
#define SINGLEWIDGET_H

#include "ui_global.h"

#include <QWidget>
#include "smartPointers/stdpointer.h"

class SWT_Abstraction;
class ScrollWidgetVisiblePart;
class SingleWidgetTarget;

class SingleWidget : public QWidget {
class UI_EXPORT SingleWidget : public QWidget
{
Q_OBJECT

public:
SingleWidget(ScrollWidgetVisiblePart *parent = nullptr);
virtual void setTargetAbstraction(SWT_Abstraction *abs);
SWT_Abstraction *getTargetAbstraction();
SingleWidgetTarget *getTarget() const;

protected:
stdptr<SWT_Abstraction> mTarget;
ScrollWidgetVisiblePart *mParent;
Expand Down

0 comments on commit ad4d0dc

Please sign in to comment.