summaryrefslogtreecommitdiff
path: root/AudioManGUI/audiomangui.h
blob: 3aa2228f0313c0cda4e2d39b411433e47f3205c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/**
 *
 * Copyright (C) 2011, BMW AG
 *
 * AudioManGui
 *
 * \file audiomangui.h
 *
 * \date 20.05.2011
 * \author Christian Müller (christian.ei.mueller@bmw.de)
 *
 * \section License
 * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
 * Copyright (C) 2011, BMW AG – Christian Müller  Christian.ei.mueller@bmw.de
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
 * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
 * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
 * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
 * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
 * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
 */

#ifndef AUDIOMANGUI_H
#define AUDIOMANGUI_H

#include <QCoreApplication>
#include <QtGui/QWidget>
#include "qstandarditemmodel.h"
#include "ui_audiomangui.h"
#include "ui_popup_navi.h"
#include "ui_popup_ta.h"
#include "qtreewidget.h"
#include "qtreeview.h"
#include "DBusSend.h"
#include "DBusTypes.h"
#include "audiomangui.h"
#include "qlist.h"
#include "qtableview.h"
#include "qstring.h"
#include "qstringlist.h"
#include "qpainter.h"
#include "qmessagebox.h"
#include "qdial.h"

class SourceItem;
class SinkItem;
class naviPopup;
class taPopup;

struct Connection_t {
	SinkItem* Sink;
	SourceItem* Source;
};

/**\class AudioManGUI
 * \brief Main Gui Class
 * This class is used to display source sink connections and to test the AudioManager
 * \brief constructor
 * \fn AudioManGUI::insertSource(int ID, QString name);
 * \brief inserts a source
 * \fn AudioManGUI::insertSink(int ID, QString name);
 * \brief inserts a sink
 * \fn AudioManGUI::connect(int SourceID, int SinkID);
 * \brief connects source and sink
 * \fn AudioManGUI::disconnect(int SourceID, int SinkID);
 * \brief disconnects source and sink
 * \fn SinkItem* AudioManGUI::returnSelectedSink(void);
 * \brief returns the selected sink
 * \fn SourceItem* AudioManGUI::returnSelectedSource(void);
 * \brief returns the selected source
 * \fn SourceItem* AudioManGUI::returnSourceItemfromID(int ID);
 * \brief returns a source item from an ID
 * \param ID the id
 * \fn void AudioManGUI::updateButtons(void);
 * \brief is called to update the buttons
 */
class AudioManGUI: public QWidget {
Q_OBJECT

public:
	AudioManGUI(QWidget *parent = 0);
	~AudioManGUI();

	void insertSource(int ID, QString name);
	void insertSink(int ID, QString name);
	void connect(int SourceID, int SinkID);
	void disconnect(int SourceID, int SinkID);

public slots:
	void slot_selectionChanged(QTreeWidgetItem *current, int column);
	void slot_doubleClickedSource(QTreeWidgetItem *current, int column);
	void slot_connectPressed(void);
	void slot_disconnectPressed(void);
	void slot_connectionChanged(void);
	void slot_numberOfSinksChanged(void);
	void slot_numberOfSourcesChanged(void);
	void slot_volumeChanged(int);

protected:
	void paintEvent(QPaintEvent *);

private:
	SinkItem* returnSelectedSink(void);
	SourceItem* returnSelectedSource(void);
	SourceItem* returnSourceItemfromID(int ID);
	void updateButtons(void);

	Ui::AudioManGUIClass ui;
	taPopup* m_taPop;
	naviPopup* m_naviPop;
	QList<SourceItem*> m_sourceList;
	QList<SinkItem*> m_sinkList;
	QList<Connection_t> m_connectionList;
	DBusSend* sender;
	bool m_taActive;
	bool m_naviActive;

};

/**This is the navigation popup widget
 *
 */
class naviPopup: public QWidget {
Q_OBJECT
public:
	naviPopup(QWidget *parent = 0);
	virtual ~naviPopup();
private:
	Ui::naviPopup navi_pop;
};

/**The traffic announcement widget
 *
 */
class taPopup: public QWidget {
Q_OBJECT
public:
	taPopup(QWidget *parent = 0);
	virtual ~taPopup();
private:
	Ui::taPopup ta_pop;
};

/** \class SinkItem
 * \brief This class represents a sink item
 * \fn SinkItem::SinkItem(QTreeWidget* parent = 0, int ID = 0, QString Name = "");
 * \brief constructor
 * \param ID the Id of the sink
 * \param parent pointer to the parent
 * \param Name the name of the sink
 * \fn SinkItem::getSinkID(void);
 * \brief returns the Sink ID
 */
class SinkItem: SinkType, public QTreeWidgetItem {
public:
	SinkItem(QTreeWidget* parent = 0, int ID = 0, QString Name = "");
	virtual ~SinkItem();
	int getSinkID(void);
};

/**
 * \class SourceItem
 * \brief This class represents a source item
 * \fn SourceItem::SourceItem(QTreeWidget* parent = 0, int ID = 0, QString Name = "");
 * \brief constructor
 * \param ID the Id of the source
 * \param parent pointer to parent
 * \param Name the name of the source
 * \fn SourceItem::getSourceID(void);
 * \brief returns the Source ID
 * \fn SourceItem::getName(void);
 * \brief returns the name of the source item
 * \return returns the name of the source item
 */
class SourceItem: SourceType, public QTreeWidgetItem {
public:
	SourceItem(QTreeWidget* parent = 0, int ID = 0, QString Name = "");
	virtual ~SourceItem();
	int getSourceID(void);
	QString getName(void);
};

#endif // AUDIOMANGUI_H