Skip to content

Commit

Permalink
WIP: Separate client and server proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Holecek <hluk@email.cz>
  • Loading branch information
hluk committed May 8, 2020
1 parent a80d035 commit c515975
Show file tree
Hide file tree
Showing 10 changed files with 567 additions and 792 deletions.
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Expand Up @@ -8,6 +8,10 @@ file(GLOB copyq_SOURCES
scriptable/*.cpp
scriptable/proxy/scriptableproxy.h
scriptable/proxy/scriptableproxy.cpp
scriptable/proxy/scriptableproxy-client.h
scriptable/proxy/scriptableproxy-client.cpp
scriptable/proxy/scriptableproxy-common.h
scriptable/proxy/scriptableproxy-common.cpp
../qt/*.cpp
)

Expand Down Expand Up @@ -215,6 +219,8 @@ file(GLOB copyq_SOURCES
scriptable/*.cpp
scriptable/proxy/scriptableproxy-client.h
scriptable/proxy/scriptableproxy-client.cpp
scriptable/proxy/scriptableproxy-common.h
scriptable/proxy/scriptableproxy-common.cpp
../qt/*.cpp
)
set(copyq_qt_modules Script Gui Widgets Network)
Expand Down
12 changes: 6 additions & 6 deletions src/app/clipboardclient.cpp
Expand Up @@ -134,7 +134,7 @@ void ClipboardClient::onConnectionFailed()
void ClipboardClient::start(const QStringList &arguments)
{
QScriptEngine engine;
ScriptableProxy scriptableProxy(nullptr, nullptr);
ScriptableProxyClient scriptableProxy;
Scriptable scriptable(&engine, &scriptableProxy);

const auto serverName = clipboardServerName();
Expand All @@ -147,21 +147,21 @@ void ClipboardClient::start(const QStringList &arguments)
connect( &socket, &ClientSocket::connectionFailed,
this, &ClipboardClient::onConnectionFailed );

connect( &scriptableProxy, &ScriptableProxy::sendMessage,
connect( &scriptableProxy, &ScriptableProxyClient::sendMessage,
&socket, &ClientSocket::sendMessage );

connect( this, &ClipboardClient::functionCallResultReceived,
&scriptableProxy, &ScriptableProxy::setFunctionCallReturnValue );
&scriptableProxy, &ScriptableProxyClient::setFunctionCallReturnValue );
connect( this, &ClipboardClient::inputDialogFinished,
&scriptableProxy, &ScriptableProxy::setInputDialogResult );
&scriptableProxy, &ScriptableProxyClient::setInputDialogResult );

connect( &socket, &ClientSocket::disconnected,
&scriptable, &Scriptable::abort );
connect( &socket, &ClientSocket::disconnected,
&scriptableProxy, &ScriptableProxy::clientDisconnected );
&scriptableProxy, &ScriptableProxyClient::clientDisconnected );

connect( &scriptable, &Scriptable::finished,
&scriptableProxy, &ScriptableProxy::clientDisconnected );
&scriptableProxy, &ScriptableProxyClient::clientDisconnected );

connect( this, &ClipboardClient::dataReceived,
&scriptable, &Scriptable::dataReceived, Qt::QueuedConnection );
Expand Down

0 comments on commit c515975

Please sign in to comment.