1 /*
2 Copyright (c) 2012-2020 Maarten Baert <maarten-baert@hotmail.com>
3 
4 This file is part of SimpleScreenRecorder.
5 
6 SimpleScreenRecorder is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 SimpleScreenRecorder is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with SimpleScreenRecorder.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 #include "Global.h"
22 
23 class PageWelcome;
24 class PageInput;
25 class PageOutput;
26 class PageRecord;
27 class PageDone;
28 
29 class MainWindow : public QMainWindow {
30 	Q_OBJECT
31 
32 public:
33 	enum enum_nvidia_disable_flipping {
34 		NVIDIA_DISABLE_FLIPPING_ASK,
35 		NVIDIA_DISABLE_FLIPPING_YES,
36 		NVIDIA_DISABLE_FLIPPING_NO,
37 		NVIDIA_DISABLE_FLIPPING_COUNT // must be last
38 	};
39 
40 public:
41 	static const QString WINDOW_CAPTION;
42 
43 private:
44 	enum_nvidia_disable_flipping m_nvidia_disable_flipping;
45 	bool m_nvidia_reenable_flipping;
46 
47 	QRect m_old_geometry;
48 
49 	QStackedLayout *m_stacked_layout;
50 	PageWelcome *m_page_welcome;
51 	PageInput *m_page_input;
52 	PageOutput *m_page_output;
53 	PageRecord *m_page_record;
54 	PageDone *m_page_done;
55 
56 public:
57 	MainWindow();
58 	~MainWindow();
59 
60 	void LoadSettings();
61 	void SaveSettings();
62 
63 	bool IsBusy();
64 	bool Validate();
65 	void Quit();
66 
67 protected:
68 	virtual void closeEvent(QCloseEvent* event) override;
69 
70 public:
GetPageInput()71 	inline PageInput* GetPageInput() { return m_page_input; }
GetPageOutput()72 	inline PageOutput* GetPageOutput() { return m_page_output; }
73 
GetNVidiaDisableFlipping()74 	inline enum_nvidia_disable_flipping GetNVidiaDisableFlipping() { return m_nvidia_disable_flipping; }
75 
SetNVidiaDisableFlipping(enum_nvidia_disable_flipping flipping)76 	inline void SetNVidiaDisableFlipping(enum_nvidia_disable_flipping flipping) { m_nvidia_disable_flipping = (enum_nvidia_disable_flipping) clamp((unsigned int) flipping, 0u, (unsigned int) NVIDIA_DISABLE_FLIPPING_COUNT - 1); }
77 
78 public slots:
79 	void GoPageWelcome();
80 	void GoPageInput();
81 	void GoPageOutput();
82 	void GoPageRecord();
83 	void GoPageDone();
84 
85 	void OnShow();
86 	void OnHide();
87 	void OnShowHide();
88 	void OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason);
89 
90 };
91