preferences: Minimal setup for preferences dialog.

This commit is contained in:
Glenn Y. Rolland 2012-08-03 01:57:09 +02:00
parent 07c1ad7579
commit f2c8c14a83
4 changed files with 21 additions and 4 deletions

View file

@ -154,13 +154,16 @@ module Qasim
act_pref = Qt::Action.new _('&Preferences'), @context_menu act_pref = Qt::Action.new _('&Preferences'), @context_menu
act_pref.setIcon( Qt::Icon::fromTheme("configure") ) rescue nil act_pref.setIcon( Qt::Icon::fromTheme("configure") ) rescue nil
act_pref.setIconVisibleInMenu true act_pref.setIconVisibleInMenu true
act_pref.setEnabled false #act_pref.setEnabled true
act_pref.connect(SIGNAL(:triggered)) do
res = @pref_dialog.show
end
@context_menu.addAction act_pref; @context_menu.addAction act_pref;
act_about = Qt::Action.new '&About', @context_menu act_about = Qt::Action.new '&About', @context_menu
act_about.setIcon( Qt::Icon::fromTheme("help-about") ) rescue nil act_about.setIcon( Qt::Icon::fromTheme("help-about") ) rescue nil
act_about.setIconVisibleInMenu true act_about.setIconVisibleInMenu true
act_about.setEnabled true #act_about.setEnabled true
act_about.connect(SIGNAL(:triggered)) do act_about.connect(SIGNAL(:triggered)) do
res = @about_dialog.show res = @about_dialog.show
end end
@ -189,6 +192,7 @@ module Qasim
@main_win = Qt::MainWindow.new @main_win = Qt::MainWindow.new
@systray = Qt::SystemTrayIcon.new @main_win @systray = Qt::SystemTrayIcon.new @main_win
@about_dialog = Qasim::Ui::About.new @main_win @about_dialog = Qasim::Ui::About.new @main_win
@pref_dialog = Qasim::Ui::Preferences.new @main_win
std_icon = Qt::Icon.new( ":/qasim/qasim-icon" ) std_icon = Qt::Icon.new( ":/qasim/qasim-icon" )
alt_icon = Qt::Icon.new alt_icon = Qt::Icon.new

View file

@ -3,4 +3,5 @@ require 'qasim/constants'
module Qasim ; module Ui module Qasim ; module Ui
autoload :About, 'qasim/ui/about' autoload :About, 'qasim/ui/about'
autoload :Preferences, 'qasim/ui/preferences'
end ; end end ; end

View file

@ -0,0 +1,12 @@
require 'qasim/ui/preferences_ui'
module Qasim ; module Ui
class Preferences < Qt::Dialog
def initialize(parent = nil)
super
@ui = Ui_Preferences.new
@ui.setup_ui(self)
end
end
end ; end

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MapDialog</class> <class>Preferences</class>
<widget class="QDialog" name="MapDialog"> <widget class="QDialog" name="MapDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>