From 753aa216d69564d0fa39b867b98ea78cd08e316b Mon Sep 17 00:00:00 2001 From: glenux Date: Tue, 19 Jul 2011 14:56:21 +0000 Subject: [PATCH] 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 --- qt-mapper/qtsshfsmapper.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/qt-mapper/qtsshfsmapper.rb b/qt-mapper/qtsshfsmapper.rb index ff58293..1c91b85 100755 --- a/qt-mapper/qtsshfsmapper.rb +++ b/qt-mapper/qtsshfsmapper.rb @@ -2,6 +2,10 @@ require 'Qt4' +def _ str + Qt::Object.tr(str) +end + app = Qt::Application.new(ARGV) si = Qt::SystemTrayIcon.new @@ -22,7 +26,7 @@ end menu = Qt::Menu.new ['Diades', 'Daneel', 'Dolos'].each do |name| - itemx = Qt::Action.new('Diades', menu) + itemx = Qt::Action.new(name, menu) itemx.setCheckable true; itemx.connect(SIGNAL(:triggered)) { puts itemx.checked } menu.addAction itemx; @@ -30,15 +34,21 @@ end 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; act_about = Qt::Action.new '&About', menu +act_about.setIcon( Qt::Icon::fromTheme("help-about") ) +act_about.setIconVisibleInMenu true menu.addAction act_about; 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 } menu.addAction act_quit