mirror of
https://github.com/QuasarApp/Patronum.git
synced 2025-04-26 15:44:32 +00:00
fix echo
This commit is contained in:
parent
063ff4ece3
commit
d493203b20
@ -94,6 +94,8 @@ bool Controller::sendStop() {
|
||||
if (!d_ptr)
|
||||
return false;
|
||||
|
||||
d_ptr->setEcho(false);
|
||||
|
||||
if (!d_ptr->connectToHost(false)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -104,6 +104,11 @@ bool ControllerPrivate::connectToHost(bool echo) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ControllerPrivate::setEcho(bool echo) {
|
||||
if (_socket)
|
||||
_socket->setEcho(echo);
|
||||
}
|
||||
|
||||
void ControllerPrivate::handleReceve(QByteArray data) {
|
||||
|
||||
if (!_controller) {
|
||||
|
@ -32,6 +32,8 @@ public:
|
||||
bool isConnected() const;
|
||||
bool connectToHost(bool echo = true) const;
|
||||
|
||||
void setEcho(bool echo);
|
||||
|
||||
signals:
|
||||
void sigListFeatures(QList<Feature>);
|
||||
|
||||
|
@ -9,8 +9,19 @@
|
||||
|
||||
namespace Patronum {
|
||||
|
||||
ISocketWraper::ISocketWraper(){
|
||||
}
|
||||
|
||||
State ISocketWraper::state() const {
|
||||
return m_state;
|
||||
}
|
||||
|
||||
bool ISocketWraper::echo() const {
|
||||
return _echo;
|
||||
}
|
||||
|
||||
void ISocketWraper::setEcho(bool newEcho) {
|
||||
_echo = newEcho;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ enum class State: int {
|
||||
class ISocketWraper
|
||||
{
|
||||
public:
|
||||
ISocketWraper(){};
|
||||
ISocketWraper();
|
||||
/**
|
||||
* @brief send - send data to service
|
||||
* @param data
|
||||
@ -68,8 +68,12 @@ public:
|
||||
|
||||
State state() const;
|
||||
|
||||
bool echo() const;
|
||||
void setEcho(bool newEcho);
|
||||
|
||||
protected:
|
||||
State m_state = State::Disconeccted;
|
||||
bool _echo = true;
|
||||
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
namespace Patronum {
|
||||
|
||||
LocalSocket::LocalSocket(const QString &target, QObject *ptr):
|
||||
QObject(ptr) {
|
||||
QObject(ptr), ISocketWraper() {
|
||||
m_target = "P" + target;
|
||||
}
|
||||
|
||||
@ -132,6 +132,9 @@ void LocalSocket::handleIncomming() {
|
||||
|
||||
void LocalSocket::handleSocketError(QLocalSocket::LocalSocketError) {
|
||||
|
||||
if (!_echo)
|
||||
return;
|
||||
|
||||
auto _sender = dynamic_cast<QLocalSocket*>(sender());
|
||||
|
||||
if (!_sender) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user