Module: Yast::SoundCardWizardInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) _options(card_id)

wrapper function for running Options dialog (during expert configuration)



51
52
53
54
55
56
57
58
59
# File '../../src/include/sound/card_wizard.rb', line 51

def _options(card_id)
  res = sound_options(Sound.save_entry)
  ui = Ops.get_symbol(res, "ui", :back)
  if ui == :next
    Sound.save_entry = Ops.get_map(res, "return", {})
    Sound.save_entry = add_common_options(Sound.save_entry, card_id)
  end
  ui
end

- (Object) _quick(card_id, finish, save_info)

wrapper function for quick configuration (just modprobe)



62
63
64
65
66
67
# File '../../src/include/sound/card_wizard.rb', line 62

def _quick(card_id, finish, save_info)
  save_info = deep_copy(save_info)
  res = sound_volume(Sound.save_entry, card_id, finish, true, save_info)
  ui = Ops.get_symbol(res, "ui", :back)
  ui
end

- (Object) _showName(card_id, flags)

wrapper function for running first card config dialog (There will be shown possibilities for next configuration steps (quick/normal/expert)



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File '../../src/include/sound/card_wizard.rb', line 32

def _showName(card_id, flags)
  modelname = Ops.get_string(Sound.save_entry, "model", "")
  modname = Ops.get_string(Sound.save_entry, "module", "")

  res = DisplayName(
    modelname,
    Ops.get_string(Sound.save_entry, "alias", ""),
    card_id,
    flags
  )

  ui = Ops.get_symbol(res, "ui", :back)

  Thinkpad600E_cs4236_hack(card_id) if ui != :back && ui != :abort

  ui
end

- (Object) _volume(card_id, finish, save_info)

wrapper function for normal configuration (modprobe + volume setting)



70
71
72
73
74
75
# File '../../src/include/sound/card_wizard.rb', line 70

def _volume(card_id, finish, save_info)
  save_info = deep_copy(save_info)
  res = sound_volume(Sound.save_entry, card_id, finish, false, save_info)
  ui = Ops.get_symbol(res, "ui", :back)
  ui
end

- (Object) initialize_sound_card_wizard(include_target)



17
18
19
20
21
22
23
24
25
26
27
28
# File '../../src/include/sound/card_wizard.rb', line 17

def initialize_sound_card_wizard(include_target)
  Yast.import "UI"

  Yast.import "Sequencer"
  Yast.import "Sound"


  Yast.include include_target, "sound/ui.rb"
  Yast.include include_target, "sound/options.rb"
  Yast.include include_target, "sound/volume.rb"
  Yast.include include_target, "sound/routines.rb" # add_common_options, add_alias
end

- (Hash) OneCardWizard(card_entry, card_id, flags, finish, save_info)

Wizard steps: 1. displayname
2. modprobe and volume settings

Parameters:

  • card_entry (Hash)

    the card to configure

  • card_id (Fixnum)

    index of configured car

  • flags (Fixnum)

    defines which radioboxes has to be enabled (0x1 - first, 0x2 second, 0x4 third...)

  • finish (Boolean)

    true if no complex dialog is to be called (then the popup "Config will be saved.." will appear)

Returns:

  • (Hash)

    with save info, as required by sound_write for one cards



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File '../../src/include/sound/card_wizard.rb', line 87

def OneCardWizard(card_entry, card_id, flags, finish, save_info)
  card_entry = deep_copy(card_entry)
  save_info = deep_copy(save_info)
  aliases = {
    "name"      => lambda { _showName(card_id, flags) },
    "options"   => lambda { _options(card_id) },
    "volume"    => lambda { _volume(card_id, finish, save_info) },
    "optVolume" => lambda { _volume(card_id, finish, save_info) },
    "quick"     => lambda { _quick(card_id, finish, save_info) }
  }

  sequence = {
    "ws_start"  => "name",
    "name"      => {
      :quick   => "quick",
      :skip    => :back,
      :next    => "volume",
      :options => "options",
      :abort   => :abort
    },
    "options"   => { :next => "optVolume", :abort => :abort },
    "volume"    => { :next => :next, :abort => :abort },
    "optVolume" => { :next => :next, :abort => :abort },
    "quick"     => { :next => :next, :abort => :abort }
  }
  Sound.save_entry = Builtins.eval(card_entry)
  Sound.save_entry = add_common_options(Sound.save_entry, card_id)
  Sound.save_entry = add_alias(Sound.save_entry, card_id)

  ui = Sequencer.Run(aliases, sequence)
  { "ui" => ui, "return" => Sound.save_entry }
end