Skip to content
Snippets Groups Projects
Commit a8da2c6e authored by jpbl's avatar jpbl
Browse files

config panel

parent 16431004
No related branches found
No related tags found
No related merge requests found
Showing with 169 additions and 4 deletions
/**
* 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
/**
* 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
......@@ -171,7 +171,6 @@ PhoneLine::incomming(const Call &call)
}
else {
mCall = new Call(call);
setLineStatus("Incomming...");
emit backgrounded();
}
}
......
......@@ -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"
......
......@@ -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
......
......@@ -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()),
......
......@@ -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);
......
......@@ -62,6 +62,7 @@ private:
JPushButton *mOk;
JPushButton *mClear;
JPushButton *mMute;
JPushButton *mSetup;
VolumeControl *mVolume;
VolumeControl *mMicVolume;
......
......@@ -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();
}
......@@ -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
......@@ -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
{
......
......@@ -59,6 +59,8 @@ class Session
*/
QString mute() const;
QString configGetAll() const;
/**
* This function will set the volume to
* the given percentage
......
......@@ -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 {
......
......@@ -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 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment