sshfs-mapper: qt-mapper now has menu icons.

git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1686 eaee96b3-f302-0410-b096-c6cfd47f7835
This commit is contained in:
Glenn Y. Rolland 2011-07-19 14:56:21 +00:00
parent e062cb81bf
commit 4af59316c5

View file

@ -2,6 +2,10 @@
require 'Qt4' require 'Qt4'
def _ str
Qt::Object.tr(str)
end
app = Qt::Application.new(ARGV) app = Qt::Application.new(ARGV)
si = Qt::SystemTrayIcon.new si = Qt::SystemTrayIcon.new
@ -22,7 +26,7 @@ end
menu = Qt::Menu.new menu = Qt::Menu.new
['Diades', 'Daneel', 'Dolos'].each do |name| ['Diades', 'Daneel', 'Dolos'].each do |name|
itemx = Qt::Action.new('Diades', menu) itemx = Qt::Action.new(name, menu)
itemx.setCheckable true; itemx.setCheckable true;
itemx.connect(SIGNAL(:triggered)) { puts itemx.checked } itemx.connect(SIGNAL(:triggered)) { puts itemx.checked }
menu.addAction itemx; menu.addAction itemx;
@ -30,15 +34,21 @@ end
menu.addSeparator menu.addSeparator
act_pref = Qt::Action.new '&Preferences', menu act_pref = Qt::Action.new _('&Preferences'), menu
act_pref.setIcon( Qt::Icon::fromTheme("configure") )
act_pref.setIconVisibleInMenu true
menu.addAction act_pref; menu.addAction act_pref;
act_about = Qt::Action.new '&About', menu act_about = Qt::Action.new '&About', menu
act_about.setIcon( Qt::Icon::fromTheme("help-about") )
act_about.setIconVisibleInMenu true
menu.addAction act_about; menu.addAction act_about;
menu.addSeparator menu.addSeparator
act_quit = Qt::Action.new '&Quit', menu act_quit = Qt::Action.new _('Quit'), menu
act_quit.setIcon( Qt::Icon::fromTheme("application-exit") )
act_quit.setIconVisibleInMenu true
act_quit.connect(SIGNAL(:triggered)) { app.quit } act_quit.connect(SIGNAL(:triggered)) { app.quit }
menu.addAction act_quit menu.addAction act_quit