diff --git a/src/gui/official/PhoneLine.cpp b/src/gui/official/PhoneLine.cpp index 4062dd9235d3b433d7a37627da666380659131b3..088f025d7166e9c4f04e9142d2d7d296e3ac07f3 100644 --- a/src/gui/official/PhoneLine.cpp +++ b/src/gui/official/PhoneLine.cpp @@ -46,9 +46,7 @@ PhoneLine::setLineStatus(const QString &status) mAction = ""; mLineStatus = status; - if(mSelected) { - emit lineStatusChanged(mLineStatus); - } + emit lineStatusChanged(mLineStatus); } void @@ -56,9 +54,7 @@ PhoneLine::setAction(const QString &status) { mActionTimer->stop(); mAction = status; - if(mSelected) { - emit actionChanged(mAction); - } + emit actionChanged(mAction); } void @@ -67,9 +63,7 @@ PhoneLine::setTempAction(const QString &status) mActionTimer->stop(); mActionTimer->start(3000); mAction = status; - if(mSelected) { - emit actionChanged(mAction); - } + emit actionChanged(mAction); } unsigned int diff --git a/src/gui/official/PhoneLineManagerImpl.cpp b/src/gui/official/PhoneLineManagerImpl.cpp index 7eeb397bfb3dace11e1fa7fd96b68cfbfb079769..976f0064de04d15adad1e6f634db31a4032492a3 100644 --- a/src/gui/official/PhoneLineManagerImpl.cpp +++ b/src/gui/official/PhoneLineManagerImpl.cpp @@ -1,4 +1,3 @@ -#include <qmutex.h> #include <iostream> #include <stdexcept> @@ -150,10 +149,6 @@ PhoneLineManagerImpl::setNbLines(unsigned int nb) PhoneLine *p = new PhoneLine(*mSession, *mAccount, i + 1); QObject::connect(p, SIGNAL(lineStatusChanged(QString)), this, SIGNAL(unselectedLineStatusSet(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); } } @@ -233,7 +228,7 @@ PhoneLineManagerImpl::select(PhoneLine *line, bool hardselect) mCurrentLine = line; mCurrentLine->select(hardselect); - if(mCurrentLine->isAvailable()) { + if(!mCurrentLine->isAvailable()) { mSession->playTone(); } emit lineStatusSet(mCurrentLine->getLineStatus()); @@ -253,7 +248,9 @@ PhoneLineManagerImpl::unselect() this, SIGNAL(bufferStatusSet(QString))); QObject::connect(mCurrentLine, SIGNAL(lineStatusChanged(QString)), this, SIGNAL(unselectedLineStatusSet(QString))); - + if(mCurrentLine->isAvailable()) { + mSession->stopTone(); + } mCurrentLine->unselect(); mCurrentLine = NULL; } @@ -411,7 +408,9 @@ PhoneLineManagerImpl::hold() mCurrentLine = NULL; if(selectedLine) { - mSession->stopTone(); + if(selectedLine->isAvailable()) { + mSession->stopTone(); + } selectedLine->hold(); } } @@ -423,7 +422,9 @@ PhoneLineManagerImpl::hangup(bool sendrequest) mCurrentLine = NULL; if(selectedLine) { - mSession->stopTone(); + if(selectedLine->isAvailable()) { + mSession->stopTone(); + } selectedLine->hangup(sendrequest); lineStatusSet(""); } @@ -497,20 +498,22 @@ PhoneLineManagerImpl::incomming(const QString &accountId, const QString &peer) { Call call(mSession->id(), accountId, callId, true); - addCall(call, peer, QObject::tr("Incomming")); - emit globalStatusSet(QObject::tr("Ringing (%1)...").arg(peer)); + PhoneLine *line = addCall(call, peer, QObject::tr("Incomming")); + if(line) { + line->setLineStatus(QObject::tr("Ringing (%1)...").arg(peer)); + } } -void +PhoneLine * PhoneLineManagerImpl::addCall(const QString &accountId, const QString &callId, const QString &peer, const QString &state) { - addCall(Call(mSession->id(), accountId, callId), peer, state); + return addCall(Call(mSession->id(), accountId, callId), peer, state); } -void +PhoneLine * PhoneLineManagerImpl::addCall(Call call, const QString &peer, const QString &state) @@ -528,6 +531,8 @@ PhoneLineManagerImpl::addCall(Call call, .arg(call.id()); call.notAvailable(); } + + return selectedLine; } void diff --git a/src/gui/official/PhoneLineManagerImpl.hpp b/src/gui/official/PhoneLineManagerImpl.hpp index a747e71b2e176a36dd4e55d7a0879cf8f09fe5ed..9cbd9b8944bf95abf59332828d7d06ea6e43669d 100644 --- a/src/gui/official/PhoneLineManagerImpl.hpp +++ b/src/gui/official/PhoneLineManagerImpl.hpp @@ -3,7 +3,6 @@ //#include <qt.h> #include <qobject.h> -#include <qmutex.h> #include <utility> #include <vector> @@ -54,6 +53,7 @@ signals: void globalStatusSet(QString); void bufferStatusSet(QString); void actionSet(QString); + void unselectedLineStatusSet(QString); void lineStatusSet(QString); void volumeUpdated(int); @@ -152,13 +152,13 @@ public slots: * This function is used to add a call on a * phone line. */ - void addCall(Call call, - const QString &peer, - const QString &state); - void addCall(const QString &accountId, - const QString &callId, - const QString &peer, - const QString &state); + 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 @@ -278,13 +278,8 @@ private: Account *mAccount; std::vector< PhoneLine * > mPhoneLines; - QMutex mPhoneLinesMutex; - PhoneLine *mCurrentLine; - QMutex mCurrentLineMutex; - bool mIsInitialized; - QMutex mIsInitializedMutex; int mVolume; int mMicVolume; diff --git a/src/gui/official/SFLLcd.cpp b/src/gui/official/SFLLcd.cpp index 2c030d351d6740ec0220637eb9588b145ea9f0de..a65d72c5f6865f34cd0ee3fd008cda05c63bf98b 100644 --- a/src/gui/official/SFLLcd.cpp +++ b/src/gui/official/SFLLcd.cpp @@ -19,6 +19,7 @@ SFLLcd::SFLLcd(QWidget *parent) , mScreen(TransparentWidget::retreive(SCREEN)) , mOverscreen(TransparentWidget::retreive(OVERSCREEN)) , mGlobalStatusPos(-1) + , mUnselectedLineStatusPos(-1) , mLineStatusPos(-1) , mBufferStatusPos(-1) , mActionPos(-1) @@ -28,7 +29,10 @@ SFLLcd::SFLLcd(QWidget *parent) 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())); @@ -57,6 +61,12 @@ SFLLcd::updateText() } } +void +SFLLcd::updateGlobalText() +{ + mUnselectedLineStatus = ""; +} + void SFLLcd::startTiming() { @@ -106,6 +116,19 @@ SFLLcd::setLineStatus(QString line) 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) { @@ -153,11 +176,22 @@ SFLLcd::paintEvent(QPaintEvent *event) // 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(mGlobalStatus, mGlobalStatusPos)); + extractVisibleText(globalStatus, *globalStatusPos)); p.drawText(QPoint(margin, 2*fm.height()), extractVisibleText(mLineStatus, mLineStatusPos)); p.drawText(QPoint(margin, 3*fm.height()), diff --git a/src/gui/official/SFLLcd.hpp b/src/gui/official/SFLLcd.hpp index bf41fb4e93ee981853a64dfd88cd64fd3b74bcdc..c286369fe7cec48a41da0d538214c813bdf0498e 100644 --- a/src/gui/official/SFLLcd.hpp +++ b/src/gui/official/SFLLcd.hpp @@ -41,6 +41,7 @@ public slots: QString getTimeStatus(); void setGlobalStatus(QString global); + void setUnselectedLineStatus(QString line); void setLineStatus(QString line); void setAction(QString line); void setBufferStatus(QString line); @@ -48,6 +49,7 @@ public slots: void startTiming(); void stopTiming(); void updateText(); + void updateGlobalText(); QString extractVisibleText(const QString &text, int &pos); private: @@ -55,10 +57,12 @@ private: QPixmap mOverscreen; QString mGlobalStatus; + QString mUnselectedLineStatus; QString mLineStatus; QString mBufferStatus; QString mAction; int mGlobalStatusPos; + int mUnselectedLineStatusPos; int mLineStatusPos; int mBufferStatusPos; int mActionPos; @@ -66,7 +70,7 @@ private: bool mIsTimed; QTime mTime; QTimer *mTimer; - QTimer *mTextTimer; + QTimer *mUnselectedLineTimer; QFont mFont; }; diff --git a/src/gui/official/SFLPhoneApp.cpp b/src/gui/official/SFLPhoneApp.cpp index 05f4785ade5b939d446296f875ec6158063e1daf..281cdcc7a9091bf460e2684a4d007200b45a8deb 100644 --- a/src/gui/official/SFLPhoneApp.cpp +++ b/src/gui/official/SFLPhoneApp.cpp @@ -75,6 +75,8 @@ SFLPhoneApp::initConnections(SFLPhoneWindow *w) // 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)),