From kde-commits Tue Jul 31 21:43:23 2012 From: Emmanuel Lepage Vallee Date: Tue, 31 Jul 2012 21:43:23 +0000 To: kde-commits Subject: [sflphone-kde] src: [ #14078 ] The config dialog were not being correctly deleted, this caused some Message-Id: <20120731214323.CF7F8A6094 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=134377128304172 Git commit bc745502c8fa93ead6383776db5600a0c9419899 by Emmanuel Lepage Vall= ee. Committed on 31/07/2012 at 23:42. Pushed by lepagevalleeemmanuel into branch 'master'. [ #14078 ] The config dialog were not being correctly deleted, this caused = some race conditions M +11 -8 src/conf/dlgaccounts.cpp M +1 -1 src/conf/dlgaccounts.h M +6 -2 src/lib/videocodecmodel.cpp M +3 -3 src/lib/videocodecmodel.h M +6 -6 src/sflphoneview.cpp http://commits.kde.org/sflphone-kde/bc745502c8fa93ead6383776db5600a0c9419899 diff --git a/src/conf/dlgaccounts.cpp b/src/conf/dlgaccounts.cpp index d46595e..c4d44fc 100755 --- a/src/conf/dlgaccounts.cpp +++ b/src/conf/dlgaccounts.cpp @@ -43,7 +43,7 @@ DlgAccounts::DlgAccounts(KConfigDialog* parent) : QWidget(parent),m_IsLoading(false) { - m_IsLoading =3D true; + m_IsLoading++; setupUi(this); button_accountUp->setIcon ( KIcon( "go-up" ) ); button_accountDown->setIcon ( KIcon( "go-down" ) ); @@ -133,7 +133,7 @@ DlgAccounts::DlgAccounts(KConfigDialog* parent) listView_accountList->setCurrentIndex(AccountList::getInstance()->in= dex(0,0)); loadAccount(listView_accountList->currentIndex()); } - m_IsLoading =3D false; + m_IsLoading--; } //DlgAccounts = ///Destructor @@ -163,8 +163,8 @@ void DlgAccounts::saveAccount(QModelIndex item) kDebug() << "Nothing to be saved"; return; } + m_IsLoading++; = - m_IsLoading =3D true; QString protocolsTab[] =3D ACCOUNT_TYPES_TAB; = //ACCOUNT DETAILS @@ -226,7 +226,7 @@ void DlgAccounts::saveAccount(QModelIndex item) if (m_pCodecsLW->currentIndex().isValid()) m_pCodecsLW->model()->setData(m_pCodecsLW->currentIndex(),m_pBitrate= SB->value(),VideoCodecModel::BITRATE_ROLE); saveCredential(); - m_IsLoading =3D false; + m_IsLoading--; } //saveAccount = void DlgAccounts::cancel() @@ -242,9 +242,9 @@ void DlgAccounts::cancel() } } = +///Load an account, set all field to the right value void DlgAccounts::loadAccount(QModelIndex item) { - m_IsLoading =3D true; if(! item.isValid() ) { kDebug() << "Attempting to load details of an account from a NULL it= em (" << item.row() << ")"; return; @@ -255,6 +255,7 @@ void DlgAccounts::loadAccount(QModelIndex item) kDebug() << "Attempting to load details of an unexisting account"; return; } + m_IsLoading++; = edit1_alias->setText( account->getAccountAlias()); = @@ -270,11 +271,13 @@ void DlgAccounts::loadAccount(QModelIndex item) = = QModelIndex idx =3D account->getCredentialsModel()->index(0,0); + disconnect(edit5_password, SIGNAL(textEdited(QString)), this , SLOT(mai= n_password_field_changed())); if (idx.isValid() && !account->getAccountId().isEmpty()) { edit5_password->setText(account->getCredentialsModel()->data(idx,Cre= dentialModel::PASSWORD_ROLE).toString()); } else edit5_password->setText(""); + connect(edit5_password, SIGNAL(textEdited(QString)), this , SLOT(main_p= assword_field_changed())); = = switch (account->getTlsMethod()) { @@ -340,12 +343,11 @@ void DlgAccounts::loadAccount(QModelIndex item) m_pDefaultAccount->setChecked(account =3D=3D AccountList::getInstance()= ->getDefaultAccount()); connect(m_pDefaultAccount, SIGNAL(clicked(bool)) , this , SLOT(chang= edAccountList()) ); = - account->getVideoCodecModel()->reload(); = disconnect(list_credential->selectionModel(),SIGNAL(currentChanged(QMod= elIndex,QModelIndex)), this, SLOT(selectCredential(QModelIndex,QModelIndex)= ) ); list_credential->setModel(account->getCredentialsModel()); connect(list_credential->selectionModel() ,SIGNAL(currentChanged(QMod= elIndex,QModelIndex)), this, SLOT(selectCredential(QModelIndex,QModelIndex)= ) ); - = + disconnect(list_audiocodec->selectionModel(),SIGNAL(currentChanged(QMod= elIndex,QModelIndex)), this, SLOT(selectedCodecChanged(QModelIndex,QModelIn= dex)) ); disconnect(list_audiocodec->model() ,SIGNAL(dataChanged(QModelI= ndex,QModelIndex)), this, SLOT(changedAccountList()) = ); list_audiocodec->setModel(account->getAudioCodecModel()); @@ -355,6 +357,7 @@ void DlgAccounts::loadAccount(QModelIndex item) #ifdef ENABLE_VIDEO disconnect(m_pCodecsLW->selectionModel() ,SIGNAL(currentChanged(QMod= elIndex,QModelIndex)), this, SLOT(loadVidCodecDetails(QModelIndex,QModelInd= ex)) ); disconnect(m_pCodecsLW->model() ,SIGNAL(dataChanged(QModelI= ndex,QModelIndex)), this, SLOT(changedAccountList()) = ); + account->getVideoCodecModel()->reload(); m_pCodecsLW->setModel(account->getVideoCodecModel()); connect(m_pCodecsLW->model() ,SIGNAL(dataChanged(QModelI= ndex,QModelIndex)), this, SLOT(changedAccountList()) = ); connect(m_pCodecsLW->selectionModel() ,SIGNAL(currentChanged(QMod= elIndex,QModelIndex)), this, SLOT(loadVidCodecDetails(QModelIndex,QModelInd= ex)) ); @@ -436,7 +439,7 @@ void DlgAccounts::loadAccount(QModelIndex item) updateStatusLabel(account); enablePublished(); frame2_editAccounts->setEnabled(true); - m_IsLoading =3D false; + m_IsLoading--; account->performAction(EDIT); } //loadAccount = diff --git a/src/conf/dlgaccounts.h b/src/conf/dlgaccounts.h index 0fed408..38106e2 100755 --- a/src/conf/dlgaccounts.h +++ b/src/conf/dlgaccounts.h @@ -112,7 +112,7 @@ private: QList codecList ; bool accountListHasChanged ; QMap m_hRingtonePath ; - bool m_IsLoading ; + int m_IsLoading ; = public slots: void loadAccountList (); diff --git a/src/lib/videocodecmodel.cpp b/src/lib/videocodecmodel.cpp index d4ded3b..aed0bed 100644 --- a/src/lib/videocodecmodel.cpp +++ b/src/lib/videocodecmodel.cpp @@ -53,13 +53,17 @@ bool VideoCodecModel::setData(const QModelIndex& index,= const QVariant &value, i { = if (index.column() =3D=3D 0 && role =3D=3D Qt::CheckStateRole) { + bool changed =3D m_lCodecs[index.row()]->getEnabled() !=3D (value = =3D=3D Qt::Checked); m_lCodecs[index.row()]->setEnabled(value =3D=3D Qt::Checked); - emit dataChanged(index, index); + if (changed) + emit dataChanged(index, index); return true; } else if (index.column() =3D=3D 0 && role =3D=3D VideoCodecModel::BITRAT= E_ROLE) { + bool changed =3D m_lCodecs[index.row()]->getBitrate() !=3D value.toU= Int(); m_lCodecs[index.row()]->setBitrate(value.toInt()); - emit dataChanged(index, index); + if (changed) + emit dataChanged(index, index); return true; } return false; diff --git a/src/lib/videocodecmodel.h b/src/lib/videocodecmodel.h index bddcf38..85216cb 100644 --- a/src/lib/videocodecmodel.h +++ b/src/lib/videocodecmodel.h @@ -83,9 +83,9 @@ class LIB_EXPORT VideoCodec { = //Attributes static CodecHash m_slCodecs; - QString m_Name; - uint m_Bitrate; - bool m_Enabled; + QString m_Name; + uint m_Bitrate; + bool m_Enabled; static bool m_sInit; }; #endif diff --git a/src/sflphoneview.cpp b/src/sflphoneview.cpp index 17f79f6..771f0b3 100755 --- a/src/sflphoneview.cpp +++ b/src/sflphoneview.cpp @@ -22,6 +22,7 @@ = //Qt #include +#include #include #include #include @@ -755,14 +756,13 @@ void SFLPhoneView::setAccountFirst(Account * account) ///Show the configuration dialog void SFLPhoneView::configureSflPhone() { - ConfigurationDialog* configDialog =3D new ConfigurationDialog(this); + QPointer configDialog =3D new ConfigurationDialog(= this); configDialog->setModal(true); = - connect(configDialog, SIGNAL(changesApplied()), - this, SLOT(loadWindow())); - - //configDialog->reload(); - configDialog->show(); + connect(configDialog, SIGNAL(changesApplied()), this, SLOT(loadWindow()= )); + configDialog->exec(); + disconnect(configDialog, SIGNAL(changesApplied()), this, SLOT(loadWindo= w())); + delete configDialog; } = ///Show the account creation wizard