[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [gluon/creator-qmlintro-shreya] creator: Viewport Navigation working
From: Shreya Pandit <shreya () shreyapandit ! com>
Date: 2012-06-03 15:35:27
Message-ID: 20120603153527.15D29A60C6 () git ! kde ! org
[Download RAW message or body]
Git commit 606e535cc74bcc388a3d0d5b99a8ecf270332b25 by Shreya Pandit.
Committed on 03/06/2012 at 17:34.
Pushed by pandit into branch 'creator-qmlintro-shreya'.
Viewport Navigation working
M +33 -21 creator/introduction.cpp
M +30 -62 creator/introduction.h
M +0 -1 creator/main.cpp
M +3 -6 creator/mainwindow.cpp
M +1 -0 creator/mainwindow.h
M +0 -5 creator/ui/introduction.qml
http://commits.kde.org/gluon/606e535cc74bcc388a3d0d5b99a8ecf270332b25
diff --git a/creator/introduction.cpp b/creator/introduction.cpp
index 42b64b4..d42e6be 100644
--- a/creator/introduction.cpp
+++ b/creator/introduction.cpp
@@ -19,52 +19,64 @@
#include "introduction.h"
#include <QRect>
-#include <QDebug>
#include <KDE/KApplication>
class QRect;
-class QDebug;
class KApplication;
IntroSlideShow::IntroSlideShow()
{
- qDebug() << "INSIDE CONSTRUCTOR";
- timer = new QTimer();
- timer->setSingleShot(true);
- timer->singleShot(3000, this, SLOT(on_timeout()));
+
}
IntroSlideShow::~IntroSlideShow()
{
- delete timer;
+ delete this;
}
-void IntroSlideShow::startIntro()
+void IntroSlideShow::setWidth(qreal width)
{
- qDebug() << "INSIDE START INTRO";
+ setImplicitWidth(width);
+ emit widthChanged();
+}
+
+void IntroSlideShow::setHeight(qreal height)
+{
+ setImplicitHeight(height);
+ emit heightChanged();
}
-void IntroSlideShow::on_timeout()
+void IntroSlideShow::setXpos(qreal xpos)
{
- qDebug() << "INSIDE TIMEOUT";
- this_windowcopy= kapp->activeWindow();
- qDebug() <<"OUR WINDOWCOPY IS" << this_windowcopy;
+ setX(xpos);
+ emit xposChanged();
+}
+void IntroSlideShow::setYpos(qreal ypos)
+{
+ setY(ypos);
+ emit yposChanged();
}
+void IntroSlideShow::setdockername(QString name)
+{
+ docker=name;
+ if(QString::compare(docker,"", Qt::CaseInsensitive)) {
+ updateDocker();
+ }
+ emit dockernameChanged();
+}
void IntroSlideShow::updateDocker()
{
- qDebug() << "Inside updateDocker";
- QWidget *rectangle;
-
- /*setWidth(rectangle->width());
- setHeight(rectangle->height());
- setXpos(rectangle->x());
- setYpos(rectangle->y());
-*/
+ QRect rectangle;
+ rectangle= kapp->activeWindow()->findChild<QWidget*>(docker)->frameGeometry();
+ setWidth(rectangle.width());
+ setHeight(rectangle.height());
+ setXpos(rectangle.x());
+ setYpos(rectangle.y());
}
diff --git a/creator/introduction.h b/creator/introduction.h
index 8fc2c48..1b52f08 100644
--- a/creator/introduction.h
+++ b/creator/introduction.h
@@ -23,75 +23,43 @@
#include "mainwindow.h"
#include <QtDeclarative/QDeclarativeItem>
#include <QString>
-#include <QDebug>
-#include <QWidget>
-#include <QTimer>
-#include <QWidget>
-class QTimer;
class QDeclarativeItem;
class QString;
-class QDebug;
-class QWidget;
class IntroSlideShow: public QDeclarativeItem
{
-
- Q_OBJECT
- Q_PROPERTY(QString dockername READ dockername WRITE setdockername NOTIFY \
dockernameChanged)
- Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
- 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)
-
-public slots:
- void on_timeout();
-
-
-public:
- IntroSlideShow();
- ~IntroSlideShow();
- QString dockername() const {return docker;}
- qreal width() const { return implicitWidth(); }
- qreal height() const { return implicitHeight(); }
- int xpos() const { return x(); }
- int ypos() const { return y(); }
-
- void setWidth(qreal width){qDebug() << "Inside setwidth"; \
setImplicitWidth(width); emit widthChanged();}
-
- void setHeight(qreal height){ setImplicitHeight(height); emit \
heightChanged();}
-
- void setXpos(qreal xpos){ setX(xpos);emit xposChanged();}
-
- void setYpos(qreal ypos){ setY(ypos);emit yposChanged();}
-
- Q_INVOKABLE void setdockername(QString name){
-
- docker=name;
- qDebug() << "Inside set dockername" ;
- if(QString::compare(docker,"", Qt::CaseInsensitive)) {
- qDebug() << "INSIDE IF" ;
- qDebug() << docker;
- updateDocker();
- }
- emit dockernameChanged();
- }
-
- Q_INVOKABLE void startIntro();
- void updateDocker();
-
- QWidget *this_windowcopy;
- QTimer *timer;
- QString docker;
-
- signals:
-
- void dockernameChanged();
- void widthChanged();
- void heightChanged();
- void xposChanged();
- void yposChanged();
+ Q_OBJECT
+ Q_PROPERTY(QString dockername READ dockername WRITE setdockername NOTIFY \
dockernameChanged) + Q_PROPERTY(int width READ width WRITE setWidth NOTIFY \
widthChanged) + 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)
+
+ public:
+ IntroSlideShow();
+ ~IntroSlideShow();
+ QString dockername() const {return docker;}
+ qreal width() const { return implicitWidth(); }
+ qreal height() const { return implicitHeight(); }
+ int xpos() const { return x(); }
+ int ypos() const { return y(); }
+ void setWidth(qreal width);
+ void setHeight(qreal height);
+ void setXpos(qreal xpos);
+ void setYpos(qreal ypos);
+ Q_INVOKABLE void setdockername(QString name);
+ void updateDocker();
+ QString docker;
+
+ signals:
+
+ void dockernameChanged();
+ void widthChanged();
+ void heightChanged();
+ void xposChanged();
+ void yposChanged();
};
diff --git a/creator/main.cpp b/creator/main.cpp
index ff975d6..e38f2be 100644
--- a/creator/main.cpp
+++ b/creator/main.cpp
@@ -31,7 +31,6 @@
#include <QtDeclarative/QDeclarativeView>
#include <core/gluon_global.h>
#include "aboutdata.h"
-#include "introduction.h"
#include <QDebug>
diff --git a/creator/mainwindow.cpp b/creator/mainwindow.cpp
index 4bd172b..454bb3c 100644
--- a/creator/mainwindow.cpp
+++ b/creator/mainwindow.cpp
@@ -2,6 +2,7 @@
* This file is part of the Gluon Development Platform
* Copyright (c) 2010 Arjen Hiemstra <ahiemstra@heimr.nl>
* Copyright (c) 2011 Laszlo Papp <lpapp@kde.org>
+ * Copyright (c) 2012 Shreya Pandit <shreya@shreyapandit.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -23,7 +24,6 @@
#include <QtCore/QVariantList>
#include <QtCore/QFileInfo>
#include <QtCore/QTimer>
-#include <QDebug>
#include <QWidget>
#include <KDE/KFileDialog>
#include <KDE/KStandardAction>
@@ -55,12 +55,8 @@
#include "gluoncreatorsettings.h"
#include "dialogs/projectselectiondialog.h"
#include "dialogs/configdialog.h"
-#include <QTimer>
-
-class QTimer;
using namespace GluonCreator;
-class QDebug;
class MainWindow::Private
{
@@ -76,6 +72,7 @@ class MainWindow::Private
MainWindow::MainWindow( const QString& fileName, QWidget* parent, Qt::WindowFlags \
flags ) : KParts::MainWindow( parent, flags ), d( new Private )
{
+ kapp->setActiveWindow(this);
d->modified = false;
GluonCore::GluonObjectFactory::instance()->loadPlugins();
@@ -423,7 +420,7 @@ void MainWindow::addAsset()
void GluonCreator::MainWindow::showNewProjectDialog()
{
d->projectDialog->setPage( ProjectSelectionDialog::NewProjectPage );
- // d->projectDialog->show();
+ d->projectDialog->show();
}
void MainWindow::showOpenProjectDialog()
diff --git a/creator/mainwindow.h b/creator/mainwindow.h
index b68bf26..923cdc9 100644
--- a/creator/mainwindow.h
+++ b/creator/mainwindow.h
@@ -1,6 +1,7 @@
/******************************************************************************
* This file is part of the Gluon Development Platform
* Copyright (c) 2010 Arjen Hiemstra <ahiemstra@heimr.nl>
+ * Copyright (c) 2012 Shreya Pandit <shreya@shreyapandit.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/creator/ui/introduction.qml b/creator/ui/introduction.qml
index a23fd89..7a9188f 100644
--- a/creator/ui/introduction.qml
+++ b/creator/ui/introduction.qml
@@ -83,9 +83,6 @@ Item {
IntroSlideShow {
id :animator;
- Component.onCompleted:{
- console.log("I am inside instance");
- }
}
MouseArea {
@@ -95,12 +92,10 @@ Item {
switch(animator.dockername){
case(""):
- console.log("going to component")
viewport.state = 'component';
break;
case("ComponentsDock"):
- console.log("going to project")
viewport.state = 'project';
break;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic