author | kergoth <kergoth> | 2003-02-18 18:28:18 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-02-18 18:28:18 (UTC) |
commit | 50f0a50a14f87960cf9492d01aeed5a56a6dca06 (patch) (side-by-side diff) | |
tree | 4c922e0fbdc815aba671c09975e56d77140b2c30 | |
parent | f8226f95152e53948b064303b5dc6513ece222aa (diff) | |
download | opie-50f0a50a14f87960cf9492d01aeed5a56a6dca06.zip opie-50f0a50a14f87960cf9492d01aeed5a56a6dca06.tar.gz opie-50f0a50a14f87960cf9492d01aeed5a56a6dca06.tar.bz2 |
Use a max line count on the QMultiLineEdit used for ipkg output, as users have reported performance issues when the line count gets huge.
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 9339086..1f0bb5f 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -12,64 +12,68 @@ * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include <stdio.h> #ifdef QWS #include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/storage.h> #endif #include <qcheckbox.h> #include <qcombobox.h> #include <qdialog.h> #include <qgroupbox.h> #include <qmultilineedit.h> #include <qlabel.h> #include <qlayout.h> #include <qpushbutton.h> #include "datamgr.h" #include "destination.h" #include "instoptionsimpl.h" #include "installdlgimpl.h" #include "ipkg.h" #include "utils.h" #include "global.h" +enum { + MAXLINES = 100, +}; + InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title ) : QWidget( 0, 0, 0 ) { setCaption( title ); init( TRUE ); pIpkg = 0; upgradePackages = false; dataMgr = dataManager; QString defaultDest = "root"; #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); defaultDest = cfg.readEntry( "dest", "root" ); // Grab flags - Turn MAKE_LINKS on by default (if no flags found) flags = cfg.readNumEntry( "installFlags", 0 ); #else flags = 0; #endif // Output text is read only output->setReadOnly( true ); // QFont f( "helvetica" ); // f.setPointSize( 10 ); // output->setFont( f ); // setup destination data int defIndex = 0; int i; @@ -290,64 +294,70 @@ void InstallDlgImpl :: installSelected() if ( idata->option == "R" ) pIpkg->setOption( "reinstall" ); else pIpkg->setOption( "upgrade" ); pIpkg->setDestination( idata->destination->getDestinationName() ); pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); pIpkg->setPackage( idata->packageName ); int tmpFlags = flags; if ( idata->destination->linkToRoot() && idata->recreateLinks ) tmpFlags |= MAKE_LINKS; pIpkg->setFlags( tmpFlags ); pIpkg->runIpkg(); } delete pIpkg; pIpkg = 0; } btnOptions->setEnabled( true ); // btnInstall->setEnabled( true ); btnInstall->setText( tr( "Close" ) ); btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) displayAvailableSpace( destination->currentText() ); } void InstallDlgImpl :: displayText(const QString &text ) { QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); + + /* Set a max line count for the QMultiLineEdit, as users have reported + * performance issues when line count gets extreme. + */ + if(output->numLines() >= MAXLINES) + output->removeLine(0); output->setText( newtext ); output->setCursorPosition( output->numLines(), 0 ); } void InstallDlgImpl :: displayAvailableSpace( const QString &text ) { Destination *d = dataMgr->getDestination( text ); QString destDir = d->getDestinationPath(); long blockSize = 0; long totalBlocks = 0; long availBlocks = 0; QString space; if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) { long mult = blockSize / 1024; long div = 1024 / blockSize; if ( !mult ) mult = 1; if ( !div ) div = 1; // long total = totalBlocks * mult / div; long avail = availBlocks * mult / div; // long used = total - avail; space.sprintf( "%ld Kb", avail ); } else space = tr( "Unknown" ); if ( txtAvailableSpace ) txtAvailableSpace->setText( space ); |