mainwindow: Add a method to remove all widgets (e.g. on disconnect)

This commit is contained in:
Colin Guthrie 2010-04-20 20:00:37 +01:00
parent b11f0b7297
commit 6c0bcb4c08
2 changed files with 31 additions and 0 deletions

View File

@ -896,6 +896,35 @@ void MainWindow::removeClient(uint32_t index) {
clientNames.erase(index); clientNames.erase(index);
} }
void MainWindow::removeAllWidgets() {
{
std::map<uint32_t, SinkInputWidget*>::iterator it;
for (it = sinkInputWidgets.begin(); it != sinkInputWidgets.end(); ++it)
removeSinkInput(it->first);
}{
std::map<uint32_t, SourceOutputWidget*>::iterator it;
for (it = sourceOutputWidgets.begin(); it != sourceOutputWidgets.end(); ++it)
removeSourceOutput(it->first);
}{
std::map<uint32_t, SinkWidget*>::iterator it;
for (it = sinkWidgets.begin(); it != sinkWidgets.end(); ++it)
removeSink(it->first);
}{
std::map<uint32_t, SourceWidget*>::iterator it;
for (it = sourceWidgets.begin(); it != sourceWidgets.end(); ++it)
removeSource(it->first);
}{
std::map<uint32_t, CardWidget*>::iterator it;
for (it = cardWidgets.begin(); it != cardWidgets.end(); ++it)
removeCard(it->first);
}{
std::map<uint32_t, char*>::iterator it;
for (it = clientNames.begin(); it != clientNames.end(); ++it)
removeSourceOutput(it->first);
}
deleteEventRoleWidget();
}
void MainWindow::onSinkTypeComboBoxChanged() { void MainWindow::onSinkTypeComboBoxChanged() {
showSinkType = (SinkType) sinkTypeComboBox->get_active_row_number(); showSinkType = (SinkType) sinkTypeComboBox->get_active_row_number();

View File

@ -55,6 +55,8 @@ public:
void removeSourceOutput(uint32_t index); void removeSourceOutput(uint32_t index);
void removeClient(uint32_t index); void removeClient(uint32_t index);
void removeAllWidgets();
Gtk::Notebook *notebook; Gtk::Notebook *notebook;
Gtk::VBox *streamsVBox, *recsVBox, *sinksVBox, *sourcesVBox, *cardsVBox; Gtk::VBox *streamsVBox, *recsVBox, *sinksVBox, *sourcesVBox, *cardsVBox;
Gtk::Label *noStreamsLabel, *noRecsLabel, *noSinksLabel, *noSourcesLabel, *noCardsLabel; Gtk::Label *noStreamsLabel, *noRecsLabel, *noSinksLabel, *noSourcesLabel, *noCardsLabel;