Commit 1da5a889 authored by Andreas Traczyk's avatar Andreas Traczyk

settings: fix crash when there no accounts present

Change-Id: I02383c1a8916ea2088e1145f18b41321dc9442b2
parent c4e86975
......@@ -15,13 +15,15 @@
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "advancedsettingswidget.h"
#include "ui_advancedsettingswidget.h"
#include <QFileDialog>
#include "lrcinstance.h"
#include "api/newcodecmodel.h"
#include "advancedsettingswidget.h"
#include "ui_advancedsettingswidget.h"
#include "lrcinstance.h"
#include "utils.h"
AdvancedSettingsWidget::AdvancedSettingsWidget(QWidget* parent)
:QWidget(parent),
......@@ -29,7 +31,6 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QWidget* parent)
{
ui->setupUi(this);
updateAdvancedSettings();
///////////////////////////////////////////////////////////////////////////////
// call settings
connect(ui->checkBoxUntrusted, &QAbstractButton::clicked, this, &AdvancedSettingsWidget::setCallsUntrusted);
......@@ -75,12 +76,6 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QWidget* parent)
connect(ui->videoDownPushButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::decreaseVideoCodecPriority);
connect(ui->videoUpPushButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::increaseVideoCodecPriority);
///////////////////////////////////////////////////////////////////////////////
ui->btnRingtone->setEnabled(LRCInstance::getCurrAccConfig().Ringtone.ringtoneEnabled);
ui->btnRingtone->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().Ringtone.ringtonePath)).fileName());
ui->lineEditProxy->setEnabled(LRCInstance::getCurrAccConfig().proxyEnabled);
ui->lineEditSTUNAddress->setEnabled(LRCInstance::getCurrAccConfig().STUN.enable);
}
AdvancedSettingsWidget::~AdvancedSettingsWidget()
......@@ -123,6 +118,11 @@ AdvancedSettingsWidget::updateAdvancedSettings()
ui->videoCheckBox->setChecked(config.Video.videoEnabled);
updateAudioCodecs();
updateVideoCodecs();
ui->btnRingtone->setEnabled(LRCInstance::getCurrAccConfig().Ringtone.ringtoneEnabled);
ui->btnRingtone->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().Ringtone.ringtonePath)).fileName());
ui->lineEditProxy->setEnabled(LRCInstance::getCurrAccConfig().proxyEnabled);
ui->lineEditSTUNAddress->setEnabled(LRCInstance::getCurrAccConfig().STUN.enable);
}
// call settings
......
......@@ -34,9 +34,10 @@ public:
AdvancedSettingsWidget(QWidget* parent = nullptr);
~AdvancedSettingsWidget();
void updateAdvancedSettings();
private:
Ui::AdvancedSettingsWidget* ui;
void updateAdvancedSettings();
private slots:
// call settings
......@@ -85,5 +86,4 @@ private slots:
void setVideoState(int state);
};
\ No newline at end of file
......@@ -261,6 +261,7 @@ SettingsWidget::toggleAdvancedSettings()
ui->advancedAccountSettingsPButton->setIcon(QPixmap(":/images/icons/round-arrow_drop_up-24px.svg"));
ui->scrollBarLabel->hide();
ui->advancedSettingsWidget->setVisible(true);
ui->advancedSettingsWidget->updateAdvancedSettings();
QTimer::singleShot(50, this,
[this] {
auto top = ui->advancedAccountSettingsPButton->frameGeometry().top();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment