Open Source Telephony
 help / color / mirror / Atom feed
From: Nicolas Bertrand <nicolas.bertrand@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 6/6] control: Update call view
Date: Thu, 28 Apr 2011 11:49:39 +0200	[thread overview]
Message-ID: <1303984179-8333-7-git-send-email-nicolas.bertrand@linux.intel.com> (raw)
In-Reply-To: <1303984179-8333-1-git-send-email-nicolas.bertrand@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 4726 bytes --]

---
 src/control.cpp |  100 +++++++++++++++++++++++++++++++++++++++++++++++++------
 src/control.h   |    3 +-
 2 files changed, 91 insertions(+), 12 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 2f12d91..dec3aea 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -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() ) );
diff --git a/src/control.h b/src/control.h
index 2ccde29..20bdc86 100644
--- a/src/control.h
+++ b/src/control.h
@@ -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();
-- 
1.7.1


      parent reply	other threads:[~2011-04-28  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
2011-04-28 19:52   ` Denis Kenzior
2011-04-28  9:49 ` [PATCH 2/6] control: Update UI using call status Nicolas Bertrand
2011-04-28 19:58   ` Denis Kenzior
2011-04-28  9:49 ` [PATCH 3/6] hardwaremanipulator: add callmanagement method Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 4/6] phonesim: Connect call status signal Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 5/6] controlbase.ui: Add call mangement tab Nicolas Bertrand
2011-04-28  9:49 ` Nicolas Bertrand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303984179-8333-7-git-send-email-nicolas.bertrand@linux.intel.com \
    --to=nicolas.bertrand@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox