File: passivepopup.rb

package info (click to toggle)
qtruby 4%3A4.11.3-4.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,552 kB
  • ctags: 5,498
  • sloc: ruby: 24,603; cpp: 23,018; makefile: 65; sh: 20
file content (38 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env ruby

require 'Qt'
 
class PassiveWindow < Qt::Frame
	MARGIN = 20
	
    def initialize(message)
        super(nil, Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint |
                   Qt::Tool | Qt::FramelessWindowHint)
        setFrameStyle(Qt::Frame::Box| Qt::Frame::Plain)
        setLineWidth(2)

        setMinimumWidth(100)
        layout = Qt::VBoxLayout.new(self) do |l|
            l.spacing = 11
            l.margin = 6
        end
        Qt::Label.new(message, self)

        quit=Qt::PushButton.new(tr("Close"), self)
        connect(quit, SIGNAL("clicked()"), SLOT("close()"))
	end

    def show
        super
        move(Qt::Application.desktop().width() - width() - MARGIN,
            Qt::Application.desktop().height() - height() - MARGIN)
	end
end
  	
if (Process.fork != nil)
	exit
end
app = Qt::Application.new(ARGV)
win = PassiveWindow.new(ARGV[0])
win.show
app.exec