fix config load

This commit is contained in:
恍兮惚兮 2024-02-09 09:59:49 +08:00
parent ec0a7623b4
commit 5262bd42b0

View File

@ -122,6 +122,11 @@ LunaHost::LunaHost(){
g_showtexts = new textedit(this,L"",10, 330, 200, 200,ES_READONLY|ES_MULTILINE |ES_AUTOVSCROLL| WS_VSCROLL); g_showtexts = new textedit(this,L"",10, 330, 200, 200,ES_READONLY|ES_MULTILINE |ES_AUTOVSCROLL| WS_VSCROLL);
TextThread::filterRepetition=configs->get("filterrepeat",false);
check_toclipboard=configs->get("ToClipboard",false);
TextThread::flushDelay=configs->get("flushDelay",TextThread::flushDelay);
Host::defaultCodepage=configs->get("codepage",Host::defaultCodepage);
Host::Start( Host::Start(
[&](DWORD pid) {attachedprocess.push_back(pid);}, [&](DWORD pid) {attachedprocess.push_back(pid);},
[&](DWORD pid) { [&](DWORD pid) {
@ -183,9 +188,7 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
TextThread::filterRepetition=ck; TextThread::filterRepetition=ck;
host->configs->set("filterrepeat",ck); host->configs->set("filterrepeat",ck);
}; };
auto frp=host->configs->get("filterrepeat",false); ckbfilterrepeat->setcheck(host->configs->get("filterrepeat",false));
TextThread::filterRepetition=frp;
ckbfilterrepeat->setcheck(frp);
g_check_clipboard =new checkbox(this,BtnToClipboard,10, 110, 200, 40) ; g_check_clipboard =new checkbox(this,BtnToClipboard,10, 110, 200, 40) ;
g_check_clipboard->onclick=[=](){ g_check_clipboard->onclick=[=](){
@ -193,9 +196,7 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
((LunaHost*)parent)->check_toclipboard=ck; ((LunaHost*)parent)->check_toclipboard=ck;
host->configs->set("ToClipboard",ck); host->configs->set("ToClipboard",ck);
}; };
auto toc=host->configs->get("ToClipboard",false); g_check_clipboard->setcheck(host->configs->get("ToClipboard",false));
((LunaHost*)parent)->check_toclipboard=toc;
g_check_clipboard->setcheck(toc);
g_timeout = new textedit(this,std::to_wstring(host->configs->get("flushDelay",TextThread::flushDelay)).c_str(),160, 10, 100, 40) ; g_timeout = new textedit(this,std::to_wstring(host->configs->get("flushDelay",TextThread::flushDelay)).c_str(),160, 10, 100, 40) ;
g_codepage = new textedit(this,std::to_wstring(host->configs->get("codepage",Host::defaultCodepage)).c_str(),160, 60, 100, 40) ; g_codepage = new textedit(this,std::to_wstring(host->configs->get("codepage",Host::defaultCodepage)).c_str(),160, 60, 100, 40) ;
@ -207,11 +208,13 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
} }
catch(std::exception&){} catch(std::exception&){}
}; };
g_codepage->ontextchange=[=](const std::wstring &text){ g_codepage->ontextchange=[=](const std::wstring &text){
try { try {
auto cp=std::stoi(text); auto cp=std::stoi(text);
if(IsValidCodePage(cp)){ if(IsValidCodePage(cp)){
Host::defaultCodepage= cp; printf("2"); Host::defaultCodepage= cp;
printf("%d",Host::defaultCodepage);
host->configs->set("codepage",cp); host->configs->set("codepage",cp);
} }
} }