|
7 | 7 |
|
8 | 8 | #include <spdlog/spdlog.h> |
9 | 9 | #include <string> |
| 10 | +#include <wx/string.h> |
10 | 11 |
|
11 | 12 | MainFrame::MainFrame(const wxString& title) : wxFrame(nullptr, wxID_ANY, title) { |
12 | 13 | m_panel = new wxPanel(this, wxID_ANY); |
@@ -109,23 +110,24 @@ void MainFrame::OnEnterPress(wxCommandEvent& event) { |
109 | 110 | if (m_messageField->IsEmpty()) { |
110 | 111 | return; |
111 | 112 | } |
112 | | - auto text = m_messageField->GetValue(); |
113 | | - if (!Speech::GetInstance().speak(text.ToUTF8().data())) { |
| 113 | + wxString messageText = m_messageField->GetValue(); |
| 114 | + std::string text = std::string(messageText.utf8_str()); |
| 115 | + if (!Speech::GetInstance().speak(text.c_str())) { |
114 | 116 | wxMessageBox("This voice either does not work with the program or crashes it. Please select another voice.", |
115 | 117 | "Error! The selected SAPI voice is not supported.", 5L, m_panel); |
116 | 118 | } |
117 | | - g_HistoryStorage.push(text.ToStdString()); |
| 119 | + g_HistoryStorage.push(text); |
118 | 120 | m_messageField->Clear(); |
119 | 121 | } |
120 | 122 |
|
121 | 123 | void MainFrame::OnMessageFieldKeyDown(wxKeyEvent& event) { |
122 | | - auto text = m_messageField->GetValue().ToStdString(); |
| 124 | + std::string text = std::string(m_messageField->GetValue().utf8_str()); |
123 | 125 | switch (event.GetKeyCode()) { |
124 | 126 | case WXK_UP: |
125 | | - m_messageField->SetValue(g_HistoryStorage.getPreviousByText(text)); |
| 127 | + m_messageField->SetValue(wxString::FromUTF8(g_HistoryStorage.getPreviousByText(text))); |
126 | 128 | break; |
127 | 129 | case WXK_DOWN: |
128 | | - m_messageField->SetValue(g_HistoryStorage.getNextByText(text)); |
| 130 | + m_messageField->SetValue(wxString::FromUTF8(g_HistoryStorage.getNextByText(text))); |
129 | 131 | break; |
130 | 132 | } |
131 | 133 | event.Skip(); |
|
0 commit comments