qmlhandler.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. // Server Files
  29. void serverFilesSetFileUrlText(QString signalText);
  30. void serverFilesEnableSendButton();
  31. void serverFilesDisableSendButton();
  32. void serverFilesClearFileList();
  33. void serverFilesListFile(QString fileName, QString fileSize, QString fileDecryptable, bool existsLocally);
  34. void serverFilesUpdateFile(QString fileName, QString fileProgress, bool isQueued);
  35. void serverFilesDisableDownloadButton(QString fileName);
  36. void serverFilesCloseConfirmDeletePopup();
  37. // Messages
  38. void message(QString msg);
  39. // Settings
  40. void closeWindow();
  41. void loadSettings(bool saveIP, bool saveUsername, QString cliPath, QString keyPath);
  42. void keyfileStatus(bool success, QString msg);
  43. void keyfileClosedOK();
  44. // Delete Me Popup
  45. void deleteMePopupSetStatus(QString status);
  46. // Ip Popup
  47. void ipPopupSetStatus(QString status);
  48. void ipPopupSetIP(QString default_ip);
  49. void ipPopupClose();
  50. void ipPopupOpen();
  51. void ipPopupEnableConnectButton();
  52. void ipPopupDisableConnectButton();
  53. void ipPopupCheckSaveCheckbox();
  54. // Login Signup Popup
  55. void loginSignupPopupClose();
  56. void loginSignupPopupOpen();
  57. void loginSignupCheckSaveCheckbox();
  58. // Login
  59. void loginSetStatus(QString status);
  60. void loginEnableLoginButton();
  61. void loginDisableLoginButton();
  62. void loginSetUsername(QString username);
  63. // Signup
  64. void signupSetStatus(QString status);
  65. void signupEnableRegisterButton();
  66. void signupDisableRegisterButton();
  67. // Footer
  68. void log(QString logText);
  69. void footerSetStatus(QString status);
  70. void footerSetError(QString error);
  71. // Notifications
  72. void notification(QString message);
  73. void dismissNotification(int index);
  74. void showDesktopNotification(QString title, QString message);
  75. // QML -> C++
  76. public slots:
  77. // Main
  78. void onStart(bool startWithCli);
  79. void onSwitchServer();
  80. // No Config Found Popup
  81. void onNoConfigFoundPopupContinueButton(QString cli_path);
  82. // Invalid Cli Path Popup
  83. void onInvalidCliPathPopupContinueButton(QString cli_path);
  84. void onInvalidCliPathPopupQuitButton();
  85. // Invalid Config Popup
  86. void onInvalidConfigPopupCreateDefaultButton();
  87. void onInvalidConfigPopupQuitButton();
  88. // Server Files
  89. void onServerFilesSelectFileButton(QUrl url);
  90. void onServerFilesSendFileButton();
  91. void onServerFilesClearSelectionButton();
  92. void onServerFilesDownloadFileButton(QString fileName);
  93. void onServerFilesConfirmDeleteFileButton(QString fileName);
  94. // Messages
  95. void onMessagesSendButton(QString msg);
  96. // Settings
  97. void onKeyfileSelected(QString path);
  98. void onKeyfileClosed();
  99. void onSettingsDeleteMeButton(QString password);
  100. void onSettingsRevertChangesButton();
  101. void onSettingsResetButton();
  102. void onSettingsSaveButton(bool saveIP, bool saveUsername, QString cliPath, QString keyPath);
  103. // Ip Popup
  104. void onIpPopupConnectButton(QString ip, bool saveAsDefault);
  105. // Login
  106. void onLoginLoginButton(QString username, QString password, bool saveAsDefault);
  107. // Signup
  108. void onSignupRegisterButton(QString username, QString passwordOne, QString passwordTwo, bool saveAsDefault);
  109. // Notifications
  110. void onDismissNotificationButton(int id);
  111. // Queueing
  112. void onReceivingQueueFileButton(QString fileName);
  113. void onReceivingDequeueFileButton(QString fileName);
  114. };
  115. #endif // QMLHANDLER_H