Class: QTimetrap::TrackerControls::Component

Inherits:
Object
  • Object
show all
Defined in:
app/components/tracker_controls/component.rb

Overview

Contains main tracking controls, summary labels, and theme actions.

Constant Summary collapse

TIMER_FONT_MIN_PT =
12
TIMER_FONT_MAX_PT =
20
TIMER_CHAR_WIDTH_FACTOR =
0.72
TIMER_HORIZONTAL_PADDING =
12
TIMER_FIT_SAMPLE =
'000:00:00'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent:, callbacks:) ⇒ Component

Returns a new instance of Component.



15
16
17
# File 'app/components/tracker_controls/component.rb', line 15

def initialize(parent:, callbacks:)
  assign_ui(build_ui(parent:, callbacks:))
end

Instance Attribute Details

#clock_labelObject (readonly)

Returns the value of attribute clock_label.



13
14
15
# File 'app/components/tracker_controls/component.rb', line 13

def clock_label
  @clock_label
end

#project_inputObject (readonly)

Returns the value of attribute project_input.



13
14
15
# File 'app/components/tracker_controls/component.rb', line 13

def project_input
  @project_input
end

#task_inputObject (readonly)

Returns the value of attribute task_input.



13
14
15
# File 'app/components/tracker_controls/component.rb', line 13

def task_input
  @task_input
end

#timer_labelObject (readonly)

Returns the value of attribute timer_label.



13
14
15
# File 'app/components/tracker_controls/component.rb', line 13

def timer_label
  @timer_label
end

#widgetObject (readonly)

Returns the value of attribute widget.



13
14
15
# File 'app/components/tracker_controls/component.rb', line 13

def widget
  @widget
end

Instance Method Details

#update_action_button(running:) ⇒ Object



36
37
38
39
40
41
# File 'app/components/tracker_controls/component.rb', line 36

def update_action_button(running:)
  start_button.visible = !running
  stop_button.visible = running
  task_input.read_only = running
  project_input.read_only = running
end

#update_project_input(project_name) ⇒ Object



23
24
25
26
# File 'app/components/tracker_controls/component.rb', line 23

def update_project_input(project_name)
  value = project_name.to_s.strip
  project_input.text = value
end

#update_summary(text) ⇒ Object



19
20
21
# File 'app/components/tracker_controls/component.rb', line 19

def update_summary(text)
  summary_label.text = text
end

#update_task_input(text) ⇒ Object



28
29
30
# File 'app/components/tracker_controls/component.rb', line 28

def update_task_input(text)
  task_input.text = text.to_s
end

#update_theme_label(theme_name) ⇒ Object



32
33
34
# File 'app/components/tracker_controls/component.rb', line 32

def update_theme_label(theme_name)
  theme_button.text = "THEME: #{theme_name.upcase}"
end