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

First attempt of configuration panel

parent 6826b41b
No related branches found
No related tags found
No related merge requests found
Showing
with 2087 additions and 18 deletions
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __CONFIGURATION_PANEL_HPP__ #ifndef __CONFIGURATION_MANAGER_HPP__
#define __CONFIGURATION_PANEL_HPP__ #define __CONFIGURATION_MANAGER_HPP__
#include "utilspp/Singleton.hpp" #include "utilspp/Singleton.hpp"
#include "ConfigurationPanelImpl.hpp" #include "ConfigurationManagerImpl.hpp"
typedef utilspp::SingletonHolder< ConfigurationPanelImpl > ConfigurationPanel; typedef utilspp::SingletonHolder< ConfigurationManagerImpl > ConfigurationManager;
#endif #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;
}
}
}
/**
* 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);
void add(const ConfigEntry &entry);
void add(const AudioDevice &entry);
void clearAudioDevices()
{mAudioDevices.clear();}
std::list< AudioDevice > getAudioDevices()
{return mAudioDevices;}
void complete()
{emit updated();}
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 "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]);
}
}
}
*/
// Set position of the button group, with appropriate length
//DriverChoice->setGeometry( QRect( 10, 10, 410, top + 30 ) );
//ManagerImpl& manager = Manager::instance();
// For signalisations tab
/*
fullName->setText(QString(manager.getConfigString(
SIGNALISATION , FULL_NAME)));
userPart->setText(QString(manager.getConfigString(SIGNALISATION,
USER_PART)));
username->setText(QString(manager.getConfigString(SIGNALISATION,
AUTH_USER_NAME)));
password->setText(QString(manager.getConfigString(SIGNALISATION, PASSWORD)));
hostPart->setText(QString(manager.getConfigString(SIGNALISATION,
HOST_PART)));
sipproxy->setText(QString(manager.getConfigString(SIGNALISATION, PROXY)));
autoregister->setChecked(manager.getConfigInt(SIGNALISATION,
AUTO_REGISTER));
playTones->setChecked(manager.getConfigInt(SIGNALISATION, PLAY_TONES));
pulseLength->setValue(manager.getConfigInt(SIGNALISATION, PULSE_LENGTH));
sendDTMFas->setCurrentItem(manager.getConfigInt(SIGNALISATION,
SEND_DTMF_AS));
STUNserver->setText(QString(manager.getConfigString(SIGNALISATION,
STUN_SERVER)));
((QRadioButton*)stunButtonGroup->find(manager.getConfigInt(SIGNALISATION,
USE_STUN)))->setChecked(true);
*/
// For audio tab
/*
((QRadioButton*)DriverChoice->find(manager.getConfigInt(AUDIO,
DRIVER_NAME)))->setChecked(true);
codec1->setCurrentText(QString(manager.getConfigString(AUDIO, CODEC1)));
codec2->setCurrentText(QString(manager.getConfigString(AUDIO, CODEC2)));
codec3->setCurrentText(QString(manager.getConfigString(AUDIO, CODEC3)));
*/
/*
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()
{
DebugOutput::instance() << "ConfigurationPanel::generate()\n";
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;
DebugOutput::instance() <<
QObject::tr("ConfigurationPanel::generate(): name: %1\n").arg(name);
// 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);
// Add tooltip for each one
//QToolTip::add(device , name);
top += 30;
//if (ConfigurationManager::instance().(i)) {
// device->setChecked(true);
//}
}
// Set position of the button group, with appropriate length
DriverChoice->setGeometry( QRect( 10, 10, 410, top + 30 ) );
}
// For saving settings at application 'save'
void ConfigurationPanel::saveSlot()
{
/*
manager.setConfig("VoIPLink", "SIP.fullName",
string(fullName->text().ascii()));
manager.setConfig("VoIPLink", "SIP.userPart",
string(userPart->text().ascii()));
manager.setConfig("VoIPLink", "SIP.username",
string(username->text().ascii()));
manager.setConfig("VoIPLink", "SIP.password",
string(password->text().ascii()));
manager.setConfig("VoIPLink", "SIP.hostPart",
string(hostPart->text().ascii()));
manager.setConfig("VoIPLink", "SIP.proxy",
string(sipproxy->text().ascii()));
manager.setConfig("VoIPLink", "SIP.autoregister",
autoregister->isChecked());
manager.setConfig("VoIPLink", "DTMF.pulseLength",
pulseLength->value());
manager.setConfig("VoIPLink", "DTMF.playTones",
playTones->isChecked());
manager.setConfig("VoIPLink", "DTMF.sendDTMFas" ,
sendDTMFas->currentItem());
manager.setConfig("VoIPLink", "STUN.STUNserver",
string(STUNserver->text().ascii()));
manager.setConfig("Audio", "Codecs.codec1",
string(codec1->currentText().ascii()));
manager.setConfig("Audio", "Codecs.codec2",
string(codec2->currentText().ascii()));
manager.setConfig("Audio", "Codecs.codec3",
string(codec3->currentText().ascii()));
if (ringsChoice->currentText() != NULL)
manager.setConfig("Audio", "Rings.ringChoice",
string(ringsChoice->currentText().ascii()));
manager.setConfig("Preferences", "Themes.skinChoice",
string(SkinChoice->currentText().ascii()));
manager.setConfig("Preferences", "Options.zoneToneChoice",
string(zoneToneChoice->currentText().ascii()));
manager.setConfig("Preferences", "Options.confirmQuit",
confirmationToQuit->isChecked());
manager.setConfig("Preferences", "Options.checkedTray",
checkedTray->isChecked());
manager.setConfig("Preferences", "Options.voicemailNumber",
string(voicemailNumber->text().ascii()));
*/
#if 0
QMessageBox::information(this, "Save settings",
"You must restart SFLPhone",
QMessageBox::Yes);
#endif
}
// 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);
}
...@@ -108,6 +108,7 @@ PhoneLineManagerImpl::handleEvents() ...@@ -108,6 +108,7 @@ PhoneLineManagerImpl::handleEvents()
emit globalStatusSet(QString(tr("SFLPhone is ready to serve you, master."))); emit globalStatusSet(QString(tr("SFLPhone is ready to serve you, master.")));
mSession->getEvents(); mSession->getEvents();
mSession->list("audiodevice");
} }
......
/*
Copyright(C)2004 Johan Thelin
johan.thelin -at- digitalfanatics.org
Visit: http://www.digitalfanatics.org/e8johan/projects/jseries/index.html
This file is part of the JSeries.
JSeries 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.
JSeries 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 JSeries; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <qpainter.h>
#include <qstyle.h>
#include "QjListBoxPixmap.hpp"
QjListBoxPixmap::QjListBoxPixmap( PixmapLocation location, const QPixmap &pixmap, const QString &text, QListBox *listbox ) : QListBoxItem( listbox )
{
m_location = location;
m_pixmap = pixmap;
setText( text );
}
QjListBoxPixmap::QjListBoxPixmap( PixmapLocation location, const QPixmap &pixmap, const QString &text, QListBox *listbox, QListBoxItem *after ) : QListBoxItem( listbox, after )
{
m_location = location;
m_pixmap = pixmap;
setText( text );
}
QjListBoxPixmap::PixmapLocation QjListBoxPixmap::location() const
{
return m_location;
}
const QPixmap *QjListBoxPixmap::pixmap() const
{
return &m_pixmap;
}
void QjListBoxPixmap::setPixmap( const QPixmap &pixmap )
{
m_pixmap = pixmap;
listBox()->repaint();
}
int QjListBoxPixmap::height( const QListBox *lb ) const
{
switch( m_location )
{
case Above:
case Under:
return 6 + m_pixmap.height() + lb->fontMetrics().height();
case Left:
case Right:
if( m_pixmap.height() > lb->fontMetrics().height() )
return 4 + m_pixmap.height();
else
return 4 + lb->fontMetrics().height();
default:
return 0;
}
}
int QjListBoxPixmap::width( const QListBox *lb ) const
{
int tw;
switch( m_location )
{
case Above:
case Under:
tw = lb->fontMetrics().width( text() );
if( tw > m_pixmap.width() )
return 4 + tw;
else
return 4 + m_pixmap.width();
case Left:
case Right:
return 6 + m_pixmap.width() + lb->fontMetrics().width( text() );
default:
return 0;
}
}
void QjListBoxPixmap::setLocation( PixmapLocation location )
{
if( m_location == location )
return;
m_location = location;
listBox()->repaint();
}
void QjListBoxPixmap::paint( QPainter *p )
{
if( !( listBox() && listBox()->viewport() == p->device() ) )
return;
QRect r( 0, 0, listBox()->width(), height( listBox() ) );
if( isSelected() )
p->eraseRect( r );
int tw = listBox()->fontMetrics().width( text() );
int th = listBox()->fontMetrics().height();
int pw = m_pixmap.width();
int ph = m_pixmap.height();
int xo = (listBox()->width() - width( listBox() ))/2;
int tyo = listBox()->fontMetrics().ascent();
switch( m_location )
{
case Above:
p->drawText( (listBox()->width()-tw)/2, ph+4+tyo, text() );
p->drawPixmap( (listBox()->width()-pw)/2, 2, m_pixmap );
break;
case Under:
p->drawText( (listBox()->width()-tw)/2, 2+tyo, text() );
p->drawPixmap( (listBox()->width()-pw)/2, 4+th, m_pixmap );
break;
case Left:
p->drawText( xo+2+pw, (height( listBox() )-th)/2+tyo, text() );
p->drawPixmap( xo, (height( listBox() )-ph)/2, m_pixmap );
break;
case Right:
p->drawText( xo, (height( listBox() )-th)/2+tyo, text() );
p->drawPixmap( xo+2+tw, (height( listBox() )-ph)/2, m_pixmap );
break;
}
if( isCurrent() )
listBox()->style().drawPrimitive( QStyle::PE_FocusRect, p, r, listBox()->colorGroup() );
}
/*
Copyright(C)2004 Johan Thelin
johan.thelin -at- digitalfanatics.org
Visit: http://www.digitalfanatics.org/e8johan/projects/jseries/index.html
This file is part of the JSeries.
JSeries 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.
JSeries 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 JSeries; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef QjLISTBOXPIXMAP_H
#define QjLISTBOXPIXMAP_H
#include <qlistbox.h>
#include <qstring.h>
#include <qpixmap.h>
/** \brief The JPixmapItem is a listbox item showing a pixmap and a text. The location of the pixmap in relation to the text can be altered.
*
* \image html jpmi.png
* The location of the pixmap in relation to the text can be altered using the location and setLocation members.
*/
class QjListBoxPixmap : public QListBoxItem
{
public:
/** Specifies the location of the pixmap in relation to the text. */
enum PixmapLocation
{ Above, /**< The pixmap is above the text. */
Under, /**< The pixmap is under the text. */
Left, /**< The pixmap is to the left of the text. */
Right /**< The pixmap is to the right of the text. */
};
/** Creates a JPixmapItem. */
QjListBoxPixmap( PixmapLocation location, const QPixmap &pixmap, const QString &text, QListBox *listbox=0 );
/** Creates a JPixmapItem at a certain position in the listbox. */
QjListBoxPixmap( PixmapLocation location, const QPixmap &pixmap, const QString &text, QListBox *listbox, QListBoxItem *after );
/** Returns the pixmap location in relation to the text. */
PixmapLocation location() const;
/** Sets the pixmap location in relation to the text. This does not generate a re-paint of the listbox. */
void setLocation( PixmapLocation );
/** Returns the pixmap. */
const QPixmap *pixmap() const;
/** Sets the pixmap. This does not generate a re-paint of the listbox. */
void setPixmap( const QPixmap &pixmap );
int height( const QListBox *lb ) const;
int width( const QListBox *lb ) const;
protected:
void paint( QPainter *p );
private:
QPixmap m_pixmap;
PixmapLocation m_location;
};
#endif // QjLISTBOXPIXMAP_H
#include "globals.h" #include "globals.h"
#include "ConfigurationManager.hpp"
#include "PhoneLine.hpp" #include "PhoneLine.hpp"
#include "PhoneLineButton.hpp" #include "PhoneLineButton.hpp"
#include "Requester.hpp" #include "Requester.hpp"
...@@ -22,6 +23,8 @@ SFLPhoneApp::SFLPhoneApp(int argc, char **argv) ...@@ -22,6 +23,8 @@ SFLPhoneApp::SFLPhoneApp(int argc, char **argv)
Requester::instance().registerObject< Request >(QString("playtone")); Requester::instance().registerObject< Request >(QString("playtone"));
Requester::instance().registerObject< Request >(QString("stoptone")); Requester::instance().registerObject< Request >(QString("stoptone"));
Requester::instance().registerObject< Request >(QString("playdtmf")); Requester::instance().registerObject< Request >(QString("playdtmf"));
Requester::instance().registerObject< ListRequest >(QString("list"));
Requester::instance().registerObject< CallRequest >(QString("call")); Requester::instance().registerObject< CallRequest >(QString("call"));
Requester::instance().registerObject< ConfigGetAllRequest >(QString("configgetall")); Requester::instance().registerObject< ConfigGetAllRequest >(QString("configgetall"));
Requester::instance().registerObject< EventRequest >(QString("getevents")); Requester::instance().registerObject< EventRequest >(QString("getevents"));
...@@ -112,6 +115,9 @@ SFLPhoneApp::initConnections(SFLPhoneWindow *w) ...@@ -112,6 +115,9 @@ SFLPhoneApp::initConnections(SFLPhoneWindow *w)
QObject::connect(w, SIGNAL(resendStatusAsked()), QObject::connect(w, SIGNAL(resendStatusAsked()),
&PhoneLineManager::instance(), SIGNAL(readyToSendStatus())); &PhoneLineManager::instance(), SIGNAL(readyToSendStatus()));
QObject::connect(&ConfigurationManager::instance(), SIGNAL(updated()),
w, SLOT(showSetup()));
} }
...@@ -51,6 +51,7 @@ SFLPhoneWindow::SFLPhoneWindow() ...@@ -51,6 +51,7 @@ SFLPhoneWindow::SFLPhoneWindow()
Qt::WStyle_NoBorder) Qt::WStyle_NoBorder)
#endif #endif
{ {
mSetupPanel = new ConfigurationPanel(this, "ConfigurationPanel");
// Initialize the background image // Initialize the background image
mMain = new QLabel(this); mMain = new QLabel(this);
QPixmap main(JPushButton::transparize(BACKGROUND_IMAGE)); QPixmap main(JPushButton::transparize(BACKGROUND_IMAGE));
...@@ -196,6 +197,13 @@ SFLPhoneWindow::askReconnect() ...@@ -196,6 +197,13 @@ SFLPhoneWindow::askReconnect()
} }
} }
void
SFLPhoneWindow::showSetup()
{
mSetupPanel->generate();
mSetupPanel->show();
}
void void
SFLPhoneWindow::askResendStatus(QString message) SFLPhoneWindow::askResendStatus(QString message)
{ {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <qpoint.h> #include <qpoint.h>
#include <list> #include <list>
#include "ConfigurationPanel.h"
class JPushButton; class JPushButton;
class PhoneLineButton; class PhoneLineButton;
class SFLLcd; class SFLLcd;
...@@ -48,6 +50,8 @@ signals: ...@@ -48,6 +50,8 @@ signals:
*/ */
void askResendStatus(QString); void askResendStatus(QString);
void showSetup();
protected: protected:
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);
...@@ -71,4 +75,6 @@ private: ...@@ -71,4 +75,6 @@ private:
QLabel *mMain; QLabel *mMain;
QPoint mLastPos; QPoint mLastPos;
ConfigurationPanel *mSetupPanel;
}; };
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "CallManager.hpp" #include "CallManager.hpp"
#include "CallStatus.hpp" #include "CallStatus.hpp"
#include "CallStatusFactory.hpp" #include "CallStatusFactory.hpp"
#include "ConfigurationPanel.hpp" #include "ConfigurationManager.hpp"
#include "PhoneLine.hpp" #include "PhoneLine.hpp"
#include "PhoneLineLocker.hpp" #include "PhoneLineLocker.hpp"
#include "PhoneLineManager.hpp" #include "PhoneLineManager.hpp"
...@@ -315,7 +315,7 @@ ConfigGetAllRequest::onEntry(const QString &code, const QString &message) ...@@ -315,7 +315,7 @@ ConfigGetAllRequest::onEntry(const QString &code, const QString &message)
def = *args.begin(); def = *args.begin();
args.pop_front(); args.pop_front();
val = *args.begin(); val = *args.begin();
ConfigurationPanel::instance().add(ConfigEntry(section, variable, type, def, val)); ConfigurationManager::instance().add(ConfigEntry(section, variable, type, def, val));
} }
} }
...@@ -325,5 +325,46 @@ ConfigGetAllRequest::onSuccess(const QString &code, const QString &message) ...@@ -325,5 +325,46 @@ ConfigGetAllRequest::onSuccess(const QString &code, const QString &message)
DebugOutput::instance() << QObject::tr("ConfigGetAllRequest success: (%1) %1\n") DebugOutput::instance() << QObject::tr("ConfigGetAllRequest success: (%1) %1\n")
.arg(code) .arg(code)
.arg(message); .arg(message);
ConfigurationPanel::instance().generate(); ConfigurationManager::instance().complete();
}
ListRequest::ListRequest(const QString &sequenceId,
const QString &command,
const std::list< QString > &args)
: Request(sequenceId, command, args)
{}
void
ListRequest::onError(const QString &code, const QString &message)
{
DebugOutput::instance() << QObject::tr("ListRequest error: (%1) %1\n")
.arg(code)
.arg(message);
}
void
ListRequest::onEntry(const QString &code, const QString &message)
{
DebugOutput::instance() << QObject::tr("ListRequest entry: (%1) %1\n")
.arg(code)
.arg(message);
std::list< QString > args = Request::parseArgs(message);
if(args.size() >= 2) {
AudioDevice device;
device.index = *args.begin();
args.pop_front();
device.description = *args.begin();
args.pop_front();
ConfigurationManager::instance().add(device);
}
}
void
ListRequest::onSuccess(const QString &code, const QString &message)
{
DebugOutput::instance() << QObject::tr("ListRequest success: (%1) %1\n")
.arg(code)
.arg(message);
} }
...@@ -201,4 +201,21 @@ public: ...@@ -201,4 +201,21 @@ public:
virtual void onSuccess(const QString &code, const QString &message); virtual void onSuccess(const QString &code, const QString &message);
}; };
class ListRequest : public Request
{
public:
ListRequest(const QString &sequenceId,
const QString &command,
const std::list< QString > &args);
virtual ~ListRequest(){}
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 #endif
...@@ -118,6 +118,14 @@ Session::playDtmf(char c) const ...@@ -118,6 +118,14 @@ Session::playDtmf(char c) const
return Requester::instance().send(mId, "playdtmf", args); return Requester::instance().send(mId, "playdtmf", args);
} }
QString
Session::list(const QString &category) const
{
std::list< QString > args;
args.push_back(category);
return Requester::instance().send(mId, "list", args);
}
Account Account
Session::getAccount(const QString &name) const Session::getAccount(const QString &name) const
{ {
......
...@@ -44,6 +44,12 @@ class Session ...@@ -44,6 +44,12 @@ class Session
*/ */
QString playDtmf(char c) const; QString playDtmf(char c) const;
/**
* This function will retreive the given list.
*/
QString list(const QString &category) const;
/** /**
* This function will register to receive events * This function will register to receive events
*/ */
......
...@@ -9,9 +9,11 @@ TARGET += ...@@ -9,9 +9,11 @@ TARGET +=
# This line is for qt4: # This line is for qt4:
# INCLUDEPATH += /usr/lib/qt4/include/Qt/ # INCLUDEPATH += /usr/lib/qt4/include/Qt/
QT += network qt3support QT += network qt3support
#CONFIG += debug CONFIG += debug
DEFINES += QT_THREAD_SUPPORT DEFINES += QT_THREAD_SUPPORT
FORMS = ConfigurationPanel.ui
IMAGES += \ IMAGES += \
images/about.png \ images/about.png \
images/audio.png \ images/audio.png \
...@@ -105,8 +107,8 @@ HEADERS += Account.hpp \ ...@@ -105,8 +107,8 @@ HEADERS += Account.hpp \
Call.hpp \ Call.hpp \
CallStatus.hpp \ CallStatus.hpp \
CallStatusFactory.hpp \ CallStatusFactory.hpp \
ConfigurationPanel.hpp \ ConfigurationManager.hpp \
ConfigurationPanelImpl.hpp \ ConfigurationManagerImpl.hpp \
DebugOutput.hpp \ DebugOutput.hpp \
DebugOutputImpl.hpp \ DebugOutputImpl.hpp \
Event.hpp \ Event.hpp \
...@@ -121,9 +123,10 @@ HEADERS += Account.hpp \ ...@@ -121,9 +123,10 @@ HEADERS += Account.hpp \
PhoneLineLocker.hpp \ PhoneLineLocker.hpp \
PhoneLineManager.hpp \ PhoneLineManager.hpp \
PhoneLineManagerImpl.hpp \ PhoneLineManagerImpl.hpp \
QjListBoxPixmap.hpp \
Request.hpp \ Request.hpp \
Requester.hpp \ Requester.hpp \
RequesterImpl.hpp \ RequesterImpl.hpp RequesterImpl.inl \
Session.hpp \ Session.hpp \
SessionIO.hpp \ SessionIO.hpp \
SessionIOFactory.hpp \ SessionIOFactory.hpp \
...@@ -135,15 +138,12 @@ HEADERS += Account.hpp \ ...@@ -135,15 +138,12 @@ HEADERS += Account.hpp \
TCPSessionIO.hpp \ TCPSessionIO.hpp \
TCPSessionIOCreator.hpp \ TCPSessionIOCreator.hpp \
TransparentWidget.hpp \ TransparentWidget.hpp \
VolumeControl.hpp \ VolumeControl.hpp
ObjectFactory.inl \
RequesterImpl.inl \
ObjectPool.inl
SOURCES += Account.cpp \ SOURCES += Account.cpp \
Call.cpp \ Call.cpp \
CallManagerImpl.cpp \ CallManagerImpl.cpp \
CallStatus.cpp \ CallStatus.cpp \
ConfigurationPanelImpl.cpp \ ConfigurationManagerImpl.cpp \
DebugOutputImpl.cpp \ DebugOutputImpl.cpp \
Event.cpp \ Event.cpp \
JPushButton.cpp \ JPushButton.cpp \
...@@ -152,6 +152,7 @@ SOURCES += Account.cpp \ ...@@ -152,6 +152,7 @@ SOURCES += Account.cpp \
PhoneLineButton.cpp \ PhoneLineButton.cpp \
PhoneLineLocker.cpp \ PhoneLineLocker.cpp \
PhoneLineManagerImpl.cpp \ PhoneLineManagerImpl.cpp \
QjListBoxPixmap.cpp \
Request.cpp \ Request.cpp \
RequesterImpl.cpp \ RequesterImpl.cpp \
Session.cpp \ Session.cpp \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment