No idea what this is doing, seems to allow recorder instance to not block further engine starts while it is doing its job.
authorunc0rr
Wed, 18 Dec 2013 01:05:15 +0400
changeset 9800 169fbb968bb3
parent 9797 1fdc1507e42d
child 9802 00216d609140
No idea what this is doing, seems to allow recorder instance to not block further engine starts while it is doing its job.
QTfrontend/net/recorder.cpp
QTfrontend/net/recorder.h
QTfrontend/net/tcpBase.cpp
QTfrontend/net/tcpBase.h
--- a/QTfrontend/net/recorder.cpp	Sun Dec 15 14:05:42 2013 -0500
+++ b/QTfrontend/net/recorder.cpp	Wed Dec 18 01:05:15 2013 +0400
@@ -143,3 +143,8 @@
 
     return arguments;
 }
+
+bool HWRecorder::simultaneousRun()
+{
+    return true;
+}
--- a/QTfrontend/net/recorder.h	Sun Dec 15 14:05:42 2013 -0500
+++ b/QTfrontend/net/recorder.h	Wed Dec 18 01:05:15 2013 +0400
@@ -35,6 +35,7 @@
         virtual ~HWRecorder();
 
         void EncodeVideo(const QByteArray & record);
+        bool simultaneousRun();
 
         VideoItem * item; // used by pagevideos
         QString name;
--- a/QTfrontend/net/tcpBase.cpp	Sun Dec 15 14:05:42 2013 -0500
+++ b/QTfrontend/net/tcpBase.cpp	Wed Dec 18 01:05:15 2013 +0400
@@ -80,6 +80,7 @@
     QObject(parent),
     m_hasStarted(false),
     m_isDemoMode(demoMode),
+    m_connected(false),
     IPCSocket(0)
 {
     if(!IPCServer)
@@ -103,12 +104,23 @@
         // connection should be already finished
         return;
     }
+
     disconnect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
     IPCSocket = IPCServer->nextPendingConnection();
+
     if(!IPCSocket) return;
+
+    m_connected = true;
+
     connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
     connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
     SendToClientFirst();
+
+    if(simultaneousRun())
+    {
+        srvsList.removeOne(this);
+        emit isReadyNow();
+    }
 }
 
 void TCPBase::RealStart()
@@ -149,7 +161,8 @@
     disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
     onClientDisconnect();
 
-    emit isReadyNow();
+    if(!simultaneousRun())
+        emit isReadyNow();
     IPCSocket->deleteLater();
 
     deleteLater();
@@ -188,6 +201,7 @@
         TCPBase * last = srvsList.last();
         if(couldCancelPreviousRequest
             && last->couldBeRemoved()
+            && (last->isConnected() || !last->hasStarted())
             && (last->parent() == parent()))
         {
             srvsList.removeLast();
@@ -195,7 +209,7 @@
             Start(couldCancelPreviousRequest);
         } else
         {
-            connect(srvsList.last(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
+            connect(last, SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
             srvsList.push_back(this);
         }
     }
@@ -246,3 +260,18 @@
 {
     return false;
 }
+
+bool TCPBase::isConnected()
+{
+    return m_connected;
+}
+
+bool TCPBase::simultaneousRun()
+{
+    return false;
+}
+
+bool TCPBase::hasStarted()
+{
+    return m_hasStarted;
+}
--- a/QTfrontend/net/tcpBase.h	Sun Dec 15 14:05:42 2013 -0500
+++ b/QTfrontend/net/tcpBase.h	Wed Dec 18 01:05:15 2013 +0400
@@ -42,6 +42,9 @@
         virtual ~TCPBase();
 
         virtual bool couldBeRemoved();
+        virtual bool simultaneousRun();
+        bool isConnected();
+        bool hasStarted();
 
     signals:
         void isReadyNow();
@@ -69,6 +72,7 @@
         static QPointer<QTcpServer> IPCServer;
 
         bool m_isDemoMode;
+        bool m_connected;
         void RealStart();
         QPointer<QTcpSocket> IPCSocket;