| Class | Ui::Qt4::DradisWindow |
| In: |
ui/qt/window.rb
|
| Parent: | Qt::MainWindow |
DradisWindow creates an interface window on top of MainWindow Qt elements. DradisWindow defines connections between the elements of the interface. It also defines a set of operations connected to the input and actions performed by the user.
MainWindow can be seen as the structure of the building while DradisWindow provides the funcionality to the different rooms and levels.
| controller | [W] |
Create the window, instantiate the widgets, connect signals and slots. Start the timer that will query the server for updates. The refresh period is defined in the config file.
# File ui/qt/window.rb, line 407
407: def initialize(parent=nil)
408: super #call Qt::Widget constructor
409: @base=Ui::Qt4::MainWindow.new
410: @base.setupUi self #this is where the widget construction happens
411:
412: @timer_updates = Qt::Timer.new( self )
413: connect( @timer_updates, SIGNAL( 'timeout()' ), SLOT( 'timeout_updates()' ) )
414:
415: connect @base.actionQuit, SIGNAL('triggered()'), $qApp, SLOT('quit()')
416: connect @base.commandLine, SIGNAL('returnPressed()'), self, SLOT('console_new_command()')
417:
418: connect @base.treeLeft, SIGNAL('itemClicked(QTreeWidgetItem*,int)'), self, SLOT('item_clicked(QTreeWidgetItem*,int)')
419: connect @base.textRight, SIGNAL('addNote(QString*, int)'), self, SLOT('add_note(QString*,int)')
420: connect @base.textRight, SIGNAL('editNote(QString*, int, int)'), self, SLOT('edit_note(QString*,int,int)')
421:
422: if Qt::SystemTrayIcon.isSystemTrayAvailable
423: connect(@base.trayIcon, SIGNAL('activated(QSystemTrayIcon::ActivationReason)'),
424: self, SLOT('iconActivated(QSystemTrayIcon::ActivationReason)'))
425: end
426:
427: @timer_updates.start( $config.get_option(:qt_refresh).to_i )
428: #@updateontick = false
429:
430: #TODO: @base.treeLeft.installEventFilter(self)
431: #@base.commandLine.installEventFilter(self)
432:
433: @base.treeLeft.setHeaderLabels(['hosts'])
434: @par = true
435: @last_commands = []
436: #@revision = 0
437:
438: end