Ok, the long awaited config wizard is here (at least in a very basic state). There...
[quassel.git] / src / contrib / libqxt-2007-10-24 / examples / rpcpeer / main.cpp
1 /** ***** QxtRPCPeer demonstration *****
2
3 This example shows the power of QxtRPCPeer with QxtSemaphore
4 It shows two QxtSpanSliders, both connected with the range property.
5 Run this app twice and watch the sliders sync
6 When QxtnamedPipe is ready, and the improvement to QxtRPCPeer is done, it will be posible to do the same 
7 without actualy blocking a port.
8
9 QxtSemaphore is experimental. Do not kill the app, use the guis close button instead
10 if you already killed the app, the semaphore might be blocked, try changing it if the app doesn't work.
11 */
12
13 #include <QxtApplication>
14 #include <QxtRPCPeer>
15 #include <QxtSpanSlider>
16 #include <QxtSemaphore>
17
18 int main(int argc, char** argv)
19         {
20         QxtApplication app(argc,argv);
21         QxtSpanSlider slider;
22         QxtRPCPeer peer;
23         peer.setRPCType(QxtRPCPeer::Peer);
24
25         QxtSemaphore smp("org.libqxt.examples.rpcpeer.singleinstance");
26         if(smp.trylock())
27                 peer.listen ( QHostAddress::LocalHost, 56663);  
28         else
29                 peer.connect ( QHostAddress::LocalHost, 56663);
30
31         peer.attachSignal (&slider, SIGNAL(spanChanged(int,int)));
32         peer.attachSlot ( "spanChanged",&slider, SLOT(setSpan(int,int))); 
33
34         slider.resize(80,200);
35         slider.show();
36         app.exec();
37         };