qmlhandler.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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, bool existsLocally);
  35. void receivingDisableDownloadButton(QString fileName);
  36. void receivingCloseConfirmDeletePopup();
  37. // Messages
  38. void message(QString msg);
  39. // Settings
  40. void closeWindow();
  41. void loadSettings(int covertMethod, bool saveIP, bool saveUsername, QString cliPath);
  42. // Delete Me Popup
  43. void deleteMePopupSetStatus(QString status);
  44. // Ip Popup
  45. void ipPopupSetStatus(QString status);
  46. void ipPopupSetIP(QString default_ip);
  47. void ipPopupClose();
  48. void ipPopupOpen();
  49. void ipPopupEnableConnectButton();
  50. void ipPopupDisableConnectButton();
  51. void ipPopupCheckSaveCheckbox();
  52. // Login Signup Popup
  53. void loginSignupPopupClose();
  54. void loginSignupPopupOpen();
  55. void loginSignupCheckSaveCheckbox();
  56. // Login
  57. void loginSetStatus(QString status);
  58. void loginEnableLoginButton();
  59. void loginDisableLoginButton();
  60. void loginSetUsername(QString username);
  61. // Signup
  62. void signupSetStatus(QString status);
  63. void signupEnableRegisterButton();
  64. void signupDisableRegisterButton();
  65. // Footer
  66. void log(QString logText);
  67. void footerSetStatus(QString status);
  68. // Notifications
  69. void notification(QString message);
  70. void dismissNotification(int index);
  71. void showDesktopNotification(QString title, QString message);
  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. // Notifications
  107. void onDismissNotificationButton(int id);
  108. };
  109. #endif // QMLHANDLER_H