|
18 | 18 | #include "OBSSourceLabel.hpp" |
19 | 19 | #include "moc_OBSSourceLabel.cpp" |
20 | 20 |
|
21 | | -void OBSSourceLabel::SourceRenamed(void *data, calldata_t *params) |
| 21 | +OBSSourceLabel::OBSSourceLabel(const obs_source_t *source, QWidget *parent, Qt::WindowFlags f) |
| 22 | + : QLabel(obs_source_get_name(source), parent, f), |
| 23 | + renamedSignal(obs_source_get_signal_handler(source), "rename", &OBSSourceLabel::obsSourceRenamed, this), |
| 24 | + removedSignal(obs_source_get_signal_handler(source), "remove", &OBSSourceLabel::obsSourceRemoved, this), |
| 25 | + destroyedSignal(obs_source_get_signal_handler(source), "destroy", &OBSSourceLabel::obsSourceDestroyed, this) |
| 26 | +{ |
| 27 | +} |
| 28 | + |
| 29 | +void OBSSourceLabel::obsSourceRenamed(void *data, calldata_t *params) |
22 | 30 | { |
23 | 31 | auto &label = *static_cast<OBSSourceLabel *>(data); |
24 | 32 |
|
25 | 33 | const char *name = calldata_string(params, "new_name"); |
26 | 34 | label.setText(name); |
27 | 35 |
|
28 | | - emit label.Renamed(name); |
| 36 | + emit label.renamed(name); |
29 | 37 | } |
30 | 38 |
|
31 | | -void OBSSourceLabel::SourceRemoved(void *data, calldata_t *) |
| 39 | +void OBSSourceLabel::obsSourceRemoved(void *data, calldata_t *) |
32 | 40 | { |
33 | 41 | auto &label = *static_cast<OBSSourceLabel *>(data); |
34 | | - emit label.Removed(); |
| 42 | + emit label.removed(); |
35 | 43 | } |
36 | 44 |
|
37 | | -void OBSSourceLabel::SourceDestroyed(void *data, calldata_t *) |
| 45 | +void OBSSourceLabel::obsSourceDestroyed(void *data, calldata_t *) |
38 | 46 | { |
39 | 47 | auto &label = *static_cast<OBSSourceLabel *>(data); |
40 | | - emit label.Destroyed(); |
| 48 | + emit label.destroyed(); |
41 | 49 |
|
42 | 50 | label.destroyedSignal.Disconnect(); |
43 | 51 | label.removedSignal.Disconnect(); |
44 | 52 | label.renamedSignal.Disconnect(); |
45 | 53 | } |
| 54 | + |
| 55 | +void OBSSourceLabel::mousePressEvent(QMouseEvent *event) |
| 56 | +{ |
| 57 | + emit clicked(); |
| 58 | + |
| 59 | + QLabel::mousePressEvent(event); |
| 60 | +} |
0 commit comments