fb2note.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef FB2NOTE_H
  2. #define FB2NOTE_H
  3. #include <QAbstractListModel>
  4. #include <QDialog>
  5. #include <QList>
  6. #include <QTreeView>
  7. #include <QWebElement>
  8. #include <QWebElementCollection>
  9. QT_BEGIN_NAMESPACE
  10. class QComboBox;
  11. class QLineEdit;
  12. class QToolBar;
  13. class QWebView;
  14. QT_END_NAMESPACE
  15. class FbTextPage;
  16. class FbTextBase;
  17. class FbTextEdit;
  18. #include "fb2html.h"
  19. class FbNoteDlg : public QDialog
  20. {
  21. Q_OBJECT
  22. public:
  23. explicit FbNoteDlg(FbTextBase *text);
  24. private slots:
  25. void loadFinished();
  26. private:
  27. QComboBox *m_key;
  28. FbTextBase *m_text;
  29. QLineEdit *m_title;
  30. QToolBar *m_toolbar;
  31. };
  32. class FbNotesModel : public QAbstractListModel
  33. {
  34. Q_OBJECT
  35. public:
  36. explicit FbNotesModel(FbTextPage *page, QObject *parent = 0);
  37. FbTextElement at(const QModelIndex &index) const;
  38. public:
  39. int rowCount(const QModelIndex &parent = QModelIndex()) const;
  40. int columnCount(const QModelIndex &parent = QModelIndex()) const;
  41. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  42. QVariant headerData(int section, Qt::Orientation orientation, int role) const;
  43. private:
  44. QWebElementCollection collection;
  45. FbTextPage *m_page;
  46. };
  47. class FbNotesWidget : public QWidget
  48. {
  49. Q_OBJECT
  50. public:
  51. explicit FbNotesWidget(FbTextEdit *text, QWidget* parent = 0);
  52. QSize sizeHint() const { return QSize(200,200); }
  53. private slots:
  54. void activated(const QModelIndex &index);
  55. void showCurrent(const QString &name);
  56. void loadFinished();
  57. private:
  58. FbTextEdit *m_text;
  59. QTreeView *m_list;
  60. QWebView *m_view;
  61. };
  62. #endif // FB2NOTE_H