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

removed the qt gui from sflphone

parent 4ca86775
Branches
Tags
No related merge requests found
Showing
with 0 additions and 2720 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.
*/
#include "Account.hpp"
#include "Requester.hpp"
#include "Call.hpp"
Account::Account(const QString &sessionId,
const QString &name)
: mSessionId(sessionId)
, mId(name)
{}
QString
Account::registerAccount() const
{
std::list< QString > args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "register", args);
}
QString
Account::unregisterAccount() const
{
std::list< QString > args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "unregister", args);
}
Call
Account::createCall(const QString &to) const
{
QString callId = Requester::instance().generateCallId();
std::list< QString> args;
args.push_back(mId);
args.push_back(callId);
args.push_back(to);
Requester::instance().send(mSessionId, "call", args);
return Call(mSessionId, mId, callId);
}
/**
* 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 SFLPHONEGUI_ACCOUNT_H
#define SFLPHONEGUI_ACCOUNT_H
#include <qstring.h>
class Call;
class Account {
public:
Account(const QString &sessionId,
const QString &name);
/**
* This will generate a call ready to be used.
*/
QString registerAccount() const;
QString unregisterAccount() const;
QString id() const
{return mId;}
Call createCall(const QString &to) const;
private:
Account();
/**
* This is the session id that we are related to.
*/
QString mSessionId;
/**
* This is the account id that we are related to.
*/
QString mId;
};
#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.
*/
#include <qstring.h>
#include <list>
#include "Account.hpp"
#include "Call.hpp"
#include "CallManager.hpp"
#include "Session.hpp"
#include "Requester.hpp"
Call::Call(const QString &sessionId,
const QString &accountId,
const QString &callId,
bool incomming)
: mSessionId(sessionId)
, mAccountId(accountId)
, mId(callId)
, mIsIncomming(incomming)
{
CallManager::instance().registerCall(*this);
}
Call::Call(const Session &session,
const Account &account,
const QString &callId,
bool incomming)
: mSessionId(session.id())
, mAccountId(account.id())
, mId(callId)
, mIsIncomming(incomming)
{
CallManager::instance().registerCall(*this);
}
bool
Call::isIncomming()
{return mIsIncomming;}
QString
Call::answer()
{
mIsIncomming = false;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "answer", args);
}
QString
Call::hangup()
{
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "hangup", args);
}
QString
Call::cancel()
{
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "cancel", args);
}
QString
Call::hold()
{
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "hold", args);
}
QString
Call::unhold()
{
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "unhold", args);
}
QString
Call::refuse()
{
mIsIncomming = false;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "refuse", args);
}
QString
Call::notAvailable()
{
mIsIncomming = false;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "notavailable", args);
}
QString
Call::sendDtmf(char c)
{
std::list< QString> args;
args.push_back(mId);
QString s;
s += c;
args.push_back(s);
return Requester::instance().send(mSessionId, "senddtmf", args);
}
/**
* 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 SFLPHONEGUI_CALL_H
#define SFLPHONEGUI_CALL_H
#include <qstring.h>
class Session;
class Account;
class Call
{
public:
/**
* A call is automaticaly registered in
* the CallManager. However, a call isn't
* registered when you have a copy constructor.
*/
Call(const QString &sessionId,
const QString &accountId,
const QString &callId,
bool incomming = false);
Call(const Session &session,
const Account &account,
const QString &callId,
bool incomming = false);
/**
* This function returns true if the
* call is waiting to be picked up.
*/
bool isIncomming();
QString id() const
{return mId;}
/**
* This function will answer the call.
*/
QString answer();
/**
* This function will hangup on a call.
*/
QString hangup();
/**
* ///TODO need to clarify this function.
*/
QString cancel();
/**
* This function will put the call on hold.
* This *should* stop temporarly the streaming.
*/
QString hold();
/**
* This function will unhold a holding call.
* This *should* restart a stopped streaming.
*/
QString unhold();
/**
* This function refuse and incomming call.
* It means that the phone is ringing but we
* don't want to answer.
*/
QString refuse();
/**
* This function will set this client to be
* not able to receive the call. It means that
* the phone can still ring. But if every client
* sent notavailable, then it will be refused.
*/
QString notAvailable();
/**
* This function will send a tone to the line.
* This is used if you make a choice when you
* have a voice menu.
*/
QString sendDtmf(char c);
private:
/**
* This is the session id that we belong to.
*/
QString mSessionId;
/**
* This is the account id that we belong to.
*/
QString mAccountId;
/**
* This is the unique identifier of the call.
*/
QString mId;
bool mIsIncomming;
};
#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 __CALL_MANAGER_HPP__
#define __CALL_MANAGER_HPP__
#include "utilspp/Singleton.hpp"
#include "CallManagerImpl.hpp"
typedef utilspp::SingletonHolder< CallManagerImpl > CallManager;
#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.
*/
#include <qobject.h>
#include <stdexcept>
#include "CallManagerImpl.hpp"
#include "DebugOutput.hpp"
void
CallManagerImpl::registerCall(const Call &call)
{
mCallsMutex.lock();
mCalls.insert(std::make_pair(call.id(), call));
mCallsMutex.unlock();
}
void
CallManagerImpl::unregisterCall(const Call &call)
{
unregisterCall(call.id());
}
void
CallManagerImpl::unregisterCall(const QString &id)
{
QMutexLocker guard(&mCallsMutex);
std::map< QString, Call >::iterator pos = mCalls.find(id);
if(pos != mCalls.end()) {
mCalls.erase(pos);
}
}
bool
CallManagerImpl::exist(const QString &id)
{
QMutexLocker guard(&mCallsMutex);
std::map< QString, Call >::iterator pos = mCalls.find(id);
if(pos == mCalls.end()) {
return false;
}
return true;
}
Call
CallManagerImpl::getCall(const QString &id)
{
QMutexLocker guard(&mCallsMutex);
std::map< QString, Call >::iterator pos = mCalls.find(id);
if(pos == mCalls.end()) {
throw std::runtime_error("Trying to retreive an unregistred call\n");
}
return pos->second;
}
/**
* 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 __CALL_MANAGER_IMPL_HPP__
#define __CALL_MANAGER_IMPL_HPP__
#include <qmutex.h>
#include <qstring.h>
#include <map>
#include "Call.hpp"
class CallManagerImpl
{
public:
void registerCall(const Call &call);
void unregisterCall(const Call &call);
void unregisterCall(const QString &id);
/**
* Return true if the call is registered.
*/
bool exist(const QString &id);
/**
* Return the call with the given id. If
* there's no such call it will throw a
* std::runtime_error.
*/
Call getCall(const QString &id);
private:
QMutex mCallsMutex;
std::map< QString, Call > mCalls;
};
#endif
#include "globals.h"
#include "CallStatus.hpp"
#include "PhoneLineManager.hpp"
CallStatus::CallStatus(const QString &code,
const std::list< QString > &args)
: CallRelatedEvent(code, args)
{
std::list< QString > l = getUnusedArgs();
if(l.size() >= 3) {
mAccountId = *l.begin();
l.pop_front();
mDestination = *l.begin();
l.pop_front();
mStatus = *l.begin();
l.pop_front();
setUnusedArgs(l);
}
}
void
CallStatus::execute()
{
QString id = getCallId();
if(id.length() > 0) {
DebugOutput::instance() << QObject::tr("%1 status received for call ID: %2.\n")
.arg(mStatus)
.arg(id);
PhoneLineManager::instance().addCall(mAccountId, getCallId(), mDestination, mStatus);
}
else {
DebugOutput::instance() << QObject::tr("Status invalid: %1\n").arg(toString());
}
}
/**
* 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 __CALLSTATUS_HPP__
#define __CALLSTATUS_HPP__
#include "Event.hpp"
class CallStatus : public CallRelatedEvent
{
public:
CallStatus(const QString &code,
const std::list< QString > &args);
void execute();
protected:
QString mAccountId;
QString mDestination;
QString mStatus;
};
#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 __CALLSTATUSFACTORY_HPP__
#define __CALLSTATUSFACTORY_HPP__
#include "EventFactory.hpp"
typedef utilspp::SingletonHolder< EventFactoryImpl< Event > > CallStatusFactory;
#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_MANAGER_HPP__
#define __CONFIGURATION_MANAGER_HPP__
#include "utilspp/Singleton.hpp"
#include "ConfigurationManagerImpl.hpp"
typedef utilspp::SingletonHolder< ConfigurationManagerImpl > ConfigurationManager;
#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.
*/
#include "ConfigurationManagerImpl.hpp"
#include "DebugOutput.hpp"
void
ConfigurationManagerImpl::setCurrentSpeakerVolume(unsigned int )
{
}
void
ConfigurationManagerImpl::setCurrentMicrophoneVolume(unsigned int )
{
}
void
ConfigurationManagerImpl::add(const ConfigEntry &entry)
{
mEntries[entry.section][entry.name] = entry;
}
void
ConfigurationManagerImpl::add(const AudioDevice &entry)
{
mAudioDevices.push_back(entry);
}
void
ConfigurationManagerImpl::set(const QString &section,
const QString &name,
const QString &value)
{
SectionMap::iterator pos = mEntries.find(section);
if(pos != mEntries.end()) {
VariableMap::iterator vpos = pos->second.find(name);
if(vpos != pos->second.end()) {
vpos->second.value = value;
}
}
}
QString
ConfigurationManagerImpl::get(const QString &section,
const QString &name)
{
QString value;
SectionMap::iterator pos = mEntries.find(section);
if(pos != mEntries.end()) {
VariableMap::iterator vpos = pos->second.find(name);
if(vpos != pos->second.end()) {
value = vpos->second.value;
}
}
return value;
}
void
ConfigurationManagerImpl::save()
{
}
/**
* 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_MANAGER_IMPL_HPP__
#define __CONFIGURATION_MANAGER_IMPL_HPP__
#include <list>
#include <map>
#include <qobject.h>
#include <vector>
struct AudioDevice
{
public:
QString index;
QString description;
};
/**
* This is the representation of a configuration
* entry.
*/
struct ConfigEntry
{
public:
ConfigEntry(){}
ConfigEntry(QString s,
QString n,
QString t,
QString d,
QString v)
{
section = s;
name = n;
type = t;
def = d;
value = v;
}
QString section;
QString name;
QString type;
QString def;
QString value;
};
class ConfigurationManagerImpl : public QObject
{
Q_OBJECT
signals:
void updated();
public:
/**
* This function will set the current speaker volume
* to the given percentage. If it's greater than 100
* it will be set to 100.
*/
void setCurrentSpeakerVolume(unsigned int percentage);
/**
* This function will set the current microphone volume
* to the given percentage. If it's greater than 100
* it will be set to 100.
*/
void setCurrentMicrophoneVolume(unsigned int percentage);
void set(const QString &section,
const QString &name,
const QString &value);
QString get(const QString &section,
const QString &name);
void add(const ConfigEntry &entry);
void add(const AudioDevice &entry);
void clearAudioDevices()
{mAudioDevices.clear();}
std::list< AudioDevice > getAudioDevices()
{return mAudioDevices;}
void complete()
{emit updated();}
void save();
private:
typedef std::map< QString, ConfigEntry > VariableMap;
typedef std::map< QString, VariableMap > SectionMap;
SectionMap mEntries;
std::list< AudioDevice > mAudioDevices;
};
#endif
This diff is collapsed.
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
#include <qdir.h>
#include <qmessagebox.h>
#include <qstringlist.h>
#include "globals.h"
#include "ConfigurationManager.hpp"
#include "DebugOutput.hpp"
#include "QjListBoxPixmap.hpp"
#include "TransparentWidget.hpp"
#define SIGNALISATIONS_IMAGE "signalisations.png"
#define AUDIO_IMAGE "audio.png"
#define PREFERENCES_IMAGE "preferences.png"
#define ABOUT_IMAGE "about.png"
void ConfigurationPanel::init()
{
DebugOutput::instance() << "ConfigurationPanel::init()\n";
Tab_Signalisations->show();
Tab_Audio->hide();
Tab_Preferences->hide();
Tab_About->hide();
/*
// For reading settings at application startup
// List skin choice from "skins" directory
QDir dir(Skin::getPath(QString(SKINDIR)));
if ( !dir.exists() ) {
_debug("\nCannot find 'skins' directory\n");
return;
} else {
dir.setFilter( QDir::Dirs | QDir::NoSymLinks);
dir.setSorting( QDir::Name );
QStringList list;
list = dir.entryList();
for (unsigned int i = 0; i < dir.count(); i++) {
if (list[i] != "." && list[i] != ".." && list[i] != "CVS") {
SkinChoice->insertItem(list[i]);
}
}
}
*/
/*
// List ring choice from "rings" directory
QDir ringdir(Skin::getPath(QString(RINGDIR)));
if ( !ringdir.exists() ) {
_debug ("\nCannot find 'rings' directory\n");
return;
} else {
ringdir.setFilter( QDir::Files | QDir::NoSymLinks);
ringdir.setSorting( QDir::Name );
QStringList ringlist;
ringlist = ringdir.entryList();
for (unsigned int i = 0; i < ringdir.count(); i++) {
if (ringlist[i] != "." && ringlist[i] != ".." && ringlist[i] != "CVS") {
ringsChoice->insertItem(ringlist[i]);
}
}
}
*/
/*
ringsChoice->setCurrentText(QString(manager.getConfigString(AUDIO,
RING_CHOICE)));
*/
/*
// For preferences tab
SkinChoice->setCurrentText(QString(manager.getConfigString(
PREFERENCES, SKIN_CHOICE)));
confirmationToQuit->setChecked(manager.getConfigInt(
PREFERENCES, CONFIRM_QUIT));
zoneToneChoice->setCurrentText(QString(manager.getConfigString(
PREFERENCES, ZONE_TONE)));
checkedTray->setChecked(manager.getConfigInt(
PREFERENCES, CHECKED_TRAY));
voicemailNumber->setText(QString(manager.getConfigString(
PREFERENCES, VOICEMAIL_NUM)));
*/
// Init tab view order
// Set items for QListBox
new QjListBoxPixmap (QjListBoxPixmap::Above,
TransparentWidget::retreive(SIGNALISATIONS_IMAGE),
"Signalisation",
Menu);
new QjListBoxPixmap (QjListBoxPixmap::Above,
TransparentWidget::retreive(AUDIO_IMAGE),
"Audio", Menu );
new QjListBoxPixmap (QjListBoxPixmap::Above,
TransparentWidget::retreive(PREFERENCES_IMAGE),
"Preferences",
Menu);
new QjListBoxPixmap (QjListBoxPixmap::Above,
TransparentWidget::retreive(ABOUT_IMAGE),
"About",
Menu);
}
void
ConfigurationPanel::generate()
{
// For audio tab
codec1->setCurrentText(ConfigurationManager::instance()
.get(AUDIO_SECTION, AUDIO_CODEC1));
codec2->setCurrentText(ConfigurationManager::instance()
.get(AUDIO_SECTION, AUDIO_CODEC2));
codec3->setCurrentText(ConfigurationManager::instance()
.get(AUDIO_SECTION, AUDIO_CODEC3));
int top = 0;
std::list< AudioDevice > audio = ConfigurationManager::instance().getAudioDevices();
std::list< AudioDevice >::iterator pos;
for (pos = audio.begin(); pos != audio.end(); pos++) {
QString name = pos->description;
// New radio button with found device name
QRadioButton* device = new QRadioButton(DriverChoice);
device->setGeometry( QRect( 10, 30 + top, 390, 21 ) );
// Set label of radio button
device->setText(name);
top += 30;
if (ConfigurationManager::instance().get(AUDIO_SECTION,
AUDIO_DEFAULT_DEVICE) == pos->index) {
device->setChecked(true);
}
}
// Set position of the button group, with appropriate length
DriverChoice->setGeometry( QRect( 10, 10, 410, top + 30 ) );
// For signalisations tab
fullName->setText(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_FULL_NAME));
userPart->setText(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_USER_PART));
username->setText(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_AUTH_USER_NAME));
password->setText(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_PASSWORD));
hostPart->setText(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_HOST_PART));
sipproxy->setText(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_PROXY));
autoregister->setChecked(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_AUTO_REGISTER));
playTones->setChecked(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_PLAY_TONES).toUInt());
pulseLength->setValue(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_PULSE_LENGTH).toUInt());
sendDTMFas->setCurrentItem(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_SEND_DTMF_AS).toUInt());
STUNserver->setText(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_STUN_SERVER));
((QRadioButton*)stunButtonGroup->find(ConfigurationManager::instance()
.get(SIGNALISATION_SECTION,
SIGNALISATION_USE_STUN).toUInt()))->setChecked(true);
/*
ringsChoice->setCurrentText(QString(manager.getConfigString(AUDIO,
RING_CHOICE)));
*/
}
// For saving settings at application 'save'
void ConfigurationPanel::saveSlot()
{
ConfigurationManager::instance().set("VoIPLink", "SIP.fullName",
fullName->text());
ConfigurationManager::instance().set("VoIPLink", "SIP.userPart",
userPart->text());
ConfigurationManager::instance().set("VoIPLink", "SIP.username",
username->text());
ConfigurationManager::instance().set("VoIPLink", "SIP.password",
password->text());
ConfigurationManager::instance().set("VoIPLink", "SIP.hostPart",
hostPart->text());
ConfigurationManager::instance().set("VoIPLink", "SIP.proxy",
sipproxy->text());
ConfigurationManager::instance().set("VoIPLink", "SIP.autoregister",
QString::number(autoregister->isChecked()));
ConfigurationManager::instance().set("VoIPLink", "DTMF.pulseLength",
QString::number(pulseLength->value()));
ConfigurationManager::instance().set("VoIPLink", "DTMF.playTones",
QString::number(playTones->isChecked()));
ConfigurationManager::instance().set("VoIPLink", "DTMF.sendDTMFas" ,
QString::number(sendDTMFas->currentItem()));
ConfigurationManager::instance().set("VoIPLink", "STUN.STUNserver",
STUNserver->text());
ConfigurationManager::instance().set("Audio", "Codecs.codec1",
codec1->currentText());
ConfigurationManager::instance().set("Audio", "Codecs.codec2",
codec2->currentText());
ConfigurationManager::instance().set("Audio", "Codecs.codec3",
codec3->currentText());
if (ringsChoice->currentText() != NULL)
ConfigurationManager::instance().set("Audio", "Rings.ringChoice",
ringsChoice->currentText());
ConfigurationManager::instance().set("Preferences", "Themes.skinChoice",
SkinChoice->currentText());
ConfigurationManager::instance().set("Preferences", "Options.zoneToneChoice",
zoneToneChoice->currentText());
ConfigurationManager::instance().set("Preferences", "Options.confirmQuit",
QString::number(confirmationToQuit->isChecked()));
ConfigurationManager::instance().set("Preferences", "Options.checkedTray",
QString::number(checkedTray->isChecked()));
ConfigurationManager::instance().set("Preferences", "Options.voicemailNumber",
voicemailNumber->text());
#if 0
QMessageBox::information(this, "Save settings",
"You must restart SFLPhone",
QMessageBox::Yes);
#endif
ConfigurationManager::instance().save();
}
// Handle tab view according to current item of listbox
void ConfigurationPanel::changeTabSlot()
{
switch (Menu->currentItem()) {
case 0:
TitleTab->setText("Setup signalisation");
Tab_Signalisations->show();
Tab_Audio->hide();
Tab_Preferences->hide();
Tab_About->hide();
break;
case 1:
TitleTab->setText("Setup audio");
Tab_Signalisations->hide();
Tab_Audio->show();
Tab_Preferences->hide();
Tab_About->hide();
break;
case 2:
TitleTab->setText("Setup preferences");
Tab_Signalisations->hide();
Tab_Audio->hide();
Tab_Preferences->show();
Tab_About->hide();
break;
case 3:
TitleTab->setText("About");
Tab_Signalisations->hide();
Tab_Audio->hide();
Tab_Preferences->hide();
Tab_About->show();
break;
}
}
void ConfigurationPanel::useStunSlot(int)
{
//Manager::instance().setConfig("VoIPLink", "STUN.useStun", id);
}
void ConfigurationPanel::applySkinSlot()
{
//Manager::instance().setConfig("Preferences", "Themes.skinChoice",
//string(SkinChoice->currentText().ascii()));
}
void ConfigurationPanel::driverSlot(int)
{
//Manager::instance().setConfig("Audio", "Drivers.driverName", id);
}
/**
* 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.
*/
#include <qbutton.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qsizepolicy.h>
#include "ConfigurationPanelImpl.hpp"
ConfigurationPanelImpl::ConfigurationPanelImpl(QWidget *parent)
: QDialog(parent)
{
mLayout = new QVBoxLayout(this);
}
void
ConfigurationPanelImpl::add(const ConfigEntry &entry)
{
mEntries[entry.section].push_back(entry);
}
void
ConfigurationPanelImpl::generate()
{
std::map< QString, std::list< ConfigEntry > >::iterator pos = mEntries.begin();
while(pos != mEntries.end()) {
QVBoxLayout *l = new QVBoxLayout(this);
std::list< ConfigEntry > entries = pos->second;
std::list< ConfigEntry >::iterator entrypos = entries.begin();
while(entrypos != entries.end()) {
QHBox *hbox = new QHBox(this);
mLayout->addWidget(hbox);
QLabel *label = new QLabel(hbox);
label->setText((*entrypos).name);
QLineEdit *edit = new QLineEdit(hbox);
edit->setText((*entrypos).value);
entrypos++;
}
pos++;
}
QButton *ok = new QButton(this);
ok->setText(QObject::tr("Ok"));
mLayout->addWidget(ok);
show();
}
/**
* 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 <list>
#include <map>
#include <qlayout.h>
#include <qdialog.h>
struct ConfigEntry
{
public:
ConfigEntry(QString s,
QString n,
QString t,
QString d,
QString v)
{
section = s;
name = n;
type = t;
def = d;
value = v;
}
QString section;
QString name;
QString type;
QString def;
QString value;
};
class ConfigurationPanelImpl : public QDialog
{
Q_OBJECT
public:
ConfigurationPanelImpl(QWidget *parent = NULL);
public slots:
void add(const ConfigEntry &entry);
void generate();
private:
std::map< QString, std::list< ConfigEntry > > mEntries;
QVBoxLayout *mLayout;
};
#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 __DEBUGOUTPUT_HPP__
#define __DEBUGOUTPUT_HPP__
#include "utilspp/Singleton.hpp"
#include "DebugOutputImpl.hpp"
typedef utilspp::SingletonHolder< DebugOutputImpl > DebugOutput;
#endif
/*
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jean-Philippe Barrette-LaPierre
* (jean-philippe.barrette-lapierre@savoirfairelinux.com)
*
* This 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,
* or (at your option) any later version.
*
* This 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 dpkg; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "globals.h"
#include <qfile.h>
#include "DebugOutputImpl.hpp"
DebugOutputImpl::DebugOutputImpl()
#ifdef DEBUG
: QTextStream(stdout, IO_WriteOnly)
#else
: QTextStream(&mOutputString, IO_WriteOnly)
#endif
{}
/*
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jean-Philippe Barrette-LaPierre
* (jean-philippe.barrette-lapierre@savoirfairelinux.com)
*
* This 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,
* or (at your option) any later version.
*
* This 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 dpkg; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __DEBUGOUTPUTIMPL_HPP__
#define __DEBUGOUTPUTIMPL_HPP__
#include <qtextstream.h>
class DebugOutputImpl : public QTextStream
{
public:
DebugOutputImpl();
private:
#ifdef DEBUG
QString mOutputString;
#endif
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment