Module: Yast::SoundUiInclude

Defined in:
../../src/include/sound/ui.rb

Instance Method Summary (collapse)

Instance Method Details

- (Yast::Term) AutoconfDlg(name, cname, cpos)

quick config dialog widget

Parameters:

  • name (String)

    card model

  • cname (String)

    alias for modules conf

  • cpos (Fixnum)

    position of the card

Returns:

  • (Yast::Term)

    with widget



48
49
50
51
52
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
# File '../../src/include/sound/ui.rb', line 48

def AutoconfDlg(name, cname, cpos)
  clab = ""
  if Ops.less_than(cpos, 3)
    clab = Ops.add(
      "\n",
      Builtins.sformat(
        Ops.get_string(Sound.STRINGS, ["soundCount", cpos], ""),
        cname
      )
    )
  else
    clab = Ops.add(
      "\n",
      Builtins.sformat(
        Ops.get_string(Sound.STRINGS, ["soundCount", 3], ""),
        cname,
        Ops.add(cpos, 1)
      )
    )
  end

  con = VBox(
    VSpacing(1),
    # this is the first part of message "The sound card 'cardname'
    # will be configured as the first snd card"
    Label(Opt(:hstretch), _("The sound card\n")),
    HBox(HSpacing(5), Label(Opt(:hstretch), name)),
    Label(Opt(:hstretch), clab),
    VSpacing(1),
    HBox(
      HSpacing(5),
      RadioButtonGroup(
        Id(:action),
        VBox(
          RadioButton(
            Id(:quick),
            Opt(:hstretch, :notify),
            # radio button label - type of setup
            _("&Quick automatic setup"),
            true
          ),
          VSpacing(0.3),
          RadioButton(
            Id(:normal),
            Opt(:hstretch, :notify),
            # radio button label - type of setup
            _("Normal &setup")
          ),
          VSpacing(0.3),
          RadioButton(
            Id(:options),
            Opt(:hstretch, :notify),
            # radio button label - type of setup
            _("Advanced setup with possibility to change &options")
          )
        )
      )
    ),
    VStretch()
  )
  deep_copy(con)
end

- (Hash) DisplayName(name, cname, cpos, flags)

DisplayName

Parameters:

  • name (String)

    card model

  • cname (String)

    sound card alias for modules conf

  • cpos (Fixnum)

    cards position

  • flags (Fixnum)

    enable/disable radiobuttons accordingly

Returns:

  • (Hash)

    symbol of next dialog



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File '../../src/include/sound/ui.rb', line 118

def DisplayName(name, cname, cpos, flags)
  helptext = Ops.get_string(Sound.STRINGS, "DisplayName", "")
  con = AutoconfDlg(name, cname, cpos)
  # dialog header
  Wizard.SetContents(
    _("Sound Card Configuration"),
    con,
    helptext,
    true,
    true
  )

  # dialog title
  flagc = 1
  flagp = 0
  selected = false
  flages = [:quick, :normal, :intro]

  while Ops.less_than(flagp, 3)
    if Ops.bitwise_and(flagc, flags) == 0
      UI.ChangeWidget(
        Id(Ops.get_symbol(flages, flagp, :quick)),
        :Enabled,
        false
      )
    else
      if !selected
        selected = true
        UI.ChangeWidget(
          Id(:action),
          :CurrentButton,
          Ops.get_symbol(flages, flagp, :quick)
        )
      end
    end
    flagp = Ops.add(flagp, 1)
    flagc = Ops.multiply(flagc, 2)
  end

  Wizard.RestoreNextButton

  input = :quick
  begin
    if input == :cancel || input == :abort
      return { "ui" => :abort } if ReallyAbort()
    end
    input = Convert.to_symbol(UI.UserInput)
  end while input != :next && input != :back

  output = input
  if input == :next
    output = Convert.to_symbol(UI.QueryWidget(Id(:action), :CurrentButton))
    output = :next if output == :normal
  end
  { "ui" => output }
end

- (Object) initialize_sound_ui(include_target)



19
20
21
22
23
24
25
26
# File '../../src/include/sound/ui.rb', line 19

def initialize_sound_ui(include_target)
  Yast.import "UI"
  textdomain "sound"
  Yast.import "Sound"
  Yast.import "Wizard"
  Yast.import "Popup"
  Yast.import "Label"
end

- (Boolean) ReallyAbort

dialog to be displayed when user presses 'Abort' button

Returns:

  • (Boolean)

    yes/no



30
31
32
33
34
35
36
37
38
39
40
41
# File '../../src/include/sound/ui.rb', line 30

def ReallyAbort
  config_changed = Sound.Changed
  Builtins.y2milestone(
    "Sound config changed: %1",
    config_changed
  )

  # no change, abort immediately
  return true if !config_changed

  Popup.ReallyAbort(config_changed)
end