This commit is contained in:
恍兮惚兮 2024-11-11 10:07:41 +08:00
parent 1de8afaa0f
commit c9ac2f6df8
12 changed files with 198 additions and 72 deletions

View File

@ -447,7 +447,7 @@ namespace
void FPCSG00852(TextBuffer *buffer, HookParam *hp)
{
auto ws = StringToWideString(buffer->viewA(), 932).value();
ws = std::regex_replace(ws, std::wregex(LR"(\^)"), L"");
strReplace(ws, L"^", L"");
buffer->from(WideStringToString(ws, 932));
}
void FPCSG01066(TextBuffer *buffer, HookParam *hp)
@ -578,6 +578,8 @@ namespace
{0x80038e76, {CODEC_UTF8, 8, 0, 0, F010088B01A8FC000, "PCSG01110"}},
// オメルタ CODE:TYCOON 戒
{0x800BC462, {0, 3, 0, 0, F010088B01A8FC000, "PCSG00789"}},
// 紅色天井艶妖綺譚 二藍
{0x8003F554, {0, 4, 0, 0, FPCSG00852, "PCSG01221"}},
};
return 1;
}();

View File

@ -1775,6 +1775,13 @@ namespace
s = std::regex_replace(s, std::regex("@[0-9]"), "");
buffer->from(s);
}
void F010069E01A7CE000(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strA();
strReplace(s, "\"", "");
strReplace(s, "#", "");
buffer->from(s);
}
void F01000EA00B23C000(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strW();
@ -3322,6 +3329,8 @@ namespace
{0x8000ED1C, {CODEC_UTF8, 0, 0, 0, T0100A4700BC98000, "0100A4700BC98000", "1.0.0"}},
{0x8000ED3C, {CODEC_UTF8, 0, 0, 0, T0100A4700BC98000, "0100A4700BC98000", "1.0.0"}},
{0x8003734C, {CODEC_UTF8, 2, 0, 0, F010027100C79A000, "0100A4700BC98000", "1.0.2"}}, // 完整
// サスペクツルーム -警視庁門前署取調班-
{0x81397F6C, {CODEC_UTF8, 1, 0, 0, F010069E01A7CE000, "010069E01A7CE000", "1.0.0"}},
};
return 1;
}();

View File

@ -1,6 +1,6 @@
if(BUILD_GUI)
add_executable(LunaHost WIN32 confighelper.cpp controls.cpp main.cpp processlistwindow.cpp LunaHost.cpp window.cpp luna.rc pluginmanager.cpp Plugin/extensionimpl.cpp Plugin/copyclipboard.cpp QtLoader_inline.cpp app.manifest ${versioninfohost})
add_executable(LunaHost WIN32 confighelper.cpp controls.cpp main.cpp processlistwindow.cpp LunaHost.cpp window.cpp ../../../exec/luna.rc pluginmanager.cpp Plugin/extensionimpl.cpp Plugin/copyclipboard.cpp QtLoader_inline.cpp app.manifest ${versioninfohost})
target_precompile_headers(LunaHost REUSE_FROM pch)
set_target_properties(LunaHost PROPERTIES OUTPUT_NAME "LunaHost${bitappendix}")
target_link_libraries(LunaHost comctl32 winhttp pch host ${YY_Thunks_for_WinXP} nlohmann)

View File

@ -312,18 +312,17 @@ LunaHost::LunaHost()
WORD version[4] = LUNA_VERSION;
WCHAR vs[32];
if (queryversion(&_1, &_2, &_3, &_4))
{
wsprintf(vs, L" | %s v%d.%d.%d", VersionCurrent, version[0], version[1], version[2]);
title += vs;
settext(title);
std::thread([&]()
{
wsprintf(vs, L" | %s v%d.%d.%d", VersionCurrent, version[0], version[1], version[2]);
title += vs;
settext(title);
std::thread([&]()
{
if (HttpRequest httpRequest{
L"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
L"lunatranslator.org",
L"GET",
L"/version_lunahook"
L"/version"
}){
try{
@ -333,8 +332,7 @@ LunaHost::LunaHost()
}
catch(std::exception&e){}
} })
.detach();
}
.detach();
}
void LunaHost::on_text_recv_checkissaved(TextThread &thread)
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

@ -1 +0,0 @@
IDI_ICON1 ICON DISCARDABLE "luna.ico"

View File

@ -1,7 +1,7 @@
set(VERSION_MAJOR 5)
set(VERSION_MINOR 57)
set(VERSION_PATCH 2)
set(VERSION_PATCH 3)
set(VERSION_REVISION 0)
add_definitions(-DVERSION_MAJOR=${VERSION_MAJOR})
add_definitions(-DVERSION_MINOR=${VERSION_MINOR})

View File

@ -255,10 +255,10 @@ class yuyinzhidingsetting(LDialog):
QStandardItem(),
],
)
self.table.setindexdata(self.model.index(row, 0), item['regex'])
self.table.setindexdata(self.model.index(row, 0), item["regex"])
self.table.setindexdata(self.model.index(row, 1), item['condition'])
self.table.setindexdata(self.model.index(row, 3), item['target'])
self.table.setindexdata(self.model.index(row, 1), item["condition"])
self.table.setindexdata(self.model.index(row, 3), item["target"])
def createacombox(self, config):
com = SuperCombo()
@ -478,9 +478,6 @@ class autoinitdialog__(LDialog):
except:
print_exc()
def __getv(l):
return l
hasrank = []
hasnorank = []
for line in lines:
@ -523,9 +520,24 @@ class autoinitdialog__(LDialog):
else:
lineW = LLabel(dd[key])
elif line["type"] == "textlist":
__list = dd[key].copy()
lineW = listediterline(line["name"], line["header"], __list)
regist[key] = functools.partial(__getv, __list)
directedit = isinstance(dd[key], str)
if directedit:
__list = dd[key].split("|")
else:
__list = dd[key].copy()
lineW = listediterline(
line["name"],
line.get("header", line["name"]),
__list,
directedit=directedit,
)
def __getv(l, directedit):
if directedit:
return "|".join(l)
return l
regist[key] = functools.partial(__getv, __list, directedit)
elif line["type"] == "combo":
lineW = SuperCombo()
if "list_function" in line:

View File

@ -9,7 +9,6 @@ from myutils.config import (
get_launchpath,
savehook_new_list,
static_data,
getlanguse,
)
from traceback import print_exc
@ -21,7 +20,6 @@ from gui.usefulwidget import (
D_getsimplecombobox,
D_getspinbox,
D_getIconButton,
listediterline,
getIconButton,
makegrid,
listediter,

View File

@ -1896,6 +1896,9 @@ class listediter(LDialog):
candidates=None,
) -> None:
super().__init__(parent)
self.setWindowFlags(
self.windowFlags() & ~Qt.WindowType.WindowContextHelpButtonHint
)
self.lst = lst
self.candidates = candidates
self.closecallback = closecallback
@ -2073,35 +2076,64 @@ class listediter(LDialog):
)
class listediterline(QLineEdit):
class ClickableLine(QLineEdit):
clicked = pyqtSignal()
def __init__(self, name, header, reflist, ispathsedit=None):
super().__init__()
self.setReadOnly(True)
self.reflist = reflist
self.setText("|".join(reflist))
self.clicked.connect(
functools.partial(
listediter,
self,
name,
header,
reflist,
closecallback=self.callback,
ispathsedit=ispathsedit,
)
)
def callback(self):
self.setText("|".join(self.reflist))
def mousePressEvent(self, e):
self.clicked.emit()
super().mousePressEvent(e)
class listediterline(QWidget):
def text(self):
return self.edit.text()
def setText(self, t):
return self.edit.setText(t)
def __init__(self, name, header, reflist, ispathsedit=None, directedit=False):
super().__init__()
self.edit = ClickableLine()
self.reflist = reflist
self.setText("|".join(reflist))
hbox = QHBoxLayout()
hbox.setContentsMargins(0, 0, 0, 0)
hbox.addWidget(self.edit)
self.setLayout(hbox)
callback = functools.partial(
listediter,
self,
name,
header,
reflist,
closecallback=self.callback,
ispathsedit=ispathsedit,
)
self.directedit = directedit
if directedit:
def __(t):
self.reflist.clear()
self.reflist.extend(t.split("|"))
self.edit.textChanged.connect(__)
def __2():
self.edit.setReadOnly(True)
callback()
hbox.addWidget(getIconButton(icon="fa.gear", callback=__2))
else:
self.edit.setReadOnly(True)
self.edit.clicked.connect(callback)
def callback(self):
self.setText("|".join(self.reflist))
if self.directedit:
self.edit.setReadOnly(False)
def openfiledirectory(directory, multi, edit, isdir, filter1="*.*", callback=None):
if isdir:
res = QFileDialog.getExistingDirectory(directory=directory)

View File

@ -1238,8 +1238,7 @@
"argstype": {
"punctuations": {
"type": "textlist",
"name": "标点",
"header": "标点"
"name": "标点"
}
}
}

View File

@ -21,7 +21,8 @@
"api": {
"name": "DeepLX api",
"refcombo": "usewhich",
"refcombo_i": 1
"refcombo_i": 1,
"type": "textlist"
},
"usewhich": {
"rank": 0,
@ -45,19 +46,23 @@
"argstype": {
"密钥": {
"refcombo": "interface",
"refcombo_i": 0
"refcombo_i": 0,
"type": "textlist"
},
"APP ID": {
"refcombo": "interface",
"refcombo_i": 0
"refcombo_i": 0,
"type": "textlist"
},
"API Key": {
"refcombo": "interface",
"refcombo_i": 1
"refcombo_i": 1,
"type": "textlist"
},
"Secret Key": {
"refcombo": "interface",
"refcombo_i": 1
"refcombo_i": 1,
"type": "textlist"
},
"interface": {
"rank": 0,
@ -74,11 +79,24 @@
"args": {
"app_id": "",
"app_secret": ""
},
"argstype": {
"app_id": {
"type": "textlist"
},
"app_secret": {
"type": "textlist"
}
}
},
"caiyunapi": {
"args": {
"Token": ""
},
"argstype": {
"Token": {
"type": "textlist"
}
}
},
"deeplapi-free": {
@ -92,13 +110,15 @@
"rank": 1,
"name": "Auth Key",
"refcombo": "usewhich",
"refcombo_i": 0
"refcombo_i": 0,
"type": "textlist"
},
"DeepL-Auth-Key-2": {
"rank": 2,
"name": "Auth Key",
"refcombo": "usewhich",
"refcombo_i": 1
"refcombo_i": 1,
"type": "textlist"
},
"usewhich": {
"rank": 0,
@ -114,11 +134,21 @@
"yandexapi": {
"args": {
"key": ""
},
"argstype": {
"key": {
"type": "textlist"
}
}
},
"googleapi": {
"args": {
"key": ""
},
"argstype": {
"key": {
"type": "textlist"
}
}
},
"sugoix": {
@ -137,6 +167,14 @@
"args": {
"Access Key ID": "",
"Secret Access Key": ""
},
"argstype": {
"Access Key ID": {
"type": "textlist"
},
"Secret Access Key": {
"type": "textlist"
}
}
},
"tencentapi": {
@ -146,6 +184,12 @@
"Region": 0
},
"argstype": {
"SecretId": {
"type": "textlist"
},
"SecretKey": {
"type": "textlist"
},
"Region": {
"type": "combo",
"list": [
@ -173,6 +217,11 @@
"xiaoniu": {
"args": {
"apikey": ""
},
"argstype": {
"apikey": {
"type": "textlist"
}
}
},
"youdaoapi": {
@ -182,10 +231,12 @@
},
"argstype": {
"APP_KEY": {
"name": "应用ID"
"name": "应用ID",
"type": "textlist"
},
"APP_SECRET": {
"name": "应用密钥"
"name": "应用密钥",
"type": "textlist"
}
}
},
@ -197,10 +248,12 @@
},
"argstype": {
"ak": {
"name": "Access Key Id"
"name": "Access Key Id",
"type": "textlist"
},
"sk": {
"name": "Secret Access Key"
"name": "Secret Access Key",
"type": "textlist"
}
}
},
@ -233,11 +286,13 @@
},
"secret_id": {
"rank": 0,
"name": "SecretId"
"name": "SecretId",
"type": "textlist"
},
"secret_key": {
"rank": 1,
"name": "SecretKey"
"name": "SecretKey",
"type": "textlist"
},
"model": {
"rank": 2,
@ -359,7 +414,8 @@
},
"API_KEY": {
"name": "API Key",
"rank": 0.5
"rank": 0.5,
"type": "textlist"
},
"流式输出": {
"type": "switch",
@ -446,7 +502,8 @@
},
"SECRET_KEY": {
"rank": 1,
"name": "API Key"
"name": "API Key",
"type": "textlist"
},
"model": {
"rank": 2,
@ -536,11 +593,13 @@
},
"API_KEY": {
"rank": 0,
"name": "API Key"
"name": "API Key",
"type": "textlist"
},
"SECRET_KEY": {
"rank": 1,
"name": "Secret Key"
"name": "Secret Key",
"type": "textlist"
},
"model": {
"rank": 2,
@ -649,7 +708,8 @@
},
"SECRET_KEY": {
"rank": 0,
"name": "API Key"
"name": "API Key",
"type": "textlist"
},
"model": {
"rank": 1,
@ -769,12 +829,25 @@
"args": {
"key1": "",
"Location": ""
},
"argstype": {
"key1": {
"type": "textlist"
}
}
},
"ibm": {
"args": {
"apiurl": "",
"apikey": ""
},
"argstype": {
"apiurl": {
"type": "textlist"
},
"apikey": {
"type": "textlist"
}
}
},
"aliyunapi": {
@ -784,10 +857,12 @@
},
"argstype": {
"Access_Key": {
"name": "AccessKey ID"
"name": "AccessKey ID",
"type": "textlist"
},
"SECRET_KEY": {
"name": "AccessKey Secret"
"name": "AccessKey Secret",
"type": "textlist"
}
}
},
@ -1046,7 +1121,8 @@
},
"SECRET_KEY": {
"rank": 2,
"name": "API Key"
"name": "API Key",
"type": "textlist"
},
"model": {
"rank": 3,
@ -1264,7 +1340,8 @@
},
"SECRET_KEY": {
"rank": 6,
"name": "API Key"
"name": "API Key",
"type": "textlist"
},
"model": {
"rank": 1,