GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GeneralDialog.h
1 /*
2  * Copyright (c) 2022. Saturneric
3  *
4  * This file is part of GpgFrontend.
5  *
6  * GpgFrontend 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  * GpgFrontend 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 GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
18  *
19  * The initial version of the source code is inherited from
20  * the gpg4usb project, which is under GPL-3.0-or-later.
21  *
22  * All the source code of GpgFrontend was modified and released by
23  * Saturneric<eric@bktus.com> starting on May 12, 2021.
24  *
25  * SPDX-License-Identifier: GPL-3.0-or-later
26  */
27 
28 #ifndef GPGFRONTEND_GENERALDIALOG_H
29 #define GPGFRONTEND_GENERALDIALOG_H
30 
31 #include "ui/GpgFrontendUI.h"
32 
33 namespace GpgFrontend::UI {
34 
35 class GeneralDialog : public QDialog {
36  public:
41  explicit GeneralDialog(std::string name, QWidget* parent = nullptr);
42 
46  ~GeneralDialog() override;
47 
48  protected:
52  void setPosCenterOfScreen();
53 
58  void movePosition2CenterOfParent();
59 
64  [[nodiscard]] bool isRectRestored();
65 
70  void showEvent(QShowEvent* event) override;
71 
72  private slots:
76  void slot_restore_settings() noexcept;
77 
81  void slot_save_settings() noexcept;
82 
83  private:
87  void update_rect_cache();
88 
89  std::string name_;
90  QRect rect_;
91  QRect parent_rect_;
92  bool rect_restored_ = false;
93 };
94 } // namespace GpgFrontend::UI
95 
96 #endif // GPGFRONTEND_GENERALDIALOG_H
Definition: GeneralDialog.h:35
GeneralDialog(std::string name, QWidget *parent=nullptr)
Definition: GeneralDialog.cpp:32
Definition: FileReadTask.cpp:29