Use shared engine in ksplashqml

As Martin G analysed in kscreenlocker_greet this cuts down a lot of time
on dual monitors.

REVIEW: 125654
wilder-5.14
David Edmundson 11 years ago
parent 0720bfdd75
commit 44fb5c45ab
  1. 1
      ksplash/ksplashqml/CMakeLists.txt
  2. 10
      ksplash/ksplashqml/splashwindow.cpp
  3. 4
      ksplash/ksplashqml/splashwindow.h

@ -13,6 +13,7 @@ target_link_libraries(ksplashqml
Qt5::DBus Qt5::DBus
KF5::ConfigCore KF5::ConfigCore
KF5::Package KF5::Package
KF5::QuickAddons
) )
install(TARGETS ksplashqml ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS ksplashqml ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})

@ -34,7 +34,7 @@
#include <KPackage/PackageLoader> #include <KPackage/PackageLoader>
SplashWindow::SplashWindow(bool testing, bool window) SplashWindow::SplashWindow(bool testing, bool window)
: QQuickView(), : KQuickAddons::QuickViewSharedEngine(),
m_stage(0), m_stage(0),
m_testing(testing), m_testing(testing),
m_window(window) m_window(window)
@ -42,7 +42,7 @@ SplashWindow::SplashWindow(bool testing, bool window)
setColor(Qt::transparent); setColor(Qt::transparent);
setDefaultAlphaBuffer(true); setDefaultAlphaBuffer(true);
setClearBeforeRendering(true); setClearBeforeRendering(true);
setResizeMode(QQuickView::SizeRootObjectToView); setResizeMode(KQuickAddons::QuickViewSharedEngine::SizeRootObjectToView);
if (!m_window) { if (!m_window) {
setFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); setFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
@ -76,7 +76,7 @@ void SplashWindow::setStage(int stage)
void SplashWindow::keyPressEvent(QKeyEvent *event) void SplashWindow::keyPressEvent(QKeyEvent *event)
{ {
QQuickView::keyPressEvent(event); KQuickAddons::QuickViewSharedEngine::keyPressEvent(event);
if (m_testing && !event->isAccepted() && event->key() == Qt::Key_Escape) { if (m_testing && !event->isAccepted() && event->key() == Qt::Key_Escape) {
close(); close();
} }
@ -84,7 +84,7 @@ void SplashWindow::keyPressEvent(QKeyEvent *event)
void SplashWindow::mousePressEvent(QMouseEvent *event) void SplashWindow::mousePressEvent(QMouseEvent *event)
{ {
QQuickView::mousePressEvent(event); KQuickAddons::QuickViewSharedEngine::mousePressEvent(event);
if (m_testing && !event->isAccepted()) { if (m_testing && !event->isAccepted()) {
close(); close();
} }
@ -93,7 +93,7 @@ void SplashWindow::mousePressEvent(QMouseEvent *event)
void SplashWindow::setGeometry(const QRect& rect) void SplashWindow::setGeometry(const QRect& rect)
{ {
bool oldGeometryEmpty = geometry().isNull(); bool oldGeometryEmpty = geometry().isNull();
QQuickView::setGeometry(rect); KQuickAddons::QuickViewSharedEngine::setGeometry(rect);
if (oldGeometryEmpty) { if (oldGeometryEmpty) {

@ -20,13 +20,13 @@
#ifndef SPLASH_WINDOW_H_ #ifndef SPLASH_WINDOW_H_
#define SPLASH_WINDOW_H_ #define SPLASH_WINDOW_H_
#include <QQuickView> #include <KQuickAddons/QuickViewSharedEngine>
class QResizeEvent; class QResizeEvent;
class QMouseEvent; class QMouseEvent;
class QKeyEvent; class QKeyEvent;
class SplashWindow: public QQuickView class SplashWindow: public KQuickAddons::QuickViewSharedEngine
{ {
public: public:
SplashWindow(bool testing, bool window); SplashWindow(bool testing, bool window);

Loading…
Cancel
Save