File: main_window.h

package info (click to toggle)
fractalnow 0.8.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,656 kB
  • sloc: ansic: 8,201; cpp: 4,517; sh: 571; makefile: 9
file content (122 lines) | stat: -rw-r--r-- 3,504 bytes parent folder | download | duplicates (3)
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
/*
 *  main_window.h -- part of FractalNow
 *
 *  Copyright (c) 2012 Marc Pegon <pe.marc@free.fr>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
 /**
  * \file main_window.h
  * \brief Header file introducing MainWindow class.
  *
  * \author Marc Pegon
  */

#ifndef __MAIN_WINDOW_H__
#define __MAIN_WINDOW_H__

#include "command_line.h"
#include "export_fractal_image_dialog.h"
#include "fractal_config_widget.h"
#include "fractal_explorer.h"
#include "fractal_rendering_widget.h"

#include "fractalnow.h"

#include <QCheckBox>
#include <QCloseEvent>
#include <QDesktopServices>
#include <QDoubleSpinBox>
#include <QDropEvent>
#include <QMainWindow>
#include <QSpinBox>

#define DEFAULT_EXPLORER_WIDTH (uint)(640)
#define DEFAULT_EXPLORER_HEIGHT (uint)(512)

class MainWindow : public QMainWindow
{
	Q_OBJECT

	public:
	MainWindow(int argc, char *argv[]);
	~MainWindow();

	private:
	enum FileType { UNKNOWN_FILE=0, CONFIG_FILE,
		FRACTAL_FILE, RENDER_FILE, GRADIENT_FILE };

	ExportFractalImageDialog *exportFractalImageDialog;
	QDockWidget *fractalDock, *renderDock, *otherDock;
	QToolBar *toolBar;
	FractalExplorer *fractalExplorer;
	FractalConfigWidget *fractalConfigWidget;
	FractalRenderingWidget *fractalRenderingWidget;
	QSpinBox *preferredImageWidthSpinBox;
	QSpinBox *preferredImageHeightSpinBox;
	QCheckBox *solidGuessingCheckBox;
	QCheckBox *useCacheCheckBox;
	QSpinBox *cacheSizeSpinBox;
	QComboBox *floatTypeComboBox;
	QSpinBox *MPFloatPrecisionSpinBox;
	QWidget *editMPFloatPrecisionWidget;

	QAction *adaptExplorerToWindowAction;
	uint_fast32_t fractalExplorerNbThreads;
	uint_fast32_t exportImageNbThreads;
	bool adaptExplorerSize;
	uint lastPreferredExplorerWidth, lastPreferredExplorerHeight;
	uint lastWindowWidth, lastWindowHeight;
	QString imageDir;
	QString configDir;
	QString gradientDir;
	bool useCache;
	int cacheSize;
	bool solidGuessing;
	QAction *switchFullScreenAction;

	enum FileType getFileType(QString fileName);
	void saveSettings();
	void loadSettings();
	void loadFile(QString fileName);
	void loadConfigFile(QString fileName);
	void loadFractalFile(QString fileName);
	void loadRenderingFile(QString fileName);
	void loadGradientFile(QString fileName);
	void openFile(QString fileName);
	void dragEnterEvent(QDragEnterEvent *event);
	void dropEvent(QDropEvent *event);

	private slots:
	void delayedInit();
	void aboutQt();
	void aboutQFractalNow();
	void adaptExplorerToWindow(bool checked);
	void exportImage();
	void openConfigFile();
	void saveConfigFile();
	void openGradientFile();
	void saveGradientFile();
	void onPreferredImageWidthChanged();
	void onPreferredImageHeightChanged();
	void onCacheSizeChanged();
	void onFloatTypeChanged(int index);
	void editMPFloatPrecision();
	void switchFullScreenMode(bool checked);
	void escapeFullScreen();
};

#endif