yeah...that was never a class. improve performance and add current process function
This commit is contained in:
parent
49432f689d
commit
fcb525df36
@ -5,7 +5,7 @@
|
||||
|
||||
namespace Host
|
||||
{
|
||||
using ProcessEventHandler = std::function<void(DWORD)>;
|
||||
using ProcessEventHandler = void(*)(DWORD);
|
||||
using ThreadEventHandler = std::function<void(TextThread&)>;
|
||||
using HookEventHandler = std::function<void(HookParam, std::wstring text)>;
|
||||
void Start(ProcessEventHandler Connect, ProcessEventHandler Disconnect, ThreadEventHandler Create, ThreadEventHandler Destroy, TextThread::OutputCallback Output);
|
||||
|
@ -77,7 +77,7 @@ void TextThread::Flush()
|
||||
if (storage->size() > maxHistorySize) storage->erase(0, storage->size() - maxHistorySize); // https://github.com/Artikash/Textractor/issues/127#issuecomment-486882983
|
||||
}
|
||||
|
||||
std::deque<std::wstring> sentences;
|
||||
std::vector<std::wstring> sentences;
|
||||
queuedSentences->swap(sentences);
|
||||
int totalSize = 0;
|
||||
for (auto& sentence : sentences)
|
||||
|
@ -6,7 +6,7 @@
|
||||
class TextThread
|
||||
{
|
||||
public:
|
||||
using OutputCallback = std::function<bool(TextThread&, std::wstring&)>;
|
||||
using OutputCallback = bool(*)(TextThread&, std::wstring&);
|
||||
inline static OutputCallback Output;
|
||||
|
||||
inline static bool filterRepetition = true;
|
||||
@ -37,7 +37,7 @@ private:
|
||||
std::unordered_set<wchar_t> repeatingChars;
|
||||
std::mutex bufferMutex;
|
||||
DWORD lastPushTime = 0;
|
||||
Synchronized<std::deque<std::wstring>> queuedSentences;
|
||||
Synchronized<std::vector<std::wstring>> queuedSentences;
|
||||
struct TimerDeleter { void operator()(HANDLE h) { DeleteTimerQueueTimer(NULL, h, INVALID_HANDLE_VALUE); } };
|
||||
AutoHandle<TimerDeleter> timer = NULL;
|
||||
};
|
||||
|
1036
GUI/mainwindow.cpp
1036
GUI/mainwindow.cpp
File diff suppressed because it is too large
Load Diff
@ -1,56 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "qtcommon.h"
|
||||
#include "extenwindow.h"
|
||||
#include "host/host.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
inline static constexpr auto HOOK_SAVE_FILE = u8"SavedHooks.txt";
|
||||
inline static constexpr auto GAME_SAVE_FILE = u8"SavedGames.txt";
|
||||
|
||||
void closeEvent(QCloseEvent*) override;
|
||||
void ProcessConnected(DWORD processId);
|
||||
void ProcessDisconnected(DWORD processId);
|
||||
void ThreadAdded(TextThread& thread);
|
||||
void ThreadRemoved(TextThread& thread);
|
||||
bool SentenceReceived(TextThread& thread, std::wstring& sentence);
|
||||
void OutputContextMenu(QPoint point);
|
||||
QString TextThreadString(TextThread& thread);
|
||||
ThreadParam ParseTextThreadString(QString ttString);
|
||||
DWORD GetSelectedProcessId();
|
||||
std::array<InfoForExtension, 10> GetSentenceInfo(TextThread& thread);
|
||||
std::optional<std::wstring> UserSelectedProcess();
|
||||
void AttachProcess();
|
||||
void LaunchProcess();
|
||||
void DetachProcess();
|
||||
void ForgetProcess();
|
||||
void AddHook();
|
||||
void AddHook(QString hook);
|
||||
void RemoveHooks();
|
||||
void SaveHooks();
|
||||
void FindHooks();
|
||||
void Settings();
|
||||
void Extensions();
|
||||
void ViewThread(int index);
|
||||
void SetOutputFont(QString font);
|
||||
|
||||
Ui::MainWindow* ui;
|
||||
ExtenWindow* extenWindow;
|
||||
std::unordered_set<DWORD> alreadyAttached;
|
||||
bool autoAttach = false, autoAttachSavedOnly = true;
|
||||
bool showSystemProcesses = false;
|
||||
uint64_t savedThreadCtx = 0, savedThreadCtx2 = 0;
|
||||
wchar_t savedThreadCode[1000] = {};
|
||||
TextThread* current = nullptr;
|
||||
void closeEvent(QCloseEvent*);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user