communicationthread.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. = StarPU-Top for StarPU =
  3. Copyright (C) 2011
  4. William Braik
  5. Yann Courtois
  6. Jean-Marie Couteyen
  7. Anthony Roy
  8. This library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Lesser General Public
  10. License as published by the Free Software Foundation; either
  11. version 2.1 of the License, or (at your option) any later version.
  12. This library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. Lesser General Public License for more details.
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with this library; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef COMMUNICATIONTHREAD_H
  21. #define COMMUNICATIONTHREAD_H
  22. class MainWindow;
  23. class ConfigurationManager;
  24. class CommunicationManager;
  25. #include <QThread>
  26. #include <QProcess>
  27. #include <QTcpSocket>
  28. class CommunicationThread : public QThread
  29. {
  30. Q_OBJECT
  31. public:
  32. CommunicationThread(
  33. MainWindow *mainWindow,
  34. ConfigurationManager *configurationManager);
  35. ~CommunicationThread();
  36. // Thread execution loop
  37. void run();
  38. private:
  39. // Linked components
  40. MainWindow *_mainWindow;
  41. ConfigurationManager *_configurationManager;
  42. CommunicationManager *_communicationManager;
  43. QProcess * _SSHProcess;
  44. int _connectionAttemptsCount;
  45. void createNewCommunicationManager(void);
  46. private slots:
  47. void connectionError(QAbstractSocket::SocketError error);
  48. void connectionSucceeded();
  49. void connectionDisconnected();
  50. signals:
  51. void SocketError(QAbstractSocket::SocketError);
  52. void progress(QString message);
  53. void abort(QString message);
  54. void disconnected();
  55. };
  56. #endif // COMMUNICATIONTHREAD_H