[PC-BSD Commits] r12096 - pcbsd/current/src-qt4/pc-softwaremanager

svn at pcbsd.org svn at pcbsd.org
Thu Aug 11 08:09:57 PDT 2011


Author: kris
Date: 2011-08-11 08:09:57 -0700 (Thu, 11 Aug 2011)
New Revision: 12096

Modified:
   pcbsd/current/src-qt4/pc-softwaremanager/classes.cpp
   pcbsd/current/src-qt4/pc-softwaremanager/classes.h
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp
Log:

Truncate descriptions in category listings / searches, add some functionality
for sizes to be used in the future



Modified: pcbsd/current/src-qt4/pc-softwaremanager/classes.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/classes.cpp	2011-08-11 13:55:30 UTC (rev 12095)
+++ pcbsd/current/src-qt4/pc-softwaremanager/classes.cpp	2011-08-11 15:09:57 UTC (rev 12096)
@@ -123,7 +123,7 @@
 AvailPBI::AvailPBI() { }
 AvailPBI::~AvailPBI() { }
 
-void AvailPBI::addPBI(QString name, QString ver, QString date, QString arch, QString auth, QString url, QString lic, QString type, QString keys, QString desc, QString icon, QString repo, QString cat, bool root)
+void AvailPBI::addPBI(QString name, QString ver, QString date, QString arch, QString auth, QString url, QString lic, QString type, QString keys, QString desc, QString icon, QString repo, QString cat, bool root, QString size)
 {
 	pbiName.append(name);
 	pbiVer.append(ver);
@@ -138,6 +138,7 @@
 	pbiIcon.append(icon);
 	pbiRepo.append(repo);
 	pbiCat.append(cat);
+	pbiSize.append(size);
 	if ( root )
   	  pbiRoot.append("YES");
 	else
@@ -150,6 +151,11 @@
 	return pbiCat.at(pnum);
 }
 
+QString AvailPBI::getSize(int pnum)
+{
+	return pbiSize.at(pnum);
+}
+
 QString AvailPBI::getRepo(int pnum)
 {
 	return pbiRepo.at(pnum);

Modified: pcbsd/current/src-qt4/pc-softwaremanager/classes.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/classes.h	2011-08-11 13:55:30 UTC (rev 12095)
+++ pcbsd/current/src-qt4/pc-softwaremanager/classes.h	2011-08-11 15:09:57 UTC (rev 12096)
@@ -98,14 +98,15 @@
     virtual QString getIcon(int pnum);
     virtual QString getRepo(int pnum);
     virtual QString getCat(int pnum);
+    virtual QString getSize(int pnum);
     virtual bool getRoot(int pnum);
     virtual int count();
     
     // Setters
-    virtual void addPBI(QString name, QString ver, QString date, QString arch, QString auth, QString url, QString lic, QString type, QString keys, QString desc, QString icon, QString repo, QString cat, bool root);
+    virtual void addPBI(QString name, QString ver, QString date, QString arch, QString auth, QString url, QString lic, QString type, QString keys, QString desc, QString icon, QString repo, QString cat, bool root, QString size);
 
 private:
-    QStringList pbiName, pbiVer, pbiDate, pbiArch, pbiAuth, pbiURL, pbiLic, pbiType, pbiKeys, pbiCat, pbiDesc, pbiIcon, pbiRepo, pbiRoot;
+    QStringList pbiName, pbiVer, pbiDate, pbiArch, pbiAuth, pbiURL, pbiLic, pbiType, pbiKeys, pbiCat, pbiDesc, pbiIcon, pbiRepo, pbiRoot, pbiSize;
     
 };
 

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp	2011-08-11 13:55:30 UTC (rev 12095)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp	2011-08-11 15:09:57 UTC (rev 12096)
@@ -140,7 +140,12 @@
 		grid1->addWidget(pLabel, 0, 1);
 
 		// Create the category description
-		QLabel *pDesc = new QLabel(pbiAvail->getDesc(i));
+		QString desc = pbiAvail->getDesc(i);
+		if ( desc.size() > 100 ) {
+                  desc.truncate(100);
+		  desc += "...";
+		}
+		QLabel *pDesc = new QLabel(desc);
 		pDesc->setAlignment(Qt::AlignLeft);
 		pDesc->setWordWrap(true);
 		pDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
@@ -598,7 +603,7 @@
 	QString repoID;
         QStringList indexTmp;
 	
-	QString name, ver, date, arch, auth, url, lic, type, keys, desc, icon, cat;
+	QString name, ver, date, arch, auth, url, lic, type, keys, desc, icon, cat, size;
 	bool needsRoot = false;
 	bool found;
 
@@ -658,6 +663,7 @@
 			keys.clear();
 			desc.clear();
 			icon.clear();
+			size.clear();
 			needsRoot=false;
 			found = false;
 
@@ -687,6 +693,7 @@
 			      arch = indexTmp.at(i).section(':', 1, 1); 
 			      ver = indexTmp.at(i).section(':', 2, 2); 
 			      date = indexTmp.at(i).section(':', 4, 4); 
+			      size = indexTmp.at(i).section(';', 7, 7);
 			      found = true;
 			      break;
 		            }
@@ -695,6 +702,7 @@
 			      arch = indexTmp.at(i).section(':', 1, 1); 
 			      ver = indexTmp.at(i).section(':', 2, 2); 
 			      date = indexTmp.at(i).section(':', 4, 4); 
+			      size = indexTmp.at(i).section(';', 7, 7);
 			      found = true;
 			    }
 			  }
@@ -702,7 +710,7 @@
 			    
 			// We have a current PBI
 			if ( found )
-				pbiAvail->addPBI(name, ver, date, arch, auth, url, lic, type, keys, desc, icon, repoID, cat, needsRoot);
+				pbiAvail->addPBI(name, ver, date, arch, auth, url, lic, type, keys, desc, icon, repoID, cat, needsRoot, size);
 		}
 		mFile.close();
 
@@ -900,7 +908,12 @@
 		grid1->addWidget(pLabel, 0, 1);
 
 		// Create the category description
-		QLabel *pDesc = new QLabel(pbiAvail->getDesc(i));
+		QString desc = pbiAvail->getDesc(i);
+		if ( desc.size() > 100 ) {
+                  desc.truncate(100);
+		  desc += "...";
+		}
+		QLabel *pDesc = new QLabel(desc);
 		pDesc->setAlignment(Qt::AlignLeft);
 		pDesc->setWordWrap(true);
 		pDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);



More information about the Commits mailing list