[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [gluon/creator-qmlintro-shreya] creator: Now customized text is displayed for each docker, providing
From:       Shreya Pandit <shreya () shreyapandit ! com>
Date:       2012-06-18 10:24:56
Message-ID: 20120618102456.ADA98A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 9556314aea305ea7acad10425f2b7863726f2414 by Shreya Pandit.
Committed on 18/06/2012 at 12:24.
Pushed by pandit into branch 'creator-qmlintro-shreya'.

Now customized text is displayed for each docker, providing basic information :)

M  +1    -0    creator/CMakeLists.txt
M  +0    -5    creator/introslideshow.cpp
A  +17   -0    creator/ui/CustomText.qml     [License: UNKNOWN]  *
M  +53   -55   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/9556314aea305ea7acad10425f2b7863726f2414

diff --git a/creator/CMakeLists.txt b/creator/CMakeLists.txt
index 41d63bc..c189bd6 100644
--- a/creator/CMakeLists.txt
+++ b/creator/CMakeLists.txt
@@ -54,6 +54,7 @@ install(TARGETS gluoncreator DESTINATION ${BIN_INSTALL_DIR})
 install(FILES
     ui/gluoncreatorui.rc
     ui/introduction.qml
+    ui/CustomText.qml
     icons/gluon-creator-splash.png
 
     DESTINATION ${DATA_INSTALL_DIR}/gluoncreator
diff --git a/creator/introslideshow.cpp b/creator/introslideshow.cpp
index c663cfe..57932db 100644
--- a/creator/introslideshow.cpp
+++ b/creator/introslideshow.cpp
@@ -20,9 +20,7 @@
 #include "introslideshow.h"
 #include <QRect>
 #include <KDE/KApplication>
-#include <QDebug>
 
-class QDebug;
 class QRect;
 class KApplication;
 
@@ -116,9 +114,6 @@ void IntroSlideShow::updateDocker()
     setHeight(rectangle.height());
     setX(rectangle.x());
     setY(rectangle.y());
-    qDebug()<<rectangle.x()+rectangle.width();
-    qDebug()<<"Limit 1"<<kapp->activeWindow()->width()/4 ;
-    qDebug()<<"Limit 2"<<kapp->activeWindow()->width()*0.75;
 }
 
 void IntroSlideShow::setX (int x)
diff --git a/creator/ui/CustomText.qml b/creator/ui/CustomText.qml
new file mode 100644
index 0000000..1448b1f
--- /dev/null
+++ b/creator/ui/CustomText.qml
@@ -0,0 +1,17 @@
+
+import QtQuick 1.0
+
+ Item {
+     property variant items: {  'default': qsTr("This is a list of the pre-defined \
functionality available to you in Gluon Creator. The Components are things like sound \
emitters and listeners, camera controllers, input handlers and the like, as well as \
the custom logic handler, the Scripting component."), +                               \
'project': qsTr("This shows all the Assets that you have in your project, such as \
sounds, textures, scripts, materials and Scenes."), +                                \
'message': qsTr("This is where debugging messages, errors from scripts and other \
information from the various Components are shown."), +                               \
'scene': qsTr("The contents of the current Scene. This is made up of a tree of \
GameObjects which in essence is your scene graph."), +                                \
'property': qsTr("The place where you can see and manipulate every option on the \
various Components which are attached to the GameObjects in your game."), +           \
} +
+     function getText(which){
+         return items[which];
+     }
+
+
+}
diff --git a/creator/ui/introduction.qml b/creator/ui/introduction.qml
index 4037f63..b1d4694 100644
--- a/creator/ui/introduction.qml
+++ b/creator/ui/introduction.qml
@@ -21,6 +21,7 @@ import QtQuick 1.0
 import Intro 1.0
 
 Item {
+    id: topmost;
 
     Rectangle {
         id: topOverlay;
@@ -29,7 +30,6 @@ Item {
         anchors.left: parent.left;
         anchors.right: parent.right;
         anchors.bottom: viewport.top;
-
         opacity: 0.7;
         color: "black";
     }
@@ -86,6 +86,10 @@ Item {
             Component.onCompleted:viewportTimer.start();
         }
 
+        CustomText{
+            id :custom;
+        }
+
         width: animator.width;
         height: animator.height;
         x: animator.x;
@@ -96,111 +100,105 @@ Item {
         Behavior on x { NumberAnimation { duration: 500; } }
         Behavior on y { NumberAnimation { duration: 500; } }
 
-
-        Text {
-            id : text;
-            font.pointSize: 12;
-            font.bold : true;
-            text: "In addition to the more traditional Grid, Row, and Column, QML \
also provides a way to layout items using the concept of anchors. Each item can be \
thought of as having a set of 7 invisible : left, horizontalCenter, right, top, \
                verticalCenter, baseline, and bottom.";
-            opacity: 0;
-            style: Text.Raised;
-            color: "white";
+        Rectangle{
+            id: textBox;
+            color: "Transparent";
+            property int i: 0;
             property bool showText: true ;
-
+            width: topmost.width / 4;
+            height: topmost.height / 4;
+            x: topmost.width / 5;
+            y: topmost.height / 5;
             states: [
 
                 State {
                     name: "top"
                     AnchorChanges {
-                                target: text
+                                target: textBox;
                                 anchors.top: viewport.bottom;
                                 anchors.horizontalCenter: viewport.horizontalCenter;
                     }
-                    StateChangeScript {
-                             name: "myScript1"
-                             script: {console.log("In top");}
-
-                    }
 
                 },
 
                 State {
                     name: "bottom"
                     AnchorChanges {
-                                target: text
+                                target: textBox;
                                 anchors.bottom: viewport.top;
                                 anchors.horizontalCenter: viewport.horizontalCenter
 
                     }
-                    StateChangeScript {
-                             name: "myScript1"
-                             script: {console.log("In bottom");}
-
-                    }
-
                 },
 
                 State {
                     name: "right"
                     AnchorChanges {
-                                target: text
+                                target: textBox;
                                 anchors.left: viewport.right;
 
                     }
-                    StateChangeScript {
-                             name: "myScript1"
-                             script: {console.log("In right");}
-
-                    }
                 },
 
                 State {
                     name: "left"
                     AnchorChanges {
-                                target: text
+                                target: textBox;
                                 anchors.right: viewport.left;
 
                     }
-                    StateChangeScript {
-                             name: "myScript1"
-                             script: {console.log("In left");}
-
-                    }
 
                 }
             ]
 
+            Text {
+                id : docktext;
+                width: parent.width
+                font.pointSize: 12;
+                font.bold : true;
+                font.italic: true;
+                font.letterSpacing: 1;
+                text: "Click to start slideshow";
+                opacity: 0;
+                style: Text.Raised;
+                color: "white";
+                wrapMode :Text.WordWrap
+
+              }
+
+            function updateText(which)
+            {   docktext.text=(function() { return custom.getText(which); })
+            }
 
             function orient() {
-
                 if ((animator.getdockX() +animator.getdockWidth()) < \
                (0.25*animator.getrefWidth())){
-                    text.state = "right";
-                    console.log("dockname is");
-                    console.log(animator.dockername);
+                    textBox.state = "right";
                 }
 
                 else if((animator.getdockX() +animator.getdockWidth()) > \
(0.75*(animator.getrefWidth()))) {  
-                        text.state = "left";
-                        console.log("dockname is");
-                        console.log(animator.dockername);
-                    }
+                        textBox.state = "left";
+                }
 
                 else{
 
-                    if((animator.getdockY()+animator.getdockHeight()) < \
                animator.getrefHeight()) {text.state = "top";}
-                    else{text.state = "bottom";}
+                    if((animator.getdockY()+animator.getdockHeight()) < \
animator.getrefHeight()) {textBox.state = "top";} +                    \
else{textBox.state = "bottom";}  }
                 show();
 
             }
 
-            function show(){opacity=1; showText = false ;}
+            function show()
+            {   docktext.opacity=1;
+                showText = false ;
+            }
 
             Behavior on opacity {
                     NumberAnimation { properties:"opacity"; duration: 100 }
                }
-            }
+
+        }
 
         MouseArea {
 
@@ -223,7 +221,7 @@ Item {
                                        break;
 
                                    case("MessageDock"):
-                                       viewport.state = 'scene';status
+                                       viewport.state = 'scene';
                                        break;
 
                                    case("SceneDock"):
@@ -245,7 +243,7 @@ Item {
 
             anchors.fill: parent;
             onClicked: {
-                if(!text.showText){ text.opacity = 0 ;}
+                if(textBox.showText){ textBox.opacity = 0 ;docktext.opacity=0;}
                 showTimer.start();
 
             }
@@ -260,7 +258,7 @@ Item {
                 PropertyChanges { target:animator; dockername: "ComponentsDock"}
                 StateChangeScript {
                          name: "myScript"
-                         script: { text.orient(); showTimer.stop();}
+                         script: { textBox.orient();textBox.updateText("default"); \
showTimer.stop();}  
                 }
           },
@@ -270,7 +268,7 @@ Item {
                 PropertyChanges { target:animator; dockername : "ProjectDock"}
                 StateChangeScript {
                          name: "myScript"
-                         script: { text.orient();showTimer.stop();}
+                         script: { \
textBox.orient();textBox.updateText("project");showTimer.stop();}  
                 }
             },
@@ -280,7 +278,7 @@ Item {
                 PropertyChanges { target:animator; dockername : "MessageDock"}
                 StateChangeScript {
                          name: "myScript"
-                         script: { text.orient();showTimer.stop();}
+                         script: { \
textBox.orient();textBox.updateText("message");showTimer.stop();}  
                 }
             },
@@ -290,7 +288,7 @@ Item {
                 PropertyChanges { target:animator; dockername : "SceneDock"}
                 StateChangeScript {
                          name: "myScript"
-                         script: { text.orient();showTimer.stop();}
+                         script: { \
textBox.orient();textBox.updateText("scene");showTimer.stop();}  
                 }
             },
@@ -300,7 +298,7 @@ Item {
                 PropertyChanges { target:animator; dockername : "PropertiesDock"}
                 StateChangeScript {
                          name: "myScript"
-                         script: { text.orient();showTimer.stop();}
+                         script: { \
textBox.orient();textBox.updateText("property");showTimer.stop();}  
                 }
             }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic