Recent

Author Topic: Progress bar for zipper - how to do it?  (Read 2906 times)

abmservice

  • Jr. Member
  • **
  • Posts: 69
Progress bar for zipper - how to do it?
« on: May 26, 2018, 04:54:52 am »
Progress bar for zipper - how to do it?
I would like to make a progress bar for my application that will pack and unzip zip archives. I'm just starting z zipper, so I am asking for help and guidance.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Progress bar for zipper - how to do it?
« Reply #1 on: May 26, 2018, 08:56:30 am »
The Online Package Manager has progress indication for the zipper / unzipper. Please take alook.
It requires a zip unit from FPC trunk which is also copied to OPM sources temporarily.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14162
  • Probably until I exterminate Putin.
Re: Progress bar for zipper - how to do it?
« Reply #2 on: May 26, 2018, 10:03:13 am »
The algorithms are:
zip: establish the number of bytes to be zipped (progress max) by looking at all the file sizes. Then fire an event based on the buffer size.
unzip: look at the size of the zip archive (progress max). then fire an event from the unzip buffer.
In both cases the progress formula is totalsize(100%) * buffersprocessed div Buffersize. Add one for the last buffer (remainder) to reach 100%.
(multiply before the integer divide! and scale to percentage)
Specialize a type, not a var.

abmservice

  • Jr. Member
  • **
  • Posts: 69
Re: Progress bar for zipper - how to do it?
« Reply #3 on: May 26, 2018, 10:15:46 pm »
I will try. :)

 

TinyPortal © 2005-2018