-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimageview.h
141 lines (116 loc) · 3.03 KB
/
imageview.h
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef __IMAGE_VIEW_H__
#define __IMAGE_VIEW_H__
/**
* Image viewer.
* vim:ts=8:sw=2:et
*/
#include <qwmatrix.h>
#include <qpixmap.h>
#include <qwidget.h>
#include <qimage.h>
#include "baseview.h"
#include "monitor.h"
/* ImageView Fit Type */
typedef enum {
IVFM_NONE,
IVFM_STATIC,
IVFM_WIDTH,
IVFM_HEIGHT,
IVFM_BOTH
} IV_FIT_METHOD;
typedef enum {
IVSM_NONE,
IVSM_STATIC,
IVSM_PORTRAIT,
IVSM_LANDSCAPE
} IV_SPLIT_METHOD;
typedef enum {
IVPM_DOWN_RIGHT, // down -> right.
IVPM_DOWN_LEFT, // down -> left.
IVPM_RIGHT_DOWN, // right -> down.
IVPM_LEFT_DOWN // left -> down.
} IV_PAGING_MODE;
typedef enum {
IVLC_LOAD,
IVLC_STOP,
IVLC_NONE
} IV_LOADER_CMD;
typedef enum {
IVLS_LOADING,
IVLS_WAITING,
IVLS_STOPPING
} IV_LOADER_STATUS;
class ImageItem;
class FileLister;
class ImageView : public BaseView
{
Q_OBJECT
private:
bool event(QEvent *ev);
void paintEvent(QPaintEvent *ev);
void resizeEvent(QResizeEvent *ev);
void mousePressEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev);
void resetResized();
void setImage(const QPixmap &img, const QSize &splits);
bool scrollDown();
bool scrollRight();
bool scrollUp();
bool scrollLeft();
bool rightSlice();
bool downSlice();
bool leftSlice();
bool upSlice();
void handleImageReady(const QString &fname, const QPixmap &pixmap,
const QSize &splits);
public:
ImageView(QWidget *parent=NULL, const char *name=NULL, WFlags f=0);
void setSlideShowMode(int mode);
void loadConfig();
void setParagraph(int para);
int getParaCount();
bool getDocumentLocation(int ¶, int &offset);
bool hasDocument();
bool setDocument(QString filename, int parser_id, int encoding_id,
int para, int offset);
void resetDocument();
void setFileLister(FileLister *flist);
bool canSearch();
void search(QString key, int flags);
void nextPage();
void prevPage();
void rotateRight();
void rotateLeft();
void resetPage();
QPixmap loadImage(const QString &path, QSize &splits);
QSize getProperMatrixAndSize(QWMatrix &mat, QPixmap &img);
void backgroundLoaderLoop();
bool checkAndStartLoader(const QString &filename);
bool stopBackgroundLoader();
private:
QPixmap m_image;
int m_imgVSplits, m_imgHSplits;
int m_imgWidth, m_imgHeight;
QString m_filename;
int m_xslice, m_yslice;
int m_xoffset, m_yoffset;
QSize m_deskSize;
/* IVSM_STATIC */
int m_vSplit, m_hSplit;
/* IVFM_STATIC */
double m_scaleFactor;
bool m_noScaleUp;
IV_FIT_METHOD m_fitMethod;
IV_SPLIT_METHOD m_splitMethod;
IV_PAGING_MODE m_scrollMode;
IV_PAGING_MODE m_pageMode;
FileLister *m_flist;
Monitor m_bgLock;
ImageItem *m_loadQueue;
int m_queueSize;
IV_LOADER_CMD m_cmd;
QString m_cmdFile;
IV_LOADER_STATUS m_status;
};
#endif