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()
setItemText(getAccountDetail(*(new QString(ACCOUNT_ALIAS))));
itemWidget = new QWidget();
QCheckBox * checkbox = new QCheckBox(itemWidget);
checkbox->setObjectName("checkbox");
checkbox->setObjectName(QString(ACCOUNT_ITEM_CHECKBOX));
checkbox->setCheckState(enabled ? Qt::Checked : Qt::Unchecked);
//QLabel* name = new QLabel(getAccountDetail(*(new QString(ACCOUNT_ALIAS))), itemWidget);
//QLabel* name = new QLabel("", itemWidget);
......@@ -139,6 +139,11 @@ bool Account::isNew()
return(!accountId);
}
bool Account::isChecked()
{
return itemWidget->findChild<QCheckBox *>(QString(ACCOUNT_ITEM_CHECKBOX))->checkState() == Qt::Checked;
}
QString & Account::getAccountId()
{
return *accountId;
......@@ -170,26 +175,22 @@ QString Account::getStateName(QString & state)
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)
return Qt::darkGreen;
return Qt::red;
}
return Qt::black;
}
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)
return "darkGreen";
return "red";
}
return "black";
}
QString Account::getAccountDetail(QString & param)
{
......
......@@ -27,6 +27,7 @@ public:
//Getters
bool isNew();
bool isChecked();
QString & getAccountId();
MapStringString & getAccountDetails();
QListWidgetItem * getItem();
......
......@@ -230,8 +230,9 @@ void ConfigurationDialog::saveOptions()
void ConfigurationDialog::loadAccountList()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
//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
accountList = new AccountList(accountIds);
//initialize the QListWidget object with the AccountList
......@@ -276,7 +277,7 @@ void ConfigurationDialog::saveAccountList()
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
for (int i = 0; i < accountIds.size(); i++)
......
......@@ -100,6 +100,8 @@
#define ACCOUNT_STATE_ERROR_CONF_STUN "ERROR_CONF_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_RINGING "RINGING"
#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