[yast-commit] r66186 - /branches/tmp/lslezak/sound/sound/src/joy_dialog.ycp
Author: lslezak Date: Fri Sep 30 11:39:07 2011 New Revision: 66186 URL: http://svn.opensuse.org/viewcvs/yast?rev=66186&view=rev Log: jousticks - check for uncofigured sound cards with gameport when pressing [Add] Modified: branches/tmp/lslezak/sound/sound/src/joy_dialog.ycp Modified: branches/tmp/lslezak/sound/sound/src/joy_dialog.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/sound/sound/src/joy_dialog.ycp?rev=66186&r1=66185&r2=66186&view=diff ============================================================================== --- branches/tmp/lslezak/sound/sound/src/joy_dialog.ycp (original) +++ branches/tmp/lslezak/sound/sound/src/joy_dialog.ycp Fri Sep 30 11:39:07 2011 @@ -28,6 +28,8 @@ list joylist = []; + string usb_notice = _("USB joysticks do not need any configuration, just connect them."); + /** * Update the sound card configuration of joystick * @param start should joystick be used? @@ -751,10 +753,19 @@ UI::CloseDialog(); } + list unconfigured_sound_cards(list gameport_cards) + { + list ret = filter(map card, (list<map>) gameport_cards, { + return Joystick::joystick[ card["card_no"]:0, "model" ]:"" == ""; + }); + + y2milestone("Unconfigured gameport cards: %1", ret); + return ret; + } integer select_sound_card(list gameport_cards) { - list tcont = maplist (map card, (list<map>) gameport_cards, ``{ + list tcont = maplist (map card, (list<map>) gameport_cards, { map jconf = Joystick::joystick[ card["card_no"]:0 ]:$[]; string jmodel = jconf["model"]:""; @@ -849,31 +860,39 @@ if (ret == `add) { list jcards = Sound::GetSoundCardListWithJoy(); + y2milestone("Sound cards with gameport: %1", jcards); // no sound card with gameport if (size(jcards) == 0) { string message = _("There is no soundcard with joystick support (gameport).") - + "\n" + _("USB joysticks do not need any configuration, just plug them."); + + "\n" + usb_notice; Popup::Message(message); } else { - integer selected = nil; + // remove configured cards with joystick + list unconfigured = unconfigured_sound_cards(jcards); + y2milestone("Gamport sound cards without joystick: %1", unconfigured); - if (size(jcards) == 1) + if (size(unconfigured) == 0) { - selected = jcards[0, "card_no"]:0; + string message = _("There is no soundcard with unconfigured joystick.") + + "\n" + usb_notice; + + Popup::Message(message); } else { - selected = select_sound_card(jcards); - } + // if there is just one card just use it otherwise ask user + integer selected = (size(unconfigured) == 1) ? unconfigured[0, "card_no"]:0 : select_sound_card(unconfigured); - if (selected != nil) - { - joy_dialog(selected, `ok); + // selection canceled? + if (selected != nil) + { + joy_dialog(selected, `ok); + } } } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn2.opensuse.org