[PC-BSD Commits] r2146 - pcbsd/trunk/kcmPBMsource

svn at pcbsd.org svn at pcbsd.org
Fri Jun 20 10:53:18 PDT 2008


Author: kris
Date: 2008-06-20 10:53:18 -0700 (Fri, 20 Jun 2008)
New Revision: 2146

Modified:
   pcbsd/trunk/kcmPBMsource/pbi.cpp
   pcbsd/trunk/kcmPBMsource/pbi.h
   pcbsd/trunk/kcmPBMsource/pbm.ui.h
Log:

Fixed up the icons / versions being displayed in PBM tool, got rid of some
overrides which we're necessary from our reimplementation of QListWidgetItem



Modified: pcbsd/trunk/kcmPBMsource/pbi.cpp
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbi.cpp	2008-06-20 17:25:58 UTC (rev 2145)
+++ pcbsd/trunk/kcmPBMsource/pbi.cpp	2008-06-20 17:53:18 UTC (rev 2146)
@@ -29,12 +29,12 @@
 {
    name = "SOMENAME";
    version = "0.0.1";
-   icon = QPixmap();
+   setIcon(QPixmap());
    author = "";
    website = "";
    exePath = QStringList();
    mimeFile = QStringList();
-   iconPath = "";
+   savedIconPath = "";
    setText(name + " " + version);
 }
 
@@ -42,16 +42,16 @@
 {
    this->name = name;
    this->version = version;
-   setIcon(iconPath);
+   //setIcon(iconPath);
    this->author = author;
    this->website = website;
-   iconPath = "";
+   savedIconPath = iconPath;
    setText(name + " " + version);
 }
 
 PBI::PBI(QIcon icon, QListWidget *listbox) : QListWidgetItem(icon, "", listbox)
 {
-   this->icon = icon;
+   setIcon(icon);
 }
 
 PBI::~PBI()
@@ -69,11 +69,6 @@
    return version;
 }
 
-QIcon PBI::getIcon()
-{
-   return icon;
-}
-
 QString PBI::getAuthor()
 {
    return author;
@@ -106,15 +101,10 @@
    setText(name + " " + version);
 }
 
-void PBI::setIcon(QIcon icon)
-{
-   this->icon = icon;
-}
 
-void PBI::setIcon(QString iconPath)
+void PBI::setIconPath(QString iconPath)
 {
-   icon = QIcon(iconPath);
-   this->iconPath = iconPath;
+	this->savedIconPath = iconPath;
 }
 
 void PBI::setAuthor(QString author)
@@ -144,7 +134,7 @@
 
 void PBI::paint(QPainter *p)
 {
-   QPixmap icon = pixmap();
+   QPixmap icon = QPixmap();
    p->drawPixmap(3, 0, icon);
    if (!text().isEmpty())
    {
@@ -156,11 +146,6 @@
    }
 }
 
-QPixmap PBI::pixmap()
-{
-   return icon.pixmap(40,40);
-}
-
 QString PBI::toString()
 {
    return text() + "\n" + getAuthor();
@@ -178,5 +163,5 @@
 
 QString PBI::getIconPath()
 {
-   return iconPath;
+   return savedIconPath;
 }

Modified: pcbsd/trunk/kcmPBMsource/pbi.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbi.h	2008-06-20 17:25:58 UTC (rev 2145)
+++ pcbsd/trunk/kcmPBMsource/pbi.h	2008-06-20 17:53:18 UTC (rev 2146)
@@ -40,7 +40,6 @@
     //Getters
     virtual QString getName();
     virtual QString getVersion();
-    virtual QIcon getIcon();
     virtual QString getAuthor();
     virtual QString getWebsite();
     virtual QStringList getExePath();
@@ -50,8 +49,7 @@
     //Setters
     virtual void setName(QString name);
     virtual void setVersion(QString version);
-    virtual void setIcon(QIcon icon);
-    virtual void setIcon(QString iconPath);
+    virtual void setIconPath(QString iconPath);
     virtual void setAuthor(QString author);
     virtual void setWebsite(QString website);
     virtual void setExePath(QStringList exePath);
@@ -60,7 +58,6 @@
     //Overrides
     virtual QString text();
     virtual void paint(QPainter *p);
-    virtual QPixmap pixmap();
     
     virtual QString toString();
     virtual void addMimeFile(QString mime);
@@ -69,12 +66,11 @@
 private:
     QString name;
     QString version;
-    QIcon icon;
     QString author;
     QString website;
     QStringList exePath;
     QStringList mimeFile;
-    QString iconPath;
+    QString savedIconPath;
 };
 
 #endif // INC_PBI_H

Modified: pcbsd/trunk/kcmPBMsource/pbm.ui.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.ui.h	2008-06-20 17:25:58 UTC (rev 2145)
+++ pcbsd/trunk/kcmPBMsource/pbm.ui.h	2008-06-20 17:53:18 UTC (rev 2146)
@@ -117,6 +117,7 @@
     SoftwareListBox->clear();
     QPixmap defaultIcon;
     defaultIcon.convertFromImage(QImage("/Programs/.config/application.png").smoothScale(40,40));
+    QString tmp;
 
     qDebug("Opening ProgList");
     QFile file( "/Programs/.config/ProgList" );
@@ -147,11 +148,26 @@
 		{
 		    //ProgIcon[i] = line.replace("DefaultIcon: ", "");
                     QString iconPath = line.replace("DefaultIcon: ", "");
-                    if (iconPath.isEmpty()) iconPath = "/Programs/.config/application.png";
-                    else iconPath = "/Programs/" + pbi->getName() + pbi->getVersion() + "/" + iconPath;
-                    iconPath.replace(" ", "");
+                    if (iconPath.isEmpty()) {
+                       iconPath = "/Programs/.config/application.png";
+                    } else  {
+    			// Set our ProgDirName variable
+    			tmp = pbi->getName();
+    			tmp.replace(" ", "");
+    			QString progDir = tmp;
+    			tmp = pbi->getVersion();
+    			tmp.replace(" ", "");
+    			progDir = progDir + tmp;
+
+                       iconPath = "/Programs/" + progDir + "/" + iconPath;
+
+                    }
                     qDebug("iconPath: " + iconPath);
-                    pbi->setIcon(iconPath);
+                    QIcon custIcon;
+                    custIcon.addFile(iconPath);
+		    //QMessageBox::information( this, tr("Error!"), "Icon:" + iconPath );
+
+                    pbi->setIcon(custIcon);
 		}
 		if ( line.find("ProgAuthor:") == 0)
 		{



More information about the Commits mailing list