diff --git a/src/gui/official/Account.hpp b/src/gui/official/Account.hpp index 32a98ef272c0b4e3372bbc574697dafd7e811a9c..250dfa973cb8d9904339b1851efaa651b371bdef 100644 --- a/src/gui/official/Account.hpp +++ b/src/gui/official/Account.hpp @@ -21,7 +21,7 @@ #ifndef SFLPHONEGUI_ACCOUNT_H #define SFLPHONEGUI_ACCOUNT_H -#include <QString> +#include <qstring.h> class Call; diff --git a/src/gui/official/Call.cpp b/src/gui/official/Call.cpp index 792709544a7074eca8c4ce7f3d5420b90a5a5934..aea0609799c778b6735a2d701c325a7efc25b758 100644 --- a/src/gui/official/Call.cpp +++ b/src/gui/official/Call.cpp @@ -18,7 +18,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <QString> +#include <qstring.h> #include <list> #include "Account.hpp" diff --git a/src/gui/official/Call.hpp b/src/gui/official/Call.hpp index 018b424f8c7131c55c778d3a899c7e518ef16f24..aef0332febd73925de39583583ee8d7dd86fb5f4 100644 --- a/src/gui/official/Call.hpp +++ b/src/gui/official/Call.hpp @@ -21,7 +21,7 @@ #ifndef SFLPHONEGUI_CALL_H #define SFLPHONEGUI_CALL_H -#include <QString> +#include <qstring.h> class Session; class Account; diff --git a/src/gui/official/CallManagerImpl.cpp b/src/gui/official/CallManagerImpl.cpp index 9bcff55e42d224a20074fa55b601a65caa25513f..e3463c3140ddbb524a19fa53ee1a5e6a78c6279f 100644 --- a/src/gui/official/CallManagerImpl.cpp +++ b/src/gui/official/CallManagerImpl.cpp @@ -42,7 +42,8 @@ CallManagerImpl::unregisterCall(const QString &id) QMutexLocker guard(&mCallsMutex); std::map< QString, Call >::iterator pos = mCalls.find(id); if(pos == mCalls.end()) { - throw std::runtime_error(QString("Trying to unregister an unregistred call (%1)").arg(id).toStdString().c_str()); + //TODO + //throw std::runtime_error(QString("Trying to unregister an unregistred call (%1)").arg(id).toStdString().c_str()); } mCalls.erase(pos); @@ -54,7 +55,8 @@ 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(QString("Trying to retreive an unregistred call (%1)").arg(id).toStdString().c_str()); + //TODO + //throw std::runtime_error(QString("Trying to retreive an unregistred call (%1)").arg(id).toStdString().c_str()); } return pos->second; diff --git a/src/gui/official/CallManagerImpl.hpp b/src/gui/official/CallManagerImpl.hpp index c71c496e6bb7aca96c45e2ba444fd855447a545f..78b4c27b2ad0463cfaa4cfd5c093a834df207112 100644 --- a/src/gui/official/CallManagerImpl.hpp +++ b/src/gui/official/CallManagerImpl.hpp @@ -21,8 +21,8 @@ #ifndef __CALL_MANAGER_IMPL_HPP__ #define __CALL_MANAGER_IMPL_HPP__ -#include <QMutex> -#include <QString> +#include <qmutex.h> +#include <qstring.h> #include <map> #include "Call.hpp" diff --git a/src/gui/official/CallStatus.cpp b/src/gui/official/CallStatus.cpp index 343a333135ca82a4863d3bf208a5eca2716e5115..7df7b23b2470f63fb15f2915d25190b5be5a54c3 100644 --- a/src/gui/official/CallStatus.cpp +++ b/src/gui/official/CallStatus.cpp @@ -23,14 +23,14 @@ void CallStatus::execute() { QString id = getCallId(); - if(id.size() > 0) { - _debug("%s status received for call ID: %s.\n", - mStatus.toStdString().c_str(), - id.toStdString().c_str()); + 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 { - _debug("Status invalid: %s\n", toString().toStdString().c_str()); + DebugOutput::instance() << QObject::tr("Status invalid: %1\n").arg(toString()); } } diff --git a/src/gui/official/DebugOutput.hpp b/src/gui/official/DebugOutput.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0001320532a37311b69ddd82d22443d5e588147d --- /dev/null +++ b/src/gui/official/DebugOutput.hpp @@ -0,0 +1,30 @@ +/** + * 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 new file mode 100644 index 0000000000000000000000000000000000000000..c276a3bc4ac34bba352f50459461773d61a87fd2 --- /dev/null +++ b/src/gui/official/DebugOutputImpl.cpp @@ -0,0 +1,31 @@ +/* + * 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 "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 new file mode 100644 index 0000000000000000000000000000000000000000..8a182d27bbc9bce7fa0fd9743e8e6ea5cb5ac029 --- /dev/null +++ b/src/gui/official/DebugOutputImpl.hpp @@ -0,0 +1,38 @@ +/* + * 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 index 84ad65d6ba3a5c436d952063e86b7063b946065e..fe4f4eb036f2cf57e2c3ef08a812a7da954b6e25 100644 --- a/src/gui/official/Event.cpp +++ b/src/gui/official/Event.cpp @@ -1,6 +1,9 @@ +#include <qobject.h> + #include "globals.h" #include "Call.hpp" +#include "DebugOutput.hpp" #include "Event.hpp" Event::Event(const QString &code, @@ -14,7 +17,7 @@ Event::Event(const QString &code, void Event::execute() { - _debug("Event: Received: %s\n", toString().toStdString().c_str()); + DebugOutput::instance() << QObject::tr("Event: Received: %1\n").arg(toString()); } QString diff --git a/src/gui/official/Event.hpp b/src/gui/official/Event.hpp index 1b54b0dd2ab3b46460ba935373115790017a0632..1fea8a1762ad127fe5910c96ace154cfe1ddea86 100644 --- a/src/gui/official/Event.hpp +++ b/src/gui/official/Event.hpp @@ -22,7 +22,7 @@ #define __EVENT_HPP__ #include <list> -#include <QString> +#include <qstring.h> class Event { diff --git a/src/gui/official/EventFactory.hpp b/src/gui/official/EventFactory.hpp index 97f584044f60738389810b1a3d2b53b914f0ddbc..1a21f156882b5531307b9ecabcec7b0c1bc112af 100644 --- a/src/gui/official/EventFactory.hpp +++ b/src/gui/official/EventFactory.hpp @@ -23,7 +23,7 @@ #include <list> #include <map> -#include <QString> +#include <qstring.h> #include "Event.hpp" diff --git a/src/gui/official/EventFactory.inl b/src/gui/official/EventFactory.inl index 90dc8a4ba7fbe9308c2c2ab6b1584b65e9085bad..369d47e2170c0e81efcd82d0ea5d7f63c98dc5d1 100644 --- a/src/gui/official/EventFactory.inl +++ b/src/gui/official/EventFactory.inl @@ -22,8 +22,10 @@ #ifndef __EVENTFACTORY_INL__ #define __EVENTFACTORY_INL__ +#include <qobject.h> #include <stdexcept> +#include "DebugOutput.hpp" template< typename Base, typename Actual > Actual * @@ -56,9 +58,8 @@ EventFactoryImpl< Base >::create(const QString &code, return mDefaultCreator->create(code, args); } else{ - throw std::logic_error(QString("The code %s has no creator registered " - "and there's no default creator" - ).arg(code).toStdString().c_str()); + DebugOutput::instance() << QObject::tr("The code %1 has no creator registered.\n" + "and there's no default creator").arg(code); } } diff --git a/src/gui/official/JPushButton.cpp b/src/gui/official/JPushButton.cpp index d17c2c8e6f3c548d13ccf47dbdc2fb477fb40b47..b19113ac7b7df48e528bac020e8d1869a88019c4 100644 --- a/src/gui/official/JPushButton.cpp +++ b/src/gui/official/JPushButton.cpp @@ -21,10 +21,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <QBitmap> -#include <QEvent> -#include <QImage> -#include <QMouseEvent> +#include <qbitmap.h> +#include <qevent.h> +#include <qimage.h> +#include <qevent.h> #include "globals.h" @@ -32,9 +32,8 @@ JPushButton::JPushButton(const QString &released, const QString &pressed, - QWidget* parent, - Qt::WFlags flags) - : QLabel(parent, flags) + QWidget* parent) + : QLabel(parent) , mIsPressed(false) , mIsToggling(false) { @@ -53,10 +52,9 @@ JPushButton::setToggle(bool toggle) } QPixmap -JPushButton::transparize(const QString &image) +JPushButton::transparize(const QPixmap &image) { - QPixmap p(image); - + /** if (!p.mask()) { if (p.hasAlphaChannel()) { p.setMask(p.alphaChannel()); @@ -65,17 +63,19 @@ JPushButton::transparize(const QString &image) p.setMask(p.createHeuristicMask()); } } - - return p; + */ + return image; } void JPushButton::release(bool modify) { setPixmap(mImages[0]); + /* if(mImages[0].hasAlpha()) { setMask(mImages[0].mask()); } + */ resize(mImages[0].size()); } @@ -83,9 +83,10 @@ void JPushButton::press(bool modify) { setPixmap(mImages[1]); + /* if(mImages[1].hasAlpha()) { setMask(mImages[1].mask()); - } + }*/ resize(mImages[1].size()); } diff --git a/src/gui/official/JPushButton.hpp b/src/gui/official/JPushButton.hpp index 4e394a97d44d7617f09c0e1db782efd02bb010d7..a6fc410e93860d86fdaedc4678e5c802f44d9cfa 100644 --- a/src/gui/official/JPushButton.hpp +++ b/src/gui/official/JPushButton.hpp @@ -24,9 +24,9 @@ #ifndef __J_PUSH_BUTTON_H__ #define __J_PUSH_BUTTON_H__ -#include <QLabel> -#include <QPixmap> -#include <QImage> +#include <qlabel.h> +#include <qpixmap.h> +#include <qimage.h> /** * This class Emulate a PushButton but takes two @@ -39,14 +39,13 @@ class JPushButton : public QLabel public: JPushButton(const QString &released, const QString &pressed, - QWidget *parent, - Qt::WFlags flags = 0); + QWidget *parent); ~JPushButton(); bool isPressed() {return mIsPressed;} - static QPixmap transparize(const QString &image); + static QPixmap transparize(const QPixmap &image); public slots: /** diff --git a/src/gui/official/ObjectFactory.hpp b/src/gui/official/ObjectFactory.hpp index 133ce0d8e9746f7af5fd12e7cb438503bf3e0895..88c16e0938548a6abd50b6e88d34c83c92605bdc 100644 --- a/src/gui/official/ObjectFactory.hpp +++ b/src/gui/official/ObjectFactory.hpp @@ -23,7 +23,7 @@ #include <list> #include <map> -#include <QString> +#include <qstring.h> /** * This is the base class that we will use to diff --git a/src/gui/official/ObjectFactory.inl b/src/gui/official/ObjectFactory.inl index c6aa337a748d255a68766d3e0125941f667e6edf..98f93cc44b30178ff627ede7427050734474ec11 100644 --- a/src/gui/official/ObjectFactory.inl +++ b/src/gui/official/ObjectFactory.inl @@ -49,7 +49,8 @@ ObjectFactory< Base >::create(const QString &command, { typename std::map< QString, ObjectCreatorBase< Base > * >::iterator pos = mObjectCreators.find(command); if(pos == mObjectCreators.end()) { - throw std::runtime_error("The command \"" + command.toStdString() + "\" has no creator registered."); + 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); diff --git a/src/gui/official/ObjectPool.hpp b/src/gui/official/ObjectPool.hpp index 57faae562d62e14ee91496aa489cc3eca6447419..ca9d394514c7341b33a73bedb769234fe8514a2d 100644 --- a/src/gui/official/ObjectPool.hpp +++ b/src/gui/official/ObjectPool.hpp @@ -22,7 +22,7 @@ #define SFLPHONEGUI_OBJECTPOOL_H #include <list> -#include <QString> +#include <qstring.h> #include <QMutex> #include <QWaitCondition> diff --git a/src/gui/official/PhoneLine.cpp b/src/gui/official/PhoneLine.cpp index 6e590ac8bfdabfdccb9ad683db9a827731884641..46d25698e49f7258cf09acba1a795aa3153e4cf3 100644 --- a/src/gui/official/PhoneLine.cpp +++ b/src/gui/official/PhoneLine.cpp @@ -1,8 +1,9 @@ #include <iostream> #include "globals.h" -#include "PhoneLine.hpp" #include "Call.hpp" +#include "DebugOutput.hpp" +#include "PhoneLine.hpp" PhoneLine::PhoneLine(const Session &session, const Account &account, @@ -42,7 +43,7 @@ void PhoneLine::setLineStatus(const QString &status) { mActionTimer->stop(); - mAction.clear(); + mAction = ""; mLineStatus = status; if(mSelected) { @@ -93,7 +94,7 @@ void PhoneLine::select(bool hardselect) { if(!mSelected) { - _debug("PhoneLine %d: I am selected.\n", mLine); + DebugOutput::instance() << tr("PhoneLine %d: I am selected.\n").arg(mLine); mSelected = true; if(!hardselect) { @@ -109,7 +110,7 @@ PhoneLine::select(bool hardselect) } } else { - setLineStatus("Ready."); + setLineStatus(QObject::tr("Ready.")); setAction(""); } } @@ -123,7 +124,7 @@ void PhoneLine::disconnect() { mSelected = false; - _debug("PhoneLine %d: I am disconnected.\n", mLine); + DebugOutput::instance() << QObject::tr("PhoneLine %1: I am disconnected.\n").arg(mLine); close(); emit unselected(); @@ -132,7 +133,7 @@ PhoneLine::disconnect() void PhoneLine::close() { - _debug("PhoneLine %d: I am closed.\n", mLine); + DebugOutput::instance() << tr("PhoneLine %1: I am closed.\n").arg(mLine); if(mCall) { delete mCall; mCall = NULL; @@ -150,7 +151,7 @@ void PhoneLine::unselect(bool hardselect) { if(mSelected) { - _debug("PhoneLine %d: I am unselected.\n", mLine); + DebugOutput::instance() << tr("PhoneLine %d: I am unselected.\n").arg(mLine); mSelected = false; if(mIsOnError) { close(); @@ -171,7 +172,7 @@ void PhoneLine::incomming(const Call &call) { if(mCall) { - _debug("PhoneLine %d: Trying to set a phone line to an active call.\n", mLine); + DebugOutput::instance() << tr("PhoneLine %d: Trying to set a phone line to an active call.\n").arg(mLine); } else { mCall = new Call(call); @@ -183,16 +184,16 @@ PhoneLine::incomming(const Call &call) void PhoneLine::clear() { - mBuffer.clear(); + mBuffer = ""; emit bufferStatusChanged(mBuffer); } void PhoneLine::sendKey(Qt::Key c) { - _debug("PhoneLine %d: Received the character:%s.\n", - mLine, - QString(c).toStdString().c_str()); + DebugOutput::instance() << tr("PhoneLine %1: Received the character:%2.\n") + .arg(mLine) + .arg(c); switch(c) { case Qt::Key_Enter: case Qt::Key_Return: @@ -205,7 +206,7 @@ PhoneLine::sendKey(Qt::Key c) if (QChar(c).isDigit()) { if(!mCall) { mSession.playDtmf(c); - mBuffer += QString(c); + mBuffer += c; emit bufferStatusChanged(mBuffer); } else { @@ -218,7 +219,7 @@ PhoneLine::sendKey(Qt::Key c) void PhoneLine::call() { - if(mBuffer.size()) { + if(mBuffer.length()) { call(mBuffer); } } @@ -226,9 +227,9 @@ PhoneLine::call() void PhoneLine::call(const QString &to) { - _debug("PhoneLine %d: Calling %s.\n", mLine, to.toStdString().c_str()); + DebugOutput::instance() << tr("PhoneLine %d: Calling %s.\n").arg(mLine).arg(to); if(!mCall) { - setLineStatus("Calling " + to + "..."); + setLineStatus(tr("Calling %s...").arg(to)); mCall = new Call(mAccount.createCall(to)); clear(); } @@ -238,8 +239,8 @@ void PhoneLine::hold() { if(mCall) { - setAction("Holding..."); - _debug("PhoneLine %d: Trying to Hold.\n", mLine); + setAction(tr("Holding...")); + DebugOutput::instance() << tr("PhoneLine %d: Trying to Hold.\n").arg(mLine); mCall->hold(); } @@ -251,7 +252,7 @@ PhoneLine::unhold() { if(mCall) { setAction("Unholding..."); - _debug("PhoneLine %d: Trying to Unhold.\n", mLine); + DebugOutput::instance() << tr("PhoneLine %d: Trying to Unhold.\n").arg(mLine); mCall->unhold(); } } @@ -261,7 +262,7 @@ PhoneLine::answer() { if(mCall) { setAction("Answering..."); - _debug("PhoneLine %d: Trying to answer.\n", mLine); + DebugOutput::instance() << tr("PhoneLine %d: Trying to answer.\n").arg(mLine); mCall->answer(); } } @@ -271,7 +272,7 @@ PhoneLine::hangup() { if(mCall) { setAction("Hanguping..."); - _debug("PhoneLine %d: Trying to Hangup.\n", mLine); + DebugOutput::instance() << tr("PhoneLine %d: Trying to Hangup.\n").arg(mLine); mCall->hangup(); delete mCall; mCall = NULL; diff --git a/src/gui/official/PhoneLine.hpp b/src/gui/official/PhoneLine.hpp index 247fc136b7a8ea4491e12840e83dacab26c7c5f2..03b1b22bf9814c99ce6b92dd3858319544c15cf9 100644 --- a/src/gui/official/PhoneLine.hpp +++ b/src/gui/official/PhoneLine.hpp @@ -1,9 +1,9 @@ -#include <QChar> -#include <QObject> -#include <QMutex> -#include <QString> -#include <QTimer> +#include <qobject.h> +#include <qmutex.h> +#include <qstring.h> +#include <qtimer.h> +#include "Account.hpp" #include "Session.hpp" class Call; @@ -111,9 +111,9 @@ signals: void selected(); void unselected(); void backgrounded(); - void lineStatusChanged(const QString &); - void actionChanged(const QString &); - void bufferStatusChanged(const QString &); + void lineStatusChanged(QString); + void actionChanged(QString); + void bufferStatusChanged(QString); private: Session mSession; diff --git a/src/gui/official/PhoneLineButton.cpp b/src/gui/official/PhoneLineButton.cpp index 47321e2e24605940e4928d61884028fb5545d81e..40f67bed627be50be065fec5b34632b8df27ff91 100644 --- a/src/gui/official/PhoneLineButton.cpp +++ b/src/gui/official/PhoneLineButton.cpp @@ -2,16 +2,15 @@ #include "PhoneLineButton.hpp" -#include <QMouseEvent> -#include <QTimer> +#include <qevent.h> +#include <qtimer.h> PhoneLineButton::PhoneLineButton(const QString &released, const QString &pressed, unsigned int line, - QWidget *parent, - Qt::WFlags flags) - : JPushButton(released, pressed, parent, flags) + QWidget *parent) + : JPushButton(released, pressed, parent) , mLine(line) , mFace(0) { diff --git a/src/gui/official/PhoneLineButton.hpp b/src/gui/official/PhoneLineButton.hpp index b8475e105b6c8b2be0de1f3b6dbb5c7208a7cfb5..e49efc22a7c23e93f23d79332a4bcfb08c810f18 100644 --- a/src/gui/official/PhoneLineButton.hpp +++ b/src/gui/official/PhoneLineButton.hpp @@ -2,9 +2,9 @@ #ifndef __PHONELINEBUTTON_HPP__ #define __PHONELINEBUTTON_HPP__ -#include <QLabel> -#include <QObject> -#include <QPixmap> +#include <qlabel.h> +#include <qobject.h> +#include <qpixmap.h> #include "JPushButton.hpp" @@ -23,8 +23,7 @@ public: PhoneLineButton(const QString &released, const QString &pressed, unsigned int line, - QWidget *parent, - Qt::WFlags flags = 0); + QWidget *parent); virtual ~PhoneLineButton(){} diff --git a/src/gui/official/PhoneLineManagerImpl.cpp b/src/gui/official/PhoneLineManagerImpl.cpp index c723e85328fb318258ec9e321b819bc12f11eb53..7efabc0689017f7bafeb882d68e257efa364c34b 100644 --- a/src/gui/official/PhoneLineManagerImpl.cpp +++ b/src/gui/official/PhoneLineManagerImpl.cpp @@ -1,4 +1,4 @@ -#include <QMutexLocker> +#include <qmutex.h> #include <iostream> #include <stdexcept> @@ -146,12 +146,12 @@ PhoneLineManagerImpl::setNbLines(unsigned int nb) mPhoneLines.clear(); for(unsigned int i = 0; i < nb; i++) { PhoneLine *p = new PhoneLine(*mSession, *mAccount, i + 1); - QObject::connect(p, SIGNAL(lineStatusChanged(const QString &)), - this, SIGNAL(lineStatusSet(const QString &))); - QObject::connect(p, SIGNAL(actionChanged(const QString &)), - this, SIGNAL(actionSet(const QString &))); - QObject::connect(p, SIGNAL(bufferStatusChanged(const QString &)), - this, SIGNAL(bufferStatusSet(const QString &))); + QObject::connect(p, SIGNAL(lineStatusChanged(QString)), + this, SIGNAL(lineStatusSet(QString))); + QObject::connect(p, SIGNAL(actionChanged(QString)), + this, SIGNAL(actionSet(QString))); + QObject::connect(p, SIGNAL(bufferStatusChanged(QString)), + this, SIGNAL(bufferStatusSet(QString))); mPhoneLines.push_back(p); } } @@ -332,8 +332,8 @@ PhoneLineManagerImpl::selectLine(const QString &callId, bool hardselect) selectLine(line, hardselect); } else { - _debug("PhoneLineManager: Tried to selected line with call ID (%s), " - "which appears to be invalid.\n", callId.toStdString().c_str()); + DebugOutput::instance() << QObject::tr("PhoneLineManager: Tried to selected line with call ID (%1), " + "which appears to be invalid.\n").arg(callId); } } @@ -524,8 +524,9 @@ PhoneLineManagerImpl::addCall(Call call, selectedLine->setState(state); } else { - _debug("PhoneLineManager: There's no available lines here for the incomming call ID: %s.\n", - call.id().toStdString().c_str()); + DebugOutput::instance() << QObject::tr("PhoneLineManager: There's no available lines" + "here for the incomming call ID: %1.\n") + .arg(call.id()); call.notAvailable(); } } diff --git a/src/gui/official/PhoneLineManagerImpl.hpp b/src/gui/official/PhoneLineManagerImpl.hpp index e34073a281dfe01c08e4e76146ae33537cc836d7..17b440d07bc87bec275162d06f67635fa11c015f 100644 --- a/src/gui/official/PhoneLineManagerImpl.hpp +++ b/src/gui/official/PhoneLineManagerImpl.hpp @@ -1,9 +1,9 @@ #ifndef __PHONELINEMANAGERIMPL_HPP__ #define __PHONELINEMANAGERIMPL_HPP__ -#include <Qt> -#include <QObject> -#include <QMutex> +//#include <qt.h> +#include <qobject.h> +#include <qmutex.h> #include <utility> #include <vector> diff --git a/src/gui/official/Request.cpp b/src/gui/official/Request.cpp index 77a7079d6680878a605a1577d7686dff9e774c3c..d55eca66e875cf6d527520e7e274b417f3e29422 100644 --- a/src/gui/official/Request.cpp +++ b/src/gui/official/Request.cpp @@ -18,9 +18,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <qobject.h> #include <sstream> #include "globals.h" +#include "DebugOutput.hpp" #include "CallManager.hpp" #include "Request.hpp" #include "Requester.hpp" @@ -36,12 +38,12 @@ Request::Request(const QString &sequenceId, std::list< QString > Request::parseArgs(const QString &message) { - std::istringstream stream(message.toStdString()); + std::istringstream stream(message); std::string s; std::list< QString > args; while(stream.good()) { stream >> s; - args.push_back(QString::fromStdString(s)); + args.push_back(s); } return args; @@ -50,43 +52,50 @@ Request::parseArgs(const QString &message) void Request::onError(const QString &code, const QString &message) { - _debug("Received an error:\n Code: %s\n SequenceID: %s\n Message%s\n", - code.toStdString().c_str(), - mSequenceId.toStdString().c_str(), - message.toStdString().c_str()); + 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) { - _debug("Received a temp info:\n Code: %s\n SequenceID: %s\n Message%s\n", - code.toStdString().c_str(), - mSequenceId.toStdString().c_str(), - message.toStdString().c_str()); + 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) { - _debug("Received a success:\n Code: %s\n SequenceID: %s\n Message%s\n", - code.toStdString().c_str(), - mSequenceId.toStdString().c_str(), - message.toStdString().c_str()); + 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() { - std::ostringstream id; - id << mCommand.toStdString() << " " << mSequenceId.toStdString(); + QString output = mCommand + " " + mSequenceId; for(std::list< QString >::const_iterator pos = mArgs.begin(); pos != mArgs.end(); pos++) { - id << " " << (*pos).toStdString(); + output += " " + (*pos); } - id << std::endl; + output += "\n"; - return QString::fromStdString(id.str()); + return output; } diff --git a/src/gui/official/Request.hpp b/src/gui/official/Request.hpp index 0910218b7cbb551066f903ba17647e192074d7d1..890e2912827472a065f80b84921f02ac81b61178 100644 --- a/src/gui/official/Request.hpp +++ b/src/gui/official/Request.hpp @@ -22,7 +22,7 @@ #define SFLPHONEGUI_REQUEST_H #include <list> -#include <QString> +#include <qstring.h> #include "Account.hpp" diff --git a/src/gui/official/RequesterImpl.cpp b/src/gui/official/RequesterImpl.cpp index 08666010f8a5a8f5bee787c714002254d147774f..4094fc7e5fd17cf266321cf675147a61f83917e8 100644 --- a/src/gui/official/RequesterImpl.cpp +++ b/src/gui/official/RequesterImpl.cpp @@ -18,11 +18,13 @@ * 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" @@ -101,25 +103,22 @@ RequesterImpl::connect(const QString &id) int RequesterImpl::getCodeCategory(const QString &code) { - int c; - std::istringstream s(code.toStdString()); - s >> c; - return c / 100; + return code.toInt() / 100; } void RequesterImpl::receiveAnswer(const QString &answer) { - std::string code; - std::string seq; - std::string message; - std::istringstream s(answer.toStdString()); + QString a(answer); + QString code; + QString seq; + QString message; + + QTextStream s(&a, IO_ReadOnly); s >> code >> seq; - getline(s, message); - message.erase(0, 1); - receiveAnswer(QString::fromStdString(code), - QString::fromStdString(seq), - QString::fromStdString(message)); + message = s.readLine(); + message.remove(0, 1); + receiveAnswer(code, seq, message); } @@ -157,28 +156,28 @@ RequesterImpl::receiveAnswer(const QString &code, QString RequesterImpl::generateCallId() { - std::ostringstream id; - id << "cCallID:" << mCallIdCount; + QString s("cCallID:"); + s += mCallIdCount; mCallIdCount++; - return QString::fromStdString(id.str()); + return s; } QString RequesterImpl::generateSessionId() { - std::ostringstream id; - id << "cSessionID:" << mSessionIdCount; + QString s("cSessionID:"); + s += mSessionIdCount; mSessionIdCount++; - return QString::fromStdString(id.str()); + return s; } QString RequesterImpl::generateSequenceId() { - std::ostringstream id; - id << "cSequenceID:" << mSequenceIdCount; + QString s("cSequenceID:"); + s += mSequenceIdCount; mSequenceIdCount++; - return QString::fromStdString(id.str()); + return s; } void @@ -189,8 +188,8 @@ RequesterImpl::inputIsDown(const QString &sessionId) if(pos == mSessions.end()) { // we will not thow an exception, but this is // a logic error - _debug("Requester: SessionIO input for session %s is down, " - "but we don't have that session.\n", - sessionId.toStdString().c_str()); + 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/SFLEvents.cpp b/src/gui/official/SFLEvents.cpp index f2a3e24c8d0b938e3e9cd068310ac4b52bec1087..3d994c8a8ab6f0d0b65cf4591d6ea95937f75d69 100644 --- a/src/gui/official/SFLEvents.cpp +++ b/src/gui/official/SFLEvents.cpp @@ -12,7 +12,7 @@ DefaultEvent::DefaultEvent(const QString &code, void DefaultEvent::execute() { - _debug("DefaultEvent: We don't handle: %s\n", toString().toStdString().c_str()); + DebugOutput::instance() << QObject::tr("DefaultEvent: We don't handle: %1\n").arg(toString()); } @@ -25,12 +25,14 @@ void HangupEvent::execute() { QString id = getCallId(); - if(id.size() > 0) { - _debug("Hangup Event received for call ID: %s.\n", id.toStdString().c_str()); + if(id.length() > 0) { + DebugOutput::instance() << QObject::tr("Hangup Event received for call ID: %1.\n") + .arg(id); PhoneLineManager::instance().hangup(id); } else { - _debug("Hangup Event invalid (missing call ID): %s\n", toString().toStdString().c_str()); + DebugOutput::instance() << QObject::tr("Hangup Event invalid (missing call ID): %1\n") + .arg(toString()); } } @@ -52,11 +54,13 @@ void IncommingEvent::execute() { QString id = getCallId(); - if(id.size() > 0) { - _debug("Incomming Event received for call ID: %s.\n", id.toStdString().c_str()); + 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 { - _debug("Incomming Event invalid: %s\n", toString().toStdString().c_str()); + DebugOutput::instance() << QObject::tr("Incomming Event invalid: %1\n") + .arg(toString()); } } diff --git a/src/gui/official/SFLLcd.cpp b/src/gui/official/SFLLcd.cpp index c43ea2629bc2a375b23c4d8d946d73201bcf607e..ab6b8574ccdc17c57176b5d0e0aec39810784a4b 100644 --- a/src/gui/official/SFLLcd.cpp +++ b/src/gui/official/SFLLcd.cpp @@ -1,6 +1,6 @@ -#include <QDateTime> -#include <QPainter> -#include <QPaintEvent> +#include <qdatetime.h> +#include <qpainter.h> +#include <qevent.h> #include "globals.h" #include "JPushButton.hpp" @@ -10,10 +10,12 @@ // Others fixed font support "Monospace", "Fixed", "MiscFixed" #define FONT_SIZE 10 -SFLLcd::SFLLcd(QWidget *parent, Qt::WFlags flags) - : QLabel(parent, flags) - , mScreen(JPushButton::transparize(":/sflphone/images/screen_main")) - , mOverscreen(JPushButton::transparize(":/sflphone/images/overscreen.png")) +#define SCREEN "screen_main" +#define OVERSCREEN "overscreen" +SFLLcd::SFLLcd(QWidget *parent) + : QLabel(parent) + , mScreen(JPushButton::transparize(QPixmap::fromMimeSource(SCREEN))) + , mOverscreen(JPushButton::transparize(QPixmap::fromMimeSource(OVERSCREEN))) , mGlobalStatusPos(-1) , mLineStatusPos(-1) , mBufferStatusPos(-1) @@ -24,7 +26,7 @@ SFLLcd::SFLLcd(QWidget *parent, Qt::WFlags flags) resize(mScreen.size()); move(22,44); - + mTimer = new QTimer(this); QObject::connect(mTimer, SIGNAL(timeout()), this, SLOT(updateText())); @@ -185,7 +187,7 @@ SFLLcd::extractVisibleText(const QString &text, int &pos) int nbCharBetween = 8; - if(pos >= tmp.size() + nbCharBetween) { + if(pos >= tmp.length() + nbCharBetween) { pos = 0; } @@ -202,7 +204,7 @@ SFLLcd::extractVisibleText(const QString &text, int &pos) tmp.remove(0, pos); while(textIsTooBig(tmp)) { - tmp.chop(1); + tmp.remove(tmp.length() - 1, 1); } } diff --git a/src/gui/official/SFLLcd.hpp b/src/gui/official/SFLLcd.hpp index 702869c2812ddbdc7f26b4345a38ac7a6e7b0409..e02de41869ec50751d8582f873f6b18d9b4cd1b2 100644 --- a/src/gui/official/SFLLcd.hpp +++ b/src/gui/official/SFLLcd.hpp @@ -21,18 +21,18 @@ #ifndef __SFLLCD_HPP__ #define __SFLLCD_HPP__ -#include <QLabel> -#include <QObject> -#include <QPixmap> -#include <QTime> -#include <QTimer> +#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, Qt::WFlags flags = 0); + SFLLcd(QWidget *parent = NULL); bool textIsTooBig(const QString &text); diff --git a/src/gui/official/SFLPhoneApp.hpp b/src/gui/official/SFLPhoneApp.hpp index 6f4f52b6cc76985dbcfc95a60499963f0f4f6db0..89bc30efff1f1be12bfc97dbc73c0eb76c8b8bfb 100644 --- a/src/gui/official/SFLPhoneApp.hpp +++ b/src/gui/official/SFLPhoneApp.hpp @@ -1,7 +1,7 @@ #ifndef __SFLPHONEAPP_HPP__ #define __SFLPHONEAPP_HPP__ -#include <QApplication> +#include <qapplication.h> #include "PhoneLineManager.hpp" #include "Session.hpp" diff --git a/src/gui/official/SFLPhoneWindow.cpp b/src/gui/official/SFLPhoneWindow.cpp index b0cf8aaa1c0fa20d0d3c2116b7a7a9592fda05b0..b45ec21cb58d33e3a8a18009011d2aecb9e007dd 100644 --- a/src/gui/official/SFLPhoneWindow.cpp +++ b/src/gui/official/SFLPhoneWindow.cpp @@ -1,12 +1,18 @@ #include "SFLPhoneWindow.hpp" -#include <QBitmap> +#include <qbitmap.h> + +//To test if we are in QT4 +#include <qt.h> +#ifdef quint16 #include <QIcon> -#include <QLabel> -#include <QMessageBox> -#include <QMouseEvent> -#include <QPixmap> -#include <QKeyEvent> +#endif + + +#include <qlabel.h> +#include <qmessagebox.h> +#include <qevent.h> +#include <qpixmap.h> #include <iostream> #include "globals.h" @@ -15,23 +21,36 @@ #include "SFLLcd.hpp" #include "VolumeControl.hpp" +#define LOGO_IMAGE "logo_ico" +#define BACKGROUND_IMAGE "main" + SFLPhoneWindow::SFLPhoneWindow() +#ifdef quint16 : QMainWindow(NULL, Qt::FramelessWindowHint) +#else + : QMainWindow(NULL) +#endif { // Initialize the background image mMain = new QLabel(this); - QPixmap main(JPushButton::transparize(":/sflphone/images/main.png")); + QPixmap main(JPushButton::transparize(QPixmap::fromMimeSource(BACKGROUND_IMAGE))); mMain->setPixmap(main); //mMain->move(100,100); + /* if(main.hasAlpha()) { setMask(main.mask()); } + */ resize(main.size()); mMain->resize(main.size()); - setWindowIcon(QIcon(QPixmap(":/sflphone/images/logo_ico"))); - setMouseTracking(false); + QPixmap logo(QPixmap::fromMimeSource(LOGO_IMAGE)); +#ifdef QIcon + setWindowIcon(QIcon(logo)); +#else + setIcon(logo); +#endif mLastPos = pos(); diff --git a/src/gui/official/SFLPhoneWindow.hpp b/src/gui/official/SFLPhoneWindow.hpp index 29e9f70b92e535f26d5eeb83da542c22a9acf860..09f61c1897383be66ad1c4b52f69418afba9ec10 100644 --- a/src/gui/official/SFLPhoneWindow.hpp +++ b/src/gui/official/SFLPhoneWindow.hpp @@ -1,7 +1,7 @@ -#include <QLabel> -#include <QMainWindow> -#include <QObject> -#include <QPoint> +#include <qlabel.h> +#include <qmainwindow.h> +#include <qobject.h> +#include <qpoint.h> #include <list> class JPushButton; diff --git a/src/gui/official/SFLRequest.cpp b/src/gui/official/SFLRequest.cpp index 060878319c6d5cd95ce99b26a2455bc4a8aaec61..7b2ace5846a540c1c72b49d1e8b86c9efa058439 100644 --- a/src/gui/official/SFLRequest.cpp +++ b/src/gui/official/SFLRequest.cpp @@ -2,7 +2,7 @@ #include <memory> #include <sstream> #include <string> -#include <QString> +#include <qstring.h> #include "globals.h" #include "CallManager.hpp" @@ -23,9 +23,9 @@ EventRequest::EventRequest(const QString &sequenceId, void EventRequest::onError(const QString &code, const QString &message) { - _debug("EventRequest error: (%s)%s\n", - code.toStdString().c_str(), - message.toStdString().c_str()); + DebugOutput::instance() << QObject::tr("EventRequest error: (%1) %1\n") + .arg(code) + .arg(message); } void @@ -39,9 +39,9 @@ EventRequest::onEntry(const QString &code, const QString &message) void EventRequest::onSuccess(const QString &code, const QString &message) { - _debug("EventRequest success: (%s)%s\n", - code.toStdString().c_str(), - message.toStdString().c_str()); + DebugOutput::instance() << QObject::tr("EventRequest success: (%1) %1\n") + .arg(code) + .arg(message); } CallStatusRequest::CallStatusRequest(const QString &sequenceId, @@ -54,9 +54,9 @@ CallStatusRequest::CallStatusRequest(const QString &sequenceId, void CallStatusRequest::onError(const QString &code, const QString &message) { - _debug("CallStatusRequest error: (%s)%s\n", - code.toStdString().c_str(), - message.toStdString().c_str()); + DebugOutput::instance() << QObject::tr("CallStatusRequest error: (%1) %1\n") + .arg(code) + .arg(message); PhoneLineManager::instance().errorOnCallStatus(); } @@ -71,16 +71,16 @@ CallStatusRequest::onEntry(const QString &code, const QString &message) void CallStatusRequest::onSuccess(const QString &code, const QString &message) { - _debug("CallStatusRequest success: (%s)%s\n", - code.toStdString().c_str(), - message.toStdString().c_str()); + 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 { - _debug("CallStatusRequest Error: cannot get current line.\n"); + DebugOutput::instance() << QObject::tr("CallStatusRequest Error: cannot get current line.\n"); } } PhoneLineManager::instance().handleEvents(); @@ -105,9 +105,10 @@ PermanentRequest::onError(Call call, line->error(); } else { - _debug("We received an error on a call " - "that doesn't have a phone line (%s).\n", - call.id().toStdString().c_str()); + DebugOutput::instance() << + QObject::tr("We received an error on a call " + "that doesn't have a phone line (%1).\n") + .arg(call.id()); } } @@ -122,9 +123,10 @@ PermanentRequest::onEntry(Call call, line->setLineStatus(message); } else { - _debug("We received a status on a call related request " - "that doesn't have a phone line (%s).\n", - call.id().toStdString().c_str()); + 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()); } } @@ -139,9 +141,10 @@ PermanentRequest::onSuccess(Call call, line->setLineStatus(message); } else { - _debug("We received a success on a call related request " - "that doesn't have a phone line (%s).\n", - call.id().toStdString().c_str()); + 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()); } } @@ -178,10 +181,11 @@ TemporaryRequest::onSuccess(Call call, line->setTempAction(message); } else { - _debug("We received an answer on a temporary call " - "related request that doesn't have a phone " - "line (%s).\n", - call.id().toStdString().c_str()); + 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()); } } @@ -209,9 +213,10 @@ CallRequest::onError(Account, line->error(); } else { - _debug("We received an error on a call " - "that doesn't have a phone line (%s).\n", - mCallId.toStdString().c_str()); + DebugOutput::instance() << + QObject::tr("We received an error on a call " + "that doesn't have a phone line (%1).\n") + .arg(mCallId); } } @@ -227,9 +232,10 @@ CallRequest::onEntry(Account, line->setLineStatus(message); } else { - _debug("We received a status on a call related request " - "that doesn't have a phone line (%s).\n", - mCallId.toStdString().c_str()); + DebugOutput::instance() << + QObject::tr("We received a status on a call related request " + "that doesn't have a phone line (%1).\n") + .arg(mCallId); } } @@ -245,8 +251,9 @@ CallRequest::onSuccess(Account, line->setLineStatus(message); } else { - _debug("We received a success on a call related request " - "that doesn't have a phone line (%s).\n", - mCallId.toStdString().c_str()); + DebugOutput::instance() << + QObject::tr("We received a success on a call related request " + "that doesn't have a phone line (%1).\n") + .arg(mCallId); } } diff --git a/src/gui/official/Session.cpp b/src/gui/official/Session.cpp index 3762dbb1f052f4565f3e7fe1936cca753701f290..eb3751bab11e16ba9363e5708572a1bea64f420d 100644 --- a/src/gui/official/Session.cpp +++ b/src/gui/official/Session.cpp @@ -19,7 +19,7 @@ */ #include <iostream> -#include <QString> +#include <qstring.h> #include "Session.hpp" #include "Requester.hpp" diff --git a/src/gui/official/Session.hpp b/src/gui/official/Session.hpp index 912ede862867c8612a560afc0e4a187eb15383ba..0069457aa1b8861836b359d0d203f310e9e7cca1 100644 --- a/src/gui/official/Session.hpp +++ b/src/gui/official/Session.hpp @@ -21,7 +21,7 @@ #ifndef SFLPHONEGUI_SESSION_H #define SFLPHONEGUI_SESSION_H -#include <QString> +#include <qstring.h> #include "Account.hpp" diff --git a/src/gui/official/SessionIO.hpp b/src/gui/official/SessionIO.hpp index 159649818d7d96bef2bc082670cc008db09060fc..e845e8e00c3f8ba04030ae9bb73774e4d3e708b9 100644 --- a/src/gui/official/SessionIO.hpp +++ b/src/gui/official/SessionIO.hpp @@ -21,8 +21,8 @@ #ifndef __SESSIONIO_HPP__ #define __SESSIONIO_HPP__ -#include <QObject> -#include <QString> +#include <qobject.h> +#include <qstring.h> /** * This is the main class that will handle diff --git a/src/gui/official/TCPSessionIO.cpp b/src/gui/official/TCPSessionIO.cpp index 9207a4e1eb3a0e89275301b48f497b03c1f304c2..933022797dab34083186ae6bce9796ed1785fe12 100644 --- a/src/gui/official/TCPSessionIO.cpp +++ b/src/gui/official/TCPSessionIO.cpp @@ -19,11 +19,13 @@ */ #include "globals.h" +#include "DebugOutput.hpp" #include "Requester.hpp" #include "TCPSessionIO.hpp" -TCPSessionIO::TCPSessionIO(const QString &hostname, quint16 port) - : mSocket(new QTcpSocket(this)) + +TCPSessionIO::TCPSessionIO(const QString &hostname, Q_UINT16 port) + : mSocket(new QSocket(this)) , mHostname(hostname) , mPort(port) { @@ -33,9 +35,9 @@ TCPSessionIO::TCPSessionIO(const QString &hostname, quint16 port) this, SLOT(sendWaitingRequests())); QObject::connect(mSocket, SIGNAL(connected()), this, SIGNAL(connected())); - QObject::connect(mSocket, SIGNAL(error(QAbstractSocket::SocketError)), + QObject::connect(mSocket, SIGNAL(error(int)), this, SLOT(error())); - QObject::connect(mSocket, SIGNAL(error(QAbstractSocket::SocketError)), + QObject::connect(mSocket, SIGNAL(error(int)), this, SIGNAL(disconnected())); } @@ -43,10 +45,10 @@ TCPSessionIO::~TCPSessionIO() {} void -TCPSessionIO::error() +TCPSessionIO::error(int err) { - _debug("TCPSessionIO: %s. \n", - mSocket->errorString().toStdString().c_str()); + DebugOutput::instance() << QObject::tr("TCPSessionIO: Error number %1. \n") + .arg(err); mSocket->close(); } @@ -61,20 +63,19 @@ TCPSessionIO::receive() void TCPSessionIO::connect() { - _debug("TCPSessionIO: Tring to connect to %s:%d.\n", - mHostname.toStdString().c_str(), - mPort); + DebugOutput::instance() << QObject::tr("TCPSessionIO: Tring to connect to %1:%2.\n") + .arg(mHostname) + .arg(mPort); mSocket->connectToHost(mHostname, mPort); } - void TCPSessionIO::sendWaitingRequests() { _debug("TCPSessionIO: Connected.\n"); QTextStream stream(mSocket); QMutexLocker guard(&mStackMutex); - while(mSocket->state() == QAbstractSocket::ConnectedState && + while(mSocket->state() == QSocket::Connected && mStack.size() > 0) { stream << *mStack.begin(); mStack.pop_front(); @@ -85,9 +86,9 @@ void TCPSessionIO::send(const QString &request) { QTextStream stream(mSocket); - if(mSocket->state() == QAbstractSocket::ConnectedState) { - _debug("TCPSessioIO: Sending request to sflphone: %s", - request.toStdString().c_str()); + if(mSocket->state() == QSocket::Connected) { + DebugOutput::instance() << QObject::tr("TCPSessioIO: Sending request to sflphone: %1") + .arg(request); stream << request; } else { @@ -103,8 +104,8 @@ TCPSessionIO::receive(QString &answer) if(mSocket->isReadable()) { QTextStream stream(mSocket); answer = stream.readLine(); - _debug("TCPSessionIO: Received answer from sflphone: %s\n", - answer.toStdString().c_str()); + DebugOutput::instance() << QObject::tr("TCPSessionIO: Received answer from sflphone: %1") + .arg(answer); } } diff --git a/src/gui/official/TCPSessionIO.hpp b/src/gui/official/TCPSessionIO.hpp index 360b7caaf60022995b0b2904653ec1109ab4d9c9..423a140e539b1e70b4962b50f2c53fc8db201f30 100644 --- a/src/gui/official/TCPSessionIO.hpp +++ b/src/gui/official/TCPSessionIO.hpp @@ -21,14 +21,22 @@ #ifndef __TCPSESSIONIO_HPP__ #define __TCPSESSIONIO_HPP__ -#include <QMutex> -#include <QString> -#include <QTcpSocket> -#include <QTextStream> +#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 { @@ -36,7 +44,7 @@ class TCPSessionIO : public SessionIO public: TCPSessionIO(const QString &hostname, - quint16 port); + Q_UINT16 port); virtual ~TCPSessionIO(); @@ -75,12 +83,12 @@ public slots: * This function is called when we have an error * on the socket. */ - void error(); + void error(int); private: - QTcpSocket *mSocket; + QSocket *mSocket; QString mHostname; - quint16 mPort; + Q_UINT16 mPort; QMutex mStackMutex; std::list< QString > mStack; diff --git a/src/gui/official/TCPSessionIOCreator.cpp b/src/gui/official/TCPSessionIOCreator.cpp index b2f9dab8a3c2439a711dd84b73c568072c9f67e0..67afbd5a1b6b035e34ad5f507b7290170ca28a55 100644 --- a/src/gui/official/TCPSessionIOCreator.cpp +++ b/src/gui/official/TCPSessionIOCreator.cpp @@ -2,7 +2,7 @@ #include "PhoneLineManager.hpp" TCPSessionIOCreator::TCPSessionIOCreator(const QString &hostname, - quint16 port) + Q_UINT16 port) : mHostname(hostname) , mPort(port) {} diff --git a/src/gui/official/TCPSessionIOCreator.hpp b/src/gui/official/TCPSessionIOCreator.hpp index d8c6c167b2ba8da55036161f825c87a08e54aeb9..32b7abc7bd8dc1693e5921785a0692a07d0ef18f 100644 --- a/src/gui/official/TCPSessionIOCreator.hpp +++ b/src/gui/official/TCPSessionIOCreator.hpp @@ -28,14 +28,14 @@ class TCPSessionIOCreator : public Creator< SessionIO > { public: TCPSessionIOCreator(const QString &hostname, - quint16 port); + Q_UINT16 port); virtual ~TCPSessionIOCreator(){} virtual TCPSessionIO *create(); private: QString mHostname; - quint16 mPort; + Q_UINT16 mPort; }; #endif diff --git a/src/gui/official/TransparentWidget.cpp b/src/gui/official/TransparentWidget.cpp index 6625bd87540cf87d32ce7d65d77e44d40c40ca23..4c4a6eaa7a81f7eb94edb59568fe3f3c2a07fac8 100644 --- a/src/gui/official/TransparentWidget.cpp +++ b/src/gui/official/TransparentWidget.cpp @@ -18,36 +18,36 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <QBitmap> -#include <QColor> +#include <qbitmap.h> +#include <qcolor.h> #include <iostream> #include "TransparentWidget.hpp" TransparentWidget::TransparentWidget(const QString &pixmap, - QWidget* parent, - Qt::WFlags flags) - : QLabel(parent, flags) + QWidget* parent) + : QLabel(parent) { mImage = transparize(pixmap); setPixmap(mImage); + /* if(mImage.hasAlpha()) { setMask(mImage.mask()); } + */ resize(mImage.size()); } -TransparentWidget::TransparentWidget(QWidget* parent, - Qt::WFlags flags) - : QLabel(parent, flags) +TransparentWidget::TransparentWidget(QWidget* parent) + : QLabel(parent) {} QPixmap -TransparentWidget::transparize(const QSize &size) +TransparentWidget::transparize(const QSize &) { - + /* QImage image(size, QImage::Format_RGB32); QColor c(12,32,35,123); image.fill(c.rgb()); @@ -55,8 +55,8 @@ TransparentWidget::transparize(const QSize &size) QPixmap p(QPixmap::fromImage(image)); p.setMask(p.createHeuristicMask()); //p.setMask(p.alphaChannel()); - - return p; + */ + return QPixmap(); } TransparentWidget::~TransparentWidget() @@ -66,7 +66,7 @@ QPixmap TransparentWidget::transparize(const QString &image) { QPixmap p(image); - + /* if (!p.mask()) { if (p.hasAlphaChannel()) { p.setMask(p.alphaChannel()); @@ -75,7 +75,7 @@ TransparentWidget::transparize(const QString &image) p.setMask(p.createHeuristicMask()); } } - + */ return p; } diff --git a/src/gui/official/TransparentWidget.hpp b/src/gui/official/TransparentWidget.hpp index 267d5cc4565febbe186b9a01735fb620baba1040..d8626b38f1ababbc9a4a2482088d2b5766723826 100644 --- a/src/gui/official/TransparentWidget.hpp +++ b/src/gui/official/TransparentWidget.hpp @@ -21,10 +21,10 @@ #ifndef __TRANSPARENT_WIDGET_HPP__ #define __TRANSPARENT_WIDGET_HPP__ -#include <QBitmap> -#include <QLabel> -#include <QPixmap> -#include <QImage> +#include <qbitmap.h> +#include <qlabel.h> +#include <qpixmap.h> +#include <qimage.h> /** * This class Emulate a PushButton but takes two @@ -36,10 +36,8 @@ class TransparentWidget : public QLabel public: TransparentWidget(const QString &pixmap, - QWidget *parent, - Qt::WFlags flags = 0); - TransparentWidget(QWidget *parent, - Qt::WFlags flags = 0); + QWidget *parent); + TransparentWidget(QWidget *parent); ~TransparentWidget(); static QPixmap transparize(const QSize &size); @@ -49,7 +47,7 @@ public: {return mImage.hasAlpha();} QBitmap mask() const - {return mImage.mask();} + {return *mImage.mask();} private: QPixmap mImage; diff --git a/src/gui/official/main.cpp b/src/gui/official/main.cpp index 67c2f7f0337c1cdccb4b9a75fb4b0a25210561c4..7ba183ee7f287501690c59d82f42561e186594e3 100644 --- a/src/gui/official/main.cpp +++ b/src/gui/official/main.cpp @@ -20,9 +20,8 @@ #include <iostream> #include <stdexcept> -#include <QString> +#include <qstring.h> -#include <QPushButton> #include "SFLPhoneApp.hpp" #include "SFLPhoneWindow.hpp" diff --git a/src/gui/official/sflphone.pro b/src/gui/official/sflphone.pro index 7532baeb5d1d3e2ce0ca1bdb7d2c1b1dd86c4ffc..664cd34cce858016d04e4fcc568df26f330bb7bb 100644 --- a/src/gui/official/sflphone.pro +++ b/src/gui/official/sflphone.pro @@ -6,7 +6,7 @@ TEMPLATE = app TARGET += DEPENDPATH += . INCLUDEPATH += /usr/lib/qt4/include/Qt/ -QT += network +QT += network qt3support #CONFIG += debug # Input @@ -16,6 +16,8 @@ HEADERS += Account.hpp \ Call.hpp \ CallStatus.hpp \ CallStatusFactory.hpp \ + DebugOutput.hpp \ + DebugOutputImpl.hpp \ Event.hpp \ EventFactory.hpp EventFactory.inl \ Factory.hpp Factory.inl \ @@ -50,6 +52,7 @@ SOURCES += Account.cpp \ Call.cpp \ CallManagerImpl.cpp \ CallStatus.cpp \ + DebugOutputImpl.cpp \ Event.cpp \ JPushButton.cpp \ main.cpp \