Mailinglist Archive: yast-devel (105 mails)

< Previous Next >
Re: [zypp-devel] [yast-devel] patch disk usage (was: repodata.c - clarification)
  • From: "Roberto Mannai" <robermann@xxxxxxxxx>
  • Date: Mon, 8 Sep 2008 10:06:40 +0200
  • Message-id: <414e44f70809080106xf5c876fg8178ada5f5d15d31@xxxxxxxxxxxxxx>
Hi all
any news about the patch?

Ciao
Roberto

On Tue, Aug 26, 2008 at 9:16 AM, Stanislav Visnovsky <visnov@xxxxxxx> wrote:

Hi Roberto!

Thanks a lot for the patch! Unfortunatelly, our maintainer for the package
selector is on vacation.

Maybe someone else from the team can review the patch?

Stano

Dňa Friday 22 August 2008 23:32:51 Roberto Mannai ste napísal:
Hi Stano

I believe zypp-devel is the proper mailing list for this.

Yes, thank you, they clared the question.

I append the patch, trying to resolve the enhancement in:
https://bugzilla.novell.com/show_bug.cgi?id=399239 - "YaST's software
installation modules should show disk space modification".

It adds the string " - Installing x MB" or " - Removing x MB" to the
tooltip on the "Free space" column (in the disk usage widget) .

The disk usage variation will work for the same packages that change
the disk usage bar; the zypp-devel mailing list pointed out that the
repositories with disk usage attribute are those soddisfying the
command:
dumpsolv /var/cache/zypp/solv/MYREPO/solv | grep diskusage


Here the patch, feel free to change (or throw away :)):


Index: qt/src/QY2DiskUsageList.cc
===================================================================
--- qt/src/QY2DiskUsageList.cc (revision 50308)
+++ qt/src/QY2DiskUsageList.cc (working copy)
@@ -229,9 +229,20 @@
if ( nameCol() >= 0 ) setText( nameCol(),
name() );
if ( deviceNameCol() >= 0 ) setText( deviceNameCol(),
deviceName() );
}
+

- if ( usedSizeCol() < 0 )
- setToolTip( freeSizeCol(), _( "Used %1" ).arg(
usedSize().form( 0, 1, true ).c_str() ) );
+ if ( usedSizeCol() < 0 ) {
+ QString message = _( "Used %1" ).arg( usedSize().form( 0, 1,
true ).c_str());
+
+ if(deltaSize() > 0){
+ message = message + _( " - Installing %1" ).arg(
deltaSize().form( 0, 1, true ).c_str() );
+
+ } else if(deltaSize() < 0){
+ message = message + _( " - Removing %1" ).arg(
deltaSize().form( 0, 1, true ).c_str() );
+
+ }
+ setToolTip( freeSizeCol(), message);
+ }
}


Index: qt/src/QY2DiskUsageList.h
===================================================================
--- qt/src/QY2DiskUsageList.h (revision 50308)
+++ qt/src/QY2DiskUsageList.h (working copy)
@@ -132,6 +132,13 @@
* is the default implementation.
**/
virtual FSize freeSize() const;
+
+ /**
+ * The delta partition space, after installation / removal.
+ * Derived classes may choose to reimplement this method.
+ * Default implementation returns 0.
+ **/
+ virtual FSize deltaSize() const { return 0; }

/**
* The currently used percentage ( 0..100 ) of this partition.
Index: qt-pkg/src/YQPkgDiskUsageList.cc
===================================================================
--- qt-pkg/src/YQPkgDiskUsageList.cc (revision 50323)
+++ qt-pkg/src/YQPkgDiskUsageList.cc (working copy)
@@ -114,9 +114,16 @@
const ZyppPartitionDu & partitionDu = *it;
YQPkgDiskUsageListItem * item = _items[
QString::fromUtf8(partitionDu.dir.c_str()) ];

- if ( item )
- item->updateDuData( partitionDu );
- else
+ if ( item ) {
+ int usedBefore = item->usedSize();
+ item->updateDuData( partitionDu );
+ int usedAfter = item->usedSize();
+ int usedDelta= usedAfter - usedBefore;
+ if (usedDelta != 0){
+ item->setDeltaSize(usedDelta);
+ }
+
+ } else
yuiError() << "No entry for mount point " << partitionDu.dir <<
endl;
}

@@ -258,6 +265,7 @@
, _partitionDu( partitionDu )
, _pkgDiskUsageList( parent )
{
+ _deltaSize = 0;
yuiDebug() << "disk usage list entry for " << partitionDu.dir << endl;
}

@@ -268,8 +276,20 @@
return FSize( _partitionDu.pkg_size, FSize::K );
}

+void
+YQPkgDiskUsageListItem::setDeltaSize(FSize aDelta)
+{
+ _deltaSize += aDelta;
+}

FSize
+YQPkgDiskUsageListItem::deltaSize() const
+{
+ return _deltaSize;
+}
+
+
+FSize
YQPkgDiskUsageListItem::totalSize() const
{
return FSize( _partitionDu.total_size, FSize::K );
Index: qt-pkg/src/YQPkgDiskUsageList.h
===================================================================
--- qt-pkg/src/YQPkgDiskUsageList.h (revision 50323)
+++ qt-pkg/src/YQPkgDiskUsageList.h (working copy)
@@ -234,6 +234,19 @@
* Reimplemented from QY2DiskUsageListItem.
**/
virtual FSize totalSize() const;
+
+ /**
+ * The delta partition space, after installation / removal.
+ *
+ * Reimplemented from QY2DiskUsageListItem.
+ **/
+ virtual FSize deltaSize() const;
+
+ /**
+ * Set delta partition space, after marking packages for
installation / removal.
+ *
+ **/
+ virtual void setDeltaSize(FSize aSize) ;

/**
* The name to display for this partition ( the mount point ).
@@ -263,6 +276,7 @@

ZyppPartitionDu _partitionDu;
YQPkgDiskUsageList * _pkgDiskUsageList;
+ FSize _deltaSize;
};



Best regards
Roberto Mannai


< Previous Next >