修改plugin顺序

This commit is contained in:
恍兮惚兮 2024-02-09 09:47:22 +08:00
parent 49742b9ca7
commit ec0a7623b4
2 changed files with 5 additions and 8 deletions

View File

@ -254,20 +254,17 @@ Pluginwindow::Pluginwindow(mainwindow*p,Pluginmanager* pl):mainwindow(p){
auto f=pluginmanager->selectpluginfile();
if(f.has_value()){
if(pluginmanager->addplugin(f.value(),LOWORD(wparam)==IDM_ADD_QT_PLUGIN)){
listplugins->deleteitem(listplugins->count()-1);
listadd(f.value());
listadd(L"InternalClipBoard");
}
}
break;
}
case IDM_REMOVE_PLUGIN:
{
auto idx=listplugins->currentidx();
if(idx==listplugins->count()-1)break;printf("??");
if(idx==0)break;
pluginmanager->remove((LPCWSTR)listplugins->getdata(idx));
listplugins->deleteitem(idx);
listplugins->deleteitem(idx-1);
break;
}
}

View File

@ -54,7 +54,8 @@ void Pluginmanager::loadqtdlls(std::vector<std::wstring>&collectQtplugs){
Pluginmanager::Pluginmanager(LunaHost* _host):host(_host){
try {
std::scoped_lock lock(OnNewSentenceSLock);
PluginRank.push_back(L"InternalClipBoard");
OnNewSentenceS[L"InternalClipBoard"]=GetProcAddress(GetModuleHandle(0),"OnNewSentence");//内部链接的剪贴板插件
auto plgs=host->configs->pluginsget();
std::vector<std::wstring>collectQtplugs;
for (auto i=0;i<plgs.size();i++) {
@ -71,8 +72,7 @@ Pluginmanager::Pluginmanager(LunaHost* _host):host(_host){
if(collectQtplugs.size()){
loadqtdlls(collectQtplugs);
}
PluginRank.push_back(L"InternalClipBoard");
OnNewSentenceS[L"InternalClipBoard"]=GetProcAddress(GetModuleHandle(0),"OnNewSentence");//内部链接的剪贴板插件
} catch (const std::exception& ex) {
std::cerr << "Error: " << ex.what() << std::endl;
}