Skip to content
Snippets Groups Projects
Commit a9dfb021 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Merge branch 'qt-client'

parents cbcd0cd7 8f72f491
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,9 @@ const QString account_state_name(QString & s) ...@@ -53,7 +53,9 @@ const QString account_state_name(QString & s)
//Constructors //Constructors
Account::Account():accountId(NULL), item(NULL), itemWidget(NULL){} Account::Account():accountId(NULL), item(NULL), itemWidget(NULL)
{
}
void Account::initAccountItem() void Account::initAccountItem()
...@@ -90,6 +92,7 @@ void Account::initAccountItemWidget() ...@@ -90,6 +92,7 @@ void Account::initAccountItemWidget()
{ {
itemWidget->setState(AccountItemWidget::NotWorking); itemWidget->setState(AccountItemWidget::NotWorking);
} }
connect(itemWidget, SIGNAL(checkStateChanged(bool)), this, SLOT(setEnabled(bool)));
} }
Account * Account::buildExistingAccountFromId(QString _accountId) Account * Account::buildExistingAccountFromId(QString _accountId)
...@@ -147,13 +150,11 @@ MapStringString & Account::getAccountDetails() const ...@@ -147,13 +150,11 @@ MapStringString & Account::getAccountDetails() const
QListWidgetItem * Account::getItem() QListWidgetItem * Account::getItem()
{ {
if(!item) { qDebug() << "null" ; }
return item; return item;
} }
AccountItemWidget * Account::getItemWidget() AccountItemWidget * Account::getItemWidget()
{ {
if(itemWidget == NULL) { qDebug() << "null"; }
return itemWidget; return itemWidget;
} }
...@@ -214,6 +215,12 @@ void Account::setAccountId(QString id) ...@@ -214,6 +215,12 @@ void Account::setAccountId(QString id)
accountId = new QString(id); accountId = new QString(id);
} }
void Account::setEnabled(bool checked)
{
qDebug() << "setEnabled = " << checked;
setAccountDetail(ACCOUNT_ENABLED, checked ? ACCOUNT_ENABLED_TRUE : ACCOUNT_ENABLED_FALSE);
}
void Account::updateState() void Account::updateState()
{ {
qDebug() << "updateState"; qDebug() << "updateState";
... ...
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
const QString account_state_name(QString & s); const QString account_state_name(QString & s);
class Account{ class Account : public QObject{
Q_OBJECT
private: private:
QString * accountId; QString * accountId;
...@@ -76,6 +76,10 @@ public: ...@@ -76,6 +76,10 @@ public:
//Operators //Operators
bool operator==(const Account&)const; bool operator==(const Account&)const;
private slots:
void setEnabled(bool checked);
}; };
... ...
......
...@@ -113,7 +113,8 @@ bool AccountItemWidget::getEnabled() ...@@ -113,7 +113,8 @@ bool AccountItemWidget::getEnabled()
return checkBox->checkState(); return checkBox->checkState();
} }
void AccountItemWidget::on_checkBox_stateChanged() void AccountItemWidget::on_checkBox_stateChanged(int state)
{ {
emit checkStateChanged(); qDebug() << "on_checkBox_stateChanged";
emit checkStateChanged(state == Qt::Checked);
} }
...@@ -65,11 +65,11 @@ public: ...@@ -65,11 +65,11 @@ public:
void updateDisplay(); void updateDisplay();
private slots: private slots:
void on_checkBox_stateChanged(); void on_checkBox_stateChanged(int state);
signals: signals:
void checkStateChanged(); void checkStateChanged(bool checked);
}; };
... ...
......
...@@ -54,7 +54,7 @@ const function Call::actionPerformedFunctionMap[11][5] = ...@@ -54,7 +54,7 @@ const function Call::actionPerformedFunctionMap[11][5] =
/*INCOMING */ {&Call::accept , &Call::refuse , &Call::acceptTransf , &Call::acceptHold , &Call::setRecord }, /*INCOMING */ {&Call::accept , &Call::refuse , &Call::acceptTransf , &Call::acceptHold , &Call::setRecord },
/*RINGING */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::nothing , &Call::setRecord }, /*RINGING */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::nothing , &Call::setRecord },
/*CURRENT */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::hold , &Call::setRecord }, /*CURRENT */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::hold , &Call::setRecord },
/*DIALING */ {&Call::call , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, /*DIALING */ {&Call::call , &Call::cancel , &Call::nothing , &Call::nothing , &Call::nothing },
/*HOLD */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::unhold , &Call::setRecord }, /*HOLD */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::unhold , &Call::setRecord },
/*FAILURE */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::nothing , &Call::nothing }, /*FAILURE */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::nothing , &Call::nothing },
/*BUSY */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::nothing , &Call::nothing }, /*BUSY */ {&Call::nothing , &Call::hangUp , &Call::nothing , &Call::nothing , &Call::nothing },
...@@ -275,6 +275,14 @@ call_state Call::getStartStateFromDaemonCallState(QString daemonCallState, QStri ...@@ -275,6 +275,14 @@ call_state Call::getStartStateFromDaemonCallState(QString daemonCallState, QStri
{ {
return CALL_STATE_RINGING; return CALL_STATE_RINGING;
} }
else if(daemonCallState == DAEMON_CALL_STATE_INIT_INCOMING)
{
return CALL_STATE_INCOMING;
}
else if(daemonCallState == DAEMON_CALL_STATE_INIT_RINGING)
{
return CALL_STATE_RINGING;
}
else else
{ {
return CALL_STATE_FAILURE; return CALL_STATE_FAILURE;
...@@ -558,6 +566,13 @@ void Call::hangUp() ...@@ -558,6 +566,13 @@ void Call::hangUp()
callManager.hangUp(callId); callManager.hangUp(callId);
} }
void Call::cancel()
{
CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
qDebug() << "Canceling call. callId : " << callId;
callManager.hangUp(callId);
}
void Call::hold() void Call::hold()
{ {
CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
... ...
......
...@@ -167,6 +167,7 @@ private: ...@@ -167,6 +167,7 @@ private:
void acceptTransf(); void acceptTransf();
void acceptHold(); void acceptHold();
void hangUp(); void hangUp();
void cancel();
void hold(); void hold();
void call(); void call();
void transfer(); void transfer();
... ...
......
...@@ -31,7 +31,6 @@ CallList::CallList() ...@@ -31,7 +31,6 @@ CallList::CallList()
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
QStringList callList = callManager.getCallList(); QStringList callList = callManager.getCallList();
qDebug() << "Call List = " << callList; qDebug() << "Call List = " << callList;
callIdCpt = 0;
calls = new QVector<Call *>(); calls = new QVector<Call *>();
for(int i = 0 ; i < callList.size() ; i++) for(int i = 0 ; i < callList.size() ; i++)
{ {
...@@ -49,7 +48,7 @@ CallList::CallList() ...@@ -49,7 +48,7 @@ CallList::CallList()
QString name = param[2]; QString name = param[2];
uint stopTimeStamp = param[3].toUInt(); uint stopTimeStamp = param[3].toUInt();
QString account = param[4]; QString account = param[4];
calls->append(Call::buildHistoryCall(getAndIncCallId(), startTimeStamp, stopTimeStamp, account, name, number, type)); calls->append(Call::buildHistoryCall(generateCallId(), startTimeStamp, stopTimeStamp, account, name, number, type));
} }
} }
...@@ -127,10 +126,11 @@ Call * CallList::operator[](int ind) ...@@ -127,10 +126,11 @@ Call * CallList::operator[](int ind)
return (*calls)[ind]; return (*calls)[ind];
} }
QString CallList::getAndIncCallId()
{
QString res = QString::number(callIdCpt++);
QString CallList::generateCallId()
{
int id = qrand();
QString res = QString::number(id);
return res; return res;
} }
...@@ -141,7 +141,7 @@ int CallList::size() ...@@ -141,7 +141,7 @@ int CallList::size()
Call * CallList::addDialingCall(const QString & peerName, QString account) Call * CallList::addDialingCall(const QString & peerName, QString account)
{ {
Call * call = Call::buildDialingCall(getAndIncCallId(), peerName, account); Call * call = Call::buildDialingCall(generateCallId(), peerName, account);
calls->append(call); calls->append(call);
return call; return call;
} }
... ...
......
...@@ -35,7 +35,6 @@ Q_OBJECT ...@@ -35,7 +35,6 @@ Q_OBJECT
private: private:
QVector<Call *> * calls; QVector<Call *> * calls;
int callIdCpt;
public: public:
...@@ -58,7 +57,7 @@ public: ...@@ -58,7 +57,7 @@ public:
Call * addRingingCall(const QString & callId); Call * addRingingCall(const QString & callId);
//GSetter //GSetter
QString getAndIncCallId(); QString generateCallId();
public slots: public slots:
void clearHistory(); void clearHistory();
... ...
......
...@@ -109,7 +109,6 @@ void DlgAccounts::saveAccountList() ...@@ -109,7 +109,6 @@ void DlgAccounts::saveAccountList()
} }
} }
qDebug() << currentId << " : " << current.isChecked(); qDebug() << currentId << " : " << current.isChecked();
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++)
...@@ -205,7 +204,7 @@ void DlgAccounts::addAccountToAccountList(Account * account) ...@@ -205,7 +204,7 @@ void DlgAccounts::addAccountToAccountList(Account * account)
qDebug() << "addAccountToAccountList"; qDebug() << "addAccountToAccountList";
QListWidgetItem * item = account->getItem(); QListWidgetItem * item = account->getItem();
QWidget * widget = account->getItemWidget(); QWidget * widget = account->getItemWidget();
connect(widget, SIGNAL(checkStateChanged()), connect(widget, SIGNAL(checkStateChanged(bool)),
this, SLOT(changedAccountList())); this, SLOT(changedAccountList()));
qDebug() << "item->isHidden()" << item->isHidden(); qDebug() << "item->isHidden()" << item->isHidden();
listWidget_accountList->addItem(item); listWidget_accountList->addItem(item);
...@@ -215,6 +214,7 @@ void DlgAccounts::addAccountToAccountList(Account * account) ...@@ -215,6 +214,7 @@ void DlgAccounts::addAccountToAccountList(Account * account)
void DlgAccounts::changedAccountList() void DlgAccounts::changedAccountList()
{ {
qDebug() << "changedAccountList";
accountListHasChanged = true; accountListHasChanged = true;
emit updateButtons(); emit updateButtons();
toolButton_accountsApply->setEnabled(hasChanged()); toolButton_accountsApply->setEnabled(hasChanged());
... ...
......
...@@ -39,9 +39,7 @@ int main(int argc, char **argv) ...@@ -39,9 +39,7 @@ int main(int argc, char **argv)
KLocalizedString(), KLocalizedString(),
"http://www.sflphone.org.", "http://www.sflphone.org.",
"sflphone@lists.savoirfairelinux.net"); "sflphone@lists.savoirfairelinux.net");
about.setProgramLogo(QVariant(QImage(ICON_SFLPHONE)));
about.addAuthor( ki18n("Jérémy Quentin"), KLocalizedString(), "jeremy.quentin@savoirfairelinux.com" ); about.addAuthor( ki18n("Jérémy Quentin"), KLocalizedString(), "jeremy.quentin@savoirfairelinux.com" );
about.setProgramIconName(ICON_SFLPHONE);
about.setTranslator( ki18nc("NAME OF TRANSLATORS","Your names"), ki18nc("EMAIL OF TRANSLATORS","Your emails") ); about.setTranslator( ki18nc("NAME OF TRANSLATORS","Your names"), ki18nc("EMAIL OF TRANSLATORS","Your emails") );
KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options; KCmdLineOptions options;
... ...
......
...@@ -167,6 +167,8 @@ ...@@ -167,6 +167,8 @@
#define DAEMON_CALL_STATE_INIT_CURRENT "CURRENT" #define DAEMON_CALL_STATE_INIT_CURRENT "CURRENT"
#define DAEMON_CALL_STATE_INIT_HOLD "HOLD" #define DAEMON_CALL_STATE_INIT_HOLD "HOLD"
#define DAEMON_CALL_STATE_INIT_BUSY "BUSY" #define DAEMON_CALL_STATE_INIT_BUSY "BUSY"
#define DAEMON_CALL_STATE_INIT_INCOMING "INCOMING"
#define DAEMON_CALL_STATE_INIT_RINGING "RINGING"
#define DAEMON_CALL_STATE_INIT_INACTIVE "INACTIVE" #define DAEMON_CALL_STATE_INIT_INACTIVE "INACTIVE"
#define DAEMON_CALL_TYPE_INCOMING "0" #define DAEMON_CALL_TYPE_INCOMING "0"
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment