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