[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [gluon/creator-qmlintro-shreya] creator: New Class for Introductory Slideshow
From: Shreya Pandit <shreya () shreyapandit ! com>
Date: 2012-04-29 21:35:37
Message-ID: 20120429213537.8B0E3A60C4 () git ! kde ! org
[Download RAW message or body]
Git commit b55b03841e5742aed36e1061437d5b2f9ea21e49 by Shreya Pandit.
Committed on 29/04/2012 at 21:30.
Pushed by pandit into branch 'creator-qmlintro-shreya'.
New Class for Introductory Slideshow
A +39 -0 creator/introduction.cpp [License: UNKNOWN] *
A +25 -0 creator/introduction.h [License: UNKNOWN] *
M +5 -15 creator/main.cpp
M +11 -9 creator/ui/introduction.qml
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
http://commits.kde.org/gluon/b55b03841e5742aed36e1061437d5b2f9ea21e49
diff --git a/creator/introduction.cpp b/creator/introduction.cpp
new file mode 100644
index 0000000..57fd7f5
--- /dev/null
+++ b/creator/introduction.cpp
@@ -0,0 +1,39 @@
+#include "introduction.h"
+#include <QRect>
+class QRect;
+
+IntroSlideShow::IntroSlideShow(QObject *parent) :
+ QObject(parent){
+
+ startIntro();
+}
+
+
+void IntroSlideShow::startIntro(){
+
+ view = new QDeclarativeView( window );
+ context = view->rootContext();
+ context->setContextProperty("intro", this);
+ view->setSource( QUrl::fromLocalFile( KGlobal::dirs()->locate( "appdata", \
"introduction.qml" ) )); + view->setStyleSheet("background: transparent");
+ view->setResizeMode( QDeclarativeView::SizeRootObjectToView );
+ view->setGeometry( window->rect());
+ view->show();
+
+}
+
+void IntroSlideShow::updateDocker(QString dockername){
+
+ docker =dockername;
+ QObject *object = view->rootObject();
+ QObject *geometry = object->findChild<QObject*>("geometry");
+ if(geometry){
+ QRect rectangle= new QRect();
+ rectangle= window->findChild<QWidget*>( docker )->frameGeometry();
+ geometry->setProperty("width",rectangle.width());
+ geometry->setProperty("x",rectangle.x());
+ geometry->setProperty("y",rectangle.y());
+ geometry->setProperty("height",rectangle.height());
+ }
+
+}
diff --git a/creator/introduction.h b/creator/introduction.h
new file mode 100644
index 0000000..23dfdb5
--- /dev/null
+++ b/creator/introduction.h
@@ -0,0 +1,25 @@
+#ifndef INTRODUCTION_H
+#define INTRODUCTION_H
+
+#include "mainwindow.h"
+#include <QtDeclarative/QDeclarativeContext>
+#include <QtDeclarative/QDeclarativeView>
+#include <QObject>
+#include <QString>
+class QDeclarativeContext;
+class QDeclarativeView;
+class QString;
+
+class IntroSlideShow : public QObject{
+
+public:
+ IntroSlideShow(QObject *parent = 0);
+ Q_INVOKABLE void updateDocker(QString dockername);
+ void startIntro();
+ MainWindow window;
+ QDeclarativeView* view;
+ QDeclarativeContext *context;
+ QString docker;
+};
+
+#endif // IntroSlideShow_H
diff --git a/creator/main.cpp b/creator/main.cpp
index a7ea0dc..1ccda4f 100644
--- a/creator/main.cpp
+++ b/creator/main.cpp
@@ -30,11 +30,8 @@
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeView>
#include <core/gluon_global.h>
-
#include "aboutdata.h"
-class QDeclarativeContext;
-class QDeclarativeView;
-class QString;
+#include "introduction.h"
int main( int argc, char** argv )
{
@@ -57,16 +54,9 @@ int main( int argc, char** argv )
GluonCreator::MainWindow* window = new GluonCreator::MainWindow( args->count() > \
0 ? args->arg( 0 ) : QString() ); window->show();
splash.finish( window );
- QDeclarativeView* view = new QDeclarativeView( window );
- QDeclarativeContext *context = view->rootContext();
- context->setContextProperty( "targetRect", window->findChild<QWidget*>( \
"ComponentsDock" )->frameGeometry() );
- context->setContextProperty( "targetRect2", window->findChild<QWidget*>( \
"ProjectDock" )->frameGeometry() );
- view->setSource( QUrl::fromLocalFile( KGlobal::dirs()->locate( "appdata", \
"introduction.qml" ) ));
- QObject *object = view->rootObject();
- QObject *geometry = object->findChild<QObject*>("geometry");
- view->setStyleSheet("background: transparent");
- view->setResizeMode( QDeclarativeView::SizeRootObjectToView );
- view->setGeometry( window->rect());
- view->show();
+
+ //Instantiate QML Bindings for SlideShow
+ IntroSlideShow intro;
+
app.exec();
}
diff --git a/creator/ui/introduction.qml b/creator/ui/introduction.qml
index 273a0f7..8b2890d 100644
--- a/creator/ui/introduction.qml
+++ b/creator/ui/introduction.qml
@@ -14,16 +14,16 @@ Item {
color: "blue";
}
Rectangle {
- id: leftOverlay;
+ id: leftOverlay;
anchors.top: topOverlay.bottom;
anchors.left: parent.left;
anchors.right: viewport.left;
anchors.bottom: bottomOverlay.top;
-
opacity: 0.1;
color: "blue";
- }
+ }
+
Rectangle {
id: rightOverlay;
@@ -48,12 +48,14 @@ Item {
}
Item {
- id: geomtery
- width: 0;
- height: 0;
- x: 0;
- y: 0;
- }
+
+ property string dockername;
+ property int x;
+ property int y;
+ property int width;
+ property int height ;
+ onDockernameChanged : intro.updateDocker(dockername);
+ }
Item {
id: viewport;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic