Make UI enhancements and refactor some code. We still have bugs on handling multiple calls and switching between them.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16431 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1390132682
commit
0ecda2f00a
|
@ -45,10 +45,9 @@ typedef enum {
|
||||||
FSCOMM_CALL_DIRECTION_OUTBOUND = 1
|
FSCOMM_CALL_DIRECTION_OUTBOUND = 1
|
||||||
} fscomm_call_direction_t;
|
} fscomm_call_direction_t;
|
||||||
|
|
||||||
class Call
|
class Call {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Call(void);
|
Call();
|
||||||
Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
|
Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
|
||||||
QString getCidName(void) { return _cid_name; }
|
QString getCidName(void) { return _cid_name; }
|
||||||
QString getCidNumber(void) { return _cid_number; }
|
QString getCidNumber(void) { return _cid_number; }
|
||||||
|
|
|
@ -97,7 +97,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
connect(ui->answerBtn, SIGNAL(clicked()), this, SLOT(paAnswer()));
|
connect(ui->answerBtn, SIGNAL(clicked()), this, SLOT(paAnswer()));
|
||||||
connect(ui->hangupBtn, SIGNAL(clicked()), this, SLOT(paHangup()));
|
connect(ui->hangupBtn, SIGNAL(clicked()), this, SLOT(paHangup()));
|
||||||
connect(ui->recoredCallBtn, SIGNAL(toggled(bool)), SLOT(recordCall(bool)));
|
connect(ui->recoredCallBtn, SIGNAL(toggled(bool)), SLOT(recordCall(bool)));
|
||||||
connect(ui->listCalls, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(callListDoubleClick(QListWidgetItem*)));
|
connect(ui->tableCalls, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(callTableDoubleClick(QTableWidgetItem*)));
|
||||||
connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefTriggered()));
|
connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefTriggered()));
|
||||||
connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close()));
|
connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close()));
|
||||||
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
|
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
|
||||||
|
@ -199,7 +199,8 @@ void MainWindow::sendDTMF(QString dtmf)
|
||||||
g_FSHost.getCurrentActiveCall().data()->sendDTMF(dtmf);
|
g_FSHost.getCurrentActiveCall().data()->sendDTMF(dtmf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::callListDoubleClick(QListWidgetItem *item)
|
/* TODO: Update the timers and the item text! */
|
||||||
|
void MainWindow::callTableDoubleClick(QTableWidgetItem *item)
|
||||||
{
|
{
|
||||||
QSharedPointer<Call> lastCall = g_FSHost.getCurrentActiveCall();
|
QSharedPointer<Call> lastCall = g_FSHost.getCurrentActiveCall();
|
||||||
QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
|
QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
|
||||||
|
@ -301,9 +302,20 @@ void MainWindow::recordCall(bool pressed)
|
||||||
void MainWindow::newOutgoingCall(QSharedPointer<Call> call)
|
void MainWindow::newOutgoingCall(QSharedPointer<Call> call)
|
||||||
{
|
{
|
||||||
ui->textEdit->setText(QString("Calling %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
ui->textEdit->setText(QString("Calling %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
||||||
QListWidgetItem *item = new QListWidgetItem(tr("%1 (%2) - Calling").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
|
||||||
item->setData(Qt::UserRole, call.data()->getUUID());
|
ui->tableCalls->setRowCount(ui->tableCalls->rowCount()+1);
|
||||||
ui->listCalls->addItem(item);
|
QTableWidgetItem *item0 = new QTableWidgetItem(QString("%1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
||||||
|
item0->setData(Qt::UserRole, call.data()->getUUID());
|
||||||
|
ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,0,item0);
|
||||||
|
|
||||||
|
QTableWidgetItem *item1 = new QTableWidgetItem(tr("Dialing..."));
|
||||||
|
item1->setData(Qt::UserRole, call.data()->getUUID());
|
||||||
|
ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,1,item1);
|
||||||
|
|
||||||
|
ui->tableCalls->resizeColumnsToContents();
|
||||||
|
ui->tableCalls->resizeRowsToContents();
|
||||||
|
ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
|
||||||
ui->hangupBtn->setEnabled(true);
|
ui->hangupBtn->setEnabled(true);
|
||||||
call.data()->setActive(true);
|
call.data()->setActive(true);
|
||||||
}
|
}
|
||||||
|
@ -311,42 +323,48 @@ void MainWindow::newOutgoingCall(QSharedPointer<Call> call)
|
||||||
void MainWindow::ringing(QSharedPointer<Call> call)
|
void MainWindow::ringing(QSharedPointer<Call> call)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i=0; i<ui->listCalls->count(); i++)
|
for (int i=0; i<ui->tableCalls->rowCount(); i++)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui->listCalls->item(i);
|
QTableWidgetItem *item = ui->tableCalls->item(i, 1);
|
||||||
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
||||||
{
|
{
|
||||||
item->setText(tr("%1 - Ringing").arg(call.data()->getCidNumber()));
|
item->setText(tr("Ringing"));
|
||||||
ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
||||||
QListWidgetItem *item = new QListWidgetItem(tr("%1 (%2) - Ringing").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
|
||||||
item->setData(Qt::UserRole, call.data()->getUUID());
|
ui->tableCalls->setRowCount(ui->tableCalls->rowCount()+1);
|
||||||
ui->listCalls->addItem(item);
|
QTableWidgetItem *item0 = new QTableWidgetItem(QString("%1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
||||||
|
item0->setData(Qt::UserRole, call.data()->getUUID());
|
||||||
|
ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,0,item0);
|
||||||
|
|
||||||
|
QTableWidgetItem *item1 = new QTableWidgetItem(tr("Ringing"));
|
||||||
|
item1->setData(Qt::UserRole, call.data()->getUUID());
|
||||||
|
ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,1,item1);
|
||||||
|
|
||||||
|
ui->tableCalls->resizeColumnsToContents();
|
||||||
|
ui->tableCalls->resizeRowsToContents();
|
||||||
|
ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
|
||||||
ui->answerBtn->setEnabled(true);
|
ui->answerBtn->setEnabled(true);
|
||||||
call.data()->setActive(true);
|
call.data()->setActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::answered(QSharedPointer<Call> call)
|
void MainWindow::answered(QSharedPointer<Call> call)
|
||||||
{
|
{
|
||||||
for (int i=0; i<ui->listCalls->count(); i++)
|
for (int i=0; i<ui->tableCalls->rowCount(); i++)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui->listCalls->item(i);
|
QTableWidgetItem *item = ui->tableCalls->item(i, 1);
|
||||||
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
||||||
{
|
{
|
||||||
if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
|
item->setText(tr("Answered"));
|
||||||
{
|
ui->tableCalls->resizeColumnsToContents();
|
||||||
item->setText(tr("%1 (%2) - Active").arg(call.data()->getCidName(), call.data()->getCidNumber()));
|
ui->tableCalls->resizeRowsToContents();
|
||||||
break;
|
ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
item->setText(tr("%1 - Active").arg(call.data()->getCidNumber()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->recoredCallBtn->setEnabled(true);
|
ui->recoredCallBtn->setEnabled(true);
|
||||||
|
@ -371,12 +389,15 @@ void MainWindow::answered(QSharedPointer<Call> call)
|
||||||
|
|
||||||
void MainWindow::callFailed(QSharedPointer<Call> call)
|
void MainWindow::callFailed(QSharedPointer<Call> call)
|
||||||
{
|
{
|
||||||
for (int i=0; i<ui->listCalls->count(); i++)
|
for (int i=0; i<ui->tableCalls->rowCount(); i++)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui->listCalls->item(i);
|
QTableWidgetItem *item = ui->tableCalls->item(i, 1);
|
||||||
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
||||||
{
|
{
|
||||||
delete ui->listCalls->takeItem(i);
|
ui->tableCalls->removeRow(i);
|
||||||
|
ui->tableCalls->resizeColumnsToContents();
|
||||||
|
ui->tableCalls->resizeRowsToContents();
|
||||||
|
ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,12 +431,15 @@ void MainWindow::callFailed(QSharedPointer<Call> call)
|
||||||
|
|
||||||
void MainWindow::hungup(QSharedPointer<Call> call)
|
void MainWindow::hungup(QSharedPointer<Call> call)
|
||||||
{
|
{
|
||||||
for (int i=0; i<ui->listCalls->count(); i++)
|
for (int i=0; i<ui->tableCalls->rowCount(); i++)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui->listCalls->item(i);
|
QTableWidgetItem *item = ui->tableCalls->item(i, 1);
|
||||||
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
|
||||||
{
|
{
|
||||||
delete ui->listCalls->takeItem(i);
|
ui->tableCalls->removeRow(i);
|
||||||
|
ui->tableCalls->resizeColumnsToContents();
|
||||||
|
ui->tableCalls->resizeRowsToContents();
|
||||||
|
ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QListWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
@ -62,7 +62,7 @@ private slots:
|
||||||
void prefTriggered();
|
void prefTriggered();
|
||||||
void coreLoadingError(QString);
|
void coreLoadingError(QString);
|
||||||
void sendDTMF(QString);
|
void sendDTMF(QString);
|
||||||
void callListDoubleClick(QListWidgetItem *);
|
void callTableDoubleClick(QTableWidgetItem*);
|
||||||
void makeCall();
|
void makeCall();
|
||||||
void fshostReady();
|
void fshostReady();
|
||||||
void paAnswer();
|
void paAnswer();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>670</width>
|
<width>716</width>
|
||||||
<height>541</height>
|
<height>541</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -256,7 +256,35 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="listCalls"/>
|
<widget class="QTableWidget" name="tableCalls">
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>To/From</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Status</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Time</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -329,7 +357,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>670</width>
|
<width>716</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in New Issue