libkwineffects: Drop QObject parent argument in OffscreenQuickView constructor

All usages of OffscreenQuickView have been ported to smart pointers. So
let's drop the QObject parent argument to simplify the API.
This commit is contained in:
Vlad Zahorodnii 2023-10-23 20:16:05 +03:00
parent 8cc1c7eca7
commit fb638f26c5
5 changed files with 11 additions and 36 deletions

View file

@ -2154,10 +2154,8 @@ EffectWindowList EffectWindowGroupImpl::members() const
// EffectFrameImpl // EffectFrameImpl
//**************************************** //****************************************
EffectFrameQuickScene::EffectFrameQuickScene(EffectFrameStyle style, bool staticSize, QPoint position, EffectFrameQuickScene::EffectFrameQuickScene(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment)
Qt::Alignment alignment, QObject *parent) : m_style(style)
: OffscreenQuickScene(parent)
, m_style(style)
, m_static(staticSize) , m_static(staticSize)
, m_point(position) , m_point(position)
, m_alignment(alignment) , m_alignment(alignment)
@ -2366,9 +2364,7 @@ void EffectFrameQuickScene::reposition()
} }
EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment) EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment)
: QObject(nullptr) : m_view(new EffectFrameQuickScene(style, staticSize, position, alignment))
, EffectFrame()
, m_view(new EffectFrameQuickScene(style, staticSize, position, alignment, nullptr))
{ {
connect(m_view, &OffscreenQuickScene::repaintNeeded, this, [this] { connect(m_view, &OffscreenQuickScene::repaintNeeded, this, [this] {
effects->addRepaint(geometry()); effects->addRepaint(geometry());

View file

@ -506,8 +506,7 @@ class EffectFrameQuickScene : public OffscreenQuickScene
Q_PROPERTY(qreal crossFadeProgress READ crossFadeProgress NOTIFY crossFadeProgressChanged) Q_PROPERTY(qreal crossFadeProgress READ crossFadeProgress NOTIFY crossFadeProgressChanged)
public: public:
EffectFrameQuickScene(EffectFrameStyle style, bool staticSize, QPoint position, EffectFrameQuickScene(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment);
Qt::Alignment alignment, QObject *parent = nullptr);
~EffectFrameQuickScene() override; ~EffectFrameQuickScene() override;
EffectFrameStyle style() const; EffectFrameStyle style() const;

View file

@ -73,14 +73,8 @@ public:
std::unique_ptr<QQuickItem> quickItem; std::unique_ptr<QQuickItem> quickItem;
}; };
OffscreenQuickView::OffscreenQuickView(QObject *parent) OffscreenQuickView::OffscreenQuickView(ExportMode exportMode)
: OffscreenQuickView(ExportMode::Texture, parent) : d(new OffscreenQuickView::Private)
{
}
OffscreenQuickView::OffscreenQuickView(ExportMode exportMode, QObject *parent)
: QObject(parent)
, d(new OffscreenQuickView::Private)
{ {
d->m_renderControl = std::make_unique<QQuickRenderControl>(); d->m_renderControl = std::make_unique<QQuickRenderControl>();
@ -520,14 +514,8 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
} }
} }
OffscreenQuickScene::OffscreenQuickScene(QObject *parent) OffscreenQuickScene::OffscreenQuickScene(OffscreenQuickView::ExportMode exportMode)
: OffscreenQuickView(parent) : OffscreenQuickView(exportMode)
, d(new OffscreenQuickScene::Private)
{
}
OffscreenQuickScene::OffscreenQuickScene(OffscreenQuickView::ExportMode exportMode, QObject *parent)
: OffscreenQuickView(exportMode, parent)
, d(new OffscreenQuickScene::Private) , d(new OffscreenQuickScene::Private)
{ {
} }

View file

@ -56,16 +56,10 @@ public:
Image Image
}; };
/**
* Construct a new KWinQuickView
* Export mode will be determined by the current effectsHandler
*/
explicit OffscreenQuickView(QObject *parent = nullptr);
/** /**
* Construct a new KWinQuickView explicitly stating an export mode * Construct a new KWinQuickView explicitly stating an export mode
*/ */
explicit OffscreenQuickView(ExportMode exportMode = ExportMode::Texture, QObject *parent = nullptr); explicit OffscreenQuickView(ExportMode exportMode = ExportMode::Texture);
/** /**
* Note that this may change the current GL Context * Note that this may change the current GL Context
@ -164,8 +158,7 @@ private:
class KWINEFFECTS_EXPORT OffscreenQuickScene : public OffscreenQuickView class KWINEFFECTS_EXPORT OffscreenQuickScene : public OffscreenQuickView
{ {
public: public:
explicit OffscreenQuickScene(QObject *parent = nullptr); explicit OffscreenQuickScene(ExportMode exportMode = ExportMode::Texture);
explicit OffscreenQuickScene(ExportMode exportMode, QObject *parent = nullptr);
~OffscreenQuickScene(); ~OffscreenQuickScene();
/** top level item in the given source*/ /** top level item in the given source*/

View file

@ -83,8 +83,7 @@ bool QuickSceneEffectPrivate::isItemOnScreen(QQuickItem *item, EffectScreen *scr
} }
QuickSceneView::QuickSceneView(QuickSceneEffect *effect, EffectScreen *screen) QuickSceneView::QuickSceneView(QuickSceneEffect *effect, EffectScreen *screen)
: OffscreenQuickView(effect) : m_effect(effect)
, m_effect(effect)
, m_screen(screen) , m_screen(screen)
{ {
setGeometry(screen->geometry()); setGeometry(screen->geometry());