release 0.6.4
authorHeikki Holstila <heikki.holstila@gmail.com>
Thu, 19 Aug 2010 10:00:10 +0000 (13:00 +0300)
committerHeikki Holstila <heikki.holstila@gmail.com>
Thu, 19 Aug 2010 10:00:10 +0000 (13:00 +0300)
TODO.txt
aaptinterface.cpp
debian/changelog
fapman
package.cpp
packageselector.cpp
packageview.cpp
repository.cpp

index 15411f5..6e9eb7f 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -5,22 +5,6 @@
 -------------------------------------------------------------------------------------
 
 
-0.6.4:
-* show user/hidden category apps in the list of installed apps (remove only)
-* show "recommends" and "suggests" in package dependencies if there are any
-* check rootfs and opt free space on startup and warn if low
-* option to disable automatic catalog updates
-* option to start fetching changelogs immediately when package view is opened
-* warn about immediate conflicts when selecting a package for operation (note that this doesn't check all possible conflicts)
-* don't use hildon banner in portrait mode
-* use the proxy settings for fetching package date information and changelogs
-* switched to garage bugtracker
-
-- move stuff away from Package class for possible speed increase
-
-* source code now available also from garage (git)
-
-
 0.6.5
 - a bugfix release (if needed)
 - promote to extras-testing
@@ -31,6 +15,8 @@
 - support loading .install files
 - support installing local .debs
 - mime type handling for .install and .deb (can it be done without conflicting HAM?)
+- possible to select cache location?
+- repository color coding?
 
 
 0.8 (possibly):
index 7ff8033..3d63feb 100644 (file)
@@ -847,7 +847,7 @@ void AAptInterface::uiUpdaterAptGetInstall()
 
 void AAptInterface::progressCheckTimerCallback()
 {
-       if( iAptGetCurrentDownloadFileName=="" )
+       if( iAptGetCurrentDownloadFileName.isEmpty() )
                return;
 
        qint64 prevsize = iAptGetCurrentFileDownloadSize;
@@ -904,7 +904,7 @@ QByteArray AAptInterface::readLogFile()
                own.close();
        }
 
-       if( log=="" )
+       if( log.isEmpty() )
                log = "The log is empty";
 
        return log;
@@ -972,7 +972,7 @@ void AAptInterface::readRepositoryInfo()
                while(!names.atEnd() && c<iRepositories.count())
                {
                        QString line = names.readLine().trimmed();
-                       if( line.trimmed()!="" )
+                       if( !line.trimmed().isEmpty() )
                        iRepositories.at(c)->setName( line.trimmed() );
                        c++;
                }
@@ -1137,7 +1137,7 @@ void AAptInterface::startPkgListRead()
        quint64 totaldatasize = 0;
        quint64 currentreaddata = 0;
        quint64 lastupdatedata = 0;
-       quint64 updateinterval = 1000000;
+       quint64 updateinterval = 2000000;
        if( iNeedListRefresh && !iSkipRefreshListAndDates ) {
                for( int i=0; i<files.count(); i++ )
                {
@@ -1183,14 +1183,13 @@ void AAptInterface::startPkgListRead()
 
                                while (!db.atEnd() && !iTerminated) {
                                        Package* newpkg = ReadNextPackage(db, currentreaddata);
-                                       //qDebug() << "read" << currentreaddata << "of" << totaldatasize;
                                        if( iUiDimmer && currentreaddata >= lastupdatedata+updateinterval ) {
                                                iUiDimmer->setProgress( currentreaddata*100/totaldatasize );
                                                lastupdatedata = currentreaddata;
                                                QApplication::processEvents();
                                        }
                                        pkgcount_apt++;
-                                       if( newpkg )//&& !newpkg->name().isEmpty() )
+                                       if( newpkg )
                                        {
                                                newpkg->addRepository( currentRepo );
 
@@ -1216,10 +1215,7 @@ void AAptInterface::startPkgListRead()
                                                                newpkg=0;
                                                        }
                                                }
-                                       }/* else if( newpkg ) {
-                                               delete newpkg;
-                                               newpkg = 0;
-                                       }*/
+                                       }
                                }
                                db.close();
                        }
@@ -1316,15 +1312,21 @@ Package* AAptInterface::ReadNextPackage(QFile& f, quint64& currentreaddata)
        Package* pkg = new Package("", this);
 
        bool pkgready = false;
+
+       // this is faster than directly reading to QByteArray...
+       char* data = new char[25000];
+       QByteArray line;
        while( !pkgready && !f.atEnd() ) {
-               QByteArray line = f.readLine();
+               f.readLine(data,25000);
+               line = data;
                currentreaddata += line.size();
                if( processPackageDataLine(pkg,line) ) {
                        pkgready = true;
                }
        }
+       delete data;
 
-       if( pkg->name() != "" && pkg->isInstalled() ) {
+       if( !pkg->name().isEmpty() && pkg->isInstalled() ) {
                QFileInfo f( KDpkgInfoDir + "/" + pkg->name() + ".list" );
                if( f.exists() )
                        pkg->setDate( f.lastModified() );
@@ -1332,7 +1334,8 @@ Package* AAptInterface::ReadNextPackage(QFile& f, quint64& currentreaddata)
 
        pkg->updateStatus();
 
-       if( pkg->name() == "" ) {
+       if( pkg->name().isEmpty() ) {
+               qDebug() << "null name package!";
                delete pkg;
                pkg = 0;
        }
@@ -1341,12 +1344,37 @@ Package* AAptInterface::ReadNextPackage(QFile& f, quint64& currentreaddata)
 
 bool AAptInterface::processPackageDataLine(Package*& pkg, QByteArray& line)
 {
-       if( !line.startsWith(' ') && !line.startsWith('\t') )
-               line = line.trimmed();
-       if( line.trimmed()=="" )
+       if( line.isEmpty() || line=="\n" )
+       {
                return true;
+       }
 
-       if( line.startsWith("Package:") )
+       else if( iMultiLine == MultiLineDesc ) {
+               if( (line.startsWith(' ') || line.startsWith('\t')) && !line.trimmed().isEmpty() ) {
+                       if( line.trimmed()!="." )
+                               pkg->appendDescLong( line.trimmed() + "\n" );
+                       else
+                               pkg->appendDescLong( "\n" );
+               } else {
+                       iMultiLine = MultiLineNone;
+               }
+       }
+       else if( iMultiLine == MultiLineIcon ) {
+               if( (line.startsWith(' ') || line.startsWith('\t')) && !line.trimmed().isEmpty() ) {
+                       pkg->appendIconData( line.trimmed() );
+               } else {
+                       iMultiLine = MultiLineNone;
+               }
+       }
+       else if( iMultiLine == MultiLineUpgradeDesc ) {
+               if( (line.startsWith(' ') || line.startsWith('\t')) && !line.trimmed().isEmpty() ) {
+                       pkg->appendUpgradeDescription( line.trimmed() + "\n" );
+               } else {
+                       iMultiLine = MultiLineNone;
+               }
+       }
+
+       else if( line.startsWith("Package:") )
        {
                pkg->setName( line.mid(8).trimmed() );
                iMultiLine=MultiLineNone;
@@ -1394,18 +1422,10 @@ bool AAptInterface::processPackageDataLine(Package*& pkg, QByteArray& line)
        {
                pkg->appendPreDepends( line.mid(12).trimmed() );
        }
-       else if( line.startsWith("Provides:") )
-       {
-               pkg->appendProvides( line.mid(9).trimmed() );
-       }
        else if( line.startsWith("Replaces:") )
        {
                pkg->appendReplaces( line.mid(9).trimmed() );
        }
-       else if( line.startsWith("Breaks:") )
-       {
-               pkg->appendBreaks( line.mid(7).trimmed() );
-       }
        else if( line.startsWith("Recommends:") )
        {
                pkg->appendRecommends( line.mid(11).trimmed() );
@@ -1414,33 +1434,16 @@ bool AAptInterface::processPackageDataLine(Package*& pkg, QByteArray& line)
        {
                pkg->appendSuggests( line.mid(9).trimmed() );
        }
-
-       if( iMultiLine == MultiLineDesc ) {
-               if( (line.startsWith(' ') || line.startsWith('\t')) && line.trimmed()!="" ) {
-                       if( line.trimmed()!="." )
-                               pkg->appendDescLong( line.trimmed() + "\n" );
-                       else
-                               pkg->appendDescLong( "\n" );
-               } else {
-                       iMultiLine = MultiLineNone;
-               }
-       }
-       else if( iMultiLine == MultiLineIcon ) {
-               if( (line.startsWith(' ') || line.startsWith('\t')) && line.trimmed()!="" ) {
-                       pkg->appendIconData( line.trimmed() );
-               } else {
-                       iMultiLine = MultiLineNone;
-               }
+       else if( line.startsWith("Provides:") )
+       {
+               pkg->appendProvides( line.mid(9).trimmed() );
        }
-       else if( iMultiLine == MultiLineUpgradeDesc ) {
-               if( (line.startsWith(' ') || line.startsWith('\t')) && line.trimmed()!="" ) {
-                       pkg->appendUpgradeDescription( line.trimmed() + "\n" );
-               } else {
-                       iMultiLine = MultiLineNone;
-               }
+       else if( line.startsWith("Breaks:") )
+       {
+               pkg->appendBreaks( line.mid(7).trimmed() );
        }
 
-       if( line.startsWith("Description:") )
+       else if( line.startsWith("Description:") )
        {
                pkg->setDescShort( line.mid(12).trimmed() );
                iMultiLine = MultiLineDesc;
@@ -1604,7 +1607,7 @@ void AAptInterface::startFetchDates()
 
        QNetworkAccessManager* nam = new QNetworkAccessManager(this);
 
-       if( iSettings->qsettings()->value("use_proxies").toBool() && iSettings->qsettings()->value("http_proxy").toString()!="" )
+       if( iSettings->qsettings()->value("use_proxies").toBool() && !iSettings->qsettings()->value("http_proxy").toString().isEmpty() )
        {
                 QNetworkProxy proxy = Settings::createProxyFromString( iSettings->qsettings()->value("http_proxy").toString() );
                 nam->setProxy(proxy);
@@ -1651,7 +1654,7 @@ void AAptInterface::startFetchDates()
        {
                fe.next();
 
-               if( updProgress >=10 ) {
+               if( updProgress >=20 ) {
                        iUiDimmer->setProgress( count*100/fetchable.count() );
                        updProgress=0;
                }
@@ -1708,7 +1711,7 @@ void AAptInterface::startFetchDates()
                }
        }
        while( iDateRequestsWaiting>0 ) {
-               if( updProgress >=10 ) {
+               if( updProgress >=20 ) {
                        iUiDimmer->setProgress( count*100/fetchable.count() );
                        updProgress=0;
                }
index f8f9194..4f6e58d 100644 (file)
@@ -1,8 +1,17 @@
 fapman (0.6.4-1) unstable; urgency=low
 
-  *
-
- -- Heikki Holstila <heikki.holstila@gmail.com>  Wed, 18 Aug 2010 17:35:44 +0300
+  * show user/hidden category apps in the list of installed apps (remove only)
+  * show "recommends" and "suggests" in package dependencies if there are any
+  * check rootfs and opt free space on startup and warn if low
+  * option to disable automatic catalog updates
+  * option to start fetching changelogs immediately when package view is opened
+  * warn about immediate conflicts when selecting a package for operation
+  * don't use hildon banner in portrait mode
+  * use the proxy settings for fetching package date information and changelogs
+  * package list read speed optimizations
+  * switched to garage bugtracker
+
+ -- Heikki Holstila <heikki.holstila@gmail.com>  Thu, 19 Aug 2010 12:57:31 +0300
 
 fapman (0.6.3-1) unstable; urgency=low
 
diff --git a/fapman b/fapman
index ea1f22c..699d3b9 100755 (executable)
Binary files a/fapman and b/fapman differ
index 19ba186..9a4924a 100644 (file)
@@ -40,7 +40,7 @@ Package::~Package()
 QString Package::displayName()
 {
        QString pkgname = name();
-       if( iMaemoDisplayName!="" )
+       if( !iMaemoDisplayName.isEmpty() )
                pkgname = maemoDisplayName();
        QString n( pkgname.at(0) );
        n = n.toUpper();
@@ -82,12 +82,10 @@ void Package::convertIcon()
 {
        if( iIconData.length() > 0 && iIcon == 0 ) {
                iIcon = new QPixmap();
-               iIconData = QByteArray::fromBase64( iIconData );
-               if( !iIcon->loadFromData( iIconData ) ) {
+               if( !iIcon->loadFromData(QByteArray::fromBase64(iIconData)) ) {
                        qDebug() << "Warning: Package" << iName << "has invalid icon data";
                }
        }
-
 }
 
 bool Package::isUpgradeable()
@@ -107,7 +105,7 @@ bool Package::isUpgradeable()
 
 QString Package::upgradeableVersion()
 {
-       QString ver="";
+       QString ver;
        if( isInstalled() ) {
                Package* newer = iAptInterface->packagesAvailable()->value(iName,0);
                if( newer )
@@ -139,7 +137,7 @@ void Package::updateStatus()
 
 Package::packageStatus Package::status()
 {
-       updateStatus(); // not optimal, but it's here just in case
+       updateStatus(); // just in case
        return iPkgStatus;
 }
 
@@ -221,7 +219,7 @@ QStringList Package::checkConflicts_RichText()
 
 bool Package::versionConflicts(QString conflictVer, QString operVer)
 {
-       if( conflictVer=="" )
+       if( conflictVer.isEmpty() )
                return true;
 
        bool confl = false;
index 392189a..54d0827 100644 (file)
@@ -44,7 +44,7 @@ PackageSelector::PackageSelector(Package* pkg, AAptInterface* apt, Settings* set
        iChangelog = "";
 
        ui->pushButton_website->setIcon(QPixmap("/usr/share/icons/hicolor/48x48/hildon/general_web.png"));
-       if( getMaemoOrgUrl(pkg)=="" && getMaemoOrgUrl(pkg->availablePackage())=="" ) {
+       if( getMaemoOrgUrl(pkg).isEmpty() && getMaemoOrgUrl(pkg->availablePackage()).isEmpty() ) {
                ui->pushButton_website->setEnabled(false);
        }
        if( pkg->isMarkedForOperation() )
@@ -76,7 +76,7 @@ PackageSelector::PackageSelector(Package* pkg, AAptInterface* apt, Settings* set
        Package* upg_pkg = iPkg->availablePackage();
        if( !upg_pkg )
                upg_pkg = iPkg;
-       if( (!pkg->isUpgradeable() || (upg_pkg && upg_pkg->upgradeDescription()=="")) && (getMaemoOrgUrl(upg_pkg)=="") )
+       if( (!pkg->isUpgradeable() || (upg_pkg && upg_pkg->upgradeDescription().isEmpty())) && (getMaemoOrgUrl(upg_pkg).isEmpty()) )
                ui->radioTabChanges->hide();
 
        if( pkg->isUpgradeable() )
@@ -105,7 +105,7 @@ PackageSelector::PackageSelector(Package* pkg, AAptInterface* apt, Settings* set
                ui->radioRemove->setChecked(true);
        }
 
-       if( getMaemoOrgUrl(upg_pkg)!="" && !iChangelogFetched && !iFetchInProgress &&
+       if( !getMaemoOrgUrl(upg_pkg).isEmpty() && !iChangelogFetched && !iFetchInProgress &&
                iSettings->qsettings()->value("always_fetch_changes",false).toBool() )
        {
                queryChangelog();
@@ -406,7 +406,7 @@ void PackageSelector::on_radioTabChanges_clicked()
        if( !upg_pkg )
                upg_pkg = iPkg;
 
-       if( iPkg->isUpgradeable() && upg_pkg && upg_pkg->upgradeDescription()!="" )
+       if( iPkg->isUpgradeable() && upg_pkg && !upg_pkg->upgradeDescription().isEmpty() )
        {
                text += "<u><b>Upgrade description:</b></u>";
                text += "<font size=\"-1\"><br>";
@@ -416,7 +416,7 @@ void PackageSelector::on_radioTabChanges_clicked()
        }
 
        QString changelog;
-       if( getMaemoOrgUrl(upg_pkg)!="" && !iChangelogFetched && !iFetchInProgress ) {
+       if( !getMaemoOrgUrl(upg_pkg).isEmpty() && !iChangelogFetched && !iFetchInProgress ) {
                queryChangelog();
                changelog = "Fetching changelog...";
        } else {
@@ -538,7 +538,7 @@ void PackageSelector::queryChangelog()
                iNetworkAccessManager = new QNetworkAccessManager(this);
                connect(iNetworkAccessManager,SIGNAL(finished(QNetworkReply*)),this,SLOT(changelogFetchNetworkReply(QNetworkReply*)));
 
-               if( iSettings->qsettings()->value("use_proxies").toBool() && iSettings->qsettings()->value("http_proxy").toString()!="" )
+               if( iSettings->qsettings()->value("use_proxies").toBool() && !iSettings->qsettings()->value("http_proxy").toString().isEmpty() )
                {
                         QNetworkProxy proxy = Settings::createProxyFromString( iSettings->qsettings()->value("http_proxy").toString() );
                         iNetworkAccessManager->setProxy(proxy);
index 6ca121f..1f2e514 100644 (file)
@@ -106,7 +106,7 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
                statusicon = iIconPkgRemove;
        }
 
-       QString showVer = "";
+       QString showVer;
        if( upgradeable && (statfilter==Package::PkgStatUpgradeable ||
                                                (statfilter==Package::PkgStatUnknown && marked==Package::PkgOpInstallUpgrade) ||
                                                (catfilter==PackageView::CatFilterAllMarked && marked==Package::PkgOpInstallUpgrade) ))
@@ -126,7 +126,7 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
                        painter->drawText(r, Qt::AlignTop|Qt::AlignRight, showVer, &r);
                        ver_w = r.width();
                } else if( blacklisted==BlacklistSelect::BlacklistThis ) {
-                       if( upgradeable && upg_version!="" ) {
+                       if( upgradeable && !upg_version.isEmpty() ) {
                                showVer = upg_version;
                        } else {
                                showVer = version;
@@ -490,7 +490,7 @@ void PackageView::addListItem(Package* pkg_, QString listname_)
        if( pkg_ != 0 )
        {
                QString name = pkg_->name();
-               if( pkg_->maemoDisplayName()!="" )
+               if( !pkg_->maemoDisplayName().isEmpty() )
                        name = pkg_->maemoDisplayName();
                p->setData(UserRoleName, name);
        } else {
@@ -827,7 +827,7 @@ void PackageView::on_lineEdit_textEdited(QString text)
        if( !ui->searchBar->isVisible() )
                return;
 
-       if( text=="" ) {
+       if( text.isEmpty() ) {
                on_btn_searchClose_clicked();
                return;
        }
@@ -1039,7 +1039,7 @@ void PackageView::on_actionLoad_selections_triggered()
                                } else {
                                        errors++;
                                }
-                       } else if( line!="" ){
+                       } else if( !line.isEmpty() ){
                                errors++;
                        }
                }
index b2b2cf1..31eb71e 100644 (file)
@@ -50,12 +50,12 @@ QStringList Repository::toListFileNames()
                com << "";
        for( int i=0; i<com.count(); i++ ) {
                QString chopUrl = iUrl.mid( iUrl.indexOf("://")+3 );
-               if( com.at(i)!="" )
+               if( !com.at(i).isEmpty() )
                        disttext = "dists_";
                else
                        disttext = "_";
                QString str = chopUrl + iDir + disttext + iDist + "_" + com.at(i);
-               if( com.at(i)!="" )
+               if( !com.at(i).isEmpty() )
                        str += "_binary-armel_Packages";
                else
                        str += "_Packages";
@@ -93,7 +93,7 @@ bool Repository::setFromString(QString repo)
                iDir = parts.at(1).right( parts.at(1).length()-d-1 );
        }
 
-       if( parts.at(2)!="" )
+       if( !parts.at(2).isEmpty() )
                iDist = parts.at(2);
        else
                return false;
@@ -158,7 +158,7 @@ void Repository::set(QString name, QString url, QString dir, QString dist, QStri
        if( !iUrl.endsWith('/') )
                iUrl.append('/');
        iDir = dir.trimmed();
-       if( !iDir.endsWith('/') && iDir!="" )
+       if( !iDir.endsWith('/') && !iDir.isEmpty() )
                iDir.append('/');
        iDist = dist.trimmed();
        iComponents = components.trimmed();