Skip to content
Snippets Groups Projects
Commit 7cd7788a authored by Jérémy Quentin's avatar Jérémy Quentin
Browse files

Before merge.

parent fe6fb1fd
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ void Account::initAccountItem() ...@@ -71,7 +71,7 @@ void Account::initAccountItem()
setItemText(getAccountDetail(*(new QString(ACCOUNT_ALIAS)))); setItemText(getAccountDetail(*(new QString(ACCOUNT_ALIAS))));
itemWidget = new QWidget(); itemWidget = new QWidget();
QCheckBox * checkbox = new QCheckBox(itemWidget); QCheckBox * checkbox = new QCheckBox(itemWidget);
checkbox->setObjectName("checkbox"); checkbox->setObjectName(QString(ACCOUNT_ITEM_CHECKBOX));
checkbox->setCheckState(enabled ? Qt::Checked : Qt::Unchecked); checkbox->setCheckState(enabled ? Qt::Checked : Qt::Unchecked);
//QLabel* name = new QLabel(getAccountDetail(*(new QString(ACCOUNT_ALIAS))), itemWidget); //QLabel* name = new QLabel(getAccountDetail(*(new QString(ACCOUNT_ALIAS))), itemWidget);
//QLabel* name = new QLabel("", itemWidget); //QLabel* name = new QLabel("", itemWidget);
...@@ -139,6 +139,11 @@ bool Account::isNew() ...@@ -139,6 +139,11 @@ bool Account::isNew()
return(!accountId); return(!accountId);
} }
bool Account::isChecked()
{
return itemWidget->findChild<QCheckBox *>(QString(ACCOUNT_ITEM_CHECKBOX))->checkState() == Qt::Checked;
}
QString & Account::getAccountId() QString & Account::getAccountId()
{ {
return *accountId; return *accountId;
...@@ -170,25 +175,21 @@ QString Account::getStateName(QString & state) ...@@ -170,25 +175,21 @@ QString Account::getStateName(QString & state)
QColor Account::getStateColor() QColor Account::getStateColor()
{ {
if(item->checkState() == Qt::Checked) if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_UNREGISTERED)
{ return Qt::black;
if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED) if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED)
return Qt::darkGreen; return Qt::darkGreen;
return Qt::red; return Qt::red;
}
return Qt::black;
} }
QString Account::getStateColorName() QString Account::getStateColorName()
{ {
if(item->checkState() == Qt::Checked) if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_UNREGISTERED)
{ return "black";
if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED) if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED)
return "darkGreen"; return "darkGreen";
return "red"; return "red";
}
return "black";
} }
QString Account::getAccountDetail(QString & param) QString Account::getAccountDetail(QString & param)
......
...@@ -27,6 +27,7 @@ public: ...@@ -27,6 +27,7 @@ public:
//Getters //Getters
bool isNew(); bool isNew();
bool isChecked();
QString & getAccountId(); QString & getAccountId();
MapStringString & getAccountDetails(); MapStringString & getAccountDetails();
QListWidgetItem * getItem(); QListWidgetItem * getItem();
......
...@@ -230,8 +230,9 @@ void ConfigurationDialog::saveOptions() ...@@ -230,8 +230,9 @@ void ConfigurationDialog::saveOptions()
void ConfigurationDialog::loadAccountList() void ConfigurationDialog::loadAccountList()
{ {
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
//ask for the list of accounts ids to the configurationManager //ask for the list of accounts ids to the configurationManager
QStringList accountIds = ConfigurationManagerInterfaceSingleton::getInstance().getAccountList().value(); QStringList accountIds = configurationManager.getAccountList().value();
//create the AccountList object with the ids //create the AccountList object with the ids
accountList = new AccountList(accountIds); accountList = new AccountList(accountIds);
//initialize the QListWidget object with the AccountList //initialize the QListWidget object with the AccountList
...@@ -276,7 +277,7 @@ void ConfigurationDialog::saveAccountList() ...@@ -276,7 +277,7 @@ void ConfigurationDialog::saveAccountList()
currentId = QString(current.getAccountId()); currentId = QString(current.getAccountId());
} }
} }
configurationManager.sendRegister(currentId, (current.getItem()->checkState() == Qt::Checked) ? 1 : 0 ); configurationManager.sendRegister(currentId, current.isChecked() ? 1 : 0 );
} }
//remove accounts that are in the configurationManager but not in the client //remove accounts that are in the configurationManager but not in the client
for (int i = 0; i < accountIds.size(); i++) for (int i = 0; i < accountIds.size(); i++)
......
...@@ -100,6 +100,8 @@ ...@@ -100,6 +100,8 @@
#define ACCOUNT_STATE_ERROR_CONF_STUN "ERROR_CONF_STUN" #define ACCOUNT_STATE_ERROR_CONF_STUN "ERROR_CONF_STUN"
#define ACCOUNT_STATE_ERROR_EXIST_STUN "ERROR_EXIST_STUN" #define ACCOUNT_STATE_ERROR_EXIST_STUN "ERROR_EXIST_STUN"
#define ACCOUNT_ITEM_CHECKBOX "checkbox"
#define CALL_STATE_CHANGE_HUNG_UP "HUNGUP" #define CALL_STATE_CHANGE_HUNG_UP "HUNGUP"
#define CALL_STATE_CHANGE_RINGING "RINGING" #define CALL_STATE_CHANGE_RINGING "RINGING"
#define CALL_STATE_CHANGE_CURRENT "CURRENT" #define CALL_STATE_CHANGE_CURRENT "CURRENT"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment