1 // qjackctlSocketForm.h
2 //
3 /****************************************************************************
4    Copyright (C) 2003-2020, rncbc aka Rui Nuno Capela. All rights reserved.
5 
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License
8    as published by the Free Software Foundation; either version 2
9    of the License, or (at your option) any later version.
10 
11    This program 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 along
17    with this program; if not, write to the Free Software Foundation, Inc.,
18    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 
20 *****************************************************************************/
21 
22 #ifndef __qjackctlSocketForm_h
23 #define __qjackctlSocketForm_h
24 
25 #include "ui_qjackctlSocketForm.h"
26 
27 #include "qjackctlJackConnect.h"
28 #include "qjackctlAlsaConnect.h"
29 
30 // Forward declarations.
31 class qjackctlPatchbay;
32 class qjackctlPatchbaySocket;
33 class qjackctlSocketList;
34 
35 class QButtonGroup;
36 class QPixmap;
37 
38 
39 //----------------------------------------------------------------------------
40 // qjackctlSocketForm -- UI wrapper form.
41 
42 class qjackctlSocketForm : public QDialog
43 {
44 	Q_OBJECT
45 
46 public:
47 
48 	// Constructor.
49 	qjackctlSocketForm(QWidget *pParent = nullptr);
50 	// Destructor.
51 	~qjackctlSocketForm();
52 
53 	void setSocketCaption(const QString& sSocketCaption);
54 	void setSocketList(qjackctlSocketList *pSocketList);
55 	void setSocketNew(bool bSocketNew);
56 
57 	void setPixmaps(QPixmap **ppPixmaps);
58 
59 	void setConnectCount(int iConnectCount);
60 
61 	void load(qjackctlPatchbaySocket *pSocket);
62 	void save(qjackctlPatchbaySocket *pSocket);
63 
64 public slots:
65 
66 	void changed();
67 
68 	void addPlug();
69 	void editPlug();
70 	void removePlug();
71 	void moveUpPlug();
72 	void moveDownPlug();
73 	void selectedPlug();
74 
75 	void activateAddPlugMenu(QAction *);
76 
77 	void customContextMenu(const QPoint&);
78 
79 	void socketTypeChanged();
80 	void socketNameChanged();
81 	void clientNameChanged();
82 
83 	void stabilizeForm();
84 
85 protected slots:
86 
87 	void accept();
88 	void reject();
89 
90 protected:
91 
92 	void updateJackClients(int iSocketType);
93 	void updateAlsaClients(int iSocketType);
94 
95 	void updateJackPlugs(int iSocketType);
96 	void updateAlsaPlugs(int iSocketType);
97 
98 	bool validateForm();
99 
100 private:
101 
102 	// The Qt-designer UI struct...
103 	Ui::qjackctlSocketForm m_ui;
104 
105 	// Instance variables.
106 	qjackctlSocketList *m_pSocketList;
107 	bool                m_bSocketNew;
108 	int                 m_iSocketNameChanged;
109 	QPixmap           **m_ppPixmaps;
110 	int                 m_iDirtyCount;
111 
112 	QButtonGroup       *m_pSocketTypeButtonGroup;
113 };
114 
115 
116 #endif	// __qjackctlSocketForm_h
117 
118 
119 // end of qjackctlSocketForm.h
120