1 /** -*- mode: c++ ; c-basic-offset: 2 -*-
2  *
3  *  @file InOutPanel.h
4  *
5  *  Copyright 2017 Sebastien Fourey
6  *
7  *  This file is part of G'MIC-Qt, a generic plug-in for raster graphics
8  *  editors, offering hundreds of filters thanks to the underlying G'MIC
9  *  image processing framework.
10  *
11  *  gmic_qt is free software: you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation, either version 3 of the License, or
14  *  (at your option) any later version.
15  *
16  *  gmic_qt is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with gmic_qt.  If not, see <http://www.gnu.org/licenses/>.
23  *
24  */
25 #ifndef GMIC_QT_INOUTPANEL_H
26 #define GMIC_QT_INOUTPANEL_H
27 
28 #include <QWidget>
29 #include "Host/GmicQtHost.h"
30 #include "InputOutputState.h"
31 #include "GmicQt.h"
32 class QSettings;
33 class QPalette;
34 
35 namespace Ui
36 {
37 class InOutPanel;
38 }
39 
40 namespace GmicQt
41 {
42 
43 class FilterThread;
44 
45 class InOutPanel : public QWidget {
46   Q_OBJECT
47 
48 public:
49   explicit InOutPanel(QWidget * parent = nullptr);
50   ~InOutPanel();
51 
52 public:
53   InputMode inputMode() const;
54   OutputMode outputMode() const;
55   OutputMessageMode outputMessageMode() const;
56   void reset();
57 
58   void disableNotifications();
59   void enableNotifications();
60   void setInputMode(InputMode mode);
61   void setOutputMode(OutputMode mode);
62 
63   InputOutputState state() const;
64   void setState(const InputOutputState & state, bool notify);
65 
66   void setEnabled(bool);
67   void disable();
68   void enable();
69 
70   static void disableInputMode(InputMode mode);
71   static void disableOutputMode(OutputMode mode);
72 
73   bool hasActiveControls();
74 
75 signals:
76   void inputModeChanged(InputMode);
77 
78 public slots:
79   void onInputModeSelected(int);
80   void onOutputModeSelected(int);
81   void onResetButtonClicked();
82   void setDarkTheme();
83 
84 private:
85   static void setDefaultInputMode();
86   static void setDefaultOutputMode();
87   void setTopLabel();
88   void updateLayoutIfUniqueRow();
89   bool _notifyValueChange;
90   Ui::InOutPanel * ui;
91   static const int NoSelection = -1;
92   static QList<InputMode> _enabledInputModes;
93   static QList<OutputMode> _enabledOutputModes;
94 };
95 
96 } // namespace GmicQt
97 
98 #endif // GMIC_QT_INOUTPANEL_H
99