From b2af005db21bd8fd068cb79b2ae700953128af2c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 1 Jan 2012 18:29:30 -0600 Subject: Move PerlQt --- PerlQt/examples/dclock/DigitalClock.pm | 88 ---------------------------------- PerlQt/examples/dclock/dclock.pl | 12 ----- 2 files changed, 100 deletions(-) delete mode 100644 PerlQt/examples/dclock/DigitalClock.pm delete mode 100644 PerlQt/examples/dclock/dclock.pl (limited to 'PerlQt/examples/dclock') diff --git a/PerlQt/examples/dclock/DigitalClock.pm b/PerlQt/examples/dclock/DigitalClock.pm deleted file mode 100644 index 2d25428..0000000 --- a/PerlQt/examples/dclock/DigitalClock.pm +++ /dev/null @@ -1,88 +0,0 @@ -package DigitalClock; -use strict; -use TQt; -use TQt::isa qw(TQt::LCDNumber); -use TQt::slots - stopDate => [], - showTime => []; -use TQt::attributes qw( - showingColon - normalTimer - showDateTimer -); - -# -# Constructs a DigitalClock widget -# - -sub NEW { - shift->SUPER::NEW(@_); - showingColon = 0; - setFrameStyle(&Panel | &Raised); - setLineWidth(2); - showTime(); - normalTimer = startTimer(500); - showDateTimer = -1; -} - -# -# Handles timer events and the digital clock widget. -# There are two different timers; one timer for updating the clock -# and another one for switching back from date mode to time mode -# - -sub timerEvent { - my $e = shift; - if($e->timerId == showDateTimer) { # stop showing date - stopDate(); - } elsif(showDateTimer == -1) { # normal timer - showTime(); - } -} - -# -# Enters date mode when the left mouse button is pressed -# - -sub mousePressEvent { - my $e = shift; - showDate() if $e->button == &LeftButton; -} - -# -# Shows the durrent date in the internal lcd widget. -# Fires a timer to stop showing the date. -# - -sub showDate { - return if showDateTimer != -1; # already showing date - my $date = TQt::Date::currentDate(); - my $s = sprintf("%2d %2d", $date->month, $date->day); - display($s); # sets the LCD number/text - showDateTimer = startTimer(2000); # keep this state for 2 secs -} - -# -# Stops showing the date. -# - -sub stopDate { - killTimer(showDateTimer); - showDateTimer = -1; - showTime(); -} - -# -# Shows the current time in the internal lcd widget. -# - -sub showTime { - showingColon = !showingColon; - my $s = substr(TQt::Time::currentTime()->toString, 0, 5); - $s =~ s/^0/ /; - $s =~ s/:/ / unless showingColon; - display($s); -} - -1; - diff --git a/PerlQt/examples/dclock/dclock.pl b/PerlQt/examples/dclock/dclock.pl deleted file mode 100644 index 57c02bd..0000000 --- a/PerlQt/examples/dclock/dclock.pl +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl -w -use strict; -use TQt; -use DigitalClock; - -my $a = TQt::Application(\@ARGV); -my $clock = DigitalClock; -$clock->resize(170, 80); -$a->setMainWidget($clock); -$clock->setCaption("PerlTQt Example - Digital Clock"); -$clock->show; -exit $a->exec; -- cgit v1.2.3