145 lines
3.7 KiB
C
Raw Normal View History

2024-07-21 19:28:47 +08:00
#include "window.h"
#include "controls.h"
#include "textthread.h"
#include "pluginmanager.h"
#include "confighelper.h"
2024-02-09 09:25:26 +08:00
class LunaHost;
2024-07-21 19:28:47 +08:00
class Pluginwindow : public mainwindow
{
listbox *listplugins;
Pluginmanager *pluginmanager;
2024-02-09 09:25:26 +08:00
public:
2024-07-21 19:28:47 +08:00
Pluginwindow(mainwindow *, Pluginmanager *);
void on_size(int w, int h);
2024-03-29 15:07:43 +08:00
void pluginrankmove(int);
2024-02-09 09:25:26 +08:00
};
2024-07-21 19:28:47 +08:00
class Settingwindow : public mainwindow
{
checkbox *ckbfilterrepeat;
spinbox *g_timeout;
spinbox *g_codepage;
checkbox *g_check_clipboard;
checkbox *readonlycheck;
checkbox *autoattach;
checkbox *autoattach_so;
checkbox *copyselect;
spinbox *spinmaxbuffsize;
spinbox *spinmaxhistsize;
gridlayout *mainlayout;
lineedit *showfont;
button *selectfont;
2024-02-09 09:25:26 +08:00
public:
2024-07-21 19:28:47 +08:00
Settingwindow(LunaHost *);
2024-02-09 09:25:26 +08:00
};
2024-03-27 16:36:14 +08:00
2024-07-21 19:28:47 +08:00
class processlistwindow : public mainwindow
{
gridlayout *mainlayout;
lineedit *g_hEdit;
button *g_hButton;
listview *g_hListBox;
button *g_refreshbutton;
std::unordered_map<std::wstring, std::vector<int>> g_exe_pid;
void PopulateProcessList(listview *, std::unordered_map<std::wstring, std::vector<int>> &);
2024-03-27 16:36:14 +08:00
public:
2024-07-21 19:28:47 +08:00
processlistwindow(mainwindow *parent = 0);
2024-03-27 16:36:14 +08:00
void on_show();
};
2024-07-21 19:28:47 +08:00
class HooksearchText : public mainwindow
{
gridlayout *layout;
lineedit *edittext;
button *checkok;
spinbox *codepage;
2024-03-28 19:24:07 +08:00
public:
2024-07-21 19:28:47 +08:00
HooksearchText(mainwindow *);
void call(std::set<DWORD> pids);
2024-03-28 19:24:07 +08:00
};
2024-07-21 19:28:47 +08:00
class Hooksearchsetting : public mainwindow
{
gridlayout *layout;
spinbox *spinduration;
spinbox *spinoffset;
spinbox *spincap;
spinbox *spincodepage;
lineedit *editpattern;
lineedit *editmodule;
lineedit *editmaxaddr;
lineedit *editminaddr;
spinbox *spinpadding;
lineedit *editregex;
button *start;
2024-03-28 19:24:07 +08:00
public:
2024-07-21 19:28:47 +08:00
Hooksearchsetting(mainwindow *);
void call(std::set<DWORD> pids, std::wstring);
2024-03-28 19:24:07 +08:00
};
2024-07-21 19:28:47 +08:00
class Hooksearchwindow : public mainwindow
{
checkbox *cjkcheck;
button *hs_default, *hs_text, *hs_user;
gridlayout *layout;
Hooksearchsetting *hooksearchsetting = 0;
HooksearchText *hooksearchText = 0;
2024-03-28 19:24:07 +08:00
public:
2024-07-21 19:28:47 +08:00
Hooksearchwindow(LunaHost *parent);
2024-03-28 19:24:07 +08:00
};
2024-07-21 19:28:47 +08:00
class LunaHost : public mainwindow
{
Pluginwindow *pluginwindow = 0;
std::set<DWORD> attachedprocess;
lineedit *g_hEdit_userhook;
gridlayout *mainlayout;
button *g_hButton_insert;
button *btnplugin;
// listbox* g_hListBox_listtext;
listview *g_hListBox_listtext;
multilineedit *g_showtexts;
button *g_selectprocessbutton;
button *btndetachall;
button *btnsearchhooks;
button *btnshowsettionwindow;
// button* btnsavehook;
processlistwindow *_processlistwindow = 0;
Settingwindow *settingwindow = 0;
Pluginmanager *plugins;
Hooksearchwindow *hooksearchwindow = 0;
std::atomic<bool> hasstoped = false;
bool on_text_recv(TextThread &thread, std::wstring &sentence);
void on_text_recv_checkissaved(TextThread &thread);
void on_thread_create(TextThread &thread);
void on_thread_delete(TextThread &thread);
2024-03-27 16:36:14 +08:00
void on_proc_connect(DWORD pid);
2024-04-18 16:19:52 +08:00
void on_proc_disconnect(DWORD pid);
2024-07-21 19:28:47 +08:00
void showtext(const std::wstring &text, bool clear);
void updatelisttext(const std::wstring &text, LONG_PTR data);
2024-02-07 20:59:24 +08:00
public:
2024-07-21 19:28:47 +08:00
confighelper *configs;
int64_t currentselect = 0;
bool check_toclipboard;
2024-04-25 15:44:28 +08:00
bool check_toclipboard_selection;
2024-07-21 19:28:47 +08:00
Font uifont;
2024-03-27 16:36:14 +08:00
bool autoattach;
bool autoattach_savedonly;
2024-07-21 19:28:47 +08:00
std::set<std::string> autoattachexes;
std::unordered_map<std::string, nlohmann::json> savedhookcontext;
std::set<int> userdetachedpids;
2024-02-07 20:59:24 +08:00
void on_close();
LunaHost();
2024-02-20 23:24:33 +08:00
friend class Settingwindow;
2024-03-28 19:24:07 +08:00
friend class Hooksearchwindow;
2024-07-21 19:28:47 +08:00
2024-03-27 14:23:36 +08:00
private:
void loadsettings();
void savesettings();
2024-03-27 16:36:14 +08:00
void doautoattach();
2024-02-09 09:25:26 +08:00
};