[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [sflphone-kde] src: [ #14078 ] The config dialog were not being correctly deleted, this caused some
From: Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date: 2012-07-31 21:43:23
Message-ID: 20120731214323.CF7F8A6094 () git ! kde ! org
[Download RAW message or body]
Git commit bc745502c8fa93ead6383776db5600a0c9419899 by Emmanuel Lepage Vallee.
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 = 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()->index(0,0));
loadAccount(listView_accountList->currentIndex());
}
- m_IsLoading = false;
+ m_IsLoading--;
} //DlgAccounts
///Destructor
@@ -163,8 +163,8 @@ void DlgAccounts::saveAccount(QModelIndex item)
kDebug() << "Nothing to be saved";
return;
}
+ m_IsLoading++;
- m_IsLoading = true;
QString protocolsTab[] = 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_pBitrateSB->value(),VideoCodecModel::BITRATE_ROLE);
saveCredential();
- m_IsLoading = 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 = true;
if(! item.isValid() ) {
kDebug() << "Attempting to load details of an account from a NULL item (" << \
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 = account->getCredentialsModel()->index(0,0);
+ disconnect(edit5_password, SIGNAL(textEdited(QString)), this , \
SLOT(main_password_field_changed())); if (idx.isValid() && \
!account->getAccountId().isEmpty()) {
edit5_password->setText(account->getCredentialsModel()->data(idx,CredentialModel::PASSWORD_ROLE).toString());
}
else
edit5_password->setText("");
+ connect(edit5_password, SIGNAL(textEdited(QString)), this , \
SLOT(main_password_field_changed()));
switch (account->getTlsMethod()) {
@@ -340,12 +343,11 @@ void DlgAccounts::loadAccount(QModelIndex item)
m_pDefaultAccount->setChecked(account == \
AccountList::getInstance()->getDefaultAccount()); connect(m_pDefaultAccount, \
SIGNAL(clicked(bool)) , this , SLOT(changedAccountList()) );
- account->getVideoCodecModel()->reload();
disconnect(list_credential->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)), \
this, SLOT(selectCredential(QModelIndex,QModelIndex)) ); \
list_credential->setModel(account->getCredentialsModel()); \
connect(list_credential->selectionModel() \
,SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, \
SLOT(selectCredential(QModelIndex,QModelIndex)) );
-
+
disconnect(list_audiocodec->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)), \
this, SLOT(selectedCodecChanged(QModelIndex,QModelIndex)) ); \
disconnect(list_audiocodec->model() \
,SIGNAL(dataChanged(QModelIndex,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(QModelIndex,QModelIndex)), this, \
SLOT(loadVidCodecDetails(QModelIndex,QModelIndex)) ); \
disconnect(m_pCodecsLW->model() \
,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(changedAccountList()) \
); + account->getVideoCodecModel()->reload();
m_pCodecsLW->setModel(account->getVideoCodecModel());
connect(m_pCodecsLW->model() \
,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(changedAccountList()) \
); connect(m_pCodecsLW->selectionModel() \
,SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, \
SLOT(loadVidCodecDetails(QModelIndex,QModelIndex)) ); @@ -436,7 +439,7 @@ void \
DlgAccounts::loadAccount(QModelIndex item) updateStatusLabel(account);
enablePublished();
frame2_editAccounts->setEnabled(true);
- m_IsLoading = 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<StringHash> codecList ;
bool accountListHasChanged ;
QMap<QString,QString> 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() == 0 && role == Qt::CheckStateRole) {
+ bool changed = m_lCodecs[index.row()]->getEnabled() != (value == Qt::Checked);
m_lCodecs[index.row()]->setEnabled(value == Qt::Checked);
- emit dataChanged(index, index);
+ if (changed)
+ emit dataChanged(index, index);
return true;
}
else if (index.column() == 0 && role == VideoCodecModel::BITRATE_ROLE) {
+ bool changed = m_lCodecs[index.row()]->getBitrate() != value.toUInt();
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 <QtCore/QString>
+#include <QtCore/QPointer>
#include <QtGui/QContextMenuEvent>
#include <QtGui/QPalette>
#include <QtGui/QInputDialog>
@@ -755,14 +756,13 @@ void SFLPhoneView::setAccountFirst(Account * account)
///Show the configuration dialog
void SFLPhoneView::configureSflPhone()
{
- ConfigurationDialog* configDialog = new ConfigurationDialog(this);
+ QPointer<ConfigurationDialog> configDialog = 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(loadWindow()));
+ delete configDialog;
}
///Show the account creation wizard
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic