webview_dialog.h 972 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. #include <QtCore/QString>
  9. #include <optional>
  10. #include <vector>
  11. class QWidget;
  12. namespace Webview {
  13. struct PopupArgs {
  14. struct Button {
  15. enum class Type {
  16. Default,
  17. Ok,
  18. Close,
  19. Cancel,
  20. Destructive,
  21. };
  22. QString id;
  23. QString text;
  24. Type type = Type::Default;
  25. };
  26. QWidget *parent = nullptr;
  27. QString title;
  28. QString text;
  29. std::optional<QString> value;
  30. std::vector<Button> buttons;
  31. bool ignoreFloodCheck = false;
  32. };
  33. struct PopupResult {
  34. std::optional<QString> id;
  35. std::optional<QString> value;
  36. };
  37. [[nodiscard]] PopupResult ShowBlockingPopup(PopupArgs &&args);
  38. struct DialogArgs;
  39. struct DialogResult;
  40. [[nodiscard]] DialogResult DefaultDialogHandler(DialogArgs &&args);
  41. } // namespace Webview