mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Cfg: Convert 'App - Debug'
This commit is contained in:
parent
5fbf168fb7
commit
5073db8044
@ -148,6 +148,7 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
stage = Xoa_stage_.Tid_init;
|
||||
user.Init_by_app(this);
|
||||
cfg.Init_by_app(this);
|
||||
user.History_mgr().Init_by_app(this);
|
||||
prog_mgr.Init_by_app(this, url_cmd_eval);
|
||||
xtn_mgr.Init_by_app(this);
|
||||
gui_mgr.Init_by_app();
|
||||
|
@ -71,7 +71,7 @@ public class Xocfg_cache_mgr {
|
||||
// get data from db
|
||||
Xocfg_itm_row meta_itm = db_app.Tbl__itm().Select_by_key_or_null(key);
|
||||
if (meta_itm == null) {
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "cfg:grp not found; key=~{0}", key);
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "cfg:itm not found; key=~{0}", key);
|
||||
return new Xocfg_cache_grp(key, "");
|
||||
}
|
||||
Xocfg_val_row[] itms = db_usr.Tbl__val().Select_all(meta_itm.Key());
|
||||
|
@ -35,7 +35,7 @@ public class Xoctg_catpage_mgr__basic__tst {
|
||||
byte[] page_bry = Bry_.new_a7("A 1");
|
||||
Xoa_url url = Xoa_url.New(Bry_.new_a7("en.wikipedia.org"), page_bry);
|
||||
Xoa_ttl ttl = Xoa_ttl.Parse(fxt.Wiki(), page_bry);
|
||||
fxt.Wiki().Appe().Usere().History_mgr().Add(url, ttl, page_bry);
|
||||
fxt.Wiki().Appe().Usere().History_mgr().Add(fxt.Wiki().App(), url, ttl, page_bry);
|
||||
fxt .Init_itms__pages("A_1")
|
||||
.Test__html__all(Xoa_ctg_mgr.Tid__page, String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
|
@ -32,8 +32,6 @@ public class Xoapi_addon implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk__wikis__ctgs__hidden_enabled_)) wikis__ctgs__hidden_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__app__scripting__enabled)) return Yn.To_str(app__scripting__enabled);
|
||||
else if (ctx.Match(k, Invk__app__scripting__enabled_)) app__scripting__enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__app__page_history__log_all)) return Yn.To_str(app__page_history__log_all);
|
||||
else if (ctx.Match(k, Invk__app__page_history__log_all_)) app__page_history__log_all = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__app__update__restart_cmd)) return app__update__restart_cmd;
|
||||
else if (ctx.Match(k, Invk__app__update__restart_cmd_)) app__update__restart_cmd = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk__app__update__update_db_src)) return app__update__update_db_src;
|
||||
@ -46,12 +44,9 @@ public class Xoapi_addon implements Gfo_invk {
|
||||
, Invk__wikis__ctgs__hidden_enabled_ = "wikis__ctgs__hidden_enabled_"
|
||||
, Invk__app__scripting__enabled = "app__scripting__enabled"
|
||||
, Invk__app__scripting__enabled_ = "app__scripting__enabled_"
|
||||
, Invk__app__page_history__log_all = "app__page_history__log_all"
|
||||
, Invk__app__page_history__log_all_ = "app__page_history__log_all_"
|
||||
, Invk__app__update__restart_cmd = "app__update__restart_cmd"
|
||||
, Invk__app__update__restart_cmd_ = "app__update__restart_cmd_"
|
||||
, Invk__app__update__update_db_src = "app__update__update_db_src"
|
||||
, Invk__app__update__update_db_src_ = "app__update__update_db_src_"
|
||||
;
|
||||
public static boolean app__page_history__log_all;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_info implements Gfo_usr_dlg__gui__opt, Gfo_invk {
|
||||
public class Xoapi_info implements Gfo_invk {
|
||||
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
private Xog_win_itm Win() {return app.Gui_mgr().Browser_win();}
|
||||
public void Focus() {this.Win().Info_box().Focus();}
|
||||
@ -26,21 +26,12 @@ public class Xoapi_info implements Gfo_usr_dlg__gui__opt, Gfo_invk {
|
||||
Io_url session_fil = app.Log_wtr().Session_fil();
|
||||
app.Prog_mgr().App_view_text().Run(session_fil);
|
||||
}
|
||||
public boolean Warn_enabled() {return warn_enabled;} private boolean warn_enabled;
|
||||
public boolean Note_enabled() {return note_enabled;} private boolean note_enabled;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_focus)) this.Focus();
|
||||
else if (ctx.Match(k, Invk_clear)) this.Clear();
|
||||
else if (ctx.Match(k, Invk_launch)) this.Launch();
|
||||
else if (ctx.Match(k, Invk_warn_enabled)) return Yn.To_str(warn_enabled);
|
||||
else if (ctx.Match(k, Invk_warn_enabled_)) warn_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_note_enabled)) return Yn.To_str(note_enabled);
|
||||
else if (ctx.Match(k, Invk_note_enabled_)) note_enabled = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_focus = "focus", Invk_clear = "clear", Invk_launch = "launch"
|
||||
, Invk_warn_enabled = "warn_enabled", Invk_warn_enabled_ = "warn_enabled_"
|
||||
, Invk_note_enabled = "note_enabled", Invk_note_enabled_ = "note_enabled_"
|
||||
;
|
||||
private static final String Invk_focus = "focus", Invk_clear = "clear", Invk_launch = "launch";
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.guis.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*;
|
||||
public interface Gfo_usr_dlg__gui__opt {
|
||||
boolean Warn_enabled();
|
||||
boolean Note_enabled();
|
||||
}
|
@ -19,17 +19,18 @@ package gplx.xowa.guis.views; import gplx.*; import gplx.xowa.*; import gplx.xow
|
||||
import gplx.core.lists.rings.*;
|
||||
import gplx.gfui.*; import gplx.gfui.draws.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.standards.*;
|
||||
public class Gfo_usr_dlg__gui__swt implements Gfo_usr_dlg__gui, Gfo_invk {
|
||||
private final GfuiInvkCmd cmd_sync; private final GfuiTextBox prog_box, info_box; private final Gfo_usr_dlg__gui__opt opt;
|
||||
public Gfo_usr_dlg__gui__swt(Gfui_kit kit, GfuiTextBox prog_box, GfuiTextBox info_box, GfuiTextBox warn_box, Gfo_usr_dlg__gui__opt opt) {
|
||||
private final GfuiInvkCmd cmd_sync; private final GfuiTextBox prog_box, info_box;
|
||||
private boolean show_warn, show_note;
|
||||
public Gfo_usr_dlg__gui__swt(Xoa_app app, Gfui_kit kit, GfuiTextBox prog_box, GfuiTextBox info_box, GfuiTextBox warn_box) {
|
||||
this.cmd_sync = kit.New_cmd_sync(this); // NOTE: cmd_sync needed else progress messages may be sent out of order
|
||||
this.prog_box = prog_box; this.info_box = info_box;
|
||||
this.opt = opt;
|
||||
app.Cfg().Bind_many_app(this, Cfg__show_warn, Cfg__show_note);
|
||||
}
|
||||
public void Clear() {Write(Invk_write_prog, ""); info_box.Text_(""); info_box.ForeColor_(ColorAdp_.Black); info_box.BackColor_(ColorAdp_.White); info_box.Redraw(); info_box_is_warn = false;}
|
||||
public Ring__string Prog_msgs() {return prog_msgs;} Ring__string prog_msgs = new Ring__string().Max_(128);
|
||||
public void Write_prog(String text) {Write(Invk_write_prog, text);}
|
||||
public void Write_note(String text) {if (opt.Note_enabled()) Write(Invk_write_note, text);}
|
||||
public void Write_warn(String text) {if (opt.Warn_enabled()) Write(Invk_write_warn, text);}
|
||||
public void Write_note(String text) {if (show_note) Write(Invk_write_note, text);}
|
||||
public void Write_warn(String text) {if (show_warn) Write(Invk_write_warn, text);}
|
||||
public void Write_stop(String text) {Write(Invk_write_stop, text);}
|
||||
private void Write(String invk, String text) {
|
||||
GfoMsg m = GfoMsg_.new_cast_(invk).Add("v", text);
|
||||
@ -39,6 +40,8 @@ public class Gfo_usr_dlg__gui__swt implements Gfo_usr_dlg__gui, Gfo_invk {
|
||||
if (ctx.Match(k, Invk_write_prog)) {String v = m.ReadStr("v"); prog_box.Text_(v); prog_box.Redraw(); if (!String_.Eq(v, "")) prog_msgs.Push(v);}
|
||||
else if (ctx.Match(k, Invk_write_note)) {Info_box_write(m.ReadStr("v"), false); info_box.Redraw();}
|
||||
else if (ctx.Match(k, Invk_write_warn)) {Info_box_write(m.ReadStr("v"), true); info_box.ForeColor_(ColorAdp_.White); info_box.BackColor_(ColorAdp_.Red); info_box.Redraw();}
|
||||
else if (ctx.Match(k, Cfg__show_warn)) show_warn = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Cfg__show_note)) show_note = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
@ -47,5 +50,7 @@ public class Gfo_usr_dlg__gui__swt implements Gfo_usr_dlg__gui, Gfo_invk {
|
||||
info_box.Text_(v);
|
||||
info_box_is_warn = warn;
|
||||
} boolean info_box_is_warn;
|
||||
|
||||
private static final String Invk_write_prog = "write_prog", Invk_write_note = "write_note", Invk_write_warn = "write_warn", Invk_write_stop = "write_stop";
|
||||
private static final String Cfg__show_warn = "xowa.app.debug.show_warn", Cfg__show_note = "xowa.app.debug.show_note";
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm {
|
||||
page.Url().Anch_bry_(anchor_bry); // update url
|
||||
}
|
||||
tab.History_mgr().Add(page);
|
||||
app.Usere().History_mgr().Add(page.Url(), page.Ttl(), Bry_.Add_w_dlm(Byte_ascii.Hash, page.Url().Page_bry(), anchor_bry));
|
||||
app.Usere().History_mgr().Add(page.Wiki().App(), page.Url(), page.Ttl(), Bry_.Add_w_dlm(Byte_ascii.Hash, page.Url().Page_bry(), anchor_bry));
|
||||
}
|
||||
public void App__exit() {
|
||||
kit.Kit_term(); // NOTE: Kit_term calls shell.close() which in turn is hooked up to app.Term_cbk() event; DATE:2014-09-09
|
||||
@ -314,7 +314,7 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm {
|
||||
|
||||
if ( !Env_.Mode_testing()
|
||||
&& app.Mode().Tid_is_gui()) // only run for gui; do not run for tcp/http server; DATE:2014-05-03
|
||||
app.Usr_dlg().Gui_wkr_(new Gfo_usr_dlg__gui__swt(kit, prog_box, info_box, info_box, app.Api_root().Gui().Browser().Info()));
|
||||
app.Usr_dlg().Gui_wkr_(new Gfo_usr_dlg__gui__swt(app, kit, prog_box, info_box, info_box));
|
||||
}
|
||||
public static String Remove_redirect_if_exists(String text) {
|
||||
// remove redirect target; EX: "A -> B" -> "A"
|
||||
|
@ -28,9 +28,9 @@ public class Xoue_user implements Xou_user, Gfo_evt_mgr_owner, Gfo_invk {
|
||||
this.ev_mgr = new Gfo_evt_mgr(this);
|
||||
this.fsys_mgr = new Xou_fsys_mgr(user_dir);
|
||||
this.user_db_mgr = new Xou_db_mgr(app);
|
||||
this.cfg_mgr = new Xou_cfg(this);
|
||||
this.history_mgr = new Xou_history_mgr(fsys_mgr.App_data_history_fil());
|
||||
this.prefs_mgr = new gplx.xowa.users.prefs.Prefs_mgr(app);
|
||||
this.cfg_mgr = new Xou_cfg(this);
|
||||
this.session_mgr = new Xou_session(this);
|
||||
}
|
||||
public Gfo_evt_mgr Evt_mgr() {return ev_mgr;} private final Gfo_evt_mgr ev_mgr;
|
||||
|
@ -23,7 +23,13 @@ public class Xou_history_mgr implements Gfo_invk {
|
||||
private Ordered_hash itms = Ordered_hash_.New_bry();
|
||||
private boolean load_chk = false;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
public Xou_history_mgr(Io_url history_fil) {this.history_fil = history_fil;}
|
||||
private boolean log_all;
|
||||
public Xou_history_mgr(Io_url history_fil) {
|
||||
this.history_fil = history_fil;
|
||||
}
|
||||
public void Init_by_app(Xoa_app app) {
|
||||
app.Cfg().Bind_many_app(this, Cfg__log_all);
|
||||
}
|
||||
public int Len() {return itms.Count();}
|
||||
public void Clear() {itms.Clear();}
|
||||
public Xou_history_itm Get_at(int i) {return (Xou_history_itm)itms.Get_at(i);}
|
||||
@ -54,9 +60,9 @@ public class Xou_history_mgr implements Gfo_invk {
|
||||
if (url.Qargs_ary().length > 0)
|
||||
page_ttl = Bry_.Add(page_ttl, url.Qargs_mgr().To_bry());
|
||||
}
|
||||
Add(url, ttl, page_ttl);
|
||||
Add(page.Wiki().App(), url, ttl, page_ttl);
|
||||
}
|
||||
public void Add(Xoa_url url, Xoa_ttl ttl, byte[] page_ttl) {
|
||||
public void Add(Xoa_app app, Xoa_url url, Xoa_ttl ttl, byte[] page_ttl) {
|
||||
if (gplx.xowa.users.history.Xoud_history_mgr.Skip_history(ttl)) return;
|
||||
if (!load_chk) Load();
|
||||
byte[] key = Xou_history_itm.key_(url.Wiki_bry(), page_ttl);
|
||||
@ -65,7 +71,7 @@ public class Xou_history_mgr implements Gfo_invk {
|
||||
itm = new Xou_history_itm(url.Wiki_bry(), To_full_db_w_qargs(url, ttl));
|
||||
itms.Add(key, itm);
|
||||
}
|
||||
if (gplx.xowa.apps.apis.xowa.Xoapi_addon.app__page_history__log_all)
|
||||
if (log_all)
|
||||
Io_mgr.Instance.AppendFilStr(history_fil.GenNewNameAndExt("log_all.csv"), String_.Format("{0}|{1}|{2}\n", Datetime_now.Get().XtoStr_fmt_iso_8561_w_tz(), itm.Wiki(), itm.Page()));
|
||||
itm.Tally();
|
||||
}
|
||||
@ -120,12 +126,14 @@ public class Xou_history_mgr implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_html_itm_)) html_mgr.Html_itm().Fmt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_current_itms_max_)) current_itms_max = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_current_itms_reset_)) current_itms_reset = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Cfg__log_all)) log_all = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_html_grp = "html_grp", Invk_html_grp_ = "html_grp_", Invk_html_itm = "html_itm", Invk_html_itm_ = "html_itm_", Invk_current_itms_max_ = "current_itms_max_", Invk_current_itms_reset_ = "current_itms_reset_";
|
||||
public static final byte[] Ttl_name = Bry_.new_a7("XowaPageHistory");
|
||||
public static final byte[] Ttl_full = Bry_.new_a7("Special:XowaPageHistory");
|
||||
private static final String Cfg__log_all = "xowa.app.page_history.log_all";
|
||||
}
|
||||
class Xou_history_itm_srl {
|
||||
public static void Load(byte[] ary, Ordered_hash list) {
|
||||
|
Loading…
Reference in New Issue
Block a user