1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 require 'constrained_text_item'
13 def set_geometry(rect)
14 @rect = Qt::RectF.new(rect)
15 self.pos = @rect.top_left
19 def create_display_items
21 :time => ConstrainedTextItem.new(OFF_TEXT, self),
22 :player => ConstrainedTextItem.new('', self),
23 :caption => ConstrainedTextItem.new('', self)
31 # save 'started' state for when the clock is added
38 # cancel possible 'started' state
54 @caption = translate[d[:color]]
55 @player = d[:player] || KDE::i18n('(unknown)')
57 items[:caption].text = @caption
58 items[:player].text = @player
63 @clock.delete_observer(self)
68 # start the clock if the display was in the 'started'
69 # state before the clock was added
70 @clock.start if @started
73 clock.add_observer(self)
78 min = data[:main] / 60
79 sec = data[:main] % 60
81 @items[:time].text = "%02d:%02d" % [min, sec]