Revision
14212
Author
jmesquita
Date
2009-07-13 01:01:22 -0500 (Mon, 13 Jul 2009)

Log Message

We are trying to cleanup right a QThread.

Modified Paths

Diff

Modified: freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.cpp (14211 => 14212)


--- freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.cpp	2009-07-13 04:29:55 UTC (rev 14211)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.cpp	2009-07-13 06:01:22 UTC (rev 14212)
@@ -1,6 +1,5 @@
 #include "esl_oop.h"
 #include "esl_connection.h"
-#include <iostream>
 
 eslConnectionManager::eslConnectionManager() {}
 eslConnectionManager::eslConnectionManager(QString host, QString pass, QString port)
@@ -10,11 +9,6 @@
     start();
 }
 
-eslConnectionManager::~eslConnectionManager()
-{
-    doDisconnect();
-}
-
 void eslConnectionManager::doConnect(QString host, QString pass, QString port)
 {
     connection = new ESLconnection(host.toAscii(), port.toAscii(), pass.toAscii());
@@ -24,7 +18,7 @@
 
 void eslConnectionManager::doDisconnect()
 {
-    delete connection;
+	connection->disconnect();
 }
 
 void eslConnectionManager::run()
@@ -52,10 +46,5 @@
                 emit gotEvent(e);
             }
          }
-        else
-        {
-            doDisconnect();
-            break;
-        }
     }
 }

Modified: freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.h (14211 => 14212)


--- freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.h	2009-07-13 04:29:55 UTC (rev 14211)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.h	2009-07-13 06:01:22 UTC (rev 14212)
@@ -13,7 +13,6 @@
     Q_DISABLE_COPY(eslConnectionManager)
 public:
     eslConnectionManager();
-    virtual ~eslConnectionManager();
     eslConnectionManager(QString,QString,QString);
     void doConnect(QString, QString, QString);
     void doDisconnect();

Modified: freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.cpp (14211 => 14212)


--- freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.cpp	2009-07-13 04:29:55 UTC (rev 14211)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.cpp	2009-07-13 06:01:22 UTC (rev 14212)
@@ -13,12 +13,12 @@
     // Set the default status bar message
     m_ui->statusBar->showMessage(tr("Ready"));
 
-    connect(m_ui->actionConnect, SIGNAL(triggered())
-            , serverDialog, SLOT(show()));
+    connect(m_ui->actionConnect, SIGNAL(triggered()),
+            serverDialog, SLOT(show()));
     connect(serverDialog, SIGNAL(doConnect(QString,QString,QString)),
             this, SLOT(newConnectionFromDialog(QString,QString,QString)));
+}
 
-    }
 Cfsgui::~Cfsgui()
 {
     delete m_ui;
@@ -30,15 +30,24 @@
     m_ui->textConsole->append(text);
 }
 
+void Cfsgui::getDisconnectedSlot()
+{
+    delete eslConnection;
+}
+
 void Cfsgui::gotConnectedSlot()
 {
     m_ui->statusBar->showMessage("Connected");
     appendConsoleText("Conneted!");
+    m_ui->actionConnect->setDisabled(true);
+    m_ui->actionDisconnect->setEnabled(true);
 }
 void Cfsgui::gotDisconnectedSlot()
 {
     appendConsoleText("Disconnected!");
     m_ui->textConsole->append("Conneted!");
+    m_ui->actionConnect->setEnabled(true);
+    m_ui->actionDisconnect->setDisabled(true);
 }
 
 void Cfsgui::gotEventSlot(ESLevent * event)
@@ -88,4 +97,7 @@
             this, SLOT(gotDisconnectedSlot(void)));
     connect(eslConnection, SIGNAL(gotEvent(ESLevent*)),
             this, SLOT(gotEventSlot(ESLevent*)));
+    /* Connect the disconnect menu */
+    connect(m_ui->actionDisconnect, SIGNAL(triggered()),
+            this, SLOT(getDisconnectedSlot()));
 }

Modified: freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.h (14211 => 14212)


--- freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.h	2009-07-13 04:29:55 UTC (rev 14211)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.h	2009-07-13 06:01:22 UTC (rev 14212)
@@ -28,6 +28,7 @@
     void gotConnectedSlot();
     void gotDisconnectedSlot();
     void gotEventSlot(ESLevent *);
+    void getDisconnectedSlot();
 
 private:
     Ui::Cfsgui *m_ui;

Modified: freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.ui (14211 => 14212)


--- freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.ui	2009-07-13 04:29:55 UTC (rev 14211)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.ui	2009-07-13 06:01:22 UTC (rev 14212)
@@ -58,7 +58,7 @@
      <x>0</x>
      <y>0</y>
      <width>600</width>
-     <height>26</height>
+     <height>22</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
@@ -66,6 +66,7 @@
      <string>&amp;File</string>
     </property>
     <addaction name="actionConnect"/>
+    <addaction name="actionDisconnect"/>
     <addaction name="separator"/>
     <addaction name="actionQuit"/>
    </widget>
@@ -101,6 +102,17 @@
     <string>Ctrl+C</string>
    </property>
   </action>
+  <action name="actionDisconnect">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>&amp;Disconnect</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+D</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <tabstops>