logic: more wstring usages

* removed header paths from VS Project setup message since VS doesn't send these anymore
* implemented using wstring in IDE communication
* fixed retrieving filepaths from QtDirectoryListbox that contain special characters
* use wstring for source extensions
* added special character as file extension to FileManagerTestSuite
This commit is contained in:
mlangkabel
2018-01-30 17:07:51 +01:00
parent 471b1757df
commit c99e79364f
46 changed files with 319 additions and 337 deletions
@@ -45,7 +45,7 @@ bool QtIDECommunicationController::isListening() const
return m_tcpWrapper.isListening();
}
void QtIDECommunicationController::sendMessage(const std::string& message) const
void QtIDECommunicationController::sendMessage(const std::wstring& message) const
{
m_tcpWrapper.sendMessage(message);
}
@@ -23,7 +23,7 @@ public:
virtual bool isListening() const;
private:
virtual void sendMessage(const std::string& message) const;
virtual void sendMessage(const std::wstring& message) const;
QtTcpWrapper m_tcpWrapper;
+5 -7
View File
@@ -43,10 +43,9 @@ QtTcpWrapper::~QtTcpWrapper()
}
}
void QtTcpWrapper::sendMessage(const std::string& message) const
void QtTcpWrapper::sendMessage(const std::wstring& message) const
{
QByteArray data;
data.append(message.c_str());
QByteArray data = QString::fromStdWString(message).toUtf8();
QTcpSocket socket;
socket.connectToHost(QHostAddress::LocalHost, m_clientPort);
@@ -60,7 +59,7 @@ void QtTcpWrapper::sendMessage(const std::string& message) const
}
}
void QtTcpWrapper::setReadCallback(const std::function<void(const std::string&)>& callback)
void QtTcpWrapper::setReadCallback(const std::function<void(const std::wstring&)>& callback)
{
m_readCallback = callback;
}
@@ -110,12 +109,11 @@ void QtTcpWrapper::startRead()
QString string;
stream >> string;*/
QString string = QString::fromUtf8(byteArray);
QString message = QString::fromUtf8(byteArray);
if (m_readCallback != NULL)
{
std::string message = string.toStdString();
m_readCallback(message);
m_readCallback(message.toStdWString());
}
/*char buffer[1024] = { 0 };
+3 -3
View File
@@ -19,9 +19,9 @@ public:
void startListening();
void stopListening();
void sendMessage(const std::string& message) const;
void sendMessage(const std::wstring& message) const;
void setReadCallback(const std::function<void(const std::string&)>& callback);
void setReadCallback(const std::function<void(const std::wstring&)>& callback);
quint16 getServerPort() const;
void setServerPort(const quint16 serverPort);
@@ -42,7 +42,7 @@ private:
quint16 m_clientPort;
std::string m_ip;
std::function<void(const std::string&)> m_readCallback;
std::function<void(const std::wstring&)> m_readCallback;
QTcpServer* m_tcpServer;
QTcpSocket* m_tcpClient;