#ifndef DOODLEWINDOW_H #define DOODLEWINDOW_H #include #include #include #include "DoodlePage.h" #include namespace Ui { class WidgetClass; } namespace JusDoodle { enum DoodleColor { Red, green, Blue, yellow, darkCyan, darkRed }; enum DoodleWidth { Thin, Middle, Thick }; class DoodleWindow : public QMainWindow { Q_OBJECT public: explicit DoodleWindow(QWidget *parent = 0); ~DoodleWindow(); // Override resize event. // Resize current doodle page. void resizeEvent(QResizeEvent *event); // Initialization // Create corresponding pages for doodle. void init(int pageCount); // Set background images. void setBackgroundImages(const QStringList &imagePaths); // Set background image void setBackgroundImage(int pageId, const QString &path); // Process draw action received. void actionDraw(int pageId, unsigned int argb, double width, const Path &path); // Process erase action received. void actionErase(int pageId, double width, const Path &path); // Process clean action received. void actionClean(int pageId); // Process select page action received. void actionSelectPage(int pageId); public Q_SLOTS: // Process black is selected. void colorBlackSelected(bool checked); // Process red is selected. void colorRedSelected(bool checked); // Process blue is selected. void colorBlueSelected(bool checked); // Process thin is selected. void widthThinSelected(bool checked); // Process middle is selected. void widthMiddleSelected(bool checked); // Process thick is selected. void widthThickSelected(bool checked); // Process erase is selected. void toolsEraseSelected(bool checked); // Process clear is clicked. void toolsClear(); // Process previous is clicked. void pagePrevious(); // Process next is clicked. void pageNext(); // Process message in status bar.. void onStatusMessageChanged(const QString &message); Q_SIGNALS: // Emit when color is changed. void colorChanged(const QColor &color); // Emit when width is changed. void widthChanged(double width); // Emit when mode is changed. void modeChanged(bool erase); // Emit when selected page is changed. void notifyPageChanged(int pageId); // Emit when clean is clicked. void notifyClean(int pageId); // Emit after drawing a line. void notifyDrawPath(int pageId, const Path &path, const QColor &color, double width); // Emit after erase a line. void notifyErasePath(int pageId, const Path &path, double width); void setDrawFlag(bool); private slots: void on_btnColor_clicked(bool checked); void selectedColor(); void on_btnPen_clicked(); private: // Calculate rectangle of doodle page. void calculateRect(const QSize &size, QRect &rect); // Process of a color is selected. void colorSelected(enum DoodleColor colorId); // Process of a width is selected. void widthSelected(enum DoodleWidth widthId); // Process of a page is selected. bool pageSelected(int newIndex); public: Ui::WidgetClass *ui; private: int _currentPageId; std::vector _pages; QColor _color; double _width; bool _erase; bool drawFlag; QStringList imagePathlist; }; } #endif // DOODLEWINDOW_H