Class: Watobo::Gui::PreferencesDialog_UNUSED

Inherits:
FXDialogBox
  • Object
show all
Includes:
Responder
Defined in:
lib/watobo/gui/preferences_dialog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, settings) ⇒ PreferencesDialog_UNUSED

Returns a new instance of PreferencesDialog_UNUSED.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/watobo/gui/preferences_dialog.rb', line 53

def initialize(owner, settings)
  super(owner, "Preferences", :opts => DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE)
  
   FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
   
  @settings = Hash.new
  @settings.update(settings)
  
  @advancedFrame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
  
  gbox_frame = FXGroupBox.new(@advancedFrame, "Scan Options ", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
  gbox = FXVerticalFrame.new(gbox_frame, :opts => LAYOUT_SIDE_TOP|PACK_UNIFORM_WIDTH)
  frame = FXHorizontalFrame.new(gbox, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_RIGHT)
  FXLabel.new(frame, "Max. Par. Request:")
  @max_par_checks_dt = FXDataTarget.new(0)
  @max_par_checks_dt.value = @settings[:max_parallel_checks]
  @max_par_checks = FXTextField.new(frame, 3, @max_par_checks_dt, FXDataTarget::ID_VALUE, :opts => JUSTIFY_RIGHT|FRAME_GROOVE|FRAME_SUNKEN)
  
  
  @enable_smart_scan = FXCheckButton.new(gbox, "Enable Smart Scan ", nil, 0, JUSTIFY_RIGHT|JUSTIFY_TOP|ICON_AFTER_TEXT|LAYOUT_SIDE_RIGHT)
  @enable_smart_scan.checkState = @settings[:smart_scan]
  
 #-------------------------- Forwarding Proxy ---------------------------------#
#  gbox = FXGroupBox.new(@advancedFrame, "Forwarding Proxy",LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
#  frame = FXHorizontalFrame.new(gbox, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_RIGHT)
#  FXLabel.new(frame, "Current: ")
#  @forwarding_proxy_dt = FXDataTarget.new('')
#  @forwarding_proxy = FXTextField.new(frame, 20, @forwarding_proxy_dt, FXDataTarget::ID_VALUE, :opts => LAYOUT_FILL_X|FRAME_GROOVE|FRAME_SUNKEN)
  
#  @forwarding_proxy_dt.value = @settings[:proxy]
#  button = FXButton.new(frame, "View/Edit" ,  nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)  
#  button.enable
#  button.connect(SEL_COMMAND, method(:startProxyDialog))
 
  #-------------------------- Interceptor ---------------------------------#
#  gbox = FXGroupBox.new(@advancedFrame, "Interceptor",LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
#  frame = FXHorizontalFrame.new(gbox, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_RIGHT)
#  FXLabel.new(frame, "Listener Port: ")
#  @intercept_port_dt = FXDataTarget.new(@settings[:intercept_port])
#  @intercept_port = FXTextField.new(frame, 0, @intercept_port_dt, FXDataTarget::ID_VALUE, :opts => LAYOUT_FILL_X|FRAME_GROOVE|FRAME_SUNKEN)
 
  
  buttons_frame = FXHorizontalFrame.new(@advancedFrame, :opts => LAYOUT_FILL_X)
  
    @cancelButton = FXButton.new(buttons_frame, "Accept" ,
  :target => self, :selector => FXDialogBox::ID_ACCEPT,
  :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
  
  @cancelButton = FXButton.new(buttons_frame, "Cancel" ,
  :target => self, :selector => FXDialogBox::ID_CANCEL,
  :opts => BUTTON_NORMAL|LAYOUT_RIGHT)  
  
  @max_par_checks.handle(self, FXSEL(SEL_UPDATE, 0), nil)
 # @forwarding_proxy.handle(self, FXSEL(SEL_UPDATE, 0), nil)
 # @intercept_port.handle(self, FXSEL(SEL_UPDATE, 0), nil)
 
  
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



27
28
29
# File 'lib/watobo/gui/preferences_dialog.rb', line 27

def settings
  @settings
end

Instance Method Details

#onAccept(sender, sel, event) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/watobo/gui/preferences_dialog.rb', line 32

def onAccept(sender, sel, event)
    @settings[:enable_smart_scan] = @enable_smart_scan.checked?
    @settings[:max_parallel_checks] = @max_par_checks_dt.value
    @settings[:intercept_port] = @intercept_port_dt.value

    getApp().stopModal(self, 1)
    self.hide()
    return 1

end

#startProxyDialog(sender, sel, ptr) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/watobo/gui/preferences_dialog.rb', line 43

def startProxyDialog(sender, sel, ptr)
   proxy_dialog = Watobo::Gui::ProxyDialog.new(self, @settings[:proxy], @settings[:proxy_list])
  if proxy_dialog.execute != 0 then
    @settings[:proxy_list] = proxy_dialog.getProxyList
    @settings[:proxy] = proxy_dialog.proxy
    @forwarding_proxy_dt.value = @settings[:proxy]
    @forwarding_proxy.handle(self, FXSEL(SEL_UPDATE, 0), nil)
  end
end