<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 07/11/2011 11:36, Yuri Momotiuk wrote:
<blockquote
cite="mid:CAOf=PitbOz8regQAqJssuGxn0XS0CPNZZqG7z9jV7AM_Y7c0=A@mail.gmail.com"
type="cite"><br>
<br>
<div class="gmail_quote">2011/7/7 Yuri Momotiuk <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:yurkis@gmail.com">yurkis@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
Hello
<div><br>
</div>
<div>I trying to ctreate port for qsingleapplication library
from qt solutions. It may be useful for turning current
pc-bsd tools to single instance applications. </div>
<div>See port in attachment. This is early version, so it may
contain bugs. Can someone review that port? This is my first
port creation expirience. </div>
<div>Thanks.<br clear="all">
<br>
-- <br>
Best regards, Yuri Momotyuk<br>
</div>
</blockquote>
</div>
<div><br>
</div>
<div>I have just finished prototype of single application
mechanism for pc-controlpanel. I use QtSingleApplication class
from port above. You can try single instance pc-controlpanel
from my assembla repo:</div>
<div><br>
</div>
<div>svn co <a moz-do-not-send="true"
href="http://subversion.assembla.com/svn/pcbsd-extras/trunk/approved/src-qt4">http://subversion.assembla.com/svn/pcbsd-extras/trunk/approved/src-qt4</a></div>
<div><br>
</div>
<div>Don't forget to install qt4-qtsolutions-singleapplication
port from previous message.</div>
<div><br>
</div>
<div>QtSingleApplication has one issue. It can not show window
which is displayed in another workspace. For example: </div>
<div>1. I launch pc-controlpanel on 1st workspace (desktop)</div>
<div>2. I switch to another workspace (for example to 2nd)</div>
<div>3. I launch pc-controlpanel again. Application can see
another instance but window is not shown on 2nd workspace :(</div>
<div><br>
</div>
<div>As workaround I hide window before show it again. Window is
blink but seems it works :(</div>
<div><br>
</div>
<div>To turn pc-controlpanel to single instance I did:</div>
<div><br>
</div>
<div><u>main.cpp:</u></div>
<div><br>
</div>
<div><strong>#include <qtsingleapplication.h></strong><br>
</div>
<div><strong><br>
</strong></div>
<div><strong>...</strong><strong><br>
</strong></div>
<div><br>
</div>
<div>int main(int argc, char *argv[])<br>
{<br>
<em> // Turn application to single instance. Use
QtSingleInstance class</em></div>
<div><strong> QtSingleApplication</strong> a(argc, argv);</div>
<div> <em>// Check for running instance</em><br>
<strong>if (a.isRunning())<br>
{<br>
</strong><em> // If other instance is running- send
message and exit </em></div>
<div><strong> return !(a.sendMessage("show")); <br>
}</strong></div>
<div><strong><br>
</strong></div>
<div><strong>...<br>
</strong></div>
<div><strong><br>
</strong></div>
<div><strong> </strong> MainWnd w;<strong><br>
</strong><em>// Use own function to show window on
message.</em></div>
<div><strong> QObject::connect( &a, SIGNAL(
messageReceived( const QString & ) ),<br>
&w, SLOT( on_SingleInstance( ) ) );<br>
<br>
</strong> w.show();<br>
<br>
return a.exec();<br>
</div>
<div>
}<strong><br>
</strong></div>
<div><br>
</div>
<div><u>mainwnd.h</u></div>
<div><strong>...</strong><strong><br>
</strong></div>
<div><strong> public slots:</strong><strong><br>
</strong><strong> void on_SingleInstance();</strong><u><br>
</u></div>
<div><strong><br>
</strong></div>
<div><u>mainwnd.cpp</u><strong><br>
</strong></div>
<div><u><br>
</u></div>
<div><strong>void MainWnd::on_SingleInstance()<br>
{<br>
</strong><em>// Hide window first. This is workaround to
show window if it on other workspace. Only hide-show sequence
is working for me :(</em></div>
<div><strong> this->hide();<br>
this->showNormal();<br>
this->activateWindow();<br>
this->raise();<br>
}</strong><u><br>
</u></div>
<div><strong><br>
</strong></div>
<div>PS Sorry again for my english. I hope you can understand
this.<strong><br>
</strong></div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Dev@lists.pcbsd.org">Dev@lists.pcbsd.org</a>
<a class="moz-txt-link-freetext" href="http://lists.pcbsd.org/mailman/listinfo/dev">http://lists.pcbsd.org/mailman/listinfo/dev</a>
</pre>
</blockquote>
<br>
This looks really cool :) I'll take a look at the port shortly, and
can commit it if its working OK. This would come in handy for all
our various tools / apps. <br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Kris Moore
PC-BSD Software
iXsystems</pre>
</body>
</html>