| iPodDB documentation | Contained in the iPodDB distribution. |
iPodDB::Status - iPodDB Status bar
my $status = iPodDB::Status->new( $frame );
$status->songs( $songs );
$status->time( $time );
$status->size( $size );
This adds a status bar to the main iPodDB window. It keeps track of the number of songs, the total length of the songs and the total size on disk of the files.
Creates the status bar, with 3 columns (and one other for help text).
Clears the status bar to 0 for each column.
Gets / sets the songs column in the status bar.
Gets / sets the time column in the status bar. It should be passed in as thousands of seconds.
Gets / Sets the size column in the status bar. It should be passed in as bytes.
Copyright 2004 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| iPodDB documentation | Contained in the iPodDB distribution. |
package iPodDB::Status;
use base qw( Class::Accessor ); use strict; use warnings; use constant SONGS => 1; use constant TIME => 2; use constant SIZE => 3; __PACKAGE__->mk_accessors( qw( parent ) ); our $VERSION = '0.03'; my @columns = qw( songs time size );
sub new { my $class = shift; my $parent = shift; my $self = {}; $parent->CreateStatusBar( scalar @columns + 1 ); bless $self, $class; $self->parent( $parent ); $self->clear; return $self; }
sub clear { my $self = shift; $self->songs( 0 ); $self->time( 0 ); $self->size( 0 ); }
sub songs { my $self = shift; my $songs = shift; if( defined $songs ) { $self->parent->SetStatusText( "$songs songs", SONGS ) ; $self->{ _SONGS } = $songs; } return $self->{ _SONGS }; }
sub time { my $self = shift; my $time = shift; if( defined $time ) { $self->{ _TIME } = $time; $time = $time / 1000 / 60 / 60; $self->parent->SetStatusText( sprintf( '%.1f hours', $time ), TIME ) ; } return $self->{ _TIME }; }
sub size { my $self = shift; my $size = shift; if( defined $size ) { $self->{ _SIZE } = $size; $size = $size / 1024 / 1024; $self->parent->SetStatusText( sprintf( '%.1f MB', $size ), SIZE ) ; } return $self->{ _SIZE }; }
1;