qmlhandler.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef QMLHANDLER_H
  2. #define QMLHANDLER_H
  3. #include <QDebug>
  4. #include <QObject>
  5. #include <QUrl>
  6. #include <string>
  7. class QMLHandler : public QObject {
  8. Q_OBJECT
  9. private:
  10. void handleJSON(std::string buffer);
  11. void readPipeLoop();
  12. public:
  13. explicit QMLHandler(QObject *parent = 0);
  14. void onExit();
  15. // C++ -> QML
  16. signals:
  17. // Sending
  18. void sendingSetFileUrlText(QString signalText);
  19. void sendingEnableSendButton();
  20. void sendingDisableSendButton();
  21. // Receiving
  22. void receivingClearFileList();
  23. void receivingListFile(QString fileName);
  24. // Messages
  25. void message(QString msg);
  26. // Settings
  27. void settingsOpenSwitchServerPopup();
  28. // Ip Popup
  29. // Switch Popup
  30. // Footer
  31. void log(QString logText);
  32. void footerSetStatus(QString status);
  33. // QML -> C++
  34. public slots:
  35. // Sending
  36. void onSendingSelectFileButton(QUrl url);
  37. void onSendingSendFileButton();
  38. void onSendingClearSelectionButton();
  39. // Receiving
  40. void onReceivingListFilesButton();
  41. void onReceivingGetFileButton(QString fileName);
  42. // Messages
  43. void onMessagesSendButton(QString msg);
  44. // Settings
  45. void onSettingsSwitchServerButton();
  46. // Ip Popup
  47. void onIpPopupEnterIp(QString ip);
  48. // Switch Popup
  49. void onSwitchPopupEnterIp(QString ip);
  50. // Footer
  51. void onFooterGetStatusButton();
  52. };
  53. #endif // QMLHANDLER_H