Class: Cosmos::PacketLogDialog

Inherits:
Qt::Dialog show all
Defined in:
lib/cosmos/gui/dialogs/packet_log_dialog.rb

Instance Method Summary collapse

Methods inherited from Qt::Dialog

#exec

Constructor Details

#initialize(parent, title, log_directory, packet_log_reader, initial_filenames = [], initial_output_filename = nil, show_output_filename = false, show_time = true, show_log_reader = true, input_filename_filter = Cosmos::BIN_FILE_PATTERN, output_filename_filter = Cosmos::BIN_FILE_PATTERN) ⇒ PacketLogDialog

Returns a new instance of PacketLogDialog.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 21

def initialize(parent,
               title,
               log_directory,
               packet_log_reader,
               initial_filenames = [],
               initial_output_filename = nil,
               show_output_filename = false,
               show_time = true,
               show_log_reader = true,
               input_filename_filter = Cosmos::BIN_FILE_PATTERN,
               output_filename_filter = Cosmos::BIN_FILE_PATTERN)
  # Call base class constructor
  super(parent)
  setWindowTitle(title)

  @layout = Qt::VBoxLayout.new

  # Create log frame
  @packet_log_frame = PacketLogFrame.new(self,
                                         log_directory,
                                         packet_log_reader,
                                         initial_filenames,
                                         initial_output_filename,
                                         show_output_filename,
                                         show_time,
                                         show_log_reader,
                                         input_filename_filter,
                                         output_filename_filter)
  @packet_log_frame.change_callback = method(:change_callback)
  @layout.addWidget(@packet_log_frame)

  # Separator before buttons
  @sep1 = Qt::Frame.new(self)
  @sep1.setFrameStyle(Qt::Frame::HLine | Qt::Frame::Sunken)
  @layout.addWidget(@sep1)

  # Create OK and Cancel buttons
  @button_layout = Qt::HBoxLayout.new
  @ok_button = Qt::PushButton.new('OK')
  @ok_button.connect(SIGNAL('clicked()')) { System.telemetry.reset; self.accept }
  @ok_button.setEnabled(false) if initial_filenames.empty?
  @button_layout.addWidget(@ok_button)
  @cancel_button = Qt::PushButton.new('Cancel')
  @cancel_button.connect(SIGNAL('clicked()')) { self.reject }
  @button_layout.addWidget(@cancel_button)

  @layout.addLayout(@button_layout)
  setLayout(@layout)
end

Instance Method Details

#filenamesObject

Returns the chosen filenames



72
73
74
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 72

def filenames
  @packet_log_frame.filenames
end

#output_filenameObject

Return the output filename



77
78
79
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 77

def output_filename
  @packet_log_frame.output_filename
end

#packet_log_readerObject

Return Log reader to use



102
103
104
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 102

def packet_log_reader
  @packet_log_frame.packet_log_reader
end

#time_endObject

Return End time of packets to process



92
93
94
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 92

def time_end
  @packet_log_frame.time_end
end

#time_end=(new_time_end) ⇒ Object

Set the end time



97
98
99
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 97

def time_end=(new_time_end)
  @packet_log_frame.time_end = new_time_end
end

#time_startObject

Return Start time of packets to process



82
83
84
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 82

def time_start
  @packet_log_frame.time_start
end

#time_start=(new_time_start) ⇒ Object

Set the start time



87
88
89
# File 'lib/cosmos/gui/dialogs/packet_log_dialog.rb', line 87

def time_start=(new_time_start)
  @packet_log_frame.time_start = new_time_start
end