qmlhandler.h 3.7 KB

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