diff --git a/ebin/gajumine.app b/ebin/gajumine.app index 7915aa9..5c1e5b6 100644 --- a/ebin/gajumine.app +++ b/ebin/gajumine.app @@ -3,6 +3,6 @@ {registered,[]}, {included_applications,[]}, {applications,[stdlib,kernel]}, - {vsn,"0.3.6"}, + {vsn,"0.4.0"}, {modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]}, {mod,{gajumine,[]}}]}. diff --git a/src/gajumine.erl b/src/gajumine.erl index 911a222..08aaf06 100644 --- a/src/gajumine.erl +++ b/src/gajumine.erl @@ -3,7 +3,7 @@ %%% @end -module(gajumine). --vsn("0.3.6"). +-vsn("0.4.0"). -behavior(application). -author("Craig Everett "). -copyright("QPQ AG "). diff --git a/src/gmc_con.erl b/src/gmc_con.erl index c99fb0d..9e7d5e8 100644 --- a/src/gmc_con.erl +++ b/src/gmc_con.erl @@ -3,7 +3,7 @@ %%% @end -module(gmc_con). --vsn("0.3.6"). +-vsn("0.4.0"). -author("Craig Everett "). -copyright("QPQ AG "). -license("GPL-3.0-or-later"). @@ -204,10 +204,7 @@ terminate(Reason, State) -> do_stop() -> - case is_pid(whereis(gd_con)) of - false -> zx:stop(); - true -> application:stop(gajumine) - end. + zx:stop(). %%% Doers @@ -251,7 +248,7 @@ do_start_stop(#s{acc = PubKey, keys = Keys, network = Network, max_cores = MaxCo ok = gmc_gui:message({notice, "Starting..."}), ok = gmc_gui:message({notice, ["Miner: ", Miner]}), {ok, Apps} = gmhc_app:start(Profile), - Started = io_lib:format("Apps started: ~p", [Apps]), + Started = io_lib:format("Apps started:~n ~p", [Apps]), ok = log(info, Started), ok = gmc_gui:message({notice, Started}), Events = @@ -344,23 +341,10 @@ win_mem() -> do_gajudesk() -> - ok = tell(info, "Running gajudesk"), - PID = spawn(fun run_gajudesk/0), - tell(info, "GajuDesk launched at PID: ~p", [PID]). - -run_gajudesk() -> - R = "otpr", - N = "gajudesk", - {ok, V} = zx:latest({R, N}), - {ok, PackageString} = zx_lib:package_string({R, N, V}), - try - case zx:run(PackageString, []) of - ok -> ok; - Error -> tell(error, "gajudesk died with: ~p", [Error]) - end - catch - E:R -> tell(error, "gajudesk died with: ~p", [{E, R}]) - end. + ok = log(info, "Running gajudesk"), + Command = "zx run gajudesk", + Out = os:cmd(Command), + log(info, "os:cmd(~w) -> ~w", [Command, Out]). run_gmc_conf(State = #s{gmc_conf = none, network = Net, acc = Acc, keys = Keys, diff --git a/src/gmc_conf.erl b/src/gmc_conf.erl index c5d1a12..b092ca6 100644 --- a/src/gmc_conf.erl +++ b/src/gmc_conf.erl @@ -3,7 +3,7 @@ %%% @end -module(gmc_conf). --vsn("0.3.6"). +-vsn("0.4.0"). -author("Craig Everett "). -copyright("QPQ AG "). -license("GPL-3.0-or-later"). @@ -60,27 +60,30 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) -> WX = wx:new(), Frame = wxFrame:new(WX, ?wxID_ANY, Label), + Panel = wxWindow:new(Frame, ?wxID_ANY), + TopSz = wxBoxSizer:new(?wxVERTICAL), + _ = wxBoxSizer:add(TopSz, Panel, zxw:flags(wide)), MainSz = wxBoxSizer:new(?wxVERTICAL), - AccSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("GajuMining Account ID")}]), - AccTx = wxTextCtrl:new(Frame, ?wxID_ANY, [{value, acc(Acc)}]), + AccSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("GajuMining Account ID")}]), + AccTx = wxTextCtrl:new(Panel, ?wxID_ANY, [{value, acc(Acc)}]), _ = wxStaticBoxSizer:add(AccSz, AccTx, wide(5)), - KeysSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("Additional Account IDs (optional)")}]), - KeysTx = wxTextCtrl:new(Frame, ?wxID_ANY, [{style, ?wxTE_MULTILINE}, {value, keys(Keys)}]), + KeysSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("Additional Account IDs (optional)")}]), + KeysTx = wxTextCtrl:new(Panel, ?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)")}]), + StatSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("Max System Committment (optional)")}]), 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}], - {Grid, [CoresTx, MemoryTx]} = display_box(Frame, Labels), - Network = wxRadioBox:new(Frame, ?wxID_ANY, J("Network"), {0, 0}, {50, 50}, [J("Mainnet"), J("Testnet")]), + {Grid, [CoresTx, MemoryTx]} = display_box(Panel, Labels), + Network = wxRadioBox:new(Panel, ?wxID_ANY, J("Network"), {0, 0}, {50, 50}, [J("Mainnet"), J("Testnet")]), ok = wxRadioBox:setSelection(Network, net_num(Net)), ButtSz = wxBoxSizer:new(?wxHORIZONTAL), - Affirm = wxButton:new(Frame, ?wxID_OK), - Cancel = wxButton:new(Frame, ?wxID_CANCEL), + Affirm = wxButton:new(Panel, ?wxID_OK), + Cancel = wxButton:new(Panel, ?wxID_CANCEL), _ = wxBoxSizer:add(StatSz, Grid, wide(5)), _ = wxBoxSizer:add(ButtSz, Affirm, wide(5)), _ = wxBoxSizer:add(ButtSz, Cancel, wide(5)), @@ -89,7 +92,8 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) -> _ = wxBoxSizer:add(MainSz, StatSz, base(5)), _ = wxBoxSizer:add(MainSz, Network, base(5)), _ = wxBoxSizer:add(MainSz, ButtSz, base(5)), - ok = wxFrame:setSizer(Frame, MainSz), + ok = wxWindow:setSizer(Panel, MainSz), + ok = wxFrame:setSizer(Frame, TopSz), ok = wxBoxSizer:layout(MainSz), ok = wxFrame:connect(Frame, command_button_clicked), ok = wxFrame:connect(Frame, close_window), diff --git a/src/gmc_gui.erl b/src/gmc_gui.erl index e3560cc..17e9eff 100644 --- a/src/gmc_gui.erl +++ b/src/gmc_gui.erl @@ -3,7 +3,7 @@ %%% @end -module(gmc_gui). --vsn("0.3.6"). +-vsn("0.4.0"). -author("Craig Everett "). -copyright("QPQ AG "). -license("GPL-3.0-or-later"). @@ -99,18 +99,21 @@ init(Prefs) -> VSN = proplists:get_value(vsn, ?MODULE:module_info(attributes)), WX = wx:new(), Frame = wxFrame:new(WX, ?wxID_ANY, AppName ++ " v" ++ VSN), + Panel = wxWindow:new(Frame, ?wxID_ANY), + TopSz = wxBoxSizer:new(?wxVERTICAL), + _ = wxBoxSizer:add(TopSz, Panel, zxw:flags(wide)), MainSz = wxBoxSizer:new(?wxVERTICAL), LeftRight = wxBoxSizer:new(?wxHORIZONTAL), Left = wxBoxSizer:new(?wxVERTICAL), Right = wxBoxSizer:new(?wxVERTICAL), - Labels = [J("ID"), J("Target"), J("Maps/s"), J("Candidate"), J("Height"), J("BlockHash")], - {Grid, [ID_C, DiffC, PerfC, CandyC, HeightC, BlockC]} = display_box(Frame, Labels), + Labels = [J("ID"), J("Target"), J("Graphs/s"), J("Candidate"), J("Height"), J("BlockHash")], + {Grid, [ID_C, DiffC, PerfC, CandyC, HeightC, BlockC]} = display_box(Panel, Labels), Style = ?wxTE_MULTILINE bor ?wxTE_READONLY, - MessSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("Messages")}]), - MessC = wxTextCtrl:new(Frame, ?wxID_ANY, [{style, Style}]), - _ = wxStaticBoxSizer:add(MessSz, MessC, zxw:flags(wide)), + MessSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("Messages")}]), + MessC = wxTextCtrl:new(Panel, ?wxID_ANY, [{style, Style}]), + _ = wxStaticBoxSizer:add(MessSz, MessC, zxw:flags({wide, 5})), ButtonTemplates = [{start_stop, J("Start")}, @@ -121,26 +124,27 @@ init(Prefs) -> MakeButton = fun({Name, Label}) -> - B = wxButton:new(Frame, ?wxID_ANY, [{label, Label}]), + B = wxButton:new(Panel, ?wxID_ANY, [{label, Label}]), #w{name = Name, id = wxButton:getId(B), wx = B} end, Buttons = lists:map(MakeButton, ButtonTemplates), - _ = wxBoxSizer:add(Left, Grid, zxw:flags(base)), - _ = wxBoxSizer:add(Left, MessSz, zxw:flags(wide)), + _ = wxBoxSizer:add(Left, Grid, zxw:flags({base, 5})), + _ = wxBoxSizer:add(Left, MessSz, zxw:flags({wide, 5})), Add = fun(#w{wx = Button}) -> wxBoxSizer:add(Right, Button, zxw:flags(wide)) end, ok = lists:foreach(Add, Buttons), _ = wxBoxSizer:add(LeftRight, Left, zxw:flags(wide)), _ = wxBoxSizer:add(LeftRight, Right, zxw:flags(base)), - _ = wxBoxSizer:add(MainSz, LeftRight, zxw:flags(wide)), + _ = wxBoxSizer:add(MainSz, LeftRight, zxw:flags({wide, 5})), - ok = wxFrame:setSizer(Frame, MainSz), - ok = wxSizer:layout(MainSz), + ok = wxWindow:setSizer(Panel, MainSz), + ok = wxFrame:setSizer(Frame, TopSz), + ok = wxBoxSizer:layout(MainSz), ok = wxFrame:connect(Frame, command_button_clicked), ok = wxFrame:connect(Frame, close_window), - ok = wxFrame:setSize(Frame, {650, 300}), + ok = wxFrame:setSize(Frame, {780, 350}), ok = wxFrame:center(Frame), true = wxFrame:show(Frame), State = diff --git a/src/gmc_sup.erl b/src/gmc_sup.erl index 027f088..ab567b1 100644 --- a/src/gmc_sup.erl +++ b/src/gmc_sup.erl @@ -12,7 +12,7 @@ %%% @end -module(gmc_sup). --vsn("0.3.6"). +-vsn("0.4.0"). -behaviour(supervisor). -author("Craig Everett "). -copyright("QPQ AG "). diff --git a/zomp.meta b/zomp.meta index a02c39a..28b9058 100644 --- a/zomp.meta +++ b/zomp.meta @@ -4,7 +4,7 @@ {prefix,"gmc"}. {desc,"Mining client for the Gajumaru Root"}. {author,"Craig Everett"}. -{package_id,{"qpq","gajumine",{0,3,6}}}. +{package_id,{"qpq","gajumine",{0,4,0}}}. {deps,[{"uwiger","gmhive_client",{0,9,3}}, {"uwiger","gmhive_protocol",{0,2,0}}, {"uwiger","gmcuckoo",{1,2,4}},