#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtWidgets/QMainWindow>
#include <QtWidgets/QListWidget>
#include <QTextStream>
#include <QTimer>


#include "Animation.h"

namespace Ui {
class MainWindow;
}


class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void SetAnimation(TAnimation* animation);



public slots:
    void SelectFrame(int i);
    void LoadFrame(const std::string& text);
    void ItemClicked();

    void ShiftXChanged(int val);
    void ShiftYChanged(int val);
    void TimeFrameChanged(const QString& str);

    void GenerateTimeFrameBy12Fps();
    void GenerateSheet();

    void SaveSheet();
    void SaveAnimationParams();

    void AnimateCheckBoxStateChanged(int state);
    void TimerTimeout();

    void Clear();

private:
    Ui::MainWindow *ui;

    TAnimation* Animation;

    int frameImageDefaultPosX;
    int frameImageDefaultPosY;

    boost::shared_ptr<QPixmap> SheetPixmap;
    QString AnimationParamsText;

    QTimer AnimTimer;
    int currentFrameOnTimer;

    int GetSelectedFrame();

    //void SetTimerToNextFrame();
};

#endif // MAINWINDOW_H
