Author: lslezak Date: Thu Aug 7 08:26:36 2008 New Revision: 49805 URL: http://svn.opensuse.org/viewcvs/yast?rev=49805&view=rev Log: - implemented manual change of the target architecture Modified: branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp branches/tmp/lslezak/product-creator-cross-arch/src/helps.ycp Modified: branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp?rev=49805&r1=49804&r2=49805&view=diff ============================================================================== --- branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp (original) +++ branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp Thu Aug 7 08:26:36 2008 @@ -426,36 +426,61 @@ return (symbol)ret; } -string AskArch(list<string> archs) +string AskArch(string label, list<string> archs, string preselected) { - term widget = `VBox(); + term widget1 = `VBox(); + term widget2 = `VBox(); - boolean preselect = true; + const integer max_lines = 6; + + if (!contains(archs, preselected)) + { + y2warning("The preselected architecture is missing in the list!"); + // add the missing preselected arch + archs = prepend(archs, preselected); + } + + integer archsz = size(archs); + integer col1num = (archsz > max_lines) ? archsz / 2 : archsz; + y2milestone("Number of archs in the first column: %1", col1num); // preselect the first item foreach(string a, archs, { - widget = add(widget, `MinWidth(25, `Left(`RadioButton(`id(a), a, preselect)))); - preselect = false; + if (col1num > 0) + { + widget1 = add(widget1, `MinWidth(10, `Left(`RadioButton(`id(a), a, a == preselected)))); + } + else + { + widget2 = add(widget2, `MinWidth(10, `Left(`RadioButton(`id(a), a, a == preselected)))); + } + + col1num = col1num - 1; } ); term content = `MarginBox(1, 0.5, `VBox( - `Label(sformat(_("The source does not support the target architecture (%1). -Change the target architecture? -"), ProductCreator::GetArch)), + `Label(label), `VSpacing(1), `Frame(_("Target Architecture"), `RadioButtonGroup(`id(`rb), - widget + `HBox( + widget1, + `HStretch(), + widget2, + `HStretch() + ) ) ), `VSpacing(1), `HBox( - `PushButton(`id(`change), _("Change Architecture")), - `HSpacing(1), - `PushButton(`id(`cancel), Label::CancelButton()) + `HSpacing(`opt(`hstretch), 2), + `HWeight(1, `PushButton(`id(`change), Label::OKButton())), + `HSpacing(2), + `HWeight(1, `PushButton(`id(`cancel), Label::CancelButton())), + `HSpacing(`opt(`hstretch), 2) ) ) ); @@ -538,7 +563,11 @@ } // the architecture is different, ask to switch - string new_arch = AskArch(found_archs); + string new_arch = AskArch( + sformat(_("The source does not support the current target architecture (%1). +Change the target architecture? +"), ProductCreator::GetArch()), + found_archs, found_archs[0]:""); // nil == switch has been canceled if (new_arch != nil) @@ -583,11 +612,12 @@ `VBox( `HBox( `ReplacePoint(`id(`rp), - `Label(sformat(_("Target Architecture: %1"), ProductCreator::GetArch())) + `Label(sformat(_("Target architecture: %1"), ProductCreator::GetArch())) ), - `HSpacing(1), - `PushButton(`id(`arch), _("Change...")) + `HSpacing(2), + `PushButton(`id(`arch), Label::EditButton()) ), + `VSpacing(0.3), `HBox( `PushButton(`id(`select), Label::SelectButton() ), `PushButton(`id(`remove), Label::RemoveButton() ), @@ -743,7 +773,24 @@ } else if (ret == `arch) { - // TODO FIXME: ask for the target architecture + // ask for the target architecture + string new_arch = AskArch( + _("Select the new target architecture."), + // sort the lilst according to the current locale + lsort(["i386", "sparc", "sparc64", "mips", "mips64", "ppc", "ppc64", "alpha", + "s390_32", "s390_64", "ia64", "x86_64"]), + ProductCreator::GetArch()); + + // nil == switch has been canceled + if (new_arch != nil && new_arch != "" && new_arch != ProductCreator::GetArch()) + { + // change the architecture + ProductCreator::SetArch(new_arch); + + UI::ReplaceWidget(`rp, + `Label(sformat(_("Target Architecture: %1"), ProductCreator::GetArch())) + ); + } } else { y2error("unexpected retcode: %1", ret); Modified: branches/tmp/lslezak/product-creator-cross-arch/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/product-creator-cross-arch/src/helps.ycp?rev=49805&r1=49804&r2=49805&view=diff ============================================================================== --- branches/tmp/lslezak/product-creator-cross-arch/src/helps.ycp (original) +++ branches/tmp/lslezak/product-creator-cross-arch/src/helps.ycp Thu Aug 7 08:26:36 2008 @@ -91,10 +91,18 @@ </p> "), - /* Configure2 dialog help 1/2 */ + /* Source selection help 1/2 */ "sourceDialog" : _("<p><b><big>Select Package Sources</big></b><br> Select at least one package source.<br></p> -"), +") + /* Source selection help 2/2 */ + + _("<p><b><big>Target Architecture</big></b><br> +It is possible to create a product for different architecture than the architecture of this machine. +All selected repositories must support the target architecture.<br> +<b>Note:</b> KIWI does not support different architectures yet, do not change the +architecture if you intend to create a KIWI image from the current configuration.</p> +") + , /* Configure2 dialog help 1/2 */ "dest" : _("<p><b><big>ISO Directory and Image</big></b><br> -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org