summaryrefslogtreecommitdiff
path: root/src/ui/imageviewer/imageviewer_origin.h
blob: 15d9c622ef52615999c495050a9824c571aac311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
///////////////////////////////////////////////////////
//////// the origin image viewer //////////////////////
///////////////////////////////////////////////////////

#ifndef FQTERM_IMAGEVIEWER_ORIGIN_H
#define FQTERM_IMAGEVIEWER_ORIGIN_H

#include <QDesktopWidget>
#include <QDirModel>
#include <QLabel>
#include <QPainter>
#include <QPixmapCache>
#include <QScrollArea>
#include <QStatusBar>
#include <QToolButton>
#include <QToolBar>
#include <QLayout>
#include <QItemDelegate>
#include <QItemSelection>
#include <QTreeView>
#include <QMenuBar>
#include <QComboBox>

#include "pictureflow.h"
#include "fqtermimage.h"

namespace FQTerm
{

    class FQTermCanvas;
    class ExifExtractor;

    class ItemDelegate : public QItemDelegate {
    public:
        static QSize size_;

        ItemDelegate() {
            size_ = QSize(250,200);
        }

        QSize sizeHint (const QStyleOptionViewItem & option, const QModelIndex & index) const {
            return size_;
        }

        void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
    };

    class ExifTable : public QLabel {
        Q_OBJECT;

    public:
        ExifTable(QWidget *parent);

    signals:
        void showExifDetails();

    protected:
        void mouseReleaseEvent(QMouseEvent *pEvent);
    };

    class ImageViewerDirModel : public QDirModel {
    public:
        ImageViewerDirModel(QObject *parent = 0);

        int columnCount(const QModelIndex & = QModelIndex()) const;
        QVariant headerData ( int section, Qt::Orientation orientation, int role) const;
        QVariant data(const QModelIndex &index, int role) const;
    };

    class FQTermImageOrigin: public FQTermImage {
        Q_OBJECT;

    public:
        FQTermImageOrigin(FQTermConfig * config, QWidget *parent, Qt::WindowFlags wflag);
        ~FQTermImageOrigin();
        void scrollTo(const QString& filename);
        void updateImage(const QString& filename);

        public slots:
            void onChange(const QModelIndex & index);
            void next();
            void previous();
            void adjustItemSize();
            void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
            void sortFileList(int index);
            void showFullExifInfo();
            void adjustLayout(bool withExifTable);
            void updateExifInfo();

    protected:
            void closeEvent(QCloseEvent *clse);

    private:
            FQTermCanvas* canvas_;
            QTreeView* tree_;
            ImageViewerDirModel* model_;
            QMenuBar* menuBar_;
            QComboBox* comboBox_;
            FQTermConfig* config_;
            ExifExtractor* exifExtractor_;
            ExifTable* exifTable_;
            QGridLayout* layout_;
            bool isExifTableShown_;
    };

}

#endif