Add facility to read frames in RGB & RGBA format
[imageviewer.git] / mainwindow.h
blob97ac08262fec2fc3acbee3df822bec6f955f189e
1 /* ***** BEGIN LICENSE BLOCK *****
3 * $Id$
5 * The MIT License
7 * Copyright (c) 2008 BBC Research
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
27 * ***** END LICENSE BLOCK ***** */
29 #ifndef MAINWINDOW_H
30 #define MAINWINDOW_H
32 #include <QtGui>
34 #include "view.h"
35 #include "colourSpace.h"
37 class SequenceReader;
39 class MainWindow : public QMainWindow
41 Q_OBJECT
42 public:
43 MainWindow();
45 protected:
47 private slots:
48 void setZoom(QAction *);
49 void setYUVdisplayMode(QAction *);
50 void setRGBScaling(QAction *);
51 void setColourMatrix(QAction *);
52 void setCustomSize(bool);
53 void setPresetSize(QAction *);
54 void setYUVimageDepth(QAction *);
55 void setYUVimageFormat(QAction *);
56 void setScrollBar(QAction *);
57 void setFullScreen(bool);
58 void toggleFullScreen();
59 void escapeFullScreen();
60 void zoomIn();
61 void zoomOut();
62 void processSize(QSize &);
63 void viewImageZoomChanged(float);
64 void processSequencePosition(const QString&, int, int, int, int);
65 void processHasHeader(bool);
66 void processBitDepth(int);
67 void jumpToFirstFrame();
68 void jumpToFrameRelative(QAction *);
69 void jumpToFrameAbsolute();
70 void jumpToLastFrame();
71 void openDirectory();
72 void openSeq();
73 void openRecentFile();
74 void closeEvent(QCloseEvent *event);
75 void about();
76 void assistant();
77 void toggleToolBar();
78 void helpViewerClosed();
80 private:
81 void readSettings();
82 void writeSettings();
83 void updateRecentFileActions();
84 void updateRgbScaling(bool scaled);
85 void updateDisplayMode(View::YUVdisplayMode mode);
86 void updateColourMatrix(ColourSpace::MatrixType matrix);
87 void updateRawImageSize(SequenceReader::ImageSizes size);
88 void updateYUVbitDepth(int depth);
89 void updateYUVFormat(int format);
90 void updateZoom(double zoom);
91 void updateScrollBarPolicy(Qt::ScrollBarPolicy policy);
93 void createActions();
94 void createStatusBar();
95 void createToolBar();
96 void initializeAssistant();
98 QProcess *assistantClientProcess;
99 bool assistantClientStarted;
101 //file menu actions
102 QStringList recentFiles;
103 QAction *recentFileSeperatorAct;
104 enum {MaxRecentFiles = 5};
105 QAction *recentFileAct[MaxRecentFiles];
107 //view menu actions and groups
108 QActionGroup *YUVModeGroup; //YUV display mode
110 QActionGroup *zoomGroup;
112 QActionGroup *rgbScalingGroup; //YUV->RGB scaling is 1:1 or 255/219
113 QActionGroup *matrixGroup; //Use either the HDTV or SDTV colour matrix
114 QActionGroup *scrollBarGroup;
116 QAction *toggleToolBarAct;
118 //image menu actions and groups
119 QMenu *imageFormatMenu;
120 QActionGroup *imageFormatGroup;
122 QMenu *imageSizeMenu;
123 QMenu *imageDepthMenu;
124 QActionGroup *imageSizeGroup;
125 QAction *imageSizeSetCustomAct;
127 QActionGroup *imageDepthGroup;
129 //GUI items
130 View *view;
131 SequenceReader reader;
133 //status bar
134 QStatusBar *myStatusBar;
135 QLabel *fileFormatLabel;
136 QLabel *fileSizeLabel;
137 QLabel *fileZoomLabel;
138 QLabel *fileNameLabel;
140 //Tool bar
141 QToolBar *myToolBar;
142 QSpinBox *jumpToFrameSpin;
146 #endif