From 5b55750de91168290e65c924fa654f9954cc9be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Sat, 16 Dec 2017 14:22:07 +0100 Subject: [PATCH 1/3] Fix typo in BroadcastProfile::loadValues --- src/preferences/broadcastprofile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preferences/broadcastprofile.cpp b/src/preferences/broadcastprofile.cpp index 5c46563678a6..824d2e9364ec 100644 --- a/src/preferences/broadcastprofile.cpp +++ b/src/preferences/broadcastprofile.cpp @@ -298,7 +298,7 @@ bool BroadcastProfile::loadValues(const QString& filename) { m_customTitle = XmlParse::selectNodeQString(doc, kCustomTitle); m_metadataFormat = XmlParse::selectNodeQString(doc, kMetadataFormat); m_oggDynamicUpdate = - (bool)XmlParse::selectNodeInt(doc, kMetadataFormat); + (bool)XmlParse::selectNodeInt(doc, kOggDynamicUpdate); return true; } From 16610fcc127c0464405c1a0e0bcd197e3d89583a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Sat, 16 Dec 2017 14:32:12 +0100 Subject: [PATCH 2/3] Live Broadcasting: rename "connections" to "source connections" --- src/preferences/dialog/dlgprefbroadcast.cpp | 10 ++++---- src/preferences/dialog/dlgprefbroadcastdlg.ui | 24 ++++++++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/preferences/dialog/dlgprefbroadcast.cpp b/src/preferences/dialog/dlgprefbroadcast.cpp index c5d80ce496ac..133a8ad46d99 100644 --- a/src/preferences/dialog/dlgprefbroadcast.cpp +++ b/src/preferences/dialog/dlgprefbroadcast.cpp @@ -177,7 +177,7 @@ void DlgPrefBroadcast::slotApply() { QMessageBox::warning( this, tr("Action failed"), tr("'%1' has the same Icecast mountpoint as '%2'.\n" - "Two connections on the same server can't have the same mountpoint.") + "Two source connections to the same server can't have the same mountpoint.") .arg(profileName).arg(profileNameWithSameMountpoint)); return; } @@ -236,7 +236,7 @@ void DlgPrefBroadcast::enableCustomMetadataChanged(int value) { void DlgPrefBroadcast::btnCreateConnectionClicked() { if(m_pSettingsModel->rowCount() >= BROADCAST_MAX_CONNECTIONS) { QMessageBox::warning(this, tr("Action failed"), - tr("You can't create more than %1 Live Broadcasting connections.") + tr("You can't create more than %1 source connections.") .arg(BROADCAST_MAX_CONNECTIONS)); return; } @@ -249,7 +249,7 @@ void DlgPrefBroadcast::btnCreateConnectionClicked() { QString newName; do { profileNumber++; - newName = tr("Connection %1").arg(profileNumber); + newName = tr("Source connection %1").arg(profileNumber); existingProfile = m_pSettingsModel->getProfileByName(newName); } while(!existingProfile.isNull()); @@ -490,7 +490,7 @@ void DlgPrefBroadcast::setValuesToProfile(BroadcastProfilePtr profile) { void DlgPrefBroadcast::btnRemoveConnectionClicked() { if(m_pSettingsModel->rowCount() < 2) { QMessageBox::information(this, tr("Action failed"), - tr("At least one connection is required.")); + tr("At least one source connection is required.")); return; } @@ -534,7 +534,7 @@ void DlgPrefBroadcast::btnRenameConnectionClicked() { void DlgPrefBroadcast::btnDisconnectAllClicked() { auto response = QMessageBox::question(this, tr("Confirmation required"), - tr("Are you sure you want to disconnect every active Live Broadcasting source connection?"), + tr("Are you sure you want to disconnect every active source connection?"), QMessageBox::Yes, QMessageBox::No); if(response == QMessageBox::Yes) { diff --git a/src/preferences/dialog/dlgprefbroadcastdlg.ui b/src/preferences/dialog/dlgprefbroadcastdlg.ui index 85be1e20e74a..ac8b3dcd03e9 100644 --- a/src/preferences/dialog/dlgprefbroadcastdlg.ui +++ b/src/preferences/dialog/dlgprefbroadcastdlg.ui @@ -174,7 +174,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -634,7 +643,7 @@ p, li { white-space: pre-wrap; } - Select a connection above to edit its settings here + Select a source connection above to edit its settings here @@ -757,7 +766,16 @@ p, li { white-space: pre-wrap; } - + + 0 + + + 0 + + + 0 + + 0 From 5b860eab4e1c095f54ad2169b0b5f55df9bb2686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Sat, 16 Dec 2017 15:34:07 +0100 Subject: [PATCH 3/3] Fix connection selection behaviour in Live Broadcasting settings --- src/preferences/dialog/dlgprefbroadcast.cpp | 28 +++++++++++++-------- src/preferences/dialog/dlgprefbroadcast.h | 3 +-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/preferences/dialog/dlgprefbroadcast.cpp b/src/preferences/dialog/dlgprefbroadcast.cpp index 133a8ad46d99..717589e59fc7 100644 --- a/src/preferences/dialog/dlgprefbroadcast.cpp +++ b/src/preferences/dialog/dlgprefbroadcast.cpp @@ -46,9 +46,9 @@ DlgPrefBroadcast::DlgPrefBroadcast(QWidget *parent, connectionList->setModel(m_pSettingsModel); connect(connectionList->selectionModel(), - SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), + SIGNAL(currentRowChanged(const QModelIndex&, const QModelIndex&)), this, - SLOT(profileListItemSelected(const QModelIndex&, const QModelIndex&))); + SLOT(connectionListItemSelected(const QModelIndex&))); connect(btnRemoveConnection, SIGNAL(clicked(bool)), this, SLOT(btnRemoveConnectionClicked())); connect(btnRenameConnection, SIGNAL(clicked(bool)), @@ -104,9 +104,6 @@ DlgPrefBroadcast::DlgPrefBroadcast(QWidget *parent, comboBoxEncodingChannels->addItem(tr("Stereo"), static_cast(EncoderSettings::ChannelMode::STEREO)); - BroadcastProfilePtr pProfile = m_pBroadcastSettings->profileAt(0); - getValuesFromProfile(pProfile); - connect(checkBoxEnableReconnect, SIGNAL(stateChanged(int)), this, SLOT(checkBoxEnableReconnectChanged(int))); @@ -130,7 +127,7 @@ void DlgPrefBroadcast::slotUpdate() { // Force select an item to have the current selection // set to a profile pointer belonging to the model - connectionList->selectRow(0); + selectConnectionRow(0); // Don't let user modify information if // sending is enabled. @@ -261,9 +258,7 @@ void DlgPrefBroadcast::btnCreateConnectionClicked() { selectConnectionRowByName(newProfile->getProfileName()); } -void DlgPrefBroadcast::profileListItemSelected(const QModelIndex& selected, - const QModelIndex& deselected) { - Q_UNUSED(deselected); +void DlgPrefBroadcast::connectionListItemSelected(const QModelIndex& selected) { setValuesToProfile(m_pProfileListSelection); QString selectedName = m_pSettingsModel->data(selected, @@ -292,11 +287,22 @@ void DlgPrefBroadcast::updateModel() { } void DlgPrefBroadcast::selectConnectionRow(int row) { - if(row < 0 || row > m_pSettingsModel->rowCount()) { - return; + if (row < 0) { + row = 0; + } + + const int maxRow = m_pSettingsModel->rowCount() - 1; + if (row > maxRow) { + row = maxRow; } connectionList->selectRow(row); + + // QTableView::selectRow updates the UI but doesn't trigger + // currentRowChanged in the selection model object, so + // we must do it manually + QModelIndex newSelection = m_pSettingsModel->index(row, kColumnName); + connectionListItemSelected(newSelection); } void DlgPrefBroadcast::selectConnectionRowByName(QString rowName) { diff --git a/src/preferences/dialog/dlgprefbroadcast.h b/src/preferences/dialog/dlgprefbroadcast.h index 490d6aec7e0e..3848d3d7d62a 100644 --- a/src/preferences/dialog/dlgprefbroadcast.h +++ b/src/preferences/dialog/dlgprefbroadcast.h @@ -30,8 +30,7 @@ class DlgPrefBroadcast : public DlgPreferencePage, public Ui::DlgPrefBroadcastDl void checkBoxEnableReconnectChanged(int value); void checkBoxLimitReconnectsChanged(int value); void enableCustomMetadataChanged(int value); - void profileListItemSelected(const QModelIndex& selected, - const QModelIndex& deselected); + void connectionListItemSelected(const QModelIndex& selected); signals: void apply(const QString &);