Debian Codegraph @

src/Gui/Dialogs/DlgSettingsImageImp.h

raw
1 /***************************************************************************
2 * Copyright (c) 2005 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library 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 Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23 #ifndef GUI_DIALOG_DLGSETTINGSIMAGE_IMP_H
24 #define GUI_DIALOG_DLGSETTINGSIMAGE_IMP_H
25
26 #include <Inventor/SbMatrix.h>
27 #include <Inventor/SoOffscreenRenderer.h>
28
29 #include <QWidget>
30 #include <memory>
31
32 namespace Gui
33 {
34 namespace Dialog
35 {
36 class Ui_DlgSettingsImage;
37
38 /**
39 * The DlgSettingsImageImp class implements a preference page to change settings
40 * for the Inventor viewer.
41 * @author Werner Mayer
42 */
43 class DlgSettingsImageImp: public QWidget
44 {
45 Q_OBJECT
46
47 public:
48 explicit DlgSettingsImageImp(QWidget* parent = nullptr);
49 ~DlgSettingsImageImp() override;
50
51 /** @name Image dimensions */
52 //@{
53 void setImageSize(int, int);
54 void setImageSize(const QSize&);
55 QSize imageSize() const;
56 int imageWidth() const;
57 int imageHeight() const;
58 //@}
59
60 /** @name Image meta information */
61 //@{
62 void setMethod(const QByteArray&);
63 QByteArray method() const;
64 QString comment() const;
65 int backgroundType() const;
66 void setBackgroundType(int);
67 bool addWatermark() const;
68 //@}
69
70 public Q_SLOTS:
71 void onSelectedFilter(const QString&);
72
73 protected:
74 void setupConnections();
75 void onButtonRatioScreenClicked();
76 void onButtonRatio4x3Clicked();
77 void onButtonRatio16x9Clicked();
78 void onButtonRatio1x1Clicked();
79 void onStandardSizeBoxActivated(int);
80 void onComboMethodActivated(int);
81
82 protected:
83 // helper to force an aspect ratio
84 void adjustImageSize(float fRatio);
85 void changeEvent(QEvent* e) override;
86
87
88 private:
89 std::unique_ptr<Ui_DlgSettingsImage> ui;
90 float _fRatio;
91 int _width, _height;
92 SbMatrix _Matrix;
93 };
94
95 } // namespace Dialog
96 } // namespace Gui
97
98 #endif // GUI_DIALOG_DLGSETTINGSIMAGE_IMP_H