more consistent/organized text

This commit is contained in:
Akash Mozumdar 2018-12-14 22:26:49 -05:00
parent dfb45a3699
commit 97f3f51758
8 changed files with 38 additions and 64 deletions

View File

@ -138,7 +138,7 @@ void ExtenWindow::dropEvent(QDropEvent* event)
void ExtenWindow::on_addButton_clicked() void ExtenWindow::on_addButton_clicked()
{ {
Add(QFileDialog::getOpenFileName(this, SELECT_EXTENSION, "C:\\", EXTENSIONS)); Add(QFileDialog::getOpenFileName(this, SELECT_EXTENSION, "C:\\", EXTENSION_FILES));
} }
void ExtenWindow::on_rmvButton_clicked() void ExtenWindow::on_rmvButton_clicked()

View File

@ -7,6 +7,9 @@
#include "host/util.h" #include "host/util.h"
#include <Psapi.h> #include <Psapi.h>
#include <winhttp.h> #include <winhttp.h>
#include <QFrame>
#include <QLayout>
#include <QPushButton>
#include <QInputDialog> #include <QInputDialog>
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
@ -15,6 +18,23 @@ MainWindow::MainWindow(QWidget *parent) :
extenWindow(new ExtenWindow(this)) extenWindow(new ExtenWindow(this))
{ {
ui->setupUi(this); ui->setupUi(this);
QFrame* processFrame = findChild<QFrame*>("processFrame");
QVBoxLayout* processLayout = findChild<QVBoxLayout*>("processLayout");
for (auto[text, slot] : std::initializer_list<std::tuple<QString, void(MainWindow::*)()>>{
{ ATTACH, &MainWindow::on_attachButton_clicked },
{ DETACH, &MainWindow::on_detachButton_clicked },
{ ADD_HOOK, &MainWindow::on_hookButton_clicked },
{ SAVE_HOOKS, &MainWindow::on_saveButton_clicked },
{ SETTINGS, &MainWindow::on_setButton_clicked },
{ EXTENSIONS, &MainWindow::on_extenButton_clicked }
})
{
QPushButton* button = new QPushButton(processFrame);
connect(button, &QPushButton::clicked, this, slot);
button->setText(text);
processLayout->addWidget(button);
}
processLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
processCombo = findChild<QComboBox*>("processCombo"); processCombo = findChild<QComboBox*>("processCombo");
ttCombo = findChild<QComboBox*>("ttCombo"); ttCombo = findChild<QComboBox*>("ttCombo");

View File

@ -36,11 +36,11 @@
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<item> <item>
<widget class="QFrame" name="processManager"> <widget class="QFrame" name="processFrame">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout" name="processLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -66,55 +66,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="attachButton">
<property name="text">
<string>Attach to game</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="detachButton">
<property name="text">
<string>Detach from game</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="hookButton">
<property name="text">
<string>Add hook</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="saveButton">
<property name="text">
<string>Save hook(s)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="setButton">
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="extenButton">
<property name="text">
<string>Extensions</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -1,6 +1,7 @@
#include "setdialog.h" #include "setdialog.h"
#include "ui_setdialog.h" #include "ui_setdialog.h"
#include "defs.h" #include "defs.h"
#include "text.h"
#include "host/host.h" #include "host/host.h"
#include <QSettings> #include <QSettings>

View File

@ -139,7 +139,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end()); requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end());
if (!sentenceInfo["current select"] && requestTimes.size() > 30) if (!sentenceInfo["current select"] && requestTimes.size() > 30)
{ {
sentence += L"\r\nToo many translation requests: refuse to make more."; sentence += L"\r\nToo many translation requests: refuse to make more";
return true; return true;
} }
} }

View File

@ -143,7 +143,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end()); requestTimes.erase(std::remove_if(requestTimes.begin(), requestTimes.end(), [&](DWORD requestTime) { return GetTickCount() - requestTime > 60 * 1000; }), requestTimes.end());
if (!sentenceInfo["current select"] && requestTimes.size() > 30) if (!sentenceInfo["current select"] && requestTimes.size() > 30)
{ {
sentence += L"\r\nToo many translation requests: refuse to make more."; sentence += L"\r\nToo many translation requests: refuse to make more";
return true; return true;
} }
} }

View File

@ -24,11 +24,4 @@ constexpr auto CONFIG_FILE = u8"Textractor.ini";
constexpr auto HOOK_SAVE_FILE = u8"SavedHooks.txt"; constexpr auto HOOK_SAVE_FILE = u8"SavedHooks.txt";
constexpr auto EXTEN_SAVE_FILE = u8"Extensions.txt"; constexpr auto EXTEN_SAVE_FILE = u8"Extensions.txt";
// Settings
constexpr auto WINDOW = u8"Window";
constexpr auto DEFAULT_CODEPAGE = u8"Default Codepage";
constexpr auto FLUSH_DELAY = u8"Flush Delay";
constexpr auto MAX_BUFFER_SIZE = u8"Max Buffer Size";
// EOF // EOF

View File

@ -1,10 +1,15 @@
#pragma once #pragma once
#define CURRENT_VERSION "3.6.0" #define CURRENT_VERSION "3.6.0"
constexpr auto ATTACH = u8"Attach to game";
constexpr auto DETACH = u8"Detach from game";
constexpr auto ADD_HOOK = u8"Add hook";
constexpr auto SAVE_HOOKS = u8"Save hook(s)";
constexpr auto SETTINGS = u8"Settings";
constexpr auto EXTENSIONS = u8"Extensions";
constexpr auto SELECT_PROCESS = u8"Select Process"; constexpr auto SELECT_PROCESS = u8"Select Process";
constexpr auto ATTACH_INFO = u8"If you don't see the process you want to attach, try running with admin rights\r\n" constexpr auto ATTACH_INFO = u8"If you don't see the process you want to attach, try running with admin rights\r\n"
"You can also type in the process id"; "You can also type in the process id";
constexpr auto ADD_HOOK = u8"Add hook";
constexpr auto CODE_INFODUMP = u8"Enter hook code\r\n" constexpr auto CODE_INFODUMP = u8"Enter hook code\r\n"
"/H{A|B|W|S|Q|V}[N][codepage#]data_offset[*deref_offset1][:split_offset[*deref_offset2]]@addr[:module[:func]]\r\n" "/H{A|B|W|S|Q|V}[N][codepage#]data_offset[*deref_offset1][:split_offset[*deref_offset2]]@addr[:module[:func]]\r\n"
"OR\r\n" "OR\r\n"
@ -20,7 +25,11 @@ constexpr auto CODE_INFODUMP = u8"Enter hook code\r\n"
constexpr auto UNHOOK = u8"Unhook"; constexpr auto UNHOOK = u8"Unhook";
constexpr auto REMOVE_HOOK = u8"Which hook to remove?"; constexpr auto REMOVE_HOOK = u8"Which hook to remove?";
constexpr auto SELECT_EXTENSION = u8"Select Extension"; constexpr auto SELECT_EXTENSION = u8"Select Extension";
constexpr auto EXTENSIONS = u8"Extensions (*.dll)"; constexpr auto EXTENSION_FILES = u8"Extensions (*.dll)";
constexpr auto WINDOW = u8"Window";
constexpr auto DEFAULT_CODEPAGE = u8"Default Codepage";
constexpr auto FLUSH_DELAY = u8"Flush Delay";
constexpr auto MAX_BUFFER_SIZE = u8"Max Buffer Size";
constexpr auto ABOUT = L"Textractor beta v" CURRENT_VERSION " (project homepage: https://github.com/Artikash/Textractor)\r\n" constexpr auto ABOUT = L"Textractor beta v" CURRENT_VERSION " (project homepage: https://github.com/Artikash/Textractor)\r\n"
"Made by me: Artikash (email: akashmozumdar@gmail.com)\r\n" "Made by me: Artikash (email: akashmozumdar@gmail.com)\r\n"
"Please contact me with any problems, feature requests, or questions relating to Textractor\r\n" "Please contact me with any problems, feature requests, or questions relating to Textractor\r\n"