From a8da2c6ec06974997eeb533d988b550423b3157c Mon Sep 17 00:00:00 2001 From: jpbl <jpbl> Date: Fri, 14 Oct 2005 18:46:36 +0000 Subject: [PATCH] config panel --- src/gui/official/ConfigurationPanel.hpp | 29 ++++++++++++ src/gui/official/ConfigurationPanelImpl.hpp | 42 ++++++++++++++++++ src/gui/official/PhoneLine.cpp | 1 - src/gui/official/PhoneLineManagerImpl.cpp | 10 ++++- src/gui/official/PhoneLineManagerImpl.hpp | 2 + src/gui/official/SFLPhoneApp.cpp | 3 ++ src/gui/official/SFLPhoneWindow.cpp | 9 +++- src/gui/official/SFLPhoneWindow.hpp | 1 + src/gui/official/SFLRequest.cpp | 49 +++++++++++++++++++++ src/gui/official/SFLRequest.hpp | 15 +++++++ src/gui/official/Session.cpp | 6 +++ src/gui/official/Session.hpp | 2 + src/gui/official/TransparentWidget.cpp | 1 - src/gui/official/sflphone.pro | 3 ++ 14 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 src/gui/official/ConfigurationPanel.hpp create mode 100644 src/gui/official/ConfigurationPanelImpl.hpp diff --git a/src/gui/official/ConfigurationPanel.hpp b/src/gui/official/ConfigurationPanel.hpp new file mode 100644 index 0000000000..911a71215b --- /dev/null +++ b/src/gui/official/ConfigurationPanel.hpp @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2004-2005 Savoir-Faire Linux inc. + * Author : Jean-Philippe Barrette-LaPierre + * <jean-philippe.barrette-lapierre@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 + * (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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CONFIGURATION_PANEL_HPP__ +#define __CONFIGURATION_PANEL_HPP__ + +#include "utilspp/Singleton.hpp" +#include "ConfigurationPanelImpl.hpp" + +typedef utilspp::SingletonHolder< ConfigurationPanelImpl > ConfigurationPanel; + +#endif diff --git a/src/gui/official/ConfigurationPanelImpl.hpp b/src/gui/official/ConfigurationPanelImpl.hpp new file mode 100644 index 0000000000..ea6ab975e7 --- /dev/null +++ b/src/gui/official/ConfigurationPanelImpl.hpp @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2004-2005 Savoir-Faire Linux inc. + * Author: Jean-Philippe Barrette-LaPierre + * <jean-philippe.barrette-lapierre@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 + * (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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CONFIGURATION_PANEL_IMPL_HPP__ +#define __CONFIGURATION_PANEL_IMPL_HPP__ + +#include <qlayout.h> +#include <qdialog.h> + +class ConfigurationPanelImpl : public QDialog +{ + Q_OBJECT + +public: + ConfigurationPanelImpl(QWidget *parent = NULL); + +public slots: + void add(QString section, QString name, QString type, QString def, QString value); + +private: + QVBoxLayout *mLayout; +}; + + +#endif diff --git a/src/gui/official/PhoneLine.cpp b/src/gui/official/PhoneLine.cpp index 088f025d71..83bc43c83f 100644 --- a/src/gui/official/PhoneLine.cpp +++ b/src/gui/official/PhoneLine.cpp @@ -171,7 +171,6 @@ PhoneLine::incomming(const Call &call) } else { mCall = new Call(call); - setLineStatus("Incomming..."); emit backgrounded(); } } diff --git a/src/gui/official/PhoneLineManagerImpl.cpp b/src/gui/official/PhoneLineManagerImpl.cpp index bdbe2b8834..ea41a3f989 100644 --- a/src/gui/official/PhoneLineManagerImpl.cpp +++ b/src/gui/official/PhoneLineManagerImpl.cpp @@ -449,6 +449,14 @@ PhoneLineManagerImpl::mute() mSession->mute(); } +void +PhoneLineManagerImpl::setup() +{ + isInitialized(); + + mSession->configGetAll(); +} + void PhoneLineManagerImpl::unmute() { @@ -523,7 +531,7 @@ PhoneLineManagerImpl::addCall(Call call, if(selectedLine) { selectedLine->incomming(call); selectedLine->setPeer(peer); - selectedLine->setState(state); + selectedLine->setLineStatus(state); } else { DebugOutput::instance() << QObject::tr("PhoneLineManager: There's no available lines" diff --git a/src/gui/official/PhoneLineManagerImpl.hpp b/src/gui/official/PhoneLineManagerImpl.hpp index 9cbd9b8944..efdf39cf5d 100644 --- a/src/gui/official/PhoneLineManagerImpl.hpp +++ b/src/gui/official/PhoneLineManagerImpl.hpp @@ -113,6 +113,8 @@ public slots: */ void unmute(); + void setup(); + /** * This function will hanp up the line number given * argument. Be aware that the first line is 1, not diff --git a/src/gui/official/SFLPhoneApp.cpp b/src/gui/official/SFLPhoneApp.cpp index 281cdcc7a9..657df3b18f 100644 --- a/src/gui/official/SFLPhoneApp.cpp +++ b/src/gui/official/SFLPhoneApp.cpp @@ -23,6 +23,7 @@ SFLPhoneApp::SFLPhoneApp(int argc, char **argv) Requester::instance().registerObject< Request >(QString("stoptone")); Requester::instance().registerObject< Request >(QString("playdtmf")); Requester::instance().registerObject< CallRequest >(QString("call")); + Requester::instance().registerObject< ConfigGetAllRequest >(QString("configgetall")); Requester::instance().registerObject< EventRequest >(QString("getevents")); Requester::instance().registerObject< CallStatusRequest >(QString("getcallstatus")); Requester::instance().registerObject< PermanentRequest >(QString("answer")); @@ -63,6 +64,8 @@ SFLPhoneApp::initConnections(SFLPhoneWindow *w) &PhoneLineManager::instance(), SLOT(call())); QObject::connect(w->mMute, SIGNAL(clicked(bool)), &PhoneLineManager::instance(), SLOT(mute(bool))); + QObject::connect(w->mSetup, SIGNAL(clicked()), + &PhoneLineManager::instance(), SLOT(setup())); QObject::connect(w->mHangup, SIGNAL(clicked()), &PhoneLineManager::instance(), SLOT(hangup())); QObject::connect(w->mHold, SIGNAL(clicked()), diff --git a/src/gui/official/SFLPhoneWindow.cpp b/src/gui/official/SFLPhoneWindow.cpp index 49efd30cfc..90e73d477b 100644 --- a/src/gui/official/SFLPhoneWindow.cpp +++ b/src/gui/official/SFLPhoneWindow.cpp @@ -37,7 +37,8 @@ #define CLOSE_PRESSED_IMAGE "close_on.png" #define MINIMIZE_RELEASED_IMAGE "minimize_off.png" #define MINIMIZE_PRESSED_IMAGE "minimize_on.png" - +#define SETUP_RELEASED_IMAGE "setup_off.png" +#define SETUP_PRESSED_IMAGE "setup_on.png" SFLPhoneWindow::SFLPhoneWindow() @@ -116,6 +117,12 @@ SFLPhoneWindow::initGUIButtons() mMute->move(225,94); mMute->setToggle(true); + mSetup = new JPushButton(QString(SETUP_RELEASED_IMAGE), + QString(SETUP_PRESSED_IMAGE), + mMain); + //mSetup->move(225,42); + mSetup->move(318,68); + mVolume = new VolumeControl(QString(VOLUME_IMAGE), mMain); mVolume->setOrientation(VolumeControl::Vertical); diff --git a/src/gui/official/SFLPhoneWindow.hpp b/src/gui/official/SFLPhoneWindow.hpp index 0165399a89..6c2b02e7f1 100644 --- a/src/gui/official/SFLPhoneWindow.hpp +++ b/src/gui/official/SFLPhoneWindow.hpp @@ -62,6 +62,7 @@ private: JPushButton *mOk; JPushButton *mClear; JPushButton *mMute; + JPushButton *mSetup; VolumeControl *mVolume; VolumeControl *mMicVolume; diff --git a/src/gui/official/SFLRequest.cpp b/src/gui/official/SFLRequest.cpp index f90c4b5d6b..989d11659c 100644 --- a/src/gui/official/SFLRequest.cpp +++ b/src/gui/official/SFLRequest.cpp @@ -8,6 +8,7 @@ #include "CallManager.hpp" #include "CallStatus.hpp" #include "CallStatusFactory.hpp" +#include "ConfigurationPanel.hpp" #include "PhoneLine.hpp" #include "PhoneLineLocker.hpp" #include "PhoneLineManager.hpp" @@ -278,3 +279,51 @@ CallRequest::onSuccess(Account, DebugOutput::instance() << QObject::tr("CallRequest: Trying to retreive an unregistred call (%1)\n").arg(mCallId); } } + + + +ConfigGetAllRequest::ConfigGetAllRequest(const QString &sequenceId, + const QString &command, + const std::list< QString > &args) + : Request(sequenceId, command, args) +{} + + +void +ConfigGetAllRequest::onError(const QString &code, const QString &message) +{ + DebugOutput::instance() << QObject::tr("ConfigGetAllRequest error: (%1) %1\n") + .arg(code) + .arg(message); +} + +void +ConfigGetAllRequest::onEntry(const QString &code, const QString &message) +{ + DebugOutput::instance() << QObject::tr("ConfigGetAllRequest entry: (%1) %1\n") + .arg(code) + .arg(message); + std::list< QString > args = Request::parseArgs(message); + if(args.size() >= 5) { + QString section, variable, type, def, val; + section = *args.begin(); + args.pop_front(); + variable = *args.begin(); + args.pop_front(); + type = *args.begin(); + args.pop_front(); + def = *args.begin(); + args.pop_front(); + val = *args.begin(); + ConfigurationPanel::instance().add(section, variable, type, def, val); + } +} + +void +ConfigGetAllRequest::onSuccess(const QString &code, const QString &message) +{ + DebugOutput::instance() << QObject::tr("ConfigGetAllRequest success: (%1) %1\n") + .arg(code) + .arg(message); + ConfigurationPanel::instance().show(); +} diff --git a/src/gui/official/SFLRequest.hpp b/src/gui/official/SFLRequest.hpp index 3d7ff71eda..ffe291306e 100644 --- a/src/gui/official/SFLRequest.hpp +++ b/src/gui/official/SFLRequest.hpp @@ -185,5 +185,20 @@ class TemporaryRequest : public CallRelatedRequest const QString &message); }; +class ConfigGetAllRequest : public Request +{ +public: + ConfigGetAllRequest(const QString &sequenceId, + const QString &command, + const std::list< QString > &args); + + + virtual ~ConfigGetAllRequest(){} + + + virtual void onError(const QString &code, const QString &message); + virtual void onEntry(const QString &code, const QString &message); + virtual void onSuccess(const QString &code, const QString &message); +}; #endif diff --git a/src/gui/official/Session.cpp b/src/gui/official/Session.cpp index 815baea42d..b875fbcffd 100644 --- a/src/gui/official/Session.cpp +++ b/src/gui/official/Session.cpp @@ -68,6 +68,12 @@ Session::getEvents() const return Requester::instance().send(mId, "getevents", std::list< QString >()); } +QString +Session::configGetAll() const +{ + return Requester::instance().send(mId, "configgetall", std::list< QString >()); +} + QString Session::mute() const { diff --git a/src/gui/official/Session.hpp b/src/gui/official/Session.hpp index 7062f03bf9..30483f6d57 100644 --- a/src/gui/official/Session.hpp +++ b/src/gui/official/Session.hpp @@ -59,6 +59,8 @@ class Session */ QString mute() const; + QString configGetAll() const; + /** * This function will set the volume to * the given percentage diff --git a/src/gui/official/TransparentWidget.cpp b/src/gui/official/TransparentWidget.cpp index e6cb011098..5107f46ca8 100644 --- a/src/gui/official/TransparentWidget.cpp +++ b/src/gui/official/TransparentWidget.cpp @@ -103,7 +103,6 @@ TransparentWidget::transparize(const QString &image) QBitmap bm; if (img.hasAlphaBuffer()) { - DebugOutput::instance() << QObject::tr("Image has alpha buffer (%1)\n").arg(image); bm = img.createAlphaMask(); } else { diff --git a/src/gui/official/sflphone.pro b/src/gui/official/sflphone.pro index fa78c870d0..ea2db1cf38 100644 --- a/src/gui/official/sflphone.pro +++ b/src/gui/official/sflphone.pro @@ -104,6 +104,8 @@ HEADERS += Account.hpp \ Call.hpp \ CallStatus.hpp \ CallStatusFactory.hpp \ + ConfigurationPanel.hpp \ + ConfigurationPanelImpl.hpp \ DebugOutput.hpp \ DebugOutputImpl.hpp \ Event.hpp \ @@ -140,6 +142,7 @@ SOURCES += Account.cpp \ Call.cpp \ CallManagerImpl.cpp \ CallStatus.cpp \ + ConfigurationPanelImpl.cpp \ DebugOutputImpl.cpp \ Event.cpp \ JPushButton.cpp \ -- GitLab