Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/preferences/broadcastprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
38 changes: 22 additions & 16 deletions src/preferences/dialog/dlgprefbroadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -104,9 +104,6 @@ DlgPrefBroadcast::DlgPrefBroadcast(QWidget *parent,
comboBoxEncodingChannels->addItem(tr("Stereo"),
static_cast<int>(EncoderSettings::ChannelMode::STEREO));

BroadcastProfilePtr pProfile = m_pBroadcastSettings->profileAt(0);
getValuesFromProfile(pProfile);

connect(checkBoxEnableReconnect, SIGNAL(stateChanged(int)),
this, SLOT(checkBoxEnableReconnectChanged(int)));

Expand All @@ -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.
Expand Down Expand Up @@ -177,7 +174,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;
}
Expand Down Expand Up @@ -236,7 +233,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;
}
Expand All @@ -249,7 +246,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());

Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -490,7 +496,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;
}

Expand Down Expand Up @@ -534,7 +540,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) {
Expand Down
3 changes: 1 addition & 2 deletions src/preferences/dialog/dlgprefbroadcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 &);
Expand Down
24 changes: 21 additions & 3 deletions src/preferences/dialog/dlgprefbroadcastdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,16 @@
<item>
<widget class="QWidget" name="widgetReconnectControls" native="true">
<layout class="QGridLayout" name="gridLayout_5">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
Expand Down Expand Up @@ -634,7 +643,7 @@ p, li { white-space: pre-wrap; }
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="labelHowtoSettings">
<property name="text">
<string>Select a connection above to edit its settings here</string>
<string>Select a source connection above to edit its settings here</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -757,7 +766,16 @@ p, li { white-space: pre-wrap; }
<item row="1" column="0">
<widget class="QWidget" name="groupPasswordStorage" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand Down