Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ManualPlugin.h « mumble « src - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa76efbc88928e3a7bff5c008934d9dff90f0a4a (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
// Copyright 2016-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_MUMBLE_MANUALPLUGIN_H_
#define MUMBLE_MUMBLE_MANUALPLUGIN_H_

#include <QtCore/QtGlobal>
#include <QtWidgets/QDialog>
#include <QtWidgets/QGraphicsItem>
#include <QtWidgets/QGraphicsScene>

#include "ui_ManualPlugin.h"

#include "../../plugins/mumble_plugin.h"

#include <atomic>
#include <chrono>

struct Position2D {
	float x;
	float y;
};

// We need this typedef in order to be able to pass this hash as an argument
// to QMetaObject::invokeMethod
using PositionMap = QHash< unsigned int, Position2D >;
Q_DECLARE_METATYPE(PositionMap);


/// A struct holding information about a stale entry in the
/// manual plugin's position window
struct StaleEntry {
	/// The time point since when this entry is considered stale
	std::chrono::time_point< std::chrono::steady_clock > staleSince;
	/// The pointer to the stale item
	QGraphicsItem *staleItem;
};

class Manual : public QDialog, public Ui::Manual {
	Q_OBJECT
public:
	Manual(QWidget *parent = 0);

	static void setSpeakerPositions(const QHash< unsigned int, Position2D > &positions);


public slots:
	void on_qpbUnhinge_pressed();
	void on_qpbLinked_clicked(bool);
	void on_qpbActivated_clicked(bool);
	void on_qdsbX_valueChanged(double);
	void on_qdsbY_valueChanged(double);
	void on_qdsbZ_valueChanged(double);
	void on_qsbAzimuth_valueChanged(int);
	void on_qsbElevation_valueChanged(int);
	void on_qdAzimuth_valueChanged(int);
	void on_qdElevation_valueChanged(int);
	void on_qleContext_editingFinished();
	void on_qleIdentity_editingFinished();
	void on_buttonBox_clicked(QAbstractButton *);
	void on_qsbSilentUserDisplaytime_valueChanged(int);

	void on_speakerPositionUpdate(PositionMap positions);

	void on_updateStaleSpeakers();

protected:
	QGraphicsScene *qgsScene;
	QGraphicsItem *qgiPosition;

	std::atomic< bool > updateLoopRunning;

	QHash< unsigned int, QGraphicsItem * > speakerPositions;
	QHash< unsigned int, StaleEntry > staleSpeakerPositions;

	bool eventFilter(QObject *, QEvent *);
	void changeEvent(QEvent *e);
	void updateTopAndFront(int orientation, int azimut);
};

MumblePlugin *ManualPlugin_getMumblePlugin();
MumblePluginQt *ManualPlugin_getMumblePluginQt();

#endif