X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcontrib%2Flibqxt-2007-10-24%2Fexamples%2Frpcpeer%2Fmain.cpp;fp=src%2Fcontrib%2Flibqxt-2007-10-24%2Fexamples%2Frpcpeer%2Fmain.cpp;h=a8d80193a752f1009448b2cc62314078ac29a474;hp=0000000000000000000000000000000000000000;hb=a634acadbcf6017474f68a3eaf7cb632660e9e49;hpb=cd122ca8e0d2c0ffc5397e0a813c75d791a7e6e3 diff --git a/src/contrib/libqxt-2007-10-24/examples/rpcpeer/main.cpp b/src/contrib/libqxt-2007-10-24/examples/rpcpeer/main.cpp new file mode 100644 index 00000000..a8d80193 --- /dev/null +++ b/src/contrib/libqxt-2007-10-24/examples/rpcpeer/main.cpp @@ -0,0 +1,37 @@ +/** ***** QxtRPCPeer demonstration ***** + +This example shows the power of QxtRPCPeer with QxtSemaphore +It shows two QxtSpanSliders, both connected with the range property. +Run this app twice and watch the sliders sync +When QxtnamedPipe is ready, and the improvement to QxtRPCPeer is done, it will be posible to do the same +without actualy blocking a port. + +QxtSemaphore is experimental. Do not kill the app, use the guis close button instead +if you already killed the app, the semaphore might be blocked, try changing it if the app doesn't work. +*/ + +#include +#include +#include +#include + +int main(int argc, char** argv) + { + QxtApplication app(argc,argv); + QxtSpanSlider slider; + QxtRPCPeer peer; + peer.setRPCType(QxtRPCPeer::Peer); + + QxtSemaphore smp("org.libqxt.examples.rpcpeer.singleinstance"); + if(smp.trylock()) + peer.listen ( QHostAddress::LocalHost, 56663); + else + peer.connect ( QHostAddress::LocalHost, 56663); + + peer.attachSignal (&slider, SIGNAL(spanChanged(int,int))); + peer.attachSlot ( "spanChanged",&slider, SLOT(setSpan(int,int))); + + slider.resize(80,200); + slider.show(); + app.exec(); + };