Class: LogFileSelector

Inherits:
LogFileSelectorDlg show all
Defined in:
lib/LogFileSelector.rb

Instance Attribute Summary

Attributes inherited from LogFileSelectorDlg

#cancelBtn, #fileList, #monitorBtn, #otherLogBtn, #textLabel1

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil, name = nil) ⇒ LogFileSelector

Returns a new instance of LogFileSelector.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/LogFileSelector.rb', line 20

def initialize(parent = nil, name = nil)
  super(parent, name)

  @fileListCSLV = CSListView.new(@fileList)
  @fileList.setSorting(1, true)

  addLogsToList

  connect(@fileList, SIGNAL('selectionChanged(QListViewItem*)'),
      SLOT('selectionChanged(QListViewItem*)'))
  connect(@fileList, SIGNAL('clicked(QListViewItem*)'),
      SLOT('clicked(QListViewItem*)'))

  show
end

Instance Method Details

#addLogsToListObject



36
37
38
39
40
41
42
# File 'lib/LogFileSelector.rb', line 36

def addLogsToList
  @fileListCSLV.startUpdate
  $globals.serverLogFiles.each do |slf|
    @fileListCSLV.insertItem(slf, slf.name, slf.logFile)
  end
  @fileListCSLV.finishUpdate
end

#clicked(item) ⇒ Object



52
53
54
# File 'lib/LogFileSelector.rb', line 52

def clicked(item)
  @monitorBtn.setEnabled(false) unless item
end

#otherLogBtnClickedObject



56
57
58
59
60
61
62
# File 'lib/LogFileSelector.rb', line 56

def otherLogBtnClicked
  settings = GSServerLogSettings.new
  if ServerLogSettings.new(settings, self).exec() == Qt::Dialog.Accepted
    $globals.addServerLogFile(settings)
    addLogsToList
  end
end

#selectedLogFileObject



44
45
46
# File 'lib/LogFileSelector.rb', line 44

def selectedLogFile
  @fileListCSLV.selectedItemList[0]
end

#selectionChanged(item) ⇒ Object



48
49
50
# File 'lib/LogFileSelector.rb', line 48

def selectionChanged(item)
  @monitorBtn.setEnabled(item != nil)
end