Home · All Namespaces · All Classes |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of mhome. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #ifndef LAUNCHER_H 00021 #define LAUNCHER_H 00022 00023 #include <QObject> 00024 #include <QList> 00025 #include <MWidgetController> 00026 #include "launchermodel.h" 00027 00028 class MDesktopEntry; 00029 class LauncherDataStore; 00030 class ApplicationPackageMonitorListener; 00031 00054 class Launcher : public MWidgetController 00055 { 00056 Q_OBJECT 00057 M_CONTROLLER(Launcher) 00058 00059 public: 00061 class Placement { 00062 public: 00063 Placement(); 00064 Placement(const QString &placement); 00065 Placement(int page, int position); 00066 00067 void setPlacement(const QString &placementString); 00068 QString toString(); 00069 00070 QString location; 00071 int page; 00072 int position; 00073 00074 bool isNull() { 00075 return (page < 0 || position < 0); 00076 } 00077 }; 00078 00087 Launcher(QGraphicsItem *parent = NULL, LauncherModel *model = NULL); 00088 00092 virtual ~Launcher(); 00093 00099 void setLauncherDataStore(LauncherDataStore *dataStore); 00100 00107 void setApplicationPackageMonitorListener(ApplicationPackageMonitorListener *packageMonitorListener); 00108 00116 void setMaximumPageSize(int maximumPageSize); 00117 00118 protected: 00125 virtual QSharedPointer<LauncherButton> createLauncherButton(const QString &desktopEntryPath); 00126 00128 virtual QSharedPointer<LauncherPage> createLauncherPage(); 00129 00130 signals: 00134 void launcherButtonClicked(); 00135 00141 void panningRequested(uint page); 00142 00146 void focusToPageRequested(uint page); 00147 00151 void focusToButtonRequested(const QString& desktopFileEntry); 00152 00153 00154 public slots: 00155 00165 int focusToButton(const QString &desktopFileEntry); 00166 00172 void setPage(uint page); 00173 00183 void updateButtonState(const QString& desktopEntryPath, const QString &packageName, LauncherButtonModel::State state, int progress, bool packageRemovable); 00184 00194 void removePlaceholderButton(const QString &desktopEntryPath); 00200 void updateButtonPlacementsOnPage(LauncherPage *page); 00201 00202 private slots: 00203 00211 void addLauncherButton(const QString &desktopEntryPath); 00212 00218 void removeLauncherButton(const QString &desktopEntryPath); 00219 00227 bool updateLauncherButton(const QString &desktopEntryPath); 00228 00232 void updatePagesFromDataStore(); 00233 00235 void updatePackageName(const QString &desktopEntryPath, const QString &packageName); 00236 00237 private: 00244 Launcher::Placement entryPlacementInDatastore(const QString &desktopEntryPath); 00245 00252 void addNewLauncherButtonToPages(const QString &desktopEntryPath, QList<QSharedPointer<LauncherPage> > &pages); 00253 00263 Launcher::Placement appendButtonToPages(QSharedPointer<LauncherButton> button, QList<QSharedPointer<LauncherPage> > &pages); 00264 00274 Placement buttonPlacement(const QString &desktopEntryFile); 00275 00283 void addDesktopEntriesWithKnownPlacements(QList<QSharedPointer<LauncherPage> > &pages); 00284 00291 void addDesktopEntriesWithUnknownPlacements(QList<QSharedPointer<LauncherPage> > &pages); 00292 00298 void removeEmptyPages(QList<QSharedPointer<LauncherPage> > &pages); 00299 00308 QMap<Launcher::Placement, QString> createPlacementMap(const QHash<QString, QVariant> &desktopEntryPlacements); 00309 00317 QSharedPointer<LauncherButton> placeholderButton(const QString& desktopEntryPath); 00318 00326 void updateButtonPlacementInStore(const QString &desktopEntryPath); 00327 00333 void removeButtonPlacementFromStore(const QString &desktopEntryPath); 00334 00340 void setMaximumPageSizeIfNecessary(QSharedPointer<LauncherPage> &page); 00341 00343 int pageIndex(LauncherPage *page); 00344 00346 static const QString LOCATION_IDENTIFIER; 00347 00349 static const char SECTION_SEPARATOR; 00350 00352 static const QString PLACEMENT_TEMPLATE; 00353 00355 LauncherDataStore *dataStore; 00356 00358 ApplicationPackageMonitorListener *packageMonitorListener; 00359 00361 int maximumPageSize; 00362 00364 bool initialized; 00365 00366 #ifdef UNIT_TEST 00367 friend class Ut_Launcher; 00368 #endif 00369 }; 00370 00371 #endif /* LAUNCHER_H */
Copyright © 2011 Nokia Corporation | Generated on Thu Jul 7 2011 22:14:50 Doxygen 1.7.1 |
MeeGo Touch |