require "qt2"
include Qt2
require "dclock_lib.rb"

class QApplication
def initialize arg
   @firsttime = true
   @timer = startTimer(500)
   catchEvent
end
def timerEvent(e)
        Thread.pass
end
end

a = QApplication.new([$0]+ARGV)
w = QWidget.new
v = QVBoxLayout.new(w)
w.resize(100,60)
clock = DigitalClock.new(8,w)
v.addWidget(clock)
l = QLabel.new("memo:",w)
v.addWidget(l)
a.setMainWidget(clock)
clock.show()
w.show()

th = Thread.start {
   a.exec()
}
print "Please enter memo text or quit for quit program.\n"
while("quit" != (line = gets).chop!)
   print "memo = \"#{line}\"\n"
   res = eval("l.setText(QString::fromLocal8Bit(\"#{line}\"))")
   print res,"\n"
end
