/** @file imageview.h
 * Hlavickovy soubor tridy ImageView dedici ze tridy QWidget
 * pro zobrazeni noveho okna s fotografii v puvodni velikosti
 */

#ifndef IMAGEVIEW_H
#define IMAGEVIEW_H

#include "scrollarea.h"
#include <QCloseEvent>
#include <QLabel>
#include <QLayout>
#include <QWidget>
#include <exiv2/exiv2.hpp>

class ImageWidgetsList;

class ImageView : public QWidget {
    Q_OBJECT

    QLabel* imageL;
    QImage* img;
    ScrollArea* scrollArea;
    void resizeEvent(QResizeEvent* event);
    QSize currentSize;

    double scaleFactor = 1.0;

    ImageWidgetsList* imageList = nullptr;
    int currentIndex = -1;
    void showAdjacentImage(int delta);
    void showAdjacentRow(int rowDelta);
    void showEvent(QShowEvent* event) override;
    void closeEvent(QCloseEvent* event) override;

    static QSize rememberedWindowSize;
    static bool hasRememberedWindowSize;

public:
    ImageView(QWidget* parent = 0);
    ~ImageView();
    // ImageView(QWidget *parent = 0,QImage *image = 0);
    void setImage(QString pictureName);
    void setNavigation(ImageWidgetsList* list, int index);
    void wheelEvent(QWheelEvent* event);
    virtual QSize sizeHint() const;

public slots:
    void changeImageSize(int delta);
    void keyPressEvent(QKeyEvent* e);
};

#endif // IMAGEVIEW_H
