tiny refactors
This commit is contained in:
parent
36ad3aa05d
commit
651cd486eb
@ -12,11 +12,10 @@ SetDialog::SetDialog(QWidget* parent) :
|
|||||||
|
|
||||||
QFormLayout* layout = findChild<QFormLayout*>("layout");
|
QFormLayout* layout = findChild<QFormLayout*>("layout");
|
||||||
|
|
||||||
using Bindable = std::tuple<QSpinBox*&, int, const char*>;
|
for (auto[spinBox, value, label] : std::initializer_list<std::tuple<QSpinBox*&, int, const char*>>{
|
||||||
for (auto[spinBox, value, label] : {
|
{ flushDelay, TextThread::flushDelay, FLUSH_DELAY },
|
||||||
Bindable{ flushDelay, TextThread::flushDelay, FLUSH_DELAY },
|
{ maxBufferSize, TextThread::maxBufferSize, MAX_BUFFER_SIZE },
|
||||||
Bindable{ maxBufferSize, TextThread::maxBufferSize, MAX_BUFFER_SIZE },
|
{ defaultCodepage, TextThread::defaultCodepage, DEFAULT_CODEPAGE }
|
||||||
Bindable{ defaultCodepage, TextThread::defaultCodepage, DEFAULT_CODEPAGE }
|
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
spinBox = new QSpinBox(this);
|
spinBox = new QSpinBox(this);
|
||||||
|
@ -188,7 +188,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
|||||||
wchar_t wbuffer[10000] = {};
|
wchar_t wbuffer[10000] = {};
|
||||||
MultiByteToWideChar(CP_UTF8, 0, buffer, -1, wbuffer, 10000);
|
MultiByteToWideChar(CP_UTF8, 0, buffer, -1, wbuffer, 10000);
|
||||||
std::wstring response(wbuffer);
|
std::wstring response(wbuffer);
|
||||||
for (std::wsmatch results; std::regex_search(response, results, std::wregex(L"\\[\"(.*?)\",[n\"]")); response = results.suffix().str())
|
for (std::wsmatch results; std::regex_search(response, results, std::wregex(L"\\[\"(.*?)\",[n\"]")); response = results.suffix())
|
||||||
translation += std::wstring(results[1]) + L" ";
|
translation += std::wstring(results[1]) + L" ";
|
||||||
for (auto& c : translation) if (c == L'\\') c = 0x200b;
|
for (auto& c : translation) if (c == L'\\') c = 0x200b;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user