diff --git a/CMakeLists.txt b/CMakeLists.txt index 87ba5e61..0e3aa7a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,28 +1,29 @@ project(MediaCenterComponents) find_package(KDE4 REQUIRED) find_package(Taglib REQUIRED) include(KDE4Defaults) add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} utils/ widgets/ libs/ ) add_subdirectory(browsingbackends) add_subdirectory(artwork) +add_subdirectory(components) add_subdirectory(dataengines) add_subdirectory(applets) add_subdirectory(containments) add_subdirectory(libs) add_subdirectory(shells) add_subdirectory(videoproviders) # FIXME: needs CMake check for bluetooth.h and cwiid.h #add_subdirectory(wiimote) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt new file mode 100644 index 00000000..05b4808b --- /dev/null +++ b/components/CMakeLists.txt @@ -0,0 +1,6 @@ +install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents) +install(DIRECTORY mediabrowser DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents) +install(DIRECTORY mediacontroller DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents) +install(DIRECTORY mediainfobar DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents) +install(DIRECTORY mediaplayer DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents) +install(DIRECTORY mediawelcome DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/mediacentercomponents) \ No newline at end of file diff --git a/components/mediabrowser/MediaBrowser.qml b/components/mediabrowser/MediaBrowser.qml new file mode 100644 index 00000000..5af28e96 --- /dev/null +++ b/components/mediabrowser/MediaBrowser.qml @@ -0,0 +1,5 @@ +import QtQuick 1.1 + +Text { + text: "hello world" +} diff --git a/components/mediacontroller/MediaController.qml b/components/mediacontroller/MediaController.qml new file mode 100644 index 00000000..5af28e96 --- /dev/null +++ b/components/mediacontroller/MediaController.qml @@ -0,0 +1,5 @@ +import QtQuick 1.1 + +Text { + text: "hello world" +} diff --git a/components/mediainfobar/MediaInfoBar.qml b/components/mediainfobar/MediaInfoBar.qml new file mode 100644 index 00000000..5af28e96 --- /dev/null +++ b/components/mediainfobar/MediaInfoBar.qml @@ -0,0 +1,5 @@ +import QtQuick 1.1 + +Text { + text: "hello world" +} diff --git a/components/mediaplayer/MediaPlayer.qml b/components/mediaplayer/MediaPlayer.qml new file mode 100644 index 00000000..5af28e96 --- /dev/null +++ b/components/mediaplayer/MediaPlayer.qml @@ -0,0 +1,5 @@ +import QtQuick 1.1 + +Text { + text: "hello world" +} diff --git a/components/mediawelcome/MediaWelcome.qml b/components/mediawelcome/MediaWelcome.qml new file mode 100644 index 00000000..5af28e96 --- /dev/null +++ b/components/mediawelcome/MediaWelcome.qml @@ -0,0 +1,5 @@ +import QtQuick 1.1 + +Text { + text: "hello world" +} diff --git a/components/qmldir b/components/qmldir new file mode 100644 index 00000000..0fc7c5bf --- /dev/null +++ b/components/qmldir @@ -0,0 +1,5 @@ +MediaBrowser 0.1 mediabrowser/MediaBrowser.qml +MediaController 0.1 mediacontroller/MediaController.qml +MediaInfoBar 0.1 mediainfobar/MediaInfoBar.qml +MediaPlayer 0.1 mediaplayer/MediaPlayer.qml +MediaWelcome 0.1 mediawelcome/MediaWelcome.qml diff --git a/shells/CMakeLists.txt b/shells/CMakeLists.txt index a09e890c..9f2a35bb 100644 --- a/shells/CMakeLists.txt +++ b/shells/CMakeLists.txt @@ -1 +1,2 @@ -add_subdirectory(plasmediacenter) +add_subdirectory(newshell) +add_subdirectory(plasmediacenter) diff --git a/shells/newshell/CMakeLists.txt b/shells/newshell/CMakeLists.txt index d38efcb2..fde8e0a6 100644 --- a/shells/newshell/CMakeLists.txt +++ b/shells/newshell/CMakeLists.txt @@ -1,18 +1,26 @@ project (plasma-mediacenter) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories(${KDE4_INCLUDES}) set(QT_USE_QTOPENGL TRUE) include(${QT_USE_FILE}) set(plasma-mediacenter_SRCS main.cpp mainwindow.cpp ) -kde4_add_ui_files(plasma-mediacenter_SRCS theme.ui backgrounddialog.ui) -kde4_add_executable(plasma-mediacenter ${plasma-mediacenter_SRCS}) -target_link_libraries(plasma-mediacenter mediacenterlibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${QT_LIBRARIES} ) +kde4_add_executable(plasma-mediacenter-new ${plasma-mediacenter_SRCS}) +target_link_libraries(plasma-mediacenter-new mediacenterlibs + ${KDE4_KDEUI_LIBS} + ${KDE4_PLASMA_LIBS} + ${KDE4_KIO_LIBS} + ${QT_LIBRARIES} + ${QT_QTDECLARATIVE_LIBRARIES} + kdeclarative +) -install(TARGETS plasma-mediacenter ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS plasma-mediacenter-new ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(DIRECTORY package/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.plasma.mediacenter) +install(FILES plasma-mediacenter.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) diff --git a/shells/newshell/backgrounddialog.ui b/shells/newshell/backgrounddialog.ui deleted file mode 100644 index b71ba60d..00000000 --- a/shells/newshell/backgrounddialog.ui +++ /dev/null @@ -1,81 +0,0 @@ - - - BackgroundDialog - - - - 0 - 0 - 352 - 324 - - - - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 25 - 18 - - - - - - - - true - - - - 0 - 0 - - - - Type a path or a URL here - - - - - - - - - Qt::Vertical - - - QSizePolicy::Minimum - - - - 20 - 20 - - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
- 1 -
-
- - -
diff --git a/shells/newshell/main.cpp b/shells/newshell/main.cpp index 37ad8fdf..04b181b3 100644 --- a/shells/newshell/main.cpp +++ b/shells/newshell/main.cpp @@ -1,69 +1,57 @@ /*************************************************************************** * Copyright 2009 by Alessandro Diaferia * * * * 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 #include #include #include #include "mainwindow.h" int main(int argc, char *argv[]) { Q_UNUSED(argc); Q_UNUSED(argv); KAboutData aboutData("plasma-mediacenter", 0, ki18n("Plasma Mediacenter Shell"), "0.1", ki18n("A convenient shell for the Plasma Media Center Components"), KAboutData::License_GPL_V2, ki18n("Copyright (c) 2009-2011")); aboutData.addAuthor(ki18n("Alessandro Diaferia"), ki18n("Mantainer and main developer"), "alediaferia@gmail.com", "http://alediaferia.wordpress.com"); aboutData.addAuthor(ki18n("Sinny Kumari"), ki18n("Mantainer and main developer"), "ksinny@gmail.com", "http://www.sinny.in"); aboutData.addCredit(ki18n("Marco Martin"), ki18n("GSoC project mentor"), "notmart@gmail.com", ""); KCmdLineArgs::init(argc, argv, &aboutData); - KCmdLineOptions options; - options.add("f"); - options.add("nofullscreen", ki18n("Starts Plasma Media Center in fullscreen mode (the default)")); - KCmdLineArgs::addCmdLineOptions(options); - KApplication app; - KConfigGroup cg(KSharedConfig::openConfig("plasmarc"), "Theme-plasma-mediacenter"); - const QString themeName = cg.readEntry("name", "oxygen-mediacenter"); - Plasma::Theme::defaultTheme()->setUseGlobalSettings(false); - Plasma::Theme::defaultTheme()->setThemeName(themeName); - MainWindow *mw = new MainWindow; mw->show(); - mw->loadMediaCenter(); return app.exec(); - } diff --git a/shells/newshell/mainwindow.cpp b/shells/newshell/mainwindow.cpp index a60c69f0..a25144fd 100644 --- a/shells/newshell/mainwindow.cpp +++ b/shells/newshell/mainwindow.cpp @@ -1,270 +1,46 @@ /*************************************************************************** * Copyright 2009 by Alessandro Diaferia * * * * 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 "mainwindow.h" -#include -#include +#include -#include -#include -#include -#include +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -MainWindow::MainWindow(QWidget *parent) : KMainWindow(parent), -m_view(new QGraphicsView(this)), -m_containment(0), -m_cfskeleton(new KConfigSkeleton), -m_browser(0), -// m_controller(0), -m_playlist(0), -m_player(0), -m_infobar(0), -m_welcome(0), -m_recognizer(0) +MainWindow::MainWindow(QWidget *parent) : KMainWindow(parent) { - setCentralWidget(m_view); - - QGLWidget *glWidget = new QGLWidget; - glWidget->setAutoFillBackground(false); - m_view->setViewport(glWidget); - m_view->setAlignment(Qt::AlignLeft | Qt::AlignTop); - - m_corona = new Plasma::Corona(this); - m_view->setScene(m_corona); - - m_view->installEventFilter(this); - installEventFilter(this); - - m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - m_view->setFrameShadow(QFrame::Plain); - m_view->setFrameShape(QFrame::NoFrame); - - KAction *fullScreen = new KAction(i18n("Go fullscreen"), this); - fullScreen->setShortcut(Qt::CTRL + Qt::Key_F); - fullScreen->setIcon(KIcon("view-fullscreen")); - connect (fullScreen, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); + resize(1024, 768); + QDeclarativeView *view = new QDeclarativeView(this); + view->setResizeMode(QDeclarativeView::SizeRootObjectToView); + setCentralWidget(view); - KAction *preferences = KStandardAction::preferences(this, SLOT(createConfigurationInterface()), this); + m_kdeclarative.setDeclarativeEngine(view->engine()); + m_kdeclarative.initialize(); + m_kdeclarative.setupBindings(); - QMenu *menu = menuBar()->addMenu(i18n("Settings")); - menu->addAction(fullScreen); - menu->addSeparator(); - menu->addAction(preferences); - - menuBar()->addMenu(helpMenu()); - - resize(1024, 600); //netbook size - //showFullScreen(); - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if (args->isSet("fullscreen")) { - toggleFullScreen(); - } - args->clear(); - - m_recognizer = new MediaCenter::GestureRecognizer; + m_structure = Plasma::PackageStructure::load("Plasma/Generic"); + Plasma::Package *package = new Plasma::Package(QString(), "org.kde.plasma.mediacenter", m_structure); + view->setSource(QUrl(package->filePath("mainscript"))); } MainWindow::~MainWindow() { - QGestureRecognizer::unregisterRecognizer(m_gestureType); -} - -void MainWindow::loadMediaCenter() -{ - - m_gestureType = QGestureRecognizer::registerRecognizer(m_recognizer); - - m_containment = m_corona->addContainment("org.kde.mediacontainment"); - if (!m_containment) { - kDebug() << "unable to load mediacontaiment"; - return; - } - - m_containment->resize(m_view->size()); - - m_view->setSceneRect(m_containment->geometry()); - - m_browser = m_containment->addApplet("org.kde.mediabrowser"); - //m_playlist = m_containment->addApplet("playlist"); - m_player = m_containment->addApplet("org.kde.mediaplayer"); - m_infobar = m_containment->addApplet("org.kde.mediainfobar"); - m_welcome = m_containment->addApplet("org.kde.mediawelcome"); - //m_controller = m_containment->addApplet("org.kde.mediacontroller"); //Keep the controller last - - if (m_browser) { - MediaCenter::Browser *browser = qobject_cast(m_browser); - if (browser) { - browser->setGestureType(m_gestureType); - } else { - kWarning() << "expecting MedicaCenter::Browser for the browser, but didn't get one!"; - } - - m_browser->grabGesture(m_gestureType); - } -} - -bool MainWindow::eventFilter(QObject *o, QEvent *e) -{ - Q_UNUSED(o); - - if (e->type() == QEvent::KeyPress) { - QKeyEvent *key = static_cast(e); - if (key->key() == Qt::Key_Escape && windowState() & Qt::WindowFullScreen) { - toggleFullScreen(); - } - } - - return false; -} - -void MainWindow::toggleFullScreen() -{ - if (windowState() & Qt::WindowFullScreen) { - setWindowState(windowState() & ~Qt::WindowFullScreen); - menuBar()->show(); - } else { - setWindowState(windowState() | Qt::WindowFullScreen); - menuBar()->hide(); - } -} - -void MainWindow::createConfigurationInterface() -{ - KConfigDialog *dialog = new KConfigDialog(this, "Settings", m_cfskeleton); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setCaption(i18n("Preferences")); - - //The settings - QWidget *theme = new QWidget; - m_theme.setupUi(theme); - KPluginInfo::List themes = Plasma::Theme::listThemeInfo(); - foreach (const KPluginInfo &info, themes) { - m_theme.themeComboBox->addItem(info.name(), info.pluginName()); - } - - kDebug() << Plasma::Theme::defaultTheme()->themeName(); - for (int i = 0; i < m_theme.themeComboBox->count(); i++) { - if (m_theme.themeComboBox->itemData(i).toString() == Plasma::Theme::defaultTheme()->themeName()) { - m_theme.themeComboBox->setCurrentIndex(i); - break; - } - } - //Background Settings - QWidget *background = new QWidget; - m_background.setupUi(background); - - - - KPageWidgetItem *themeItem = dialog->addPage(theme, i18n("Theme settings")); - themeItem->setIcon(KIcon("preferences-desktop-theme")); - KPageWidgetItem *backgroundItem = dialog->addPage(background, i18n("Background settings")); - backgroundItem->setIcon(KIcon("preferences-desktop-theme")); - - if (m_browser) { - m_browser->createConfigurationInterface(dialog); - } -// if (m_controller) { -// m_controller->createConfigurationInterface(dialog); -// } - if (m_playlist) { - m_playlist->createConfigurationInterface(dialog); - } - if (m_player) { - m_player->createConfigurationInterface(dialog); - } - if (m_infobar) { - m_infobar->createConfigurationInterface(dialog); - } - if (m_welcome) { - m_welcome->createConfigurationInterface(dialog); - } - - connect (dialog, SIGNAL(accepted()), this, SLOT(applyConfig())); - dialog->exec(); -} - -void MainWindow::applyConfig() -{ - kDebug() << m_theme.themeComboBox->itemData(m_theme.themeComboBox->currentIndex()).toString(); - Plasma::Theme::defaultTheme()->setThemeName(m_theme.themeComboBox->itemData(m_theme.themeComboBox->currentIndex()).toString()); - kWarning() << m_background.fileRequester->url(); - m_wallpaper = m_background.fileRequester->url().toLocalFile(); - - Plasma::Wallpaper *currentWallpaper = m_containment->wallpaper(); - if (currentWallpaper) { - KConfigGroup cfg = wallpaperConfig(m_containment, currentWallpaper->pluginName()); - currentWallpaper->save(cfg); - } - KConfigGroup cfg = wallpaperConfig(m_containment, "image"); - cfg.writeEntry("wallpaper", m_wallpaper); - //cfg.writeEntry("wallpapercolor", (color.isEmpty() ? "0,0,0" : color)); - //cfg.writeEntry("wallpaperposition", position); - cfg.sync(); - m_containment->setWallpaper("image", "SingleImage"); -} - -void MainWindow::resizeEvent(QResizeEvent *event) -{ - Q_UNUSED(event); - - if (!m_containment) { - return; - } - m_containment->resize(m_view->size()); - m_view->setSceneRect(m_containment->geometry()); -} - -void MainWindow::moveEvent(QMoveEvent *event) -{ - KMainWindow::moveEvent(event); -} - -KConfigGroup MainWindow::wallpaperConfig(Plasma::Containment * containment, const QString &plugin) -{ - Q_ASSERT(containment); - - //FIXME: we have details about the structure of the containment config duplicated here! - - KConfigGroup cfg = containment->config(); - cfg = KConfigGroup(&cfg, "Wallpaper"); - return KConfigGroup(&cfg, plugin); + } diff --git a/shells/newshell/mainwindow.h b/shells/newshell/mainwindow.h index 36d1b896..dd25d76c 100644 --- a/shells/newshell/mainwindow.h +++ b/shells/newshell/mainwindow.h @@ -1,90 +1,39 @@ /*************************************************************************** * Copyright 2009 by Alessandro Diaferia * * * * 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 MAINWINDOW_H #define MAINWINDOW_H #include -#include "ui_theme.h" -#include "ui_backgrounddialog.h" - - -class QGraphicsView; -namespace Plasma { - class Corona; - class Containment; - class Applet; -} - -namespace Phonon { - class VideoWidget; -} - -namespace MediaCenter { - class GestureRecognizer; -} - -class KConfigSkeleton; +#include +#include class MainWindow : public KMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); ~MainWindow(); - bool eventFilter(QObject *o, QEvent *e); - - void loadMediaCenter(); - -public slots: - void createConfigurationInterface(); - -protected: - void resizeEvent(QResizeEvent *event); - void moveEvent(QMoveEvent *); - -protected slots: - void toggleFullScreen(); - void applyConfig(); - private: - KConfigGroup wallpaperConfig(Plasma::Containment * containment, const QString &plugin); - QGraphicsView *m_view; - Plasma::Corona *m_corona; - Plasma::Containment *m_containment; - KConfigSkeleton *m_cfskeleton; - - Plasma::Applet *m_browser; - Plasma::Applet *m_controller; - Plasma::Applet *m_playlist; - Plasma::Applet *m_player; - Plasma::Applet *m_infobar; - Plasma::Applet *m_welcome; - - MediaCenter::GestureRecognizer *m_recognizer; - Qt::GestureType m_gestureType; - - KUrl m_wallpaper; - - Ui::Theme m_theme; - Ui::BackgroundDialog m_background; + Plasma::PackageStructure::Ptr m_structure; + KDeclarative m_kdeclarative; }; #endif // MAINWINDOW_H diff --git a/shells/newshell/package/contents/ui/mediacenter.qml b/shells/newshell/package/contents/ui/mediacenter.qml new file mode 100644 index 00000000..03313608 --- /dev/null +++ b/shells/newshell/package/contents/ui/mediacenter.qml @@ -0,0 +1,32 @@ +import QtQuick 1.1 +import org.kde.plasma.mediacentercomponents 0.1 as MediaCenterComponents + +Rectangle { + id: mediaCenterRootItem + + MediaCenterComponents.MediaPlayer { + anchors.fill: parent + } + + Column { + anchors.fill: parent + + MediaCenterComponents.MediaController { + id: mediaController + height: parent.height*0.1 + width: parent.width + } + + MediaCenterComponents.MediaBrowser { + height: parent.height - mediaController.height - mediaInfoBar.height + } + + MediaCenterComponents.MediaInfoBar { + id: mediaInfoBar + height: parent.height * 0.1 + width: parent.width + } + + z: 1 + } +} diff --git a/shells/newshell/package/metadata.desktop b/shells/newshell/package/metadata.desktop new file mode 100644 index 00000000..0ba8c325 --- /dev/null +++ b/shells/newshell/package/metadata.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Name=Plasma Media Center +Comment=Plasma Media Center +Encoding=UTF-8 +Type=Service +Icon=plasma +X-KDE-ParentApp= +X-KDE-PluginInfo-Author=Shantanu Tushar +X-KDE-PluginInfo-Email=shaan7in@gmail.com +X-KDE-PluginInfo-Name=org.kde.plasma.mediacenter +X-KDE-PluginInfo-Version=1.0 +X-KDE-PluginInfo-Website=http://plasma.kde.org +X-KDE-PluginInfo-Category=Multimedia +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +X-Plasma-MainScript=ui/mediacenter.qml diff --git a/shells/newshell/plasma-mediacenter.desktop b/shells/newshell/plasma-mediacenter.desktop new file mode 100755 index 00000000..8b8c4006 --- /dev/null +++ b/shells/newshell/plasma-mediacenter.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Plasma Media Center +GenericName=Plasma Media Center +Comment=Plasma Media Center +Exec=plasma-mediacenter -graphicssystem raster %u +Terminal=false +Icon=plasma +Type=Application +Categories=Multimedia diff --git a/shells/newshell/theme.ui b/shells/newshell/theme.ui deleted file mode 100644 index 6fbc78fb..00000000 --- a/shells/newshell/theme.ui +++ /dev/null @@ -1,42 +0,0 @@ - - - Theme - - - - 0 - 0 - 400 - 300 - - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - Theme: - - - - - - - - 0 - 0 - - - - - - - - - - -