From 54afba696b4f85a2592d6894449ef7cac188e72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Quentin?= <jquentin@jquentin-laptop-kub2.(none)> Date: Wed, 27 May 2009 12:32:32 -0400 Subject: [PATCH] Clean code, add comments... --- sflphone-client-kde/Account.cpp | 40 ++++++++-------- sflphone-client-kde/Account.h | 25 +++++++++- sflphone-client-kde/AccountItemWidget.cpp | 4 ++ sflphone-client-kde/AccountItemWidget.h | 18 ++++---- sflphone-client-kde/AccountList.cpp | 21 +++++++++ sflphone-client-kde/AccountList.h | 25 ++++++++-- sflphone-client-kde/AccountWizard.cpp | 4 -- sflphone-client-kde/AccountWizard.h | 2 - sflphone-client-kde/ActionSetAccountFirst.cpp | 1 + sflphone-client-kde/ActionSetAccountFirst.h | 5 +- sflphone-client-kde/Call.cpp | 21 +++++++++ sflphone-client-kde/Call.h | 39 ++++++++++++++-- sflphone-client-kde/CallList.cpp | 21 +++++++++ sflphone-client-kde/CallList.h | 29 +++++++++++- sflphone-client-kde/ConfigDialog.cpp | 23 +++++++++- sflphone-client-kde/ConfigDialog.h | 35 ++++++++++++-- sflphone-client-kde/Contact.cpp | 3 ++ sflphone-client-kde/Contact.h | 26 +++++------ sflphone-client-kde/ContactItemWidget.cpp | 4 ++ sflphone-client-kde/ContactItemWidget.h | 4 +- sflphone-client-kde/SFLPhone.cpp | 21 +++++++++ sflphone-client-kde/SFLPhone.h | 21 +++++++++ sflphone-client-kde/main.cpp | 21 --------- sflphone-client-kde/metatypes.h | 4 -- sflphone-client-kde/sflphone_const.h | 46 +++++++++---------- sflphone-client-kde/sflphone_kdeview.cpp | 18 ++++++-- sflphone-client-kde/sflphone_kdeview.h | 31 +++++++++---- 27 files changed, 385 insertions(+), 127 deletions(-) diff --git a/sflphone-client-kde/Account.cpp b/sflphone-client-kde/Account.cpp index ded51e8899..5939416fac 100644 --- a/sflphone-client-kde/Account.cpp +++ b/sflphone-client-kde/Account.cpp @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #include "Account.h" #include <QtGui/QApplication> @@ -31,28 +52,11 @@ const QString account_state_name(QString & s) //Constructors - Account::Account():accountId(NULL){} - -/* -Account::Account(QListWidgetItem & _item, QString & alias) -{ - accountDetails = new MapStringString(); - (*accountDetails)[ACCOUNT_ALIAS] = alias; - item = & _item; -} - -Account::Account(QString & _accountId, MapStringString & _accountDetails, account_state_t & _state) -{ - *accountDetails = _accountDetails; - *accountId = _accountId; - *state = _state; -} -*/ +Account::Account():accountId(NULL){} void Account::initAccountItem() { - //ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); item = new QListWidgetItem(); item->setSizeHint(QSize(140,25)); item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled); diff --git a/sflphone-client-kde/Account.h b/sflphone-client-kde/Account.h index 3b8ebbcde2..78175ff341 100644 --- a/sflphone-client-kde/Account.h +++ b/sflphone-client-kde/Account.h @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #ifndef ACCOUNT_H #define ACCOUNT_H @@ -23,12 +44,12 @@ private: public: + ~Account(); + //Constructors static Account * buildExistingAccountFromId(QString _accountId); static Account * buildNewAccountFromAlias(QString alias); - ~Account(); - //Getters bool isNew() const; bool isChecked() const; diff --git a/sflphone-client-kde/AccountItemWidget.cpp b/sflphone-client-kde/AccountItemWidget.cpp index 9c437e95b3..eb4beda063 100644 --- a/sflphone-client-kde/AccountItemWidget.cpp +++ b/sflphone-client-kde/AccountItemWidget.cpp @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #include "AccountItemWidget.h" #include <QtGui/QHBoxLayout> @@ -49,6 +50,9 @@ AccountItemWidget::AccountItemWidget(QWidget *parent) AccountItemWidget::~AccountItemWidget() { + delete led; + delete checkBox; + delete textLabel; } diff --git a/sflphone-client-kde/AccountItemWidget.h b/sflphone-client-kde/AccountItemWidget.h index 1448d0e2bd..7d26ccd616 100644 --- a/sflphone-client-kde/AccountItemWidget.h +++ b/sflphone-client-kde/AccountItemWidget.h @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef ACCOUNTITEMWIDGET_H #define ACCOUNTITEMWIDGET_H @@ -45,25 +46,24 @@ public: enum State {Registered, Unregistered, NotWorking}; + //Constructors & Destructors AccountItemWidget(QWidget *parent = 0); - ~AccountItemWidget(); - + + //Getters + int getState(); + bool getEnabled(); + + //Setters void setState(int state); - void setEnabled(bool enabled); - void setAccountText(QString text); + //Updates void updateStateDisplay(); - void updateEnabledDisplay(); - void updateDisplay(); - int getState(); - - bool getEnabled(); }; diff --git a/sflphone-client-kde/AccountList.cpp b/sflphone-client-kde/AccountList.cpp index 5b0996e5aa..f40b7d8ad1 100644 --- a/sflphone-client-kde/AccountList.cpp +++ b/sflphone-client-kde/AccountList.cpp @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #include "AccountList.h" #include "sflphone_const.h" #include "configurationmanager_interface_singleton.h" diff --git a/sflphone-client-kde/AccountList.h b/sflphone-client-kde/AccountList.h index 3e3cee3586..e7250b39e3 100644 --- a/sflphone-client-kde/AccountList.h +++ b/sflphone-client-kde/AccountList.h @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #ifndef ACCOUNT_LIST_H #define ACCOUNT_LIST_H @@ -15,7 +36,7 @@ private: public: - //Constructors + //Constructors & Destructors AccountList(QStringList & _accountIds); AccountList(); ~AccountList(); @@ -47,6 +68,4 @@ public: }; - - #endif \ No newline at end of file diff --git a/sflphone-client-kde/AccountWizard.cpp b/sflphone-client-kde/AccountWizard.cpp index 832a3b54b6..4745593e5e 100644 --- a/sflphone-client-kde/AccountWizard.cpp +++ b/sflphone-client-kde/AccountWizard.cpp @@ -148,7 +148,6 @@ rest_account get_rest_account(char *host,char *email) { AccountWizard::AccountWizard(QWidget * parent) : QWizard(parent) { - setPage(Page_Intro, new WizardIntroPage); setPage(Page_AutoMan, new WizardAccountAutoManualPage); setPage(Page_Type, new WizardAccountTypePage); @@ -159,10 +158,8 @@ AccountWizard::AccountWizard(QWidget * parent) setPage(Page_Conclusion, new WizardAccountConclusionPage); setStartId(Page_Intro); - //setPixmap(QWizard::BannerPixmap, QPixmap(":/images/icons/dial.svg")); setWindowTitle(tr2i18n("Account Wizard")); setPixmap(QWizard::LogoPixmap, QPixmap(":/images/icons/sflphone.png")); - } @@ -554,7 +551,6 @@ WizardAccountConclusionPage::WizardAccountConclusionPage(QWidget *parent) WizardAccountConclusionPage::~WizardAccountConclusionPage() { - //delete label_emailAddress; } int WizardAccountConclusionPage::nextId() const diff --git a/sflphone-client-kde/AccountWizard.h b/sflphone-client-kde/AccountWizard.h index 625c8c6277..0095856a18 100644 --- a/sflphone-client-kde/AccountWizard.h +++ b/sflphone-client-kde/AccountWizard.h @@ -185,8 +185,6 @@ public: int nextId() const; private: - //QLabel * label_emailAddress; - //QLineEdit * lineEdit_emailAddress; }; #endif diff --git a/sflphone-client-kde/ActionSetAccountFirst.cpp b/sflphone-client-kde/ActionSetAccountFirst.cpp index bef7dbc8cd..6b29e6c6a4 100644 --- a/sflphone-client-kde/ActionSetAccountFirst.cpp +++ b/sflphone-client-kde/ActionSetAccountFirst.cpp @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #include "ActionSetAccountFirst.h" ActionSetAccountFirst::ActionSetAccountFirst(Account * account, QObject *parent) diff --git a/sflphone-client-kde/ActionSetAccountFirst.h b/sflphone-client-kde/ActionSetAccountFirst.h index 6d53166ff5..dd8914f474 100644 --- a/sflphone-client-kde/ActionSetAccountFirst.h +++ b/sflphone-client-kde/ActionSetAccountFirst.h @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef ACTION_SET_ACCOUNT_FIRST_H #define ACTION_SET_ACCOUNT_FIRST_H @@ -33,10 +34,12 @@ class ActionSetAccountFirst : public QAction Q_OBJECT private: + Account * account; + public: - ActionSetAccountFirst(Account * account, QObject *parent = 0); + ActionSetAccountFirst(Account * account, QObject *parent = 0); ~ActionSetAccountFirst(); private slots: diff --git a/sflphone-client-kde/Call.cpp b/sflphone-client-kde/Call.cpp index a9dde32c26..d7aacb2949 100644 --- a/sflphone-client-kde/Call.cpp +++ b/sflphone-client-kde/Call.cpp @@ -1,3 +1,23 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ #include "Call.h" #include "callmanager_interface_singleton.h" @@ -181,6 +201,7 @@ Call * Call::buildIncomingCall(const QString & callId/*, const QString & from, c { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); MapStringString details = callManager.getCallDetails(callId).value(); + qDebug() << "details = " << details; QString from = details[CALL_PEER_NUMBER]; QString account = details[CALL_ACCOUNTID]; QString peerName = details[CALL_PEER_NAME]; diff --git a/sflphone-client-kde/Call.h b/sflphone-client-kde/Call.h index 2123264e6d..9d2bea58a3 100644 --- a/sflphone-client-kde/Call.h +++ b/sflphone-client-kde/Call.h @@ -1,3 +1,25 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + #ifndef CALL_H #define CALL_H @@ -157,13 +179,15 @@ private: public: + //Constructors & Destructors ~Call(); void initCallItem(); static Call * buildDialingCall(QString callId, const QString & peerName); static Call * buildIncomingCall(const QString & callId/*, const QString & from, const QString & account*/); static Call * buildRingingCall(const QString & callId); - Contact * findContactForNumberInKAddressBook(QString number); + + //Getters QListWidgetItem * getItem(); QWidget * getItemWidget(); QListWidgetItem * getHistoryItem(); @@ -172,19 +196,26 @@ public: QString getCallId() const; QString getPeerPhoneNumber() const; QString getPeerName() const; - - call_state stateChanged(const QString & newState); - call_state actionPerformed(call_action action); call_state getCurrentState() const; history_state getHistoryState() const; bool getRecording() const; + + //Automate calls + call_state stateChanged(const QString & newState); + call_state actionPerformed(call_action action); + + //Setters void appendItemText(QString text); void backspaceItemText(); void setItemIcon(const QString pixmap); // void setPeerName(const QString peerName); void changeCurrentState(call_state newState); + + //Updates void updateItem(); + //Utils + Contact * findContactForNumberInKAddressBook(QString number); }; diff --git a/sflphone-client-kde/CallList.cpp b/sflphone-client-kde/CallList.cpp index eff5689617..3ee4851c2e 100644 --- a/sflphone-client-kde/CallList.cpp +++ b/sflphone-client-kde/CallList.cpp @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #include "CallList.h" CallList::CallList() diff --git a/sflphone-client-kde/CallList.h b/sflphone-client-kde/CallList.h index 8b01961f0f..9333abd037 100644 --- a/sflphone-client-kde/CallList.h +++ b/sflphone-client-kde/CallList.h @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #ifndef CALL_LIST_H #define CALL_LIST_H @@ -10,27 +31,33 @@ class CallList { private: + QVector<Call *> * calls; int callIdCpt; public: + //Constructors & Destructors CallList(); ~CallList(); + //Getters Call * findCallByItem(const QListWidgetItem * item); Call * findCallByHistoryItem(const QListWidgetItem * item); Call * findCallByCallId(const QString & callId); Call * operator[](const QListWidgetItem * item); Call * operator[](const QString & callId); Call * operator[](int ind); + int size(); + //Setters Call * addDialingCall(const QString & peerName = ""); Call * addIncomingCall(const QString & callId/*, const QString & from, const QString & account*/); Call * addRingingCall(const QString & callId); + //GSetter QString getAndIncCallId(); - int size(); + }; diff --git a/sflphone-client-kde/ConfigDialog.cpp b/sflphone-client-kde/ConfigDialog.cpp index d939033996..4f9d9a5391 100644 --- a/sflphone-client-kde/ConfigDialog.cpp +++ b/sflphone-client-kde/ConfigDialog.cpp @@ -1,4 +1,25 @@ -#include "ConfigDialog.h" +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + #include "ConfigDialog.h" #include <QtGui/QStyle> #include <QErrorMessage> diff --git a/sflphone-client-kde/ConfigDialog.h b/sflphone-client-kde/ConfigDialog.h index 42f51341ec..241ec75106 100644 --- a/sflphone-client-kde/ConfigDialog.h +++ b/sflphone-client-kde/ConfigDialog.h @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #ifndef HEADER_CONFIGDIALOG #define HEADER_CONFIGDIALOG @@ -25,26 +46,31 @@ private: public: + + //Constructors & Destructors ConfigurationDialog(sflphone_kdeView *parent = 0); ~ConfigurationDialog(); + + //Getters static AccountList * getAccountList(); + //Setters + void setPage(int page); + void addAccountToAccountList(Account * account); + void loadAccount(QListWidgetItem * item); void saveAccount(QListWidgetItem * item); void loadAccountList(); void saveAccountList(); - void addAccountToAccountList(Account * account); - void loadCodecs(); void saveCodecs(); void loadOptions(); void saveOptions(); - void setPage(int page); - + //Updates void updateCodecListCommands(); void updateAccountListCommands(); @@ -68,7 +94,6 @@ private slots: void on1_parametersChanged(); void on1_errorAlert(int code); - }; #endif diff --git a/sflphone-client-kde/Contact.cpp b/sflphone-client-kde/Contact.cpp index 3929e609e3..60d32f21a8 100644 --- a/sflphone-client-kde/Contact.cpp +++ b/sflphone-client-kde/Contact.cpp @@ -48,6 +48,9 @@ Contact::Contact(Addressee addressee, const PhoneNumber & number, bool displayPh Contact::~Contact() { + delete item; + delete itemWidget; + delete photo; } void Contact::initItem(bool displayPhoto) diff --git a/sflphone-client-kde/Contact.h b/sflphone-client-kde/Contact.h index 5fb25e526f..0d62657eab 100644 --- a/sflphone-client-kde/Contact.h +++ b/sflphone-client-kde/Contact.h @@ -48,20 +48,20 @@ private: void initItem(bool displayPhoto); public: - Contact(Addressee addressee, const PhoneNumber & number, bool displayPhoto); - ~Contact(); - - QString getPhoneNumber() const; - QString getNickName() const; - QString getFirstName() const; - QString getSecondName() const; - const Picture * getPhoto() const; - PhoneNumber::Type getType() const; - - QListWidgetItem * getItem(); - - QWidget * getItemWidget(); + //Constructors & Destructors + Contact(Addressee addressee, const PhoneNumber & number, bool displayPhoto); + ~Contact(); + + //Getters + QString getPhoneNumber() const; + QString getNickName() const; + QString getFirstName() const; + QString getSecondName() const; + const Picture * getPhoto() const; + PhoneNumber::Type getType() const; + QListWidgetItem * getItem(); + QWidget * getItemWidget(); }; diff --git a/sflphone-client-kde/ContactItemWidget.cpp b/sflphone-client-kde/ContactItemWidget.cpp index 7c634481a4..470cf324ad 100644 --- a/sflphone-client-kde/ContactItemWidget.cpp +++ b/sflphone-client-kde/ContactItemWidget.cpp @@ -88,6 +88,10 @@ ContactItemWidget::ContactItemWidget(const Contact * contact, bool displayPhoto, ContactItemWidget::~ContactItemWidget() { + delete contactName; + delete contactNumber; + delete contactPhoto; + delete contactType; } diff --git a/sflphone-client-kde/ContactItemWidget.h b/sflphone-client-kde/ContactItemWidget.h index dd686bd0bb..491af56d96 100644 --- a/sflphone-client-kde/ContactItemWidget.h +++ b/sflphone-client-kde/ContactItemWidget.h @@ -39,10 +39,12 @@ private: QLabel * contactType; public: - ContactItemWidget(const Contact * contact, bool displayPhoto, QWidget *parent = 0); + //Constructors & Destructors + ContactItemWidget(const Contact * contact, bool displayPhoto, QWidget *parent = 0); ~ContactItemWidget(); + //Getters QString getContactName(); QString getContactNumber(); diff --git a/sflphone-client-kde/SFLPhone.cpp b/sflphone-client-kde/SFLPhone.cpp index 37ac52291b..9e6955837a 100644 --- a/sflphone-client-kde/SFLPhone.cpp +++ b/sflphone-client-kde/SFLPhone.cpp @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #include "SFLPhone.h" #include <KApplication> diff --git a/sflphone-client-kde/SFLPhone.h b/sflphone-client-kde/SFLPhone.h index ccf9e46da7..7b8edd3c21 100644 --- a/sflphone-client-kde/SFLPhone.h +++ b/sflphone-client-kde/SFLPhone.h @@ -1,3 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #ifndef SFLPHONE_H #define SFLPHONE_H diff --git a/sflphone-client-kde/main.cpp b/sflphone-client-kde/main.cpp index 6dadd47f33..e968c54774 100644 --- a/sflphone-client-kde/main.cpp +++ b/sflphone-client-kde/main.cpp @@ -24,26 +24,8 @@ static const char version[] = "0.9.5"; int main(int argc, char **argv) { - - ///home/jquentin/.kde/share/apps/kabc -/* FILE *fp; - int status; - char path[PATH_MAX]; - - - fp = popen("ls *", "r"); - if (fp == NULL) - qDebug() << "marche pas"; - while (fgets(path, PATH_MAX, fp) != NULL) - printf("%s", path); - - status = pclose(fp); -*/ - try { - - KLocale::setMainCatalog("sflphone-client-kde"); qDebug() << KLocale::defaultLanguage(); qDebug() << KLocale::defaultCountry(); @@ -66,9 +48,6 @@ int main(int argc, char **argv) //options.add("+[URL]", ki18n( "Document to open" )); KCmdLineArgs::addCmdLineOptions(options); - - - KApplication app; qDebug() << KGlobal::locale()->language(); diff --git a/sflphone-client-kde/metatypes.h b/sflphone-client-kde/metatypes.h index e5ae32d8fd..7abd086ae1 100644 --- a/sflphone-client-kde/metatypes.h +++ b/sflphone-client-kde/metatypes.h @@ -7,20 +7,16 @@ #include <QtCore/QString> #include <QtDBus/QtDBus> -//class MapStringString:public QMap<QString, QString>{}; typedef QMap<QString, QString> MapStringString; typedef QMap<QString, int> MapStringInt; -//typedef QVector<QString> VectorString; Q_DECLARE_METATYPE(MapStringString) Q_DECLARE_METATYPE(MapStringInt) -//Q_DECLARE_METATYPE(VectorString) inline void registerCommTypes() { qDBusRegisterMetaType<MapStringString>(); qDBusRegisterMetaType<MapStringInt>(); - //qDBusRegisterMetaType<VectorString>(); } #endif \ No newline at end of file diff --git a/sflphone-client-kde/sflphone_const.h b/sflphone-client-kde/sflphone_const.h index c8a6838ada..3f17b89d1d 100644 --- a/sflphone-client-kde/sflphone_const.h +++ b/sflphone-client-kde/sflphone_const.h @@ -27,15 +27,17 @@ * @brief Contains the global variables for the client code */ -#define APP_NAME "KDE Client" +#define APP_NAME "SFLPhone KDE Client" /** Locale */ -#define _(STRING) gettext( STRING ) +// #define _(STRING) gettext( STRING ) /** Warnings unused variables **/ -#define UNUSED_VAR(var) (void*)var +// #define UNUSED_VAR(var) (void*)var + +// #define UNUSED __attribute__((__unused__)) + -#define UNUSED __attribute__((__unused__)) #define SIP 0 #define IAX 1 @@ -105,6 +107,7 @@ #define SOUND_DEVICE "speaker" +/** Account details */ #define ACCOUNT_TYPE "Account.type" #define ACCOUNT_ALIAS "Account.alias" #define ACCOUNT_ENABLED "Account.enable" @@ -123,8 +126,10 @@ #define ACCOUNT_TYPE_IAX "IAX" #define ACCOUNT_TYPES_TAB {QString(ACCOUNT_TYPE_SIP), QString(ACCOUNT_TYPE_IAX)} +/** Constant variables */ #define ACCOUNT_MAILBOX_DEFAULT_VALUE "888" +/** Account States */ #define ACCOUNT_STATE_REGISTERED "REGISTERED" #define ACCOUNT_STATE_UNREGISTERED "UNREGISTERED" #define ACCOUNT_STATE_TRYING "TRYING" @@ -135,11 +140,12 @@ #define ACCOUNT_STATE_ERROR_CONF_STUN "ERROR_CONF_STUN" #define ACCOUNT_STATE_ERROR_EXIST_STUN "ERROR_EXIST_STUN" - +/** Calls details */ #define CALL_PEER_NAME "PEER_NAME" #define CALL_PEER_NUMBER "PEER_NUMBER" #define CALL_ACCOUNTID "ACCOUNTID" +/** Call States */ #define CALL_STATE_CHANGE_HUNG_UP "HUNGUP" #define CALL_STATE_CHANGE_RINGING "RINGING" #define CALL_STATE_CHANGE_CURRENT "CURRENT" @@ -149,12 +155,14 @@ #define CALL_STATE_CHANGE_UNHOLD_CURRENT "UNHOLD_CURRENT" #define CALL_STATE_CHANGE_UNHOLD_RECORD "UNHOLD_RECORD" +/** Address Book Settings */ #define ADDRESSBOOK_MAX_RESULTS "ADDRESSBOOK_MAX_RESULTS" #define ADDRESSBOOK_DISPLAY_CONTACT_PHOTO "ADDRESSBOOK_DISPLAY_CONTACT_PHOTO" #define ADDRESSBOOK_DISPLAY_BUSINESS "ADDRESSBOOK_DISPLAY_PHONE_BUSINESS" #define ADDRESSBOOK_DISPLAY_HOME "ADDRESSBOOK_DISPLAY_PHONE_HOME" #define ADDRESSBOOK_DISPLAY_MOBILE "ADDRESSBOOK_DISPLAY_PHONE_MOBILE" +/** Hooks settings */ #define HOOKS_ADD_PREFIX "PHONE_NUMBER_HOOK_ADD_PREFIX" #define HOOKS_ENABLED "PHONE_NUMBER_HOOK_ENABLED" #define HOOKS_COMMAND "URLHOOK_COMMAND" @@ -162,16 +170,21 @@ #define HOOKS_SIP_ENABLED "URLHOOK_SIP_ENABLED" #define HOOKS_SIP_FIELD "URLHOOK_SIP_FIELD" - - +/** Constant variables */ #define MAX_HISTORY_CAPACITY 60 - +/** Codecs details */ #define CODEC_NAME 0 #define CODEC_SAMPLE_RATE 1 #define CODEC_BIT_RATE 2 #define CODEC_BANDWIDTH 3 +/** Audio Managers */ +#define ALSA 0 +#define PULSEAUDIO 1 + + + /** Error while opening capture device */ #define ALSA_CAPTURE_DEVICE 0x0001 /** Error while opening playback device */ @@ -179,28 +192,11 @@ /** Error pulseaudio */ #define PULSEAUDIO_NOT_RUNNING 0x0100 - - /** Tone to play when no voice mails */ #define TONE_WITHOUT_MESSAGE 0 /** Tone to play when voice mails */ #define TONE_WITH_MESSAGE 1 -/** Tells if the main window is reduced to the system tray or not */ -#define MINIMIZED TRUE -/** Behaviour of the main window on incoming calls */ -#define __POPUP_WINDOW ( dbus_popup_mode() ) -/** Show/Hide the dialpad */ -#define SHOW_DIALPAD ( dbus_get_dialpad() ) -/** Show/Hide the volume controls */ -#define SHOW_VOLUME ( dbus_get_volume_controls() ) -/** Show/Hide the dialpad */ -#define SHOW_SEARCHBAR ( dbus_get_searchbar() ) -/** Show/Hide the alsa configuration panel */ -#define SHOW_ALSA_CONF ( dbus_get_audio_manager() == ALSA ) -/** Audio Managers */ -#define ALSA 0 -#define PULSEAUDIO 1 /** Notification levels */ #define __NOTIF_LEVEL_MIN 0 diff --git a/sflphone-client-kde/sflphone_kdeview.cpp b/sflphone-client-kde/sflphone_kdeview.cpp index 5189686db0..f904ed86d8 100644 --- a/sflphone-client-kde/sflphone_kdeview.cpp +++ b/sflphone-client-kde/sflphone_kdeview.cpp @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (C) 2009 by Jérémy Quentin * - * jeremy.quentin@gmail.com * + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * + * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -78,6 +79,8 @@ sflphone_kdeView::sflphone_kdeView(QWidget *parent) pal.setColor(QPalette::AlternateBase, Qt::lightGray); setPalette(pal); + stackedWidget_screen->setCurrentWidget(page_callList); + loadWindow(); @@ -109,7 +112,6 @@ void sflphone_kdeView::loadWindow() updateDialpad(); updateSearchHistory(); updateSearchAddressBook(); - stackedWidget_screen->setCurrentWidget(page_callList); } QString sflphone_kdeView::firstAccountId() @@ -447,6 +449,7 @@ void sflphone_kdeView::updateWindowCallState() enabledActions[3] = false; break; case CALL_STATE_CURRENT: + qDebug() << "details = " << CallManagerInterfaceSingleton::getInstance().getCallDetails(call->getCallId()).value(); qDebug() << "Reached CALL_STATE_CURRENT with call " << (*callList)[item]->getCallId() << ". Updating window."; recordEnabled = true; break; @@ -689,6 +692,11 @@ QVector<Contact *> sflphone_kdeView::findContactsInKAddressBook(QString textSear return results; } +/** + * + * @return the integer resulting to the flags of the types chosen to be displayed in SFLPhone configuration. + * useful to sort contacts according to their types. + */ int sflphone_kdeView::phoneNumberTypesDisplayed() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -1331,7 +1339,7 @@ void sflphone_kdeView::on1_error(MapStringString details) void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString & callID) { - qDebug() << "Signal : Incoming Call !"; + qDebug() << "Signal : Incoming Call ! ID = " << callID; ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); Call * call = callList->addIncomingCall(callID); addCallToCallList(call); diff --git a/sflphone-client-kde/sflphone_kdeview.h b/sflphone-client-kde/sflphone_kdeview.h index 2a64fc1763..20017b53fe 100644 --- a/sflphone-client-kde/sflphone_kdeview.h +++ b/sflphone-client-kde/sflphone_kdeview.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (C) 2009 by Jérémy Quentin * - * jeremy.quentin@gmail.com * + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * + * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -39,7 +40,6 @@ #include "ui_sflphone_kdeview_base.h" -class QPainter; class ConfigurationDialog; /** * This is the main view class for sflphone-client-kde. Most of the non-menu, @@ -64,21 +64,36 @@ private: QErrorMessage * errorWindow; protected: + + /** + * override context menu handling + * @param event + */ void contextMenuEvent(QContextMenuEvent *event); public: + + //Constructors & Destructors sflphone_kdeView(QWidget *parent); virtual ~sflphone_kdeView(); - + /** + * + */ void loadWindow(); + + //Getters static QString firstAccountId(); static Account * firstRegisteredAccount(); static QVector<Account *> registeredAccounts(); static AccountList * getAccountList(); - QVector<Contact *> findContactsInKAddressBook(QString textSearched, bool & full); - int phoneNumberTypesDisplayed(); QErrorMessage * getErrorWindow(); - + + //Daemon getters + int phoneNumberTypesDisplayed(); + + //Updates + QVector<Contact *> findContactsInKAddressBook(QString textSearched, bool & full); + private slots: void actionb(Call * call, call_action action); void action(QListWidgetItem * item, call_action action); -- GitLab