From fab8e0d5b67ed6bc51d4f19ad6e77cfef8e0bde9 Mon Sep 17 00:00:00 2001 From: Joao Mesquita Date: Wed, 14 Apr 2010 23:54:59 -0300 Subject: [PATCH] Fix some things on the console and start implementing the transfer. --- fscomm/call.cpp | 6 ++++++ fscomm/call.h | 5 ++++- fscomm/debugtools/consolewindow.cpp | 20 +++++++++++++++++--- fscomm/mainwindow.cpp | 5 +++-- fscomm/mainwindow.h | 1 + 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/fscomm/call.cpp b/fscomm/call.cpp index 80dc316fb3..0dce6a83cd 100644 --- a/fscomm/call.cpp +++ b/fscomm/call.cpp @@ -112,3 +112,9 @@ QTime Call::getCurrentStateTime() int now = QDateTime::fromTime_t(time).secsTo(QDateTime::currentDateTime()); return QTime::fromString(QString::number(now), "s"); } + +/*bool Call::transfer() +{ + + g_FSHost.sendCmd("uuid_bridge", "") +}*/ diff --git a/fscomm/call.h b/fscomm/call.h index 81f712a679..d2626f35af 100644 --- a/fscomm/call.h +++ b/fscomm/call.h @@ -38,7 +38,8 @@ typedef enum { FSCOMM_CALL_STATE_RINGING = 0, FSCOMM_CALL_STATE_TRYING = 1, FSCOMM_CALL_STATE_ANSWERED = 2, - FSCOMM_CALL_STATE_FAILED = 3 + FSCOMM_CALL_STATE_FAILED = 3, + FSCOMM_CALL_STATE_TRANSFER = 4 } fscomm_call_state_t; typedef enum { @@ -76,6 +77,8 @@ public: void setAnsweredEpoch(qulonglong time) { _answeredEpoch = time/1000000; } QTime getCurrentStateTime(); + /*bool transfer();*/ + private: QSharedPointer _channel; /* This should be our portaudio channel */ QSharedPointer _otherLegChannel; diff --git a/fscomm/debugtools/consolewindow.cpp b/fscomm/debugtools/consolewindow.cpp index aa3b4faa42..25fab26df9 100644 --- a/fscomm/debugtools/consolewindow.cpp +++ b/fscomm/debugtools/consolewindow.cpp @@ -105,9 +105,23 @@ void ConsoleWindow::cmdSendClicked() QString res; g_FSHost.sendCmd(cmd.toAscii().data(), args.toAscii().data(), &res); - QStandardItem *item = new QStandardItem(res); - item->setData(SWITCH_LOG_CONSOLE, ConsoleModel::LogLevelRole); - addNewConsoleItem(item); + if (!res.isEmpty()) + { + /* Remove \r\n */ + QStringList textList = res.split(QRegExp("(\r+)"), QString::SkipEmptyParts); + QString final_str; + for (int line = 0; linesetData(SWITCH_LOG_CONSOLE, ConsoleModel::LogLevelRole); + addNewConsoleItem(item); + } + } ui->lineCmd->clear(); } diff --git a/fscomm/mainwindow.cpp b/fscomm/mainwindow.cpp index 0cfb076f3e..50dca81bee 100644 --- a/fscomm/mainwindow.cpp +++ b/fscomm/mainwindow.cpp @@ -101,6 +101,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->hangupBtn, SIGNAL(clicked()), this, SLOT(paHangup())); connect(ui->recoredCallBtn, SIGNAL(toggled(bool)), SLOT(recordCall(bool))); connect(ui->btnHold, SIGNAL(toggled(bool)), this, SLOT(holdCall(bool))); + /*connect(ui->btnTransfer, SIGNAL(clicked()), this, SLOT(transferCall()));*/ connect(ui->tableCalls, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(callTableDoubleClick(QTableWidgetItem*))); connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefTriggered())); connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close())); @@ -280,9 +281,9 @@ void MainWindow::callTableDoubleClick(QTableWidgetItem *item) void MainWindow::makeCall() { - bool ok; + bool ok = true; QString dialstring = QInputDialog::getText(this, tr("Make new call"), - tr("Number to dial:"), QLineEdit::Normal, NULL,&ok); + tr("Number to dial:"), QLineEdit::Normal, NULL,&ok); QSharedPointer acc = g_FSHost.getCurrentDefaultAccount(); if (!acc.isNull()) { diff --git a/fscomm/mainwindow.h b/fscomm/mainwindow.h index 3b87da18ed..32c4466d20 100644 --- a/fscomm/mainwindow.h +++ b/fscomm/mainwindow.h @@ -77,6 +77,7 @@ private slots: void callFailed(QSharedPointer); void recordCall(bool); void holdCall(bool); + /*void transferCall();*/ void setDefaultAccount(); void accountAdd(QSharedPointer); void accountDel(QSharedPointer);