Port add/remove buttons in DesktopGrid to QtQuick 2
With this change we no longer need to link QtDeclarative in the Effects.
This commit is contained in:
parent
47cf35720f
commit
7bd86505f5
4 changed files with 19 additions and 31 deletions
|
@ -12,7 +12,6 @@ set(kwin_effect_KDE_LIBS
|
||||||
)
|
)
|
||||||
|
|
||||||
set(kwin_effect_QT_LIBS
|
set(kwin_effect_QT_LIBS
|
||||||
${Qt5Declarative_LIBRARIES}
|
|
||||||
${Qt5Quick_LIBRARIES}
|
${Qt5Quick_LIBRARIES}
|
||||||
${Qt5X11Extras_LIBRARIES}
|
${Qt5X11Extras_LIBRARIES}
|
||||||
${Qt5DBus_LIBRARIES}
|
${Qt5DBus_LIBRARIES}
|
||||||
|
|
|
@ -34,15 +34,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <KDE/KGlobal>
|
#include <KDE/KGlobal>
|
||||||
#include <KDE/KLocalizedString>
|
#include <KDE/KLocalizedString>
|
||||||
#include <KDE/KStandardDirs>
|
#include <KDE/KStandardDirs>
|
||||||
#include <kdeclarative.h>
|
|
||||||
#include <netwm_def.h>
|
#include <netwm_def.h>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <kglobalsettings.h>
|
#include <kglobalsettings.h>
|
||||||
#include <QtGui/QVector2D>
|
#include <QtGui/QVector2D>
|
||||||
#include <QDeclarativeEngine>
|
#include <QQmlContext>
|
||||||
#include <QDeclarativeContext>
|
#include <QQmlEngine>
|
||||||
#include <QGraphicsObject>
|
#include <QQuickItem>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -1117,9 +1116,9 @@ void DesktopGridEffect::setup()
|
||||||
connect(view, SIGNAL(addDesktop()), SLOT(slotAddDesktop()));
|
connect(view, SIGNAL(addDesktop()), SLOT(slotAddDesktop()));
|
||||||
connect(view, SIGNAL(removeDesktop()), SLOT(slotRemoveDesktop()));
|
connect(view, SIGNAL(removeDesktop()), SLOT(slotRemoveDesktop()));
|
||||||
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
|
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
|
||||||
view->setGeometry(screenRect.right() + 1 - view->sceneRect().width(),
|
view->setGeometry(screenRect.right() + 1 - view->width(),
|
||||||
screenRect.bottom() + 1 - view->sceneRect().height(),
|
screenRect.bottom() + 1 - view->height(),
|
||||||
view->sceneRect().width(), view->sceneRect().height());
|
view->width(), view->height());
|
||||||
view->show();
|
view->show();
|
||||||
m_desktopButtonsViews.insert(view, NULL);
|
m_desktopButtonsViews.insert(view, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1382,24 +1381,11 @@ bool DesktopGridEffect::isRelevantWithPresentWindows(EffectWindow *w) const
|
||||||
/************************************************
|
/************************************************
|
||||||
* DesktopButtonView
|
* DesktopButtonView
|
||||||
************************************************/
|
************************************************/
|
||||||
DesktopButtonsView::DesktopButtonsView(QWidget *parent)
|
DesktopButtonsView::DesktopButtonsView(QWindow *parent)
|
||||||
: QDeclarativeView(parent)
|
: QQuickView(parent)
|
||||||
{
|
{
|
||||||
setWindowFlags(Qt::X11BypassWindowManagerHint);
|
setFlags(Qt::X11BypassWindowManagerHint);
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setColor(Qt::transparent);
|
||||||
QPalette pal = palette();
|
|
||||||
pal.setColor(backgroundRole(), Qt::transparent);
|
|
||||||
setPalette(pal);
|
|
||||||
for (const QString &importPath : KGlobal::dirs()->findDirs("module", QStringLiteral("imports"))) {
|
|
||||||
engine()->addImportPath(importPath);
|
|
||||||
}
|
|
||||||
#warning Port declarative code to QtQuick2
|
|
||||||
#if KWIN_QT5_PORTING
|
|
||||||
KDeclarative kdeclarative;
|
|
||||||
kdeclarative.setDeclarativeEngine(engine());
|
|
||||||
kdeclarative.initialize();
|
|
||||||
kdeclarative.setupBindings();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rootContext()->setContextProperty(QStringLiteral("add"), QVariant(true));
|
rootContext()->setContextProperty(QStringLiteral("add"), QVariant(true));
|
||||||
rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(true));
|
rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(true));
|
||||||
|
|
|
@ -25,19 +25,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <kwineffects.h>
|
#include <kwineffects.h>
|
||||||
#include <kshortcut.h>
|
#include <kshortcut.h>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDeclarativeView>
|
|
||||||
#include <QTimeLine>
|
#include <QTimeLine>
|
||||||
|
#include <QQuickView>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
class PresentWindowsEffectProxy;
|
class PresentWindowsEffectProxy;
|
||||||
|
|
||||||
class DesktopButtonsView : public QDeclarativeView
|
class DesktopButtonsView : public QQuickView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DesktopButtonsView(QWidget *parent = 0);
|
explicit DesktopButtonsView(QWindow *parent = 0);
|
||||||
void windowInputMouseEvent(QMouseEvent* e);
|
void windowInputMouseEvent(QMouseEvent* e);
|
||||||
void setAddDesktopEnabled(bool enable);
|
void setAddDesktopEnabled(bool enable);
|
||||||
void setRemoveDesktopEnabled(bool enable);
|
void setRemoveDesktopEnabled(bool enable);
|
||||||
|
|
|
@ -17,13 +17,16 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
import QtQuick 1.1
|
import QtQuick 2.0
|
||||||
import org.kde.plasma.components 0.1 as Plasma
|
import org.kde.plasma.components 2.0 as Plasma
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
Plasma.ButtonRow {
|
Plasma.ButtonRow {
|
||||||
anchors.fill: parent
|
|
||||||
exclusive: false
|
exclusive: false
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
Plasma.Button {
|
Plasma.Button {
|
||||||
id: removeButton
|
id: removeButton
|
||||||
objectName: "removeButton"
|
objectName: "removeButton"
|
||||||
|
|
Loading…
Reference in a new issue