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

List:       kde-commits
Subject:    [gluon/creator-qmlintro-shreya] creator: Setting alignment for Information Bubbles
From:       Shreya Pandit <shreya () shreyapandit ! com>
Date:       2012-06-10 16:25:01
Message-ID: 20120610162501.5DC27A60C4 () git ! kde ! org
[Download RAW message or body]

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

Setting alignment for Information Bubbles

M  +1    -0    creator/CMakeLists.txt
M  +7    -0    creator/dialogs/projectselectiondialog.cpp
M  +2    -1    creator/dialogs/projectselectiondialog.h
A  +89   -0    creator/dialogs/welcomedialogpage.cpp     [License: LGPL (v2.1+)]
C  +13   -23   creator/dialogs/welcomedialogpage.h [from: \
creator/dialogs/projectselectiondialog.h - 054% similarity] M  +19   -0    \
creator/introduction.cpp M  +5    -0    creator/introduction.h
M  +61   -2    creator/ui/introduction.qml

http://commits.kde.org/gluon/e49d0e4e932402820bc76d7bb53949dfb63bfeb1

diff --git a/creator/CMakeLists.txt b/creator/CMakeLists.txt
index f553c29..5fdf7e4 100644
--- a/creator/CMakeLists.txt
+++ b/creator/CMakeLists.txt
@@ -41,6 +41,7 @@ set(gluoncreator_SRCS
     dialogs/newprojectdialogpage.cpp
     dialogs/openprojectdialogpage.cpp
     dialogs/projectselectiondialog.cpp
+    dialogs/welcomedialogpage.cpp
     dialogs/recentprojectsdialogpage.cpp
 )
 
diff --git a/creator/dialogs/projectselectiondialog.cpp \
b/creator/dialogs/projectselectiondialog.cpp index 6da27b9..c2aea8d 100644
--- a/creator/dialogs/projectselectiondialog.cpp
+++ b/creator/dialogs/projectselectiondialog.cpp
@@ -21,10 +21,12 @@
 
 #include "projectselectiondialog.h"
 
+#include "welcomedialogpage.h"
 #include "newprojectdialogpage.h"
 #include "recentprojectsdialogpage.h"
 #include "openprojectdialogpage.h"
 
+
 #include <core/debughelper.h>
 
 #include <KDE/KLocalizedString>
@@ -78,13 +80,16 @@ ProjectSelectionDialog::ProjectSelectionDialog( QWidget* parent, \
Qt::WFlags flag  setButtons( Ok | Close );
 
     NewProjectDialogPage* npdp = new NewProjectDialogPage;
+    WelcomeDialogPage *wpdp = new WelcomeDialogPage;
     addPage( npdp, NewProjectPage );
     addPage( new RecentProjectsDialogPage, RecentProjectPage );
+    addPage( wpdp, WelcomePage );
     addPage( new OpenProjectDialogPage, OpenProjectPage );
 
     restoreDialogSize( KGlobal::config()->group( "ProjectSelectionDialog" ) );
 
     connect( npdp, SIGNAL(validationFinished(bool)), SLOT(enableButtonOk(bool)) );
+    connect( wpdp, SIGNAL(validationFinished(bool)), SLOT(enableButtonOk(bool)) );
     connect( this, SIGNAL(okClicked()), SLOT(okClicked()) );
 }
 
@@ -111,6 +116,8 @@ void ProjectSelectionDialog::addPage( KPageWidgetItem* item, \
ProjectSelectionDia  connect( item, SIGNAL(projectRequested(QString)),
                      SLOT(projectRequested(QString)) );
             break;
+        case WelcomePage:
+            break;
         default:
             break;
     };
diff --git a/creator/dialogs/projectselectiondialog.h \
b/creator/dialogs/projectselectiondialog.h index 4d53a95..3e27bea 100644
--- a/creator/dialogs/projectselectiondialog.h
+++ b/creator/dialogs/projectselectiondialog.h
@@ -34,7 +34,8 @@ namespace GluonCreator
             {
                 NewProjectPage,
                 RecentProjectPage,
-                OpenProjectPage
+                OpenProjectPage,
+                WelcomePage
             };
 
             explicit ProjectSelectionDialog( QWidget* parent = 0, Qt::WFlags = 0 );
diff --git a/creator/dialogs/welcomedialogpage.cpp \
b/creator/dialogs/welcomedialogpage.cpp new file mode 100644
index 0000000..64b4f3c
--- /dev/null
+++ b/creator/dialogs/welcomedialogpage.cpp
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * This file is part of the Gluon Development Platform
+ * Copyright (C) 2010 Arjen Hiemstra <ahiemstra@heimr.nl>
+ * Copyright (C) 2010 Keith Rusler <xzekecomax@gmail.com>
+ * Copyright (C) 2010 Laszlo Papp <lpapp@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "welcomedialogpage.h"
+
+#include <core/gluon_global.h>
+#include <engine/gameproject.h>
+#include <engine/scene.h>
+#include <engine/game.h>
+#include <engine/gameobject.h>
+#include <engine/component.h>
+
+#include <KDE/KLocalizedString>
+#include <KDE/KIcon>
+#include <KDE/KLineEdit>
+#include <KDE/KUrlRequester>
+#include <KDE/KMessageBox>
+#include <KDE/KSqueezedTextLabel>
+
+#include <QtGui/QGroupBox>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QFormLayout>
+#include <QtGui/QLabel>
+//#include <QtGui/QLabel>
+#include <QtCore/QScopedPointer>
+
+class QLabel;
+
+using namespace GluonCreator;
+
+class WelcomeDialogPage::WelcomeDialogPagePrivate
+{
+    public:
+        WelcomeDialogPagePrivate( WelcomeDialogPage* qq )
+            : textView(0)
+        {
+        }
+
+    public:
+        QLabel *textView ;
+
+    private:
+        WelcomeDialogPage* q;
+};
+
+WelcomeDialogPage::WelcomeDialogPage()
+    : KPageWidgetItem( new QWidget, i18n( "Welcome Dialog" ) ),
+      d( new WelcomeDialogPagePrivate( this ) )
+{
+
+    QVBoxLayout* layout = new QVBoxLayout( widget() );
+    QGroupBox* box = new QGroupBox(widget() );
+
+    widget()->setLayout( layout );
+    layout->addWidget( box );
+
+    QFormLayout* boxLayout = new QFormLayout( box );
+    box->setLayout( boxLayout );
+
+    d->textView = new QLabel( box );
+    d->textView->setWordWrap (true);
+    d->textView->setText( i18n( "Gluon Creator is a tool that allows designers and \
artists to easily prototype and create games.With some minimal configuration , it \
allows for a multitude of games to be created. And what's more, we are free and open \
source!So here's what more you can do with creator" ) ); +    \
boxLayout->addRow(d->textView ); +
+}
+
+WelcomeDialogPage::~WelcomeDialogPage()
+{
+    delete d;
+}
+
diff --git a/creator/dialogs/projectselectiondialog.h \
b/creator/dialogs/welcomedialogpage.h similarity index 54%
copy from creator/dialogs/projectselectiondialog.h
copy to creator/dialogs/welcomedialogpage.h
index 4d53a95..f767e60 100644
--- a/creator/dialogs/projectselectiondialog.h
+++ b/creator/dialogs/welcomedialogpage.h
@@ -19,38 +19,28 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef GLUON_CREATOR_PROJECTSELECTIONDIALOG_H
-#define GLUON_CREATOR_PROJECTSELECTIONDIALOG_H
+#ifndef GLUON_CREATOR_WELCOMEDIALOGPAGE_H
+#define GLUON_CREATOR_WELCOMEDIALOGPAGE_H
 
-#include <KDE/KPageDialog>
+#include <KDE/KPageWidgetItem>
+#include <KDE/KColorScheme>
+
+class QLabel;
 
 namespace GluonCreator
 {
-    class ProjectSelectionDialog : public KPageDialog
+    class WelcomeDialogPage : public KPageWidgetItem
     {
             Q_OBJECT
         public:
-            enum ProjectPage
-            {
-                NewProjectPage,
-                RecentProjectPage,
-                OpenProjectPage
-            };
+            WelcomeDialogPage();
+            ~WelcomeDialogPage();
 
-            explicit ProjectSelectionDialog( QWidget* parent = 0, Qt::WFlags = 0 );
-            ~ProjectSelectionDialog();
-            void addPage( KPageWidgetItem* item, ProjectPage page );
-            QString fileName() const;
-            virtual QSize sizeHint() const;
-        public Q_SLOTS:
-            void setPage( ProjectPage page );
-        private:
-            Q_PRIVATE_SLOT( d, void okClicked() )
-            Q_PRIVATE_SLOT( d, void projectRequested( const QString& project ) )
         private:
-            class ProjectSelectionDialogPrivate;
-            ProjectSelectionDialogPrivate* const d;
+
+            class WelcomeDialogPagePrivate;
+            WelcomeDialogPagePrivate* const d;
     };
 }
 
-#endif // GLUON_CREATOR_PROJECTSELECTIONDIALOG_H
+#endif // GLUON_CREATOR_WELCOMEDIALOGPAGE_H
diff --git a/creator/introduction.cpp b/creator/introduction.cpp
index d42e6be..b16d525 100644
--- a/creator/introduction.cpp
+++ b/creator/introduction.cpp
@@ -20,7 +20,9 @@
 #include "introduction.h"
 #include <QRect>
 #include <KDE/KApplication>
+#include <QDebug>
 
+class QDebug;
 class QRect;
 class KApplication;
 
@@ -69,6 +71,15 @@ void IntroSlideShow::setdockername(QString name)
     emit dockernameChanged();
 }
 
+void IntroSlideShow::setAlignment(QString align)
+{
+    if(!QString::compare(align,"left", Qt::CaseInsensitive)) {m_alignment= "left";}
+    else {m_alignment = "right";}
+    qDebug() << m_alignment;
+
+    emit alignmentChanged();
+}
+
 void IntroSlideShow::updateDocker()
 {
     QRect rectangle;
@@ -77,6 +88,14 @@ void IntroSlideShow::updateDocker()
     setHeight(rectangle.height());
     setXpos(rectangle.x());
     setYpos(rectangle.y());
+    if ((rectangle.x()+ rectangle.width()) < (kapp->activeWindow()->width()/2))
+    {setAlignment("left");
+
+    }
+     else
+    {setAlignment("right");
+
+    }
 
 }
 
diff --git a/creator/introduction.h b/creator/introduction.h
index 1b52f08..b222260 100644
--- a/creator/introduction.h
+++ b/creator/introduction.h
@@ -36,6 +36,7 @@ class IntroSlideShow: public QDeclarativeItem
         Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
         Q_PROPERTY(int xpos READ xpos WRITE setXpos NOTIFY xposChanged)
         Q_PROPERTY(int ypos READ ypos WRITE setYpos NOTIFY yposChanged)
+        Q_PROPERTY(QString alignment READ alignment WRITE setAlignment NOTIFY \
alignmentChanged)  
         public:
             IntroSlideShow();
@@ -45,13 +46,16 @@ class IntroSlideShow: public QDeclarativeItem
             qreal height() const { return implicitHeight(); }
             int xpos() const { return x(); }
             int ypos() const { return y(); }
+            Q_INVOKABLE QString alignment() { return m_alignment; }
             void setWidth(qreal width);
             void setHeight(qreal height);
             void setXpos(qreal xpos);
             void setYpos(qreal ypos);
+            void setAlignment(QString align);
             Q_INVOKABLE void setdockername(QString name);
             void updateDocker();
             QString docker;
+            QString m_alignment;
 
         signals:
 
@@ -60,6 +64,7 @@ class IntroSlideShow: public QDeclarativeItem
             void heightChanged();
             void xposChanged();
             void yposChanged();
+            void alignmentChanged();
 
 
 };
diff --git a/creator/ui/introduction.qml b/creator/ui/introduction.qml
index 7a9188f..246c775 100644
--- a/creator/ui/introduction.qml
+++ b/creator/ui/introduction.qml
@@ -18,6 +18,7 @@
  */
 
 import QtQuick 1.0
+import com.nokia.symbian 1.1
 import Intro 1.0
 Item {
 
@@ -85,6 +86,34 @@ Item {
                 id :animator;
     }
 
+
+    ToolTip {
+        id: toolTip
+        text: ""
+        target: viewport
+        visible: mouseArea.hoverEnabled
+
+    }
+
+        Text {
+            id : text;
+            font.pointSize: 18;
+            text: "test";
+            style: Text.Raised;
+            styleColor: "white";
+            function orient() {
+                console.log("IN ORIENT") ;
+                if (animator.alignment == "left")
+                {anchors.left= viewport.right;
+                 anchors.right= viewport.left;
+                }
+                 else
+                { anchors.right= viewport.left;
+                }
+
+            }
+    }
+
         MouseArea {
             anchors.fill: parent;
             onClicked: {
@@ -136,31 +165,56 @@ Item {
         State {
                 name: "component"
                 PropertyChanges { target:animator; dockername: "ComponentsDock"}
-                PropertyChanges { target: viewport; x: animator.x; y: animator.y; \
                width:animator.implicitWidth; height:animator.implicitHeight}
-            },
+                PropertyChanges { target: viewport; x: animator.x; y: animator.y; \
width:animator.implicitWidth; height:animator.implicitHeight; toolTip: "Yeh hai \
component"} +                StateChangeScript {
+                         name: "myScript"
+                         script: { text.orient();}
+
+                }
+          },
 
         State {
                 name: "project"
                 PropertyChanges { target:animator; dockername : "ProjectDock"}
                 PropertyChanges { target: viewport; x: animator.x; y: animator.y; \
width:animator.implicitWidth; height:animator.implicitHeight } +                \
StateChangeScript { +                         name: "myScript"
+                         script: { text.orient();}
+
+                }
             },
 
         State {
                 name: "message"
                 PropertyChanges { target:animator; dockername : "MessageDock"}
                 PropertyChanges { target: viewport; x: animator.x; y: animator.y; \
width:animator.implicitWidth; height:animator.implicitHeight } +                \
StateChangeScript { +                         name: "myScript"
+                         script: { text.orient();}
+
+                }
             },
 
         State {
                 name: "scene"
                 PropertyChanges { target:animator; dockername : "SceneDock"}
                 PropertyChanges { target: viewport; x: animator.x; y: animator.y; \
width:animator.implicitWidth; height:animator.implicitHeight } +                \
StateChangeScript { +                         name: "myScript"
+                         script: { text.orient();}
+
+                }
             },
 
         State {
                 name: "property"
                 PropertyChanges { target:animator; dockername : "PropertiesDock"}
                 PropertyChanges { target: viewport; x: animator.x; y: animator.y; \
width:animator.implicitWidth; height:animator.implicitHeight } +                \
StateChangeScript { +                         name: "myScript"
+                         script: { text.orient();}
+
+                }
             }
     ]
 
@@ -169,26 +223,31 @@ Item {
             Transition {
                 from: "*"; to: "component"
                 NumberAnimation { properties: "x,y,width,height"; duration: 1000 }
+                 ScriptAction { scriptName: "myScript" }
             },
 
             Transition {
                 from: "*"; to: "project"
                 NumberAnimation { properties: "x,y,width,height"; duration: 1000 }
+                ScriptAction { scriptName: "myScript" }
             },
 
             Transition {
                 from: "*"; to: "message"
                 NumberAnimation { properties: "x,y,width,height"; duration: 1000 }
+                ScriptAction { scriptName: "myScript" }
             },
 
             Transition {
                 from: "*"; to: "scene"
                 NumberAnimation { properties: "x,y,width,height"; duration: 1000 }
+                ScriptAction { scriptName: "myScript" }
             },
 
             Transition {
                 from: "*"; to: "property"
                 NumberAnimation { properties: "x,y,width,height"; duration: 1000 }
+                ScriptAction { scriptName: "myScript" }
             }
 
         ]


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

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