diff --git a/sflphone-client-kde/src/Account.cpp b/sflphone-client-kde/src/Account.cpp index 138b9d4554699aab5f72a260496c22ba6a6e61f1..c77e16baf6575b445543770266772e730ce584ae 100644 --- a/sflphone-client-kde/src/Account.cpp +++ b/sflphone-client-kde/src/Account.cpp @@ -100,7 +100,6 @@ Account * Account::buildExistingAccountFromId(QString _accountId) ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); Account * a = new Account(); a->accountId = new QString(_accountId); - qDebug() << "getAccountDetails 1 sent"; a->accountDetails = new MapStringString( configurationManager.getAccountDetails(_accountId).value() ); a->initItem(); return a; diff --git a/sflphone-client-kde/src/AccountItemWidget.cpp b/sflphone-client-kde/src/AccountItemWidget.cpp index 3549b5fd92f2da3398e394d35ec317e6606faebe..1f57e83dd35ff999b3f1d5e4a1c173311dff3b7f 100644 --- a/sflphone-client-kde/src/AccountItemWidget.cpp +++ b/sflphone-client-kde/src/AccountItemWidget.cpp @@ -47,9 +47,6 @@ AccountItemWidget::AccountItemWidget(QWidget *parent) enabled = false; updateDisplay(); -// connect(checkBox, SIGNAL(stateChanged(int)), -// this, SLOT(on_checkBox_stateChanged())); - QMetaObject::connectSlotsByName(this); } @@ -115,6 +112,5 @@ bool AccountItemWidget::getEnabled() void AccountItemWidget::on_checkBox_stateChanged(int state) { - qDebug() << "on_checkBox_stateChanged"; emit checkStateChanged(state == Qt::Checked); } diff --git a/sflphone-client-kde/src/AccountList.cpp b/sflphone-client-kde/src/AccountList.cpp index 61ddb535fd46a8052c2b823b215eb040f1a699be..4add67625c13ee31e1b43532bf4b48f5d13ec5cd 100644 --- a/sflphone-client-kde/src/AccountList.cpp +++ b/sflphone-client-kde/src/AccountList.cpp @@ -38,7 +38,6 @@ AccountList::AccountList(QStringList & _accountIds) AccountList::AccountList(bool fill) { - qDebug() << "AccountList()"; accounts = new QVector<Account *>(); if(fill) { diff --git a/sflphone-client-kde/src/AccountListModel.cpp b/sflphone-client-kde/src/AccountListModel.cpp index 7dcb09a39c246584527fed46d328fe9f78eaf9bb..3b83ffe11e1053895acc4094423b5bf504d4a84c 100644 --- a/sflphone-client-kde/src/AccountListModel.cpp +++ b/sflphone-client-kde/src/AccountListModel.cpp @@ -127,7 +127,7 @@ bool AccountListModel::addAccount( QString alias ) return true; } -int AccountListModel::rowCount(const QModelIndex & parent) const +int AccountListModel::rowCount(const QModelIndex & /*parent*/) const { return accounts->size(); } diff --git a/sflphone-client-kde/src/AccountWizard.cpp b/sflphone-client-kde/src/AccountWizard.cpp index 0b81f3c15a780a643c25dee34ee4f43787873d7e..27a6b5a444162172ca52443983fde79545d0466f 100644 --- a/sflphone-client-kde/src/AccountWizard.cpp +++ b/sflphone-client-kde/src/AccountWizard.cpp @@ -56,13 +56,13 @@ ***************************************************************************/ typedef struct { - char success; - char reason[200]; - char user[200]; - char passwd[200]; + bool success; + QString reason; + QString user; + QString passwd; } rest_account; -int req(char *host, int port, char *req, char *ret) { +int sendRequest(QString host, int port, QString req, QString & ret) { int s; struct sockaddr_in servSockAddr; @@ -74,9 +74,9 @@ int req(char *host, int port, char *req, char *ret) { char buf[1024]; bzero(&servSockAddr, sizeof(servSockAddr)); - servHostEnt = gethostbyname(host); + servHostEnt = gethostbyname(host.toLatin1()); if (servHostEnt == NULL) { - strcpy(ret, "gethostbyname"); + ret = "gethostbyname"; return -1; } bcopy((char *)servHostEnt->h_addr, (char *)&servSockAddr.sin_addr, servHostEnt->h_length); @@ -84,20 +84,22 @@ int req(char *host, int port, char *req, char *ret) { servSockAddr.sin_family = AF_INET; if ((s = socket(AF_INET,SOCK_STREAM,0)) < 0) { - strcpy(ret, "socket"); + ret = "socket"; return -1; } if(connect(s, (const struct sockaddr *) &servSockAddr, (socklen_t) sizeof(servSockAddr)) < 0 ) { - perror("foo"); - strcpy(ret, "connect"); + perror(NULL); + ret = "connect"; return -1; } f = fdopen(s, "r+"); - fprintf(f, "%s HTTP/1.1\r\n", req); - fprintf(f, "Host: %s\r\n", host); + const char * req2 = req.toLatin1(); + const char * host2 = host.toLatin1(); + fprintf(f, "%s HTTP/1.1\r\n", req2); + fprintf(f, "Host: %s\r\n", host2); fputs("User-Agent: SFLphone\r\n", f); fputs("\r\n", f); @@ -113,7 +115,8 @@ int req(char *host, int port, char *req, char *ret) { ret[i] = fgetc(f); if (status != 200) { - sprintf(ret, "http error: %ld", status); + ret = "http error: " + status; +// sprintf(ret, "http error: %ld", status); return -1; } @@ -123,22 +126,22 @@ int req(char *host, int port, char *req, char *ret) { return 0; } -rest_account get_rest_account(char *host,char *email) { - char ret[4096]; +rest_account get_rest_account(QString host, QString email) { + QString req = "GET /rest/accountcreator?email=" + email; + QString ret; rest_account ra; - bzero(ret, sizeof(ret)); - printf("HOST: %s\n", host); - strcpy(ret,"GET /rest/accountcreator?email="); - strcat(ret, email); - if (req(host, 80, ret, ret) != -1) { - strcpy(ra.user, strtok(ret, "\n")); - strcpy(ra.passwd, strtok(NULL, "\n"));\ - ra.success = 1; + qDebug() << "HOST: " << host; + int res = sendRequest(host, 80, req, ret); + if (res != -1) { + QStringList list = ret.split("\n"); + ra.user = list[0]; + ra.passwd = list[1];\ + ra.success = true; } else { - ra.success = 0; - strcpy(ra.reason, ret); + ra.success = false; + ra.reason = ret; } - puts(ret); + qDebug() << ret; return ra; } diff --git a/sflphone-client-kde/src/CMakeLists.txt b/sflphone-client-kde/src/CMakeLists.txt index 778aabb808e79ecc36e232dbdefa9530e5747700..e1a056a1059c3ddd706a496185bad4dec5f8a35e 100644 --- a/sflphone-client-kde/src/CMakeLists.txt +++ b/sflphone-client-kde/src/CMakeLists.txt @@ -1,5 +1,4 @@ - ADD_DEFINITIONS( ${KDE4_DEFINITIONS} ${QT_DEFINITIONS} @@ -8,16 +7,6 @@ ADD_DEFINITIONS( -DSHARE_INSTALL_PREFIX="\\\"${SHARE_INSTALL_PREFIX}\\\"" ) -# add_definitions ( -DKDE_DEFAULT_DEBUG_AREA=9000 ) - -# kde4_set_debug_area( 1234 ) - -# IF(DEFINED DEBUG_DISABLED) -# MESSAGE("NO DEBUG OUTPUT") -# ADD_DEFINITIONS( -DQT_NO_DEBUG_OUTPUT ) -# ENDIF(DEFINED DEBUG_DISABLED) - - MESSAGE("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") IF(${CMAKE_BUILD_TYPE} MATCHES Release) @@ -28,7 +17,7 @@ ENDIF(${CMAKE_BUILD_TYPE} MATCHES Release) SET ( KDE4_KABC_LIBS -lkabc ) SET( sflphone_client_kde_SRCS - sflphone_kdeview.cpp + SFLPhoneView.cpp SFLPhone.cpp main.cpp sflphone_const.h @@ -124,12 +113,11 @@ SET( config_ui_files conf/dlghooksbase.ui ) -KDE4_ADD_UI_FILES(sflphone_client_kde_SRCS ui/sflphone_kdeview_base.ui ${config_ui_files} ) +KDE4_ADD_UI_FILES(sflphone_client_kde_SRCS ui/SFLPhoneView_base.ui ${config_ui_files} ) KDE4_ADD_KCFG_FILES(sflphone_client_kde_SRCS conf/kcfg_settings.kcfgc) INSTALL(FILES conf/sflphone-client-kde.kcfg DESTINATION ${KCFG_INSTALL_DIR}) - KDE4_ADD_EXECUTABLE(sflphone-client-kde ${sflphone_client_kde_SRCS} ${QtApp_RCC_SRCS}) TARGET_LINK_LIBRARIES(sflphone-client-kde ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KABC_LIBS}) diff --git a/sflphone-client-kde/src/Call.cpp b/sflphone-client-kde/src/Call.cpp index efb34db0da9ab6b59166ceb24edb7f62736ac8c4..ef0975796a4b11459fbd91f22c8894d2f9c9f8d3 100644 --- a/sflphone-client-kde/src/Call.cpp +++ b/sflphone-client-kde/src/Call.cpp @@ -111,7 +111,6 @@ void Call::initCallItem() itemWidget = new QWidget(); labelIcon = new QLabel(); - qDebug() << "labelIcon : " << labelIcon; labelCallNumber = new QLabel(peerPhoneNumber); labelTransferPrefix = new QLabel(i18n("Transfer to : ")); labelTransferNumber = new QLabel(); @@ -127,7 +126,6 @@ void Call::initCallItem() transfer->setMargin(0); transfer->setSpacing(0); mainLayout->addWidget(labelIcon); - qDebug() << "descr->addWidget(labelPeerName);"; if(! peerName.isEmpty()) { labelPeerName = new QLabel(peerName); @@ -389,15 +387,12 @@ QListWidgetItem * Call::getHistoryItem() { historyItem = new QListWidgetItem(); historyItem->setSizeHint(QSize(140,45)); - qDebug() << "historystate = " << historyState; } return historyItem; } QWidget * Call::getHistoryItemWidget() { -// if(historyItemWidget == NULL && historyState != NONE) -// { historyItemWidget = new QWidget(); labelHistoryIcon = new QLabel(); labelHistoryIcon->setPixmap(QPixmap(historyIcons[historyState])); @@ -584,8 +579,8 @@ void Call::call() qDebug() << "account = " << account; if(account.isEmpty()) { - qDebug() << "account is empty, taking the first registered."; - this->account = sflphone_kdeView::firstRegisteredAccountId(); + qDebug() << "account is not set, taking the first registered."; + this->account = SFLPhoneView::accountInUseId(); } if(!account.isEmpty()) { @@ -670,14 +665,8 @@ void Call::appendItemText(QString text) editNumber = labelCallNumber; break; case CALL_STATE_CURRENT: - //TODO replace account string by an Account instance and handle damn pointers to avoid detruction of Accounts -// if(peerPhoneNumber == configurationManager.getAccountDetails(account).value()[ACCOUNT_MAILBOX]) -// { -// text = QString(QChar(0x9A)); -// } text = QString(); editNumber = labelCallNumber; - break; default: qDebug() << "Type key on call not editable. Doing nothing."; diff --git a/sflphone-client-kde/src/CallList.cpp b/sflphone-client-kde/src/CallList.cpp index 9f2cb774456cb3f812375a2e78fd720d19bb9e64..c2ff2e4a5e27ec93341aedd6ec8080d5f7fe183d 100644 --- a/sflphone-client-kde/src/CallList.cpp +++ b/sflphone-client-kde/src/CallList.cpp @@ -25,7 +25,8 @@ #include "callmanager_interface_singleton.h" #include "configurationmanager_interface_singleton.h" -CallList::CallList() +CallList::CallList(QObject * parent) + : QObject(parent) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); diff --git a/sflphone-client-kde/src/CallList.h b/sflphone-client-kde/src/CallList.h index e9ff5341b32a19a4822620b7e63886495eb733c7..40c6de88ff9a40dcffb427d1fd350a60fb829576 100644 --- a/sflphone-client-kde/src/CallList.h +++ b/sflphone-client-kde/src/CallList.h @@ -39,7 +39,7 @@ private: public: //Constructors & Destructors - CallList(); + CallList(QObject * parent = 0); ~CallList(); //Getters diff --git a/sflphone-client-kde/src/CodecListModel.cpp b/sflphone-client-kde/src/CodecListModel.cpp index 4acf8a05662df40dc63f3ac612ac74a21952db4f..a6ce0616b6998b99163101446a787f675215016a 100644 --- a/sflphone-client-kde/src/CodecListModel.cpp +++ b/sflphone-client-kde/src/CodecListModel.cpp @@ -71,12 +71,12 @@ QVariant CodecListModel::data ( const QModelIndex & index, int role) const } -int CodecListModel::rowCount(const QModelIndex & parent) const +int CodecListModel::rowCount(const QModelIndex & /*parent*/) const { return codecs.count(); } -int CodecListModel::columnCount(const QModelIndex & parent) const +int CodecListModel::columnCount(const QModelIndex & /*parent*/) const { return 4; } @@ -186,7 +186,6 @@ void CodecListModel::setActiveCodecList(const QStringList & activeCodecListToSet for(int i=0 ; i<codecListToDisplay.size() ; i++) { bool ok; - qDebug() << codecListToDisplay[i]; QString payloadStr = QString(codecListToDisplay[i]); int payload = payloadStr.toInt(&ok); if(!ok) diff --git a/sflphone-client-kde/src/Dialpad.cpp b/sflphone-client-kde/src/Dialpad.cpp index ce98484b4c1c4781ed07d8ac6ce15b3dbf90dec6..c0219b71a615e939edd6150d1197e83490bd0a0f 100644 --- a/sflphone-client-kde/src/Dialpad.cpp +++ b/sflphone-client-kde/src/Dialpad.cpp @@ -42,7 +42,7 @@ Dialpad::Dialpad(QWidget *parent) pushButton_diese = new QPushButton(this); pushButton_etoile = new QPushButton(this); - pushButton_0->setObjectName(QString::fromUtf8("pushButton_0")); + pushButton_0 ->setObjectName(QString::fromUtf8("pushButton_0")); pushButton_1->setObjectName(QString::fromUtf8("pushButton_1")); pushButton_2->setObjectName(QString::fromUtf8("pushButton_2")); pushButton_3->setObjectName(QString::fromUtf8("pushButton_3")); @@ -64,9 +64,9 @@ Dialpad::Dialpad(QWidget *parent) gridLayout->addWidget(pushButton_7, 2, 0); gridLayout->addWidget(pushButton_8, 2, 1); gridLayout->addWidget(pushButton_9, 2, 2); - gridLayout->addWidget(pushButton_diese, 3, 0); + gridLayout->addWidget(pushButton_etoile, 3, 0); gridLayout->addWidget(pushButton_0, 3, 1); - gridLayout->addWidget(pushButton_etoile, 3, 2); + gridLayout->addWidget(pushButton_diese, 3, 2); fillButtons(); diff --git a/sflphone-client-kde/src/Item.h b/sflphone-client-kde/src/Item.h index c859375c07cfbabc6091b52b67b13745106e99e9..ed1063d6bac0e2203ca01581c7490808e2068d11 100644 --- a/sflphone-client-kde/src/Item.h +++ b/sflphone-client-kde/src/Item.h @@ -43,7 +43,12 @@ protected: public: - Item(QListWidget *list=0) + /** + * Would be great to take the QListWidget as attribute + * to be able to add the itemWidget to the item in the list. + * For the moment, we have to do it from outside. + */ + Item(/*QListWidget *list=0*/) { item = NULL; itemWidget = NULL; @@ -63,6 +68,7 @@ public: { return item; } + WIDGET_TYPE * getItemWidget() { return itemWidget; diff --git a/sflphone-client-kde/src/SFLPhone.cpp b/sflphone-client-kde/src/SFLPhone.cpp index 48ebe899897630020606eff4d75aa7ee27e9c22e..2e60ff3906fa3dcbae0e6364a30dfa1b28457efd 100644 --- a/sflphone-client-kde/src/SFLPhone.cpp +++ b/sflphone-client-kde/src/SFLPhone.cpp @@ -37,13 +37,9 @@ #include "configurationmanager_interface_singleton.h" -/** - * - * @param parent - */ SFLPhone::SFLPhone(QWidget *parent) : KXmlGuiWindow(parent), - view(new sflphone_kdeView(this)) + view(new SFLPhoneView(this)) { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -181,7 +177,7 @@ void SFLPhone::setupActions() } -sflphone_kdeView * SFLPhone::getView() +SFLPhoneView * SFLPhone::getView() { return view; } diff --git a/sflphone-client-kde/src/SFLPhone.h b/sflphone-client-kde/src/SFLPhone.h index f0b3992b3bf54f39dd4e112b2dfcedd5cd250931..fa0859cebcfc5e5fd7811cd72006151da45b0b2e 100644 --- a/sflphone-client-kde/src/SFLPhone.h +++ b/sflphone-client-kde/src/SFLPhone.h @@ -33,15 +33,28 @@ #include <KAction> #include <QActionGroup> -#include "ui_sflphone_kdeview_base.h" +// #include "ui_SFLPhoneView_base.h" #include "CallList.h" #include "AccountWizard.h" #include "Contact.h" -#include "sflphone_kdeview.h" +#include "SFLPhoneView.h" +class SFLPhoneView; -class sflphone_kdeView; - +/** + * This class represents the SFLphone main window + * It implements the methods relative to windowing + * (status, menus, toolbars, notifications...). + * It uses a view which implements the real functionning + * and features of the phone. + * The display of the window is according to the state of the view, + * so the view sends some signals to ask for changes on the window + * that the window has to take into account. + * + * @short Main window + * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> + * @version 0.9.6 +**/ class SFLPhone : public KXmlGuiWindow { Q_OBJECT @@ -74,7 +87,7 @@ private: KAction * action_configureSflPhone; KAction * action_accountCreationWizard; - sflphone_kdeView * view; + SFLPhoneView * view; QMenu *trayIconMenu; bool iconChanged; QSystemTrayIcon *trayIcon; @@ -95,7 +108,7 @@ public: void sendNotif(QString caller); void putForeground(); void trayIconSignal(); - sflphone_kdeView * getView(); + SFLPhoneView * getView(); QList<QAction *> getCallActions(); diff --git a/sflphone-client-kde/src/sflphone_kdeview.cpp b/sflphone-client-kde/src/SFLPhoneView.cpp similarity index 86% rename from sflphone-client-kde/src/sflphone_kdeview.cpp rename to sflphone-client-kde/src/SFLPhoneView.cpp index f0f2518a7a8f14a2c8261b0252c44cde1da2a4cc..00e77279ac3402d5623c5816507fe6fef25fbf97 100644 --- a/sflphone-client-kde/src/sflphone_kdeview.cpp +++ b/sflphone-client-kde/src/SFLPhoneView.cpp @@ -19,9 +19,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "sflphone_kdeview.h" +#include "SFLPhoneView.h" -#include <klocale.h> #include <QtGui/QLabel> #include <QtGui/QContextMenuEvent> #include <QtGui/QMenu> @@ -29,6 +28,7 @@ #include <QtGui/QPalette> #include <QtGui/QInputDialog> +#include <klocale.h> #include <kstandardaction.h> #include <kactioncollection.h> #include <kaction.h> @@ -50,11 +50,11 @@ using namespace KABC; -ConfigurationDialogKDE * sflphone_kdeView::configDialog; -AccountList * sflphone_kdeView::accountList; -QString sflphone_kdeView::priorAccountId; +ConfigurationDialog * SFLPhoneView::configDialog; +AccountList * SFLPhoneView::accountList; +QString SFLPhoneView::priorAccountId; -sflphone_kdeView::sflphone_kdeView(QWidget *parent) +SFLPhoneView::SFLPhoneView(QWidget *parent) : QWidget(parent) { setupUi(this); @@ -64,7 +64,7 @@ sflphone_kdeView::sflphone_kdeView(QWidget *parent) CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); errorWindow = new QErrorMessage(this); - callList = new CallList(); + callList = new CallList(this); for(int i = 0 ; i < callList->size() ; i++) { Call * call = (*callList)[i]; @@ -80,7 +80,7 @@ sflphone_kdeView::sflphone_kdeView(QWidget *parent) accountList = new AccountList(false); - configDialog = new ConfigurationDialogKDE(this); + configDialog = new ConfigurationDialog(this); configDialog->setObjectName("configDialog"); configDialog->setModal(true); @@ -120,20 +120,15 @@ sflphone_kdeView::sflphone_kdeView(QWidget *parent) stackedWidget_screen->setCurrentWidget(page_callList); -// loadWindow(); - } -sflphone_kdeView::~sflphone_kdeView() +SFLPhoneView::~SFLPhoneView() { - delete configDialog; - delete wizard; - delete callList; } -void sflphone_kdeView::loadWindow() +void SFLPhoneView::loadWindow() { qDebug() << "loadWindow"; updateWindowCallState(); @@ -149,9 +144,7 @@ void sflphone_kdeView::loadWindow() updateStatusMessage(); } - - -Account * sflphone_kdeView::firstRegisteredAccount() +Account * SFLPhoneView::accountInUse() { Account * priorAccount = accountList->getAccountById(priorAccountId); if(priorAccount && priorAccount->getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED ) @@ -164,9 +157,9 @@ Account * sflphone_kdeView::firstRegisteredAccount() } } -QString sflphone_kdeView::firstRegisteredAccountId() +QString SFLPhoneView::accountInUseId() { - Account * firstRegistered = firstRegisteredAccount(); + Account * firstRegistered = accountInUse(); if(firstRegistered == NULL) { return QString(); @@ -177,17 +170,17 @@ QString sflphone_kdeView::firstRegisteredAccountId() } } -AccountList * sflphone_kdeView::getAccountList() +AccountList * SFLPhoneView::getAccountList() { return accountList; } -QErrorMessage * sflphone_kdeView::getErrorWindow() +QErrorMessage * SFLPhoneView::getErrorWindow() { return errorWindow; } -void sflphone_kdeView::addCallToCallList(Call * call) +void SFLPhoneView::addCallToCallList(Call * call) { QListWidgetItem * item = call->getItem(); QWidget * widget = call->getItemWidget(); @@ -198,7 +191,7 @@ void sflphone_kdeView::addCallToCallList(Call * call) } } -void sflphone_kdeView::addCallToCallHistory(Call * call) +void SFLPhoneView::addCallToCallHistory(Call * call) { QListWidgetItem * item = call->getHistoryItem(); QWidget * widget = call->getHistoryItemWidget(); @@ -209,7 +202,7 @@ void sflphone_kdeView::addCallToCallHistory(Call * call) } } -void sflphone_kdeView::addContactToContactList(Contact * contact) +void SFLPhoneView::addContactToContactList(Contact * contact) { QListWidgetItem * item = contact->getItem(); QWidget * widget = contact->getItemWidget(); @@ -220,7 +213,7 @@ void sflphone_kdeView::addContactToContactList(Contact * contact) } } -void sflphone_kdeView::typeString(QString str) +void SFLPhoneView::typeString(QString str) { qDebug() << "typeString"; CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -252,7 +245,7 @@ void sflphone_kdeView::typeString(QString str) } } -void sflphone_kdeView::backspace() +void SFLPhoneView::backspace() { qDebug() << "backspace"; if(stackedWidget_screen->currentWidget() == page_callList) @@ -279,7 +272,7 @@ void sflphone_kdeView::backspace() } } -void sflphone_kdeView::escape() +void SFLPhoneView::escape() { qDebug() << "escape"; if(stackedWidget_screen->currentWidget() == page_callList ) @@ -323,7 +316,7 @@ void sflphone_kdeView::escape() } } -void sflphone_kdeView::enter() +void SFLPhoneView::enter() { qDebug() << "enter"; if(stackedWidget_screen->currentWidget() == page_callList ) @@ -365,8 +358,6 @@ void sflphone_kdeView::enter() } else { -// action_history->setChecked(false); -// stackedWidget_screen->setCurrentWidget(page_callList); changeScreen(SCREEN_MAIN); Call * pastCall = callList->findCallByHistoryItem(item); @@ -391,8 +382,6 @@ void sflphone_kdeView::enter() } else { -// action_addressBook->setChecked(false); -// stackedWidget_screen->setCurrentWidget(page_callList); changeScreen(SCREEN_MAIN); ContactItemWidget * w = (ContactItemWidget *) (listWidget_addressBook->itemWidget(item)); Call * call = callList->addDialingCall(w->getContactName()); @@ -404,7 +393,7 @@ void sflphone_kdeView::enter() } } -void sflphone_kdeView::action(Call * call, call_action action) +void SFLPhoneView::action(Call * call, call_action action) { if(! call) { @@ -430,7 +419,7 @@ void sflphone_kdeView::action(Call * call, call_action action) ******** Update Display Functions ********** *******************************************/ -void sflphone_kdeView::updateCallItem(Call * call) +void SFLPhoneView::updateCallItem(Call * call) { call_state state = call->getState(); if(state == CALL_STATE_OVER) @@ -442,7 +431,7 @@ void sflphone_kdeView::updateCallItem(Call * call) } -void sflphone_kdeView::updateWindowCallState() +void SFLPhoneView::updateWindowCallState() { qDebug() << "updateWindowCallState"; @@ -455,7 +444,7 @@ void sflphone_kdeView::updateWindowCallState() bool transfer = false; //tells whether the call is in recording position bool recordActivated = false; - enabledActions[SFLPhone::Mailbox] = firstRegisteredAccount() && ! firstRegisteredAccount()->getAccountDetail(ACCOUNT_MAILBOX).isEmpty(); + enabledActions[SFLPhone::Mailbox] = accountInUse() && ! accountInUse()->getAccountDetail(ACCOUNT_MAILBOX).isEmpty(); if(stackedWidget_screen->currentWidget() == page_callList) { item = listWidget_callList->currentItem(); @@ -600,20 +589,19 @@ void sflphone_kdeView::updateWindowCallState() qDebug() << "Window updated."; } -void sflphone_kdeView::updateSearchHistory() +void SFLPhoneView::updateSearchHistory() { qDebug() << "updateSearchHistory"; lineEdit_searchHistory->setVisible(!lineEdit_searchHistory->text().isEmpty()); } -void sflphone_kdeView::updateCallHistory() +void SFLPhoneView::updateCallHistory() { qDebug() << "updateCallHistory"; while(listWidget_callHistory->count() > 0) { QListWidgetItem * item = listWidget_callHistory->takeItem(0); - qDebug() << "take item " << item->text() << " ; widget = " << callList->findCallByHistoryItem(item); } QString textSearched = lineEdit_searchHistory->text(); for(int i = callList->size() - 1 ; i >= 0 ; i--) @@ -633,13 +621,12 @@ void sflphone_kdeView::updateCallHistory() alternateColors(listWidget_callHistory); } -void sflphone_kdeView::updateAddressBook() +void SFLPhoneView::updateAddressBook() { qDebug() << "updateAddressBook"; while(listWidget_addressBook->count() > 0) { QListWidgetItem * item = listWidget_addressBook->takeItem(0); - qDebug() << "take item " << item->text(); delete item; } if(isAddressBookEnabled()) @@ -673,7 +660,7 @@ void sflphone_kdeView::updateAddressBook() } -void sflphone_kdeView::alternateColors(QListWidget * listWidget) +void SFLPhoneView::alternateColors(QListWidget * listWidget) { qDebug() << "alternateColors"; for(int i = 0 ; i < listWidget->count(); i++) @@ -686,7 +673,7 @@ void sflphone_kdeView::alternateColors(QListWidget * listWidget) } -QVector<Contact *> sflphone_kdeView::findContactsInKAddressBook(QString textSearched, bool & full) +QVector<Contact *> SFLPhoneView::findContactsInKAddressBook(QString textSearched, bool & full) { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); MapStringInt addressBookSettings = configurationManager.getAddressbookSettings().value(); @@ -720,7 +707,7 @@ QVector<Contact *> sflphone_kdeView::findContactsInKAddressBook(QString textSear } -int sflphone_kdeView::phoneNumberTypesDisplayed() +int SFLPhoneView::phoneNumberTypesDisplayed() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); MapStringInt addressBookSettings = configurationManager.getAddressbookSettings().value(); @@ -740,7 +727,7 @@ int sflphone_kdeView::phoneNumberTypesDisplayed() return typesDisplayed; } -void sflphone_kdeView::updateRecordButton() +void SFLPhoneView::updateRecordButton() { qDebug() << "updateRecordButton"; CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -771,7 +758,7 @@ void sflphone_kdeView::updateRecordButton() toolButton_recVolAlone->setChecked(false); } } -void sflphone_kdeView::updateVolumeButton() +void SFLPhoneView::updateVolumeButton() { qDebug() << "updateVolumeButton"; CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -804,7 +791,7 @@ void sflphone_kdeView::updateVolumeButton() } -void sflphone_kdeView::updateRecordBar() +void SFLPhoneView::updateRecordBar() { qDebug() << "updateRecordBar"; CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -813,7 +800,7 @@ void sflphone_kdeView::updateRecordBar() slider_recVol->setValue(value); slider_recVolAlone->setValue(value); } -void sflphone_kdeView::updateVolumeBar() +void SFLPhoneView::updateVolumeBar() { qDebug() << "updateVolumeBar"; CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -823,7 +810,7 @@ void sflphone_kdeView::updateVolumeBar() slider_sndVolAlone->setValue(value); } -void sflphone_kdeView::updateVolumeControls() +void SFLPhoneView::updateVolumeControls() { qDebug() << "updateVolumeControls"; ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -835,7 +822,7 @@ void sflphone_kdeView::updateVolumeControls() widget_sndVolAlone->setVisible(display && ! displayDialpad); } -void sflphone_kdeView::updateDialpad() +void SFLPhoneView::updateDialpad() { qDebug() << "updateDialpad"; ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -844,10 +831,10 @@ void sflphone_kdeView::updateDialpad() } -void sflphone_kdeView::updateStatusMessage() +void SFLPhoneView::updateStatusMessage() { qDebug() << "updateStatusMessage"; - Account * account = firstRegisteredAccount(); + Account * account = accountInUse(); if(account == NULL) { emit statusMessageChangeAsked(i18n("No registered accounts")); @@ -864,14 +851,14 @@ void sflphone_kdeView::updateStatusMessage() ************ Autoconnect ************* ************************************************************/ -void sflphone_kdeView::displayVolumeControls() +void SFLPhoneView::displayVolumeControls() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); configurationManager.setVolumeControls(); updateVolumeControls(); } -void sflphone_kdeView::displayDialpad() +void SFLPhoneView::displayDialpad() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); configurationManager.setDialpad(); @@ -880,25 +867,25 @@ void sflphone_kdeView::displayDialpad() } -void sflphone_kdeView::on_widget_dialpad_typed(QString text) { typeString(text); } +void SFLPhoneView::on_widget_dialpad_typed(QString text) { typeString(text); } -void sflphone_kdeView::on_lineEdit_searchHistory_textChanged() +void SFLPhoneView::on_lineEdit_searchHistory_textChanged() { - qDebug() << "on_lineEdit_searchHistory_textEdited"; + qDebug() << "on_lineEdit_searchHistory_textChanged"; updateSearchHistory(); updateCallHistory(); updateWindowCallState(); } -void sflphone_kdeView::on_lineEdit_addressBook_textChanged() +void SFLPhoneView::on_lineEdit_addressBook_textChanged() { - qDebug() << "on_lineEdit_addressBook_textEdited"; + qDebug() << "on_lineEdit_addressBook_textChanged"; updateAddressBook(); updateWindowCallState(); } -void sflphone_kdeView::on_slider_recVol_valueChanged(int value) +void SFLPhoneView::on_slider_recVol_valueChanged(int value) { qDebug() << "on_slider_recVol_valueChanged(" << value << ")"; CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -906,7 +893,7 @@ void sflphone_kdeView::on_slider_recVol_valueChanged(int value) updateRecordButton(); } -void sflphone_kdeView::on_slider_sndVol_valueChanged(int value) +void SFLPhoneView::on_slider_sndVol_valueChanged(int value) { qDebug() << "on_slider_sndVol_valueChanged(" << value << ")"; CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -915,7 +902,7 @@ void sflphone_kdeView::on_slider_sndVol_valueChanged(int value) } -void sflphone_kdeView::on_toolButton_recVol_clicked(bool checked) +void SFLPhoneView::on_toolButton_recVol_clicked(bool checked) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); qDebug() << "on_toolButton_recVol_clicked()."; @@ -942,7 +929,7 @@ void sflphone_kdeView::on_toolButton_recVol_clicked(bool checked) } -void sflphone_kdeView::on_toolButton_sndVol_clicked(bool checked) +void SFLPhoneView::on_toolButton_sndVol_clicked(bool checked) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); qDebug() << "on_toolButton_sndVol_clicked()."; @@ -968,19 +955,19 @@ void sflphone_kdeView::on_toolButton_sndVol_clicked(bool checked) } -void sflphone_kdeView::on_listWidget_callList_currentItemChanged() +void SFLPhoneView::on_listWidget_callList_currentItemChanged() { qDebug() << "on_listWidget_callList_currentItemChanged"; updateWindowCallState(); } -void sflphone_kdeView::on_listWidget_callList_itemChanged() +void SFLPhoneView::on_listWidget_callList_itemChanged() { qDebug() << "on_listWidget_callList_itemChanged"; stackedWidget_screen->setCurrentWidget(page_callList); } -void sflphone_kdeView::on_listWidget_callList_itemDoubleClicked(QListWidgetItem * item) +void SFLPhoneView::on_listWidget_callList_itemDoubleClicked(QListWidgetItem * item) { qDebug() << "on_listWidget_callList_itemDoubleClicked"; Call * call = callList->findCallByItem(item); @@ -998,11 +985,9 @@ void sflphone_kdeView::on_listWidget_callList_itemDoubleClicked(QListWidgetItem } } -void sflphone_kdeView::on_listWidget_callHistory_itemDoubleClicked(QListWidgetItem * item) +void SFLPhoneView::on_listWidget_callHistory_itemDoubleClicked(QListWidgetItem * item) { qDebug() << "on_listWidget_callHistory_itemDoubleClicked"; -// action_history->setChecked(false); -// stackedWidget_screen->setCurrentWidget(page_callList); changeScreen(SCREEN_MAIN); Call * pastCall = callList->findCallByHistoryItem(item); Call * call = callList->addDialingCall(pastCall->getPeerName(), pastCall->getAccountId()); @@ -1013,11 +998,9 @@ void sflphone_kdeView::on_listWidget_callHistory_itemDoubleClicked(QListWidgetIt } -void sflphone_kdeView::on_listWidget_addressBook_itemDoubleClicked(QListWidgetItem * item) +void SFLPhoneView::on_listWidget_addressBook_itemDoubleClicked(QListWidgetItem * item) { qDebug() << "on_listWidget_addressBook_itemDoubleClicked"; -// action_addressBook->setChecked(false); -// stackedWidget_screen->setCurrentWidget(page_callList); changeScreen(SCREEN_MAIN); ContactItemWidget * w = (ContactItemWidget *) (listWidget_addressBook->itemWidget(item)); Call * call = callList->addDialingCall(w->getContactName()); @@ -1027,7 +1010,7 @@ void sflphone_kdeView::on_listWidget_addressBook_itemDoubleClicked(QListWidgetIt action(call, CALL_ACTION_ACCEPT); } -void sflphone_kdeView::on_stackedWidget_screen_currentChanged(int index) +void SFLPhoneView::on_stackedWidget_screen_currentChanged(int index) { qDebug() << "on_stackedWidget_screen_currentChanged"; switch(index) @@ -1052,10 +1035,11 @@ void sflphone_kdeView::on_stackedWidget_screen_currentChanged(int index) } } -void sflphone_kdeView::contextMenuEvent(QContextMenuEvent *event) +void SFLPhoneView::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); - if(stackedWidget_screen->currentWidget() == page_callHistory || stackedWidget_screen->currentWidget() == page_addressBook) + if( ( stackedWidget_screen->currentWidget() == page_callHistory && listWidget_callHistory->currentItem() ) || + ( stackedWidget_screen->currentWidget() == page_addressBook && listWidget_addressBook->currentItem() ) ) { QAction * action_edit = new QAction(&menu); action_edit->setText(i18n("Edit before call")); @@ -1081,7 +1065,6 @@ void sflphone_kdeView::contextMenuEvent(QContextMenuEvent *event) QVector<Account *> accounts = accountList->registeredAccounts(); for (int i = 0 ; i < accounts.size() ; i++) { - qDebug() << i; Account * account = accounts.at(i); QAction * action = new ActionSetAccountFirst(account, &menu); action->setChecked(account->getAccountId() == priorAccountId); @@ -1092,7 +1075,7 @@ void sflphone_kdeView::contextMenuEvent(QContextMenuEvent *event) menu.exec(event->globalPos()); } -void sflphone_kdeView::editBeforeCall() +void SFLPhoneView::editBeforeCall() { qDebug() << "editBeforeCall"; QString name; @@ -1126,9 +1109,6 @@ void sflphone_kdeView::editBeforeCall() QString newNumber = QInputDialog::getText(this, i18n("Edit before call"), QString(), QLineEdit::Normal, number, &ok); if(ok) { -// action_history->setChecked(false); -// action_addressBook->setChecked(false); -// stackedWidget_screen->setCurrentWidget(page_callList); changeScreen(SCREEN_MAIN); Call * call = callList->addDialingCall(name); call->appendItemText(newNumber); @@ -1138,7 +1118,7 @@ void sflphone_kdeView::editBeforeCall() } } -void sflphone_kdeView::setAccountFirst(Account * account) +void SFLPhoneView::setAccountFirst(Account * account) { qDebug() << "setAccountFirst : " << (account ? account->getAlias() : QString()); if(account) @@ -1152,32 +1132,32 @@ void sflphone_kdeView::setAccountFirst(Account * account) updateStatusMessage(); } -void sflphone_kdeView::on_listWidget_callHistory_currentItemChanged() +void SFLPhoneView::on_listWidget_callHistory_currentItemChanged() { qDebug() << "on_listWidget_callHistory_currentItemChanged"; updateWindowCallState(); } -void sflphone_kdeView::on_listWidget_addressBook_currentItemChanged() +void SFLPhoneView::on_listWidget_addressBook_currentItemChanged() { qDebug() << "on_listWidget_addressBook_currentItemChanged"; updateWindowCallState(); } -void sflphone_kdeView::configureSflPhone() +void SFLPhoneView::configureSflPhone() { configDialog->reload(); configDialog->show(); } -void sflphone_kdeView::accountCreationWizard() +void SFLPhoneView::accountCreationWizard() { wizard->show(); } -void sflphone_kdeView::accept() +void SFLPhoneView::accept() { if(stackedWidget_screen->currentWidget() == page_callList) { @@ -1215,8 +1195,6 @@ void sflphone_kdeView::accept() } if(stackedWidget_screen->currentWidget() == page_callHistory) { -// action_history->setChecked(false); -// stackedWidget_screen->setCurrentWidget(page_callList); changeScreen(SCREEN_MAIN); Call * pastCall = callList->findCallByHistoryItem(listWidget_callHistory->currentItem()); Call * call = callList->addDialingCall(pastCall->getPeerName()); @@ -1227,8 +1205,6 @@ void sflphone_kdeView::accept() } if(stackedWidget_screen->currentWidget() == page_addressBook) { -// action_addressBook->setChecked(false); -// stackedWidget_screen->setCurrentWidget(page_callList); changeScreen(SCREEN_MAIN); ContactItemWidget * w = (ContactItemWidget *) (listWidget_addressBook->itemWidget(listWidget_addressBook->currentItem())); Call * call = callList->addDialingCall(w->getContactName()); @@ -1239,7 +1215,7 @@ void sflphone_kdeView::accept() } } -void sflphone_kdeView::refuse() +void SFLPhoneView::refuse() { if(stackedWidget_screen->currentWidget() == page_callList) { @@ -1263,7 +1239,7 @@ void sflphone_kdeView::refuse() } } -void sflphone_kdeView::hold() +void SFLPhoneView::hold() { QListWidgetItem * item = listWidget_callList->currentItem(); if(!item) @@ -1276,7 +1252,7 @@ void sflphone_kdeView::hold() } } -void sflphone_kdeView::transfer() +void SFLPhoneView::transfer() { QListWidgetItem * item = listWidget_callList->currentItem(); if(!item) @@ -1289,7 +1265,7 @@ void sflphone_kdeView::transfer() } } -void sflphone_kdeView::record() +void SFLPhoneView::record() { QListWidgetItem * item = listWidget_callList->currentItem(); if(!item) @@ -1302,9 +1278,9 @@ void sflphone_kdeView::record() } } -void sflphone_kdeView::mailBox() +void SFLPhoneView::mailBox() { - Account * account = firstRegisteredAccount(); + Account * account = accountInUse(); QString mailBoxNumber = account->getAccountDetail(ACCOUNT_MAILBOX); Call * call = callList->addDialingCall(); call->appendItemText(mailBoxNumber); @@ -1313,7 +1289,7 @@ void sflphone_kdeView::mailBox() action(call, CALL_ACTION_ACCEPT); } -void sflphone_kdeView::on1_callStateChanged(const QString &callID, const QString &state) +void SFLPhoneView::on1_callStateChanged(const QString &callID, const QString &state) { qDebug() << "Signal : Call State Changed for call " << callID << " . New state : " << state; Call * call = callList->findCallByCallId(callID); @@ -1338,32 +1314,31 @@ void sflphone_kdeView::on1_callStateChanged(const QString &callID, const QString updateWindowCallState(); } -void sflphone_kdeView::on1_error(MapStringString details) +void SFLPhoneView::on1_error(MapStringString details) { qDebug() << "Signal : Daemon error : " << details; } -void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString & callID) +void SFLPhoneView::on1_incomingCall(const QString & /*accountID*/, const QString & callID) { qDebug() << "Signal : Incoming Call ! ID = " << callID; - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); Call * call = callList->addIncomingCall(callID); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); emit incomingCall(call); } -void sflphone_kdeView::on1_incomingMessage(const QString &accountID, const QString &message) +void SFLPhoneView::on1_incomingMessage(const QString &accountID, const QString &message) { - qDebug() << "Signal : Incoming Message ! \nMessage : " << message; + qDebug() << "Signal : Incoming Message for account " << accountID << " ! \nMessage : " << message; } -void sflphone_kdeView::on1_voiceMailNotify(const QString &accountID, int count) +void SFLPhoneView::on1_voiceMailNotify(const QString &accountID, int count) { qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID; } -void sflphone_kdeView::on1_volumeChanged(const QString &device, double value) +void SFLPhoneView::on1_volumeChanged(const QString & /*device*/, double value) { qDebug() << "Signal : Volume Changed !"; if(! (toolButton_recVol->isChecked() && value == 0.0)) @@ -1372,7 +1347,7 @@ void sflphone_kdeView::on1_volumeChanged(const QString &device, double value) updateVolumeBar(); } -void sflphone_kdeView::enableAddressBook() +void SFLPhoneView::enableAddressBook() { qDebug() << "\nenableAddressBook\n"; lineEdit_addressBook->clear(); @@ -1382,7 +1357,7 @@ void sflphone_kdeView::enableAddressBook() this, SLOT(enableAddressBook())); } -bool sflphone_kdeView::loadAddressBook() +bool SFLPhoneView::loadAddressBook() { qDebug() << "loadAddressBook"; AddressBook * ab = StdAddressBook::self(true); @@ -1399,7 +1374,7 @@ bool sflphone_kdeView::loadAddressBook() } -void sflphone_kdeView::updateAddressBookEnabled() +void SFLPhoneView::updateAddressBookEnabled() { emit addressBookEnableAsked(isAddressBookEnabled()); if(! isAddressBookEnabled() && stackedWidget_screen->currentWidget() == page_addressBook) @@ -1409,14 +1384,14 @@ void sflphone_kdeView::updateAddressBookEnabled() } -bool sflphone_kdeView::isAddressBookEnabled() +bool SFLPhoneView::isAddressBookEnabled() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); MapStringInt addressBookSettings = configurationManager.getAddressbookSettings().value(); return addressBookSettings[ADDRESSBOOK_ENABLE]; } -void sflphone_kdeView::changeScreen(int screen) +void SFLPhoneView::changeScreen(int screen) { switch(screen) { @@ -1436,4 +1411,4 @@ void sflphone_kdeView::changeScreen(int screen) emit screenChanged(screen); } -#include "sflphone_kdeview.moc" +#include "SFLPhoneView.moc" diff --git a/sflphone-client-kde/src/sflphone_kdeview.h b/sflphone-client-kde/src/SFLPhoneView.h similarity index 95% rename from sflphone-client-kde/src/sflphone_kdeview.h rename to sflphone-client-kde/src/SFLPhoneView.h index 9387fbab46df291f94c2047e6cd486fc6ef54936..46260baa1d54398f5f3710a33888f72d40af593e 100644 --- a/sflphone-client-kde/src/sflphone_kdeview.h +++ b/sflphone-client-kde/src/SFLPhoneView.h @@ -19,8 +19,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef sflphone_kdeVIEW_H -#define sflphone_kdeVIEW_H +#ifndef SFLPHONEVIEW_H +#define SFLPHONEVIEW_H #include <QtGui/QWidget> #include <QtCore/QString> @@ -31,35 +31,35 @@ #include <QErrorMessage> #include <KXmlGuiWindow> -#include "ui_sflphone_kdeview_base.h" +#include "ui_SFLPhoneView_base.h" #include "conf/ConfigurationDialog.h" #include "CallList.h" #include "AccountWizard.h" #include "Contact.h" -#include "sflphone_kdeview.h" #include "AccountList.h" -#include "ui_sflphone_kdeview_base.h" - -class ConfigurationDialogKDE; +class ConfigurationDialog; /** * This is the main view class for sflphone-client-kde. Most of the non-menu, * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go * here. + * As the state of the view has effects on the window, + * it emits some signals to ask for changes that the window has + * to treat. * * @short Main view * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> - * @version 0.1 + * @version 0.9.6 */ -class sflphone_kdeView : public QWidget, public Ui::SFLPhone_view +class SFLPhoneView : public QWidget, public Ui::SFLPhone_view { Q_OBJECT private: - static ConfigurationDialogKDE * configDialog; + static ConfigurationDialog * configDialog; static AccountList * accountList; AccountWizard * wizard; //List of calls in the window, and past ones. @@ -88,8 +88,8 @@ public: * expected signals. * @param parent */ - sflphone_kdeView(QWidget *parent); - virtual ~sflphone_kdeView(); + SFLPhoneView(QWidget *parent); + virtual ~SFLPhoneView(); //Getters /** @@ -100,7 +100,7 @@ public: * If there is no account registered, returns NULL. * @return the account to use if an outgoing call is placed. */ - static Account * firstRegisteredAccount(); + static Account * accountInUse(); /** * Seeks the ID of the account to use. * If priorAccountId is defined and the corresponding @@ -109,7 +109,7 @@ public: * If there is no account registered, returns an empty string. * @return the ID of the account to use if an outgoing call is placed. */ - static QString firstRegisteredAccountId(); + static QString accountInUseId(); static AccountList * getAccountList(); QErrorMessage * getErrorWindow(); @@ -128,7 +128,6 @@ public: */ bool isAddressBookEnabled(); - //Updates QVector<Contact *> findContactsInKAddressBook(QString textSearched, bool & full); private slots: @@ -255,7 +254,7 @@ public slots: /** * Loads the address book asynchronously. * Calls enableAddressBook() once the address book - * loading has finished if it is not allready loaded. + * loading has finished if it is not already loaded. * @return true if address book has finished loading */ bool loadAddressBook(); @@ -344,4 +343,4 @@ signals: }; -#endif // sflphone_kdeVIEW_H +#endif // SFLPHONEVIEW_H diff --git a/sflphone-client-kde/src/SortableCodecListWidget.cpp b/sflphone-client-kde/src/SortableCodecListWidget.cpp index 27587446b7b735b6c972b8e07a930009d13fe343..0f21952dfad47f07b577de502711794cb416222f 100644 --- a/sflphone-client-kde/src/SortableCodecListWidget.cpp +++ b/sflphone-client-kde/src/SortableCodecListWidget.cpp @@ -29,10 +29,6 @@ SortableCodecListWidget::SortableCodecListWidget(QWidget *parent) { codecTable = new QTableView(this); codecTable->setObjectName("codecTable"); -// CodecListModel * model = new CodecListModel(); -// codecTable->setModel(model); -// codecTable->resizeColumnsToContents(); -// codecTable->resizeRowsToContents(); codecTable->setSelectionBehavior(QAbstractItemView::SelectRows); codecUpButton = new KPushButton(this); diff --git a/sflphone-client-kde/src/conf/ConfigurationDialog.cpp b/sflphone-client-kde/src/conf/ConfigurationDialog.cpp index f8620c6afce1f006068e3e7df24dbad9132b30bd..32ab9363f275c03ebf446b7b69cd918f8e1016b5 100644 --- a/sflphone-client-kde/src/conf/ConfigurationDialog.cpp +++ b/sflphone-client-kde/src/conf/ConfigurationDialog.cpp @@ -32,7 +32,7 @@ #include "sflphone_const.h" -ConfigurationDialogKDE::ConfigurationDialogKDE(sflphone_kdeView *parent) +ConfigurationDialog::ConfigurationDialog(SFLPhoneView *parent) :KConfigDialog(parent, SETTINGS_NAME, ConfigurationSkeleton::self()) { this->setWindowIcon(QIcon(ICON_SFLPHONE)); @@ -51,72 +51,63 @@ ConfigurationDialogKDE::ConfigurationDialogKDE(sflphone_kdeView *parent) addPage( dlgAudio , i18nc("Config section", "Audio") , "voicecall" ); addPage( dlgAddressBook , i18nc("Config section", "Address Book") , "x-office-address-book" ); addPage( dlgRecord , i18nc("Config section", "Recordings") , "media-record" ); - addPage( dlgHooks , i18nc("Config section", "Hooks") , "insert-link" ); - connect(this, SIGNAL(applyClicked()), dlgAudio, SLOT(updateAlsaSettings())); - connect(this, SIGNAL(okClicked()), dlgAudio, SLOT(updateAlsaSettings())); + addPage( dlgHooks , i18nc("Config section", "Hooks") , "insert-link" ); + connect(this, SIGNAL(applyClicked()), this, SLOT(applyCustomSettings())); connect(this, SIGNAL(okClicked()), this, SLOT(applyCustomSettings())); connect(dlgGeneral, SIGNAL(clearCallHistoryAsked()), this, SIGNAL(clearCallHistoryAsked())); -// connect(this, SIGNAL(settingsChanged(const QString&)), this, SLOT(slot())); -// connect(this, SIGNAL(widgetModified()), this, SLOT(slot())); } -ConfigurationDialogKDE::~ConfigurationDialogKDE() +ConfigurationDialog::~ConfigurationDialog() { } -void ConfigurationDialogKDE::slot() -{ - qDebug() << "slot"; -} - -void ConfigurationDialogKDE::updateWidgets() +void ConfigurationDialog::updateWidgets() { qDebug() << "updateWidgets"; dlgAudio->updateWidgets(); dlgAccounts->updateWidgets(); } -void ConfigurationDialogKDE::updateSettings() +void ConfigurationDialog::updateSettings() { qDebug() << "updateSettings"; dlgAudio->updateSettings(); dlgAccounts->updateSettings(); - qDebug() << "yo " << ConfigurationSkeleton::self()->alsaPlugin(); + qDebug() << "alsaPlugin = " << ConfigurationSkeleton::self()->alsaPlugin(); } -bool ConfigurationDialogKDE::hasChanged() +bool ConfigurationDialog::hasChanged() { qDebug() << "hasChanged" << dlgAudio->hasChanged() << dlgAccounts->hasChanged(); return dlgAudio->hasChanged() || dlgAccounts->hasChanged(); } -void ConfigurationDialogKDE::updateButtons() +void ConfigurationDialog::updateButtons() { qDebug() << "updateButtons"; enableButtonApply( hasChanged() ); } -void ConfigurationDialogKDE::applyCustomSettings() +void ConfigurationDialog::applyCustomSettings() { qDebug() << "applyCustomSettings"; // if(hasChanged()) // { ConfigurationSkeleton::self()->writeConfig(); // } - dlgAccounts->applyCustomSettings(); - dlgAudio->applyCustomSettings(); + updateSettings(); + updateWidgets(); updateButtons(); emit changesApplied(); } -void ConfigurationDialogKDE::reload() +void ConfigurationDialog::reload() { qDebug() << "reload"; ConfigurationSkeleton::self()->readConfig(); updateWidgets(); - applyCustomSettings(); updateButtons(); } diff --git a/sflphone-client-kde/src/conf/ConfigurationDialog.h b/sflphone-client-kde/src/conf/ConfigurationDialog.h index 4c3b1c26b9610f1391fe7d34be6f33423ce9916b..de7a3fa32bebff52e4c514d32e26129dd5aebc87 100644 --- a/sflphone-client-kde/src/conf/ConfigurationDialog.h +++ b/sflphone-client-kde/src/conf/ConfigurationDialog.h @@ -25,7 +25,7 @@ #include "kcfg_settings.h" -#include "sflphone_kdeview.h" +#include "SFLPhoneView.h" #define SETTINGS_NAME "settings" @@ -38,7 +38,7 @@ class DlgAddressBook; class DlgRecord; class DlgHooks; -class sflphone_kdeView; +class SFLPhoneView; /** @author Jérémy Quentin <jeremy.quentin@gmail.com> @@ -51,7 +51,7 @@ class sflphone_kdeView; A few things might be done a cleaner way by passing the handling to the skeleton like it has been done with codecs. */ -class ConfigurationDialogKDE : public KConfigDialog +class ConfigurationDialog : public KConfigDialog { Q_OBJECT private: @@ -66,13 +66,12 @@ private: DlgHooks * dlgHooks; public: - ConfigurationDialogKDE(sflphone_kdeView *parent = 0); + ConfigurationDialog(SFLPhoneView *parent = 0); - ~ConfigurationDialogKDE(); + ~ConfigurationDialog(); public slots: - void slot(); /** * Reimplements KConfigDialog */ diff --git a/sflphone-client-kde/src/conf/ConfigurationSkeleton.cpp b/sflphone-client-kde/src/conf/ConfigurationSkeleton.cpp index e29869eaff2f627cc0ba8244afed2be026911441..1929a6fbd17271b2e10a312d1f0c2a47bbf00590 100644 --- a/sflphone-client-kde/src/conf/ConfigurationSkeleton.cpp +++ b/sflphone-client-kde/src/conf/ConfigurationSkeleton.cpp @@ -176,6 +176,8 @@ void ConfigurationSkeleton::readConfig() setEnableHooksIAX(hooksSettings[HOOKS_IAX2_ENABLED]=="1"); setHooksSIPHeader(hooksSettings[HOOKS_SIP_FIELD]); setHooksCommand(hooksSettings[HOOKS_COMMAND]); + + qDebug() << "Finished to read config\n"; } void ConfigurationSkeleton::writeConfig() @@ -271,7 +273,6 @@ void ConfigurationSkeleton::writeConfig() qDebug() << "Writing Record settings"; QString destination = destinationFolder(); - qDebug() << destination ; configurationManager.setRecordPath(destination); @@ -305,6 +306,8 @@ void ConfigurationSkeleton::writeConfig() hooksSettings[HOOKS_COMMAND] = hooksCommand(); configurationManager.setHookSettings(hooksSettings); + qDebug() << "Finished to write config\n"; + readConfig(); } diff --git a/sflphone-client-kde/src/conf/dlgaccounts.cpp b/sflphone-client-kde/src/conf/dlgaccounts.cpp index 9653ad01b1210ac6bf01e0578ae717c18f89ff39..90e20c1f2482523f94af2339d832f7f3deb38a8b 100644 --- a/sflphone-client-kde/src/conf/dlgaccounts.cpp +++ b/sflphone-client-kde/src/conf/dlgaccounts.cpp @@ -23,7 +23,7 @@ #include <QtGui/QInputDialog> #include "configurationmanager_interface_singleton.h" -#include "sflphone_kdeview.h" +#include "SFLPhoneView.h" #include "sflphone_const.h" #include "conf/ConfigurationDialog.h" @@ -70,11 +70,6 @@ DlgAccounts::DlgAccounts(KConfigDialog *parent) connect(this, SIGNAL(updateButtons()), parent, SLOT(updateButtons())); } - -DlgAccounts::~DlgAccounts() -{ -} - void DlgAccounts::saveAccountList() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -200,14 +195,11 @@ void DlgAccounts::loadAccountList() void DlgAccounts::addAccountToAccountList(Account * account) { - qDebug() << "addAccountToAccountList"; QListWidgetItem * item = account->getItem(); QWidget * widget = account->getItemWidget(); connect(widget, SIGNAL(checkStateChanged(bool)), this, SLOT(changedAccountList())); - qDebug() << "item->isHidden()" << item->isHidden(); listWidget_accountList->addItem(item); - qDebug() << "addAccountToAccountList2"; listWidget_accountList->setItemWidget(item, widget); } @@ -243,7 +235,6 @@ void DlgAccounts::on_button_accountUp_clicked() listWidget_accountList->insertItem(currentRow - 1 , item); listWidget_accountList->setItemWidget(item, widget); listWidget_accountList->setCurrentItem(item); -// changedAccountList(); } void DlgAccounts::on_button_accountDown_clicked() @@ -260,7 +251,6 @@ void DlgAccounts::on_button_accountDown_clicked() listWidget_accountList->insertItem(currentRow + 1 , item); listWidget_accountList->setItemWidget(item, widget); listWidget_accountList->setCurrentItem(item); -// changedAccountList(); } void DlgAccounts::on_button_accountAdd_clicked() @@ -275,7 +265,6 @@ void DlgAccounts::on_button_accountAdd_clicked() listWidget_accountList->setCurrentRow(r); frame2_editAccounts->setEnabled(true); } -// changedAccountList(); } void DlgAccounts::on_button_accountRemove_clicked() @@ -285,25 +274,13 @@ void DlgAccounts::on_button_accountRemove_clicked() QListWidgetItem * item = listWidget_accountList->takeItem(r); accountList->removeAccount(item); listWidget_accountList->setCurrentRow( (r >= listWidget_accountList->count()) ? r-1 : r ); -// changedAccountList(); } void DlgAccounts::on_toolButton_accountsApply_clicked() { qDebug() << "on_toolButton_accountsApply_clicked"; - applyCustomSettings(); -} - -void DlgAccounts::applyCustomSettings() -{ - qDebug() << "DlgAccounts::applyCustomSettings"; - if(hasChanged()) - { - toolButton_accountsApply->setEnabled(false); - saveAccountList(); - loadAccountList(); - accountListHasChanged = false; - } + updateSettings(); + updateWidgets(); } void DlgAccounts::on_edit1_alias_textChanged(const QString & text) @@ -359,11 +336,15 @@ bool DlgAccounts::hasChanged() void DlgAccounts::updateSettings() { - + saveAccountList(); + toolButton_accountsApply->setEnabled(false); + accountListHasChanged = false; } + void DlgAccounts::updateWidgets() { loadAccountList(); + toolButton_accountsApply->setEnabled(false); accountListHasChanged = false; } diff --git a/sflphone-client-kde/src/conf/dlgaccounts.h b/sflphone-client-kde/src/conf/dlgaccounts.h index b2187e11484fc75b4791957234e1a915fbac9523..3b1963b84382e563b34ef196c5c7103475a1e342 100644 --- a/sflphone-client-kde/src/conf/dlgaccounts.h +++ b/sflphone-client-kde/src/conf/dlgaccounts.h @@ -37,7 +37,6 @@ Q_OBJECT public: DlgAccounts(KConfigDialog *parent = 0); - ~DlgAccounts(); void saveAccount(QListWidgetItem * item); void loadAccount(QListWidgetItem * item); @@ -48,7 +47,6 @@ private: public slots: void saveAccountList(); void loadAccountList(); - void applyCustomSettings(); bool hasChanged(); void updateSettings(); diff --git a/sflphone-client-kde/src/conf/dlgaccountsbase.ui b/sflphone-client-kde/src/conf/dlgaccountsbase.ui index 3b15ea53af7cf7a22c129f7cd8e98a48696fa207..431034ca7ba3c906bdee0deb53a9b777366c45f4 100644 --- a/sflphone-client-kde/src/conf/dlgaccountsbase.ui +++ b/sflphone-client-kde/src/conf/dlgaccountsbase.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>603</width> - <height>314</height> + <height>455</height> </rect> </property> <property name="windowTitle"> @@ -231,7 +231,7 @@ <item> <widget class="QFrame" name="frame2_editAccounts"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>1</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -243,9 +243,6 @@ <enum>QFrame::Raised</enum> </property> <layout class="QFormLayout" name="formLayout_2"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> <item row="0" column="0"> <widget class="QLabel" name="label1_alias"> <property name="text"> @@ -368,6 +365,12 @@ </item> <item row="6" column="1"> <widget class="QLabel" name="edit7_state"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string/> </property> @@ -452,11 +455,11 @@ <hints> <hint type="sourcelabel"> <x>71</x> - <y>273</y> + <y>414</y> </hint> <hint type="destinationlabel"> <x>167</x> - <y>278</y> + <y>419</y> </hint> </hints> </connection> diff --git a/sflphone-client-kde/src/conf/dlgaudio.cpp b/sflphone-client-kde/src/conf/dlgaudio.cpp index 8a29233bca28d592ca06d1e65b27886a9e6aa10d..12fd1f033b11b4f64c1ee9de321f81c8f2a4d729 100644 --- a/sflphone-client-kde/src/conf/dlgaudio.cpp +++ b/sflphone-client-kde/src/conf/dlgaudio.cpp @@ -38,33 +38,21 @@ DlgAudio::DlgAudio(KConfigDialog *parent) KUrlRequester_ringtone->lineEdit()->setReadOnly(true); codecTableHasChanged = false; -// toolButton_codecUp->setIcon(KIcon("go-up")); -// toolButton_codecDown->setIcon(KIcon("go-down")); -// tableWidget_codecs->verticalHeader()->hide(); -// tableWidget_codecs->setSelectionBehavior(QAbstractItemView::SelectRows); ConfigurationSkeleton * skeleton = ConfigurationSkeleton::self(); CodecListModel * model = skeleton->getCodecListModel(); sortableCodecList->setModel(model); - updateAlsaSettings(); +// loadAlsaSettings(); connect(box_alsaPlugin, SIGNAL(currentIndexChanged(int)), parent, SLOT(updateButtons())); -// connect(tableWidget_codecs, SIGNAL(itemChanged(QTableWidgetItem *)), -// this, SLOT(codecTableChanged())); -// connect(tableWidget_codecs, SIGNAL(currentCellChanged(int, int, int, int)), -// this, SLOT(updateCodecListCommands())); -// connect(toolButton_codecUp, SIGNAL(clicked()), -// this, SLOT(codecTableChanged())); -// connect(toolButton_codecDown, SIGNAL(clicked()), -// this, SLOT(codecTableChanged())); - + connect(this, SIGNAL(updateButtons()), parent, SLOT(updateButtons())); connect(sortableCodecList, SIGNAL(dataChanged()), this, SLOT(codecTableChanged())); - + } @@ -74,92 +62,10 @@ DlgAudio::~DlgAudio() void DlgAudio::updateWidgets() { -// qDebug() << "DlgAudio::updateWidgets"; - //alsa Plugin ConfigurationSkeleton * skeleton = ConfigurationSkeleton::self(); box_alsaPlugin->setCurrentIndex(box_alsaPlugin->findText(skeleton->alsaPlugin())); + loadAlsaSettings(); - //codecList -// qDebug() << "loadCodecs"; -// ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); -// QStringList codecList = configurationManager.getCodecList(); -// QStringList activeCodecList = skeleton->activeCodecList(); -// -// qDebug() << "loadCodecs1"; -// #if QT_VERSION >= 0x040500 -// qDebug() << "loadCodecs1b"; -// activeCodecList.removeDuplicates(); -// -// qDebug() << "loadCodecs1c"; -// #else -// -// qDebug() << "loadCodecs1d"; -// for (int i = 0 ; i < activeCodecList.size() ; i++) -// { -// if(activeCodecList.lastIndexOf(activeCodecList[i]) != i || ! codecList.contains(activeCodecList[i])) -// { -// activeCodecList.removeAt(i); -// i--; -// } -// } -// -// qDebug() << "loadCodecs1e"; -// #endif -// -// qDebug() << "loadCodecs2"; -// QStringList codecListToDisplay = activeCodecList; -// qDebug() << "loadCodecs2b"; -// codecList.size(); -// -// qDebug() << "loadCodecs2c"; -// for (int i=0 ; i<codecList.size() ; i++) -// { -// -// qDebug() << "loadCodecs3"; -// if(! activeCodecList.contains(codecList[i])) -// { -// -// qDebug() << "loadCodecs4"; -// codecListToDisplay << codecList[i]; -// } -// } -// -// qDebug() << "loadCodecs5"; -// qDebug() << "codecList = " << codecList; -// qDebug() << "activeCodecList" << activeCodecList; -// qDebug() << "codecListToDisplay" << codecListToDisplay; -// tableWidget_codecs->setRowCount(0); -// for(int i=0 ; i<codecListToDisplay.size() ; i++) -// { -// bool ok; -// qDebug() << codecListToDisplay[i]; -// QString payloadStr = QString(codecListToDisplay[i]); -// int payload = payloadStr.toInt(&ok); -// if(!ok) -// qDebug() << "The codec's payload sent by the configurationManager is not a number : " << codecListToDisplay[i]; -// else -// { -// QStringList details = configurationManager.getCodecDetails(payload); -// tableWidget_codecs->insertRow(i); -// tableWidget_codecs->setVerticalHeaderItem (i, new QTableWidgetItem()); -// tableWidget_codecs->verticalHeaderItem (i)->setText(payloadStr); -// tableWidget_codecs->setItem(i,0,new QTableWidgetItem("")); -// tableWidget_codecs->setItem(i,1,new QTableWidgetItem(details[CODEC_NAME])); -// tableWidget_codecs->setItem(i,2,new QTableWidgetItem(details[CODEC_SAMPLE_RATE])); -// tableWidget_codecs->setItem(i,3,new QTableWidgetItem(details[CODEC_BIT_RATE])); -// tableWidget_codecs->setItem(i,4,new QTableWidgetItem(details[CODEC_BANDWIDTH])); -// tableWidget_codecs->item(i,0)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled); -// tableWidget_codecs->item(i,0)->setCheckState(activeCodecList.contains(codecListToDisplay[i]) ? Qt::Checked : Qt::Unchecked); -// tableWidget_codecs->item(i,1)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); -// tableWidget_codecs->item(i,2)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); -// tableWidget_codecs->item(i,3)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); -// tableWidget_codecs->item(i,4)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); -// -// qDebug() << "Added to codecs : " << payloadStr << " , " << details[CODEC_NAME]; -// } -// } -// tableWidget_codecs->resizeColumnsToContents(); -// tableWidget_codecs->resizeRowsToContents(); codecTableHasChanged = false; } @@ -171,23 +77,12 @@ void DlgAudio::updateSettings() ConfigurationSkeleton * skeleton = ConfigurationSkeleton::self(); skeleton->setAlsaPlugin(box_alsaPlugin->currentText()); - //codecList -// QStringList activeCodecs; -// for(int i = 0 ; i < tableWidget_codecs->rowCount() ; i++) -// { -// if(tableWidget_codecs->item(i,0)->checkState() == Qt::Checked) -// { -// activeCodecs << tableWidget_codecs->verticalHeaderItem(i)->text(); -// } -// } -// qDebug() << "Calling setActiveCodecList with list : " << activeCodecs ; -// skeleton->setActiveCodecList(activeCodecs); codecTableHasChanged = false; } bool DlgAudio::hasChanged() { -// qDebug() << "DlgAudio::hasChanged"; + qDebug() << "DlgAudio::hasChanged"; ConfigurationSkeleton * skeleton = ConfigurationSkeleton::self(); qDebug() << "skeleton->alsaPlugin() = " << skeleton->alsaPlugin(); qDebug() << "box_alsaPlugin->currentText() = " << box_alsaPlugin->currentText(); @@ -198,9 +93,9 @@ bool DlgAudio::hasChanged() return alsaPluginHasChanged || codecTableHasChanged; } -void DlgAudio::updateAlsaSettings() +void DlgAudio::loadAlsaSettings() { - qDebug() << "DlgAudio::updateAlsaSettings"; + qDebug() << "DlgAudio::loadAlsaSettings"; ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); if(configurationManager.getAudioManager() == ConfigurationSkeleton::EnumInterface::ALSA) { @@ -226,87 +121,12 @@ void DlgAudio::updateAlsaSettings() } else { -// box_alsaPlugin->clear(); -// kcfg_alsaInputDevice->clear(); -// kcfg_alsaOutputDevice->clear(); groupBox_alsa->setEnabled(false); } } -// void DlgAudio::updateCodecListCommands() -// { -// qDebug() << "updateCodecListCommands"; -// bool buttonsEnabled[2] = {true,true}; -// if(! tableWidget_codecs->currentItem()) -// { -// buttonsEnabled[0] = false; -// buttonsEnabled[1] = false; -// } -// else -// { -// if(tableWidget_codecs->currentRow() == 0) -// { -// buttonsEnabled[0] = false; -// } -// if(tableWidget_codecs->currentRow() == tableWidget_codecs->rowCount() - 1) -// { -// buttonsEnabled[1] = false; -// } -// } -// toolButton_codecUp->setEnabled(buttonsEnabled[0]); -// toolButton_codecDown->setEnabled(buttonsEnabled[1]); -// } - - -// void DlgAudio::on_toolButton_codecUp_clicked() -// { -// qDebug() << "on_toolButton_codecUp_clicked"; -// int currentCol = tableWidget_codecs->currentColumn(); -// int currentRow = tableWidget_codecs->currentRow(); -// int nbCol = tableWidget_codecs->columnCount(); -// for(int i = 0 ; i < nbCol ; i++) -// { -// QTableWidgetItem * item1 = tableWidget_codecs->takeItem(currentRow, i); -// QTableWidgetItem * item2 = tableWidget_codecs->takeItem(currentRow - 1, i); -// tableWidget_codecs->setItem(currentRow - 1, i , item1); -// tableWidget_codecs->setItem(currentRow, i , item2); -// } -// QTableWidgetItem * item1 = tableWidget_codecs->takeVerticalHeaderItem(currentRow); -// QTableWidgetItem * item2 = tableWidget_codecs->takeVerticalHeaderItem(currentRow - 1); -// tableWidget_codecs->setVerticalHeaderItem(currentRow - 1, item1); -// tableWidget_codecs->setVerticalHeaderItem(currentRow, item2); -// tableWidget_codecs->setCurrentCell(currentRow - 1, currentCol); -// } -// -// void DlgAudio::on_toolButton_codecDown_clicked() -// { -// qDebug() << "on_toolButton_codecDown_clicked"; -// int currentCol = tableWidget_codecs->currentColumn(); -// int currentRow = tableWidget_codecs->currentRow(); -// int nbCol = tableWidget_codecs->columnCount(); -// for(int i = 0 ; i < nbCol ; i++) -// { -// QTableWidgetItem * item1 = tableWidget_codecs->takeItem(currentRow, i); -// QTableWidgetItem * item2 = tableWidget_codecs->takeItem(currentRow + 1, i); -// tableWidget_codecs->setItem(currentRow + 1, i , item1); -// tableWidget_codecs->setItem(currentRow, i , item2); -// } -// QTableWidgetItem * item1 = tableWidget_codecs->takeVerticalHeaderItem(currentRow); -// QTableWidgetItem * item2 = tableWidget_codecs->takeVerticalHeaderItem(currentRow + 1); -// tableWidget_codecs->setVerticalHeaderItem(currentRow + 1, item1); -// tableWidget_codecs->setVerticalHeaderItem(currentRow, item2); -// tableWidget_codecs->setCurrentCell(currentRow + 1, currentCol); -// } - - -void DlgAudio::applyCustomSettings() -{ - codecTableHasChanged = false; -} - - void DlgAudio::codecTableChanged() { codecTableHasChanged = true; emit updateButtons(); -} \ No newline at end of file +} diff --git a/sflphone-client-kde/src/conf/dlgaudio.h b/sflphone-client-kde/src/conf/dlgaudio.h index 74fe3db72b88cd2f02fb7eaf9c7a51167b539d09..e33dfd8d2b1fb5597d79afb2b071e72886908fd9 100644 --- a/sflphone-client-kde/src/conf/dlgaudio.h +++ b/sflphone-client-kde/src/conf/dlgaudio.h @@ -45,13 +45,17 @@ public slots: void updateWidgets(); void updateSettings(); bool hasChanged(); - void updateAlsaSettings(); - void applyCustomSettings(); + /** + * Loads the ALSA settings to fill the combo boxes + * of the ALSA settings. + * ALSA choices for input, output... can be load only + * when the daemon has set ALSA as sound manager. + * So we have to load these settings once the user choses + * ALSA. + */ + void loadAlsaSettings(); private slots: -// void updateCodecListCommands(); -// void on_toolButton_codecUp_clicked(); -// void on_toolButton_codecDown_clicked(); void codecTableChanged(); signals: diff --git a/sflphone-client-kde/src/main.cpp b/sflphone-client-kde/src/main.cpp index 2096d1fc7672fa96a02ff3928930e9df773c8b5e..6be5f8995986a16c2f120e4976b92eb5ec93d4a7 100644 --- a/sflphone-client-kde/src/main.cpp +++ b/sflphone-client-kde/src/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char **argv) //configuration dbus registerCommTypes(); - SFLPhone * fenetre = new SFLPhone(); + new SFLPhone(); InstanceInterface & instance = InstanceInterfaceSingleton::getInstance(); instance.Register(getpid(), APP_NAME); diff --git a/sflphone-client-kde/src/ui/sflphone_kdeview_base.ui b/sflphone-client-kde/src/ui/SFLPhoneView_base.ui similarity index 100% rename from sflphone-client-kde/src/ui/sflphone_kdeview_base.ui rename to sflphone-client-kde/src/ui/SFLPhoneView_base.ui