[meego-commits] 5639: Changes to MeeGo:1.0:IVI:Update/ivihome

Brian Harring brian.harring at intel.com
Tue Jul 13 22:27:58 UTC 2010


Hi,
I have made the following changes to ivihome in project MeeGo:1.0:IVI:Update. Please review and accept ASAP.

Thank You,
Brian Harring

[This message was auto-generated]

---

Request #5639:

  submit:   MeeGo:1.0:IVI:Update:Testing/ivihome(r3) -> MeeGo:1.0:IVI:Update/ivihome


Message:
    transfer 1.6 into to updates; fixes race in menu creation on startup

State:   new          2010-07-13T10:22:51 ferringb
Comment: None



changes files:
--------------
--- ivihome.changes
+++ ivihome.changes
@@ -0,0 +1,3 @@
+* Thu Jul 08 2010 Jimmy Huang <jimmy.huang at intel.com> - 1.6
+- Add QFileSystemWatcher to monitor and update application list
+

old:
----
  ivihome-1.5.tar.gz

new:
----
  ivihome-1.6.tar.gz

spec files:
-----------
--- ivihome.spec
+++ ivihome.spec
@@ -1,6 +1,6 @@
 Summary:       Taskbar and Application Launcher Program for IVI
 Name:          ivihome
-Version:       1.5
+Version:       1.6
 Release:       1%{?dist}
 License:       GPLv2+
 Group:         User Interface/Desktops

other changes:
--------------

++++++ ivihome-1.5.tar.gz -> ivihome-1.6.tar.gz
--- inputthread.cpp
+++ inputthread.cpp
@@ -1,22 +1,21 @@
-/******************************************************************************
- * This file is part of the Gluon Development Platform
- * Copyright (C) 2008 Sacha Schutz <istdasklar at free.fr>
- * Copyright (C) 2010 Kim Jung Nissen <jungnissen at gmail.com>
- *
- * 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
- */
+/***************************************************************************
+**
+** Copyright (c) <2010>, Intel Corporation.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms and conditions of the GNU Lesser General Public License,
+** version 2.1, as published by the Free Software Foundation.
+**
+** This program is distributed in the hope 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 program; if not, write to the Free Software Foundation, Inc.,
+** 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+**
+**************************************************************************/
 
 #include <QtCore/QCoreApplication>
 #include <QtCore/QDebug>
@@ -54,7 +53,7 @@
                 }
                 else
                 {
-                    qDebug() << "devicepath not connected, sleep for 1 sec";
+                    //qDebug() << "devicepath not connected, sleep for 1 sec";
                     sleep(1);
                 }
             }
@@ -72,7 +71,7 @@
                         emit this->newInputEvent(ev.type, ev.code, ev.value);
                 }
                 else {
-                    qDebug() << "Cannot read from device, maybe unplugged";
+                    //qDebug() << "Cannot read from device, maybe unplugged";
                     m_connected = false;
                 }
             }
@@ -84,105 +83,9 @@
         m_fd = -1;
         if ((m_fd = open(devicePath.toUtf8(), O_RDONLY)) < 0)
         {
-                qDebug() << "Could not read device " << devicePath;
+                //qDebug() << "Could not read device " << devicePath;
                 return false;
         }
 
-        readInformation();
         return true;
 }
-
-void InputThread::readInformation()
-{
-        /*if (!QFile::exists(m_devicePath))
-        {
-                qDebug() << "m_devicePath does not exist";
-                m_error = true;
-                m_msgError += "device url does not exist \n";
-                return;
-        }*/
-
-        if(m_fd < 0)
-        {
-                qDebug() <<"device not open";
-                m_error = true;
-                m_msgError += "device is not open\n";
-                return;
-        }
-
-        if ((m_fd = open(m_devicePath.toUtf8(), O_RDONLY)) < 0)
-        {
-                qDebug() << "Could not open device" << m_devicePath;
-                m_error = true;
-                m_msgError += "could not open the device \n";
-                return;
-        }
-
-        if (ioctl(m_fd, EVIOCGID, &m_device_info))
-        {
-                qDebug() << "Could not retrieve information of device" << m_devicePath;
-                m_msgError += "could not retrieve information of device\n";
-                m_error = true;
-                return;
-        }
-
-        char name[256] = "Unknown";
-        if (ioctl(m_fd, EVIOCGNAME(sizeof(name)), name) < 0)
-        {
-                qDebug() << "could not retrieve name of device" << m_devicePath;
-                m_msgError += "cannot retrieve name of device\n";
-                m_error = true;
-                return;
-        }
-        m_deviceName = QString(name);
-}
-
-void InputThread::stop()
-{
-        this->quit();
-}
-
-int InputThread::vendor()const
-{
-        return m_vendor;
-}
-
-int InputThread::product()const
-{
-        return m_product;
-}
-
-int InputThread::version()const
-{
-        return m_version;
-}
-
-int InputThread::bustype()const
-{
-        return m_bustype;
-}
-
-const QString InputThread::deviceName() const
-{
-        return m_deviceName;
-}
-
-bool InputThread::isEnabled() const
-{
-        return this->isRunning();
-}
-
-bool InputThread::error()
-{
-        return m_error;
-}
-
-QString InputThread::msgError()
-{
-        return m_msgError;
-}
-
-void InputThread::closeDevice()
-{
-        close(m_fd);
-}
--- inputthread.h
+++ inputthread.h
@@ -1,29 +1,26 @@
-/******************************************************************************
- * This file is part of the Gluon Development Platform
- * Copyright (C) 2008 Sacha Schutz <istdasklar at free.fr>
- * Copyright (C) 2010 Kim Jung Nissen <jungnissen at gmail.com>
- *
- * 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
- */
+/***************************************************************************
+**
+** Copyright (c) <2010>, Intel Corporation.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms and conditions of the GNU Lesser General Public License,
+** version 2.1, as published by the Free Software Foundation.
+**
+** This program is distributed in the hope 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 program; if not, write to the Free Software Foundation, Inc.,
+** 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+**
+**************************************************************************/
 
 #ifndef INPUTTHREAD_H
 #define INPUTTHREAD_H
 
 #include <QtCore/QThread>
-#include <QtCore/QMap>
-#include <QtCore/QSharedData>
 #include <linux/input.h>
 
 class InputThread : public QThread
@@ -34,44 +31,16 @@
     InputThread(const QString& devicePath, QObject *parent = 0);
     ~InputThread();
     void run();
-    void stop();
-
-    const QString devicePath() const;
-    int vendor()const;
-    int product()const;
-    int version()const;
-    int bustype()const;
-    const QString deviceName() const;
-    bool isEnabled() const;
-    bool error();
-    QString msgError();
-
-    QObject * getParent();
 
 signals:
     void newInputEvent(int type, int code, int value);
 
 private:
     int m_fd;
-    struct input_id m_device_info;
-    struct input_event m_currentEvent;
     QString m_devicePath;
     bool m_connected;
 
-    int m_vendor;
-    int m_product;
-    int m_version;
-    int m_bustype;
-
-    QString m_deviceName;
-    QString m_msgError;
-
-    bool m_error;
-
     bool openDevice(const QString &devicePath);
-    void closeDevice();
-
-    void readInformation();
 };
 
 #endif // INPUTTHREAD_H
--- ivihome.pro
+++ ivihome.pro
@@ -4,7 +4,7 @@
 QT += opengl
 TARGET = ivihome
 TEMPLATE = app
-LIBS += /usr/lib/libmb.so
+LIBS += /usr/lib/libmb.so -lX11
 INCLUDEPATH += /usr/include/libmb/
 SOURCES += main.cpp \
     taskbar.cpp \
--- launchwindow.cpp
+++ launchwindow.cpp
@@ -29,18 +29,39 @@
     p_widget = NULL;
     m_menuCategory = -1;
     m_menu_app = NULL;
-    applistcomplete = false;
     scrollmenu_startx = -1*settings.launcher_width+100;
     scrollmenu_movestep = settings.launcher_width/7;
-    connect(&applist,SIGNAL(finished()),this,SLOT(applistFinished()));
-    applist.start();
+    connect(&applist,SIGNAL(finished()),this,SLOT(appListFinished()));
+    populateAppList();
     this->setSceneRect(DEFAULT_VIEWX, DEFAULT_VIEWY, settings.launcher_width, rect.height());
     init();
 }
 
-void LaunchWindow::applistFinished()
+void LaunchWindow::populateAppList()
+{
+    applistcomplete = false;
+    applist.start();
+}
+
+void LaunchWindow::appListFinished()
 {
     applistcomplete = true;
+    updateAppMenu();
+}
+
+void LaunchWindow::appListChanged(const QString &file)
+{
+    if(!applistcomplete)
+    {
+        /* list is still populating, ignore */
+        return;
+    }
+
+    /* this is the first of directory change event, flag this and start
+       populating after 3 seconds, by this time, the installer should
+       finish installing the desktop files */
+    applistcomplete = false;
+    QTimer::singleShot(3000, this, SLOT(populateAppList()));
 }
 
 LaunchWindow::~LaunchWindow(void)
@@ -71,6 +92,17 @@
     connect(m_menu,SIGNAL(itemRightClicked(int,QString)),this,SLOT(categoryRightClicked(const int &, const QString &)));
     connect(m_menu,SIGNAL(itemScrolled(int)),this,SLOT(itemScrolled(const int &)));
 
+    updateAppMenu();
+
+    m_watcher = new QFileSystemWatcher();
+    m_watcher->addPath(QString(APPLICATION_FOLDER));
+    QObject::connect(m_watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(appListChanged(const QString&)));
+}
+
+void LaunchWindow::updateAppMenu()
+{
+    m_menu->removeAllItems();
+
     for(int i = 0; appcats[i].name != NULL; i++)
     {
         if(!applist.AppInfoList(i)->isEmpty())
@@ -143,7 +175,7 @@
     m_menu_app->drawList();
     m_menu_app->m_state=eEXPANDING;
     emit stateChanged(eEXPANDING);
-    connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(appmenuMovein()));
+    connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(appMenuMovein()));
     m_menuTimer.start();
 }
 
@@ -151,7 +183,7 @@
 {
     Q_UNUSED(id);
     Q_UNUSED(mainMenu);
-    closeMenu();
+    return;
 }
 
 void LaunchWindow::appClicked(const int &id, const QString &appname)
@@ -162,7 +194,7 @@
     {
         m_menu_app->m_state=eCOLLAPSEING;
         emit statechanged(eCOLLAPSEING);
-        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(appmenuMoveout()));
+        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(appMenuMoveout()));
         m_menuTimer.start();
         m_menuCategory = -1;
         return;
@@ -179,7 +211,7 @@
 {
     Q_UNUSED(id);
     Q_UNUSED(mainMenu);
-    closeMenu();
+	return;
 }
 
 void LaunchWindow::itemScrolled(const int &delta)
@@ -256,7 +288,7 @@
     menu->m_state=eCOLLAPSE;
 }
 
-void LaunchWindow::catmenuMovein()
+void LaunchWindow::catMenuMovein()
 {
     if(menuMovein(m_menu, true))
     {
@@ -264,7 +296,7 @@
     }
 }
 
-void LaunchWindow::catmenuMoveout()
+void LaunchWindow::catMenuMoveout()
 {
     if(menuMoveout(m_menu, true))
     {
@@ -272,7 +304,7 @@
     }
 }
 
-void LaunchWindow::appmenuMovein()
+void LaunchWindow::appMenuMovein()
 {
     if(menuMovein(m_menu_app, false))
     {
@@ -280,7 +312,7 @@
     }
 }
 
-void LaunchWindow::appmenuMoveout()
+void LaunchWindow::appMenuMoveout()
 {
     if(menuMoveout(m_menu_app, false))
     {
@@ -291,7 +323,7 @@
     }
 }
 
-void LaunchWindow::bothmenuMovein()
+void LaunchWindow::bothMenuMovein()
 {
     if(menuMovein(m_menu_app, true))
     {
@@ -300,7 +332,7 @@
     }
 }
 
-void LaunchWindow::bothmenuMoveout()
+void LaunchWindow::bothMenuMoveout()
 {
     if(menuMoveout(m_menu_app, true))
     {
@@ -318,14 +350,14 @@
     {
         m_menu->m_state=eEXPANDING;
         emit stateChanged(eEXPANDING);
-        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(catmenuMovein()));
+        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(catMenuMovein()));
         m_menuTimer.start();
     }
     else
     {
         m_menu_app->m_state=eEXPANDING;
         emit stateChanged(eEXPANDING);
-        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(bothmenuMovein()));
+        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(bothMenuMovein()));
         m_menuTimer.start();
     }
 }
@@ -339,14 +371,14 @@
     {
         m_menu->m_state=eCOLLAPSEING;
         emit stateChanged(eCOLLAPSEING);
-        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(catmenuMoveout()));
+        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(catMenuMoveout()));
         m_menuTimer.start();
     }
     else
     {
         m_menu_app->m_state=eCOLLAPSEING;
         emit stateChanged(eCOLLAPSEING);
-        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(bothmenuMoveout()));
+        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(bothMenuMoveout()));
         m_menuTimer.start();
     }
 }
@@ -431,14 +463,14 @@
     {
         m_menu->m_state=eCOLLAPSEING;
         emit stateChanged(eCOLLAPSEING);
-        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(catmenuMoveout()));
+        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(catMenuMoveout()));
         m_menuTimer.start();
     }
     else
     {
         m_menu_app->m_state=eCOLLAPSEING;
         emit stateChanged(eCOLLAPSEING);
-        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(appmenuMoveout()));
+        connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(appMenuMoveout()));
         m_menuTimer.start();
     }
 }
--- launchwindow.h
+++ launchwindow.h
@@ -60,22 +60,26 @@
     void appClicked(const int &id, const QString &mainMenu);
     void appRightClicked(const int &id, const QString &mainMenu);
     void itemScrolled(const int &delta);
-    void catmenuMovein();
-    void catmenuMoveout();
-    void appmenuMovein();
-    void appmenuMoveout();
-    void bothmenuMovein();
-    void bothmenuMoveout();
-    void applistFinished();
+    void catMenuMovein();
+    void catMenuMoveout();
+    void appMenuMovein();
+    void appMenuMoveout();
+    void bothMenuMovein();
+    void bothMenuMoveout();
+    void populateAppList();
+    void appListFinished();
+    void appListChanged(const QString &file);
 
 private:
     QRect rect;
     ApplicationList applist;
+    QFileSystemWatcher *m_watcher;
     QTimer m_menuTimer;
     int m_menuCategory;
     ScrollMenuList *m_menu;
     ScrollMenuList *m_menu_app;
     void init(void );
+    void updateAppMenu();
     bool menuMovein(ScrollMenuList *menu, bool movemask);
     bool menuMoveout(ScrollMenuList *menu, bool movemask);
     void finishmenuMovein(ScrollMenuList *menu);
--- scrollMenuList.cpp
+++ scrollMenuList.cpp
@@ -144,6 +144,24 @@
     p_widgetList << item;
 }
 
+void ScrollMenuList::removeAllItems()
+{
+    for (int i = 0; i < p_itemList.size(); i++)
+    {
+        StscrollItemData item = (StscrollItemData) p_itemList.at(i);
+        delete item.itemImage;
+        delete item.itemImageH;
+    }
+
+    for (int i = 0; i < p_widgetList.size(); i++)
+    {
+        ScrollItem *widget = (ScrollItem*) p_widgetList.at(i);
+        delete widget;
+    }
+    p_itemList.clear();
+    p_widgetList.clear();
+}
+
 void ScrollMenuList::setSelectedItem(int id)
 {
     qDebug() << "set select index " << id;
--- scrollMenuList.h
+++ scrollMenuList.h
@@ -52,6 +52,7 @@
                   QPixmap itemImage,
                   QPixmap itemImageH,
                   eItemType itype = eIMAGE);
+    void removeAllItems();
     void setSelectedItem(int id);
     int getSelectedItem();
     int getItemCount();



More information about the MeeGo-commits mailing list