diff --git a/GUI/host/textthread.cc b/GUI/host/textthread.cc index 151ad20..a36bdd3 100644 --- a/GUI/host/textthread.cc +++ b/GUI/host/textthread.cc @@ -27,7 +27,7 @@ void TextThread::Flush() std::wstring sentence; { LOCK(ttMutex); - if (buffer.size() < 400 && (GetTickCount() - timestamp < flushDelay || buffer.size() == 0)) return; // TODO: let user change delay before sentence is flushed + if (buffer.size() < 400 && (GetTickCount() - timestamp < FlushDelay || buffer.size() == 0)) return; if (status & USING_UNICODE) sentence = std::wstring((wchar_t*)buffer.data(), buffer.size() / 2); else sentence = ToWString(buffer.data(), status & USING_UTF8 ? CP_UTF8 : SHIFT_JIS); buffer.clear(); diff --git a/GUI/host/textthread.h b/GUI/host/textthread.h index f00c61d..f217de1 100644 --- a/GUI/host/textthread.h +++ b/GUI/host/textthread.h @@ -24,7 +24,7 @@ public: const std::wstring name; const ThreadParam tp; - inline static unsigned flushDelay = 250; // flush every 250ms by default + inline static unsigned FlushDelay = 250; // flush every 250ms by default private: void Flush(); diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index fce32e2..d753b48 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -5,6 +5,7 @@ #include #include #include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -12,12 +13,10 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); - QFile settings("NHWindow"); - settings.open(QIODevice::ReadOnly); - QDataStream reader(&settings); - QRect rect; - reader >> rect; - if (rect.bottom()) this->setGeometry(rect); + QSettings settings("NextHooker.ini", QSettings::IniFormat); + if (settings.contains("Window")) this->setGeometry(settings.value("Window").toRect()); + // TODO: add GUI for changing this + if (settings.contains("Flush_Delay")) TextThread::FlushDelay = settings.value("Flush Delay").toUInt(); processCombo = findChild("processCombo"); ttCombo = findChild("ttCombo"); @@ -42,10 +41,10 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { - QFile settings("NHWindow"); - settings.open(QIODevice::ReadWrite | QIODevice::Truncate); - QDataStream writer(&settings); - writer << this->geometry(); + QSettings settings("NextHooker.ini", QSettings::IniFormat); + settings.setValue("Window", this->geometry()); + settings.setValue("Flush_Delay", TextThread::FlushDelay); + settings.sync(); Host::Close(); delete ui; } @@ -118,11 +117,12 @@ void MainWindow::ThreadOutput(TextThread* thread, QString output) QString MainWindow::TextThreadString(TextThread* thread) { ThreadParam tp = thread->tp; - return QString("%1:%2:%3:%4: ").arg( + return QString("%1:%2:%3:%4:%5: ").arg( QString::number(tp.pid), QString::number(tp.hook, 16), QString::number(tp.retn, 16), - QString::number(tp.spl, 16) + QString::number(tp.spl, 16), + QString::number((int64_t)thread, 16) ).toUpper(); }