From f2c8c14a83b973ed45c46cb17dcb395fa42276e1 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Fri, 3 Aug 2012 01:57:09 +0200 Subject: [PATCH] preferences: Minimal setup for preferences dialog. --- bin/qasim-gui.rb | 8 ++++++-- lib/qasim/ui.rb | 3 ++- lib/qasim/ui/preferences.rb | 12 ++++++++++++ lib/qasim/ui/preferences.ui | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 lib/qasim/ui/preferences.rb diff --git a/bin/qasim-gui.rb b/bin/qasim-gui.rb index 3c41814..4b5cb32 100755 --- a/bin/qasim-gui.rb +++ b/bin/qasim-gui.rb @@ -154,13 +154,16 @@ module Qasim act_pref = Qt::Action.new _('&Preferences'), @context_menu act_pref.setIcon( Qt::Icon::fromTheme("configure") ) rescue nil 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; act_about = Qt::Action.new '&About', @context_menu act_about.setIcon( Qt::Icon::fromTheme("help-about") ) rescue nil act_about.setIconVisibleInMenu true - act_about.setEnabled true + #act_about.setEnabled true act_about.connect(SIGNAL(:triggered)) do res = @about_dialog.show end @@ -189,6 +192,7 @@ module Qasim @main_win = Qt::MainWindow.new @systray = Qt::SystemTrayIcon.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" ) alt_icon = Qt::Icon.new diff --git a/lib/qasim/ui.rb b/lib/qasim/ui.rb index e0e110e..b431223 100644 --- a/lib/qasim/ui.rb +++ b/lib/qasim/ui.rb @@ -2,5 +2,6 @@ require 'qasim/constants' module Qasim ; module Ui - autoload :About, 'qasim/ui/about' + autoload :About, 'qasim/ui/about' + autoload :Preferences, 'qasim/ui/preferences' end ; end diff --git a/lib/qasim/ui/preferences.rb b/lib/qasim/ui/preferences.rb new file mode 100644 index 0000000..46e075a --- /dev/null +++ b/lib/qasim/ui/preferences.rb @@ -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 diff --git a/lib/qasim/ui/preferences.ui b/lib/qasim/ui/preferences.ui index a0c10f3..38dd421 100644 --- a/lib/qasim/ui/preferences.ui +++ b/lib/qasim/ui/preferences.ui @@ -1,6 +1,6 @@ - MapDialog + Preferences