Add setter/getter methods for sink/source indexes so we can update our combo boxes current item
This commit is contained in:
parent
255defb371
commit
903c26bd44
|
@ -484,7 +484,7 @@ void MainWindow::updateSinkInput(const pa_sink_input_info &info) {
|
||||||
|
|
||||||
w->type = info.client != PA_INVALID_INDEX ? SINK_INPUT_CLIENT : SINK_INPUT_VIRTUAL;
|
w->type = info.client != PA_INVALID_INDEX ? SINK_INPUT_CLIENT : SINK_INPUT_VIRTUAL;
|
||||||
|
|
||||||
w->sinkIndex = info.sink;
|
w->setSinkIndex(info.sink);
|
||||||
|
|
||||||
char *txt;
|
char *txt;
|
||||||
if (clientNames.count(info.client)) {
|
if (clientNames.count(info.client)) {
|
||||||
|
@ -530,7 +530,7 @@ void MainWindow::updateSourceOutput(const pa_source_output_info &info) {
|
||||||
|
|
||||||
w->type = info.client != PA_INVALID_INDEX ? SOURCE_OUTPUT_CLIENT : SOURCE_OUTPUT_VIRTUAL;
|
w->type = info.client != PA_INVALID_INDEX ? SOURCE_OUTPUT_CLIENT : SOURCE_OUTPUT_VIRTUAL;
|
||||||
|
|
||||||
w->sourceIndex = info.source;
|
w->setSourceIndex(info.source);
|
||||||
|
|
||||||
char *txt;
|
char *txt;
|
||||||
if (clientNames.count(info.client)) {
|
if (clientNames.count(info.client)) {
|
||||||
|
@ -694,7 +694,7 @@ void MainWindow::updateVolumeMeter(uint32_t source_index, uint32_t sink_input_id
|
||||||
for (std::map<uint32_t, SourceOutputWidget*>::iterator i = sourceOutputWidgets.begin(); i != sourceOutputWidgets.end(); ++i) {
|
for (std::map<uint32_t, SourceOutputWidget*>::iterator i = sourceOutputWidgets.begin(); i != sourceOutputWidgets.end(); ++i) {
|
||||||
SourceOutputWidget* w = i->second;
|
SourceOutputWidget* w = i->second;
|
||||||
|
|
||||||
if (w->sourceIndex == source_index)
|
if (w->sourceIndex() == source_index)
|
||||||
w->updatePeak(v);
|
w->updatePeak(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,14 @@ SinkInputWidget* SinkInputWidget::create(MainWindow* mainWindow) {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SinkInputWidget::setSinkIndex(uint32_t idx) {
|
||||||
|
mSinkIndex = idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t SinkInputWidget::sinkIndex() {
|
||||||
|
return mSinkIndex;
|
||||||
|
}
|
||||||
|
|
||||||
void SinkInputWidget::executeVolumeUpdate() {
|
void SinkInputWidget::executeVolumeUpdate() {
|
||||||
pa_operation* o;
|
pa_operation* o;
|
||||||
|
|
||||||
|
@ -102,7 +110,7 @@ void SinkInputWidget::clearMenu() {
|
||||||
void SinkInputWidget::buildMenu() {
|
void SinkInputWidget::buildMenu() {
|
||||||
for (std::map<uint32_t, SinkWidget*>::iterator i = mpMainWindow->sinkWidgets.begin(); i != mpMainWindow->sinkWidgets.end(); ++i) {
|
for (std::map<uint32_t, SinkWidget*>::iterator i = mpMainWindow->sinkWidgets.begin(); i != mpMainWindow->sinkWidgets.end(); ++i) {
|
||||||
SinkMenuItem *m;
|
SinkMenuItem *m;
|
||||||
sinkMenuItems[i->second->index] = m = new SinkMenuItem(this, i->second->description.c_str(), i->second->index, i->second->index == sinkIndex);
|
sinkMenuItems[i->second->index] = m = new SinkMenuItem(this, i->second->description.c_str(), i->second->index, i->second->index == mSinkIndex);
|
||||||
submenu.append(m->menuItem);
|
submenu.append(m->menuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,9 @@ public:
|
||||||
|
|
||||||
SinkInputType type;
|
SinkInputType type;
|
||||||
|
|
||||||
uint32_t index, clientIndex, sinkIndex;
|
uint32_t index, clientIndex;
|
||||||
|
void setSinkIndex(uint32_t idx);
|
||||||
|
uint32_t sinkIndex();
|
||||||
virtual void executeVolumeUpdate();
|
virtual void executeVolumeUpdate();
|
||||||
virtual void onDeviceChange();
|
virtual void onDeviceChange();
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
|
@ -70,6 +72,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow *mpMainWindow;
|
MainWindow *mpMainWindow;
|
||||||
|
uint32_t mSinkIndex;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,14 @@ SourceOutputWidget* SourceOutputWidget::create(MainWindow* mainWindow) {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SourceOutputWidget::setSourceIndex(uint32_t idx) {
|
||||||
|
mSourceIndex = idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t SourceOutputWidget::sourceIndex() {
|
||||||
|
return mSourceIndex;
|
||||||
|
}
|
||||||
|
|
||||||
void SourceOutputWidget::onKill() {
|
void SourceOutputWidget::onKill() {
|
||||||
pa_operation* o;
|
pa_operation* o;
|
||||||
if (!(o = pa_context_kill_source_output(get_context(), index, NULL, NULL))) {
|
if (!(o = pa_context_kill_source_output(get_context(), index, NULL, NULL))) {
|
||||||
|
@ -81,7 +89,7 @@ void SourceOutputWidget::clearMenu() {
|
||||||
void SourceOutputWidget::buildMenu() {
|
void SourceOutputWidget::buildMenu() {
|
||||||
for (std::map<uint32_t, SourceWidget*>::iterator i = mpMainWindow->sourceWidgets.begin(); i != mpMainWindow->sourceWidgets.end(); ++i) {
|
for (std::map<uint32_t, SourceWidget*>::iterator i = mpMainWindow->sourceWidgets.begin(); i != mpMainWindow->sourceWidgets.end(); ++i) {
|
||||||
SourceMenuItem *m;
|
SourceMenuItem *m;
|
||||||
sourceMenuItems[i->second->index] = m = new SourceMenuItem(this, i->second->description.c_str(), i->second->index, i->second->index == sourceIndex);
|
sourceMenuItems[i->second->index] = m = new SourceMenuItem(this, i->second->description.c_str(), i->second->index, i->second->index == mSourceIndex);
|
||||||
submenu.append(m->menuItem);
|
submenu.append(m->menuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,9 @@ public:
|
||||||
|
|
||||||
SourceOutputType type;
|
SourceOutputType type;
|
||||||
|
|
||||||
uint32_t index, clientIndex, sourceIndex;
|
uint32_t index, clientIndex;
|
||||||
|
void setSourceIndex(uint32_t idx);
|
||||||
|
uint32_t sourceIndex();
|
||||||
virtual void onDeviceChange();
|
virtual void onDeviceChange();
|
||||||
virtual void onKill();
|
virtual void onKill();
|
||||||
|
|
||||||
|
@ -68,6 +70,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow *mpMainWindow;
|
MainWindow *mpMainWindow;
|
||||||
|
uint32_t mSourceIndex;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue