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

List:       kde-commits
Subject:    [gluon] player/active/src: Use ActiveApp libraries and headers directly.
From:       Shantanu Tushar <shaan7in () gmail ! com>
Date:       2012-05-21 17:23:18
Message-ID: 20120521172318.1AD0DA60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 42e8e51738933b57df9ded9dbc18ae0fbf6630a0 by Shantanu Tushar.
Committed on 21/05/2012 at 19:22.
Pushed by shantanu into branch 'master'.

Use ActiveApp libraries and headers directly.

M  +2    -2    player/active/src/CMakeLists.txt
D  +0    -152  player/active/src/kdeclarativemainwindow.cpp
D  +0    -95   player/active/src/kdeclarativemainwindow.h
D  +0    -122  player/active/src/kdeclarativeview.cpp
D  +0    -81   player/active/src/kdeclarativeview.h
M  +1    -1    player/active/src/mainwindow.cpp

http://commits.kde.org/gluon/42e8e51738933b57df9ded9dbc18ae0fbf6630a0

diff --git a/player/active/src/CMakeLists.txt b/player/active/src/CMakeLists.txt
index 74973f0..5f5e526 100644
--- a/player/active/src/CMakeLists.txt
+++ b/player/active/src/CMakeLists.txt
@@ -5,11 +5,10 @@ include_directories(
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_CURRENT_BINARY_DIR}
     ${GLUON_INPUT_INCLUDE_DIRS}
+    ${ACTIVEAPP_INCLUDE_DIR}
 )
 
 set(gluonplayer-active_SRCS
-    kdeclarativemainwindow.cpp
-    kdeclarativeview.cpp
     main.cpp
     mainwindow.cpp
 )
@@ -28,6 +27,7 @@ target_link_libraries(gluonplayer-active
     ${GLUON_ENGINE_LIBS}
     ${GLUON_GRAPHICS_LIBS}
     ${GLUON_INPUT_LIBS}
+    ${ACTIVEAPP_LIBRARIES}
 )
 
 install(TARGETS gluonplayer-active ${INSTALL_TARGETS_DEFAULT_ARGS} )
diff --git a/player/active/src/kdeclarativemainwindow.cpp \
b/player/active/src/kdeclarativemainwindow.cpp deleted file mode 100644
index b1a20d1..0000000
--- a/player/active/src/kdeclarativemainwindow.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/***************************************************************************
- *                                                                         *
- *   Copyright 2011 Sebastian Kügler <sebas@kde.org>                       *
- *   Copyright 2011 Marco Martin <mart@kde.org>                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program 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 General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
- ***************************************************************************/
-
-#include "kdeclarativemainwindow.h"
-#include "kdeclarativeview.h"
-
-#include <QApplication>
-#include <QDeclarativeContext>
-
-#include <KAction>
-#include <KCmdLineArgs>
-#include <KStandardAction>
-
-#include <Plasma/Theme>
-
-
-
-class KDeclarativeMainWindowPrivate
-{
-public:
-    KDeclarativeMainWindowPrivate(KDeclarativeMainWindow *window)
-        : q(window)
-    {}
-
-    void statusChanged(QDeclarativeView::Status status);
-
-    KDeclarativeMainWindow *q;
-    KDeclarativeView *view;
-    KCmdLineArgs *args;
-    QStringList arguments;
-    QString caption;
-};
-
-void KDeclarativeMainWindowPrivate::statusChanged(QDeclarativeView::Status status)
-{
-    if (status == QDeclarativeView::Ready) {
-        view->rootContext()->setContextProperty("application", q);
-    }
-}
-
-
-
-KDeclarativeMainWindow::KDeclarativeMainWindow()
-    : KMainWindow(),
-      d(new KDeclarativeMainWindowPrivate(this))
-{
-    setAcceptDrops(true);
-    KConfigGroup cg(KSharedConfig::openConfig("plasmarc"), "Theme-plasma-mobile");
-    const QString themeName = cg.readEntry("name", "air-mobile");
-    Plasma::Theme::defaultTheme()->setUseGlobalSettings(false);
-    Plasma::Theme::defaultTheme()->setThemeName(themeName);
-    addAction(KStandardAction::close(this, SLOT(close()), this));
-    addAction(KStandardAction::quit(this, SLOT(close()), this));
-
-    d->view = new KDeclarativeView(this);
-    connect(d->view, SIGNAL(statusChanged(QDeclarativeView::Status)), this, \
                SLOT(statusChanged(QDeclarativeView::Status)));
-
-    setCentralWidget(d->view);
-    restoreWindowSize(config("Window"));
-
-    setWindowIcon(KIcon(KCmdLineArgs::aboutData()->programIconName()));
-
-    d->args = KCmdLineArgs::parsedArgs();
-    for (int i = 0; i < d->args->count(); i++) {
-        d->arguments << d->args->arg(i);
-    }
-
-    bool useGL = d->args->isSet("opengl");
-    if (!useGL) {
-        //use plasmarc to share this with plasma-windowed
-        KConfigGroup cg(KSharedConfig::openConfig("plasmarc"), "General");
-        useGL = cg.readEntry("UseOpenGl", true);
-    }
-    d->view->setUseGL(useGL);
-
-    connect(d->view, SIGNAL(titleChanged(QString)), SLOT(setCaption(QString)));
-}
-
-KDeclarativeMainWindow::~KDeclarativeMainWindow()
-{
-    saveWindowSize(config("Window"));
-}
-
-
-KDeclarativeView *KDeclarativeMainWindow::declarativeView() const
-{
-    return d->view;
-}
-
-KConfigGroup KDeclarativeMainWindow::config(const QString &group)
-{
-    return KConfigGroup(KSharedConfig::openConfig(qApp->applicationName() + "rc"), \
                group);
-}
-
-QStringList KDeclarativeMainWindow::startupArguments() const
-{
-    return d->arguments;
-}
-
-QString KDeclarativeMainWindow::startupOption(const QString &option) const
-{
-    return d->args->getOption(option.toLatin1());
-}
-
-QString KDeclarativeMainWindow::caption() const
-{
-    return d->caption;
-}
-
-void KDeclarativeMainWindow::setCaption(const QString &caption)
-{
-    if (d->caption == caption) {
-        return;
-    }
-
-    d->caption = caption;
-    emit captionChanged();
-    KMainWindow::setCaption(caption);
-}
-
-void KDeclarativeMainWindow::setCaption(const QString &caption, bool modified)
-{
-    Q_UNUSED(modified)
-
-    if (d->caption == caption) {
-        return;
-    }
-
-    d->caption = caption;
-    emit captionChanged();
-    KMainWindow::setCaption(caption, true);
-}
-
-#include "kdeclarativemainwindow.moc"
diff --git a/player/active/src/kdeclarativemainwindow.h \
b/player/active/src/kdeclarativemainwindow.h deleted file mode 100644
index 0dfe2c1..0000000
--- a/player/active/src/kdeclarativemainwindow.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/***************************************************************************
- *                                                                         *
- *   Copyright 2011 Sebastian Kügler <sebas@kde.org>                       *
- *   Copyright 2011 Marco Martin <mart@kde.org>                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program 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 General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
- ***************************************************************************/
-
-
-#ifndef KDECLARATIVEMAINWINDOW_H
-#define KDECLARATIVEMAINWINDOW_H
-
-#include <KMainWindow>
-
-
-class KDeclarativeView;
-
-class KDeclarativeMainWindowPrivate;
-
-class KDeclarativeMainWindow : public KMainWindow
-{
-    Q_OBJECT
-    /**
-     * the list of all startup arguments, such as urls to open
-     */
-    Q_PROPERTY(QStringList startupArguments READ startupArguments CONSTANT)
-    /**
-     * The caption of the main window. Do not include the application name in this \
                string. It will be added automatically according to the KDE standard.
-     */
-    Q_PROPERTY(QString caption READ caption WRITE setCaption NOTIFY captionChanged)
-
-public:
-    KDeclarativeMainWindow();
-    ~KDeclarativeMainWindow();
-
-    /**
-     * The main kconfiggroup to be used for this application
-     * The configuration file name is derived from the application name
-     *
-     * @arg QString group the kconfigugroup name
-     */
-    KConfigGroup config(const QString &group = "Default");
-
-    /**
-     * @returns the declarative view that will contain the application UI
-     * It loads a Plasma::Package rather than an absolute path
-     * @see KDeclarativeView
-     * @see Plasma::Package
-     */
-    KDeclarativeView *declarativeView() const;
-
-    //propertyies & methods for QML
-    QStringList startupArguments() const;
-
-    QString caption() const;
-
-    /**
-     * Read out a string option.
-     * The option must have a corresponding KCmdLineOptions entry of the form:
-        <code>
-         options.add("option <argument>", ki18n("Description"), "default");
-        </code>
-     * You cannot test for the presence of an alias - you must always test for the \
                full option.
-     * @arg QString option  The name of the option without '-'.
-     * @returns The value of the option. If the option was not present on the \
command line the default is returned. If the option was present more than once, the \
                value of the last occurrence is used.
-     */
-    Q_INVOKABLE QString startupOption(const QString &option) const;
-
-public Q_SLOTS:
-    void setCaption(const QString &caption);
-    //FIXME: this exists only to not hide the superclass method
-    void setCaption(const QString &caption, bool modified);
-
-Q_SIGNALS:
-    void captionChanged();
-
-private:
-    KDeclarativeMainWindowPrivate * const d;
-    Q_PRIVATE_SLOT(d, void statusChanged(QDeclarativeView::Status))
-};
-
-#endif // KDECLARATIVEMAINWINDOW_H
diff --git a/player/active/src/kdeclarativeview.cpp \
b/player/active/src/kdeclarativeview.cpp deleted file mode 100644
index 432e3e1..0000000
--- a/player/active/src/kdeclarativeview.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/***************************************************************************
- *                                                                         *
- *   Copyright 2011 Sebastian Kügler <sebas@kde.org>                       *
- *   Copyright 2011 Marco Martin <mart@kde.org>                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program 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 General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
- ***************************************************************************/
-
-#include "kdeclarativeview.h"
-
-#include <QDeclarativeContext>
-#include <QDeclarativeEngine>
-#include <QDeclarativeItem>
-#include <QGLWidget>
-
-#include <KDebug>
-
-#include  <kdeclarative.h>
-
-#include <Plasma/Package>
-
-class KDeclarativeViewPrivate
-{
-public:
-    KDeclarativeViewPrivate()
-        : useGL(false)
-    {}
-
-    KDeclarative kdeclarative;
-    Plasma::PackageStructure::Ptr structure;
-    Plasma::Package *package;
-    QString packageName;
-    bool useGL;
-};
-
-KDeclarativeView::KDeclarativeView(QWidget *parent)
-    : QDeclarativeView(parent),
-      d(new KDeclarativeViewPrivate)
-{
-    // avoid flicker on show
-    setAttribute(Qt::WA_OpaquePaintEvent);
-    setAttribute(Qt::WA_NoSystemBackground);
-    viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
-    viewport()->setAttribute(Qt::WA_NoSystemBackground);
-
-    setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
-    d->kdeclarative.setDeclarativeEngine(engine());
-    d->kdeclarative.initialize();
-    //binds things like kconfig and icons
-    d->kdeclarative.setupBindings();
-    QScriptEngine *scriptEngine = d->kdeclarative.scriptEngine();
-
-    d->structure = Plasma::PackageStructure::load("Plasma/Generic");
-
-    show();
-}
-
-KDeclarativeView::~KDeclarativeView()
-{
-}
-
-
-void KDeclarativeView::setPackageName(const QString &packageName)
-{
-    d->package = new Plasma::Package(QString(), packageName, d->structure);
-    d->packageName = packageName;
-    setSource(QUrl(d->package->filePath("mainscript")));
-}
-
-QString KDeclarativeView::packageName() const
-{
-    return d->packageName;
-}
-
-void KDeclarativeView::setPackage(Plasma::Package *package)
-{
-    if (!package || package == d->package) {
-        return;
-    }
-
-    d->package = package;
-    d->packageName = package->metadata().pluginName();
-    setSource(QUrl(d->package->filePath("mainscript")));
-}
-
-Plasma::Package *KDeclarativeView::package() const
-{
-    return d->package;
-}
-
-void KDeclarativeView::setUseGL(const bool on)
-{
-#ifndef QT_NO_OPENGL
-    if (on) {
-      QGLWidget *glWidget = new QGLWidget;
-      glWidget->setAutoFillBackground(false);
-      setViewport(glWidget);
-    }
-#endif
-    d->useGL = on;
-}
-
-bool KDeclarativeView::useGL() const
-{
-    return d->useGL;
-}
-
-#include "kdeclarativeview.moc"
diff --git a/player/active/src/kdeclarativeview.h \
b/player/active/src/kdeclarativeview.h deleted file mode 100644
index 649f78f..0000000
--- a/player/active/src/kdeclarativeview.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/***************************************************************************
- *                                                                         *
- *   Copyright 2011 Sebastian Kügler <sebas@kde.org>                       *
- *   Copyright 2011 Marco Martin <mart@kde.org>                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program 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 General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
- ***************************************************************************/
-
-#ifndef KDECLARATIVEVIEW_H
-#define KDECLARATIVEVIEW_H
-
-#include <QDeclarativeView>
-
-
-namespace Plasma
-{
-    class Package;
-}
-
-class KDeclarativeViewPrivate;
-
-class KDeclarativeView : public QDeclarativeView
-{
-    Q_OBJECT
-
-public:
-    KDeclarativeView(QWidget *parent = 0);
-    ~KDeclarativeView();
-
-    /**
-     * Sets wether the application uses opengl
-     * @arg bool on if true the declarative view will use opengl for its viewport()
-     */
-    void setUseGL(const bool on);
-    /**
-     * @returns true if the declarative view uses opengl
-     */
-    bool useGL() const;
-
-    /**
-     * Sets the package from where load the application QML UI
-     * The package must be of the type "Generic package"
-     * it must provide a qml file as "mainscript"
-     * @arg QString packageName the plugin name of the package
-     */
-    void setPackageName(const QString &packageName);
-    /**
-     * @returns the plugin name of the package
-     */
-    QString packageName() const;
-
-    /**
-     * Sets the package used for the application QML UI.
-     * You usually don't need to use this, rather use setPackageName
-     * @see setPackageName
-     */
-    //FIXME: remove this function?
-    void setPackage(Plasma::Package *package);
-    /**
-     * @returns the plugin name of the package that holds the application QML UI
-     */
-    Plasma::Package *package() const;
-
-private:
-    KDeclarativeViewPrivate *const d;
-};
-
-#endif //KDECLARATIVEVIEW_H
diff --git a/player/active/src/mainwindow.cpp b/player/active/src/mainwindow.cpp
index b6dbc83..0a17f4b 100644
--- a/player/active/src/mainwindow.cpp
+++ b/player/active/src/mainwindow.cpp
@@ -33,7 +33,7 @@
 #include <input/inputmanager.h>
 #include <graphics/renderwidget.h>
 
-#include "kdeclarativeview.h"
+#include <kdeclarativeview.h>
 
 #include <QtDeclarative/QtDeclarative>
 


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

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