vhtmltab.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef VHTMLTAB_H
  2. #define VHTMLTAB_H
  3. #include <QString>
  4. #include <QPointer>
  5. #include "vedittab.h"
  6. #include "vconstants.h"
  7. class VEdit;
  8. class VHtmlTab : public VEditTab
  9. {
  10. Q_OBJECT
  11. public:
  12. VHtmlTab(VFile *p_file, VEditArea *p_editArea, OpenFileMode p_mode, QWidget *p_parent = 0);
  13. // Close current tab.
  14. // @p_forced: if true, discard the changes.
  15. bool closeFile(bool p_forced) Q_DECL_OVERRIDE;
  16. // Enter read mode.
  17. // Will prompt user to save the changes.
  18. void readFile() Q_DECL_OVERRIDE;
  19. // Save file.
  20. bool saveFile() Q_DECL_OVERRIDE;
  21. bool isModified() const Q_DECL_OVERRIDE;
  22. void insertImage() Q_DECL_OVERRIDE;
  23. // Search @p_text in current note.
  24. void findText(const QString &p_text, uint p_options, bool p_peek,
  25. bool p_forward = true) Q_DECL_OVERRIDE;
  26. // Replace @p_text with @p_replaceText in current note.
  27. void replaceText(const QString &p_text, uint p_options,
  28. const QString &p_replaceText, bool p_findNext) Q_DECL_OVERRIDE;
  29. void replaceTextAll(const QString &p_text, uint p_options,
  30. const QString &p_replaceText) Q_DECL_OVERRIDE;
  31. QString getSelectedText() const Q_DECL_OVERRIDE;
  32. void clearSearchedWordHighlight() Q_DECL_OVERRIDE;
  33. void requestUpdateVimStatus() Q_DECL_OVERRIDE;
  34. void reload() Q_DECL_OVERRIDE;
  35. public slots:
  36. // Enter edit mode.
  37. void editFile() Q_DECL_OVERRIDE;
  38. private slots:
  39. // m_editor requests to save changes and enter read mode.
  40. void saveAndRead();
  41. // m_editor requests to discard changes and enter read mode.
  42. void discardAndRead();
  43. private:
  44. // Setup UI.
  45. void setupUI();
  46. // Show the file content in read mode.
  47. void showFileReadMode();
  48. // Show the file content in edit mode.
  49. void showFileEditMode();
  50. // Called to zoom in/out content.
  51. void zoom(bool p_zoomIn, qreal p_step = 0.25) Q_DECL_OVERRIDE;
  52. // Focus the proper child widget.
  53. void focusChild() Q_DECL_OVERRIDE;
  54. // Restore from @p_fino.
  55. // Return true if succeed.
  56. bool restoreFromTabInfo(const VEditTabInfo &p_info) Q_DECL_OVERRIDE;
  57. VEdit *m_editor;
  58. };
  59. #endif // VHTMLTAB_H