1 /****************************************************************************
2  *      mywindow.h: main window of the yafray UI
3  *      This is part of the yafray package
4  *      Copyright (C) 2008 Gustavo Pichorim Boiko
5  *		Copyright (C) 2009 Rodrigo Placencia Vazquez
6  *
7  *      This library is free software; you can redistribute it and/or
8  *      modify it under the terms of the GNU Lesser General Public
9  *      License as published by the Free Software Foundation; either
10  *      version 2.1 of the License, or (at your option) any later version.
11  *
12  *      This library is distributed in the hope that it will be useful,
13  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *      Lesser General Public License for more details.
16  *
17  *      You should have received a copy of the GNU Lesser General Public
18  *      License along with this library; if not, write to the Free Software
19  *      Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */
21 
22 
23 #ifndef MYWINDOW_H
24 #define MYWINDOW_H
25 
26 #include <QMainWindow>
27 #include <QTime>
28 #include <string>
29 
30 #include <gui/yafqtapi.h>
31 
32 namespace Ui
33 {
34 	class WindowBase;
35 }
36 
37 namespace yafaray
38 {
39 	class yafrayInterface_t;
40 }
41 
42 class AnimWorking;
43 class QtOutput;
44 class RenderWidget;
45 class Worker;
46 class QErrorMessage;
47 
48 class MainWindow : public QMainWindow
49 {
50 	Q_OBJECT
51 public:
52 	MainWindow(yafaray::yafrayInterface_t *env, int resx, int resy, int bStartX, int bStartY, Settings settings);
53 	~MainWindow();
54 
55 	virtual bool event(QEvent *e);
56 	void adjustWindow();
57 
58 protected:
59 	virtual bool eventFilter(QObject *obj, QEvent* event);
60 	virtual void keyPressEvent(QKeyEvent* event);
61 	void closeEvent(QCloseEvent *e);
62 	bool closeUnsaved();
63 	bool saveDlg();
64 
65 public slots:
66 	void slotRender();
67 	void slotFinished();
68 	void slotEnableDisable(bool enable = true);
69 	void slotSaveAs();
70 	void slotCancel();
71 	void setAlpha(bool checked);
72 	void showColor(bool checked);
73 	void showAlpha(bool checked);
74 	//FIXME: void showDepth(bool checked);
75 	void setAskSave(bool checked);
76 	//FIXME: void setSaveDepth(bool checked);
77 	void setDrawParams(bool checked);
78 	void zoomIn();
79 	void zoomOut();
80 
81 private:
82 	Ui::WindowBase *m_ui;
83 	RenderWidget *m_render;
84 	QtOutput *m_output;
85 	Worker *m_worker;
86 	yafaray::yafrayInterface_t *interf;
87 	QString m_outputPath;
88 	QString m_lastPath;
89 	int res_x, res_y, b_x, b_y;
90 	std::string fileName;
91 	bool autoClose;	// if true, rendering gets saved to fileName after finish and GUI gets closed (for animation)
92 	bool autoSave;	// if true, rendering gets saved to fileName after finish but GUI stays opened
93 	bool autoSaveAlpha;	// if true, the automatically saved image contains no alpha channel
94 	bool saveWithAlpha;
95 	bool saveWithDepth;
96 	bool useDrawParams;
97 	QTime timeMeasure;		// time measure for the render
98 	AnimWorking* anim;
99 	bool renderSaved;
100 	bool renderCancelled;
101 	bool use_zbuf;
102 	bool askUnsaved;
103 };
104 
105 #endif
106