bugfix for extensions

This commit is contained in:
Akash Mozumdar 2018-07-26 23:16:15 -07:00
parent 41566e68c1
commit 5fbf92bc07
2 changed files with 6 additions and 1 deletions

View File

@ -6,10 +6,12 @@
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <QComboBox>
std::map<int, std::wstring> LoadExtensions(); std::map<int, std::wstring> LoadExtensions();
std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo); std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo);
typedef std::wstring(*ExtensionFunction)(std::wstring, std::unordered_map<std::string, int>&); typedef std::wstring(*ExtensionFunction)(std::wstring, std::unordered_map<std::string, int>&);
extern QComboBox* ttCombo;
#endif // EXTENSIONS_H #endif // EXTENSIONS_H

View File

@ -10,7 +10,10 @@ void HostSignaller::Initialize()
emit AddThread(thread); emit AddThread(thread);
thread->RegisterOutputCallBack([&](TextThread* thread, std::wstring output) thread->RegisterOutputCallBack([&](TextThread* thread, std::wstring output)
{ {
output = DispatchSentenceToExtensions(output, {}); output = DispatchSentenceToExtensions(output,
{
{ "current select", ttCombo->currentText().split(":")[0].toInt() == thread->Number() ? 1 : 0 }
});
emit ThreadOutput(thread, QString::fromWCharArray(output.c_str())); emit ThreadOutput(thread, QString::fromWCharArray(output.c_str()));
return output; return output;
}); });