diff --git a/RingWinClient.pro b/RingWinClient.pro index b2a8b690dbe846712301b6c6006477e10e2b7c07..3cc68ad030fc65c25cdb59ba7bcef8aabc2041ce 100644 --- a/RingWinClient.pro +++ b/RingWinClient.pro @@ -41,7 +41,8 @@ SOURCES += main.cpp\ windowscontactbackend.cpp \ historydelegate.cpp \ contactdelegate.cpp \ - selectareadialog.cpp + selectareadialog.cpp \ + accountserializationadapter.cpp HEADERS += mainwindow.h \ callwidget.h \ @@ -58,7 +59,8 @@ HEADERS += mainwindow.h \ windowscontactbackend.h \ historydelegate.h \ contactdelegate.h \ - selectareadialog.h + selectareadialog.h \ + accountserializationadapter.h FORMS += mainwindow.ui \ callwidget.ui \ diff --git a/accountdetails.cpp b/accountdetails.cpp index 487dce5c65ef4d2c8de159bf400fbdf5561dbc05..e6e8fc14e29a4af1732a9836b61d02542f674d6a 100644 --- a/accountdetails.cpp +++ b/accountdetails.cpp @@ -20,16 +20,20 @@ #include "ui_accountdetails.h" #include <QSortFilterProxyModel> +#include <QFileDialog> +#include <QPushButton> -#include "accountmodel.h" -#include "account.h" #include "accountdetails.h" #include "audio/codecmodel.h" +#include "protocolmodel.h" +#include "certificate.h" +#include "ciphermodel.h" AccountDetails::AccountDetails(QWidget *parent) : QWidget(parent), ui(new Ui::AccountDetails), codecModel_(nullptr), + currentAccount_(nullptr), codecModelModified(false) { ui->setupUi(this); @@ -48,20 +52,16 @@ AccountDetails::AccountDetails(QWidget *parent) : ui->videoCodecView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->videoCodecView->setShowGrid(false); - ui->hashValue->setAlignment(Qt::AlignCenter); + ui->lrcfg_username->setAlignment(Qt::AlignCenter); connect(ui->audioCodecView, SIGNAL(cellChanged(int,int)), this, SLOT(audio_codec_checked(int, int))); connect(ui->videoCodecView, SIGNAL(cellChanged(int,int)), this, SLOT(video_codec_checked(int,int))); - connect(ui->videoEnabledCheckBox, SIGNAL(toggled(bool)), - this, SLOT(setVideoEnabled(bool))); - connect(ui->autoAnswerCheckBox, SIGNAL(toggled(bool)), - this, SLOT(setAutoAnswer(bool))); - connect(ui->aliasValue, SIGNAL(editingFinished()), - this, SLOT(aliasChanged())); - connect(ui->bootstrapLineEdit, SIGNAL(editingFinished()), - this, SLOT(bootstrapChanged())); + + connect(ui->lrcfg_tlsCaListCertificate, SIGNAL(clicked(bool)), this, SLOT(onCertButtonClicked())); + connect(ui->lrcfg_tlsCertificate, SIGNAL(clicked(bool)), this, SLOT(onCertButtonClicked())); + connect(ui->lrcfg_tlsPrivateKeyCertificate, SIGNAL(clicked(bool)), this, SLOT(onCertButtonClicked())); } AccountDetails::~AccountDetails() @@ -144,6 +144,10 @@ AccountDetails::reloadCodec(CodecType type) void AccountDetails::setAccount(Account* currentAccount) { + if (currentAccount_) { + currentAccount_->performAction(Account::EditAction::SAVE); + } + currentAccount_ = currentAccount; if (codecModel_ && codecModelModified) @@ -151,75 +155,77 @@ AccountDetails::setAccount(Account* currentAccount) { codecModel_ = currentAccount->codecModel(); - //FIX ME : Reorganize this in group - ui->hashValue->hide(); - ui->hashLabel->hide(); - ui->aliasValue->hide(); - ui->aliasLabel->hide(); - ui->bootstrapLabel->hide(); - ui->bootstrapLineEdit->hide(); - ui->hostnameLabel->hide(); - ui->hostnameEdit->hide(); - ui->usernameEdit->hide(); - ui->usernameLabel->hide(); - ui->passwordEdit->hide(); - ui->passwordLabel->hide(); - ui->proxyEdit->hide(); - ui->proxyLabel->hide(); - ui->voicemailLabel->hide(); - ui->voicemailEdit->hide(); - - switch (currentAccount_->protocol()) { - case Account::Protocol::SIP: - if (currentAccount_ != AccountModel::instance()->ip2ip()) { - ui->typeValueLabel->setText("SIP"); - ui->aliasValue->setText(currentAccount_->alias()); - ui->hostnameEdit->setText(currentAccount_->hostname()); - ui->usernameEdit->setText(currentAccount_->username()); - ui->passwordEdit->setText(currentAccount_->password()); - ui->proxyEdit->setText(currentAccount_->proxy()); - ui->voicemailEdit->setText(currentAccount_->mailbox()); - - ui->aliasLabel->show(); - ui->aliasValue->show(); - ui->hostnameLabel->show(); - ui->hostnameEdit->show(); - ui->usernameEdit->show(); - ui->usernameLabel->show(); - ui->passwordEdit->show(); - ui->passwordLabel->show(); - ui->proxyEdit->show(); - ui->proxyLabel->show(); - ui->voicemailLabel->show(); - ui->voicemailEdit->show(); - } else { - ui->typeValueLabel->setText("IP2IP"); - } - break; - case Account::Protocol::IAX: - ui->typeValueLabel->setText("IAX"); - break; - case Account::Protocol::RING: - ui->typeValueLabel->setText("RING"); - ui->aliasValue->setText(currentAccount_->alias()); - ui->hashValue->setText(currentAccount_->username()); - ui->bootstrapLineEdit->setText(currentAccount_->hostname()); - ui->hashValue->show(); - ui->hashLabel->show(); - ui->aliasLabel->show(); - ui->aliasValue->show(); - ui->bootstrapLabel->show(); - ui->bootstrapLineEdit->show(); + ui->typeValueLabel->setText(currentAccount_->protocolModel()-> + selectionModel()->currentIndex().data().value<QString>()); + + ui->publishGroup->disconnect(); + + if (currentAccount_->isPublishedSameAsLocal()) + ui->puslishedSameAsLocalRadio->setChecked(true); + else + ui->customPublishedRadio->setChecked(true); + + ui->publishGroup->setId(ui->puslishedSameAsLocalRadio, 1); + ui->publishGroup->setId(ui->customPublishedRadio, 0); + ui->lrcfg_publishedAddress->setEnabled(!currentAccount_->isPublishedSameAsLocal()); + ui->lrcfg_publishedPort->setEnabled(!currentAccount_->isPublishedSameAsLocal()); + + connect(ui->publishGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), + [=](int id) { + currentAccount_->setPublishedSameAsLocal(static_cast<bool>(id)); + }); + + switch (currentAccount_->DTMFType()) { + case DtmfType::OverRtp: + ui->rtpRadio->setChecked(true); break; - default: + case DtmfType::OverSip: + ui->sipRadio->setChecked(true); break; } - reloadCodec(); + ui->dtmfGroup->disconnect(); + ui->dtmfGroup->setId(ui->rtpRadio, DtmfType::OverRtp); + ui->dtmfGroup->setId(ui->sipRadio, DtmfType::OverSip); + + connect(ui->dtmfGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), + [=](int id){ currentAccount_->setDTMFType(static_cast<DtmfType>(id)); }); + + ui->keyExchangeModelCombo->setModel(currentAccount_->keyExchangeModel()); + ui->tlsProtocoCombo->setModel(currentAccount_->tlsMethodModel()); - ui->videoEnabledCheckBox->setChecked(currentAccount_->isVideoEnabled()); - ui->autoAnswerCheckBox->setChecked(currentAccount_->isAutoAnswer()); - ui->upnpCheckBox->setChecked(currentAccount_->isUpnpEnabled()); + if (currentAccount_->tlsCaListCertificate()) + ui->lrcfg_tlsCaListCertificate->setText(currentAccount_->tlsCaListCertificate()->path().fileName()); + if (currentAccount_->tlsCertificate()) + ui->lrcfg_tlsCertificate->setText(currentAccount_->tlsCertificate()->path().fileName()); + if (currentAccount_->tlsPrivateKeyCertificate()) + ui->lrcfg_tlsPrivateKeyCertificate->setText(currentAccount_->tlsPrivateKeyCertificate()->path().fileName()); + + certMap_[ui->lrcfg_tlsCaListCertificate->objectName()] = ¤tAccount_->setTlsCaListCertificate; + certMap_[ui->lrcfg_tlsCertificate->objectName()] = ¤tAccount_->setTlsCertificate; + certMap_[ui->lrcfg_tlsPrivateKeyCertificate->objectName()] = ¤tAccount_->setTlsPrivateKeyCertificate; + + ui->srtpEnabled->disconnect(); + connect(ui->srtpEnabled, &QCheckBox::toggled, [=](bool checked) { + currentAccount_->setSrtpEnabled(checked); + ui->lrcfg_srtpRtpFallback->setEnabled(checked); + ui->keyExchangeModelCombo->setEnabled(checked); + }); + + ui->srtpEnabled->setChecked(currentAccount_->isSrtpEnabled()); + + if (currentAccount_->cipherModel()->useDefault()) + ui->defaultCipherRadio->setChecked(true); + else + ui->customCipherRadio->setChecked(true); + + connect(ui->defaultCipherRadio, &QRadioButton::toggled, [=](bool checked) { + currentAccount_->cipherModel()->setUseDefault(checked); + }); + + ui->cipherListView->setModel(currentAccount_->cipherModel()); + + reloadCodec(); } void @@ -244,26 +250,6 @@ AccountDetails::video_codec_checked(int row, int column) { codecModelModified = true; } -void -AccountDetails::setVideoEnabled(bool enabled) { - currentAccount_->setVideoEnabled(enabled); -} - -void -AccountDetails::setAutoAnswer(bool enabled) { - currentAccount_->setAutoAnswer(enabled); -} - -void -AccountDetails::aliasChanged() { - currentAccount_->setAlias(ui->aliasValue->text()); -} - -void -AccountDetails::bootstrapChanged() { - currentAccount_->setHostname(ui->bootstrapLineEdit->text()); -} - void AccountDetails::on_upAudioButton_clicked() { @@ -322,36 +308,12 @@ AccountDetails::save() { codecModel_->save(); } -void -AccountDetails::on_hostnameEdit_editingFinished() -{ - currentAccount_->setHostname(ui->hostnameEdit->text()); -} - void AccountDetails::on_usernameEdit_editingFinished() { currentAccount_->setUsername(ui->usernameEdit->text()); } -void -AccountDetails::on_passwordEdit_editingFinished() -{ - currentAccount_->setPassword(ui->passwordEdit->text()); -} - -void -AccountDetails::on_proxyEdit_editingFinished() -{ - currentAccount_->setProxy(ui->proxyEdit->text()); -} - -void -AccountDetails::on_voicemailEdit_editingFinished() -{ - currentAccount_->setMailbox(ui->voicemailEdit->text()); -} - void AccountDetails::on_tabWidget_currentChanged(int index) { @@ -362,7 +324,17 @@ AccountDetails::on_tabWidget_currentChanged(int index) } } -void AccountDetails::on_upnpCheckBox_clicked(bool checked) + +void +AccountDetails::onCertButtonClicked() { - currentAccount_->setUpnpEnabled(checked); + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose File"), + "", + tr("Files (*)")); + + auto sender = QObject::sender(); + + (currentAccount_->*certMap_[sender->objectName()])(fileName); + + static_cast<QPushButton*>(sender)->setText(fileName); } diff --git a/accountdetails.h b/accountdetails.h index c4baa9a30c3c695b918bfb4b5573f8308f6b5d8c..b41a81e9a67552894f757ffe1a9c79a853bf20e3 100644 --- a/accountdetails.h +++ b/accountdetails.h @@ -20,11 +20,13 @@ #define ACCOUNTDETAILS_H #include <QWidget> +#include <QMap> #include <QTableWidgetItem> #include "accountmodel.h" #include "audio/codecmodel.h" +#include "account.h" namespace Ui { class AccountDetails; @@ -53,27 +55,21 @@ private slots: void on_downVideoButton_clicked(); void on_audioCodecView_itemSelectionChanged(); void on_videoCodecView_itemSelectionChanged(); - void on_hostnameEdit_editingFinished(); void on_usernameEdit_editingFinished(); - void on_passwordEdit_editingFinished(); - void on_proxyEdit_editingFinished(); - void on_voicemailEdit_editingFinished(); void on_tabWidget_currentChanged(int index); - void on_upnpCheckBox_clicked(bool checked); private slots: void audio_codec_checked(int row, int column); - void setVideoEnabled(bool enabled); void video_codec_checked(int row, int column); - void setAutoAnswer(bool enabled); - void aliasChanged(); - void bootstrapChanged(); + void onCertButtonClicked(); private: Ui::AccountDetails *ui; CodecModel* codecModel_; Account* currentAccount_; bool codecModelModified; + typedef void (Account::*ACC_PTR)(const QString&); + QMap<QString, ACC_PTR > certMap_; }; diff --git a/accountdetails.ui b/accountdetails.ui index bcb1c2cf902edeb2bd685235659ad51458516eb8..5578e1476de70c9426c3f0704c67911c69857ad7 100644 --- a/accountdetails.ui +++ b/accountdetails.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>730</width> - <height>559</height> + <width>748</width> + <height>657</height> </rect> </property> <property name="windowTitle"> @@ -63,13 +63,6 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLabel" name="typeValueLabel"> - <property name="text"> - <string>TextLabel</string> - </property> - </widget> - </item> <item row="0" column="0"> <widget class="QLabel" name="aliasLabel"> <property name="text"> @@ -78,7 +71,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="QLineEdit" name="aliasValue"/> + <widget class="QLineEdit" name="lrcfg_alias"/> </item> <item row="2" column="0"> <widget class="QLabel" name="hashLabel"> @@ -88,12 +81,19 @@ </widget> </item> <item row="2" column="1"> - <widget class="QLineEdit" name="hashValue"> + <widget class="QLineEdit" name="lrcfg_username"> <property name="readOnly"> <bool>true</bool> </property> </widget> </item> + <item row="1" column="1"> + <widget class="QLabel" name="typeValueLabel"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> </layout> </item> </layout> @@ -130,86 +130,120 @@ <property name="topMargin"> <number>10</number> </property> - <item row="6" column="0"> - <widget class="QCheckBox" name="autoAnswerCheckBox"> - <property name="text"> - <string>Auto-answer calls</string> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QCheckBox" name="upnpCheckBox"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string>UPnP enabled</string> - </property> - </widget> - </item> <item row="0" column="0"> - <widget class="QLabel" name="bootstrapLabel"> - <property name="text"> - <string>Bootstrap</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="bootstrapLineEdit"/> - </item> - <item row="1" column="0"> <widget class="QLabel" name="hostnameLabel"> <property name="text"> <string>Hostname</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="hostnameEdit"/> + <item row="0" column="1"> + <widget class="QLineEdit" name="lrcfg_hostname"/> </item> - <item row="2" column="0"> + <item row="1" column="0"> <widget class="QLabel" name="usernameLabel"> <property name="text"> <string>Username</string> </property> </widget> </item> - <item row="2" column="1"> + <item row="1" column="1"> <widget class="QLineEdit" name="usernameEdit"/> </item> - <item row="3" column="0"> + <item row="2" column="0"> <widget class="QLabel" name="passwordLabel"> <property name="text"> <string>Password</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="passwordEdit"> + <item row="2" column="1"> + <widget class="QLineEdit" name="lrcfg_password"> <property name="echoMode"> <enum>QLineEdit::PasswordEchoOnEdit</enum> </property> </widget> </item> - <item row="4" column="0"> + <item row="3" column="0"> <widget class="QLabel" name="proxyLabel"> <property name="text"> <string>Proxy</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="proxyEdit"/> + <item row="3" column="1"> + <widget class="QLineEdit" name="lrcfg_proxy"/> </item> - <item row="5" column="0"> + <item row="4" column="0"> <widget class="QLabel" name="voicemailLabel"> <property name="text"> <string>Voicemail number</string> </property> </widget> </item> - <item row="5" column="1"> - <widget class="QLineEdit" name="voicemailEdit"/> + <item row="4" column="1"> + <widget class="QLineEdit" name="lrcfg_mailbox"/> + </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="lrcfg_autoAnswer"> + <property name="text"> + <string>Auto-answer calls</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QCheckBox" name="lrcfg_upnpEnabled"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>UPnP enabled</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>DTMF tone type</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QRadioButton" name="rtpRadio"> + <property name="text"> + <string>RTP</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">dtmfGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="sipRadio"> + <property name="text"> + <string>SIP</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">dtmfGroup</string> + </attribute> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> </item> </layout> </item> @@ -310,7 +344,7 @@ <widget class="QTableWidget" name="videoCodecView"/> </item> <item row="2" column="0"> - <widget class="QCheckBox" name="videoEnabledCheckBox"> + <widget class="QCheckBox" name="lrcfg_isVideoEnabled"> <property name="text"> <string>Enable Video</string> </property> @@ -372,6 +406,729 @@ </item> </layout> </widget> + <widget class="QWidget" name="advancedTab"> + <attribute name="title"> + <string>Advanced</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QLabel" name="label_2"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Registration</string> + </property> + </widget> + </item> + <item> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Registration expire timeout (seconds):</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="lrcfg_registrationExpire"> + <property name="maximumSize"> + <size> + <width>150</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Network Interface</string> + </property> + </widget> + </item> + <item> + <layout class="QFormLayout" name="formLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>Local Port:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <item> + <widget class="QSpinBox" name="lrcfg_localPort"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Published Adress</string> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <property name="topMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QRadioButton" name="puslishedSameAsLocalRadio"> + <property name="text"> + <string>Same as local parameters</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <attribute name="buttonGroup"> + <string notr="true">publishGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="customPublishedRadio"> + <property name="text"> + <string>Set published address and port:</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">publishGroup</string> + </attribute> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="publishAdressLayout"> + <property name="leftMargin"> + <number>30</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Adress</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="lrcfg_publishedAddress"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Port</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="lrcfg_publishedPort"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="topMargin"> + <number>0</number> + </property> + <item> + <widget class="QCheckBox" name="lrcfg_sipStunEnabled"> + <property name="text"> + <string>Use STUN</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="lrcfg_sipStunServer"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <property name="topMargin"> + <number>0</number> + </property> + <item> + <widget class="QCheckBox" name="lrcfg_turnEnabled"> + <property name="text"> + <string>Use TURN</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="lrcfg_sipTurnServer"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="label_5"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>SDP Session Negotiation (ICE Fallback)</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>These settings are only used during SDP session negotiation in case ICE is not supported by the server or peer.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_8"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Audio RTP Port Range</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="leftMargin"> + <number>30</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Min</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="lrcfg_audioPortMin"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Max</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="lrcfg_audioPortMax"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="label_7"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Video RTP Port Range</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="leftMargin"> + <number>30</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Min</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="lrcfg_videoPortMin"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_16"> + <property name="text"> + <string>Max</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="lrcfg_videoPortMax"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="securityTab"> + <attribute name="title"> + <string>Security</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="QLabel" name="label_17"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Media Stream Encryption</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="srtpEnabled"> + <property name="text"> + <string>Encrypt media stream (SRTP)</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Key exchange protocol</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="keyExchangeModelCombo"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="lrcfg_srtpRtpFallback"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Fallback on RTP on encryption failure</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_19"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Negotiation Encryption</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="lrcfg_tlsEnabled"> + <property name="text"> + <string>Encrypt negotiation (TLS)</string> + </property> + </widget> + </item> + <item> + <layout class="QFormLayout" name="formLayout_5"> + <item row="0" column="0"> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>CA certificate</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>User certificate</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_22"> + <property name="text"> + <string>Private key</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_23"> + <property name="text"> + <string>Private key password</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_24"> + <property name="text"> + <string>TLS protocol method</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_25"> + <property name="text"> + <string>Outgoing TLS server name</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_26"> + <property name="text"> + <string>Negotiation timeout (seconds)</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="lrcfg_tlsPassword"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="tlsProtocoCombo"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLineEdit" name="lrcfg_tlsServerName"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QSpinBox" name="lrcfg_tlsNegotiationTimeoutSec"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximum"> + <number>100000</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="lrcfg_tlsCertificate"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>PushButton</string> + </property> + <property name="icon"> + <iconset resource="ressources.qrc"> + <normaloff>:/images/folder-download.png</normaloff>:/images/folder-download.png</iconset> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="lrcfg_tlsPrivateKeyCertificate"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>PushButton</string> + </property> + <property name="icon"> + <iconset resource="ressources.qrc"> + <normaloff>:/images/folder-download.png</normaloff>:/images/folder-download.png</iconset> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="lrcfg_tlsCaListCertificate"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>PushButton</string> + </property> + <property name="icon"> + <iconset resource="ressources.qrc"> + <normaloff>:/images/folder-download.png</normaloff>:/images/folder-download.png</iconset> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="lrcfg_tlsVerifyServer"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Verify incoming certificates (server side)</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="lrcfg_tlsVerifyClient"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Verify answer certificates (client side)</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="lrcfg_tlsRequireClientCertificate"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Require a certificate for incoming TLS connections</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Cipher</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_10" stretch="0,1"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QRadioButton" name="defaultCipherRadio"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Use default ciphers</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="customCipherRadio"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>User custom cipher list</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QListView" name="cipherListView"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> </widget> </item> </layout> @@ -379,5 +1136,283 @@ <resources> <include location="ressources.qrc"/> </resources> - <connections/> + <connections> + <connection> + <sender>customPublishedRadio</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_publishedAddress</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>120</x> + <y>277</y> + </hint> + <hint type="destinationlabel"> + <x>131</x> + <y>311</y> + </hint> + </hints> + </connection> + <connection> + <sender>customPublishedRadio</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_publishedPort</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>386</x> + <y>277</y> + </hint> + <hint type="destinationlabel"> + <x>390</x> + <y>305</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_turnEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_sipTurnServer</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>71</x> + <y>396</y> + </hint> + <hint type="destinationlabel"> + <x>196</x> + <y>393</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_sipStunEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_sipStunServer</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>33</x> + <y>355</y> + </hint> + <hint type="destinationlabel"> + <x>252</x> + <y>355</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsCaListCertificate</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>143</x> + <y>257</y> + </hint> + <hint type="destinationlabel"> + <x>327</x> + <y>296</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsCertificate</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>88</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>289</x> + <y>336</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsPrivateKeyCertificate</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>69</x> + <y>266</y> + </hint> + <hint type="destinationlabel"> + <x>257</x> + <y>376</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsPassword</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>188</x> + <y>259</y> + </hint> + <hint type="destinationlabel"> + <x>257</x> + <y>415</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>tlsProtocoCombo</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>115</x> + <y>258</y> + </hint> + <hint type="destinationlabel"> + <x>261</x> + <y>455</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsServerName</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>217</x> + <y>257</y> + </hint> + <hint type="destinationlabel"> + <x>244</x> + <y>490</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsNegotiationTimeoutSec</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>52</x> + <y>261</y> + </hint> + <hint type="destinationlabel"> + <x>259</x> + <y>523</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsVerifyServer</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>240</x> + <y>261</y> + </hint> + <hint type="destinationlabel"> + <x>180</x> + <y>565</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsVerifyClient</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>333</x> + <y>258</y> + </hint> + <hint type="destinationlabel"> + <x>288</x> + <y>584</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>lrcfg_tlsRequireClientCertificate</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>369</x> + <y>262</y> + </hint> + <hint type="destinationlabel"> + <x>375</x> + <y>625</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>defaultCipherRadio</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>373</x> + <y>255</y> + </hint> + <hint type="destinationlabel"> + <x>195</x> + <y>66</y> + </hint> + </hints> + </connection> + <connection> + <sender>lrcfg_tlsEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>customCipherRadio</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>373</x> + <y>255</y> + </hint> + <hint type="destinationlabel"> + <x>551</x> + <y>66</y> + </hint> + </hints> + </connection> + <connection> + <sender>customCipherRadio</sender> + <signal>toggled(bool)</signal> + <receiver>cipherListView</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>496</x> + <y>74</y> + </hint> + <hint type="destinationlabel"> + <x>499</x> + <y>139</y> + </hint> + </hints> + </connection> + </connections> + <buttongroups> + <buttongroup name="publishGroup"/> + <buttongroup name="dtmfGroup"/> + <buttongroup name="cipherGroup"/> + </buttongroups> </ui> diff --git a/accountserializationadapter.cpp b/accountserializationadapter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7065e96368166be9f43e2b9452c7e83af530098c --- /dev/null +++ b/accountserializationadapter.cpp @@ -0,0 +1,141 @@ +/*************************************************************************** + * Copyright (C) 2015 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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 "accountserializationadapter.h" + +#include <QtWidgets/QWidget> +#include <QtWidgets/QLayout> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QSpinBox> +#include <QtWidgets/QAbstractButton> + +#include <account.h> +#include <accountmodel.h> + +constexpr static const char LRC_CFG[] = "lrcfg_"; +constexpr static const int LRC_CFG_LEN = 6 ; + +struct ConnHolder { + QMetaObject::Connection c; + ~ConnHolder(); +}; +Q_DECLARE_METATYPE(ConnHolder*); + +ConnHolder::~ConnHolder() +{ + QObject::disconnect(c); +} + +static void avoidDuplicate(QWidget* w) +{ + if (qvariant_cast<ConnHolder*>(w->property("lrcfgConn"))) + delete qvariant_cast<ConnHolder*>(w->property("lrcfgConn")); +} + +/** + * This check for some supported widgets and bind the widgets and property + */ +static void setupWidget(QWidget* w, Account* a, const QHash<QByteArray, int>& roles) +{ + if (w->objectName().left(LRC_CFG_LEN) == LRC_CFG) { + const QByteArray prop = w->objectName().mid(LRC_CFG_LEN, 999).toLatin1(); + if (roles.contains(prop)) { + const int role = roles[prop]; + if (qobject_cast<QLineEdit*>(w)) { + QLineEdit* le = qobject_cast<QLineEdit*>(w); + avoidDuplicate(le); + le->setText(a->roleData(role).toString()); + ConnHolder* c = new ConnHolder { + QObject::connect(le, &QLineEdit::textChanged, [a,role](const QString& text) { + if (a->roleData(role) != text) + a->setRoleData(role, text); + }) + }; + le->setProperty("lrcfgConn",QVariant::fromValue(c)); + } + else if (qobject_cast<QSpinBox*>(w)) { + QSpinBox* sb = qobject_cast<QSpinBox*>(w); + avoidDuplicate(sb); + sb->setValue(a->roleData(role).toInt()); + ConnHolder* c = new ConnHolder { + QObject::connect(sb, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [a,role](int value) { + if (a->roleData(role).toInt() != value) + a->setRoleData(role, value); + }) + }; + sb->setProperty("lrcfgConn",QVariant::fromValue(c)); + } + else if (qobject_cast<QAbstractButton*>(w)) { + //QCheckBox, QRadioButton, QToolButton, QPushButton + QAbstractButton* b = qobject_cast<QAbstractButton*>(w); + avoidDuplicate(b); + b->setChecked(a->roleData(role).toBool()); + ConnHolder* c = new ConnHolder { + QObject::connect(b, &QAbstractButton::toggled,[a,role](bool c) { + if (a->roleData(role).toBool() != c) + a->setRoleData(role, c); + }) + }; + b->setProperty("lrcfgConn",QVariant::fromValue(c)); + } + } + else { + qWarning() << "Unknown config properties" << w->objectName(); + } + } +} + +static void clearConnections(QWidget* w) +{ + if (w->objectName().left(LRC_CFG_LEN) == LRC_CFG) { + avoidDuplicate(w); + } +} + +static void drill(QWidget* w, Account* a, const QHash<QByteArray, int>& roles, bool clear = false) +{ + for (QObject *object : w->children()) { + if (!object->isWidgetType()) + continue; + + QWidget* w2 = static_cast<QWidget*>(object); + if (clear) + clearConnections(w2); + else + setupWidget(w2, a, roles); + + drill(w2, a, roles); + } +} + +AccountSerializationAdapter::AccountSerializationAdapter(Account* a, QWidget* w) : QObject(w) +{ + static QHash<QByteArray, int> reverse; + if (reverse.isEmpty()) { + const QHash<int, QByteArray> a = AccountModel::instance()->roleNames(); + for (QHash<int, QByteArray>::const_iterator i = a.begin(); i != a.end(); ++i) { + reverse[i.value()] = i.key(); + } + } + + drill(w, a, reverse); +} + +AccountSerializationAdapter::~AccountSerializationAdapter() +{ + +} diff --git a/accountserializationadapter.h b/accountserializationadapter.h new file mode 100644 index 0000000000000000000000000000000000000000..862c8f07a0a01551963c3b11d2bdd0587df600a1 --- /dev/null +++ b/accountserializationadapter.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2015 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + **************************************************************************/ +#ifndef ACCOUNTSERIALIZATIONADAPTER_H +#define ACCOUNTSERIALIZATIONADAPTER_H + +#include "typedefs.h" + +class QWidget; +class Account; + +/** + * This class will automatically bridge QtDesigner .ui to the LRC Account:: + * class. To use it, all relevant .ui fields need to have in their name + * + * `lrcfg_propertyName` where `propertyName` is part of the Account object + * roleName hash. + * + * Supported widgets are currently: + * + * * QLineEdit + */ +class LIB_EXPORT AccountSerializationAdapter : public QObject +{ + Q_OBJECT +public: + AccountSerializationAdapter(Account* a, QWidget* w); + virtual ~AccountSerializationAdapter(); +}; + +#endif \ No newline at end of file diff --git a/configurationwidget.cpp b/configurationwidget.cpp index 75d74bf7d9bdc78ce26b35aa0e1f767daac2a7ad..63f5e762ab57c87761af7de26352ac0374e9fe7b 100644 --- a/configurationwidget.cpp +++ b/configurationwidget.cpp @@ -25,6 +25,8 @@ #include "video/rate.h" #include "video/previewmanager.h" +#include "accountserializationadapter.h" + #include "accountmodel.h" #include "protocolmodel.h" #include "accountdetails.h" @@ -136,9 +138,12 @@ ConfigurationWidget::on_rateBox_currentIndexChanged(int index) void ConfigurationWidget::accountSelected(QItemSelection itemSel) { + Q_UNUSED(itemSel) - accountDetails_->setAccount(accountModel_->getAccountByModelIndex( - ui->accountView->currentIndex())); + auto account = accountModel_->getAccountByModelIndex( + ui->accountView->currentIndex()); + accountDetails_->setAccount(account); + AccountSerializationAdapter adapter(account, accountDetails_); } void diff --git a/images/folder-download.png b/images/folder-download.png new file mode 100644 index 0000000000000000000000000000000000000000..637915b1c66cd589ff7cbfb5aeee326e6fe6bb4f Binary files /dev/null and b/images/folder-download.png differ diff --git a/navbar.ui b/navbar.ui index 645afd826498bb73876d227a6752a27c591753ed..b374f36e640ff93dee8f71a36a4cdf89e61fbc7d 100644 --- a/navbar.ui +++ b/navbar.ui @@ -42,7 +42,7 @@ <item> <widget class="QPushButton" name="backButton"> <property name="text"> - <string>Back</string> + <string>Done</string> </property> <property name="icon"> <iconset resource="ressources.qrc"> diff --git a/ressources.qrc b/ressources.qrc index 1b6660e1c05180b1b16f71bb6beb07415a72cef4..9ee18633300fca616be822af420b1014346d7e0f 100644 --- a/ressources.qrc +++ b/ressources.qrc @@ -22,5 +22,6 @@ <file>images/arrow-down.png</file> <file>images/arrow-up.png</file> <file>images/spinner.gif</file> + <file>images/folder-download.png</file> </qresource> </RCC> diff --git a/stylesheet.css b/stylesheet.css index 70864a50060b8a9c1851c6a01e473666d9b8dfb7..8b701871815d0076ac68b54d23b2c56dfe9e3ecc 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -190,7 +190,7 @@ QTabWidget::pane { } QTabBar::tab { - min-width: 80px; + min-width: 95px; min-height: 30px; font-size: 20px; color: black;