diff --git a/src/gui/official/Account.cpp b/src/gui/official/Account.cpp deleted file mode 100644 index 944e5adaecd62d747f4e97a68877261fd870eb6d..0000000000000000000000000000000000000000 --- a/src/gui/official/Account.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - * 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); -} - - diff --git a/src/gui/official/Account.hpp b/src/gui/official/Account.hpp deleted file mode 100644 index 250dfa973cb8d9904339b1851efaa651b371bdef..0000000000000000000000000000000000000000 --- a/src/gui/official/Account.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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 diff --git a/src/gui/official/Call.cpp b/src/gui/official/Call.cpp deleted file mode 100644 index aea0609799c778b6735a2d701c325a7efc25b758..0000000000000000000000000000000000000000 --- a/src/gui/official/Call.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/** - * 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); -} - diff --git a/src/gui/official/Call.hpp b/src/gui/official/Call.hpp deleted file mode 100644 index aef0332febd73925de39583583ee8d7dd86fb5f4..0000000000000000000000000000000000000000 --- a/src/gui/official/Call.hpp +++ /dev/null @@ -1,125 +0,0 @@ -/** - * 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 diff --git a/src/gui/official/CallManager.hpp b/src/gui/official/CallManager.hpp deleted file mode 100644 index 8eff2b2f687d4bbb45e5501d1db259ea672c77df..0000000000000000000000000000000000000000 --- a/src/gui/official/CallManager.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 - diff --git a/src/gui/official/CallManagerImpl.cpp b/src/gui/official/CallManagerImpl.cpp deleted file mode 100644 index 45241fec8f7b37380330ed660dd4a9829f3381e2..0000000000000000000000000000000000000000 --- a/src/gui/official/CallManagerImpl.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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; -} diff --git a/src/gui/official/CallManagerImpl.hpp b/src/gui/official/CallManagerImpl.hpp deleted file mode 100644 index d6e7aec7e2c43ed7486c50772ac6b5b35f2a6b9e..0000000000000000000000000000000000000000 --- a/src/gui/official/CallManagerImpl.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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 diff --git a/src/gui/official/CallStatus.cpp b/src/gui/official/CallStatus.cpp deleted file mode 100644 index 7df7b23b2470f63fb15f2915d25190b5be5a54c3..0000000000000000000000000000000000000000 --- a/src/gui/official/CallStatus.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#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()); - } -} - diff --git a/src/gui/official/CallStatus.hpp b/src/gui/official/CallStatus.hpp deleted file mode 100644 index 3b648d0ead6e49bc53958117432ecd53eadb46b6..0000000000000000000000000000000000000000 --- a/src/gui/official/CallStatus.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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 - diff --git a/src/gui/official/CallStatusFactory.hpp b/src/gui/official/CallStatusFactory.hpp deleted file mode 100644 index 83e467b6ecdf5a12dc7c093289634d15f2b414c2..0000000000000000000000000000000000000000 --- a/src/gui/official/CallStatusFactory.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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 - diff --git a/src/gui/official/ConfigurationManager.hpp b/src/gui/official/ConfigurationManager.hpp deleted file mode 100644 index 1cc5abe819413f886dba4e1b8fce09d1e81d8fa4..0000000000000000000000000000000000000000 --- a/src/gui/official/ConfigurationManager.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 - diff --git a/src/gui/official/ConfigurationManagerImpl.cpp b/src/gui/official/ConfigurationManagerImpl.cpp deleted file mode 100644 index 8ac9af004391daf2179c0b1904be40ea6e6b71ae..0000000000000000000000000000000000000000 --- a/src/gui/official/ConfigurationManagerImpl.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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 §ion, - 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 §ion, - 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() -{ -} diff --git a/src/gui/official/ConfigurationManagerImpl.hpp b/src/gui/official/ConfigurationManagerImpl.hpp deleted file mode 100644 index 9b396905e5962b2ed44e0d5093726c7e96ee65b9..0000000000000000000000000000000000000000 --- a/src/gui/official/ConfigurationManagerImpl.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/** - * 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 §ion, - const QString &name, - const QString &value); - - QString get(const QString §ion, - 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 diff --git a/src/gui/official/ConfigurationPanel.ui b/src/gui/official/ConfigurationPanel.ui deleted file mode 100644 index 8d895a222fde39f118f09d7264bf235f3db0124f..0000000000000000000000000000000000000000 --- a/src/gui/official/ConfigurationPanel.ui +++ /dev/null @@ -1,1310 +0,0 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>ConfigurationPanel</class> -<widget class="QDialog"> - <property name="name"> - <cstring>ConfigurationPanel</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>561</width> - <height>546</height> - </rect> - </property> - <property name="caption"> - <string>Configuration panel</string> - </property> - <property name="sizeGripEnabled"> - <bool>true</bool> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout19</cstring> - </property> - <property name="geometry"> - <rect> - <x>11</x> - <y>501</y> - <width>543</width> - <height>36</height> - </rect> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="Line"> - <property name="name"> - <cstring>line1</cstring> - </property> - <property name="frameShape"> - <enum>HLine</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout28</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonHelp</cstring> - </property> - <property name="text"> - <string>&Help</string> - </property> - <property name="accel"> - <string>F1</string> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>Horizontal Spacing2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>160</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonSave</cstring> - </property> - <property name="text"> - <string>&Save</string> - </property> - <property name="accel"> - <string>Alt+S</string> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - <property name="default"> - <bool>true</bool> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonOk</cstring> - </property> - <property name="text"> - <string>&OK</string> - </property> - <property name="accel"> - <string>Alt+O</string> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonCancel</cstring> - </property> - <property name="text"> - <string>&Cancel</string> - </property> - <property name="accel"> - <string>F, Backspace</string> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - </widget> - </hbox> - </widget> - </vbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout17</cstring> - </property> - <property name="geometry"> - <rect> - <x>117</x> - <y>11</y> - <width>437</width> - <height>484</height> - </rect> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>TitleTab</cstring> - </property> - <property name="font"> - <font> - <bold>1</bold> - </font> - </property> - <property name="text"> - <string>Setup signalisation</string> - </property> - </widget> - <widget class="Line"> - <property name="name"> - <cstring>line2</cstring> - </property> - <property name="frameShape"> - <enum>HLine</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - </widget> - <widget class="QTabWidget"> - <property name="name"> - <cstring>Tab_Signalisations</cstring> - </property> - <widget class="QWidget"> - <property name="name"> - <cstring>SIPPage</cstring> - </property> - <attribute name="title"> - <string>SIP Authentication</string> - </attribute> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout24</cstring> - </property> - <property name="geometry"> - <rect> - <x>16</x> - <y>12</y> - <width>401</width> - <height>393</height> - </rect> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QGroupBox"> - <property name="name"> - <cstring>groupBox1</cstring> - </property> - <property name="title"> - <string></string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel" row="0" column="0"> - <property name="name"> - <cstring>textLabel2</cstring> - </property> - <property name="text"> - <string>Full name</string> - </property> - </widget> - <widget class="QLineEdit" row="1" column="0"> - <property name="name"> - <cstring>fullName</cstring> - </property> - </widget> - <widget class="QLineEdit" row="3" column="0"> - <property name="name"> - <cstring>userPart</cstring> - </property> - </widget> - <widget class="QLabel" row="2" column="0"> - <property name="name"> - <cstring>textLabel3</cstring> - </property> - <property name="text"> - <string>User Part of SIP URL</string> - </property> - </widget> - <widget class="QLabel" row="4" column="0"> - <property name="name"> - <cstring>textLabel2_3</cstring> - </property> - <property name="text"> - <string>Authorization user</string> - </property> - </widget> - <widget class="QLineEdit" row="5" column="0"> - <property name="name"> - <cstring>username</cstring> - </property> - </widget> - <widget class="QLineEdit" row="9" column="0"> - <property name="name"> - <cstring>hostPart</cstring> - </property> - </widget> - <widget class="QLineEdit" row="11" column="0"> - <property name="name"> - <cstring>sipproxy</cstring> - </property> - </widget> - <widget class="QLabel" row="10" column="0"> - <property name="name"> - <cstring>textLabel3_2_2</cstring> - </property> - <property name="text"> - <string>SIP proxy</string> - </property> - </widget> - <widget class="QLineEdit" row="7" column="0"> - <property name="name"> - <cstring>password</cstring> - </property> - <property name="echoMode"> - <enum>Password</enum> - </property> - </widget> - <widget class="QLabel" row="6" column="0"> - <property name="name"> - <cstring>textLabel1_3</cstring> - </property> - <property name="text"> - <string>Password</string> - </property> - </widget> - <widget class="QLabel" row="8" column="0"> - <property name="name"> - <cstring>textLabel3_2</cstring> - </property> - <property name="text"> - <string>Host part of SIP URL</string> - </property> - </widget> - </grid> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout23</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout19</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QCheckBox"> - <property name="name"> - <cstring>autoregister</cstring> - </property> - <property name="text"> - <string>Auto-register</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer7</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>201</width> - <height>21</height> - </size> - </property> - </spacer> - <widget class="QPushButton"> - <property name="name"> - <cstring>Register</cstring> - </property> - <property name="text"> - <string>Register</string> - </property> - </widget> - </hbox> - </widget> - <spacer> - <property name="name"> - <cstring>spacer9</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>21</height> - </size> - </property> - </spacer> - </vbox> - </widget> - </vbox> - </widget> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>STUNPage</cstring> - </property> - <attribute name="title"> - <string>STUN</string> - </attribute> - <widget class="QGroupBox"> - <property name="name"> - <cstring>groupBox3</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>110</y> - <width>253</width> - <height>100</height> - </rect> - </property> - <property name="title"> - <string>Settings </string> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1_5</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>38</y> - <width>229</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>STUN server (address:port)</string> - </property> - </widget> - <widget class="QLineEdit"> - <property name="name"> - <cstring>STUNserver</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>229</width> - <height>23</height> - </rect> - </property> - </widget> - </widget> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>stunButtonGroup</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>90</width> - <height>81</height> - </rect> - </property> - <property name="title"> - <string>Use STUN</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QRadioButton"> - <property name="name"> - <cstring>useStunNo</cstring> - </property> - <property name="text"> - <string>No</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>useStunYes</cstring> - </property> - <property name="text"> - <string>Yes</string> - </property> - <property name="checked"> - <bool>false</bool> - </property> - </widget> - </vbox> - </widget> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>DTMFPage</cstring> - </property> - <attribute name="title"> - <string>DTMF</string> - </attribute> - <widget class="QGroupBox"> - <property name="name"> - <cstring>SettingsDTMF</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>301</width> - <height>130</height> - </rect> - </property> - <property name="title"> - <string>Settings</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget" row="0" column="0"> - <property name="name"> - <cstring>layout11</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout10</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QCheckBox"> - <property name="name"> - <cstring>playTones</cstring> - </property> - <property name="text"> - <string>Play tones locally</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer6</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>111</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout7</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>labelPulseLength</cstring> - </property> - <property name="text"> - <string>Pulse length</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer3</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>115</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QSpinBox"> - <property name="name"> - <cstring>pulseLength</cstring> - </property> - <property name="suffix"> - <string> ms</string> - </property> - <property name="maxValue"> - <number>1500</number> - </property> - <property name="minValue"> - <number>10</number> - </property> - <property name="value"> - <number>250</number> - </property> - </widget> - </hbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout8</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>labelSendDTMF</cstring> - </property> - <property name="text"> - <string>Send DTMF as</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer4</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>85</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QComboBox"> - <item> - <property name="text"> - <string>SIP INFO</string> - </property> - </item> - <property name="name"> - <cstring>sendDTMFas</cstring> - </property> - <property name="currentItem"> - <number>0</number> - </property> - </widget> - </hbox> - </widget> - </vbox> - </widget> - </grid> - </widget> - </widget> - </widget> - <widget class="QTabWidget"> - <property name="name"> - <cstring>Tab_Audio</cstring> - </property> - <widget class="QWidget"> - <property name="name"> - <cstring>DriversPage</cstring> - </property> - <attribute name="title"> - <string>Drivers</string> - </attribute> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>DriverChoice</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>410</width> - <height>180</height> - </rect> - </property> - <property name="title"> - <string>Drivers list</string> - </property> - </widget> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>CodecsPage</cstring> - </property> - <attribute name="title"> - <string>Codecs</string> - </attribute> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>CodecsChoice</cstring> - </property> - <property name="geometry"> - <rect> - <x>20</x> - <y>10</y> - <width>133</width> - <height>157</height> - </rect> - </property> - <property name="title"> - <string>Supported codecs</string> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout18</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>110</width> - <height>120</height> - </rect> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget" row="0" column="0"> - <property name="name"> - <cstring>layout17</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QComboBox"> - <item> - <property name="text"> - <string>G711u</string> - </property> - </item> - <item> - <property name="text"> - <string>G711a</string> - </property> - </item> - <item> - <property name="text"> - <string>GSM</string> - </property> - </item> - <property name="name"> - <cstring>codec1</cstring> - </property> - </widget> - <widget class="QComboBox"> - <item> - <property name="text"> - <string>G711a</string> - </property> - </item> - <item> - <property name="text"> - <string>G711u</string> - </property> - </item> - <item> - <property name="text"> - <string>GSM</string> - </property> - </item> - <property name="name"> - <cstring>codec2</cstring> - </property> - </widget> - <widget class="QComboBox"> - <item> - <property name="text"> - <string>G711u</string> - </property> - </item> - <item> - <property name="text"> - <string>G711a</string> - </property> - </item> - <item> - <property name="text"> - <string>GSM</string> - </property> - </item> - <property name="name"> - <cstring>codec3</cstring> - </property> - </widget> - </vbox> - </widget> - <widget class="QLayoutWidget" row="0" column="1"> - <property name="name"> - <cstring>layout18</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1_4</cstring> - </property> - <property name="text"> - <string>1</string> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1_4_2</cstring> - </property> - <property name="text"> - <string>2</string> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1_4_3</cstring> - </property> - <property name="text"> - <string>3</string> - </property> - </widget> - </vbox> - </widget> - </grid> - </widget> - </widget> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>RingPage</cstring> - </property> - <attribute name="title"> - <string>Ringtones</string> - </attribute> - <widget class="QComboBox"> - <property name="name"> - <cstring>ringsChoice</cstring> - </property> - <property name="geometry"> - <rect> - <x>20</x> - <y>21</y> - <width>150</width> - <height>30</height> - </rect> - </property> - </widget> - </widget> - </widget> - <widget class="QTabWidget"> - <property name="name"> - <cstring>Tab_Preferences</cstring> - </property> - <widget class="QWidget"> - <property name="name"> - <cstring>DriversPage</cstring> - </property> - <attribute name="title"> - <string>Themes</string> - </attribute> - <widget class="QComboBox"> - <property name="name"> - <cstring>SkinChoice</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="geometry"> - <rect> - <x>12</x> - <y>42</y> - <width>110</width> - <height>27</height> - </rect> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonApplySkin</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="geometry"> - <rect> - <x>136</x> - <y>40</y> - <width>80</width> - <height>32</height> - </rect> - </property> - <property name="text"> - <string>&Apply</string> - </property> - <property name="accel"> - <string>Alt+A</string> - </property> - </widget> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>TabPage</cstring> - </property> - <attribute name="title"> - <string>Options</string> - </attribute> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout17</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>262</width> - <height>200</height> - </rect> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout16</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>labelToneZone</cstring> - </property> - <property name="text"> - <string>Zone tone:</string> - </property> - </widget> - <widget class="QComboBox"> - <item> - <property name="text"> - <string>North America</string> - </property> - </item> - <item> - <property name="text"> - <string>France</string> - </property> - </item> - <item> - <property name="text"> - <string>Australia</string> - </property> - </item> - <item> - <property name="text"> - <string>United Kingdom</string> - </property> - </item> - <item> - <property name="text"> - <string>Spain</string> - </property> - </item> - <item> - <property name="text"> - <string>Italy</string> - </property> - </item> - <item> - <property name="text"> - <string>Japan</string> - </property> - </item> - <property name="name"> - <cstring>zoneToneChoice</cstring> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer5</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>31</width> - <height>21</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>confirmationToQuit</cstring> - </property> - <property name="text"> - <string>Show confirmation to quit.</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>checkedTray</cstring> - </property> - <property name="text"> - <string>Minimize to tray</string> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout16</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1_6</cstring> - </property> - <property name="text"> - <string>Voicemail:</string> - </property> - </widget> - <widget class="QLineEdit"> - <property name="name"> - <cstring>voicemailNumber</cstring> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer6_2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>61</width> - <height>21</height> - </size> - </property> - </spacer> - </hbox> - </widget> - </vbox> - </widget> - </widget> - </widget> - <widget class="QTabWidget"> - <property name="name"> - <cstring>Tab_About</cstring> - </property> - <widget class="QWidget"> - <property name="name"> - <cstring>DriversPage</cstring> - </property> - <attribute name="title"> - <string>About SFLPhone</string> - </attribute> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel2_2</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>170</y> - <width>435</width> - <height>121</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>4</hsizetype> - <vsizetype>4</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string><p align="center"> -Copyright (C) 2004-2005 Savoir-faire Linux inc.<br><br> -Jean-Philippe Barrette-LaPierre &lt;jean-philippe.barrette-lapierre@savoirfairelinux.com&gt;<br> -Laurielle LEA &lt;laurielle.lea@savoirfairelinux.com&gt;<br> -Yan Morin &lt;yan.morin@savoirfairelinux.com&gt;<br> -J&eacute;rome Oufella &lt;jerome.oufella@savoirfairelinux.com&gt;<br><br> -SFLPhone-0.5 is released under <br>the General Public License.<br> -For more information, see http://www.sflphone.org<br> -</p></string> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>pixmapLabel1</cstring> - </property> - <property name="geometry"> - <rect> - <x>50</x> - <y>40</y> - <width>312</width> - <height>91</height> - </rect> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - <property name="scaledContents"> - <bool>true</bool> - </property> - </widget> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>CodecsPage</cstring> - </property> - <attribute name="title"> - <string>About Savoir-faire Linux inc.</string> - </attribute> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1</cstring> - </property> - <property name="geometry"> - <rect> - <x>85</x> - <y>126</y> - <width>291</width> - <height>131</height> - </rect> - </property> - <property name="text"> - <string><p align="center">Website: http://www.savoirfairelinux.com<br><br> -5505, Saint-Laurent - bureau 3030<br> -Montreal, Quebec H2T 1S6</p></string> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>pixmapLabel2</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>50</y> - <width>173</width> - <height>48</height> - </rect> - </property> - <property name="pixmap"> - <pixmap>image1</pixmap> - </property> - <property name="scaledContents"> - <bool>true</bool> - </property> - </widget> - </widget> - </widget> - </vbox> - </widget> - <widget class="QListBox"> - <property name="name"> - <cstring>Menu</cstring> - </property> - <property name="geometry"> - <rect> - <x>11</x> - <y>11</y> - <width>100</width> - <height>484</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>7</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="cursor"> - <cursor>13</cursor> - </property> - <property name="currentItem"> - <number>-1</number> - </property> - <property name="selectionMode"> - <enum>Single</enum> - </property> - </widget> -</widget> -<images> - <image name="image0"> - <data format="XPM.GZ" length="58862">789ced5d596fe3b8b27e9f5f114cbd0d0eea6475625cdc878eb3b4b34ca72799e9745f9c07c74b76c776363b07e7bfdf629194488ad49249e4f40151109292488a923e7dac85a2fff9dbc2e9d1e1c26ffffce5fea1f370d95de85e74260bbff51e6f6f67fff7affffdf72fbfae2c2d2f34971696165717967ffdc72fbfe21f0bdd05682c37d61a52ffcc7a87f40eebbb4a6f2a7d47e93da57f17fafa4aa3b7be2274e8487d7d49eab8a4f43575fc96f533d2cf58df547a53e953a5f794fe22f48d95f5de866caf2df58d25a9c34ce96beaf8b9d4cf96cf56f9f890f5333a2edb1b2bbd29757c547a4f1d1f495dd7c78b44efb13e507a43e9db426fae6ef49af27c7da93797943e50fa9ad4f145ea49fd65a577947ea8f5ee1ad7df557a5f1e872dadcbe3f8c47a97daefb2fea0f4a6d2ef95de53faa5d4757de849bdbbacf496d03babcd5e47f6ff52ea9d25a583d2d7a48e7da927f59f125d5ecf27a537947ec47a97eacbfe4c94de51fab1d2fb528767a927f5af94de913a74b5de93e7df577a5f955f14fad96aa7af9ee758eac9f36d28bda1f0b22775dd1e9e28bdaff403a9f79695bece7a2f799e23a5ebe7f9ac74f5fc7045eaba3e7c4af43e1f5f557a43eac0f8eaae25cffb4eeafa7ee354e90da5f7a4aeebe3b5d23baa3d7e3fba3d7d3fe14ee9ea7ee250e9eafec195d4757dfc5debfd06eb6b4aefabf62fb42e8fc367a9f79795ceef5b6f2db99f33a927f7734fe90da57f937a52ff20d1657fba4a6fa8fefc99e8f238bf2fd43b7d3f51e9fa7a6e95aefa8f9b52d7f5e14ce91dd5de86d0fb0d7d7df855eaba7fd854baea0fec285dd587b6d607f2f8b5d2fbaafd2f5a57c7f97dee27fdc153a5ebf6264ad7f5ffd2baac8f37521f2c2bfd4ce90da5ff10fa20391fee4b3d29df52ba2edf49f4019fff46e91da533df0c06fa3882d2d5f1af0f4a1f683d4a94fa24622e4add123117a56e89988b52b744cc45a95b22e6a2d42d117351ea9688b928754bc45c94ba25622e4add123117a56e89988b52b744cc45a95b22e6a2d42d7f177308d821399bf77544f979e4b598c32ef6b08f033cc70bb55de2155ee3cdbcafe8e30bdee210ef7084639ce03d3ee0233ed1df09e9cf38c519decebb87ef2bd53147ac768d2f8cb601612dfbf7136ecefbaa3ea2600bb70855dbb883bbf8b960dbc5366171847bb83fef7ebfbd54c51c1e58dc16da0e3f0eeef81df91dbfbc4bdbfb848b23622d282cf99570f4c7abb6e379dfc1b7962a98c31b1a3ffddce6fb7b52aac53f091107344a5ff2d87c42e8f8eb2daf0fbf25fd7973d4e1293392e0a5eff8a3a0ec6221b785b6a5b7eef7bca53ce6e8e915f39bbd2de7f916c43f57c17a2b7ebb903c966f6447ae166c6b29be08cdbaddde5bdf3b6c187c342a28bbe4e1b0255c278edcc0267e05c42d00e8f8b80ef0ad7b3e5f298b39465c96cb06849b2b42c8359ce1267433c797b1e36d0d88db2e0ab8f2c41db108a56539f602bfa9f324fbe1cd31077d838f724740ea4786bf60e02b07e7597b0fcedfbae7f3957298f372dc00d7ac327f911597e5ac818fb108a7699915dc14c8c40e9cc105f48cba874ead9ea7fdd0c67da3676df8d56f7defc8df4cb928b7751a855deeea602b507694e1bac5b7eef97ca50ce6f08b974baecd32c47321cec93c0db2e0521f37c38364e3ad32838ae3dfac73749df69709bb3d204e931bc915fd774dffabbec14d5e3ffeae900f9a72513ee6006e1d9edb0a9786a1c373776fddf3f94a29cc2dfbb8c4ba4b6730cae19c15abb52fc9fee073a267744163ab331a1242cd7657a13016581fcf6151d99151760727b9656fd9fa53e561f8d6fd9eb714638ec63eafdd649559ceb7afe0dadb5ec5f8b1652f96b2ce98e7743fde97e7c685a587e42734b3f13698900771ef29dfa211f9166790d766618c46956bc2234ee9fca76f7d0f5e234598a3912ec45f3725caa80d9e8c7bfca4f62f57ed2b3c57e5ac6a3c87fb70477e64533c49dcc7198ef101a6f81d66788477d9676ff1dc1fd2d2a7e7fa0c973084195c12b70523bad4b3676a7da6f90c3a30a61acd40e91f7847e567844260940e71421ecc928e1e877009f7e40bbfa49c293816c80dae7ae7df568a30079fcac4df380b96ef4b265137b6d5c4fe4f55fb6ad87307256b54b0e70861a94fd9f1c6ca1c5bdee439e6ba4e12af4bda8147efb9a6b0e9cf3f402bcb4584c5cf057ddbf58dd6701eb80eb204ca32e47b4821cf0d82fc3548fb4dcfd66bf319db956a2fe144c8b1a2037d49ec39b82859a302cf116b14e604888b8c676bf35cb0ceb6739e0d62a6dc3a84310311706ff154f83cb6853d8171ee39a64551ecf7937ccc4149eee2d859418e425bfc894ffa37ecb9b29833edb97c8cc343b9bc00f99f498cc3e539ff465c6322085d2ef46e064e7156a65fcca98955483ed8b0b04e7b5e5c5780b96e0e772dbb1126f20ef2b84e656089add27c43a5ab4eed3928392e97e7395f3e1436c9f619e13d8f50e9fe84e9caf11c6d897f41c8dec91cff4ee36cb64edab359e9dc6ce2e11253da1cb8497bc66401dad7f72131c7fe68c817ddf194ff421e4288eb5655995563ff7295b900863d57d287b0ecb9c3dc92599e3347d16d63ffae1e95b23c0703c2e83159edf6fe84b518a5d639a4f5c6734edaceb199aa93e1397811ef029dcbe52e957f33f2c09f79144d7c06f2904d3bf27b282efdbe92873908fba397e18c395c046cc0849bac5cc33969d7e5f2ef567ceeba548dd7f39ce32fc038cb412ecfe9d82db6c0e226d00c3fb4b8a7a351a5fbca2832b849ed77788ed84af11379d98e1da86a3c18fb3fdb769b7d9daead598fe4610ebf0438ab2036a66c3bb75e12d123241c7a8ef7b1879b79715e279fbb92df0bae61c6e772633336cfd93618f779cb3caef6d93c67645c9969b2e56d2ef5cc0ae051362dc3fce4f09cc54d60e571a1aff6764c4ecc9c636a5c67e6681d928bb96e96af60b7242765e78c185164c2c20a86e6e1898cd6375f9b467c4ee57269cf09b1a42d9be96c1693e7f27d0887e71a9eb34f8de3724434796ed78ec5391cc8c74c5b0ebc36059c5b9cc628b679ce9e1940bd36cb735c86fc629b17ad5929ecc398c7e71025ce1d5bcf325c5421a606570e9739f32838bf15f6750fb3a36726df1afeab50f76a7bce1335b5388547c5bc3c04581c28222c840593af02790b93a3a41de8f09c937b25de73cb8f1c3b8fd80cef69ef049f4c8e53dbccdf8ff7945c9edb7478a56214173edbf5bde7001ac1d788ad2e3dbce7ccb374f2ad79db4dd27aba2f17738e9de3cb45ad1bfcf0cc7bcc7925ce1be5d85a6453c1a3c55781f94966ec0ea6bcc7b6e79cecabe5f34a9e9b94f673c5f6fc1628aa26b93cd7b6b8a354ae8afcd6d574ae0878edb990e00d95bfb238cb9a7f97999f774863ab98a3796d6e84f4c4267c9d3d07de397f8c22cd5b6ced59f69c930720567379cea8af6d35cf3dc8f4c3e1b90da757e30ccfdd67b82c67f3e749de577279cef65bd3b9b7c44df464fd3697f4493fe9a33c37d3f15bf385ce7a62d88f8615e6d873d725be427815cff96d2df23a537e38e23da6cde662ceb60f7f64e6c505ec28b8346d446ec9e63907ab561f183fe4d796e5b85d7a6be610a32b88cfa5398313b56713b59de68d3d305e64fcaec7333121c9af96f0339356560dae4bfc34d39e2b9789b0ecb9f27eab27f2e8f014fb9c16cfb9b195877c9e0bcd37b7da6cf31e8be7dc6cbe555ef2dc83cd6564cd1d1147cf5c216fe263c68493f9bc623612f9142f066f9c786b98b9089e73492894ba971773ceece42fac7c6bc95cadc573b963bbc34b9ef920786c1c67abaa22cfd97c159887697d3721f754e4393cb2ec46af9d305f29c0dcb5b68792586f9abff4320d5c383ee441e29b56fad69ff854b7b39ab49dda732539d3b2e7cef3de6b87973c2c0426dfb0556571cc716e7b82e79a165f79470998581cb5ce67a9ca730dab8dc2797df54b01e63a094f64e36dde6f02c907f5fb92157d5e6c2575137e34f2adaf9957720139b90bc76fcde484a83fd9785b259e7338cc6bd1d9795299d7a8cc73b7561b7e0b08e6397bb370fedc5e300ee6650d62466f79a8b8a289f18d57ea8526f65cd9d62c7bee22ef8b5b273eb7eb8eae3831b84667a52ad9733cea99e7c85eb39527d57da8ca734e1ee2366b27e0a2884e136fcf213627a4107367c118981f7327deb2b93ea3b79d6b6d131afbd2f85cc9595036cfe5f1a39b6fd579247517d0e21a9d4bafca734de71c1607e186fd0dace6daaa3ca7a2d7693b632b5b36219426b6dec7cbf1ababfa1488f5fba3584f5e4eec5a2d7e29c20c8d6487b23e18350d7baee437f98e3d27da7bc26bfe4aec0c76f026b5313df34a1e93f9235bc416296725b9d86af61cd77062678487a9980bcf2b99d8f3eabeeb79ead5790ef7ed6f64a9f777c4a12d7a73d6ad3cc72eeebd359eca4809cc75d03f4fe44f4fd91b1f278215eb861ecab973413f965a39d4fc68bda3697cae24e65c9ef36df024d8cfbf9e08bc40dfcab38a2dc9c556e539f12e79e7cae5e607aaf31cc7654a9c43e639ea9752df1afee9e52e8f756ac5d5923cab3d57c498537268e62cd4d18ecafecbfa16b68cf85ce9b547f025688f5a9c5d7a9ef0d8988d6bd671fc43e215b3debeb17fa9c479ccb97b95798ef717ae8f42e89fd3ecf492dff11f7839c2f10369b4cae44c61e4ceedc41bd8b2ca5c72066b8dc6bc7dec9bf1347b44b66276a5a39999b928be6d10e2b90cefb5cc33e3c4389659338e9ea93e66dd01f12d56ee7976ecd89df33d843b37fbd8386665897196c7a9e4417cd0ef218c2b58f172841127232bed30cb21bed9c41cc53bcce59e174260c6e6c3dfd5f10a1e49609d15fbef75a9ef2176325fd3fc20ab4b1e6b7bce7cac8e7dcfe6f3f1ab9527357dd5a32c16f029e1a6ec9a08a9afbbebe662bf8a6fd9be67cf43e79e8b1da7a5c2ba4c2b7e8e202611ab21f9befbbac89b794e185dc1cb6c7be4b3acf96b243c7a55e50af10b5c65e6d8a5f24d62db89cf6d8ad506f116ce0939c46770e7fff29438eb0e4710f2e167b01d5ef781fcd4291e93bdb8091db21bc70070e79bcfc2e74142cfc8df07f2b7ee704cfdf0f7615f7c718b47d4fe0c0506a7f3febab5e2fa73df8cfc6be15ff2154a45d1e89e7dc12e1c10a20af334342e1f54cba1951587e7d6dfe31c51a4545b67932cfcb273d856e77d65d5c4b1e7fecb57f49daf545f4f18ce3cebcc59f3e4b057cc581f4d2c9efb3ecfafdcfffbe575eba613dfadaa58b1c96dcb7812b2c53eba58f3e7e6f265cacf254994fb156b6cffbddf87c01659619bbcc666096bec230b790c29cfcdbd37957b7f1b9a1bf54ee79b605bcc3026ff7b884fc15253ff4c82f83b385ae025b1e77e8a95cac9537dd4cf148f0803019ff75dcedda7bbb52efa407f3d7122eed30f98fa675245cc6949e69ded64e35c1f51a08f6d9d8703a0ff6bf47b08ed7c6e62b2761073b774ccfbf646cca5c22b03ce7e8e5f01c12631db4b92d53f224ea9317b8adb74be06af36360dadb543e3ee4be4b9aa8220a2baf82c249d394c96df3eaf8ad8247c9a6b81006ee008c5bccb75f5053e582b324d6cfe34d6779af1d7a723dc4a66ac00b5b108e7380cc589517c952884bf06123c074311b9a636c4b70fd64a50740d47b84eef53c1db04f738c6276a690cad74bd46c2ce3936685ba7f6f5fcaa323c774ac7bcbf60103117161abd8e047a080153fdcee20f7a26e24edf132a1e04d7c84c83989706537af6e2c91fd3336b094b3bcd55c13d3dc9699a3d23dc3e0a1c93d5d3a2273862643cc240cdeedc127692380fb5ef99274f3d7a54fd78e49537c56a9a6dfebda60798d179fa12a9544eac43774c489ca2f82e312707c1f938d9c63db5a1381487b84d75c53b764af7635baf6020ed39be2f219e8310f746cc85c5e405badb6da103f38bcea0121bb465665d7872aebf4b8c933c0f40ae97cc04854769f513e2da3ac34a3ca34ac09d6431f20a037379457d3ece7599e7668a5d9b023bb28764a3b6d3160889399683b8428d4a14efceb6ea53bab2a5e895fc46a304cf718b5e8c47cc95131ecbf6388ed74e5732a7777906721d89470fe6c8e6d2775da09339418f4e13815562b7a9594bd86522064123aae0b87e78ee07f1a4e04048eb19ebe22d4aeb9d38746622826c84b66f25163ec69c9a9ffbc73d7d8d65ec3931c3c0bf3f62ae8c306371448a79cef8f681ac37f915ea3a3353c35979eb51e7f84539168dc16dc144b2969e1387fb0223e249499ecbff5d0818a4f612fbad49691a0fd9cee335eddae96a13c2560bc51e39da92fb8d188fad8a87cbf15c287a1331972fbc7afabde4288101c173e69a21642bb5d53aeb6c0d11f7b4d2df39c4b1b4e8041f12beee68ec92df729dca919af889ed3042e494acf47b14489ae9b857becd0f2de2448d6830ed3ee6e24bf9a6703bf41fa1f888da7e0afd2e19db0ea17b704a0c3911f6a8b01f794f097b2e2c117321c1167b09fcf536bde3438939e639e38b6ec154fa7fb27deea43f49a5e52a3a5bd25aa367ced8a3b148f2c4a2fcc2465873f42cd14597e4b982fedda74cc83c675a9fcc73b0adbcd912d11fb6e63c5fe4d01508bbe007db78e2ad929e45299e0b49c45c48c4334d474acef69c2b9e33ec7ab6d2adf71c26621c250e427e4ec2b34cd0c156d8808f4b5d708767652469cf15f58fb84dfb32c29e4b7a21ceca3c37947fcb5e6d766c657b33b100c5fb26cb94b3e7421231e717810ecbba9f04786e94c58688a7249ee391b2e3b46fda521ea9f47685e5e5fb6587923c67d973e6ac7969cf9d9a9e72416b23ee97b326077be3497e83af3df2dcbb094cf819682ff394b5a987e746ca9e33c625b6a75ea4b720d0435c90c6e59e9903d3b89df00492f9bf34864ba40ec379cca4ec84da51dfae727c2ec3733c86bfa4ab7d91b5300dfa98fb6caf6d2719dc0deaa988eebda416204764c6b2d7ca9e1be6d97310f855b388b990f00828be09ddc031fb93722685e00e234a4b969a8c9534e8dd5f17bf8e04d2a6532312790f633342c1f113834f84374825d6a9ddafb00d331561c6222f52fbd26a55b2a30ccfc9d8728bfde545dc00b16eec76deec059cb1cd3aa41a138ef08937e996e37e77e25de0b743c70f5b9263a5671c686f3fe621aa0bee894c02bdef7b34aaece9cc8fbd8616dd5995d1a2e313fe052f61bf19712ef1bcac1a5fed118cd8846a127300e156b10c79230d7745cdac48bb51b02e21d62a0d8f464e6e28fa457d1a17fdde35e1f252bc5d847cd01904eafdb6f88e82aeee2b217028475a7a0ff95706443fc3bf688c81bc47c4dccf2c345abef91783ef3fc721622e4add123117a56e89988b52b744cc45a95b22e6a2d42d117351ea9688b928754bc45c94ba25622e4add123117a56e89988b52b744cc45a95b22e6a2d42d117351ea9688b928754bc45c94ba25622e4add123117a56e89988b52b744cc45a95b7efdcffffcf2ff6d14cd7e</data> - </image> - <image name="image1"> - <data format="PNG" length="3625">89504e470d0a1a0a0000000d49484452000000ad0000003008060000006357fade00000df049444154789ced5d5f681cc71dfe6d21c529a69c4b1f24438b14eac0a9b4b0aa52904a83566f91e440a4bed8322ebdb31c1af925919d87da71b89c5f94cba5b8951ecef11904920d8ea4827c4a4145e7a0700ad8d5a918ee0c0e9c835a4e460f6721ccc9e8e5ebc3deeeed9f99ddd9bd9323c737603e4b3b7f7e33fb9b6fbff9edcc8a40445789a86e0800eb0000642a885da0eeed34f085c59a1d34f5a0080090134ba0084091192e2a93c0e8e22a00e0bbee78039f5ff45530b7a91268606c0694af38a6470c1480d03c1a0edc40cfe8ad000065d29d51bda2320914b7cb0d09d1402114ca885d9511fd30aa178c2ee71a8edb405774cd90db2c414ed497599d504e2c352443031dd1310336814061ef19d68a81b19986e336908bdc0bb9cd1202633e187322054a009458022580de39355a30932f562586403d75715c00e389ab080d876cff62f11800a0582c3e3f9204406a3e55d7095dde2e23168f21341c4267b782d070c87ffd7b601f0bebc3b01507c3361c53a68067c2b8d8069007821d32721d05043b64fd1febe7f391e873c1ece72351ddfebad9bb08db78bc736ed4d744de13fb18689f79bbf0ccb02229f4c5aa2f8debc77143c321d38d50fa7b319eb80a00989a9e02e280d2df6bcab39a5dddff8cabd95f2f8780d961831d72cd4c5b57fb3868fb8552f6a84137dd1d569eced4a47195c925718782996171873f80780060b7f24873a8170f50fb8d702b5f43fd28fab00f4067b7627b0261dd65bc9e817d6ef9a5ab441426a224118501481fcd12d120118961e8b52c25df68275e0aff334bd7eeb60bd7c7c3a9b71ed2d0af5f9192467b1998cdaee2c4e9537afb8ad24313b1b86b391302183c3e44f7bfb9cfec93a2f4d0d9e1116a7df515a9ab5bc1d6932d0a1c0cd0caed3425254932d6975ecee0c2c50bb4f5648b824782d47be3baa4d999bcd14e6b777b68ebc996a9fee091207576c874f6bdb3e6fae240db0d75acc73f1da79ed77f274d24ae62e2b309bd6c5353333d7ab4414444f977b3941c32dba3a166372be5ef66d57601f41cedd3eb33a6c0c100ad2869da18dea0e6c3872551fb0207037a7f75fb004c5c49d2ecad395b5b4d4dcd943eba403bc776e8e51fff484a1299679e9f375c4ec9ab86757b8326b48701768da6f4f702ebc0d2724668c66b653bbb15b52315a67de7dca8ce489ddd0ab00d14bb4b261962adafd45fb65d8fc56376fb1681d070c8549f551b9a18b154f93d43936aff3f1f89f2c76b97adf97107eadac4d09ed2df0b00aa84aa8c8396bfd45faecd3e0be397facbeaefd7818163c7cde35d617a9d69c3f3abb8b6e683119bd284d33dcc191b26a26b1e99db09a31707a9596233879529db5ee3b33f913ae383475aa9a7bb87868e0f99190d40762d4bededbfb131745b870cad8efcdd2c4d5c4992914996e617aacc63b1237f374b0bb716e8dc471fe8368c0c876968e884b99d69a0edafe672494992e286b647864768e4ed5352783884afd7d64c7d0b1e0952e8d871ea7bb35f9a9e9ec2ca7f86e8e956988888da3bba68e47458edafa59d81a303d4fae107eee3c0e8972ffb8ef651f87498b4eb8ad243edb1b8e9fe5e884431776b8e88883a6599ba3ebb26a91a62b7b6786c8ea76b37ebc7b49ea309801ad69a138b22e8ccc0a86f35bb0aec9a176fb98e029085ce1436862175356d6524a5c2bcb98e82ba68e1d99faf3294b69a67dabb68d1f0967eb0faabb58b2cecfd71185764a18f83b13e6d11ebd53e3c30b73f70ecb889d1b10cdbfd030095697d685923cabf18a4ec7162a64fbe7e48e7fed5eaabde5ab4ad15378a4534373753faab15eab9df45835fda35ab51cb8dbc7f96d6ee666d7a9395ff713c866b37ae1311e9daf6e1370f69e874582f1fbb18a5be37fb252b535b35b0510b9f79ef8c5e67f8cbdb424c36faef351b536dfcefa17efd40e0104d7cfc89de4f16631a19d5cb3878b64fe089684c8183015a9a5f503d5e4ed4ce884e29b6523fc62d3830a2574ccda74c8c319eb80a23c375762baa8eaeac66a7a6a7980c83a29931989abad22eabbc5b14442b2fa219bdf47f35bbcaec8f9521354d6b1c0716437bb5cfdabe68bcfc071bdb65ac3d22a2cf2b8ce61367efdb57985a3adb4934431b4407fcd7afe12b7f9fa53000374d9bcdaec22d5fdfd13efa030dea76ee3c794c6d27dbf559bd723b4dc91f4a121d96a4a42449434327a4334d67f4fced723b2589880e4bd2c0d1012222537ddacfe9a30b7abb71f9927e2d79e33af7c930787ca85afe35b5bcb1fe89cf93ea5ae4f3b0a93d2f4fa076b9dd64afd69f3080b6bfa8e370ea6098d2b716282919c6a1629b6e8f4cbeecb3b67fe9e205ee9367a35884f633017560c0899423d3eaa9f2c6acd6f6a6ee39682fd8e3b45ac05b6b7f69396362544d7362d941e3c1bc6a665d6769662dcae0649f29fe09c6aab958653257cdc81b1706f234adf109d4d9ad9819d8629f674d6bb563bd7a5d8bd6e8f66d032855d70c7af420e4376aa0e14f1708eff491d7245d49133deaf1d5eee8c5410a7266e4ce761927de3ec58db1b252f048903e895ca2d623ad648dcf363535d3d3273b4c4d67d38011a0ed9659a369dacefa24e0c53f8da9a9a999929f8e53ebabaa864f1a62ab2ccdd8d4d44c43a92fdca32bc4d694464ddfa598e3c722e330dddf0bad4f2cfb346d6eb5c3b826e0a5e09120cd5e9f5619bfe4f50d9801b5cd307ed3683ae7f30d9903d352951162f118787142cc81ada15061e64adc148b2ac362b7b2aa2da99b70b00b338312e97b1eb472b178ccd1ced47cca94df54ce6a97965fb347bb8e6ab9a5e58cf73756a8f687f97b835de72351b5df5998c641d43ec7378f8cf642c321200f358a60c84f9e7771456640f1eaaead5a53a650024d786b3f30b6ff37b73470ef90bc325d1970ddcde5396d03855d8fd10a878e69272d461701a55c3d4cd93815fcfd4071a61d13dbcd556b12b5c7a9632d97d9e5e444ed0c5dae4c88cc7a0900a73ec3f5cc7aa9ae13a5cc99785a7bd1e51ca2a89c92ae437be3770a08a1b26909406ed3dc9fd483229449f5ba8651f83ff397db2c210a737d0396fac49856343a50a7542bd3fa2d278285923d3e6d75585e1cbb260742756f889c804d4bb3fa9b59474dfd1dbf63af375010eb2fe52b4f380ffd1bb8c9df0d681c3f77a67d460c6b4db530addf72428f264b7dd6c3980337335cbb954980c794228cc7ed0767bca2a8adbf514ebd46072aefaa0b63de780b9df903d07239c51d376b7957a6dd8b94db5435ec4c5ec071f719d3ba31a8e2128d914b95bd1a5edb07bf1f997536d346977db463c0e8b20706077f97a0e39e1187722d97d94777c8c9c3e5e9bd7059834356ce94c550d12c96d40b8e5d2edaf4bb645a91ef4204c6bc6bdde872ce33d3721dc5eb4411ad17ce5f1a6ab95cd5dca38babe0ad3d28e2fc25227e9cb6006e94a0770ea0922a1d280fd0a40fa7dd64b43b993167da0668dd9e6fe026f62dd37a897b3bbed9e33910a31fe0326d6ddf91882eb3e3e870d1ca3c8616c140c1bd7edb0cd6d0fae260349d03c5f933cfb3d3f266a44543f7ced9cf96591de579635a2386e6c5162b7e98f659685a1e66d6bd9fe69613629adf71b5ab3bd844ca7186b86953a6d396f8f5d9da17d15456c7da279a562e0129e31933a88e6edcbf3c7053e04405f8fdd8179a96815e4e75b714211c47e73293c9615d66889fc4655ae3cc9bb6e70b8cb93bde7e625a1e739477810154f3b9adb2471757f9fd00ffbed4d4df5aebe59467216fd1c5665a221ab8699f510040716786a5c88cd0695ca6d3ba30ad48bc6e3f32ad51d30a9d2286bd3eebae3056bcd4c468fb4cd36a767b3d7328fa49acda4f2eb4ac104e7691d7e4779757e64f8fa9ebe73f713cb9702a02f0ca17dfdda1e6caa94e2f271f3494223330d61755f274e1f55feaf5f54c2ee1f6b76abf9496411afaa3d899b6431fcfd2d653f171b8faa1f98401ebfe099fa9e3e07d007146bdb838c8ddf7bab30bbcfc12915f7f0a1c98a5c7eff3eb379dc66d29fa67be67c5b4caa4c00c2772665a81995c2f4d2b6aaf1f663296cf71cee2796a9f812d97d94f5aae865d079cfc484ea8f73eba9c035079a1c0e95fa90cdb2e3a33d312d1f4bd024efcc3fb59aede5f6569e12df1733e5af233139d66b828d312cd52e8e22085fffb98ba7e7648a8be3d675aaa3266fb9534ad093c814c4c4b44ad9753f876abcf96cf6a9f28f24e6787e42c25dfb49fce3dfbaf2cc5bf66efcb969b0669fc0df61372e24e01176eb7d2d6537bb9c08141baa43ca491df9acf049a3c58995cf21e5f2bf9a0591fdf4350cae20ce9e789e134e35386930575d7b40c0ccdbb8f8f17a656b438bacbea5cdb1dc76340a6e674614c91271bb601d9e1c9abd96f635a276d24c2805e92d7ef21040e0c52fecfe25ad48d69fda0c66c6e4c6b6428cf4c6b40b7279f9569b5fbd7fab7056231ae864a4b9a0e9dec21f9ab3cd1efdb88beca53fa611b6d3d756678a5254de9933dfa93696717f8e0252296e615d5a6565c01c0f30b637daeab59111c4de73c11ad5054c2809ede1c51253c5427a6b5aec28d9a95c92486f11b5df466374b23b218484e3833f8d43dc0ba1bcd2f02fcbd067c66ace1c3d80e4f0ccd1e66c1906690e89b9d31f5048248f2faf544d1374656b4ee7bf58bbc8175bb5ed7bf2161b5cb43b9a97b05d3fe54de5e1339a15e1fb899a9eec77570bca97b05289315078b54f7bdd6651f2f80f13b057d3fad16c75526d571e56a1b278dc1c44df5db5d4ec9ebf70ffc6ac2067ebfd191a9fcfcad05de6147799abfcf948542af361bf842a27b46d44f1b8aa25f49d0c01703c532a2aa5dbc32af170c8ca91a6c3f0c4c03f72f8a17a888f9bd6258c5e10d48031b6844cf0532eb25c733415eb1a6f048035f48f45f01d438a49f3d0bda36b406b336d00fd6a7a24a3c105057fd5a7c4dc30154374934fe066e036bc5ff03859b69b81278b6550000000049454e44ae426082</data> - </image> -</images> -<connections> - <connection> - <sender>Menu</sender> - <signal>clicked(QListBoxItem*)</signal> - <receiver>Tab_Signalisations</receiver> - <slot>setFocus()</slot> - </connection> - <connection> - <sender>buttonCancel</sender> - <signal>clicked()</signal> - <receiver>ConfigurationPanel</receiver> - <slot>reject()</slot> - </connection> - <connection> - <sender>Menu</sender> - <signal>clicked(QListBoxItem*)</signal> - <receiver>ConfigurationPanel</receiver> - <slot>changeTabSlot()</slot> - </connection> - <connection> - <sender>buttonSave</sender> - <signal>clicked()</signal> - <receiver>ConfigurationPanel</receiver> - <slot>saveSlot()</slot> - </connection> - <connection> - <sender>stunButtonGroup</sender> - <signal>clicked(int)</signal> - <receiver>ConfigurationPanel</receiver> - <slot>useStunSlot(int)</slot> - </connection> - <connection> - <sender>buttonApplySkin</sender> - <signal>clicked()</signal> - <receiver>ConfigurationPanel</receiver> - <slot>applySkinSlot()</slot> - </connection> - <connection> - <sender>DriverChoice</sender> - <signal>clicked(int)</signal> - <receiver>ConfigurationPanel</receiver> - <slot>driverSlot(int)</slot> - </connection> - <connection> - <sender>buttonOk</sender> - <signal>clicked()</signal> - <receiver>ConfigurationPanel</receiver> - <slot>accept()</slot> - </connection> -</connections> -<tabstops> - <tabstop>fullName</tabstop> - <tabstop>userPart</tabstop> - <tabstop>username</tabstop> - <tabstop>password</tabstop> - <tabstop>hostPart</tabstop> - <tabstop>sipproxy</tabstop> - <tabstop>autoregister</tabstop> - <tabstop>Register</tabstop> - <tabstop>buttonSave</tabstop> - <tabstop>buttonOk</tabstop> - <tabstop>buttonCancel</tabstop> - <tabstop>Tab_Signalisations</tabstop> - <tabstop>buttonHelp</tabstop> - <tabstop>SkinChoice</tabstop> - <tabstop>zoneToneChoice</tabstop> - <tabstop>confirmationToQuit</tabstop> - <tabstop>checkedTray</tabstop> - <tabstop>voicemailNumber</tabstop> - <tabstop>useStunYes</tabstop> - <tabstop>STUNserver</tabstop> - <tabstop>playTones</tabstop> - <tabstop>pulseLength</tabstop> - <tabstop>sendDTMFas</tabstop> - <tabstop>Menu</tabstop> - <tabstop>Tab_Audio</tabstop> - <tabstop>codec1</tabstop> - <tabstop>codec2</tabstop> - <tabstop>codec3</tabstop> - <tabstop>Tab_Preferences</tabstop> - <tabstop>Tab_About</tabstop> - <tabstop>useStunNo</tabstop> - <tabstop>ringsChoice</tabstop> - <tabstop>buttonApplySkin</tabstop> -</tabstops> -<includes> - <include location="local" impldecl="in implementation">ConfigurationPanel.ui.h</include> -</includes> -<slots> - <slot>generate()</slot> - <slot>saveSlot()</slot> - <slot>changeTabSlot()</slot> - <slot>useStunSlot( int id )</slot> - <slot>applySkinSlot()</slot> - <slot>driverSlot( int id )</slot> -</slots> -<functions> - <function access="private" specifier="non virtual">init()</function> -</functions> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/src/gui/official/ConfigurationPanel.ui.h b/src/gui/official/ConfigurationPanel.ui.h deleted file mode 100644 index df4c4609b0d7e7c4357d64b9fd7abf088d91aeea..0000000000000000000000000000000000000000 --- a/src/gui/official/ConfigurationPanel.ui.h +++ /dev/null @@ -1,306 +0,0 @@ -/**************************************************************************** -** 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); -} diff --git a/src/gui/official/ConfigurationPanelImpl.cpp b/src/gui/official/ConfigurationPanelImpl.cpp deleted file mode 100644 index 06dfc4c006719466b9fe05b1d457fc39be4ea63e..0000000000000000000000000000000000000000 --- a/src/gui/official/ConfigurationPanelImpl.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/** - * 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(); -} diff --git a/src/gui/official/ConfigurationPanelImpl.hpp b/src/gui/official/ConfigurationPanelImpl.hpp deleted file mode 100644 index b8aeeddafb376927e4e345fb36da9e1ca562913c..0000000000000000000000000000000000000000 --- a/src/gui/official/ConfigurationPanelImpl.hpp +++ /dev/null @@ -1,69 +0,0 @@ -/** - * 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 diff --git a/src/gui/official/DebugOutput.hpp b/src/gui/official/DebugOutput.hpp deleted file mode 100644 index 0001320532a37311b69ddd82d22443d5e588147d..0000000000000000000000000000000000000000 --- a/src/gui/official/DebugOutput.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 - diff --git a/src/gui/official/DebugOutputImpl.cpp b/src/gui/official/DebugOutputImpl.cpp deleted file mode 100644 index 0fc7e5ec9bc3d8830ef044cb6c9b2b033cfa5335..0000000000000000000000000000000000000000 --- a/src/gui/official/DebugOutputImpl.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 -{} diff --git a/src/gui/official/DebugOutputImpl.hpp b/src/gui/official/DebugOutputImpl.hpp deleted file mode 100644 index 8a182d27bbc9bce7fa0fd9743e8e6ea5cb5ac029..0000000000000000000000000000000000000000 --- a/src/gui/official/DebugOutputImpl.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 diff --git a/src/gui/official/Event.cpp b/src/gui/official/Event.cpp deleted file mode 100644 index fe4f4eb036f2cf57e2c3ef08a812a7da954b6e25..0000000000000000000000000000000000000000 --- a/src/gui/official/Event.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include <qobject.h> - -#include "globals.h" - -#include "Call.hpp" -#include "DebugOutput.hpp" -#include "Event.hpp" - -Event::Event(const QString &code, - const std::list< QString > &args) - : mCode(code) - , mUnusedArgs(args) - , mArgs(args) -{} - - -void -Event::execute() -{ - DebugOutput::instance() << QObject::tr("Event: Received: %1\n").arg(toString()); -} - -QString -Event::toString() -{ - QString output(mCode); - for(std::list< QString >::iterator pos = mArgs.begin(); - pos != mArgs.end(); - pos++) { - output += " "; - output += *pos; - } - - return output; -} - -CallRelatedEvent::CallRelatedEvent(const QString &code, - const std::list< QString > &args) - : Event(code, args) -{ - std::list< QString > l(getUnusedArgs()); - if(l.size() != 0) { - mCallId = *l.begin(); - l.pop_front(); - setUnusedArgs(l); - } -} - -QString -CallRelatedEvent::getCallId() -{ - return mCallId; -} diff --git a/src/gui/official/Event.hpp b/src/gui/official/Event.hpp deleted file mode 100644 index 1fea8a1762ad127fe5910c96ace154cfe1ddea86..0000000000000000000000000000000000000000 --- a/src/gui/official/Event.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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 __EVENT_HPP__ -#define __EVENT_HPP__ - -#include <list> -#include <qstring.h> - -class Event -{ -public: - Event(const QString &code, - const std::list< QString > &args); - virtual ~Event(){} - - virtual void execute(); - - virtual QString toString(); - - std::list< QString > getUnusedArgs() - {return mUnusedArgs;} - - void setUnusedArgs(const std::list< QString > &args) - {mUnusedArgs = args;} - -private: - QString mCode; - std::list< QString > mUnusedArgs; - std::list< QString > mArgs; -}; - -class CallRelatedEvent : public Event -{ -public: - CallRelatedEvent(const QString &code, - const std::list< QString > &args); - - QString getCallId(); - -private: - QString mCallId; -}; - - -#endif diff --git a/src/gui/official/EventFactory.hpp b/src/gui/official/EventFactory.hpp deleted file mode 100644 index 1a21f156882b5531307b9ecabcec7b0c1bc112af..0000000000000000000000000000000000000000 --- a/src/gui/official/EventFactory.hpp +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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 __EVENTFACTORY_HPP__ -#define __EVENTFACTORY_HPP__ - -#include <list> -#include <map> -#include <qstring.h> - -#include "Event.hpp" - -/** - * This is the base class that we will use to - * create an object from the "create" function. - */ -template< typename Base > -class EventCreatorBase -{ - public: - virtual ~EventCreatorBase(){} - virtual Base *create(const QString &code, - const std::list< QString > &args) = 0; - - virtual EventCreatorBase *clone() = 0; -}; - -/** - * This is the actual class that will create - * the request. It will return a Request - */ -template< typename Base, typename Actual > - class EventCreator : public EventCreatorBase< Base > -{ - public: - virtual Actual *create(const QString &code, - const std::list< QString > &args); - - virtual EventCreatorBase< Base > *clone(); -}; - - -/** - * This class is used to create object related to - * a string. However, thoses objects will be created - * with the default constructor. - */ -template< typename Base > -class EventFactoryImpl -{ -public: - EventFactoryImpl(); - - /** - * Ask for a new object linked to the string. - */ - Base *create(const QString &code, - const std::list< QString > &args); - - /** - * Register the string to return a Actual type. - */ - template< typename Actual > - void registerEvent(const QString &code); - - template< typename Actual > - void registerDefaultEvent(); - - private: - std::map< QString, EventCreatorBase< Base > * > mEventCreators; - EventCreatorBase< Base > *mDefaultCreator; -}; - -#include "EventFactory.inl" - -#include "utilspp/Singleton.hpp" - -typedef utilspp::SingletonHolder< EventFactoryImpl< Event > > EventFactory; - - -#endif diff --git a/src/gui/official/EventFactory.inl b/src/gui/official/EventFactory.inl deleted file mode 100644 index 369d47e2170c0e81efcd82d0ea5d7f63c98dc5d1..0000000000000000000000000000000000000000 --- a/src/gui/official/EventFactory.inl +++ /dev/null @@ -1,95 +0,0 @@ -/** - * 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 __EVENTFACTORY_INL__ -#define __EVENTFACTORY_INL__ - -#include <qobject.h> -#include <stdexcept> - -#include "DebugOutput.hpp" - -template< typename Base, typename Actual > -Actual * -EventCreator< Base, Actual >::create(const QString &code, - const std::list< QString > &args) -{ - return new Actual(code, args); -} - -template< typename Base, typename Actual > -EventCreatorBase< Base > * -EventCreator< Base, Actual >::clone() -{ - return new EventCreator< Base, Actual >(); -} - -template< typename Base > -EventFactoryImpl< Base >::EventFactoryImpl() - : mDefaultCreator(NULL) -{} - -template< typename Base > -Base * -EventFactoryImpl< Base >::create(const QString &code, - const std::list< QString > &args) -{ - typename std::map< QString, EventCreatorBase< Base > * >::iterator pos = mEventCreators.find(code); - if(pos == mEventCreators.end()) { - if(mDefaultCreator) { - return mDefaultCreator->create(code, args); - } - else{ - DebugOutput::instance() << QObject::tr("The code %1 has no creator registered.\n" - "and there's no default creator").arg(code); - } - } - - return pos->second->create(code, args); -} - -template< typename Base > -template< typename Actual > -void -EventFactoryImpl< Base >::registerEvent(const QString &code) -{ - if(mEventCreators.find(code) != mEventCreators.end()) { - delete mEventCreators[code]; - } - - mEventCreators[code] = new EventCreator< Base, Actual >(); -} - -template< typename Base > -template< typename Actual > -void -EventFactoryImpl< Base >::registerDefaultEvent() -{ - if(mDefaultCreator) { - delete mDefaultCreator; - } - - mDefaultCreator = new EventCreator< Base, Actual >(); -} - - -#endif - diff --git a/src/gui/official/Factory.hpp b/src/gui/official/Factory.hpp deleted file mode 100644 index a89cf9212f0538ff371abf539a1672f04dacae89..0000000000000000000000000000000000000000 --- a/src/gui/official/Factory.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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 __FACTORY_HPP__ -#define __FACTORY_HPP__ - -template< typename T > -struct Creator -{ - virtual ~Creator(){} - - virtual T *create() = 0; -}; - -template< typename T > -class Factory -{ -public: - Factory(); - ~Factory(); - - /** - * This function will set the creator. The - * Factory owns the creator instance. - */ - void setCreator(Creator< T > *creator); - - /** - * It ask the creator to create a SessionIO. - * If there's no creator set, it will throw - * a std::logic_error. - */ - T *create(); - -private: - Creator< T > *mCreator; -}; - -#include "Factory.inl" - -#endif diff --git a/src/gui/official/Factory.inl b/src/gui/official/Factory.inl deleted file mode 100644 index 5b96b6474be4ebe21aaa45f226ccdd0715674c7e..0000000000000000000000000000000000000000 --- a/src/gui/official/Factory.inl +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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 <stdexcept> - -template< typename T > -Factory< T >::Factory() - : mCreator(0) -{} - -template< typename T > -Factory< T >::~Factory() -{ - delete mCreator; -} - -template< typename T > -void -Factory< T >::setCreator(Creator< T > *creator) -{ - mCreator = creator; -} - -template< typename T > -T * -Factory< T >::create() -{ - if(!mCreator) { - throw std::logic_error("Trying to create without a creator."); - } - else { - return mCreator->create(); - } -} - diff --git a/src/gui/official/JPushButton.cpp b/src/gui/official/JPushButton.cpp deleted file mode 100644 index 64a389e7b47c8482aba3ba3ea695d543efd7273f..0000000000000000000000000000000000000000 --- a/src/gui/official/JPushButton.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jerome Oufella (jerome.oufella@savoirfairelinux.com) - * - * Portions (c) Jean-Philippe Barrette-LaPierre - * (jean-philippe.barrette-lapierre@savoirfairelinux.com) - * Portions (c) Valentin Heinitz - * - * 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 <qbitmap.h> -#include <qevent.h> -#include <qimage.h> -#include <qevent.h> - -#include "globals.h" - -#include "JPushButton.hpp" -#include "TransparentWidget.hpp" - -JPushButton::JPushButton(const QString &released, - const QString &pressed, - QWidget* parent) - : QLabel(parent) - , mIsPressed(false) - , mIsToggling(false) -{ - mImages[0] = transparize(released); - mImages[1] = transparize(pressed); - release(); -} - -JPushButton::~JPushButton() -{} - -void -JPushButton::setToggle(bool toggle) -{ - mIsToggling = toggle; -} - -QPixmap -JPushButton::transparize(const QString &image) -{ - return TransparentWidget::transparize(image); -} - -void -JPushButton::release() -{ - setPixmap(mImages[0]); - if(mImages[0].hasAlpha()) { - setMask(*mImages[0].mask()); - } - resize(mImages[0].size()); -} - -void -JPushButton::press() -{ - setPixmap(mImages[1]); - if(mImages[1].hasAlpha()) { - setMask(*mImages[1].mask()); - } - resize(mImages[1].size()); -} - -// Mouse button released -void -JPushButton::mousePressEvent(QMouseEvent *e) -{ - switch (e->button()) { - case Qt::LeftButton: - press(); - break; - - default: - e->ignore(); - break; - } -} - -// Mouse button released -void -JPushButton::mouseReleaseEvent (QMouseEvent *e) { - switch (e->button()) { - case Qt::LeftButton: - if(mIsToggling) { - mIsPressed = !mIsPressed; - if(mIsPressed) { - press(); - } - else { - release(); - } - emit clicked(mIsPressed); - } - else { - release(); - emit clicked(); - } - // Emulate the left mouse click - //if (this->rect().contains(e->pos())) { - // emit clicked(); - //} - break; - - default: - e->ignore(); - break; - } -} - -void -JPushButton::mouseMoveEvent(QMouseEvent *e) -{ - e->accept(); -} - diff --git a/src/gui/official/JPushButton.hpp b/src/gui/official/JPushButton.hpp deleted file mode 100644 index 1e3249a0669efe272535ce9f4b16d8dd8b4b7f3d..0000000000000000000000000000000000000000 --- a/src/gui/official/JPushButton.hpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jerome Oufella (jerome.oufella@savoirfairelinux.com) - * - * Portions (c) Jean-Philippe Barrette-LaPierre - * (jean-philippe.barrette-lapierre@savoirfairelinux.com) - * Portions (c) Valentin Heinitz - * - * 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 __J_PUSH_BUTTON_H__ -#define __J_PUSH_BUTTON_H__ - -#include <qlabel.h> -#include <qpixmap.h> -#include <qimage.h> - -/** - * This class Emulate a PushButton but takes two - * images to display its state. - */ -class JPushButton : public QLabel -{ - Q_OBJECT - -public: - JPushButton(const QString &released, - const QString &pressed, - QWidget *parent); - ~JPushButton(); - - bool isPressed() - {return mIsPressed;} - - static QPixmap transparize(const QString &image); - -public slots: - /** - * This function will switch the button - */ - virtual void press(); - virtual void release(); - - virtual void setToggle(bool toggled); - -protected: - QPixmap mImages[2]; - bool mIsPressed; - -protected: - void mousePressEvent(QMouseEvent *); - void mouseReleaseEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); - -signals: - void clicked(bool); - void clicked(); - -private: - bool mIsToggling; -}; - -#endif // defined(__J_PUSH_BUTTON_H__) diff --git a/src/gui/official/ObjectFactory.hpp b/src/gui/official/ObjectFactory.hpp deleted file mode 100644 index 88c16e0938548a6abd50b6e88d34c83c92605bdc..0000000000000000000000000000000000000000 --- a/src/gui/official/ObjectFactory.hpp +++ /dev/null @@ -1,88 +0,0 @@ -/** - * 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_OBJECTFACTORY_H -#define SFLPHONEGUI_OBJECTFACTORY_H - -#include <list> -#include <map> -#include <qstring.h> - -/** - * This is the base class that we will use to - * create an object from the "create" function. - */ -template< typename Base > -class ObjectCreatorBase -{ - public: - virtual ~ObjectCreatorBase(){} - virtual Base *create(const QString &command, - const QString &sequenceId, - const std::list< QString > &args) = 0; - - virtual ObjectCreatorBase *clone() = 0; -}; - -/** - * This is the actual class that will create - * the request. It will return a Request - */ -template< typename Base, typename Actual > - class ObjectCreator : public ObjectCreatorBase< Base > -{ - public: - virtual Actual *create(const QString &command, - const QString &sequenceId, - const std::list< QString > &args); - - virtual ObjectCreatorBase< Base > *clone(); -}; - - -/** - * This class is used to create object related to - * a string. However, thoses objects will be created - * with the default constructor. - */ -template< typename Base > -class ObjectFactory -{ -public: - /** - * Ask for a new object linked to the string. - */ - Base *create(const QString &requestname, - const QString &sequenceId, - const std::list< QString > &args); - - /** - * Register the string to return a Actual type. - */ - template< typename Actual > - void registerObject(const QString &name); - - private: - std::map< QString, ObjectCreatorBase< Base > * > mObjectCreators; -}; - -#include "ObjectFactory.inl" - -#endif diff --git a/src/gui/official/ObjectFactory.inl b/src/gui/official/ObjectFactory.inl deleted file mode 100644 index 98f93cc44b30178ff627ede7427050734474ec11..0000000000000000000000000000000000000000 --- a/src/gui/official/ObjectFactory.inl +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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_OBJECTFACTORY_INL -#define SFLPHONEGUI_OBJECTFACTORY_INL - -#include <stdexcept> - - -template< typename Base, typename Actual > -Actual * -ObjectCreator< Base, Actual >::create(const QString &command, - const QString &sequenceId, - const std::list< QString > &args) -{ - return new Actual(sequenceId, command, args); -} - -template< typename Base, typename Actual > -ObjectCreatorBase< Base > * -ObjectCreator< Base, Actual >::clone() -{ - return new ObjectCreator< Base, Actual >(); -} - -template< typename Base > -Base * -ObjectFactory< Base >::create(const QString &command, - const QString &sequenceId, - const std::list< QString > &args) -{ - typename std::map< QString, ObjectCreatorBase< Base > * >::iterator pos = mObjectCreators.find(command); - if(pos == mObjectCreators.end()) { - throw std::logic_error("We need to have a better handling"); - //throw std::runtime_error("The command \"" + command.toStdString() + "\" has no creator registered."); - } - - return pos->second->create(command, sequenceId, args); -} - -template< typename Base > -template< typename Actual > -void -ObjectFactory< Base >::registerObject(const QString &name) -{ - if(mObjectCreators.find(name) != mObjectCreators.end()) { - delete mObjectCreators[name]; - } - - mObjectCreators[name] = new ObjectCreator< Base, Actual >(); -} - - -#endif - diff --git a/src/gui/official/ObjectPool.hpp b/src/gui/official/ObjectPool.hpp deleted file mode 100644 index ca9d394514c7341b33a73bedb769234fe8514a2d..0000000000000000000000000000000000000000 --- a/src/gui/official/ObjectPool.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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_OBJECTPOOL_H -#define SFLPHONEGUI_OBJECTPOOL_H - -#include <list> -#include <qstring.h> -#include <QMutex> -#include <QWaitCondition> - -template< typename T > -class ObjectPool -{ - public: - /** - * This function will push a line in the pool. - */ - void push(const T &line); - - /** - * This function will wait for an available line. - */ - bool pop(T &value, unsigned long time = ULONG_MAX); - - private: - std::list< T > mPool; - - QMutex mMutex; - QWaitCondition mDataAvailable; -}; - -#include "ObjectPool.inl" - -#endif - diff --git a/src/gui/official/ObjectPool.inl b/src/gui/official/ObjectPool.inl deleted file mode 100644 index b389eb92b16062ec8b20dc0baca917ae6705f8d9..0000000000000000000000000000000000000000 --- a/src/gui/official/ObjectPool.inl +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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_OBJECTPOOL_INL -#define SFLPHONEGUI_OBJECTPOOL_INL - -template< typename T > -void -ObjectPool< T >::push(const T &value) -{ - QMutexLocker guard(&mMutex); - mPool.push_back(value); - mDataAvailable.wakeOne(); -} - -template< typename T > -bool -ObjectPool< T >::pop(T &value, unsigned long time) -{ - QMutexLocker guard(&mMutex); - mDataAvailable.wait(guard.mutex(), time); - - if(mPool.begin() == mPool.end()) { - return false; - } - else { - typename std::list< T >::iterator pos = mPool.begin(); - mPool.pop_front(); - value = (*pos); - return true; - } -} - -#endif diff --git a/src/gui/official/PhoneLine.cpp b/src/gui/official/PhoneLine.cpp deleted file mode 100644 index cc9de470e19f6d9c9ec45e8815d16169aa91b9ce..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLine.cpp +++ /dev/null @@ -1,300 +0,0 @@ -#include <iostream> - -#include "globals.h" -#include "Call.hpp" -#include "DebugOutput.hpp" -#include "PhoneLine.hpp" - -PhoneLine::PhoneLine(const Session &session, - const Account &account, - unsigned int line) - : mSession(session) - , mAccount(account) - , mCall(NULL) - , mLine(line) - , mSelected(false) - , mLineStatus("test") - , mActionTimer(new QTimer(this)) - , mIsOnError(false) -{ - QObject::connect(mActionTimer, SIGNAL(timeout()), - this, SLOT(resetAction())); -} - -PhoneLine::~PhoneLine() -{ - delete mCall; - mCall = NULL; -} - -QString -PhoneLine::getLineStatus() -{ - return mLineStatus; -} - -void -PhoneLine::resetAction() -{ - setAction(""); -} - -void -PhoneLine::setLineStatus(const QString &status) -{ - mActionTimer->stop(); - mAction = ""; - - mLineStatus = status; - emit lineStatusChanged(mLineStatus); -} - -void -PhoneLine::setAction(const QString &status) -{ - mActionTimer->stop(); - mAction = status; - emit actionChanged(mAction); -} - -void -PhoneLine::setTempAction(const QString &status) -{ - mActionTimer->stop(); - mActionTimer->start(3000); - mAction = status; - emit actionChanged(mAction); -} - -unsigned int -PhoneLine::line() -{ - return mLine; -} - -void -PhoneLine::lock() -{ - mPhoneLineMutex.lock(); -} - -void -PhoneLine::unlock() -{ - mPhoneLineMutex.unlock(); -} - -void -PhoneLine::select(bool hardselect) -{ - if(!mSelected) { - DebugOutput::instance() << tr("PhoneLine %1: I am selected.\n").arg(mLine); - mSelected = true; - - if(!hardselect) { - if(mCall) { - if(mIsOnError) { - close(); - } - else if(mCall->isIncomming()) { - answer(); - } - else { - unhold(); - } - } - else { - setLineStatus(QObject::tr("Ready.")); - setAction(""); - } - } - - emit selected(); - } - -} - -void -PhoneLine::disconnect() -{ - mSelected = false; - DebugOutput::instance() << QObject::tr("PhoneLine %1: I am disconnected.\n").arg(mLine); - close(); - - emit unselected(); -} - -void -PhoneLine::close() -{ - DebugOutput::instance() << tr("PhoneLine %1: I am closed.\n").arg(mLine); - if(mCall) { - delete mCall; - mCall = NULL; - } - mIsOnError = false; -} - -void -PhoneLine::error() -{ - mIsOnError = true; -} - -void -PhoneLine::unselect(bool hardselect) -{ - if(mSelected) { - DebugOutput::instance() << tr("PhoneLine %1: I am unselected.\n").arg(mLine); - setAction(""); - mSelected = false; - if(mIsOnError) { - close(); - } - if(mCall) { - if(!hardselect) { - mCall->hold(); - } - emit backgrounded(); - } - else { - emit unselected(); - } - } -} - -void -PhoneLine::incomming(const Call &call) -{ - if(mCall) { - DebugOutput::instance() << tr("PhoneLine %1: Trying to set a phone line to an active call.\n").arg(mLine); - } - else { - mCall = new Call(call); - emit backgrounded(); - } -} - -void -PhoneLine::clear() -{ - mBuffer = ""; - emit bufferStatusChanged(mBuffer); -} - -void -PhoneLine::sendKey(Qt::Key c) -{ - DebugOutput::instance() << tr("PhoneLine %1: Received the character:%2.\n") - .arg(mLine) - .arg(c); - switch(c) { - case Qt::Key_Enter: - case Qt::Key_Return: - if(!mCall) { - return call(); - } - break; - - default: - if (QChar(c).isDigit() || c == Qt::Key_Asterisk || c == Qt::Key_NumberSign) { - if(!mCall) { - mSession.playDtmf(c); - mBuffer += c; - emit bufferStatusChanged(mBuffer); - } - else { - mCall->sendDtmf(c); - } - } - } -} - -void -PhoneLine::call() -{ - if(mBuffer.length()) { - call(mBuffer); - } -} - -void -PhoneLine::call(const QString &to) -{ - DebugOutput::instance() << tr("PhoneLine %1: Calling %2.\n").arg(mLine).arg(to); - if(!mCall) { - setLineStatus(tr("Calling %1...").arg(to)); - mCall = new Call(mAccount.createCall(to)); - clear(); - } -} - -void -PhoneLine::hold() -{ - if(mCall) { - setAction(tr("Holding...")); - DebugOutput::instance() << tr("PhoneLine %1: Trying to Hold.\n").arg(mLine); - mCall->hold(); - } - - unselect(); -} - -void -PhoneLine::unhold() -{ - if(mCall) { - setAction("Unholding..."); - DebugOutput::instance() << tr("PhoneLine %1: Trying to Unhold.\n").arg(mLine); - mCall->unhold(); - } -} - -void -PhoneLine::answer() -{ - if(mCall) { - setAction("Answering..."); - DebugOutput::instance() << tr("PhoneLine %1: Trying to answer.\n").arg(mLine); - mCall->answer(); - } -} - -void -PhoneLine::hangup(bool sendrequest) -{ - if(sendrequest) { - setAction(tr("Hanguping...")); - } - else { - setAction(tr("Hanguped.")); - } - - if(mCall) { - if(sendrequest) { - mCall->hangup(); - } - delete mCall; - mCall = NULL; - } - else { - clear(); - } - - //This is a hack for unselect; - mSelected = true; - unselect(); -} - -QString -PhoneLine::getCallId() -{ - QString id; - if(mCall) { - id = mCall->id(); - } - - return id; -} - diff --git a/src/gui/official/PhoneLine.hpp b/src/gui/official/PhoneLine.hpp deleted file mode 100644 index 6c1d74fdab2f2b36be71845dfbdced682d464f8d..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLine.hpp +++ /dev/null @@ -1,135 +0,0 @@ -#include <qobject.h> -#include <qmutex.h> -#include <qstring.h> -#include <qtimer.h> - -#include "Account.hpp" -#include "Session.hpp" - -class Call; - -class PhoneLine : public QObject -{ - Q_OBJECT - -public: - PhoneLine(const Session &session, - const Account &account, - unsigned int line); - ~PhoneLine(); - - void call(const QString &to); - void call(); - void answer(); - void hangup(bool sendrequest = true); - void hold(); - void unhold(); - - QString getCallId(); - - unsigned int line(); - - /** - * This will lock the current phone line. - * - * Note: this will only lock the phone line - * for those that uses this lock, unlock - * mechanism. PhoneLineManager always uses - * this mechanism. So, if you work only with - * PhoneLineManager, it will be thread safe. - */ - void lock(); - - /** - * This will unlock the current phone line. - * See the Note of the lock function. - */ - void unlock(); - - - /** - * This function will return true if there's no - * activity on this line. It means that even - * if we typed something on this line, but haven't - * started any communication, this will be available. - */ - bool isAvailable() - {return !mCall;} - - void sendKey(Qt::Key c); - - QString getLineStatus(); - QString getBuffer() - {return mBuffer;} - -public slots: - void setLineStatus(const QString &); - void setAction(const QString &); - void setTempAction(const QString &); - void resetAction(); - void incomming(const Call &call); - - /** - * Clears the buffer of the line. - */ - void clear(); - - /** - * The user selected this line. - */ - void select(bool hardselect = false); - - /** - * This phoneline is no longer selected. - */ - void unselect(bool hardselect = false); - - /** - * This will do a hard unselect. it means it - * will remove the call if there's one. - */ - void disconnect(); - - /** - * This will close the current call. it means it - * will remove the call if there's one. - */ - void close(); - - /** - * This will close the current call. it means it - * will remove the call if there's one. The line - * will be in an error state. - */ - void error(); - - void setState(const QString &){} - void setPeer(const QString &){} - - -signals: - void selected(); - void unselected(); - void backgrounded(); - void lineStatusChanged(QString); - void actionChanged(QString); - void bufferStatusChanged(QString); - -private: - Session mSession; - Account mAccount; - Call *mCall; - QMutex mPhoneLineMutex; - unsigned int mLine; - - bool mSelected; - bool mInUse; - //This is the buffer when the line is not in use; - QString mBuffer; - - QString mLineStatus; - QString mAction; - QTimer *mActionTimer; - - bool mIsOnError; -}; diff --git a/src/gui/official/PhoneLineButton.cpp b/src/gui/official/PhoneLineButton.cpp deleted file mode 100644 index 40f67bed627be50be065fec5b34632b8df27ff91..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLineButton.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "globals.h" - -#include "PhoneLineButton.hpp" - -#include <qevent.h> -#include <qtimer.h> - - -PhoneLineButton::PhoneLineButton(const QString &released, - const QString &pressed, - unsigned int line, - QWidget *parent) - : JPushButton(released, pressed, parent) - , mLine(line) - , mFace(0) -{ - mTimer = new QTimer(this); - connect(mTimer, SIGNAL(timeout()), - this, SLOT(swap())); -} - -void -PhoneLineButton::suspend() -{ - if(isPressed()) { - mFace = 1; - } - else { - mFace = 0; - } - swap(); - mTimer->start(500); -} - -void -PhoneLineButton::swap() -{ - mFace = (mFace + 1) % 2; - resize(mImages[mFace].size()); - setPixmap(mImages[mFace]); -} - -void -PhoneLineButton::press() -{ - mTimer->stop(); - JPushButton::press(); -} - -void -PhoneLineButton::release() -{ - mTimer->stop(); - JPushButton::release(); -} - -void -PhoneLineButton::mouseReleaseEvent (QMouseEvent *e) -{ - switch (e->button()) { - case Qt::LeftButton: - // Emulate the left mouse click - if (this->rect().contains(e->pos())) { - emit clicked(mLine); - } - else { - release(); - } - break; - - default: - e->ignore(); - break; - } -} diff --git a/src/gui/official/PhoneLineButton.hpp b/src/gui/official/PhoneLineButton.hpp deleted file mode 100644 index e49efc22a7c23e93f23d79332a4bcfb08c810f18..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLineButton.hpp +++ /dev/null @@ -1,51 +0,0 @@ - -#ifndef __PHONELINEBUTTON_HPP__ -#define __PHONELINEBUTTON_HPP__ - -#include <qlabel.h> -#include <qobject.h> -#include <qpixmap.h> - -#include "JPushButton.hpp" - -class QTimer; - - -/** - * This class Emulate a PushButton but takes two - * images to display its state. - */ -class PhoneLineButton : public JPushButton -{ - Q_OBJECT - -public: - PhoneLineButton(const QString &released, - const QString &pressed, - unsigned int line, - QWidget *parent); - - virtual ~PhoneLineButton(){} - -signals: - void clicked(unsigned int); - -public slots: - virtual void suspend(); - virtual void press(); - virtual void release(); - -private slots: - void swap(); - -protected: - void mouseReleaseEvent(QMouseEvent *); - -private: - unsigned int mLine; - QTimer *mTimer; - unsigned int mFace; - -}; - -#endif // defined(__J_PUSH_BUTTON_H__) diff --git a/src/gui/official/PhoneLineLocker.cpp b/src/gui/official/PhoneLineLocker.cpp deleted file mode 100644 index 022b6846de2cdf30265a6596a4cae939dd2727a5..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLineLocker.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "PhoneLineLocker.hpp" -#include "PhoneLine.hpp" - -PhoneLineLocker::PhoneLineLocker(PhoneLine *line, bool lock) - : mPhoneLine(line) -{ - if(mPhoneLine && lock) { - mPhoneLine->lock(); - } -} - -PhoneLineLocker::~PhoneLineLocker() -{ - if(mPhoneLine) { - mPhoneLine->unlock(); - } -} - - diff --git a/src/gui/official/PhoneLineLocker.hpp b/src/gui/official/PhoneLineLocker.hpp deleted file mode 100644 index 2d7a6f2e6fd29cc45ef12763ee6b9d0785abb76d..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLineLocker.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SFLPHONEGUI_PHONELINELOCKER_HPP -#define SFLPHONEGUI_PHONELINELOCKER_HPP - -class PhoneLine; - -/** - * This class is used as a Lock. It means - * that it will lock a phone line on its - * constructor, and unlock it in its - * destructor. This is generaly used to - * be exception safe. - */ -class PhoneLineLocker -{ -public: - /** - * Retreive the "line" PhoneLine and - * locks it. - */ - PhoneLineLocker(PhoneLine *line, bool lock = true); - - /** - * Unlock the currently locked PhoneLine. - */ - ~PhoneLineLocker(); - -private: - PhoneLine *mPhoneLine; -}; - -#endif diff --git a/src/gui/official/PhoneLineManager.hpp b/src/gui/official/PhoneLineManager.hpp deleted file mode 100644 index 3d166fdafa34fd7091bbdc65177cb15015de41b2..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLineManager.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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 __PHONELINEMANAGER_HPP__ -#define __PHONELINEMANAGER_HPP__ - -#include "utilspp/Singleton.hpp" -#include "PhoneLineManagerImpl.hpp" - -typedef utilspp::SingletonHolder< PhoneLineManagerImpl > PhoneLineManager; - -#endif - diff --git a/src/gui/official/PhoneLineManagerImpl.cpp b/src/gui/official/PhoneLineManagerImpl.cpp deleted file mode 100644 index 5e7b30a32803c1f1ae241d57d64b1d6f2c3411c3..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLineManagerImpl.cpp +++ /dev/null @@ -1,577 +0,0 @@ -#include <iostream> -#include <stdexcept> - -#include "globals.h" - -#include "CallStatusFactory.hpp" -#include "SFLEvents.hpp" -#include "SFLCallStatus.hpp" -#include "PhoneLine.hpp" -#include "PhoneLineLocker.hpp" -#include "PhoneLineManager.hpp" - -PhoneLineManagerImpl::PhoneLineManagerImpl() - : mSession(NULL) - , mAccount(NULL) - , mCurrentLine(NULL) - , mIsInitialized(false) - , mVolume(-1) - , mMicVolume(-1) -{ - EventFactory::instance().registerDefaultEvent< DefaultEvent >(); - // TODO: 000 - EventFactory::instance().registerEvent< CallRelatedEvent >("000"); - EventFactory::instance().registerEvent< IncommingEvent >("001"); - EventFactory::instance().registerEvent< HangupEvent >("002"); - // TODO: 020 - EventFactory::instance().registerEvent< CallRelatedEvent >("020"); - EventFactory::instance().registerEvent< VolumeEvent >("021"); - EventFactory::instance().registerEvent< MicVolumeEvent >("022"); - EventFactory::instance().registerEvent< TryingStatus >("110"); - EventFactory::instance().registerEvent< RingingStatus >("111"); - EventFactory::instance().registerEvent< HoldStatus >("112"); - EventFactory::instance().registerEvent< EstablishedStatus >("113"); - EventFactory::instance().registerEvent< BusyStatus >("114"); - EventFactory::instance().registerEvent< CongestionStatus >("115"); - EventFactory::instance().registerEvent< WrongNumberStatus >("116"); - QObject::connect(this, SIGNAL(disconnected()), - this, SLOT(closeSession())); - QObject::connect(this, SIGNAL(readyToHandleEvents()), - this, SLOT(handleEvents())); - QObject::connect(this, SIGNAL(connected()), - this, SIGNAL(readyToSendStatus())); - QObject::connect(this, SIGNAL(readyToSendStatus()), - this, SLOT(startSession())); - -} - -PhoneLineManagerImpl::~PhoneLineManagerImpl() -{ - delete mSession; - delete mAccount; - for(std::vector< PhoneLine * >::iterator pos = mPhoneLines.begin(); - pos != mPhoneLines.end(); - pos++) { - delete *pos; - } -} - -void -PhoneLineManagerImpl::initialize() -{ - if(!mIsInitialized) { - mIsInitialized = true; - mSession = new Session(); - mAccount = new Account(mSession->getDefaultAccount()); - } -} - -void -PhoneLineManagerImpl::start() -{ - isInitialized(); - - emit globalStatusSet(QString(tr("Trying to connect to sflphone server.."))); - mSession->connect(); -} - -void PhoneLineManagerImpl::isInitialized() -{ - if(!mIsInitialized) { - throw std::logic_error("Trying to use PhoneLineManager without prior initialize."); - } -} - -void -PhoneLineManagerImpl::connect() -{ - isInitialized(); - - emit globalStatusSet(QString(tr("Trying to connect to sflphone server.."))); - mSession->connect(); -} - -void -PhoneLineManagerImpl::startSession() -{ - isInitialized(); - - closeSession(); - emit globalStatusSet(QString(tr("Trying to get line status..."))); - mSession->getCallStatus(); -} - -void -PhoneLineManagerImpl::handleEvents() -{ - isInitialized(); - - emit globalStatusSet(QString(tr("SFLPhone is ready to serve you, master."))); - mSession->getEvents(); - mSession->list("audiodevice"); -} - - -void -PhoneLineManagerImpl::closeSession() -{ - isInitialized(); - - mCurrentLine = NULL; - - unsigned int i = 0; - while(i < mPhoneLines.size()) { - mPhoneLines[i]->disconnect(); - i++; - } - - emit lineStatusSet(""); - emit bufferStatusSet(""); - emit actionSet(""); - emit globalStatusSet("Disconnected."); -} - - -PhoneLine * -PhoneLineManagerImpl::getCurrentLine() -{ - isInitialized(); - - return mCurrentLine; -} - -void -PhoneLineManagerImpl::setNbLines(unsigned int nb) -{ - isInitialized(); - - mPhoneLines.clear(); - for(unsigned int i = 0; i < nb; i++) { - PhoneLine *p = new PhoneLine(*mSession, *mAccount, i + 1); - QObject::connect(p, SIGNAL(lineStatusChanged(QString)), - this, SIGNAL(unselectedLineStatusSet(QString))); - mPhoneLines.push_back(p); - } -} - -PhoneLine * -PhoneLineManagerImpl::getNextAvailableLine() -{ - isInitialized(); - - PhoneLine *selectedLine = NULL; - PhoneLine *current = mCurrentLine; - - - unsigned int i = 0; - while(i < mPhoneLines.size() && !selectedLine) { - if(mPhoneLines[i]->isAvailable() && - mPhoneLines[i] != current) { - selectedLine = mPhoneLines[i]; - } - else { - i++; - } - } - - return selectedLine; -} - -PhoneLine * -PhoneLineManagerImpl::getLine(const Call &call) -{ - isInitialized(); - - PhoneLine *selectedLine = NULL; - - unsigned int i = 0; - while(i < mPhoneLines.size() && !selectedLine) { - if(mPhoneLines[i]->getCallId() == call.id()) { - selectedLine = mPhoneLines[i]; - } - else { - i++; - } - } - - return selectedLine; -} - -PhoneLine * -PhoneLineManagerImpl::getLine(unsigned int line) -{ - isInitialized(); - - PhoneLine *selectedLine = NULL; - - if(line < mPhoneLines.size()) { - selectedLine = mPhoneLines[line]; - } - - return selectedLine; -} - -void -PhoneLineManagerImpl::select(PhoneLine *line, bool hardselect) -{ - if(line && (mCurrentLine != line)) { - unselect(); - - QObject::disconnect(line, SIGNAL(lineStatusChanged(QString)), - this, SIGNAL(unselectedLineStatusSet(QString))); - QObject::connect(line, SIGNAL(lineStatusChanged(QString)), - this, SIGNAL(lineStatusSet(QString))); - QObject::connect(line, SIGNAL(actionChanged(QString)), - this, SIGNAL(actionSet(QString))); - QObject::connect(line, SIGNAL(bufferStatusChanged(QString)), - this, SIGNAL(bufferStatusSet(QString))); - - - mCurrentLine = line; - mCurrentLine->select(hardselect); - if(mCurrentLine->isAvailable() && !hardselect) { - mSession->playTone(); - } - emit lineStatusSet(mCurrentLine->getLineStatus()); - emit bufferStatusSet(mCurrentLine->getBuffer()); - } -} - -void -PhoneLineManagerImpl::unselect() -{ - if(mCurrentLine) { - QObject::disconnect(mCurrentLine, SIGNAL(lineStatusChanged(QString)), - this, SIGNAL(lineStatusSet(QString))); - QObject::disconnect(mCurrentLine, SIGNAL(actionChanged(QString)), - this, SIGNAL(actionSet(QString))); - QObject::disconnect(mCurrentLine, SIGNAL(bufferStatusChanged(QString)), - this, SIGNAL(bufferStatusSet(QString))); - QObject::connect(mCurrentLine, SIGNAL(lineStatusChanged(QString)), - this, SIGNAL(unselectedLineStatusSet(QString))); - if(mCurrentLine->isAvailable()) { - mSession->stopTone(); - } - mCurrentLine->unselect(); - mCurrentLine = NULL; - } -} - -PhoneLine * -PhoneLineManagerImpl::selectNextAvailableLine() -{ - isInitialized(); - - PhoneLine *selectedLine = getNextAvailableLine(); - - // If we found one available line. - if(selectedLine) { - unselect(); - select(selectedLine); - } - - return selectedLine; -} - - - -PhoneLine * -PhoneLineManagerImpl::getPhoneLine(unsigned int line) -{ - isInitialized(); - - if(mPhoneLines.size() <= line) { - throw std::runtime_error("Trying to get an invalid Line"); - } - - return mPhoneLines[line]; -} - -PhoneLine * -PhoneLineManagerImpl::getPhoneLine(const QString &callId) -{ - isInitialized(); - - PhoneLine *selectedLine = NULL; - - unsigned int i = 0; - while(i < mPhoneLines.size() && - !selectedLine) { - if(mPhoneLines[i]->getCallId() == callId) { - selectedLine = mPhoneLines[i]; - } - else { - i++; - } - } - - return selectedLine; -} - - -void -PhoneLineManagerImpl::sendKey(Qt::Key c) -{ - isInitialized(); - - PhoneLine *selectedLine = getCurrentLine(); - - // Only digits that select a line if there's - // no current line. - if (!selectedLine && QChar(c).isDigit()) { - selectedLine = selectNextAvailableLine(); - } - - if(selectedLine) { - selectedLine->sendKey(c); - } -} - - -void -PhoneLineManagerImpl::selectLine(const QString &callId, bool hardselect) -{ - isInitialized(); - - PhoneLine *selectedLine = NULL; - unsigned int line = 0; - while(!selectedLine && line < mPhoneLines.size()) { - if(mPhoneLines[line]->getCallId() == callId) { - selectedLine = mPhoneLines[line]; - } - else { - line++; - } - } - - if(selectedLine) { - selectLine(line, hardselect); - } - else { - DebugOutput::instance() << QObject::tr("PhoneLineManager: Tried to selected line with call ID (%1), " - "which appears to be invalid.\n").arg(callId); - } -} - -/** - * Warning: This function might 'cause a problem if - * we select 2 line in a very short time. - */ -void -PhoneLineManagerImpl::selectLine(unsigned int line, bool hardselect) -{ - isInitialized(); - - PhoneLine *selectedLine = NULL; - // getting the wanted line; - { - if(mPhoneLines.size() > line) { - selectedLine = mPhoneLines[line]; - } - } - - if(selectedLine != NULL) { - PhoneLine *oldLine = mCurrentLine; - - if(oldLine != selectedLine) { - select(selectedLine, hardselect); - } - } - else { - DebugOutput::instance() << QObject::tr("PhoneLineManager: Tried to selected line %1, " - "which appears to be invalid.\n").arg(line); - } -} - -void -PhoneLineManagerImpl::call(const QString &to) -{ - PhoneLine *current = getCurrentLine(); - if(current) { - current->call(to); - } -} - - -void -PhoneLineManagerImpl::call() -{ - PhoneLine *current = getCurrentLine(); - if(current) { - current->call(); - } -} - -void -PhoneLineManagerImpl::hold() -{ - PhoneLine *selectedLine = mCurrentLine; - mCurrentLine = NULL; - - if(selectedLine) { - if(selectedLine->isAvailable()) { - mSession->stopTone(); - } - selectedLine->hold(); - } -} - -void -PhoneLineManagerImpl::hangup(bool sendrequest) -{ - PhoneLine *selectedLine = mCurrentLine; - mCurrentLine = NULL; - - if(selectedLine) { - if(selectedLine->isAvailable()) { - mSession->stopTone(); - } - selectedLine->hangup(sendrequest); - lineStatusSet(""); - } -} - -void -PhoneLineManagerImpl::mute(bool muting) -{ - if(muting) { - mute(); - } - else { - unmute(); - } -} - -void -PhoneLineManagerImpl::mute() -{ - isInitialized(); - - mSession->mute(); -} - -void -PhoneLineManagerImpl::setup() -{ - isInitialized(); - - mSession->configGetAll(); -} - -void -PhoneLineManagerImpl::unmute() -{ - isInitialized(); - - mSession->unmute(); -} - -void -PhoneLineManagerImpl::hangup(const QString &callId, bool sendrequest) -{ - PhoneLine *selectedLine = getPhoneLine(callId); - hangup(selectedLine, sendrequest); -} - -void -PhoneLineManagerImpl::hangup(unsigned int line, bool sendrequest) -{ - PhoneLine *selectedLine = getPhoneLine(line); - hangup(selectedLine, sendrequest); -} - -void -PhoneLineManagerImpl::hangup(PhoneLine *line, bool sendrequest) -{ - if(line) { - line->hangup(sendrequest); - if(mCurrentLine == line) { - unselect(); - } - } -} - -void -PhoneLineManagerImpl::clear() -{ - PhoneLine *selectedLine = mCurrentLine; - - if(selectedLine) { - selectedLine->clear(); - } -} - -void -PhoneLineManagerImpl::incomming(const QString &accountId, - const QString &callId, - const QString &peer) -{ - Call call(mSession->id(), accountId, callId, true); - PhoneLine *line = addCall(call, peer, QObject::tr("Incomming")); - if(line) { - line->setLineStatus(QObject::tr("Ringing (%1)...").arg(peer)); - } -} - -PhoneLine * -PhoneLineManagerImpl::addCall(const QString &accountId, - const QString &callId, - const QString &peer, - const QString &state) -{ - return addCall(Call(mSession->id(), accountId, callId), peer, state); -} - -PhoneLine * -PhoneLineManagerImpl::addCall(Call call, - const QString &peer, - const QString &state) -{ - PhoneLine *selectedLine = getNextAvailableLine(); - - if(selectedLine) { - selectedLine->incomming(call); - selectedLine->setPeer(peer); - selectedLine->setLineStatus(state); - } - else { - DebugOutput::instance() << QObject::tr("PhoneLineManager: There's no available lines" - "here for the incomming call ID: %1.\n") - .arg(call.id()); - call.notAvailable(); - } - - return selectedLine; -} - -void -PhoneLineManagerImpl::updateVolume(int volume) -{ - mVolume = volume; - emit volumeUpdated((unsigned int)volume); -} - -void -PhoneLineManagerImpl::updateMicVolume(int volume) -{ - mMicVolume = volume; - emit micVolumeUpdated((unsigned int)volume); -} - -void -PhoneLineManagerImpl::setVolume(int volume) -{ - if(mVolume != volume) { - mSession->volume(volume); - updateVolume(volume); - } -} - -void -PhoneLineManagerImpl::setMicVolume(int volume) -{ - if(mMicVolume != volume) { - mSession->micVolume(volume); - updateMicVolume(volume); - } -} diff --git a/src/gui/official/PhoneLineManagerImpl.hpp b/src/gui/official/PhoneLineManagerImpl.hpp deleted file mode 100644 index efdf39cf5d77a1b7ae4203fed0ee665a1093d8e2..0000000000000000000000000000000000000000 --- a/src/gui/official/PhoneLineManagerImpl.hpp +++ /dev/null @@ -1,291 +0,0 @@ -#ifndef __PHONELINEMANAGERIMPL_HPP__ -#define __PHONELINEMANAGERIMPL_HPP__ - -//#include <qt.h> -#include <qobject.h> -#include <utility> -#include <vector> - -class PhoneLine; - -#include "Account.hpp" -#include "Call.hpp" -#include "EventFactory.hpp" -#include "Session.hpp" - -/** - * This is the class that manages phone lines - */ -class PhoneLineManagerImpl : public QObject -{ - Q_OBJECT - -public: - PhoneLineManagerImpl(); - ~PhoneLineManagerImpl(); - - /** - * Will return the PhoneLine linked to the line - * number. - */ - PhoneLine *getPhoneLine(unsigned int line); - - /** - * Will return the PhoneLine with the call ID. - * If there's no PhoneLine of call ID, it will - * return NULL. - */ - PhoneLine *getPhoneLine(const QString &callId); - - PhoneLine *getCurrentLine(); - - void setNbLines(unsigned int line); - -signals: - void unselected(unsigned int); - void selected(unsigned int); - void connected(); - void disconnected(); - void readyToSendStatus(); - void readyToHandleEvents(); - void gotErrorOnGetEvents(QString); - void gotErrorOnCallStatus(QString); - void globalStatusSet(QString); - void bufferStatusSet(QString); - void actionSet(QString); - void unselectedLineStatusSet(QString); - void lineStatusSet(QString); - - void volumeUpdated(int); - void micVolumeUpdated(int); - -public slots: - /** - * You need to call this function once. It must be - * call before doing anything in this class. - * - * NOTE: You need to set the creator to SessionIOFactory - * before calling this function. - */ - void initialize(); - - /** - * This function will make the process to start. - * It will connect to the server, and start the - * event handling. - */ - void start(); - - /** - * This will ask the session to connect - * to the sflphone server. - */ - void connect(); - - void sendKey(Qt::Key c); - - /** - * This function will put the current line - * on hold. If there's no current line, - * it will do nothing. - */ - void hold(); - - /** - * This function will hanp up the current line - * If there's no current line, it will do nothing. - */ - void hangup(bool sendrequest = true); - - /** - * This function will mute the microphone if muting - * is true, it will unmute otherwise. - */ - void mute(bool); - - /** - * This function will mute the microphone - */ - void mute(); - - /** - * This function will unmute the microphone - */ - void unmute(); - - void setup(); - - /** - * This function will hanp up the line number given - * argument. Be aware that the first line is 1, not - * zero. - */ - void hangup(unsigned int line, bool sendrequest = true); - - /** - * This function will hanp up the line with the - * following call ID. If there's no line with - * the call ID, it will do nothing. - */ - void hangup(const QString &callId, bool sendrequest = true); - - /** - * This function will hanp up the given line. If the - * line is NULL, nothing will be done. - */ - void hangup(PhoneLine *line, bool sendrequest = true); - - /** - * This function will make a call on the - * current line. If there's no selected - * line, it will choose the first available. - */ - void call(const QString &to); - - /** - * This function will add an incomming call - * on a phone line. - */ - void incomming(const QString &accountId, - const QString &callId, - const QString &peer); - - /** - * This function is used to add a call on a - * phone line. - */ - PhoneLine *addCall(Call call, - const QString &peer, - const QString &state); - PhoneLine *addCall(const QString &accountId, - const QString &callId, - const QString &peer, - const QString &state); - - /** - * This function will make a call on the - * current line. If there's no selected - * line. It will do nothing. It will call - * the destination contained in the - * PhoneLine buffer, if any. - */ - void call(); - - /** - * This function will switch the lines. If the line - * is invalid, it just do nothing. - */ - void selectLine(unsigned int line, - bool hardselect = false); - - /** - * This function will switch the line to the line having - * the given call id. If the line is invalid, it just do - * nothing. - */ - void selectLine(const QString &callId, - bool hardselect = false); - - /** - * This function will clear the buffer of the active - * line. If there's no active line, it will do nothing. - */ - void clear(); - - /** - * This function will return the next available line. - * The line is locked, So you'll need to unlock it. - */ - PhoneLine *getNextAvailableLine(); - - /** - * This function will return the PhoneLine with the - * given id. If there's no such line, it will return - * NULL. The line is locked, So you'll need to unlock it. - */ - PhoneLine *getLine(unsigned int line); - - /** - * This function will return the PhoneLine with the - * given call id. If there's no such line, it will - * return NULL. The line is locked, So you'll need to - * unlock it. - */ - PhoneLine *getLine(const Call &call); - - /** - * This function will return the next available line. - * The line is NOT locked. - */ - PhoneLine *selectNextAvailableLine(); - - /** - * This function will send the getevents request - * to the server. - * - * NOTE: This function MUST be called AFTER getcallstatus's - * completion. - */ - void handleEvents(); - - /** - * This function will simply signal the volume change. - */ - void updateVolume(int volume); - - /** - * This function will send a request to sflphoned - * to change the volume to the given percentage. - */ - void setVolume(int volume); - - /** - * This function will simply signal the mic volume change. - */ - void updateMicVolume(int volume); - - /** - * This function will send a request to sflphoned - * to change the mic volume to the given percentage. - */ - void setMicVolume(int volume); - - void errorOnGetEvents(const QString &message) - {emit gotErrorOnGetEvents(message);} - - void errorOnCallStatus(const QString &message) - {emit gotErrorOnCallStatus(message);} - - private slots: - /** - * This will send all the command needed when a - * connection has just been established. - */ - void startSession(); - - /** - * This function is called when we are disconnected - * from the server. This will unselect all phone lines. - */ - void closeSession(); - - -private: - void isInitialized(); - void select(PhoneLine *line, bool hardselect = false); - void unselect(); - -private: - Session *mSession; - Account *mAccount; - - std::vector< PhoneLine * > mPhoneLines; - PhoneLine *mCurrentLine; - bool mIsInitialized; - - int mVolume; - int mMicVolume; -}; - - -#endif diff --git a/src/gui/official/QjListBoxPixmap.cpp b/src/gui/official/QjListBoxPixmap.cpp deleted file mode 100644 index ab57fd5e9b71b56070f896ea05b444af95bd8728..0000000000000000000000000000000000000000 --- a/src/gui/official/QjListBoxPixmap.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - 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() ); -} diff --git a/src/gui/official/QjListBoxPixmap.hpp b/src/gui/official/QjListBoxPixmap.hpp deleted file mode 100644 index d8839e30f48f521a40ee9d99d04b9a9c6f607584..0000000000000000000000000000000000000000 --- a/src/gui/official/QjListBoxPixmap.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - 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 diff --git a/src/gui/official/Request.cpp b/src/gui/official/Request.cpp deleted file mode 100644 index 4d981e687361b5bbd950afed863275fd789056ba..0000000000000000000000000000000000000000 --- a/src/gui/official/Request.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/** - * 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 <Url.hpp> -#include <sstream> - -#include "globals.h" -#include "DebugOutput.hpp" -#include "CallManager.hpp" -#include "Request.hpp" -#include "Requester.hpp" - -Request::Request(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : mSequenceId(sequenceId) - , mCommand(command) - , mArgs(args) -{} - -std::list< QString > -Request::parseArgs(const QString &message) -{ - std::istringstream stream(message); - std::string s; - std::list< QString > args; - while(stream.good()) { - stream >> s; - QString qs(s); - Url::decode(qs); - args.push_back(qs); - } - - return args; -} - -void -Request::onError(const QString &code, const QString &message) -{ - DebugOutput::instance() << QObject::tr("Received an error:\n " - "Code: %1\n " - "SequenceID: %2\n Message: %3\n") - .arg(code) - .arg(mSequenceId) - .arg(message); -} - -void -Request::onEntry(const QString &code, const QString &message) -{ - DebugOutput::instance() << QObject::tr("Received a temp info:\n " - "Code: %1\n " - "SequenceID: %2\n " - "Message: %3\n") - .arg(code) - .arg(mSequenceId) - .arg(message); -} - -void -Request::onSuccess(const QString &code, const QString &message) -{ - DebugOutput::instance() << QObject::tr("Received a success info:\n " - "Code: %1\n " - "SequenceID: %2\n " - "Message: %3\n") - .arg(code) - .arg(mSequenceId) - .arg(message); -} - -QString -Request::toString() -{ - QString output = mCommand + " " + mSequenceId; - for(std::list< QString >::const_iterator pos = mArgs.begin(); - pos != mArgs.end(); - pos++) { - output += " " + (*pos); - } - output += "\n"; - - return output; -} - - -CallRelatedRequest::CallRelatedRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : Request(sequenceId, command, args) -{ - if(args.begin() != args.end()) { - mCallId = *args.begin(); - } -} - -void -CallRelatedRequest::onError(const QString &code, const QString &message) -{ - if(CallManager::instance().exist(mCallId)) { - onError(CallManager::instance().getCall(mCallId), - code, - message); - } - else { - DebugOutput::instance() << QObject::tr("CallRelatedRequest: Trying to retreive an unregistred call (%1)\n").arg(mCallId); - } -} - -void -CallRelatedRequest::onError(Call, const QString &, const QString &) -{} - -void -CallRelatedRequest::onEntry(const QString &code, const QString &message) -{ - if(CallManager::instance().exist(mCallId)) { - onEntry(CallManager::instance().getCall(mCallId), - code, - message); - } - else { - DebugOutput::instance() << QObject::tr("CallRelatedRequest: Trying to retreive an unregistred call (%1)\n").arg(mCallId); - } -} - -void -CallRelatedRequest::onEntry(Call, const QString &, const QString &) -{} - -void -CallRelatedRequest::onSuccess(const QString &code, const QString &message) -{ - if(CallManager::instance().exist(mCallId)) { - onSuccess(CallManager::instance().getCall(mCallId), - code, - message); - } - else { - DebugOutput::instance() << QObject::tr("CallRelatedRequest: Trying to retreive an unregistred call (%1)\n").arg(mCallId); - } -} - -void -CallRelatedRequest::onSuccess(Call, const QString &, const QString &) -{} - -AccountRequest::AccountRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : Request(sequenceId, command, args) - , mAccountId(*args.begin()) -{} - -void -AccountRequest::onError(const QString &code, const QString &message) -{ - onError(Account(Requester::instance().getSessionIdFromSequenceId(getSequenceId()), - mAccountId), - code, - message); -} - -void -AccountRequest::onError(Account, const QString &, const QString &) -{} - -void -AccountRequest::onEntry(const QString &code, const QString &message) -{ - onEntry(Account(Requester::instance().getSessionIdFromSequenceId(getSequenceId()), - mAccountId), - code, - message); -} - -void -AccountRequest::onEntry(Account, const QString &, const QString &) -{} - -void -AccountRequest::onSuccess(const QString &code, const QString &message) -{ - onSuccess(Account(Requester::instance().getSessionIdFromSequenceId(getSequenceId()), - mAccountId), - code, - message); -} - -void -AccountRequest::onSuccess(Account, const QString &, const QString &) -{} - diff --git a/src/gui/official/Request.hpp b/src/gui/official/Request.hpp deleted file mode 100644 index 890e2912827472a065f80b84921f02ac81b61178..0000000000000000000000000000000000000000 --- a/src/gui/official/Request.hpp +++ /dev/null @@ -1,230 +0,0 @@ -/** - * 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_REQUEST_H -#define SFLPHONEGUI_REQUEST_H - -#include <list> -#include <qstring.h> - - -#include "Account.hpp" -#include "Call.hpp" - -class Request -{ - public: - Request(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - virtual ~Request(){} - - /** - * This function will parse the message and will cut the message - * in many arguments. - */ - static std::list< QString > parseArgs(const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. - */ - virtual void onError(const QString &code, const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - */ - virtual void onEntry(const QString &code, const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. - */ - virtual void onSuccess(const QString &code, const QString &message); - - /** - * This function will translate the function into a string. - * This is used for sending the request through a text channel. - */ - QString toString(); - - /** - * Return the sequence ID. - */ - QString getSequenceId() - {return mSequenceId;} - - /** - * Return the command. - */ - QString getCommand() - {return mCommand;} - - /** - * Return the args. - */ - std::list< QString > getArgs() - {return mArgs;} - - - private: - const QString mSequenceId; - const QString mCommand; - const std::list< QString > mArgs; -}; - -class CallRelatedRequest : public Request -{ - public: - CallRelatedRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. - */ - virtual void onError(Call call, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - */ - virtual void onEntry(Call call, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. - */ - virtual void onSuccess(Call call, - const QString &code, - const QString &message); - - private: - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. This function will call the onError, but with - * the call linked to this request. - */ - virtual void onError(const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the there's other answer to - * come. This function will call the onEntry, but with - * the call linked to this request. - */ - virtual void onEntry(const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. This function will call the onSuccess function, - * but with the call linked to this request. - */ - virtual void onSuccess(const QString &code, - const QString &message); - - - private: - QString mCallId; -}; - -class AccountRequest : public Request -{ - public: - AccountRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. - */ - virtual void onError(Account account, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - */ - virtual void onEntry(Account account, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. - */ - virtual void onSuccess(Account account, - const QString &code, - const QString &message); - - private: - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. This function will call the onError, but with - * the account linked to this request. - */ - virtual void onError(const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the there's other answer to - * come. This function will call the onEntry, but with - * the account linked to this request. - */ - virtual void onEntry(const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. This function will call the onSuccess function, - * but with the account linked to this request. - */ - virtual void onSuccess(const QString &code, - const QString &message); - - - private: - const QString mAccountId; -}; - -#endif diff --git a/src/gui/official/Requester.hpp b/src/gui/official/Requester.hpp deleted file mode 100644 index 2d6e4b20cdc268d4d78518684b4cfbf0c43300be..0000000000000000000000000000000000000000 --- a/src/gui/official/Requester.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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_REQUESTER_H -#define SFLPHONEGUI_REQUESTER_H - -#include "utilspp/Singleton.hpp" -#include "RequesterImpl.hpp" - -typedef utilspp::SingletonHolder< RequesterImpl > Requester; - -#endif - diff --git a/src/gui/official/RequesterImpl.cpp b/src/gui/official/RequesterImpl.cpp deleted file mode 100644 index 2c5bfa4bc6df7d81c74769b45444e1de243c5297..0000000000000000000000000000000000000000 --- a/src/gui/official/RequesterImpl.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/** - * 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 <qtextstream.h> -#include <iostream> -#include <stdexcept> -#include <sstream> - -#include "globals.h" -#include "DebugOutput.hpp" -#include "RequesterImpl.hpp" -#include "SessionIO.hpp" - -RequesterImpl::RequesterImpl() - : mCallIdCount(0) - , mSessionIdCount(0) - , mSequenceIdCount(0) -{} - -SessionIO * -RequesterImpl::getSessionIO(const QString &sessionId) -{ - std::map< QString, SessionIO * >::iterator pos = mSessions.find(sessionId); - if(pos == mSessions.end()) { - throw std::runtime_error("The session is not valid."); - } - - return (*pos).second; -} - -QString -RequesterImpl::send(const QString &sessionId, - const QString &command, - const std::list< QString > &args) -{ - // We retreive the internal of a session. - SessionIO *session = getSessionIO(sessionId); - - // We ask the factory to create the request. - QString sequenceId = generateSequenceId(); - Request *request = mRequestFactory.create(command, sequenceId, args); - - registerRequest(sessionId, sequenceId, request); - session->send(request->toString()); - - return sequenceId; -} - -void -RequesterImpl::registerRequest(const QString &sessionId, - const QString &sequenceId, - Request *request) -{ - if(mRequests.find(sequenceId) != mRequests.end()) { - throw std::logic_error("Registering an already know sequence ID"); - } - - mRequests.insert(std::make_pair(sequenceId, request)); - mSequenceToSession.insert(std::make_pair(sequenceId, sessionId)); -} - - -void -RequesterImpl::registerSession(const QString &id, - SessionIO *s) -{ - if(mSessions.find(id) != mSessions.end()) { - throw std::logic_error("Registering an already know Session ID"); - } - - mSessions.insert(std::make_pair(id, s)); -} - -void -RequesterImpl::connect(const QString &id) -{ - std::map< QString, SessionIO * >::iterator pos = mSessions.find(id); - if(pos == mSessions.end()) { - throw std::logic_error("Trying to connect an unknown session."); - } - - pos->second->connect(); -} - - -int -RequesterImpl::getCodeCategory(const QString &code) -{ - return code.toInt() / 100; -} - -void -RequesterImpl::receiveAnswer(const QString &answer) -{ - QString a(answer); - QString code; - QString seq; - QString message; - - QTextStream s(&a, IO_ReadOnly); - s >> code >> seq; - message = s.readLine(); - message.remove(0, 1); - receiveAnswer(code, seq, message); -} - - -void -RequesterImpl::receiveAnswer(const QString &code, - const QString &sequence, - const QString &message) -{ - int c = getCodeCategory(code); - - std::map< QString, Request * >::iterator pos; - pos = mRequests.find(sequence); - if(pos == mRequests.end()) { - DebugOutput::instance() << QObject::tr("Requester: We received an answer " - "with an unknown sequence (%1).\n") - .arg(sequence); - return; - } - - if(c <= 1) { - //Other answers will come for this request. - pos->second->onEntry(code, message); - } - else{ - //This is the final answer of this request. - if(c == 2) { - pos->second->onSuccess(code, message); - } - else { - pos->second->onError(code, message); - } - delete pos->second; - mRequests.erase(pos); - } -} - -QString -RequesterImpl::generateCallId() -{ - return QString("cCallID:%1").arg(mCallIdCount++); -} - -QString -RequesterImpl::generateSessionId() -{ - return QString("cSessionID:%1").arg(mSequenceIdCount++); -} - -QString -RequesterImpl::generateSequenceId() -{ - return QString("cSequenceID:%1").arg(mSequenceIdCount++); -} - -void -RequesterImpl::inputIsDown(const QString &sessionId) -{ - std::map< QString, SessionIO * >::iterator pos; - pos = mSessions.find(sessionId); - if(pos == mSessions.end()) { - // we will not thow an exception, but this is - // a logic error - DebugOutput::instance() << QObject::tr("Requester: SessionIO input for session %1 is down, " - "but we don't have that session.\n") - .arg(sessionId); - } -} diff --git a/src/gui/official/RequesterImpl.hpp b/src/gui/official/RequesterImpl.hpp deleted file mode 100644 index 61b802eeda32ed79d844e714525199093b8856a1..0000000000000000000000000000000000000000 --- a/src/gui/official/RequesterImpl.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/** - * 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_REQUESTERIMPL_H -#define SFLPHONEGUI_REQUESTERIMPL_H - -#include "Request.hpp" -#include "ObjectFactory.hpp" - -class AnswerReceiver; -class Call; -class SessionIO; - -class RequesterImpl -{ - public: - RequesterImpl(); - - /** - * Will send the command to the sflphone's server. - * This command is non-blocking. The command linked - * to this command will be executed. - */ - QString send(const QString &sessionId, - const QString &command, - const std::list< QString > &args); - - void receiveAnswer(const QString &answer); - void receiveAnswer(const QString &code, - const QString &sequence, - const QString &message); - - - static int getCodeCategory(const QString &code); - - /** - * Generate a unique call ID. - */ - QString generateCallId(); - - /** - * Generate a unique session ID. - */ - QString generateSessionId(); - - /** - * Generate a unique sequence ID. - */ - QString generateSequenceId(); - - /** - * Register the string to return a Actual type. - */ - template< typename Actual > - void registerObject(const QString &name); - - QString getSessionIdFromSequenceId(const QString &sequence) - {return mSequenceToSession[sequence];} - - /** - * Register the session. - */ - void registerSession(const QString &id, SessionIO *io); - - /** - * Will ask the session IO with id to connect. - */ - void connect(const QString &id); - - /** - * This function is used to notify that the SessionIO - * input of a session is down. It means that we no longer - * can receive answers. - * - * Note: Only SessionIO related classes should call this function. - */ - void inputIsDown(const QString &sessionId); - - /** - * This function is used to notify that the SessionIO - * output of a session is down. It means that we no longer - * can send requests. - * - * Note: Only SessionIO related classes should call this function. - */ - void outputIsDown(const QString &sessionId); - - private: - - /** - * Return the SessionIO instance related to - * the session ID. - */ - SessionIO *getSessionIO(const QString &sessionId); - - /** - * Register the string to return a Actual type. - */ - void registerRequest(const QString &sessionId, - const QString &sequenceId, - Request *request); - - - private: - ObjectFactory< Request > mRequestFactory; - std::map< QString, SessionIO * > mSessions; - std::map< QString, Request * > mRequests; - std::map< QString, QString > mSequenceToSession; - - - /** - * This is the integer used to generate the call IDs. - */ - unsigned long mCallIdCount; - unsigned long mSessionIdCount; - unsigned long mSequenceIdCount; -}; - -#include "RequesterImpl.inl" - -#endif diff --git a/src/gui/official/RequesterImpl.inl b/src/gui/official/RequesterImpl.inl deleted file mode 100644 index 47b5a11997a3fc079da1163e5ce09526c3b9fdd7..0000000000000000000000000000000000000000 --- a/src/gui/official/RequesterImpl.inl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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_REQUESTERIMPL_INL -#define SFLPHONEGUI_REQUESTERIMPL_INL - -template< typename Actual > -void -RequesterImpl::registerObject(const QString &name) -{ - mRequestFactory.registerObject< Actual >(name); -} - - -#endif diff --git a/src/gui/official/SFLCallStatus.hpp b/src/gui/official/SFLCallStatus.hpp deleted file mode 100644 index e322da49f9a06cdb7ebe0734326022828d93a15d..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLCallStatus.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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 __SFLCALLSTATUS_HPP__ -#define __SFLCALLSTATUS_HPP__ - -#include "CallStatus.hpp" - - -typedef CallStatus TryingStatus; -typedef CallStatus RingingStatus; -typedef CallStatus HoldStatus; -typedef CallStatus EstablishedStatus; -typedef CallStatus BusyStatus; -typedef CallStatus CongestionStatus; -typedef CallStatus WrongNumberStatus; - -#endif diff --git a/src/gui/official/SFLEvents.cpp b/src/gui/official/SFLEvents.cpp deleted file mode 100644 index 8f83c99c0048c17483004077b41c51409f3bdd17..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLEvents.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "globals.h" - -#include "PhoneLineManager.hpp" -#include "SFLEvents.hpp" - -DefaultEvent::DefaultEvent(const QString &code, - const std::list< QString > &args) - : Event(code, args) -{ -} - -void -DefaultEvent::execute() -{ - DebugOutput::instance() << QObject::tr("DefaultEvent: We don't handle: %1\n").arg(toString()); -} - - -HangupEvent::HangupEvent(const QString &code, - const std::list< QString > &args) - : CallRelatedEvent(code, args) -{} - -void -HangupEvent::execute() -{ - QString id = getCallId(); - if(id.length() > 0) { - DebugOutput::instance() << QObject::tr("Hangup Event received for call ID: %1.\n") - .arg(id); - PhoneLineManager::instance().hangup(id, false); - } - else { - DebugOutput::instance() << QObject::tr("Hangup Event invalid (missing call ID): %1\n") - .arg(toString()); - } -} - -IncommingEvent::IncommingEvent(const QString &code, - const std::list< QString > &args) - : CallRelatedEvent(code, args) -{ - std::list< QString > l = getUnusedArgs(); - if(l.size() >= 2) { - mAccountId = *l.begin(); - l.pop_front(); - mOrigin = *l.begin(); - l.pop_front(); - setUnusedArgs(l); - } -} - -void -IncommingEvent::execute() -{ - QString id = getCallId(); - if(id.length() > 0) { - DebugOutput::instance() << QObject::tr("Incomming Event received for call ID: %1.\n") - .arg(id); - PhoneLineManager::instance().incomming(mAccountId, getCallId(), mOrigin); - } - else { - DebugOutput::instance() << QObject::tr("Incomming Event invalid: %1\n") - .arg(toString()); - } -} - -VolumeEvent::VolumeEvent(const QString &code, - const std::list< QString > &args) - : Event(code, args) -{ - std::list< QString > l = getUnusedArgs(); - if(l.size() >= 1) { - mVolume = l.begin()->toUInt(); - l.pop_front(); - setUnusedArgs(l); - } -} - -void -VolumeEvent::execute() -{ - PhoneLineManager::instance().updateVolume(mVolume); -} - -MicVolumeEvent::MicVolumeEvent(const QString &code, - const std::list< QString > &args) - : VolumeEvent(code, args) -{} - -void -MicVolumeEvent::execute() -{ - PhoneLineManager::instance().updateMicVolume(mVolume); -} diff --git a/src/gui/official/SFLEvents.hpp b/src/gui/official/SFLEvents.hpp deleted file mode 100644 index b8ac753c4356f2473c80eecd9d601979643a4fba..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLEvents.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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 __SFLEVENTS_HPP__ -#define __SFLEVENTS_HPP__ - -#include "Event.hpp" - -class DefaultEvent : public Event -{ -public: - DefaultEvent(const QString &code, - const std::list< QString > &args); - - virtual void execute(); -}; - -class HangupEvent : public CallRelatedEvent -{ -public: - HangupEvent(const QString &code, - const std::list< QString > &args); - - virtual void execute(); -}; - -class IncommingEvent : public CallRelatedEvent -{ -public: - IncommingEvent(const QString &code, - const std::list< QString > &args); - - virtual void execute(); - -private: - QString mAccountId; - QString mOrigin; -}; - - -class VolumeEvent : public Event -{ -public: - VolumeEvent(const QString &code, - const std::list< QString > &args); - - virtual void execute(); - -protected: - unsigned int mVolume; -}; - -class MicVolumeEvent : public VolumeEvent -{ -public: - MicVolumeEvent(const QString &code, - const std::list< QString > &args); - - virtual void execute(); - -}; - -#endif diff --git a/src/gui/official/SFLLcd.cpp b/src/gui/official/SFLLcd.cpp deleted file mode 100644 index a65d72c5f6865f34cd0ee3fd008cda05c63bf98b..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLLcd.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include <qdatetime.h> -#include <qpainter.h> -#include <qevent.h> - -#include "globals.h" -#include "JPushButton.hpp" -#include "SFLLcd.hpp" -#include "TransparentWidget.hpp" - -#define FONT_FAMILY "Courier" -// Others fixed font support "Monospace", "Fixed", "MiscFixed" -#define FONT_SIZE 10 - -#define SCREEN "screen_main.png" -#define OVERSCREEN "overscreen.png" - -SFLLcd::SFLLcd(QWidget *parent) - : QLabel(parent, "SFLLcd", Qt::WNoAutoErase) - , mScreen(TransparentWidget::retreive(SCREEN)) - , mOverscreen(TransparentWidget::retreive(OVERSCREEN)) - , mGlobalStatusPos(-1) - , mUnselectedLineStatusPos(-1) - , mLineStatusPos(-1) - , mBufferStatusPos(-1) - , mActionPos(-1) - , mIsTimed(false) - , mFont(FONT_FAMILY, FONT_SIZE) -{ - resize(mScreen.size()); - move(22,44); - - mUnselectedLineTimer = new QTimer(this); - QObject::connect(mUnselectedLineTimer, SIGNAL(timeout()), - this, SLOT(updateGlobalText())); - - mTimer = new QTimer(this); - QObject::connect(mTimer, SIGNAL(timeout()), - this, SLOT(updateText())); - QObject::connect(mTimer, SIGNAL(timeout()), - this, SLOT(update())); - mTimer->start(100); -} - -void -SFLLcd::updateText() -{ - if(mGlobalStatusPos >= 0) { - mGlobalStatusPos++; - } - - if(mLineStatusPos >= 0) { - mLineStatusPos++; - } - - if(mBufferStatusPos >= 0) { - mBufferStatusPos++; - } - - if(mActionPos >= 0) { - mActionPos++; - } -} - -void -SFLLcd::updateGlobalText() -{ - mUnselectedLineStatus = ""; -} - -void -SFLLcd::startTiming() -{ - mIsTimed = true; - mTime.start(); -} - -void -SFLLcd::stopTiming() -{ - mIsTimed = false; -} - -void -SFLLcd::setGlobalStatus(QString global) -{ - if(textIsTooBig(global)) { - mGlobalStatusPos = 0; - } - else { - mGlobalStatusPos = -1; - } - mGlobalStatus = global; -} - -void -SFLLcd::setBufferStatus(QString buffer) -{ - if(textIsTooBig(buffer)) { - mBufferStatusPos = 0; - } - else { - mBufferStatusPos = -1; - } - mBufferStatus = buffer; -} - -void -SFLLcd::setLineStatus(QString line) -{ - if(textIsTooBig(line)) { - mLineStatusPos = 0; - } - else { - mLineStatusPos = -1; - } - mLineStatus = line; -} - -void -SFLLcd::setUnselectedLineStatus(QString line) -{ - if(textIsTooBig(line)) { - mUnselectedLineStatusPos = 0; - } - else { - mUnselectedLineStatusPos = -1; - } - mUnselectedLineStatus = line; - mUnselectedLineTimer->start(3000, true); -} - -void -SFLLcd::setAction(QString line) -{ - if(textIsTooBig(line)) { - mActionPos = 0; - } - else { - mActionPos = -1; - } - mAction = line; -} - -QString -SFLLcd::getTimeStatus() -{ - if(mIsTimed) { - int seconds = mTime.elapsed() / 1000 ; - return QTime(seconds / 60 / 60, seconds / 60, seconds % 60).toString("hh:mm:ss"); - } - else { - QTime t(QTime::currentTime()); - QString s; - if(t.second() % 2) { - s = t.toString("hh:mm"); - } - else { - s = t.toString("hh mm"); - } - - return s; - } -} - -void -SFLLcd::paintEvent(QPaintEvent *event) -{ - static QPixmap pixmap(size()); - - QRect rect = event->rect(); - QSize newSize = rect.size().expandedTo(pixmap.size()); - pixmap.resize(newSize); - pixmap.fill(this, rect.topLeft()); - QPainter p(&pixmap, this); - - // Painter settings - QFontMetrics fm(mFont); - - int *globalStatusPos; - QString globalStatus; - if(mUnselectedLineStatus.length() > 0) { - globalStatus = mUnselectedLineStatus; - globalStatusPos = &mUnselectedLineStatusPos; - } - else { - globalStatus = mGlobalStatus; - globalStatusPos = &mGlobalStatusPos; - } - - int margin = 2; - p.setFont(mFont); - p.drawPixmap(0,0, mScreen); - p.drawText(QPoint(margin, fm.height()), - extractVisibleText(globalStatus, *globalStatusPos)); - p.drawText(QPoint(margin, 2*fm.height()), - extractVisibleText(mLineStatus, mLineStatusPos)); - p.drawText(QPoint(margin, 3*fm.height()), - extractVisibleText(mAction, mActionPos)); - p.drawText(QPoint(margin, 4*fm.height()), - extractVisibleText(mBufferStatus, mBufferStatusPos)); - - p.drawText(QPoint(margin, mScreen.size().height() - margin), getTimeStatus()); - p.drawPixmap(0,0, mOverscreen); - p.end(); - - bitBlt(this, event->rect().topLeft(), &pixmap); -} - -bool -SFLLcd::textIsTooBig(const QString &text) -{ - QFontMetrics fm(mFont); - - int screenWidth = mScreen.width() - 4; - int textWidth = fm.boundingRect(text).width(); - - if(textWidth > screenWidth) { - return true; - } - else { - return false; - } -} - -QString -SFLLcd::extractVisibleText(const QString &text, int &pos) -{ - QFontMetrics fm(mFont); - QString tmp(text); - - int nbCharBetween = 8; - - if(pos > 0 && ((unsigned int)pos >= tmp.length() + nbCharBetween)) { - pos = 0; - } - - // Chop the text until it's not too big - if(textIsTooBig(tmp)) { - // We add automatiquely the space the the text again at - // the end. - tmp += QString().fill(QChar(' '), nbCharBetween); - tmp += text; - - if(pos == -1) { - pos = 0; - } - - tmp.remove(0, pos); - while(textIsTooBig(tmp)) { - tmp.remove(tmp.length() - 1, 1); - } - } - - return tmp; -} - diff --git a/src/gui/official/SFLLcd.hpp b/src/gui/official/SFLLcd.hpp deleted file mode 100644 index c286369fe7cec48a41da0d538214c813bdf0498e..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLLcd.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 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 __SFLLCD_HPP__ -#define __SFLLCD_HPP__ - -#include <qlabel.h> -#include <qobject.h> -#include <qpixmap.h> -#include <qdatetime.h> -#include <qtimer.h> - -class SFLLcd : public QLabel -{ - Q_OBJECT - -public: - SFLLcd(QWidget *parent = NULL); - - bool textIsTooBig(const QString &text); - -public slots: - virtual void paintEvent(QPaintEvent *event); - QString getTimeStatus(); - - void setGlobalStatus(QString global); - void setUnselectedLineStatus(QString line); - void setLineStatus(QString line); - void setAction(QString line); - void setBufferStatus(QString line); - - void startTiming(); - void stopTiming(); - void updateText(); - void updateGlobalText(); - QString extractVisibleText(const QString &text, int &pos); - -private: - QPixmap mScreen; - QPixmap mOverscreen; - - QString mGlobalStatus; - QString mUnselectedLineStatus; - QString mLineStatus; - QString mBufferStatus; - QString mAction; - int mGlobalStatusPos; - int mUnselectedLineStatusPos; - int mLineStatusPos; - int mBufferStatusPos; - int mActionPos; - - bool mIsTimed; - QTime mTime; - QTimer *mTimer; - QTimer *mUnselectedLineTimer; - - QFont mFont; -}; - -#endif diff --git a/src/gui/official/SFLPhoneApp.cpp b/src/gui/official/SFLPhoneApp.cpp deleted file mode 100644 index 5bcfe02c4aeee2c0f37fb83527e20fb72438bfe0..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLPhoneApp.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include "globals.h" - -#include "ConfigurationManager.hpp" -#include "PhoneLine.hpp" -#include "PhoneLineButton.hpp" -#include "Requester.hpp" -#include "SessionIOFactory.hpp" -#include "SFLLcd.hpp" -#include "SFLPhoneApp.hpp" -#include "SFLPhoneWindow.hpp" -#include "SFLRequest.hpp" -#include "TCPSessionIOCreator.hpp" -#include "VolumeControl.hpp" - - - -SFLPhoneApp::SFLPhoneApp(int argc, char **argv) - : QApplication(argc, argv) -{ - SessionIOFactory::instance().setCreator(new TCPSessionIOCreator(QString("localhost"), 3999)); - PhoneLineManager::instance().initialize(); - PhoneLineManager::instance().setNbLines(NB_PHONELINES); - Requester::instance().registerObject< Request >(QString("playtone")); - Requester::instance().registerObject< Request >(QString("stoptone")); - Requester::instance().registerObject< Request >(QString("playdtmf")); - Requester::instance().registerObject< ListRequest >(QString("list")); - - 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")); - Requester::instance().registerObject< PermanentRequest >(QString("notavailable")); - Requester::instance().registerObject< PermanentRequest >(QString("refuse")); - Requester::instance().registerObject< PermanentRequest >(QString("hangup")); - Requester::instance().registerObject< TemporaryRequest >(QString("unmute")); - Requester::instance().registerObject< TemporaryRequest >(QString("hold")); - Requester::instance().registerObject< TemporaryRequest >(QString("unhold")); - Requester::instance().registerObject< TemporaryRequest >(QString("senddtmf")); - Requester::instance().registerObject< Request >(QString("setspkrvolume")); - Requester::instance().registerObject< Request >(QString("setmicvolume")); - Requester::instance().registerObject< Request >(QString("mute")); -} - -void -SFLPhoneApp::initConnections(SFLPhoneWindow *w) -{ - // We connect the phone line buttons to the PhoneLineManager - unsigned int i = 0; - for(std::list< PhoneLineButton * >::iterator pos = w->mPhoneLineButtons.begin(); - pos != w->mPhoneLineButtons.end(); - pos++) { - PhoneLine *line = PhoneLineManager::instance().getPhoneLine(i); - QObject::connect(*pos, SIGNAL(clicked(unsigned int)), - &PhoneLineManager::instance(), SLOT(selectLine(unsigned int))); - QObject::connect(line, SIGNAL(selected()), - *pos, SLOT(press())); - QObject::connect(line, SIGNAL(unselected()), - *pos, SLOT(release())); - QObject::connect(line, SIGNAL(backgrounded()), - *pos, SLOT(suspend())); - - i++; - } - - QObject::connect(w->mOk, SIGNAL(clicked()), - &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()), - &PhoneLineManager::instance(), SLOT(hold())); - QObject::connect(w->mClear, SIGNAL(clicked()), - &PhoneLineManager::instance(), SLOT(clear())); - QObject::connect(w, SIGNAL(keyPressed(Qt::Key)), - &PhoneLineManager::instance(), SLOT(sendKey(Qt::Key))); - - // LCD Connections. - QObject::connect(&PhoneLineManager::instance(), SIGNAL(lineStatusSet(QString)), - w->mLcd, SLOT(setLineStatus(QString))); - QObject::connect(&PhoneLineManager::instance(), SIGNAL(unselectedLineStatusSet(QString)), - w->mLcd, SLOT(setUnselectedLineStatus(QString))); - QObject::connect(&PhoneLineManager::instance(), SIGNAL(actionSet(QString)), - w->mLcd, SLOT(setAction(QString))); - QObject::connect(&PhoneLineManager::instance(), SIGNAL(globalStatusSet(QString)), - w->mLcd, SLOT(setGlobalStatus(QString))); - QObject::connect(&PhoneLineManager::instance(), SIGNAL(bufferStatusSet(QString)), - w->mLcd, SLOT(setBufferStatus(QString))); - - - //Volume connections - QObject::connect(w->mVolume, SIGNAL(valueUpdated(int)), - &PhoneLineManager::instance(), SLOT(setVolume(int))); - QObject::connect(w->mMicVolume, SIGNAL(valueUpdated(int)), - &PhoneLineManager::instance(), SLOT(setMicVolume(int))); - QObject::connect(&PhoneLineManager::instance(), SIGNAL(volumeUpdated(int)), - w->mVolume, SLOT(setValue(int))); - QObject::connect(&PhoneLineManager::instance(), SIGNAL(micVolumeUpdated(int)), - w->mMicVolume, SLOT(setValue(int))); - - - - QObject::connect(&PhoneLineManager::instance(), SIGNAL(disconnected()), - w, SLOT(askReconnect())); - QObject::connect(w, SIGNAL(reconnectAsked()), - &PhoneLineManager::instance(), SLOT(connect())); - - QObject::connect(&PhoneLineManager::instance(), SIGNAL(gotErrorOnCallStatus(QString)), - w, SLOT(askResendStatus(QString))); - QObject::connect(&PhoneLineManager::instance(), SIGNAL(gotErrorOnGetEvents(QString)), - w, SLOT(askResendStatus(QString))); - QObject::connect(w, SIGNAL(resendStatusAsked()), - &PhoneLineManager::instance(), SIGNAL(readyToSendStatus())); - - QObject::connect(&ConfigurationManager::instance(), SIGNAL(updated()), - w, SLOT(showSetup())); - - -} - diff --git a/src/gui/official/SFLPhoneApp.hpp b/src/gui/official/SFLPhoneApp.hpp deleted file mode 100644 index 89bc30efff1f1be12bfc97dbc73c0eb76c8b8bfb..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLPhoneApp.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __SFLPHONEAPP_HPP__ -#define __SFLPHONEAPP_HPP__ - -#include <qapplication.h> - -#include "PhoneLineManager.hpp" -#include "Session.hpp" -#include "Account.hpp" - -class SFLPhoneWindow; - -class SFLPhoneApp : public QApplication -{ -public: - SFLPhoneApp(int argc, char **argv); - - /** - * This function will make the widgets - * connections. - */ - void initConnections(SFLPhoneWindow *w); - -}; - -#endif diff --git a/src/gui/official/SFLPhoneWindow.cpp b/src/gui/official/SFLPhoneWindow.cpp deleted file mode 100644 index eef33f514762590500e4cea3cf13946a5501c9fd..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLPhoneWindow.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include "SFLPhoneWindow.hpp" - -#include <qbitmap.h> - -//To test if we are in QT4 -#ifdef QT3_SUPPORT -#include <QIcon> -#endif - - -#include <qlabel.h> -#include <qmessagebox.h> -#include <qevent.h> -#include <qpixmap.h> -#include <iostream> - -#include "globals.h" -#include "JPushButton.hpp" -#include "PhoneLineButton.hpp" -#include "SFLLcd.hpp" -#include "VolumeControl.hpp" - -#define LOGO_IMAGE "logo_ico.png" -#define BACKGROUND_IMAGE "main.png" -#define HANGUP_RELEASED_IMAGE "hangup_off.png" -#define HANGUP_PRESSED_IMAGE "hangup_on.png" -#define HOLD_RELEASED_IMAGE "hold_off.png" -#define HOLD_PRESSED_IMAGE "hold_on.png" -#define OK_RELEASED_IMAGE "ok_off.png" -#define OK_PRESSED_IMAGE "ok_on.png" -#define CLEAR_RELEASED_IMAGE "clear_off.png" -#define CLEAR_PRESSED_IMAGE "clear_on.png" -#define MUTE_RELEASED_IMAGE "mute_off.png" -#define MUTE_PRESSED_IMAGE "mute_on.png" -#define VOLUME_IMAGE "volume.png" -#define CLOSE_RELEASED_IMAGE "close_off.png" -#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() -#ifdef QT3_SUPPORT - : QMainWindow(NULL, Qt::FramelessWindowHint) -#else - : QMainWindow(NULL, NULL, - Qt::WDestructiveClose | - Qt::WStyle_Customize | - Qt::WStyle_NoBorder) -#endif -{ - mSetupPanel = new ConfigurationPanel(this, "ConfigurationPanel"); - // Initialize the background image - mMain = new QLabel(this); - QPixmap main(JPushButton::transparize(BACKGROUND_IMAGE)); - mMain->setPixmap(main); - if(main.hasAlpha()) { - setMask(*main.mask()); - } - - resize(main.size()); - mMain->resize(main.size()); - - QPixmap logo(QPixmap::fromMimeSource(LOGO_IMAGE)); -#ifdef QIcon - setWindowIcon(QIcon(logo)); -#else - setIcon(logo); -#endif - - mLastPos = pos(); - - initGUIButtons(); - initWindowButtons(); - initLineButtons(); - initLCD(); -} - -SFLPhoneWindow::~SFLPhoneWindow() -{} - -void -SFLPhoneWindow::initLCD() -{ - mLcd = new SFLLcd(mMain); - mLcd->show(); -} - -void -SFLPhoneWindow::initGUIButtons() -{ - mHangup = new JPushButton(QString(HANGUP_RELEASED_IMAGE), - QString(HANGUP_PRESSED_IMAGE), - mMain); - mHangup->move(225,156); - - mHold = new JPushButton(QString(HOLD_RELEASED_IMAGE), - QString(HOLD_PRESSED_IMAGE), - mMain); - mHold->move(225,68); - - - mOk = new JPushButton(QString(OK_RELEASED_IMAGE), - QString(OK_PRESSED_IMAGE), - mMain); - mOk->move(225,182); - - mClear = new JPushButton(QString(CLEAR_RELEASED_IMAGE), - QString(CLEAR_PRESSED_IMAGE), - mMain); - mClear->move(225,130); - - mMute = new JPushButton(QString(MUTE_RELEASED_IMAGE), - QString(MUTE_PRESSED_IMAGE), - mMain); - 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); - mVolume->move(365,91); - QObject::connect(mVolume, SIGNAL(valueUpdated(int)), - this, SIGNAL(volumeUpdated(int))); - - mMicVolume = new VolumeControl(QString(VOLUME_IMAGE), - mMain); - mMicVolume->setOrientation(VolumeControl::Vertical); - mMicVolume->move(347,91); - QObject::connect(mVolume, SIGNAL(valueUpdated(int)), - this, SIGNAL(micVolumeUpdated(int))); - -} - -void -SFLPhoneWindow::initLineButtons() -{ - int xpos = 21; - int ypos = 151; - int offset = 31; - for(int i = 0; i < NB_PHONELINES; i++) { - PhoneLineButton *line = new PhoneLineButton(QString("l%1_off.png").arg(i + 1), - QString("l%1_on.png").arg(i + 1), - i, - mMain); - line->move(xpos, ypos); - xpos += offset; - mPhoneLineButtons.push_back(line); - } -} - -void SFLPhoneWindow::initWindowButtons() -{ - mCloseButton = new JPushButton(CLOSE_RELEASED_IMAGE, - CLOSE_PRESSED_IMAGE, - mMain); - QObject::connect(mCloseButton, SIGNAL(clicked()), - this, SLOT(close())); - mCloseButton->move(374,5); - mMinimizeButton = new JPushButton(MINIMIZE_RELEASED_IMAGE, - MINIMIZE_PRESSED_IMAGE, - mMain); - QObject::connect(mMinimizeButton, SIGNAL(clicked()), - this, SLOT(lower())); - mMinimizeButton->move(353,5); -} - -void -SFLPhoneWindow::keyPressEvent(QKeyEvent *e) { - // Misc. key - emit keyPressed(Qt::Key(e->key())); -} - -void -SFLPhoneWindow::askReconnect() -{ - int ret = QMessageBox::critical(NULL, - tr("SFLPhone disconnected"), - tr("The link between SFLPhone and SFLPhoned is broken.\n" - "Do you want to try to reconnect? If not, the application\n" - "will close. Be sure that sflphoned is running."), - QMessageBox::Retry | QMessageBox::Default, - QMessageBox::No | QMessageBox::Escape); - if (ret == QMessageBox::Retry) { - emit reconnectAsked(); - } - else { - close(); - } -} - -void -SFLPhoneWindow::showSetup() -{ - mSetupPanel->generate(); - mSetupPanel->show(); -} - -void -SFLPhoneWindow::askResendStatus(QString message) -{ - int ret = QMessageBox::critical(NULL, - tr("SFLPhone status error"), - tr("The server returned an error for the lines status.\n" - "\n%1\n\n" - "Do you want to try to resend this command? If not,\n" - "the application will close.").arg(message), - QMessageBox::Retry | QMessageBox::Default, - QMessageBox::No | QMessageBox::Escape); - if (ret == QMessageBox::Retry) { - emit resendStatusAsked(); - } - else { - close(); - } -} - -void -SFLPhoneWindow::mousePressEvent(QMouseEvent *e) -{ - mLastPos = e->pos(); -} - -void -SFLPhoneWindow::mouseMoveEvent(QMouseEvent *e) -{ - // Note that moving the windows is very slow - // 'cause it redraw the screen each time. - // Usually it doesn't. We could do it by a timer. - move(e->globalPos() - mLastPos); -} diff --git a/src/gui/official/SFLPhoneWindow.hpp b/src/gui/official/SFLPhoneWindow.hpp deleted file mode 100644 index 0da1fa60caa6c99d13ab65d4350d278a9dc4568b..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLPhoneWindow.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#include <qlabel.h> -#include <qmainwindow.h> -#include <qobject.h> -#include <qpoint.h> -#include <list> - -#include "ConfigurationPanel.h" - -class JPushButton; -class PhoneLineButton; -class SFLLcd; -class VolumeControl; - -class SFLPhoneWindow : public QMainWindow -{ - Q_OBJECT; - - friend class SFLPhoneApp; - -public: - SFLPhoneWindow(); - ~SFLPhoneWindow(); - -private: - void initLCD(); - void initGUIButtons(); - void initLineButtons(); - void initWindowButtons(); - -signals: - void keyPressed(Qt::Key); - void reconnectAsked(); - void resendStatusAsked(); - void volumeUpdated(int); - void micVolumeUpdated(int); - -public slots: - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - - /** - * This function will prompt a message box, to ask - * if the user want to reconnect to sflphoned. - */ - void askReconnect(); - - /** - * This function will prompt a message box, to ask - * if the user want to resend the getcallstatus request. - */ - void askResendStatus(QString); - - void showSetup(); - -protected: - void keyPressEvent(QKeyEvent *e); - -private: - std::list< PhoneLineButton * > mPhoneLineButtons; - - JPushButton *mCloseButton; - JPushButton *mMinimizeButton; - - JPushButton *mHangup; - JPushButton *mHold; - JPushButton *mOk; - JPushButton *mClear; - JPushButton *mMute; - JPushButton *mSetup; - - VolumeControl *mVolume; - VolumeControl *mMicVolume; - - SFLLcd *mLcd; - QLabel *mMain; - - QPoint mLastPos; - - ConfigurationPanel *mSetupPanel; -}; diff --git a/src/gui/official/SFLPhoneWindow.ui b/src/gui/official/SFLPhoneWindow.ui deleted file mode 100644 index 1a78dddbbfefadf1bb41f1b493dcf807c3efced9..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLPhoneWindow.ui +++ /dev/null @@ -1,63 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>SFLPhoneWindow</class> - <widget class="QMainWindow" name="SFLPhoneWindow" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>395</width> - <height>219</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle" > - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralWidget" > - <widget class="QPushButton" name="pushButton" > - <property name="geometry" > - <rect> - <x>260</x> - <y>80</y> - <width>91</width> - <height>31</height> - </rect> - </property> - <property name="text" > - <string/> - </property> - </widget> - <widget class="QLabel" name="label" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>395</width> - <height>219</height> - </rect> - </property> - <property name="text" > - <string/> - </property> - <property name="pixmap" > - <pixmap resource="sflphone.qrc" >:/images/images/main.png</pixmap> - </property> - </widget> - </widget> - </widget> - <pixmapfunction></pixmapfunction> - <resources> - <include location="sflphone.qrc" /> - </resources> - <connections/> -</ui> diff --git a/src/gui/official/SFLRequest.cpp b/src/gui/official/SFLRequest.cpp deleted file mode 100644 index c9121fc747277089bef6b25c17b5f2874d66b847..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLRequest.cpp +++ /dev/null @@ -1,366 +0,0 @@ -#include <iostream> -#include <memory> -#include <sstream> -#include <string> -#include <qstring.h> - -#include "globals.h" -#include "CallManager.hpp" -#include "CallStatus.hpp" -#include "CallStatusFactory.hpp" -#include "ConfigurationManager.hpp" -#include "PhoneLine.hpp" -#include "PhoneLineLocker.hpp" -#include "PhoneLineManager.hpp" -#include "SFLRequest.hpp" - -EventRequest::EventRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : Request(sequenceId, command, args) -{} - - -void -EventRequest::onError(const QString &code, const QString &message) -{ - DebugOutput::instance() << QObject::tr("EventRequest error: (%1) %1\n") - .arg(code) - .arg(message); - PhoneLineManager::instance().errorOnGetEvents(message); -} - -void -EventRequest::onEntry(const QString &code, const QString &message) -{ - std::auto_ptr< Event > - e(EventFactory::instance().create(code, Request::parseArgs(message))); - e->execute(); -} - -void -EventRequest::onSuccess(const QString &code, const QString &message) -{ - DebugOutput::instance() << QObject::tr("EventRequest success: (%1) %1\n") - .arg(code) - .arg(message); - PhoneLineManager::instance().start(); -} - -CallStatusRequest::CallStatusRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : Request(sequenceId, command, args) -{} - - -void -CallStatusRequest::onError(const QString &code, const QString &message) -{ - DebugOutput::instance() << QObject::tr("CallStatusRequest error: (%1) %1\n") - .arg(code) - .arg(message); - PhoneLineManager::instance().errorOnCallStatus(message); -} - -void -CallStatusRequest::onEntry(const QString &code, const QString &message) -{ - std::auto_ptr< Event > - e(EventFactory::instance().create(code, Request::parseArgs(message))); - e->execute(); -} - -void -CallStatusRequest::onSuccess(const QString &code, const QString &message) -{ - DebugOutput::instance() << QObject::tr("CallStatusRequest success: (%1) %1\n") - .arg(code) - .arg(message); - if(code == "206") { - std::list< QString > args = Request::parseArgs(message); - if(args.size() >= 2) { - PhoneLineManager::instance().selectLine(*args.begin(), true); - } - else { - DebugOutput::instance() << QObject::tr("CallStatusRequest Error: cannot get current line.\n"); - } - } - PhoneLineManager::instance().handleEvents(); -} - - -PermanentRequest::PermanentRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : CallRelatedRequest(sequenceId, command, args) -{} - -void -PermanentRequest::onError(Call call, - const QString &, - const QString &message) -{ - DebugOutput::instance() << QObject::tr("PermanentRequest: Error: %1").arg(toString()); - PhoneLine *line = PhoneLineManager::instance().getLine(call); - if(line) { - PhoneLineLocker guard(line, false); - line->setLineStatus(message); - line->setAction(""); - line->error(); - } - else { - DebugOutput::instance() << - QObject::tr("We received an error on a call " - "that doesn't have a phone line (%1).\n") - .arg(call.id()); - } -} - -void -PermanentRequest::onEntry(Call call, - const QString &, - const QString &message) -{ - PhoneLine *line = PhoneLineManager::instance().getLine(call); - if(line) { - PhoneLineLocker guard(line, false); - line->setLineStatus(message); - line->setAction(""); - } - else { - DebugOutput::instance() << - QObject::tr("We received a status on a call related request " - "that doesn't have a phone line (%1).\n") - .arg(call.id()); - } -} - -void -PermanentRequest::onSuccess(Call call, - const QString &, - const QString &message) -{ - PhoneLine *line = PhoneLineManager::instance().getLine(call); - if(line) { - PhoneLineLocker guard(line, false); - line->setLineStatus(message); - line->setAction(""); - } - else { - DebugOutput::instance() << - QObject::tr("We received a success on a call related request " - "that doesn't have a phone line (%1).\n") - .arg(call.id()); - } -} - -TemporaryRequest::TemporaryRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : CallRelatedRequest(sequenceId, command, args) -{} - -void -TemporaryRequest::onError(Call call, - const QString &code, - const QString &message) -{ - onSuccess(call, code, message); -} - -void -TemporaryRequest::onEntry(Call call, - const QString &code, - const QString &message) -{ - onSuccess(call, code, message); -} - -void -TemporaryRequest::onSuccess(Call call, - const QString &, - const QString &message) -{ - PhoneLine *line = PhoneLineManager::instance().getLine(call); - if(line) { - PhoneLineLocker guard(line, false); - line->setTempAction(message); - } - else { - DebugOutput::instance() << - QObject::tr("We received an answer on a temporary call " - "related request that doesn't have a phone " - "line (%1).\n") - .arg(call.id()); - } -} - -CallRequest::CallRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args) - : AccountRequest(sequenceId, command, args) -{ - - std::list< QString >::const_iterator pos = args.begin(); - pos++; - mCallId = *pos; -} - -void -CallRequest::onError(Account, - const QString &, - const QString &message) -{ - if(CallManager::instance().exist(mCallId)) { - PhoneLine *line = - PhoneLineManager::instance().getLine(CallManager::instance().getCall(mCallId)); - if(line) { - PhoneLineLocker guard(line, false); - line->setLineStatus(message); - line->error(); - } - else { - DebugOutput::instance() << - QObject::tr("We received an error on a call " - "that doesn't have a phone line (%1).\n") - .arg(mCallId); - } - } - else { - DebugOutput::instance() << QObject::tr("CallRequest: Trying to retreive an unregistred call (%1)\n").arg(mCallId); - } -} - -void -CallRequest::onEntry(Account, - const QString &, - const QString &message) -{ - if(CallManager::instance().exist(mCallId)) { - PhoneLine *line = - PhoneLineManager::instance().getLine(CallManager::instance().getCall(mCallId)); - if(line) { - PhoneLineLocker guard(line, false); - line->setLineStatus(message); - } - else { - DebugOutput::instance() << - QObject::tr("We received a status on a call related request " - "that doesn't have a phone line (%1).\n") - .arg(mCallId); - } - } - else { - DebugOutput::instance() << QObject::tr("CallRequest: Trying to retreive an unregistred call (%1)\n").arg(mCallId); - } -} - -void -CallRequest::onSuccess(Account, - const QString &, - const QString &message) -{ - if(CallManager::instance().exist(mCallId)) { - PhoneLine *line = - PhoneLineManager::instance().getLine(CallManager::instance().getCall(mCallId)); - if(line) { - PhoneLineLocker guard(line, false); - line->setLineStatus(message); - } - else { - DebugOutput::instance() << - QObject::tr("We received a success on a call related request " - "that doesn't have a phone line (%1).\n") - .arg(mCallId); - } - } - else { - 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 &, const QString &message) -{ - std::list< QString > args = Request::parseArgs(message); - if(args.size() >= 4) { - QString section, variable, type, def, val; - section = *args.begin(); - args.pop_front(); - variable = *args.begin(); - args.pop_front(); - type = *args.begin(); - args.pop_front(); - val = *args.begin(); - args.pop_front(); - if(args.size() >= 1) { - def = *args.begin(); - } - ConfigurationManager::instance().add(ConfigEntry(section, variable, type, def, val)); - } -} - -void -ConfigGetAllRequest::onSuccess(const QString &, const QString &) -{ - 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); -} diff --git a/src/gui/official/SFLRequest.hpp b/src/gui/official/SFLRequest.hpp deleted file mode 100644 index 2279f1350bdda4f527ae5b7cd6faf5caa1a35506..0000000000000000000000000000000000000000 --- a/src/gui/official/SFLRequest.hpp +++ /dev/null @@ -1,221 +0,0 @@ - - - -#ifndef SFLPHONEGUI_SFLREQUEST_HPP -#define SFLPHONEGUI_SFLREQUEST_HPP - -#include "Request.hpp" - -class EventRequest : public Request -{ -public: - EventRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - - virtual ~EventRequest(){} - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. When we have an error on an EventRequest, we should - * quit the program. - */ - virtual void onError(const QString &code, const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - * This will be dispatched to the valid event. - */ - virtual void onEntry(const QString &code, const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. The event handling is gone, so we should - * quit. - */ - virtual void onSuccess(const QString &code, const QString &message); - -}; - -class CallStatusRequest : public Request -{ -public: - CallStatusRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - - virtual ~CallStatusRequest(){} - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. When we have an error on an EventRequest, we should - * quit the program. - */ - virtual void onError(const QString &code, const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - * This will be dispatched to the valid event. - */ - virtual void onEntry(const QString &code, const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. The event handling is gone, so we should - * quit. - */ - virtual void onSuccess(const QString &code, const QString &message); - -}; - - -class CallRequest : public AccountRequest -{ - public: - CallRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. - */ - virtual void onError(Account account, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - */ - virtual void onEntry(Account account, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. - */ - virtual void onSuccess(Account account, - const QString &code, - const QString &message); - -private: - QString mCallId; -}; - - -class PermanentRequest : public CallRelatedRequest -{ - public: - PermanentRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. - */ - virtual void onError(Call call, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - */ - virtual void onEntry(Call call, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. - */ - virtual void onSuccess(Call call, - const QString &code, - const QString &message); -}; - -class TemporaryRequest : public CallRelatedRequest -{ - public: - TemporaryRequest(const QString &sequenceId, - const QString &command, - const std::list< QString > &args); - - - /** - * This function will be called when the request - * receive its answer, if the request didn't successfully - * ended. - */ - virtual void onError(Call call, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive an answer, but there's other answers to come. - */ - virtual void onEntry(Call call, - const QString &code, - const QString &message); - - /** - * This function will be called when the request - * receive its answer, if the request successfully - * ended. - */ - virtual void onSuccess(Call call, - const QString &code, - 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); -}; - - -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 diff --git a/src/gui/official/Session.cpp b/src/gui/official/Session.cpp deleted file mode 100644 index 48a9dc87cedda90ef5dfa0d3f109a92a7546719f..0000000000000000000000000000000000000000 --- a/src/gui/official/Session.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/** - * 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 <iostream> -#include <qstring.h> - -#include "Session.hpp" -#include "Requester.hpp" -#include "SessionIOFactory.hpp" - - -Session::Session(const QString &id) - : mId(id) -{} - -Session::Session() -{ - mId = Requester::instance().generateSessionId(); - SessionIO *s = SessionIOFactory::instance().create(); - Requester::instance().registerSession(mId, s); -} - -QString -Session::id() const -{ - return mId; -} - -QString -Session::playTone() const -{ - return Requester::instance().send(mId, "playtone", std::list< QString >()); -} - -QString -Session::stopTone() const -{ - return Requester::instance().send(mId, "stoptone", std::list< QString >()); -} - -void -Session::connect() const -{ - return Requester::instance().connect(mId); -} - - -QString -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 -{ - return Requester::instance().send(mId, "mute", std::list< QString >()); -} - -QString -Session::unmute() const -{ - return Requester::instance().send(mId, "unmute", std::list< QString >()); -} - -QString -Session::volume(unsigned int volume) const -{ - std::list< QString > args; - args.push_back(QString("%1").arg(volume)); - return Requester::instance().send(mId, "setspkrvolume", args); -} - -QString -Session::micVolume(unsigned int volume) const -{ - std::list< QString > args; - args.push_back(QString("%1").arg(volume)); - return Requester::instance().send(mId, "setmicvolume", args); -} - -QString -Session::getCallStatus() const -{ - return Requester::instance().send(mId, "getcallstatus", std::list< QString >()); -} - -QString -Session::playDtmf(char c) const -{ - QString s; - s += c; - std::list< QString > args; - args.push_back(s); - 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 -Session::getAccount(const QString &name) const -{ - return Account(mId, name); -} - -Account -Session::getDefaultAccount() const -{ - return Account(mId, QString("mydefaultaccount")); -} - diff --git a/src/gui/official/Session.hpp b/src/gui/official/Session.hpp deleted file mode 100644 index 75aea58c978ccee311a281a7654e37305d9ff193..0000000000000000000000000000000000000000 --- a/src/gui/official/Session.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/** - * 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_SESSION_H -#define SFLPHONEGUI_SESSION_H - -#include <qstring.h> - -#include "Account.hpp" - -class Session -{ - public: - Session(); - Session(const QString &id); - - /** - * retreive the account identified by name. - */ - Account getAccount(const QString &name) const; - - Account getDefaultAccount() const; - - /** - * This function will play a tone. This is - * just a ear candy. - */ - 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 - */ - QString getEvents() const; - - /** - * This function will ask for all calls status. - */ - QString getCallStatus() const; - - /** - * This function will mute the microphone. - */ - QString mute() const; - - QString configGetAll() const; - - /** - * This function will set the volume to - * the given percentage - */ - QString volume(unsigned int volume) const; - - /** - * This function will set the mic volume to - * the given percentage - */ - QString micVolume(unsigned int volume) const; - - /** - * This function will unmute the microphone. - */ - QString unmute() const; - - /** - * This function will ask to the SessionIO - * linked to this session to connect. - */ - void connect() const; - - QString id() const; - QString stopTone() const; - QString playTone() const; - - private: - QString mId; -}; - -#endif diff --git a/src/gui/official/SessionFactory.hpp b/src/gui/official/SessionFactory.hpp deleted file mode 100644 index c2a474e6cde96da21159ab60b6dedbe43fade23c..0000000000000000000000000000000000000000 --- a/src/gui/official/SessionFactory.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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 __FACTORY_HPP__ -#define __FACTORY_HPP__ - -template< T > -struct Creator -{ - virtual T *create(); -}; - -template< typename T > -class Factory -{ -public: - Factory(); - ~Factory(); - - /** - * This function will set the creator. The - * Factory owns the creator instance. - */ - void setCreator(Creator< T > *creator); - - /** - * It ask the creator to create a SessionIO. - * If there's no creator set, it will throw - * a std::logic_error. - */ - T *create(); - -private: - Creator< T > *mCreator; -} - -#include "Factory.inl" - -#endif diff --git a/src/gui/official/SessionIO.hpp b/src/gui/official/SessionIO.hpp deleted file mode 100644 index e845e8e00c3f8ba04030ae9bb73774e4d3e708b9..0000000000000000000000000000000000000000 --- a/src/gui/official/SessionIO.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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 __SESSIONIO_HPP__ -#define __SESSIONIO_HPP__ - -#include <qobject.h> -#include <qstring.h> - -/** - * This is the main class that will handle - * the IO. - */ -class SessionIO : public QObject -{ - Q_OBJECT - - public: - virtual ~SessionIO(){} - -public slots: - virtual void connect() {} - - /** - * You can use this function for sending request. - * The sending is non-blocking. This function will - * send the data as it is; it will NOT add an EOL. - * the stream will be "sync"ed. - */ - virtual void send(const QString &request) = 0; - - /** - * You can use this function to receive answers. - * This function will wait until there's an - * answer to be processed. - */ - virtual void receive(QString &answer) = 0; - -}; - - - -#endif - diff --git a/src/gui/official/SessionIOFactory.hpp b/src/gui/official/SessionIOFactory.hpp deleted file mode 100644 index af82d47a9e66f53720a4e6886037a34dec4e092a..0000000000000000000000000000000000000000 --- a/src/gui/official/SessionIOFactory.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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 __SESSIONIOFACTORY_HPP__ -#define __SESSIONIOFACTORY_HPP__ - -#include "utilspp/Singleton.hpp" -#include "Factory.hpp" -#include "SessionIO.hpp" - -typedef utilspp::SingletonHolder< Factory< SessionIO > > SessionIOFactory; - -#endif - diff --git a/src/gui/official/TCPSessionIO.cpp b/src/gui/official/TCPSessionIO.cpp deleted file mode 100644 index e962dfb8df350410d6fa7f45504dfd6dc13c58b1..0000000000000000000000000000000000000000 --- a/src/gui/official/TCPSessionIO.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/** - * 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 "globals.h" -#include "DebugOutput.hpp" -#include "Requester.hpp" -#include "TCPSessionIO.hpp" - - -TCPSessionIO::TCPSessionIO(const QString &hostname, Q_UINT16 port) - : mSocket(new QSocket(this)) - , mHostname(hostname) - , mPort(port) -{ - QObject::connect(mSocket, SIGNAL(readyRead()), - this, SLOT(receive())); - QObject::connect(mSocket, SIGNAL(connected()), - this, SLOT(sendWaitingRequests())); - QObject::connect(mSocket, SIGNAL(connected()), - this, SIGNAL(connected())); - QObject::connect(mSocket, SIGNAL(connectionClosed()), - this, SIGNAL(disconnected())); - QObject::connect(mSocket, SIGNAL(error(int)), - this, SLOT(error(int))); - QObject::connect(mSocket, SIGNAL(error(int)), - this, SIGNAL(disconnected())); -} - -TCPSessionIO::~TCPSessionIO() -{} - -void -TCPSessionIO::error(int err) -{ - DebugOutput::instance() << QObject::tr("TCPSessionIO: Error number %1. \n") - .arg(err); - mSocket->close(); -} - -void -TCPSessionIO::receive() -{ - QString s; - while(mSocket->canReadLine()) { - receive(s); - Requester::instance().receiveAnswer(s); - } -} - -void -TCPSessionIO::connect() -{ - DebugOutput::instance() << QObject::tr("TCPSessionIO: Tring to connect to %1:%2.\n") - .arg(mHostname) - .arg(mPort); - mSocket->connectToHost(mHostname, mPort); -} - -void -TCPSessionIO::sendWaitingRequests() -{ - DebugOutput::instance() << QObject::tr("TCPSessionIO: Connected.\n"); - QTextStream stream(mSocket); - QMutexLocker guard(&mStackMutex); - while(mSocket->state() == QSocket::Connected && - mStack.size() > 0) { - stream << *mStack.begin(); - mStack.pop_front(); - mSocket->flush(); - } -} - -void -TCPSessionIO::send(const QString &request) -{ - QTextStream stream(mSocket); - if(mSocket->state() == QSocket::Connected) { - DebugOutput::instance() << QObject::tr("TCPSessioIO: Sending request to sflphone: %1") - .arg(request); - stream << request; - mSocket->flush(); - } - else { - mStackMutex.lock(); - mStack.push_back(request); - mStackMutex.unlock(); - } -} - -void -TCPSessionIO::receive(QString &answer) -{ - if(mSocket->isReadable()) { - QTextStream stream(mSocket); - answer = stream.readLine(); - DebugOutput::instance() << QObject::tr("TCPSessionIO: Received answer from sflphone: %1\n") - .arg(answer); - } -} - - - - - - - diff --git a/src/gui/official/TCPSessionIO.hpp b/src/gui/official/TCPSessionIO.hpp deleted file mode 100644 index 423a140e539b1e70b4962b50f2c53fc8db201f30..0000000000000000000000000000000000000000 --- a/src/gui/official/TCPSessionIO.hpp +++ /dev/null @@ -1,97 +0,0 @@ -/** - * 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 __TCPSESSIONIO_HPP__ -#define __TCPSESSIONIO_HPP__ - -#include <qobject.h> -#include <qmutex.h> -#include <qstring.h> -#include <qsocket.h> -#include <qtextstream.h> -#include <list> - -#include "SessionIO.hpp" - -#ifdef QT3_SUPPORT -#include <Q3Socket> -typedef Q3Socket QSocket; -#else -#include <qsocket.h> -#endif - - -class TCPSessionIO : public SessionIO -{ - Q_OBJECT - -public: - TCPSessionIO(const QString &hostname, - Q_UINT16 port); - - virtual ~TCPSessionIO(); - -signals: - void connected(); - void disconnected(); - -public slots: - /** - * This function send the request that we were - * unable to send. - */ - void sendWaitingRequests(); - - /** - * Those function are the actual function - * that write to the socket. - */ - virtual void send(const QString &request); - - /** - * This function is called when we have - * incomming data on the socket. - */ - virtual void receive(); - - /** - * Those function are the actual function - * that read from the socket. - */ - virtual void receive(QString &answer); - virtual void connect(); - - private slots: - /** - * This function is called when we have an error - * on the socket. - */ - void error(int); - -private: - QSocket *mSocket; - QString mHostname; - Q_UINT16 mPort; - - QMutex mStackMutex; - std::list< QString > mStack; -}; - -#endif diff --git a/src/gui/official/TCPSessionIOCreator.cpp b/src/gui/official/TCPSessionIOCreator.cpp deleted file mode 100644 index 67afbd5a1b6b035e34ad5f507b7290170ca28a55..0000000000000000000000000000000000000000 --- a/src/gui/official/TCPSessionIOCreator.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "TCPSessionIOCreator.hpp" -#include "PhoneLineManager.hpp" - -TCPSessionIOCreator::TCPSessionIOCreator(const QString &hostname, - Q_UINT16 port) - : mHostname(hostname) - , mPort(port) -{} - -TCPSessionIO * -TCPSessionIOCreator::create() -{ - TCPSessionIO *t = new TCPSessionIO(mHostname, mPort); - QObject::connect(t, SIGNAL(connected()), - &PhoneLineManager::instance(), SIGNAL(connected())); - QObject::connect(t, SIGNAL(disconnected()), - &PhoneLineManager::instance(), SIGNAL(disconnected())); - return t; -} diff --git a/src/gui/official/TCPSessionIOCreator.hpp b/src/gui/official/TCPSessionIOCreator.hpp deleted file mode 100644 index 32b7abc7bd8dc1693e5921785a0692a07d0ef18f..0000000000000000000000000000000000000000 --- a/src/gui/official/TCPSessionIOCreator.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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 __TCPSESSIONIOCREATOR_HPP__ -#define __TCPSESSIONIOCREATOR_HPP__ - -#include "Factory.hpp" -#include "TCPSessionIO.hpp" - -class TCPSessionIOCreator : public Creator< SessionIO > -{ -public: - TCPSessionIOCreator(const QString &hostname, - Q_UINT16 port); - virtual ~TCPSessionIOCreator(){} - - virtual TCPSessionIO *create(); - -private: - QString mHostname; - Q_UINT16 mPort; -}; - -#endif diff --git a/src/gui/official/TODO b/src/gui/official/TODO deleted file mode 100644 index 634c064d1d4097a366602de488fef8ae4579fe7e..0000000000000000000000000000000000000000 --- a/src/gui/official/TODO +++ /dev/null @@ -1,5 +0,0 @@ -need to consolidated Request and Answers. -need to set temp status. - -PhoneLineManager should connect only to the selected line, it could simplify the signaling process. - diff --git a/src/gui/official/TransparentWidget.cpp b/src/gui/official/TransparentWidget.cpp deleted file mode 100644 index 5107f46ca85b6404092f2b5b3250f1f75b114dc0..0000000000000000000000000000000000000000 --- a/src/gui/official/TransparentWidget.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 <qbitmap.h> -#include <qcolor.h> -#include <qdragobject.h> -#include <qmime.h> -#include <iostream> - -#include "DebugOutput.hpp" -#include "TransparentWidget.hpp" - - -TransparentWidget::TransparentWidget(const QString &pixmap, - QWidget* parent) - : QLabel(parent) -{ - mImage = transparize(pixmap); - setPixmap(mImage); - updateMask(this, mImage); - - resize(mImage.size()); -} - -TransparentWidget::TransparentWidget(QWidget* parent) - : QLabel(parent) -{} - -void -TransparentWidget::updateMask(QWidget *w, QPixmap image) -{ -#ifdef QT3_SUPPORT - if(image.hasAlpha()) { - w->setMask(image.mask()); - } -#else - if(image.mask()) { - w->setMask(*image.mask()); - } -#endif -} - -QPixmap -TransparentWidget::retreive(const QString &image) -{ - return QPixmap::fromMimeSource(image); -} - -QPixmap -TransparentWidget::transparize(const QSize &) -{ - /* - QImage image(size, QImage::Format_RGB32); - QColor c(12,32,35,123); - image.fill(c.rgb()); - - QPixmap p(QPixmap::fromImage(image)); - p.setMask(p.createHeuristicMask()); - //p.setMask(p.alphaChannel()); - */ - return QPixmap(); -} - -TransparentWidget::~TransparentWidget() -{} - -QPixmap -TransparentWidget::transparize(const QString &image) -{ -#ifdef QT3_SUPPORT - QPixmap p(retreive(image)); - if (!p.mask()) { - if (p.hasAlphaChannel()) { - p.setMask(p.alphaChannel()); - } - else { - p.setMask(p.createHeuristicMask()); - } - } -#else - // QPixmap p(QPixmap::fromMimeSource(image)); - QImage img(QImage::fromMimeSource(image)); - QPixmap p; - p.convertFromImage(img); - - - QBitmap bm; - if (img.hasAlphaBuffer()) { - bm = img.createAlphaMask(); - } - else { - bm = img.createHeuristicMask(); - } - p.setMask(bm); -#endif - return p; -} - - diff --git a/src/gui/official/TransparentWidget.hpp b/src/gui/official/TransparentWidget.hpp deleted file mode 100644 index 7ce9c85d47fa773285e374f0872f0fb001cb4ffe..0000000000000000000000000000000000000000 --- a/src/gui/official/TransparentWidget.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 __TRANSPARENT_WIDGET_HPP__ -#define __TRANSPARENT_WIDGET_HPP__ - -#include <qbitmap.h> -#include <qlabel.h> -#include <qpixmap.h> -#include <qimage.h> - -/** - * This class Emulate a PushButton but takes two - * images to display its state. - */ -class TransparentWidget : public QLabel -{ - Q_OBJECT - -public: - TransparentWidget(const QString &pixmap, - QWidget *parent); - TransparentWidget(QWidget *parent); - ~TransparentWidget(); - - static QPixmap retreive(const QString &size); - static QPixmap transparize(const QSize &size); - static QPixmap transparize(const QString &image); - - /** - * This function will update the mask of the widget - * to the QPixmap mask. - */ - void updateMask(QWidget *w, QPixmap image); - - - bool hasAlpha() - {return mImage.hasAlpha();} - - QBitmap mask() const - {return *mImage.mask();} - -private: - QPixmap mImage; - -}; - -#endif diff --git a/src/gui/official/Url.cpp b/src/gui/official/Url.cpp deleted file mode 100644 index e808eb24deb1a24b363da6cfabc9c04e335e2a79..0000000000000000000000000000000000000000 --- a/src/gui/official/Url.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include <qurl.h> - -#include "Url.hpp" - -static uchar hex_to_int( uchar c ) -{ - if ( c >= 'A' && c <= 'F' ) - return c - 'A' + 10; - if ( c >= 'a' && c <= 'f') - return c - 'a' + 10; - if ( c >= '0' && c <= '9') - return c - '0'; - return 0; -} - -void Url::decode( QString& url ) -{ - int oldlen = url.length(); - if ( !oldlen ) - return; - - int newlen = 0; - - QString newUrl; - - int i = 0; - while ( i < oldlen ) { - ushort c = url[ i++ ].unicode(); - if ( c == '%' ) { - c = hex_to_int( url[ i ].unicode() ) * 16 + hex_to_int( url[ i + 1 ].unicode() ); - i += 2; - } - else if ( c == '+' ) { - c = ' '; - } - newUrl [ newlen++ ] = c; - } - - url = newUrl; -} diff --git a/src/gui/official/Url.hpp b/src/gui/official/Url.hpp deleted file mode 100644 index 88a742456529255f83115b7942a909eaed846bcc..0000000000000000000000000000000000000000 --- a/src/gui/official/Url.hpp +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef __URL_HPP__ -#define __URL_HPP__ - -#include <qstring.h> - -namespace Url -{ - void decode(QString &url); -} - -#endif - diff --git a/src/gui/official/VolumeControl.cpp b/src/gui/official/VolumeControl.cpp deleted file mode 100644 index 026b687b15e2819557661e1a168649f8877dd9db..0000000000000000000000000000000000000000 --- a/src/gui/official/VolumeControl.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Laurielle Lea <laurielle.lea@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 <qevent.h> -#include <iostream> - - -#include "TransparentWidget.hpp" -#include "VolumeControl.hpp" - -#define SLIDER_IMAGE "slider.png" - -VolumeControl::VolumeControl (const QString &pixname, - QWidget *parent, - int minValue, - int maxValue) - : QLabel(parent) - , mMin(minValue) - , mMax(maxValue) - , mValue(minValue) - , mOrientation(VolumeControl::Horizontal) - , mSlider(new TransparentWidget(pixname, this)) - , mMaxPosition(100) -{ - resize(); -} - -VolumeControl::~VolumeControl() -{} - -void -VolumeControl::resize() -{ - QPixmap q(QPixmap::fromMimeSource(SLIDER_IMAGE)); - setPixmap(q); - if(q.hasAlpha()) { - setMask(*q.mask()); - } - - QWidget::resize(q.size()); - mMaxPosition = q.height() - mSlider->height(); -} - -void -VolumeControl::setOrientation(VolumeControl::Orientation orientation) -{ - mOrientation = orientation; -} - -void -VolumeControl::setMax(int value) -{ - if(value >= mMin) { - mMax = value; - } -} - -void -VolumeControl::setMin(int value) -{ - if(value <= mMax) { - mMin = value; - } -} - -void -VolumeControl::setValue(int value) -{ - if(value != mValue) { - if(value <= mMax && value >= mMin) { - mValue = value; - updateSlider(value); - emit valueUpdated(mValue); - } - } -} - - -void -VolumeControl::mouseMoveEvent (QMouseEvent *e) { - if (mOrientation == VolumeControl::Vertical) { - // If the slider for the volume is vertical - int newpos = mSlider->y() + e->globalY() - mPos.y(); - - mPos = e->globalPos(); - if(newpos < 0) { - mPos.setY(mPos.y() - newpos); - newpos = 0; - } - - if(newpos > mMaxPosition) { - mPos.setY(mPos.y() - (newpos - mMaxPosition)); - newpos = mMaxPosition; - } - - mSlider->move(mSlider->x(), newpos); - updateValue(); - } - else { - mSlider->move(e->y() - mPos.x(), mSlider->y()); - } -} - -void -VolumeControl::updateValue() -{ - int value = (int)((float)offset() / mMaxPosition * (mMax - mMin)); - if(mValue != value) { - mValue = value; - emit valueUpdated(mValue); - } -} - - -void -VolumeControl::updateSlider(int value) -{ - if(mOrientation == VolumeControl::Vertical) { - mSlider->move(mSlider->x(), mMaxPosition - (int)((float)value / (mMax - mMin) * mMaxPosition)); - } - else { - mSlider->move(value / (mMax - mMin) * mMaxPosition, mSlider->y()); - } -} - -int -VolumeControl::offset() -{ - if(mOrientation == VolumeControl::Vertical) { - return mMaxPosition - mSlider->y(); - } - else { - return mSlider->x(); - } -} - -void -VolumeControl::mousePressEvent (QMouseEvent *e) -{ - mPos = e->globalPos(); -} - -// EOF diff --git a/src/gui/official/VolumeControl.hpp b/src/gui/official/VolumeControl.hpp deleted file mode 100644 index 0ca082afc68e5ce9ef47b9873f2987635bf29179..0000000000000000000000000000000000000000 --- a/src/gui/official/VolumeControl.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/** - * 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 __VOLUMECONTROL_HPP__ -#define __VOLUMECONTROL_HPP__ - -#include <qlabel.h> -#include "TransparentWidget.hpp" - -class VolumeControl : public QLabel -{ - Q_OBJECT - -public: - typedef enum {Vertical = 0, Horizontal} Orientation; - - VolumeControl(const QString &pixmap, - QWidget *parent = 0, - int minValue = 0, - int maxValue = 100); - ~VolumeControl(void); - - int getValue() - {return mValue;} - - int offset(); - int minY(); - int maxY(); - -signals: - void valueUpdated(int); - -public slots: - void updateValue(); - void setMin(int value); - void setMax(int value); - void setValue(int value); - void resize(); - void setOrientation(Orientation orientation); - -private: - void updateSlider(int value); - void mouseMoveEvent(QMouseEvent*); - void mousePressEvent(QMouseEvent*); - - - int mMin; - int mMax; - int mValue; - - VolumeControl::Orientation mOrientation; - QPoint mPos; - - TransparentWidget *mSlider; - int mMaxPosition; -}; - -#endif // __VOLUME_CONTROL_H__ diff --git a/src/gui/official/globals.h b/src/gui/official/globals.h deleted file mode 100644 index 1b39337ca6af21f21f094d8bb47d3e672785dd70..0000000000000000000000000000000000000000 --- a/src/gui/official/globals.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SFLPHONE_GLOBAL_H -#define SFLPHONE_GLOBAL_H - -#define DEBUG - -#define NB_PHONELINES 6 -#define PROGNAME "SFLPhone" -#define VERSION "0.4.2" - -#define AUDIO_SECTION "Audio" -#define AUDIO_DEFAULT_DEVICE "Drivers.driverName" -#define AUDIO_CODEC1 "Codecs.codec1" -#define AUDIO_CODEC2 "Codecs.codec2" -#define AUDIO_CODEC3 "Codecs.codec3" - -#define SIGNALISATION_SECTION "VoIPLink" -#define SIGNALISATION_FULL_NAME "SIP.fullName" -#define SIGNALISATION_USER_PART "SIP.userPart" -#define SIGNALISATION_AUTH_USER_NAME "SIP.username" -#define SIGNALISATION_PASSWORD "SIP.password" -#define SIGNALISATION_HOST_PART "SIP.hostPart" -#define SIGNALISATION_PROXY "SIP.proxy" -#define SIGNALISATION_AUTO_REGISTER "SIP.autoregister" -#define SIGNALISATION_PLAY_TONES "DTMF.playTones" -#define SIGNALISATION_PULSE_LENGTH "DTMF.pulseLength" -#define SIGNALISATION_SEND_DTMF_AS "DTMF.sendDTMFas" -#define SIGNALISATION_STUN_SERVER "STUN.STUNserver" -#define SIGNALISATION_USE_STUN "STUN.useStun" - - -#endif diff --git a/src/gui/official/images/about.png b/src/gui/official/images/about.png deleted file mode 100644 index 03600d6b0ac02bf687795ff13aab794e4ba8f5e6..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/about.png and /dev/null differ diff --git a/src/gui/official/images/audio.png b/src/gui/official/images/audio.png deleted file mode 100644 index d43e938810f27edf8f62a0d3cf5914e92e14086b..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/audio.png and /dev/null differ diff --git a/src/gui/official/images/clear_off.png b/src/gui/official/images/clear_off.png deleted file mode 100644 index be1436097c210a578bb51be5f8d15f89da387314..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/clear_off.png and /dev/null differ diff --git a/src/gui/official/images/clear_on.png b/src/gui/official/images/clear_on.png deleted file mode 100644 index 9605e89ae9d104ab2d627a27f7c4ddcffb42ff94..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/clear_on.png and /dev/null differ diff --git a/src/gui/official/images/close_off.png b/src/gui/official/images/close_off.png deleted file mode 100644 index e962b31b1630f1cfababa9f153fd97d7ee56058f..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/close_off.png and /dev/null differ diff --git a/src/gui/official/images/close_on.png b/src/gui/official/images/close_on.png deleted file mode 100644 index 747c7fb09c461bef92cb4fdf9af9cc03fa7e9731..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/close_on.png and /dev/null differ diff --git a/src/gui/official/images/conference_off.png b/src/gui/official/images/conference_off.png deleted file mode 100644 index e395b4c1545ab57b5f717c5e5e61d9866fad2704..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/conference_off.png and /dev/null differ diff --git a/src/gui/official/images/conference_on.png b/src/gui/official/images/conference_on.png deleted file mode 100644 index a565e16d30e2a96b5a4b06f0767bc40dffbae0d8..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/conference_on.png and /dev/null differ diff --git a/src/gui/official/images/directory_off.png b/src/gui/official/images/directory_off.png deleted file mode 100644 index 549106a473846a7fc39cec736876a4d57b7ef3d9..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/directory_off.png and /dev/null differ diff --git a/src/gui/official/images/directory_on.png b/src/gui/official/images/directory_on.png deleted file mode 100644 index 265075178051802e1195dfa022b596310b1caccf..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/directory_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_0_off.png b/src/gui/official/images/dtmf_0_off.png deleted file mode 100644 index 1b4a2ebe466177aaa91c951c306cf139940983d2..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_0_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_0_on.png b/src/gui/official/images/dtmf_0_on.png deleted file mode 100644 index 57c0f4fcee858e98d94a5c8d0663622b33065366..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_0_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_1_off.png b/src/gui/official/images/dtmf_1_off.png deleted file mode 100644 index 0b47b61c32f73d098a994a3b87796bad9f24cf4c..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_1_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_1_on.png b/src/gui/official/images/dtmf_1_on.png deleted file mode 100644 index 737e614cf153e1e6d2abdf6c2318bbefb54bd48b..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_1_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_2_off.png b/src/gui/official/images/dtmf_2_off.png deleted file mode 100644 index 6e8a44e7d7f87a785267c478e84e54795eba1987..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_2_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_2_on.png b/src/gui/official/images/dtmf_2_on.png deleted file mode 100644 index 978fe76f592f570279a9a7d267d9595b23e68f7e..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_2_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_3_off.png b/src/gui/official/images/dtmf_3_off.png deleted file mode 100644 index 6688cadc488b61b25592a5edfc553e4dd309e95d..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_3_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_3_on.png b/src/gui/official/images/dtmf_3_on.png deleted file mode 100644 index 28f1b655763540078018b971c8d8bad761e6bf57..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_3_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_4_off.png b/src/gui/official/images/dtmf_4_off.png deleted file mode 100644 index d37207a4b98c686cf6ea0c058edb59a08baf71cc..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_4_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_4_on.png b/src/gui/official/images/dtmf_4_on.png deleted file mode 100644 index 1ef21959008f13919df13d48e9695013a84816d7..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_4_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_5_off.png b/src/gui/official/images/dtmf_5_off.png deleted file mode 100644 index 48ce1373bf1970c0b711566f71ed08473b2ca6a4..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_5_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_5_on.png b/src/gui/official/images/dtmf_5_on.png deleted file mode 100644 index 40b08cb37d6e9cab1002c29e963acf51ec0126d7..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_5_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_6_off.png b/src/gui/official/images/dtmf_6_off.png deleted file mode 100644 index 33667c242a61ecc99f97f2cda4ebd00065b4e750..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_6_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_6_on.png b/src/gui/official/images/dtmf_6_on.png deleted file mode 100644 index cc36556546babec6de6da07db5e03e4af759a63c..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_6_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_7_off.png b/src/gui/official/images/dtmf_7_off.png deleted file mode 100644 index a401f432537fd4498cadf001cbd6ad65905bbcda..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_7_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_7_on.png b/src/gui/official/images/dtmf_7_on.png deleted file mode 100644 index e6adb35e516c38b24193ceb3c5a4f40c13d52778..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_7_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_8_off.png b/src/gui/official/images/dtmf_8_off.png deleted file mode 100644 index 4db35c37d7613a166808fd8e5854a9f163c5d674..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_8_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_8_on.png b/src/gui/official/images/dtmf_8_on.png deleted file mode 100644 index 50f0bf36beacbe9a30246ad0c4dd1aedc95e4570..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_8_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_9_off.png b/src/gui/official/images/dtmf_9_off.png deleted file mode 100644 index 8a678a4c63eab850e5cebeebc0fa1f34966eb078..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_9_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_9_on.png b/src/gui/official/images/dtmf_9_on.png deleted file mode 100644 index 12e4c1a11c756f793080a0ac7ae433376918fe91..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_9_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_close_off.png b/src/gui/official/images/dtmf_close_off.png deleted file mode 100644 index 85006d153f47c13b06938e1fdd81544bbac0649e..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_close_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_close_on.png b/src/gui/official/images/dtmf_close_on.png deleted file mode 100644 index 0a962cb18c1178e8012a8d859ad6489a8e6bd017..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_close_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_main.png b/src/gui/official/images/dtmf_main.png deleted file mode 100644 index 37086908a03304b29e5de1e638f9e16e16b932ea..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_main.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_off.png b/src/gui/official/images/dtmf_off.png deleted file mode 100644 index c6d28ea168800a4c5038d271910b65ffb3547492..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_on.png b/src/gui/official/images/dtmf_on.png deleted file mode 100644 index a2eeddc4460f4f560a12bb532d7d9ae3686e8ea4..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_pound_off.png b/src/gui/official/images/dtmf_pound_off.png deleted file mode 100644 index e89be9d7191880865d4ac22face1277c60f95454..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_pound_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_pound_on.png b/src/gui/official/images/dtmf_pound_on.png deleted file mode 100644 index 1a1fa6e065782ea2b159df1668f9ea4eb581cae6..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_pound_on.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_star_off.png b/src/gui/official/images/dtmf_star_off.png deleted file mode 100644 index b3702b2418328d20e6e433a14e0094e386f9c810..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_star_off.png and /dev/null differ diff --git a/src/gui/official/images/dtmf_star_on.png b/src/gui/official/images/dtmf_star_on.png deleted file mode 100644 index b77a5221bda7d438d51c3fefb6924fa602f1fcb5..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/dtmf_star_on.png and /dev/null differ diff --git a/src/gui/official/images/gsm.png b/src/gui/official/images/gsm.png deleted file mode 100644 index 888e7c550a528295e235a7e878fdd1b0af0ece9d..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/gsm.png and /dev/null differ diff --git a/src/gui/official/images/hangup_off.png b/src/gui/official/images/hangup_off.png deleted file mode 100644 index 094405f83d55d1e565370581d244379f7ac11d85..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/hangup_off.png and /dev/null differ diff --git a/src/gui/official/images/hangup_on.png b/src/gui/official/images/hangup_on.png deleted file mode 100644 index 56313f6df102d7926a5b898a4c0126f7a5351219..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/hangup_on.png and /dev/null differ diff --git a/src/gui/official/images/hold_off.png b/src/gui/official/images/hold_off.png deleted file mode 100644 index 8cd06ad5fd2d71dd654eb5636bf6c635a7d89735..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/hold_off.png and /dev/null differ diff --git a/src/gui/official/images/hold_on.png b/src/gui/official/images/hold_on.png deleted file mode 100644 index c02be220b2e97a82f5387660fc81fe3d2548912a..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/hold_on.png and /dev/null differ diff --git a/src/gui/official/images/l.png b/src/gui/official/images/l.png deleted file mode 100644 index fe035f1a4d380363b5afaf11b0081b846a11edd0..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l.png and /dev/null differ diff --git a/src/gui/official/images/l1_off.png b/src/gui/official/images/l1_off.png deleted file mode 100644 index 864c2556cdfd48c1717d01ac1ee2da0bba9c64d0..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l1_off.png and /dev/null differ diff --git a/src/gui/official/images/l1_on.png b/src/gui/official/images/l1_on.png deleted file mode 100644 index b6bffb37d75b3ff1a0501e3e9fea45821ccb2a8f..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l1_on.png and /dev/null differ diff --git a/src/gui/official/images/l2_off.png b/src/gui/official/images/l2_off.png deleted file mode 100644 index c770ff6bce5cb7458b4b5d018e1d6a729d7a6d5d..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l2_off.png and /dev/null differ diff --git a/src/gui/official/images/l2_on.png b/src/gui/official/images/l2_on.png deleted file mode 100644 index 7fbc7cded84d6d659a5b0a7a311b37f3c0c0f25f..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l2_on.png and /dev/null differ diff --git a/src/gui/official/images/l3_off.png b/src/gui/official/images/l3_off.png deleted file mode 100644 index 345206f17d79376685c24ad9970ca157c8b0b25b..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l3_off.png and /dev/null differ diff --git a/src/gui/official/images/l3_on.png b/src/gui/official/images/l3_on.png deleted file mode 100644 index d28d55755f9adbec98d7f0aed848055801dc09d0..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l3_on.png and /dev/null differ diff --git a/src/gui/official/images/l4_off.png b/src/gui/official/images/l4_off.png deleted file mode 100644 index bef390ac4082e50f4934ca6b947e4f558493daf2..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l4_off.png and /dev/null differ diff --git a/src/gui/official/images/l4_on.png b/src/gui/official/images/l4_on.png deleted file mode 100644 index e63427d93bf11ca89fcc57cc79c1698ba0a7fa23..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l4_on.png and /dev/null differ diff --git a/src/gui/official/images/l5_off.png b/src/gui/official/images/l5_off.png deleted file mode 100644 index 1303ed2ce264f2d335f79e04fb5ec6738b0cdea4..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l5_off.png and /dev/null differ diff --git a/src/gui/official/images/l5_on.png b/src/gui/official/images/l5_on.png deleted file mode 100644 index d77e64e18edd5db14005f0d060e352c59ba245c3..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l5_on.png and /dev/null differ diff --git a/src/gui/official/images/l6_off.png b/src/gui/official/images/l6_off.png deleted file mode 100644 index d5e7ec474e364a66ee009cfbbcdeb50e9be651f5..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l6_off.png and /dev/null differ diff --git a/src/gui/official/images/l6_on.png b/src/gui/official/images/l6_on.png deleted file mode 100644 index 383d3dd4197ef1661950535f79b3fb46de0dc4ec..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/l6_on.png and /dev/null differ diff --git a/src/gui/official/images/logo_ico.png b/src/gui/official/images/logo_ico.png deleted file mode 100644 index d40cbdb2a827b91e537d23e4282520e5008f2427..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/logo_ico.png and /dev/null differ diff --git a/src/gui/official/images/main.png b/src/gui/official/images/main.png deleted file mode 100644 index ddf434171b5f5b93f31616615a603bbb593b4475..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/main.png and /dev/null differ diff --git a/src/gui/official/images/minimize_off.png b/src/gui/official/images/minimize_off.png deleted file mode 100644 index ad531e82f19c89cce2944b8943571cffc4788067..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/minimize_off.png and /dev/null differ diff --git a/src/gui/official/images/minimize_on.png b/src/gui/official/images/minimize_on.png deleted file mode 100644 index 20bb4e175433a92bef6c12cac6ac849e574e4229..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/minimize_on.png and /dev/null differ diff --git a/src/gui/official/images/mute_off.png b/src/gui/official/images/mute_off.png deleted file mode 100644 index 42bf8f657c0b094768097ef2622a68f6fcd07ff0..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/mute_off.png and /dev/null differ diff --git a/src/gui/official/images/mute_on.png b/src/gui/official/images/mute_on.png deleted file mode 100644 index e46a9a8d663abb9b2fdec0b6bdd226cd1884962c..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/mute_on.png and /dev/null differ diff --git a/src/gui/official/images/network.png b/src/gui/official/images/network.png deleted file mode 100644 index 197b2355ec454b96a32c0b252da3646504ae8a65..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/network.png and /dev/null differ diff --git a/src/gui/official/images/ok_off.png b/src/gui/official/images/ok_off.png deleted file mode 100644 index 3434c1ff8b6928c42729b5a867b3c9f310773456..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/ok_off.png and /dev/null differ diff --git a/src/gui/official/images/ok_on.png b/src/gui/official/images/ok_on.png deleted file mode 100644 index 7c8327dba56f3702dd3d7e584028efef8cea7308..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/ok_on.png and /dev/null differ diff --git a/src/gui/official/images/overscreen.png b/src/gui/official/images/overscreen.png deleted file mode 100644 index 704cbbdbac5174e79260c345834cf47c78984134..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/overscreen.png and /dev/null differ diff --git a/src/gui/official/images/preferences.png b/src/gui/official/images/preferences.png deleted file mode 100644 index 9fcf92510ff9170dde910c8387b88f9606942115..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/preferences.png and /dev/null differ diff --git a/src/gui/official/images/screen_main.png b/src/gui/official/images/screen_main.png deleted file mode 100644 index dace67850cc0a380da03d9938cb85508feb93d66..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/screen_main.png and /dev/null differ diff --git a/src/gui/official/images/setup_off.png b/src/gui/official/images/setup_off.png deleted file mode 100644 index 233d26f6005cfc67509606e2cc8213d71ef49b92..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/setup_off.png and /dev/null differ diff --git a/src/gui/official/images/setup_on.png b/src/gui/official/images/setup_on.png deleted file mode 100644 index cba7b68c9fac21e5ec9c2c909d179361f3d35b65..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/setup_on.png and /dev/null differ diff --git a/src/gui/official/images/sfl-logo.png b/src/gui/official/images/sfl-logo.png deleted file mode 100644 index aa2d43ab4d03dbba706df547608d2a053d562baf..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/sfl-logo.png and /dev/null differ diff --git a/src/gui/official/images/sflphone_logo.png b/src/gui/official/images/sflphone_logo.png deleted file mode 100644 index a1637322248865099cc2b88d75cbf6d091d84f24..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/sflphone_logo.png and /dev/null differ diff --git a/src/gui/official/images/signalisations.png b/src/gui/official/images/signalisations.png deleted file mode 100644 index 61a34b98a02d84d9e13f2f5df19e146e054b402c..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/signalisations.png and /dev/null differ diff --git a/src/gui/official/images/slider.png b/src/gui/official/images/slider.png deleted file mode 100644 index 22d9e9ed3bed149d3416a02ff3ed7edd7e82bb0a..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/slider.png and /dev/null differ diff --git a/src/gui/official/images/transfer_off.png b/src/gui/official/images/transfer_off.png deleted file mode 100644 index 7e9db097e9c97687121206985c8e173781a506ec..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/transfer_off.png and /dev/null differ diff --git a/src/gui/official/images/transfer_on.png b/src/gui/official/images/transfer_on.png deleted file mode 100644 index 806f06de449184ef527220dae7b6228ace2d727f..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/transfer_on.png and /dev/null differ diff --git a/src/gui/official/images/tray-icon.png b/src/gui/official/images/tray-icon.png deleted file mode 100644 index f9af862f1bcd76ea726a900648521b7fe5e70ff3..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/tray-icon.png and /dev/null differ diff --git a/src/gui/official/images/video.png b/src/gui/official/images/video.png deleted file mode 100644 index f642e00ba09a024c240475438db64c3c955e1838..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/video.png and /dev/null differ diff --git a/src/gui/official/images/voicemail_off.png b/src/gui/official/images/voicemail_off.png deleted file mode 100644 index 9dea4984d90c0b28220d059b16368ef8a6dbb6c3..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/voicemail_off.png and /dev/null differ diff --git a/src/gui/official/images/voicemail_on.png b/src/gui/official/images/voicemail_on.png deleted file mode 100644 index 9c0f1666dd69251add93b7ecb1d8ec58be4c0ff4..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/voicemail_on.png and /dev/null differ diff --git a/src/gui/official/images/volume.png b/src/gui/official/images/volume.png deleted file mode 100644 index 4a4da95f8879bc66fddbee530cdeb2c14eb1509e..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/volume.png and /dev/null differ diff --git a/src/gui/official/images/volume_off.png b/src/gui/official/images/volume_off.png deleted file mode 100644 index fd7a004e8909c524d5f67bd336a6b800a94f5385..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/volume_off.png and /dev/null differ diff --git a/src/gui/official/images/volume_on.png b/src/gui/official/images/volume_on.png deleted file mode 100644 index 13189014b3b0c34c25dd7b65f1ce4900d4f86e1e..0000000000000000000000000000000000000000 Binary files a/src/gui/official/images/volume_on.png and /dev/null differ diff --git a/src/gui/official/main.cpp b/src/gui/official/main.cpp deleted file mode 100644 index 130803c031a53ca49c59f6a659e1c30e6dc37a3e..0000000000000000000000000000000000000000 --- a/src/gui/official/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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 <iostream> -#include <stdexcept> -#include <qstring.h> - -#include "SFLPhoneApp.hpp" -#include "SFLPhoneWindow.hpp" - -int main(int argc, char **argv) -{ - SFLPhoneApp app(argc, argv); - SFLPhoneWindow* sfl = new SFLPhoneWindow(); - app.initConnections(sfl); -#ifndef QT3_SUPPORT - app.setMainWidget(sfl); -#endif - sfl->show(); - PhoneLineManager::instance().start(); - return app.exec(); -} diff --git a/src/gui/official/sflphone.pro b/src/gui/official/sflphone.pro deleted file mode 100644 index af7c8eec5674097022fc8ad765d8ddfa3bccb65b..0000000000000000000000000000000000000000 --- a/src/gui/official/sflphone.pro +++ /dev/null @@ -1,170 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.00a) Thu Sep 22 11:58:09 2005 -###################################################################### - -TEMPLATE = app -TARGET += -#DEPENDPATH += . -#INCLUDEPATH += . -# This line is for qt4: -# INCLUDEPATH += /usr/lib/qt4/include/Qt/ -QT += network qt3support -CONFIG += debug -DEFINES += QT_THREAD_SUPPORT - -FORMS = ConfigurationPanel.ui - -IMAGES += \ -images/about.png \ -images/audio.png \ -images/clear_off.png \ -images/clear_on.png \ -images/close_off.png \ -images/close_on.png \ -images/conference_off.png \ -images/conference_on.png \ -images/directory_off.png \ -images/directory_on.png \ -images/dtmf_0_off.png \ -images/dtmf_0_on.png \ -images/dtmf_1_off.png \ -images/dtmf_1_on.png \ -images/dtmf_2_off.png \ -images/dtmf_2_on.png \ -images/dtmf_3_off.png \ -images/dtmf_3_on.png \ -images/dtmf_4_off.png \ -images/dtmf_4_on.png \ -images/dtmf_5_off.png \ -images/dtmf_5_on.png \ -images/dtmf_6_off.png \ -images/dtmf_6_on.png \ -images/dtmf_7_off.png \ -images/dtmf_7_on.png \ -images/dtmf_8_off.png \ -images/dtmf_8_on.png \ -images/dtmf_9_off.png \ -images/dtmf_9_on.png \ -images/dtmf_close_off.png \ -images/dtmf_close_on.png \ -images/dtmf_main.png \ -images/dtmf_off.png \ -images/dtmf_on.png \ -images/dtmf_pound_off.png \ -images/dtmf_pound_on.png \ -images/dtmf_star_off.png \ -images/dtmf_star_on.png \ -images/gsm.png \ -images/hangup_off.png \ -images/hangup_on.png \ -images/hold_off.png \ -images/hold_on.png \ -images/l.png \ -images/l1_off.png \ -images/l1_on.png \ -images/l2_off.png \ -images/l2_on.png \ -images/l3_off.png \ -images/l3_on.png \ -images/l4_off.png \ -images/l4_on.png \ -images/l5_off.png \ -images/l5_on.png \ -images/l6_off.png \ -images/l6_on.png \ -images/logo_ico.png \ -images/main.png \ -images/minimize_off.png \ -images/minimize_on.png \ -images/mute_off.png \ -images/mute_on.png \ -images/network.png \ -images/ok_off.png \ -images/ok_on.png \ -images/overscreen.png \ -images/preferences.png \ -images/screen_main.png \ -images/setup_off.png \ -images/setup_on.png \ -images/sfl-logo.png \ -images/sflphone_logo.png \ -images/signalisations.png \ -images/slider.png \ -images/transfer_off.png \ -images/transfer_on.png \ -images/tray-icon.png \ -images/video.png \ -images/voicemail_off.png \ -images/voicemail_on.png \ -images/volume.png \ -images/volume_off.png \ -images/volume_on.png - -# Input -HEADERS += Account.hpp \ - CallManager.hpp \ - CallManagerImpl.hpp \ - Call.hpp \ - CallStatus.hpp \ - CallStatusFactory.hpp \ - ConfigurationManager.hpp \ - ConfigurationManagerImpl.hpp \ - DebugOutput.hpp \ - DebugOutputImpl.hpp \ - Event.hpp \ - EventFactory.hpp EventFactory.inl \ - Factory.hpp Factory.inl \ - globals.h \ - JPushButton.hpp \ - ObjectFactory.hpp \ - ObjectPool.hpp \ - PhoneLine.hpp \ - PhoneLineButton.hpp \ - PhoneLineLocker.hpp \ - PhoneLineManager.hpp \ - PhoneLineManagerImpl.hpp \ - QjListBoxPixmap.hpp \ - Request.hpp \ - Requester.hpp \ - RequesterImpl.hpp RequesterImpl.inl \ - Session.hpp \ - SessionIO.hpp \ - SessionIOFactory.hpp \ - SFLEvents.hpp \ - SFLLcd.hpp \ - SFLPhoneApp.hpp \ - SFLPhoneWindow.hpp \ - SFLRequest.hpp \ - TCPSessionIO.hpp \ - TCPSessionIOCreator.hpp \ - TransparentWidget.hpp \ - Url.hpp \ - VolumeControl.hpp -SOURCES += Account.cpp \ - Call.cpp \ - CallManagerImpl.cpp \ - CallStatus.cpp \ - ConfigurationManagerImpl.cpp \ - DebugOutputImpl.cpp \ - Event.cpp \ - JPushButton.cpp \ - main.cpp \ - PhoneLine.cpp \ - PhoneLineButton.cpp \ - PhoneLineLocker.cpp \ - PhoneLineManagerImpl.cpp \ - QjListBoxPixmap.cpp \ - Request.cpp \ - RequesterImpl.cpp \ - Session.cpp \ - SFLEvents.cpp \ - SFLLcd.cpp \ - SFLPhoneApp.cpp \ - SFLPhoneWindow.cpp \ - SFLRequest.cpp \ - TCPSessionIO.cpp \ - TCPSessionIOCreator.cpp \ - TransparentWidget.cpp \ - Url.cpp \ - VolumeControl.cpp -RESOURCES += sflphone.qrc diff --git a/src/gui/official/sflphone.qrc b/src/gui/official/sflphone.qrc deleted file mode 100644 index 0a2d796cc6ddbaf7f6918eb4fe6773f28e73de5f..0000000000000000000000000000000000000000 --- a/src/gui/official/sflphone.qrc +++ /dev/null @@ -1,40 +0,0 @@ -<RCC> - <qresource prefix="/sflphone" > - <file>images/audio.png</file> - <file>images/clear_off.png</file> - <file>images/clear_on.png</file> - <file>images/close_off.png</file> - <file>images/close_on.png</file> - <file>images/directory_on.png</file> - <file>images/hangup_off.png</file> - <file>images/hangup_on.png</file> - <file>images/hold_off.png</file> - <file>images/hold_on.png</file> - <file>images/l1_off.png</file> - <file>images/l1_on.png</file> - <file>images/l2_off.png</file> - <file>images/l2_on.png</file> - <file>images/l3_off.png</file> - <file>images/l3_on.png</file> - <file>images/l4_off.png</file> - <file>images/l4_on.png</file> - <file>images/l5_off.png</file> - <file>images/l5_on.png</file> - <file>images/l6_off.png</file> - <file>images/l6_on.png</file> - <file>images/logo_ico.png</file> - <file>images/main.png</file> - <file>images/minimize_off.png</file> - <file>images/minimize_on.png</file> - <file>images/mute_off.png</file> - <file>images/mute_on.png</file> - <file>images/ok_off.png</file> - <file>images/ok_on.png</file> - <file>images/overscreen.png</file> - <file>images/screen_main.png</file> - <file>images/slider.png</file> - <file>images/volume.png</file> - <file>images/volume_off.png</file> - <file>images/volume_on.png</file> - </qresource> -</RCC> diff --git a/src/gui/official/skin.ini b/src/gui/official/skin.ini deleted file mode 100644 index 8500847e8334a01280e7f948fa8e03e1489b172a..0000000000000000000000000000000000000000 --- a/src/gui/official/skin.ini +++ /dev/null @@ -1,39 +0,0 @@ -# Main window -l1=21,151 -l2=52,151 -l3=83,151 -l4=114,151 -l5=145,151 -l6=176,151 -hangup=225,156 -ok=225,182 -mute=225,94 -conference=225,69 -hold=225,68 -transfer=225,42 -voicemail=310,43 -setup=310,68 -dtmf=20,181 -directory=140,181 -screen=22,44 -minimize=353,5 -close=374,5 -vol_mic=347,155-100 -vol_spkr=365,155-100 -# -# DTMF Keypad -dtmf_1=12,22 -dtmf_2=58,22 -dtmf_3=104,22 -dtmf_4=12,67 -dtmf_5=58,67 -dtmf_6=104,67 -dtmf_7=12,112 -dtmf_8=58,112 -dtmf_9=104,112 -dtmf_star=12,157 -dtmf_0=58,157 -dtmf_pound=104,157 -dtmf_close=141,5 -# -# EOF diff --git a/src/gui/official/utilspp/EmptyType.hpp b/src/gui/official/utilspp/EmptyType.hpp deleted file mode 100644 index 42a64f9a782518d1d1de9988d35342f30ae09222..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/EmptyType.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_EMPTYTYPE_HPP -#define UTILSPP_EMPTYTYPE_HPP - -namespace utilspp -{ - struct EmptyType {}; -}; - -#endif diff --git a/src/gui/official/utilspp/Functors.hpp b/src/gui/official/utilspp/Functors.hpp deleted file mode 100644 index 1751185d962b83c77ee05aa1de71080586b358b5..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/Functors.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_FUNCTORS_HPP -#define UTILSPP_FUNCTORS_HPP - -#include "functor/Functor.hpp" - -#endif diff --git a/src/gui/official/utilspp/NonCopyable.hpp b/src/gui/official/utilspp/NonCopyable.hpp deleted file mode 100644 index eb5443129393b24f22cc0f223401d65bee763602..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/NonCopyable.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_NONCOPYABLE_HPP -#define UTILSPP_NONCOPYABLE_HPP - -namespace utilspp -{ - class NonCopyable - { - public: - NonCopyable() - {} - - private: - NonCopyable(const NonCopyable& r) - {} - }; -}; - -#endif diff --git a/src/gui/official/utilspp/NullType.hpp b/src/gui/official/utilspp/NullType.hpp deleted file mode 100644 index 819026474bef06b73aad5a6a5fccc192c952a8fd..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/NullType.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_NULLTYPE_HPP -#define UTILSPP_NULLTYPE_HPP - -namespace utilspp -{ - struct NullType; -}; - -#endif diff --git a/src/gui/official/utilspp/Singleton.hpp b/src/gui/official/utilspp/Singleton.hpp deleted file mode 100644 index 487cbebb5dcebcc2a1dbd7a2c7478e82e6737c78..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/Singleton.hpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "ThreadingSingle.hpp" -#include "singleton/SingletonHolder.hpp" diff --git a/src/gui/official/utilspp/SmartPtr.hpp b/src/gui/official/utilspp/SmartPtr.hpp deleted file mode 100644 index 43c400be97b389b20e213fa11055ec873cd874a2..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/SmartPtr.hpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_SMARTPTR_HPP -#define UTILSPP_SMARTPTR_HPP - -#include <stdexcept> -#include "NonCopyable.hpp" - -#define NULL_BODY_ERROR "the smart pointer contain a NULL pointer" - -namespace utilspp -{ - - template < typename Type = unsigned int > - class FastCount - { - public: - FastCount(Type count = 1) : mCount(count) - {} - - FastCount &operator++() - { - mCount++; - return *this; - } - - FastCount &operator--() - { - mCount--; - return *this; - } - - operator Type() - { - return mCount; - } - - Type useCount() - { - return mCount; - } - - private: - Type mCount; - }; - - - template < typename ContentType, typename CountPolicy = FastCount > - class CountingBody : public utilspp::NonCopyable - { - public: - CountingBody(ContentType *body) : mBody(body) - {} - - void inc() - { - ++mCount; - } - - void dec() - { - --mCount; - if (mCount <= 0) { - delete this; - } - } - - ContentType *get() - { - return mBody; - } - - protected: - ~CountingBody() - { - if (mBody != NULL) { - delete mBody; - mBody = NULL; - } - } - - private: - CountPolicy mCount; - ContentType *mBody; - }; - - - template < typename ContentType, typename CountingBodyPolicy = CountingBody> - class SharedPtr - { - public: - SharedPtr() : mContent(new CountingPolicy< ContentType >(NULL)) - {} - - explicit SharedPtr(ContentType *content) : mContent(new CountingBodyPolicy< ContentType >(content)) - {} - - ~SharedPtr() - { - mContent->dec(); - } - - SharedPtr(const SharedPtr &other) : mContent(other.mContent) - { - mContent->inc(); - } - - SharedPtr& operator=(const SharedPtr &other) - { - if(mContent->get() != other.mContent->get()) { - mContent->dec(); - mContent = other.mContent; - mContent->inc(); - } - return ( *this ); - } - - SharedPtr& operator=(ContentType *content) - { - mContent--; - mContent = new CountingBodyPolicy< ContentType >(content); - } - - bool operator==(const SharedPtr &other) const - { - return (mContent->get() == other.mContent->get()); - } - - bool operator!=(const SharedPtr &other) const - { - return (mContent->get() != other.mContent->get()); - } - - bool operator<(const SharedPtr &other) const - { - return (mContent->get() < other.mContent->get()); - } - - operator ContentType*() - { - return mContent->get(); - } - - ContentType& operator*() - { - if(mContent->get() == NULL) { - throw std::runtime_error(NULL_BODY_ERROR); - } - return *mContent->get(); - } - - ContentType* operator->() - { - if(mContent->get() == NULL) { - throw std::runtime_error(NULL_BODY_ERROR); - } - return mContent->get(); - } - - private: - CountingBodyPolicy * mContent; - }; -}; - -#endif diff --git a/src/gui/official/utilspp/ThreadingFactoryMutex.hpp b/src/gui/official/utilspp/ThreadingFactoryMutex.hpp deleted file mode 100644 index 5bd6225f29f58342919ec2489d09cd2079ff478f..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/ThreadingFactoryMutex.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef THREADING_FACTORY_MUTEX_HPP -#define THREADING_FACTORY_MUTEX_HPP - -namespace utilspp -{ - template < typename T > - struct ThreadingFactoryMutex - { - struct lock - { - lock(); - lock( const T & ); - }; - - typedef T VolatileType; - }; -}; - -#include "ThreadingFactoryMutex.inl" - -#endif diff --git a/src/gui/official/utilspp/ThreadingFactoryMutex.inl b/src/gui/official/utilspp/ThreadingFactoryMutex.inl deleted file mode 100644 index c9a9f62fbdb9ab4b40e6f5fab2c91e25f60db302..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/ThreadingFactoryMutex.inl +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef THREADING_FACTORY_MUTEX_INL -#define THREADING_FACTORY_MUTEX_INL - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock() -{}; - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock( const T & ) -{}; - -#endif \ No newline at end of file diff --git a/src/gui/official/utilspp/ThreadingSingle.hpp b/src/gui/official/utilspp/ThreadingSingle.hpp deleted file mode 100644 index bbab15b5c46ad8651c31be092d351338c33dd110..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/ThreadingSingle.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SINGLE_THREADED_HPP -#define SINGLE_THREADED_HPP - -#include "NullType.hpp" - -namespace utilspp -{ - template < typename T = utilspp::NullType > - struct ThreadingSingle - { - struct mutex - { - void lock(); - void unlock(); - }; - - struct lock - { - lock(); - lock( mutex &m ); - }; - - typedef T VolatileType; - }; -}; - -#include "ThreadingSingle.inl" - -#endif diff --git a/src/gui/official/utilspp/ThreadingSingle.inl b/src/gui/official/utilspp/ThreadingSingle.inl deleted file mode 100644 index fcb395ba2081b99d361fca85deb46cbbc07d5580..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/ThreadingSingle.inl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SINGLE_THREADED_INL -#define SINGLE_THREADED_INL - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock() -{}; - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock( - utilspp::ThreadingSingle< T >::mutex & ) -{} - -template< typename T > -inline -void -utilspp::ThreadingSingle< T >::mutex::lock() -{}; - -template< typename T > -inline -void -utilspp::ThreadingSingle< T >::mutex::unlock() -{}; - -#endif diff --git a/src/gui/official/utilspp/TypeList.hpp b/src/gui/official/utilspp/TypeList.hpp deleted file mode 100644 index 98cdee69f8e7d3268107c87e8ff49a002ccbf770..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/TypeList.hpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef TYPE_LIST_HPP -#define TYPE_LIST_HPP - -#include "NullType.hpp" - - - -#define TYPE_LIST_1( T1 ) utilspp::tl::TypeList< T1, utilspp::NullType > -#define TYPE_LIST_2( T1, T2 ) ::utilspp::tl::TypeList< T1, TYPE_LIST_1( T2 ) > -#define TYPE_LIST_3( T1, T2, T3 ) ::utilspp::tl::TypeList< T1, TYPE_LIST_2( T2, T3 ) > -#define TYPE_LIST_4( T1, T2, T3, T4 ) ::utilspp::tl::TypeList< T1, TYPE_LIST_3( T2, T3, T4 ) > -#define TYPE_LIST_5( T1, T2, T3, T4, T5 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_4( T2, T3, T4, T5 ) > -#define TYPE_LIST_6( T1, T2, T3, T4, T5, T6 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_5( T2, T3, T4, T5, T6 ) > -#define TYPE_LIST_7( T1, T2, T3, T4, T5, T6, T7 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_6( T2, T3, T4, T5, T6, T7 ) > -#define TYPE_LIST_8( T1, T2, T3, T4, T5, T6, T7, T8 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_7( T2, T3, T4, T5, T6, T7, T8 ) > -#define TYPE_LIST_9( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_8( T2, T3, T4, T5, T6, T7, T8, T9 ) > -#define TYPE_LIST_10( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_9( T2, T3, T4, T5, T6, T7, T8, T9, T10 ) > -#define TYPE_LIST_11( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_10( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 ) > -#define TYPE_LIST_12( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_11( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 ) > -#define TYPE_LIST_13( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_12( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 ) > -#define TYPE_LIST_14( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_13( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 ) > -#define TYPE_LIST_15( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_14( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) > - - -namespace utilspp -{ - namespace tl - { - template< class T, class U > - struct TypeList - { - typedef T head; - typedef U tail; - }; - - //Calculating length of TypeLists - template< class TList > - struct length; - - template<> - struct length< NullType > - { - enum { value = 0 }; - }; - - template< class T, class U > - struct length< TypeList< T, U > > - { - enum { value = 1 + length< U >::value }; - }; - - /** - * Returns the type at a given position (zero-based) - * in TList. If the index is greather than or equal to - * the length of TList, a compile-time error occurs. - */ - template< class TList, unsigned int index > - struct TypeAt; - - template< class THead, class TTail > - struct TypeAt< TypeList< THead, TTail >, 0 > - { - typedef THead Result; - }; - - template< class THead, class TTail, unsigned int i > - struct TypeAt< TypeList< THead, TTail >, i > - { - typedef typename TypeAt< TTail, i - 1 >::Result Result; - }; - - /** - * Returns the type at a given position (zero-based) - * in TList. If the index is greather than or equal to - * the length of TList, OutOfBound template class is - * returned. - */ - template< class TList, unsigned int index, class OutOfBound = utilspp::NullType > - struct TypeAtNonStrict; - - template< class THead, class TTail, class OutOfBound > - struct TypeAtNonStrict< TypeList< THead, TTail >, 0, OutOfBound > - { - typedef THead Result; - }; - - template< class THead, class TTail, unsigned int i, class OutOfBound > - struct TypeAtNonStrict< TypeList< THead, TTail >, i, OutOfBound > - { - typedef typename TypeAtNonStrict< TTail, i - 1 >::Result Result; - }; - - template< unsigned int i, class OutOfBound > - struct TypeAtNonStrict< utilspp::NullType, i , OutOfBound> - { - typedef OutOfBound Result; - }; - - - //Searching TypeLists - template< class TList, class T > - struct IndexOf; - - template< class T > - struct IndexOf< NullType, T > - { - enum { value = -1 }; - }; - - template< class TTail, class T > - struct IndexOf< TypeList< T, TTail >, T > - { - enum { value = 0 }; - }; - - template< class THead, class TTail, class T > - struct IndexOf< TypeList< THead, TTail >, T > - { - private: - enum { temp = IndexOf< TTail, T >::value }; - - public: - enum { value = temp == -1 ? -1 : 1 + temp }; - }; - - //Appending to TypeLists - template< class TList, class T > - struct append; - - template <> - struct append< NullType, NullType > - { - typedef NullType Result; - }; - - template< class T > - struct append< NullType, T > - { - typedef TYPE_LIST_1( T ) Result; - }; - - template< class THead, class TTail > - struct append< NullType, TypeList< THead, TTail > > - { - typedef TypeList< THead, TTail > Result; - }; - - template < class THead, class TTail, class T > - struct append< TypeList< THead, TTail >, T > - { - typedef TypeList< THead, typename append< TTail, T >::Result > - Result; - }; - - //Erasing a type from a TypeList - template< class TList, class T > - struct erase; - - template< class T > - struct erase< NullType, T > - { - typedef NullType Result; - }; - - template< class T, class TTail > - struct erase< TypeList< T, TTail >, T > - { - typedef TTail Result; - }; - - template< class THead, class TTail, class T > - struct erase< TypeList< THead, TTail >, T > - { - typedef TypeList< THead, typename erase< TTail, T >::Result > - Result; - }; - }; -}; - - -#endif - diff --git a/src/gui/official/utilspp/TypeTrait.hpp b/src/gui/official/utilspp/TypeTrait.hpp deleted file mode 100644 index 7046f6ee013fd8ac240afd04a2152e49ac350180..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/TypeTrait.hpp +++ /dev/null @@ -1,916 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_TYPETRAIT_HPP -#define UTILSPP_TYPETRAIT_HPP - -#include "NullType.hpp" - -namespace utilspp -{ - template< typename T > - class TypeTrait - { - private: - template< typename U > - struct unreference - { - typedef U type; - }; - - template< typename U > - struct unreference< U & > - { - typedef U type; - }; - - template< typename U > - struct unconst - { - typedef U type; - }; - - template< typename U > - struct unconst< const U > - { - typedef U type; - }; - - public: - typedef typename unreference< T >::type NonReference; - typedef typename unconst< T >::type NonConst; - typedef typename unconst< unreference< T >::type >::type NonParam; - }; - - template< class T > - struct PointerOnMemberFunction - { - typedef utilspp::NullType ClassType; - typedef utilspp::NullType ReturnType; - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V, typename W > - struct PointerOnMemberFunction< W(V::*)() > - { - typedef V ClassType; - typedef W ReturnType; - - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V, typename W, typename X > - struct PointerOnMemberFunction< W(V::*)(X) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_1(X) ParamList; - }; - - template< typename V, typename W, typename X, typename Y > - struct PointerOnMemberFunction< W(V::*)(X, Y) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_2(X, Y) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_4(X, Y, Z, A) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_5(X, Y, Z, A, B) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_6(X, Y, Z, A, B, C) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_7(X, Y, Z, A, B, C, D) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_8(X, Y, Z, A, B, C, D, E) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_9(X, Y, Z, A, B, C, D, E, F) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_10(X, Y, Z, A, B, C, D, E, F, G) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_11(X, Y, Z, A, B, C, D, E, F, G, H) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_12(X, Y, Z, A, B, C, D, E, F, G, H, I) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I, J) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef J Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_13(X, Y, Z, A, B, C, D, E, F, G, H, I, J) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef J Param13Type; - typedef K Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_14(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K, L) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef J Param13Type; - typedef K Param14Type; - typedef L Param15Type; - - typedef TYPE_LIST_15(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K, L) ParamList; - }; - - template< typename T > - struct PointerOnFunction - { - typedef utilspp::NullType ReturnType; - - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V > - struct PointerOnFunction< V(*)() > - { - typedef V ReturnType; - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V, typename W > - struct PointerOnFunction< V(*)(W) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_1(W) ParamList; - }; - - template< typename V, typename W, typename X > - struct PointerOnFunction< V(*)(W, X) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_2(W, X) ParamList; - }; - - template< typename V, typename W, typename X, typename Y > - struct PointerOnFunction< V(*)(W, X, Y) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(W, X, Y) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnFunction< V(*)(W, X, Y, Z) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_4(W, X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A > - struct PointerOnFunction< V(*)(W, X, Y, Z, A) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_5(W, X, Y, Z, A) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_6(W, X, Y, Z, A, B) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_7(W, X, Y, Z, A, B, C) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_8(W, X, Y, Z, A, B, C, D) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_9(W, X, Y, Z, A, B, C, D, E) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_10(W, X, Y, Z, A, B, C, D, E, F) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_11(W, X, Y, Z, A, B, C, D, E, F, G) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_12(W, X, Y, Z, A, B, C, D, E, F, G, H) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H, I) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef I Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_13(W, X, Y, Z, A, B, C, D, E, F, G, H, I ) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef I Param13Type; - typedef J Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_14(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J ) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef I Param13Type; - typedef J Param14Type; - typedef K Param15Type; - - typedef TYPE_LIST_15(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) ParamList; - }; - -}; - -#endif diff --git a/src/gui/official/utilspp/singleton/CreationStatic.hpp b/src/gui/official/utilspp/singleton/CreationStatic.hpp deleted file mode 100644 index 27570f5308802c89614944ae3ab97b7fafdf7c8f..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/CreationStatic.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef CREATION_STATIC_HPP -#define CREATION_STATIC_HPP - -/** - * This class is a creation policy for the utilspp::singleton_holder. The - * policy is creating the singleton by a static memory. The constructor is - * called the first time we call the utilspp::creation_static::create() - * function. - * - * Note don't use this class because it's not complete, and at this time it's - * not REALY complyant with the lifetime policy. - */ -namespace utilspp -{ - template< typename T > - class CreationStatic - { - public: - static T* create(); - static void destroy( T* obj ); - }; -}; - -#include "CreationStatic.inl" - -#endif diff --git a/src/gui/official/utilspp/singleton/CreationStatic.inl b/src/gui/official/utilspp/singleton/CreationStatic.inl deleted file mode 100644 index 9572e5eca75f2d2e054cb7ea12d68a2cb33677b4..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/CreationStatic.inl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef CREATION_STATIC_INL -#define CREATION_STATIC_INL - -template< typename T > -T* -utilspp::CreationStatic::create() -{ - static T mObj; - return new(&mObj) T; -}; - -template< typename T > -void -utilspp::CreationStatic::destroy( T* obj ) -{ - obj->~T(); -} - - -#endif \ No newline at end of file diff --git a/src/gui/official/utilspp/singleton/CreationUsingNew.hpp b/src/gui/official/utilspp/singleton/CreationUsingNew.hpp deleted file mode 100644 index 5055db5b8ff0866159e9ad488312cee6e9a900c5..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/CreationUsingNew.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef CREATION_USING_NEW_HPP -#define CREATION_USING_NEW_HPP - -/** - * This class is a creation policy for the utilspp::singleton_holder. The - * policy is creating the singleton by a "new" call. - */ -namespace utilspp -{ - template< typename T > - struct CreationUsingNew - { - static T *create(); - static void destroy( T *obj ); - }; -}; - -#include "CreationUsingNew.inl" - -#endif diff --git a/src/gui/official/utilspp/singleton/CreationUsingNew.inl b/src/gui/official/utilspp/singleton/CreationUsingNew.inl deleted file mode 100644 index adb66ede9ee12036dbcc41f9469475378190a8b3..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/CreationUsingNew.inl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef CREATION_USING_NEW_INL -#define CREATION_USING_NEW_INL - -template< typename T > -T * -utilspp::CreationUsingNew< T >::create() -{ - return new T; -} - -template< typename T > -void -utilspp::CreationUsingNew< T >::destroy( T *obj ) -{ - delete obj; -} - - -#endif diff --git a/src/gui/official/utilspp/singleton/LifetimeDefault.hpp b/src/gui/official/utilspp/singleton/LifetimeDefault.hpp deleted file mode 100644 index 9c77138109a0385d267c52626e381fe0f3e5f36e..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/LifetimeDefault.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef LIFETIME_DEFAULT_HPP -#define LIFETIME_DEFAULT_HPP - -#include <stdexcept> -#include <cstdlib> - -namespace utilspp -{ - template< typename T > - class LifetimeDefault - { - public: - static void scheduleDestruction( T *obj, void (*func)() ); - static void onDeadReference(); - }; -}; - -#include "LifetimeDefault.inl" - -#endif diff --git a/src/gui/official/utilspp/singleton/LifetimeDefault.inl b/src/gui/official/utilspp/singleton/LifetimeDefault.inl deleted file mode 100644 index a8e63f9fc43ede97e653513d336327ca93e242a7..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/LifetimeDefault.inl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef LIFETIME_DEFAULT_INL -#define LIFETIME_DEFAULT_INL - -template< typename T > -void -utilspp::LifetimeDefault< T >::scheduleDestruction( T *, void (*func)() ) -{ - std::atexit(func); -} - -template< typename T > -void -utilspp::LifetimeDefault< T >::onDeadReference() -{ - throw std::logic_error( "Dead reference detected" ); -} - - -#endif diff --git a/src/gui/official/utilspp/singleton/LifetimeLibrary.hpp b/src/gui/official/utilspp/singleton/LifetimeLibrary.hpp deleted file mode 100644 index 80fba716ab70484e4cd5525be39e9e08cf40a276..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/LifetimeLibrary.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef LIFETIME_LIBRARY_HPP -#define LIFETIME_LIBRARY_HPP - -#include <cassert> - -#include "PrivateMembers.hpp" -#include "CreationUsingNew.hpp" - -namespace utilspp -{ - - template< typename T > - unsigned int getLongevity( T *p ); - - /** - * Assigns an object a longevity. Ensures ordered destructions of objects - * registered thusly during the exit sequence of the application. - */ - template< typename T, typename TDestroyer > - void setLibraryLongevity( - T *obj, - unsigned int longevity, - TDestroyer d = utilspp::PrivateMembers::Deleter< T >::deleteObject - ); - - /** - * This class is a lifetime policy for the singleton. This - * class allow you to terminate the singleton explicitly. - * You can terminate by calling: - * - * LifetimeLibrarySingleton::instance().terminate() - * - * This singleton use the utilspp::LifetimeWithLongevity policy. - */ - template< typename T > - struct LifetimeLibrary - { - static void scheduleDestruction( T *obj, void (*func)() ); - static void onDeadReference(); - }; - - class LifetimeLibraryImpl - { - public: - LifetimeLibraryImpl(); - ~LifetimeLibraryImpl(); - - void add( utilspp::PrivateMembers::LifetimeTracker *tracker ); - void terminate(); - - private: - utilspp::PrivateMembers::TrackerArray mTrackerArray; - int mNbElements; - }; - - unsigned int getLongevity( utilspp::LifetimeLibraryImpl *p ); - - typedef utilspp::SingletonHolder< - utilspp::LifetimeLibraryImpl, - utilspp::CreationUsingNew, - utilspp::LifetimeWithLongevity - > LifetimeLibrarySingleton; - - /** - * This class will ensure that - * - * LifetimeLibraryImpl::terminate() - * - * is called. - */ - template< typename T = utilspp::LifetimeLibrarySingleton > - class LifetimeLibraryGuard - { - public: - ~LifetimeLibraryGuard(); - }; -}; - -#include "LifetimeLibrary.inl" - -#endif diff --git a/src/gui/official/utilspp/singleton/LifetimeLibrary.inl b/src/gui/official/utilspp/singleton/LifetimeLibrary.inl deleted file mode 100644 index b7ab8e6d66d2bb38719e8b0b6d163636f33bcdbd..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/LifetimeLibrary.inl +++ /dev/null @@ -1,33 +0,0 @@ -template< typename T, typename TDestroyer > -void -utilspp::setLibraryLongevity( T *obj, unsigned int longevity, TDestroyer d ) -{ - using namespace utilspp::PrivateMembers; - - LifetimeTracker *p = new ConcreteLifetimeTracker< T, TDestroyer >( - obj, longevity, d); - - utilspp::LifetimeLibrarySingleton::instance().add( p ); -}; - -template< typename T > -void -utilspp::LifetimeLibrary< T >::scheduleDestruction( T *obj, void (*func)() ) -{ - utilspp::PrivateMembers::adapter<T> adapter = { func }; - utilspp::setLibraryLongevity( obj, getLongevity( obj ), adapter ); -} - -template< typename T > -void -utilspp::LifetimeLibrary< T >::onDeadReference() -{ - throw std::logic_error("Dead reference detected"); -} - -template< typename T > -utilspp::LifetimeLibraryGuard< T >::~LifetimeLibraryGuard() -{ - T::instance().terminate(); -} - diff --git a/src/gui/official/utilspp/singleton/LifetimeWithLongevity.hpp b/src/gui/official/utilspp/singleton/LifetimeWithLongevity.hpp deleted file mode 100644 index 888475126411719da68a0d7043ef358eac7b79da..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/LifetimeWithLongevity.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef LIFETIME_WITH_LONGEVITY_HPP -#define LIFETIME_WITH_LONGEVITY_HPP - -#include <cassert> - -#include "PrivateMembers.hpp" - -namespace utilspp -{ - - template< typename T > - unsigned int getLongevity( T *p ); - - /** - * Assigns an object a longevity. Ensures ordered destructions of objects - * registered thusly during the exit sequence of the application. - */ - template< typename T, typename TDestroyer > - void setLongevity(T *obj, - unsigned int longevity, - TDestroyer d = utilspp::PrivateMembers::Deleter< T >::deleteObject); - - template< typename T > - struct LifetimeWithLongevity - { - static void scheduleDestruction( T *obj, void (*func)() ); - static void onDeadReference(); - }; -}; - -#include "LifetimeWithLongevity.inl" - -#endif diff --git a/src/gui/official/utilspp/singleton/LifetimeWithLongevity.inl b/src/gui/official/utilspp/singleton/LifetimeWithLongevity.inl deleted file mode 100644 index aaaf0ebfb5befbf0b528e247ccc0b2157576f499..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/LifetimeWithLongevity.inl +++ /dev/null @@ -1,56 +0,0 @@ -template< typename T, typename TDestroyer > -void -utilspp::setLongevity( T *obj, unsigned int longevity, TDestroyer d ) -{ - using namespace utilspp::PrivateMembers; - - TrackerArray newArray = static_cast< TrackerArray >( - std::realloc(mTrackerArray, mNbElements + 1)); - if( newArray == NULL ) - { - throw std::bad_alloc(); - } - - LifetimeTracker *p = - new ConcreteLifetimeTracker< T, TDestroyer >(obj, longevity, d); - - mTrackerArray = newArray; - - TrackerArray pos = std::upper_bound( - mTrackerArray, - mTrackerArray + mNbElements, - p, - &LifetimeTracker::compare); - std::copy_backward( - pos, - mTrackerArray + mNbElements, - mTrackerArray + mNbElements + 1); - - *pos = p; - mNbElements++; - std::atexit( &atExitFunc ); -}; - -template< typename T > -void -utilspp::LifetimeWithLongevity< T >::scheduleDestruction( T *obj, void (*func)() ) -{ - utilspp::PrivateMembers::adapter<T> adapter = { func }; - utilspp::setLongevity( obj, getLongevity( obj ), adapter ); -} - -template< typename T > -void -utilspp::LifetimeWithLongevity< T >::onDeadReference() -{ - throw std::logic_error("Dead reference detected"); -} - -template< typename T > -unsigned int -utilspp::getLongevity( T * ) -{ - return 1000; -} - - diff --git a/src/gui/official/utilspp/singleton/PrivateMembers.hpp b/src/gui/official/utilspp/singleton/PrivateMembers.hpp deleted file mode 100644 index b1fb8cd22e7b9d7356a9e57fa735c1e4f0ff91e8..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/PrivateMembers.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef PRIVATE_MEMBERS_HPP -#define PRIVATE_MEMBERS_HPP - -#include <cassert> - -namespace utilspp -{ - namespace PrivateMembers - { - /** - * Helper class for utils::setLongevity - */ - class LifetimeTracker - { - public: - LifetimeTracker( unsigned int longevity ); - virtual ~LifetimeTracker(); - static bool compare( - const LifetimeTracker *l, - const LifetimeTracker *r - ); - - private: - unsigned int mLongevity; - }; - - typedef LifetimeTracker** TrackerArray; - - extern TrackerArray mTrackerArray; - extern int mNbElements; - - /** - * Helper class for Destroyer - */ - template< typename T > - struct Deleter - { - void deleteObject( T *obj ); - }; - - /** - * Concrete lifetime tracker for objects of type T - */ - template< typename T, typename TDestroyer > - class ConcreteLifetimeTracker : public LifetimeTracker - { - public: - ConcreteLifetimeTracker(T *obj, unsigned int longevity, TDestroyer d); - - ~ConcreteLifetimeTracker(); - - private: - T* mTracked; - TDestroyer mDestroyer; - }; - - void atExitFunc(); - - template <class T> - struct adapter - { - void operator()(T*); - void (*mFunc)(); - }; - }; -}; - -#include "PrivateMembers.inl" - -#endif diff --git a/src/gui/official/utilspp/singleton/PrivateMembers.inl b/src/gui/official/utilspp/singleton/PrivateMembers.inl deleted file mode 100644 index 8f3609416cd2e78a4995ab0594b62c0a73729237..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/PrivateMembers.inl +++ /dev/null @@ -1,30 +0,0 @@ - -template< typename T > -void -utilspp::PrivateMembers::Deleter< T >::deleteObject( T *obj ) -{ - delete obj; -} - -template< typename T, typename TDestroyer > -utilspp::PrivateMembers::ConcreteLifetimeTracker< T, TDestroyer >::ConcreteLifetimeTracker( - T *obj, unsigned int longevity, TDestroyer d) -: LifetimeTracker( longevity ) -, mTracked( obj ) -, mDestroyer( d ) -{} - -template< typename T, typename TDestroyer > -utilspp::PrivateMembers::ConcreteLifetimeTracker< T, TDestroyer >::~ConcreteLifetimeTracker() -{ - mDestroyer( mTracked ); -} - - -template < typename T > -void -utilspp::PrivateMembers::adapter< T >::operator()(T*) -{ - return (*mFunc)(); -} - diff --git a/src/gui/official/utilspp/singleton/SingletonHolder.hpp b/src/gui/official/utilspp/singleton/SingletonHolder.hpp deleted file mode 100644 index 8a8590a7b2e31666547357ccef12678244a42e40..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/SingletonHolder.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SINGLETON_HOLDER_HPP -#define SINGLETON_HOLDER_HPP - -#include <cassert> - -#include "CreationUsingNew.hpp" -#include "LifetimeDefault.hpp" -#include "LifetimeWithLongevity.hpp" -#include "../ThreadingSingle.hpp" - -namespace utilspp -{ - template - < class T, - template < class > class CreationPolicy = utilspp::CreationUsingNew, - template < class > class LifetimePolicy = utilspp::LifetimeDefault, - template < class > class ThreadingModel = utilspp::ThreadingSingle > - class SingletonHolder - { - public: - //the accessor method. - static T& instance(); - static void makeInstance(); - static void terminate(); - - protected: - //protected to be sure that nobody may create one by himself. - SingletonHolder(); - - private: - static void destroySingleton(); - - private: - typedef typename ThreadingModel< T * >::VolatileType InstanceType; - static InstanceType mInstance; - static bool mDestroyed; - }; - -}; - -#include "SingletonHolder.inl" - -#endif diff --git a/src/gui/official/utilspp/singleton/SingletonHolder.inl b/src/gui/official/utilspp/singleton/SingletonHolder.inl deleted file mode 100644 index 84f27bea9feb7ea73475d31fd5903df56b5c72a8..0000000000000000000000000000000000000000 --- a/src/gui/official/utilspp/singleton/SingletonHolder.inl +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SINGLETON_HOLDER_INL -#define SINGLETON_HOLDER_INL - -template -< -class T, -template < class > class CreationPolicy, -template < class > class LifetimePolicy, -template < class > class ThreadingModel -> -T& -utilspp::SingletonHolder -< -T, -CreationPolicy, -LifetimePolicy, -ThreadingModel -> -::instance() -{ - if ( mInstance == NULL ) - { - makeInstance(); - } - - return ( *mInstance ); -}; - -template -< -class T, -template < class > class CreationPolicy, -template < class > class LifetimePolicy, -template < class > class ThreadingModel -> -void -utilspp::SingletonHolder -< -T, -CreationPolicy, -LifetimePolicy, -ThreadingModel ->::makeInstance() -{ - if ( mInstance == NULL ) - { - typename ThreadingModel< T >::lock guard; - (void)guard; - - if ( mInstance == NULL ) { - if ( mDestroyed ) - { - LifetimePolicy< T >::onDeadReference(); - mDestroyed = false; - } - - mInstance = CreationPolicy< T >::create(); - LifetimePolicy< T >::scheduleDestruction( mInstance, &destroySingleton ); - } - } -} - -template -< -class T, -template < class > class CreationPolicy, -template < class > class LifetimePolicy, -template < class > class ThreadingModel -> -void -utilspp::SingletonHolder -< -T, -CreationPolicy, -LifetimePolicy, -ThreadingModel -> -::destroySingleton() -{ - assert( !mDestroyed ); - CreationPolicy< T >::destroy( mInstance ); - mInstance = NULL; - mDestroyed = true; -} - -template < class T, -template < class > class C, -template < class > class L, -template < class > class M -> -typename utilspp::SingletonHolder< T, C, L, M>::InstanceType -utilspp::SingletonHolder< T, C, L, M >::mInstance; - -template -< -class T, -template < class > class C, -template < class > class L, -template < class > class M -> -bool utilspp::SingletonHolder< T, C, L, M >::mDestroyed; - -#endif