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

Brian Harring brian.harring at intel.com
Tue Jul 13 23:35:18 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 #5674:

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


Message:
    transfer 1.7 in to resolve segfault

State:   new          2010-07-13T11:30:10 ferringb
Comment: None



changes files:
--------------
--- ivihome.changes
+++ ivihome.changes
@@ -0,0 +1,4 @@
+* Mon Jul 12 2010 Jimmy Huang <jimmy.huang at intel.com> - 1.7
+- Fixed bug where ivihome crashes on first boot
+- Fixed bug#3805 and bug#3804 cannot customize through settings.xml
+

old:
----
  ivihome-1.6.tar.gz

new:
----
  ivihome-1.7.tar.gz

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

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

++++++ ivihome-1.6.tar.gz -> ivihome-1.7.tar.gz
--- applicationlist.cpp
+++ applicationlist.cpp
@@ -19,6 +19,7 @@
 **************************************************************************/
 
 #include "applicationlist.h"
+#include "settings.h"
 #include <dirent.h>
 #include <errno.h>
 #include <string.h>
@@ -28,17 +29,25 @@
 ApplicationList::ApplicationList()
 {
     missingicons = 0;
+
+    for (int i=0; i<settings.getCategoryCount(); i++)
+    {
+        QList<AppInfo> category;
+        applist << category;
+    }
+
 }
 
 void ApplicationList::clear()
 {
     missingicons = 0;
     p_applist.clear();
-    for(uint i = 0; i < APPCATCOUNT; i++)
+    for(int i = 0; i < applist.size(); i++)
     {
-        for(int j = 0; j < applist[i].count(); j++)
-            mb_dotdesktop_free(applist[i].at(j).mb);
-        applist[i].clear();
+        QList<AppInfo> *category = &(applist[i]);
+        for(int j = 0; j < category->count(); j++)
+            mb_dotdesktop_free(category->at(j).mb);
+        category->clear();
     }
 }
 
@@ -70,7 +79,6 @@
             {
                 p_applist.at(j)->Icon = files.at(i);
                 p_applist.at(j)->Icon.prepend(dir.absolutePath() + "/");
-                //qDebug() << p_applist.at(j)->Icon;
                 missingicons--;
                 if(missingicons <= 0)
                     return;
@@ -150,7 +158,8 @@
 void ApplicationList::AddEntry(int idx, MBDotDesktop *mb)
 {
     AppInfo appinfo;
-    appinfo.id = applist[idx].count();
+    QList<AppInfo> *category = &(applist[idx]);
+    appinfo.id = category->count();
     appinfo.mb = mb;
     appinfo.Name = (char *)mb_dotdesktop_get(mb, "Name");
     appinfo.IconName = (char *)mb_dotdesktop_get(mb, "Icon");
@@ -163,8 +172,21 @@
         appinfo.Icon.clear();
         missingicons++;
     }
-    applist[idx] << appinfo;
-    p_applist << &applist[idx].last();
+    category->append(appinfo);
+    p_applist << &(category->last());
+}
+
+void ApplicationList::AddEntry(QString name, MBDotDesktop *mb)
+{
+    for (int i=0;i<settings.getCategoryCount();i++)
+    {
+        ApplicationCategory category = settings.getApplicationCategories().at(i);
+        if (category.name == name)
+        {
+            AddEntry(i, mb);
+        }
+    }
+
 }
 
 void ApplicationList::ProcessEntry(MBDotDesktop *mb)
@@ -204,9 +226,11 @@
         return;
     }
     catlist = line.split(";", QString::SkipEmptyParts);
-    for(i = 0; (i < APPCATCOUNT)&&(!match); i++)
+    for(i = 0; (i < settings.getCategoryCount())&&(!match); i++)
     {
-        matcheslist = QString(appcats[i].matches).split("|", QString::SkipEmptyParts);
+        ApplicationCategory category = settings.getApplicationCategories().at(i);
+        matcheslist = QString(category.matches).split(",", QString::SkipEmptyParts);
+
         for(j = 0; (j < matcheslist.size())&&(!match); j++)
         {
             if(catlist.contains(matcheslist.at(j).toAscii(), Qt::CaseInsensitive))
@@ -216,13 +240,29 @@
             }
         }
     }
-#ifdef UNKNOWNCAT
+
     // If the app has no identifiable category, throw it in other
     if(!match)
-        AddEntry(UNKNOWNCAT, mb);
-#else
-    mb_dotdesktop_free(mb);
-#endif
+    {
+        QString nomatch_cat_name;
+        for(i = 0; i < settings.getCategoryCount(); i++)
+        {
+            ApplicationCategory category = settings.getApplicationCategories().at(i);
+            if(category.matches == "*")
+            {
+                nomatch_cat_name = category.name;
+            }
+        }
+
+        if (!nomatch_cat_name.isEmpty())
+        {
+            AddEntry(nomatch_cat_name, mb);
+            match = true;
+        }
+    }
+
+    if(!match)
+        mb_dotdesktop_free(mb);
 }
 
 void ApplicationList::populateList()
@@ -260,14 +300,14 @@
 
 QList<AppInfo>* ApplicationList::AppInfoList(const int &idx)
 {
-    return &applist[idx];
+    return &(applist[idx]);
 }
 
 QList<AppInfo>* ApplicationList::AppInfoList(const QString &category)
 {
-    for(uint idx = 0; idx < APPCATCOUNT; idx++)
-        if(category == appcats[idx].name)
-            return &applist[idx];
+    for(uint idx = 0; idx < settings.getCategoryCount(); idx++)
+        if(category == settings.getApplicationCategories().at(idx).name)
+            return &(applist[idx]);
     return NULL;
 }
 
--- applicationlist.h
+++ applicationlist.h
@@ -26,10 +26,6 @@
 #include "settings.h"
 #include <mbdotdesktop.h>
 
-#define APPCATCOUNT ((sizeof(appcats)/sizeof(AppCategories))-1)
-#define UNKNOWNCAT 5 // The category index you want unknown apps in
-//#define BACKBUTTON (APPCATCOUNT-2)
-
 struct AppInfo
 {
     int id;
@@ -39,27 +35,6 @@
     QString Icon;
 };
 
-const struct AppCategories appcats[] = {
-    { "Navigation", NAVIGATION_ICON, NAVIGATION_ICONH,
-      "Webservices|WebBrowser|Internet|Network" },
-    { "Connect", COMMUNICATE_ICON, COMMUNICATE_ICONH,
-      "Communications|Email|InstantMessaging|Telephony" },
-    { "Music", MUSIC_ICON, MUSIC_ICONH,
-      "Media|Audio|Player" },
-    { "Activities", ACTIVITIES_ICON, ACTIVITIES_ICONH,
-      "Games|AudioVideo|Video|Viewer|Education" },
-    { "Tools", TOOLS_ICON, TOOLS_ICONH,
-      "Tools|Office|Security|Settings|Utility|System|DesktopSettings|HardwareSettings|Documentation"},
-    { "More",  OTHER_ICON, OTHER_ICONH,
-      NULL},
-#ifdef BACKBUTTON
-    { "Back",  IVIDIR "back_icon.png", IVIDIR "back_icon_hl.png",
-      NULL},
-#endif
-    { NULL, NULL, NULL,
-      NULL},
-};
-
 class ApplicationList : public QThread
 {
 public:
@@ -71,10 +46,11 @@
     void LaunchApp(const int &idx, const int &id);
     void run();
 private:
-    QList<AppInfo> applist[APPCATCOUNT];
+    QList<QList<AppInfo> > applist;
     QList<AppInfo*> p_applist;
     int missingicons;
     void AddEntry(int idx, MBDotDesktop *mb);
+    void AddEntry(QString name, MBDotDesktop *mb);
     void ProcessEntry(MBDotDesktop *mb);
     void findIcons(const QDir &dir);
     void findIconsBySize(const QDir &dir);
--- defines.h
+++ defines.h
@@ -46,6 +46,10 @@
 #define ACTIVITIES_ICON "/usr/share/ivihome/video-inactive.svg"
 #define TOOLS_ICONH "/usr/share/ivihome/settings-active.svg"
 #define TOOLS_ICON "/usr/share/ivihome/settings-inactive.svg"
+#define BACK_ICONH "/usr/share/ivihome/back_icon_hl.png"
+#define BACK_ICON "/usr/share/ivihome/back_icon.png"
 #define SETTINGSFILE "/usr/share/ivihome/settings.xml"
 
+//#define BACKBUTTON
+
 #endif // DEFINES_H
--- launchwindow.cpp
+++ launchwindow.cpp
@@ -31,7 +31,7 @@
     m_menu_app = NULL;
     scrollmenu_startx = -1*settings.launcher_width+100;
     scrollmenu_movestep = settings.launcher_width/7;
-    connect(&applist,SIGNAL(finished()),this,SLOT(appListFinished()));
+    connect(&m_applist_thread,SIGNAL(finished()),this,SLOT(appListThreadFinished()));
     populateAppList();
     this->setSceneRect(DEFAULT_VIEWX, DEFAULT_VIEWY, settings.launcher_width, rect.height());
     init();
@@ -40,10 +40,10 @@
 void LaunchWindow::populateAppList()
 {
     applistcomplete = false;
-    applist.start();
+    m_applist_thread.start();
 }
 
-void LaunchWindow::appListFinished()
+void LaunchWindow::appListThreadFinished()
 {
     applistcomplete = true;
     updateAppMenu();
@@ -51,6 +51,8 @@
 
 void LaunchWindow::appListChanged(const QString &file)
 {
+    Q_UNUSED(file);
+
     if(!applistcomplete)
     {
         /* list is still populating, ignore */
@@ -103,13 +105,13 @@
 {
     m_menu->removeAllItems();
 
-    for(int i = 0; appcats[i].name != NULL; i++)
+    for(int i=0; i<settings.getCategoryCount(); i++)
     {
-        if(!applist.AppInfoList(i)->isEmpty())
+        if(!m_applist_thread.AppInfoList(i)->isEmpty())
         {
-            m_menu->addItem(i, appcats[i].name,
-                QPixmap(appcats[i].img),
-                QPixmap(appcats[i].imgh),
+            m_menu->addItem(i, settings.getApplicationCategories().at(i).name,
+                QPixmap(settings.getApplicationCategories().at(i).img),
+                QPixmap(settings.getApplicationCategories().at(i).imgh),
                 eTEXT);
         }
     }
@@ -138,12 +140,12 @@
     if(mainMenu == "Back")
     {
         contract();
-        //m_menu->setCurrectItem(appcats[2].name);
+        //m_menu->setCurrectItem(settings.getApplicationCategories().at(2).name);
         return;
     }
 #endif
 
-    appinfolist = applist.AppInfoList(id);
+    appinfolist = m_applist_thread.AppInfoList(id);
     if(appinfolist->isEmpty())
         return;
 
@@ -169,7 +171,7 @@
     }
 
 #ifdef BACKBUTTON
-    m_menu_app->addItem(0, appcats[BACKBUTTON].name, QPixmap(appcats[BACKBUTTON].img), QPixmap(appcats[BACKBUTTON].imgh), eTEXT);
+    m_menu_app->addItem(0, "Back", QPixmap(BACK_ICON), QPixmap(BACK_ICONH), eTEXT);
     i++;
 #endif
     m_menu_app->drawList();
@@ -193,7 +195,7 @@
     if(appname == "Back")
     {
         m_menu_app->m_state=eCOLLAPSEING;
-        emit statechanged(eCOLLAPSEING);
+        emit stateChanged(eCOLLAPSEING);
         connect(&m_menuTimer,SIGNAL(timeout()),this,SLOT(appMenuMoveout()));
         m_menuTimer.start();
         m_menuCategory = -1;
@@ -202,7 +204,7 @@
 #endif
     if((m_menu->m_state==eEXPAND)&&(m_menuCategory >= 0))
     {
-        applist.LaunchApp(m_menuCategory, id);
+        m_applist_thread.LaunchApp(m_menuCategory, id);
         contract();
     }
 }
--- launchwindow.h
+++ launchwindow.h
@@ -67,12 +67,12 @@
     void bothMenuMovein();
     void bothMenuMoveout();
     void populateAppList();
-    void appListFinished();
+    void appListThreadFinished();
     void appListChanged(const QString &file);
 
 private:
     QRect rect;
-    ApplicationList applist;
+    ApplicationList m_applist_thread;
     QFileSystemWatcher *m_watcher;
     QTimer m_menuTimer;
     int m_menuCategory;
--- scrollMenuList.cpp
+++ scrollMenuList.cpp
@@ -206,8 +206,11 @@
                                    ITEMY(ctridx - selectedIndex + j));
     }
 
-    p_widgetList.at(selectedIndex)->setCurrectItem(true);
-    p_currectItem = p_widgetList.at(selectedIndex);
+    if(p_widgetList.size() > 0)
+    {
+        p_widgetList.at(selectedIndex)->setCurrectItem(true);
+        p_currectItem = p_widgetList.at(selectedIndex);
+    }
 }
 
 void ScrollMenuList::clickSelectedItem()
--- settings.cpp
+++ settings.cpp
@@ -25,7 +25,6 @@
     backbuttonimage = "/usr/share/ivihome/panel-inactive.svg";
     backbuttonimageH = "/usr/share/ivihome/panel-pressed.svg";
     appdefaulticon = "/usr/share/ivihome/app-default-icon.png";
-    ApplicationCategories appcatlist;
 
     /* now override the defaults with the settings file */
     QFile* file = new QFile(SETTINGSFILE);
@@ -50,7 +49,7 @@
             /* appcategory nodes have child nodes, process them in a loop */
             if(name == "appcategory")
             {
-                ApplicationCategories appcat;
+                ApplicationCategory appcat;
                 qDebug() << "Name: " << name;
 
                 while (!xml.atEnd()&&
@@ -94,8 +93,7 @@
 
                     if(cname == "name")
                     {
-                        QFile fp(cdata);
-                        if(fp.exists())
+                        if(!cdata.isNull() && !cdata.isEmpty())
                             appcat.name = cdata;
                     } else if(cname == "iconH")
                     {
@@ -109,9 +107,10 @@
                             appcat.img = cdata;
                     } else if(cname == "matches")
                     {
-                        appcat.matches = cdata.split(",", QString::SkipEmptyParts);
+                        appcat.matches = cdata;
                     }
                 }
+                m_appCategories << appcat;
             }
 
             /* grab the data for valid elements */
@@ -236,4 +235,27 @@
             }
         }
     }
+    else
+    {
+#ifdef BACKBUTTON
+        int cat_size = 6;
+#else
+        int cat_size = 7;
+#endif
+
+        for (int i=0;i<cat_size;i++)
+        {
+            this->m_appCategories << default_appcats[i];
+        }
+    }
+}
+
+int Settings::getCategoryCount()
+{
+    return this->m_appCategories.size();
+}
+
+QList<ApplicationCategory> Settings::getApplicationCategories()
+{
+    return this->m_appCategories;
 }
--- settings.h
+++ settings.h
@@ -2,27 +2,43 @@
 #define SETTINGS_H
 
 #include <QWidget>
+#include "defines.h"
 
-struct ApplicationCategories
+struct ApplicationCategory
 {
     QString name;
     QString img;
     QString imgh;
-    QStringList matches;
+    QString matches;
 };
 
-struct AppCategories
-{
-    const char *name;
-    const char *img;
-    const char *imgh;
-    const char *matches;
+const struct ApplicationCategory default_appcats[] = {
+    { QString("Navigation"), QString(NAVIGATION_ICON), QString(NAVIGATION_ICONH),
+      QString("Webservices,WebBrowser,Internet,Network") },
+    { QString("Connect"), QString(COMMUNICATE_ICON), QString(COMMUNICATE_ICONH),
+      QString("Communications,Email,InstantMessaging.Telephony") },
+    { QString("Music"), QString(MUSIC_ICON), QString(MUSIC_ICONH),
+      QString("Media,Audio,Player") },
+    { QString("Activities"), QString(ACTIVITIES_ICON), QString(ACTIVITIES_ICONH),
+      QString("Games,AudioVideo,Video,Viewer,Education") },
+    { QString("Tools"), QString(TOOLS_ICON), QString(TOOLS_ICONH),
+      QString("Tools,Office,Security,Settings,Utility,System,DesktopSettings,HardwareSettings,Documentation")},
+    { QString("More"),  QString(OTHER_ICON), QString(OTHER_ICONH),
+      NULL},
+#ifdef BACKBUTTON
+    { QString("Back"),  QString(BACK_ICON), QString(BACK_ICONH),
+      NULL},
+#endif
+    { NULL, NULL, NULL,
+      NULL},
 };
 
 class Settings
 {
 public:
     Settings();
+    int getCategoryCount();
+    QList<struct ApplicationCategory> getApplicationCategories();
 
     QColor taskbar_bgcolor1;
     QColor taskbar_bgcolor2;
@@ -43,6 +59,10 @@
     QString backbuttonimage;
     QString backbuttonimageH;
     QString appdefaulticon;
+
+private:
+    QList<ApplicationCategory> m_appCategories;
+
 };
 
 extern Settings settings;
--- settings.xml
+++ settings.xml
@@ -63,36 +63,37 @@
 		<matches>Webservices,WebBrowser,Internet,Network</matches>
 	</appcategory>
 	<appcategory>
-                <name>Connect</name>
+		<name>Connect</name>
 		<iconH>/usr/share/ivihome/connect-active.svg</iconH>
 		<icon>/usr/share/ivihome/connect-inactive.svg</icon>
-                <matches>Communications,Email,InstantMessaging,Telephony</matches>
+        <matches>Communications,Email,InstantMessaging,Telephony</matches>
 	</appcategory>
 	<appcategory>
-                <name>Music</name>
+		<name>Music</name>
 		<iconH>/usr/share/ivihome/music-active.svg</iconH>
 		<icon>/usr/share/ivihome/music-inactive.svg</icon>
-                <matches>Media,Audio,Player</matches>
+        <matches>Media,Audio,Player</matches>
 	</appcategory>
 	<appcategory>
-                <name>Activities</name>
+		<name>Activities</name>
 		<iconH>/usr/share/ivihome/video-active.svg</iconH>
 		<icon>/usr/share/ivihome/video-inactive.svg</icon>
-                <matches>Games,AudioVideo,Video,Viewer,Education</matches>
+        <matches>Games,AudioVideo,Video,Viewer,Education</matches>
 	</appcategory>
 	<appcategory>
-                <name>Tools</name>
+		<name>Tools</name>
 		<iconH>/usr/share/ivihome/settings-active.svg</iconH>
 		<icon>/usr/share/ivihome/settings-inactive.svg</icon>
-                <matches>Tools,Office,Security,Settings,Utility,System,DesktopSettings,HardwareSettings,Documentation</matches>
+        <matches>Tools,Office,Security,Settings,Utility,System,DesktopSettings,HardwareSettings,Documentation</matches>
 	</appcategory>
 	<appcategory>
-		<name>Junk</name>
-	</appcategory>
-	<appcategory>
-                <name>More</name>
+		<name>More</name>
 		<iconH>/usr/share/ivihome/other-active.svg</iconH>
 		<icon>/usr/share/ivihome/other-inactive.svg</icon>
-		<matches>everythingelse</matches>
+        <!-- If you specific "*" in the <matches>, it will group everything else that didn't
+             match above in here -->
+        <!-- Note! If you don't have this catagory, and if an app do not match any of the app categories,
+             the category will not show up in the scroll menu -->
+		<matches>*</matches>
 	</appcategory>
 </settings>



More information about the MeeGo-commits mailing list