phonesim: Add call status UI
cover phonesim: Add call status UI
This patch introduce a new tab "call" in phonesim UI in order to display calls informations (id, number, status, name and direction).
The interface to send CSSU and CSSI notification is now dynamic based on the type of current calls.
Nicolas Bertrand (6):
callmanager: Add signal on call status change
control: Update UI using call status
hardwaremanipulator: add callmanagement method
phonesim: Connect call status signal
controlbase.ui: Add call mangement tab
control: Update call view
src/callmanager.cpp | 34 ++++++++--- src/callmanager.h | 3 + src/control.cpp | 140 ++++++++++++++++++++++++++++++++++++++----- src/control.h | 6 ++ src/controlbase.ui | 61 +++++++++++++++++++ src/hardwaremanipulator.cpp | 4 + src/hardwaremanipulator.h | 2 + src/phonesim.cpp | 2 + 8 files changed, 228 insertions(+), 24 deletions(-)
PATCH 1/6 callmanager: Add signal on call status change
--- src/callmanager.cpp | 34 ++++++++++++++++++++++++++-------- src/callmanager.h | 3 +++ 2 files changed, 29 insertions(+), 8 deletions(-)
src/callmanager.cpp +26 -8
@@ -149,6 +149,8 @@ bool CallManager::command( const QString& cmd ) info.dialBack = false; callList += info; + emit sendCallStatus( &callList ); + // Advertise the call state change and then return to command mode. sendState( info ); send( "OK" );
@@ -176,6 +178,8 @@ bool CallManager::command( const QString& cmd ) info.dialBack = false; callList += info; + emit sendCallStatus( &callList ); + // Advertise the call state change and then return to command mode. sendState( info ); send( "CONNECT 19200" );
@@ -369,6 +373,7 @@ void CallManager::startIncomingCall( const QString& number, callList += info; emitRing(info); + emit sendCallStatus( &callList ); // Announce the incoming call using Ericsson-style state notifications. sendState( info );
@@ -395,6 +400,7 @@ void CallManager::hangupAll() connectTimer->stop(); alertingTimer->stop(); hangupTimer->stop(); + emit sendCallStatus( &callList ); } void CallManager::hangupConnected()
@@ -412,6 +418,8 @@ void CallManager::hangupConnected() if ( !hasCall( CallState_Held ) ) waitingToIncoming(); + + emit sendCallStatus( &callList ); } void CallManager::hangupHeld()
@@ -429,6 +437,8 @@ void CallManager::hangupHeld() if ( !hasCall( CallState_Active ) ) waitingToIncoming(); + + emit sendCallStatus( &callList ); } void CallManager::hangupConnectedAndHeld()
@@ -445,6 +455,7 @@ void CallManager::hangupConnectedAndHeld() } callList = newCallList; waitingToIncoming(); + emit sendCallStatus( &callList ); } void CallManager::hangupCall( int id )
@@ -464,15 +475,13 @@ bool CallManager::acceptCall() } else if ( hasCall( CallState_Active ) ) { // Put the active calls on hold and accept the incoming call. changeGroup( CallState_Active, CallState_Held ); - callList[index].state = CallState_Active; - sendState( callList[index] ); - return true; - } else { - // Only held calls, or no other calls, so just make the incoming call active. - callList[index].state = CallState_Active; - sendState( callList[index] ); - return true; } + + // No more active calls, so accept incoming + callList[index].state = CallState_Active; + sendState( callList[index] ); + emit sendCallStatus( &callList ); + return true; } bool CallManager::chld0()
@@ -500,6 +509,7 @@ bool CallManager::chld1() int index = indexForId(id); callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); return true; } else if ( hasCall( CallState_Held ) ) { // Hangup the active calls and activate the held ones.
@@ -508,6 +518,7 @@ bool CallManager::chld1() if ( callList[index].state == CallState_Held ) { callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); } } return true;
@@ -551,6 +562,7 @@ bool CallManager::chld1x( int x ) if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) ) waitingToIncoming(); + emit sendCallStatus( &callList ); return found; }
@@ -570,6 +582,7 @@ bool CallManager::chld2() int index = indexForId( id ); callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); return true; } else if ( hasCall( CallState_Active ) && hasCall( CallState_Held ) ) { // Swap the active and held calls.
@@ -620,6 +633,7 @@ bool CallManager::chld2x( int x ) // No active calls, so make just this call active. callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); } return true; } else if ( callList[index].state == CallState_Active ) {
@@ -634,6 +648,7 @@ bool CallManager::chld2x( int x ) return false; callList[index2].state = CallState_Held; sendState( callList[index2] ); + emit sendCallStatus( &callList ); } } return true;
@@ -691,6 +706,7 @@ void CallManager::dialingToConnected() // Transition the call to its new state. callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); // If the dialed number starts with 05123, disconnect the // call after xx seconds, where xx is part of the dial string // as 05123xx
@@ -714,6 +730,7 @@ void CallManager::dialingToAlerting() // Transition the call to its new state. callList[index].state = CallState_Alerting; sendState( callList[index] ); + emit sendCallStatus( &callList ); } void CallManager::waitingToIncoming()
@@ -856,6 +873,7 @@ void CallManager::changeGroup( CallState oldState, CallState newState ) sendState( callList[index] ); } } + emit sendCallStatus( &callList ); } void CallManager::sendState( const CallInfo& info )
src/callmanager.h +3 -0
@@ -114,6 +114,9 @@ signals:// Send a call control event. void controlEvent( const QSimControlEvent& event ); +// Send calls list on status change + void sendCallStatus( QList<CallInfo> *list ); + private slots:// Transition the active dialing or alerting call to connected. void dialingToConnected ();
Signature · 1 line
1.7.1
PATCH 2/6 control: Update UI using call status
In reply to Nicolas Bertrand--- src/control.cpp | 40 +++++++++++++++++++++++++++++++++++----- src/control.h | 5 +++++ 2 files changed, 40 insertions(+), 5 deletions(-)
src/control.cpp +35 -5
@@ -134,6 +134,32 @@ Control::~Control() delete widget; } +void Control::callManagement( QList<CallInfo> *list ) +{ + bool enableCSSU = false; + bool enableCSSI = false; + + foreach( CallInfo i, *list ) { + if ( i.incoming && !enableCSSU ) + enableCSSU = true; + if ( !i.incoming && !enableCSSI ) + enableCSSI = true; + } + + widget->CSSIactivation( enableCSSI ); + widget->CSSUactivation( enableCSSU ); +} + +void ControlWidget::CSSIactivation( bool enableCSSI ) +{ + ui->cbCSSI->setEnabled( enableCSSI ); +} + +void ControlWidget::CSSUactivation( bool enableCSSU ) +{ + ui->cbCSSU->setEnabled( enableCSSU ); +} + void Control::setPhoneNumber( const QString &number ) { widget->setWindowTitle("Phonesim - Number: " + number);
@@ -146,6 +172,10 @@ void Control::warning( const QString &title, const QString &message ) void ControlWidget::handleCSSNNotif() { + + ui->cbCSSU->setEnabled( false ); + ui->cbCSSI->setEnabled( false ); + ui->cbCSSU->insertItem(0, ""); ui->cbCSSU->insertItem(1, "0 - forwarded", 0); ui->cbCSSU->insertItem(3, "2 - on hold", 2);
@@ -160,15 +190,15 @@ void ControlWidget::handleCSSNNotif() void ControlWidget::sendCSSN() { - QVariant v = ui->cbCSSU->itemData(ui->cbCSSU->currentIndex()); + QVariant v = ui->cbCSSU->itemData( ui->cbCSSU->currentIndex() ); - if (v.canConvert<int>()) - emit unsolicitedCommand("+CSSU: "+QString::number(v.toInt())); + if ( v.canConvert<int>() && ui->cbCSSU->isEnabled() ) + emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) ); v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex()); - if (v.canConvert<int>()) - emit unsolicitedCommand("+CSSI: "+QString::number(v.toInt())); + if ( v.canConvert<int>() && ui->cbCSSI->isEnabled() ) + emit unsolicitedCommand( "+CSSI: "+QString::number( v.toInt() ) ); } void ControlWidget::sendSQ()
src/control.h +5 -0
@@ -25,6 +25,7 @@#include <QtScript> #include "ui_controlbase.h" #include "attranslator.h" +#include "callmanager.h" class Control;
@@ -71,6 +72,9 @@ public: void handleToData( const QString& );void handleNewApp ();void handleCSSNNotif (); +void CSSUactivation (bool enableCSSU ); +void CSSIactivation (bool enableCSSI ); + private slots:void sendSQ ();
@@ -146,6 +150,7 @@ public slots: void handleToData( const QString& ); void setPhoneNumber( const QString& );void handleNewApp (); + void callManagement( QList<CallInfo> *info ); protected: virtual void warning( const QString&, const QString& );
Signature · 1 line
1.7.1
PATCH 3/6 hardwaremanipulator: add callmanagement method
In reply to Nicolas Bertrand--- src/hardwaremanipulator.cpp | 4 ++++ src/hardwaremanipulator.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-)
src/hardwaremanipulator.cpp +4 -0
@@ -337,3 +337,7 @@ void HardwareManipulator::simAppAbort() if (app) return app->abort(); } + +void HardwareManipulator::callManagement( QList<CallInfo> *info ) +{ +}
src/hardwaremanipulator.h +2 -0
@@ -27,6 +27,7 @@class QSMSMessage;class QVMMessage;class SimRules; +struct CallInfo ; class HardwareManipulator : public QObject {Q_OBJECT
@@ -49,6 +50,7 @@ public slots: virtual void simAppStart( int appIndex ); virtual void simAppAbort(); virtual void handleNewApp(); + virtual void callManagement( QList<CallInfo> *info ); signals: void unsolicitedCommand(const QString &cmd);
Signature · 1 line
1.7.1
PATCH 4/6 phonesim: Connect call status signal
In reply to Nicolas Bertrand--- src/phonesim.cpp | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
src/phonesim.cpp +2 -0
@@ -528,6 +528,8 @@ SimRules::SimRules( int fd, QObject *p, const QString& filename, HardwareManipu if ( machine ) { connect( machine, SIGNAL(startIncomingCall(QString,QString,QString)), _callManager, SLOT(startIncomingCall(QString,QString,QString)) ); + connect ( _callManager, SIGNAL( sendCallStatus( QList<CallInfo> * ) ), + machine, SLOT( callManagement( QList<CallInfo> * ) ) ); } connect(this,SIGNAL(readyRead()),
Signature · 1 line
1.7.1
PATCH 5/6 controlbase.ui: Add call mangement tab
In reply to Nicolas Bertrand--- src/controlbase.ui | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-)
src/controlbase.ui +61 -0
@@ -1458,6 +1458,67 @@ p, li { white-space: pre-wrap; } </property> </widget> </widget> + <widget class="QWidget" name="tab_9"> + <attribute name="title"> + <string>Call</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QTableWidget" name="twCallMgt"> + <property name="columnCount"> + <number>5</number> + </property> + <attribute name="horizontalHeaderMinimumSectionSize"> + <number>50</number> + </attribute> + <attribute name="horizontalHeaderShowSortIndicator" stdset="0"> + <bool>true</bool> + </attribute> + <attribute name="verticalHeaderDefaultSectionSize"> + <number>50</number> + </attribute> + <column> + <property name="text"> + <string>id</string> + </property> + </column> + <column> + <property name="text"> + <string>number</string> + </property> + </column> + <column> + <property name="text"> + <string>state</string> + </property> + </column> + <column> + <property name="text"> + <string>name</string> + </property> + </column> + <column> + <property name="text"> + <string>type</string> + </property> + </column> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> </item> <item>
Signature · 1 line
1.7.1
PATCH 6/6 control: Update call view
In reply to Nicolas Bertrand--- src/control.cpp | 100 +++++++++++++++++++++++++++++++++++++++++++++++++------ src/control.h | 3 +- 2 files changed, 91 insertions(+), 12 deletions(-)
src/control.cpp +89 -11
@@ -136,14 +136,79 @@ Control::~Control() void Control::callManagement( QList<CallInfo> *list ) { + int row = 0; bool enableCSSU = false; bool enableCSSI = false; + widget->clearCallView(); + foreach( CallInfo i, *list ) { + QString param[5]; + if ( i.incoming && !enableCSSU ) enableCSSU = true; if ( !i.incoming && !enableCSSI ) enableCSSI = true; + + param[0].setNum( i.id ); + param[1] = i.number; + + switch( i.state ) { + + case CallState_Active: + { + param[2] = "Active"; + } + break; + + case CallState_Held: + { + param[2] = "Held"; + } + break; + + case CallState_Dialing: + { + param[2] = "Dialing"; + } + break; + + case CallState_Alerting: + { + param[2] = "Alerting"; + } + break; + + case CallState_Incoming: + { + param[2] = "Incoming"; + } + break; + + case CallState_Waiting: + { + param[2] = "Waiting"; + } + break; + + case CallState_Hangup: + { + param[2] = "Hangup"; + } + break; + + case CallState_SwapDummy: + { + param[2] = "SwapDummy"; + } + break; + } + + param[3] = i.name; + param[4] = i.incoming ? "incoming" : "outgoing"; + + widget->updateCallView( param, row ); + row++; } widget->CSSIactivation( enableCSSI );
@@ -160,6 +225,20 @@ void ControlWidget::CSSUactivation( bool enableCSSU ) ui->cbCSSU->setEnabled( enableCSSU ); } +void ControlWidget::clearCallView() +{ + ui->twCallMgt->clearContents(); +} + +void ControlWidget::updateCallView( QString callParameters [5], int row ) +{ + if ( row > ui->twCallMgt->rowCount() - 1 ) + ui->twCallMgt->insertRow( row ); + + for ( int i = 0; i < 5; i++ ) + ui->twCallMgt->setItem( row, i, new QTableWidgetItem( callParameters[i] ) ); +} + void Control::setPhoneNumber( const QString &number ) { widget->setWindowTitle("Phonesim - Number: " + number);
@@ -172,20 +251,19 @@ void Control::warning( const QString &title, const QString &message ) void ControlWidget::handleCSSNNotif() { - ui->cbCSSU->setEnabled( false ); ui->cbCSSI->setEnabled( false ); - ui->cbCSSU->insertItem(0, ""); - ui->cbCSSU->insertItem(1, "0 - forwarded", 0); - ui->cbCSSU->insertItem(3, "2 - on hold", 2); - ui->cbCSSU->insertItem(4, "3 - retrieved", 3); - ui->cbCSSU->insertItem(5, "4 - multiparty", 4); + ui->cbCSSU->insertItem( 0, "" ); + ui->cbCSSU->insertItem( 1, "0 - forwarded", 0 ); + ui->cbCSSU->insertItem( 3, "2 - on hold", 2 ); + ui->cbCSSU->insertItem( 4, "3 - retrieved", 3 ); + ui->cbCSSU->insertItem( 5, "4 - multiparty", 4 ); - ui->cbCSSI->insertItem(0, ""); - ui->cbCSSI->insertItem(3, "2 - forwarded", 2); - ui->cbCSSI->insertItem(6, "5 - outgoing barred", 5); - ui->cbCSSI->insertItem(7, "6 - incomming barred", 6); + ui->cbCSSI->insertItem( 0, "" ); + ui->cbCSSI->insertItem( 3, "2 - forwarded", 2 ); + ui->cbCSSI->insertItem( 6, "5 - outgoing barred", 5 ); + ui->cbCSSI->insertItem( 7, "6 - incomming barred", 6 ); } void ControlWidget::sendCSSN()
@@ -195,7 +273,7 @@ void ControlWidget::sendCSSN() if ( v.canConvert<int>() && ui->cbCSSU->isEnabled() ) emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) ); - v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex()); + v = ui->cbCSSI->itemData( ui->cbCSSI->currentIndex() ); if ( v.canConvert<int>() && ui->cbCSSI->isEnabled() ) emit unsolicitedCommand( "+CSSI: "+QString::number( v.toInt() ) );
src/control.h +2 -1
@@ -74,7 +74,8 @@ public:void handleCSSNNotif ();void CSSUactivation (bool enableCSSU );void CSSIactivation (bool enableCSSI ); - +void updateCallView (QString callParameters [5 ],int row ); +void clearCallView (); private slots:void sendSQ ();
Signature · 1 line
1.7.1
Re: [PATCH 1/6] callmanager: Add signal on call status change
In reply to Nicolas BertrandHi Nicolas,
Quoted 74 lines · Nicolas Bertrand
--- src/callmanager.cpp | 34 ++++++++++++++++++++++++++-------- src/callmanager.h | 3 +++ 2 files changed, 29 insertions(+), 8 deletions(-)src/callmanager.cpp +11
-1@@ -149,6 +149,8 @@ bool CallManager::command( const QString& cmd ) info.dialBack = false; callList += info; + emit sendCallStatus( &callList ); + // Advertise the call state change and then return to command mode. sendState( info ); send( "OK" );@@ -176,6 +178,8 @@ bool CallManager::command( const QString& cmd ) info.dialBack = false; callList += info; + emit sendCallStatus( &callList ); + // Advertise the call state change and then return to command mode. sendState( info ); send( "CONNECT 19200" );@@ -369,6 +373,7 @@ void CallManager::startIncomingCall( const QString& number, callList += info; emitRing(info); + emit sendCallStatus( &callList ); // Announce the incoming call using Ericsson-style state notifications. sendState( info );@@ -395,6 +400,7 @@ void CallManager::hangupAll() connectTimer->stop(); alertingTimer->stop(); hangupTimer->stop(); + emit sendCallStatus( &callList ); } void CallManager::hangupConnected()@@ -412,6 +418,8 @@ void CallManager::hangupConnected() if ( !hasCall( CallState_Held ) ) waitingToIncoming(); + + emit sendCallStatus( &callList ); } void CallManager::hangupHeld()@@ -429,6 +437,8 @@ void CallManager::hangupHeld() if ( !hasCall( CallState_Active ) ) waitingToIncoming(); + + emit sendCallStatus( &callList ); } void CallManager::hangupConnectedAndHeld()@@ -445,6 +455,7 @@ void CallManager::hangupConnectedAndHeld() } callList = newCallList; waitingToIncoming(); + emit sendCallStatus( &callList ); } void CallManager::hangupCall( int id )@@ -464,15 +475,13 @@ bool CallManager::acceptCall() } else if ( hasCall( CallState_Active ) ) { // Put the active calls on hold and accept the incoming call. changeGroup( CallState_Active, CallState_Held ); - callList[index].state = CallState_Active;
src/callmanager.cpp bool CallManager::acceptCall() · line 480
Quoted 10 lines
src/callmanager.cpp +2
-7- sendState( callList[index] ); - return true; - } else { - // Only held calls, or no other calls, so just make the incoming call active. - callList[index].state = CallState_Active; - sendState( callList[index] ); - return true; } + + // No more active calls, so accept incoming
Please make sure to follow phonesim's 4-space indentation rules.
src/callmanager.cpp bool CallManager::acceptCall() · line 484
Quoted 4 lines
src/callmanager.cpp +4
-0+ callList[index].state = CallState_Active; + sendState( callList[index] ); + emit sendCallStatus( &callList ); + return true;
This chunk is changing the behavior and does not belong in this patch. Please send the behavior modification separately. Also please note that once any calls (active or held) exist, then you cannot have incoming calls, only waiting calls. The logic of this function can probably be simplified somewhat.
Quoted 80 lines
src/callmanager.cpp +9
-0} bool CallManager::chld0()@@ -500,6 +509,7 @@ bool CallManager::chld1() int index = indexForId(id); callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); return true; } else if ( hasCall( CallState_Held ) ) { // Hangup the active calls and activate the held ones.@@ -508,6 +518,7 @@ bool CallManager::chld1() if ( callList[index].state == CallState_Held ) { callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); } } return true;@@ -551,6 +562,7 @@ bool CallManager::chld1x( int x ) if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) ) waitingToIncoming(); + emit sendCallStatus( &callList ); return found; }@@ -570,6 +582,7 @@ bool CallManager::chld2() int index = indexForId( id ); callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); return true; } else if ( hasCall( CallState_Active ) && hasCall( CallState_Held ) ) { // Swap the active and held calls.@@ -620,6 +633,7 @@ bool CallManager::chld2x( int x ) // No active calls, so make just this call active. callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); } return true; } else if ( callList[index].state == CallState_Active ) {@@ -634,6 +648,7 @@ bool CallManager::chld2x( int x ) return false; callList[index2].state = CallState_Held; sendState( callList[index2] ); + emit sendCallStatus( &callList ); } } return true;@@ -691,6 +706,7 @@ void CallManager::dialingToConnected() // Transition the call to its new state. callList[index].state = CallState_Active; sendState( callList[index] ); + emit sendCallStatus( &callList ); // If the dialed number starts with 05123, disconnect the // call after xx seconds, where xx is part of the dial string // as 05123xx@@ -714,6 +730,7 @@ void CallManager::dialingToAlerting() // Transition the call to its new state. callList[index].state = CallState_Alerting; sendState( callList[index] ); + emit sendCallStatus( &callList ); } void CallManager::waitingToIncoming()@@ -856,6 +873,7 @@ void CallManager::changeGroup( CallState oldState, CallState newState ) sendState( callList[index] ); } } + emit sendCallStatus( &callList ); } void CallManager::sendState( const CallInfo& info )src/callmanager.h +0
-0
src/callmanager.h signals: · line 119
Quoted 6 lines
src/callmanager.h +3
-0@@ -114,6 +114,9 @@ signals:// Send a call control event. void controlEvent( const QSimControlEvent& event ); +// Send calls list on status change + void sendCallStatus( QList<CallInfo> *list ); +
For Qt style APIs signals should use past-tense wording. e.g. something like callStatesChanged(). I know phonesim isn't really good in this respect ;). Lets strive to do better for new additions
src/callmanager.h signals: · line 122
Quoted 3 lines
src/callmanager.h +0
-0private slots:// Transition the active dialing or alerting call to connected. void dialingToConnected ();
Regards,
-Denis
Re: [PATCH 2/6] control: Update UI using call status
In reply to Nicolas BertrandHi Nicolas,
Quoted 13 lines · Nicolas Bertrand
--- src/control.cpp | 40 +++++++++++++++++++++++++++++++++++----- src/control.h | 5 +++++ 2 files changed, 40 insertions(+), 5 deletions(-)src/control.cpp +0
-0@@ -134,6 +134,32 @@ Control::~Control() delete widget; }
src/control.cpp Control::~Control() · line 146
Quoted 10 lines
src/control.cpp +10
-0+void Control::callManagement( QList<CallInfo> *list ) +{ + bool enableCSSU = false; + bool enableCSSI = false; + + foreach( CallInfo i, *list ) { + if ( i.incoming && !enableCSSU ) + enableCSSU = true; + if ( !i.incoming && !enableCSSI ) + enableCSSI = true;
indentation consistency please ;)
Quoted 5 lines
src/control.cpp +5
-0+ } + + widget->CSSIactivation( enableCSSI ); + widget->CSSUactivation( enableCSSU ); +}
src/control.cpp Control::~Control() · line 161
Quoted 10 lines
src/control.cpp +10
-0+ +void ControlWidget::CSSIactivation( bool enableCSSI ) +{ + ui->cbCSSI->setEnabled( enableCSSI ); +} + +void ControlWidget::CSSUactivation( bool enableCSSU ) +{ + ui->cbCSSU->setEnabled( enableCSSU ); +}
These might be better named something like:
setCssiEnabled and setCssuEnabled. Note that Qt APIs are strict CamelCase, even with abbreviations and the first word of a function should be all small-caps.
Quoted 59 lines
src/control.cpp +10
-5+ void Control::setPhoneNumber( const QString &number ) { widget->setWindowTitle("Phonesim - Number: " + number);@@ -146,6 +172,10 @@ void Control::warning( const QString &title, const QString &message ) void ControlWidget::handleCSSNNotif() { + + ui->cbCSSU->setEnabled( false ); + ui->cbCSSI->setEnabled( false ); + ui->cbCSSU->insertItem(0, ""); ui->cbCSSU->insertItem(1, "0 - forwarded", 0); ui->cbCSSU->insertItem(3, "2 - on hold", 2);@@ -160,15 +190,15 @@ void ControlWidget::handleCSSNNotif() void ControlWidget::sendCSSN() { - QVariant v = ui->cbCSSU->itemData(ui->cbCSSU->currentIndex()); + QVariant v = ui->cbCSSU->itemData( ui->cbCSSU->currentIndex() ); - if (v.canConvert<int>()) - emit unsolicitedCommand("+CSSU: "+QString::number(v.toInt())); + if ( v.canConvert<int>() && ui->cbCSSU->isEnabled() ) + emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) ); v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex()); - if (v.canConvert<int>()) - emit unsolicitedCommand("+CSSI: "+QString::number(v.toInt())); + if ( v.canConvert<int>() && ui->cbCSSI->isEnabled() ) + emit unsolicitedCommand( "+CSSI: "+QString::number( v.toInt() ) ); } void ControlWidget::sendSQ()src/control.h +4
-0@@ -25,6 +25,7 @@#include <QtScript> #include "ui_controlbase.h" #include "attranslator.h" +#include "callmanager.h" class Control;@@ -71,6 +72,9 @@ public: void handleToData( const QString& );void handleNewApp ();void handleCSSNNotif (); +void CSSUactivation (bool enableCSSU ); +void CSSIactivation (bool enableCSSI ); + private slots:void sendSQ ();
src/control.h public slots: · line 156
Quoted 7 lines
src/control.h +1
-0@@ -146,6 +150,7 @@ public slots: void handleToData( const QString& ); void setPhoneNumber( const QString& );void handleNewApp (); + void callManagement( QList<CallInfo> *info ); protected: virtual void warning( const QString&, const QString& );
Regards,
-Denis