Fix configuration crashes

This commit is contained in:
Craig Everett 2025-06-12 18:04:36 +09:00
parent e86a130180
commit 002196059e
7 changed files with 15 additions and 10 deletions

View File

@ -3,6 +3,6 @@
{registered,[]},
{included_applications,[]},
{applications,[stdlib,kernel]},
{vsn,"0.2.1"},
{vsn,"0.2.2"},
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
{mod,{gajumine,[]}}]}.

View File

@ -3,7 +3,7 @@
%%% @end
-module(gajumine).
-vsn("0.2.1").
-vsn("0.2.2").
-behavior(application).
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").

View File

@ -3,7 +3,7 @@
%%% @end
-module(gmc_con).
-vsn("0.2.1").
-vsn("0.2.2").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -3,7 +3,7 @@
%%% @end
-module(gmc_conf).
-vsn("0.2.1").
-vsn("0.2.2").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later").
@ -51,7 +51,6 @@ trouble(Info) ->
start_link(Prefs) ->
wx_object:start_link({local, ?MODULE}, ?MODULE, Prefs, []).
init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
ok = log(info, "GUI starting..."),
Lang = maps:get(lang, Prefs, en_US),
@ -70,8 +69,8 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
KeysTx = wxTextCtrl:new(Frame, ?wxID_ANY, [{style, ?wxTE_MULTILINE}, {value, keys(Keys)}]),
_ = wxStaticBoxSizer:add(KeysSz, KeysTx, wide(5)),
StatSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("Max System Committment (optional)")}]),
AProcsS = integer_to_list(AProcs),
MProcsS = integer_to_list(MProcs),
AProcsS = i_to_l(AProcs),
MProcsS = i_to_l(MProcs),
AMemS = gigs(AMem),
MMemS = gigs(MMem),
Labels = [{J("HW Cores"), J("Max Cores"), AProcsS, MProcsS}, {J("Memory (GB)"), J("Max Memory"), AMemS, MMemS}],
@ -105,12 +104,18 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
{Frame, State}.
i_to_l(none) -> "0";
i_to_l(N) when is_integer(N) -> integer_to_list(N).
base(Padding) -> [{proportion, 0}, {flag, ?wxEXPAND bor ?wxALL}, {border, Padding}].
wide(Padding) -> [{proportion, 1}, {flag, ?wxEXPAND bor ?wxALL}, {border, Padding}].
center() -> [{proportion, 0}, {flag, ?wxEXPAND bor ?wxALIGN_CENTER_VERTICAL}].
gigs(none) ->
"0";
gigs(Bytes) ->
float_to_list(Bytes / gig(), [{decimals, 2}, compact]).

View File

@ -3,7 +3,7 @@
%%% @end
-module(gmc_gui).
-vsn("0.2.1").
-vsn("0.2.2").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -12,7 +12,7 @@
%%% @end
-module(gmc_sup).
-vsn("0.2.1").
-vsn("0.2.2").
-behaviour(supervisor).
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").

View File

@ -4,7 +4,7 @@
{prefix,"gmc"}.
{author,"Craig Everett"}.
{desc,"Mining client for the Gajumaru Root"}.
{package_id,{"qpq","gajumine",{0,2,1}}}.
{package_id,{"qpq","gajumine",{0,2,2}}}.
{deps,[{"uwiger","gmcuckoo",{1,2,3}},
{"uwiger","gmhive_client",{0,4,3}},
{"qpq","cuckoo_cpu",{0,3,0}},