qmlhandler.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef QMLHANDLER_H
  2. #define QMLHANDLER_H
  3. #include <QObject>
  4. #include <QUrl>
  5. extern bool _RESTART;
  6. class QMLHandler : public QObject {
  7. Q_OBJECT
  8. private:
  9. void readPipeLoop();
  10. void fileExists(std::string name);
  11. public:
  12. explicit QMLHandler(QObject *parent = 0);
  13. void onExit();
  14. void setProgramActive(bool active);
  15. void reopenCLI(QString ip);
  16. void closeCLI();
  17. void writeToCLI(QString command);
  18. void loadSettingsToGUI();
  19. QString getIP();
  20. void setRestart(bool restart);
  21. // C++ -> QML
  22. signals:
  23. // No Config Found Popup
  24. void noConfigFoundPopupOpen();
  25. void noConfigFoundPopupClose();
  26. // Invalid Cli Path Popup
  27. void invalidCliPathPopupOpen();
  28. void invalidCliPathPopupClose();
  29. // Invalid Config Popup
  30. void invalidConfigPopupOpen();
  31. void invalidConfigPopupClose();
  32. // Sending
  33. void sendingSetFileUrlText(QString signalText);
  34. void sendingEnableSendButton();
  35. void sendingDisableSendButton();
  36. // Receiving
  37. void receivingClearFileList();
  38. void receivingListFile(QString fileName, bool existsLocally);
  39. void receivingDisableDownloadButton(QString fileName);
  40. void receivingCloseConfirmDeletePopup();
  41. // Messages
  42. void message(QString msg);
  43. // Settings
  44. void closeWindow();
  45. void loadSettings(int covertMethod, bool saveIP, bool saveUsername, QString cliPath);
  46. // Delete Me Popup
  47. void deleteMePopupSetStatus(QString status);
  48. // Ip Popup
  49. void ipPopupSetStatus(QString status);
  50. void ipPopupSetIP(QString default_ip);
  51. void ipPopupClose();
  52. void ipPopupOpen();
  53. void ipPopupEnableConnectButton();
  54. void ipPopupDisableConnectButton();
  55. void ipPopupCheckSaveCheckbox();
  56. // Login Signup Popup
  57. void loginSignupPopupClose();
  58. void loginSignupPopupOpen();
  59. void loginSignupCheckSaveCheckbox();
  60. // Login
  61. void loginSetStatus(QString status);
  62. void loginEnableLoginButton();
  63. void loginDisableLoginButton();
  64. void loginSetUsername(QString username);
  65. // Signup
  66. void signupSetStatus(QString status);
  67. void signupEnableRegisterButton();
  68. void signupDisableRegisterButton();
  69. // Footer
  70. void log(QString logText);
  71. void footerSetStatus(QString status);
  72. // QML -> C++
  73. public slots:
  74. void onStart();
  75. // No Config Found Popup
  76. void onNoConfigFoundPopupContinueButton(QString cli_path);
  77. // Invalid Cli Path Popup
  78. void onInvalidCliPathPopupContinueButton(QString cli_path);
  79. void onInvalidCliPathPopupQuitButton();
  80. // Invalid Config Popup
  81. void onInvalidConfigPopupCreateDefaultButton();
  82. void onInvalidConfigPopupQuitButton();
  83. // Sending
  84. void onSendingSelectFileButton(QUrl url);
  85. void onSendingSendFileButton();
  86. void onSendingClearSelectionButton();
  87. // Receiving
  88. void onReceivingListFilesButton();
  89. void onReceivingDownloadFileButton(QString fileName);
  90. void onReceivingConfirmDeleteFileButton(QString fileName);
  91. // Messages
  92. void onMessagesSendButton(QString msg);
  93. // Settings
  94. void onSettingsDeleteMeButton(QString password);
  95. void onSettingsRevertChangesButton();
  96. void onSettingsResetButton();
  97. void onSettingsSaveButton(int covertMethod, bool saveIP, bool saveUsername, QString cliPath);
  98. // Ip Popup
  99. void onIpPopupConnectButton(QString ip, bool saveAsDefault);
  100. // Login
  101. void onLoginLoginButton(QString username, QString password, bool saveAsDefault);
  102. // Signup
  103. void onSignupRegisterButton(QString username, QString passwordOne, QString passwordTwo, bool saveAsDefault);
  104. // Footer
  105. void onFooterGetStatusButton();
  106. };
  107. #endif // QMLHANDLER_H