Beispiel #1
0
void Question_widget::slot_button_clicked() {
  QPushButton* b = dynamic_cast<QPushButton*>(sender());
  int index = buttons_widgets.indexOf(b);
  answered(buttons[index].data);
  main_window->get_active_pane()->setFocus();
  deleteLater();
}
Beispiel #2
0
void FSHost::eventChannelAnswer(QSharedPointer<switch_event_t>event, QString uuid)
{
    _channels.value(uuid).data()->setDestinatinonNumber(switch_event_get_header_nil(event.data(), "Caller-Destination-Number"));
    if (_active_calls.contains(uuid))
    {
        _active_calls.value(uuid).data()->setAnsweredEpoch(QString(switch_event_get_header_nil(event.data(), "Caller-Channel-Answered-Time")).toULongLong());
        _active_calls.value(uuid).data()->setState(FSCOMM_CALL_STATE_ANSWERED);
        emit answered(_active_calls.value(uuid));
    }
}
Beispiel #3
0
void Question_widget::on_answer_editor_textEdited(const QString &text) {
  if (text.isEmpty()) return;
  int number = text.toInt();
  for(int i = 0; i < buttons.count(); i++) {
    if (buttons[i].number == number) {
      answered(buttons[i].data);
      main_window->get_active_pane()->setFocus();
      deleteLater();
      return;
    }
  }
  ui->answer_editor->clear();
}
Beispiel #4
0
bool Question_widget::eventFilter(QObject *object, QEvent *event) {
  //if (object == ui->answer_editor) {
  if (buttons_widgets.contains(static_cast<QPushButton*>(object))) {
    if (event->type() == QEvent::KeyPress) {
      QKeyEvent* e = static_cast<QKeyEvent*>(event);
      if (e->key() == Qt::Key_Escape) {
        //ui->answer_frame->hide();
        main_window->get_active_pane()->setFocus();
        return true;
      } else if (e->key() == Qt::Key_Down) {
        main_window->switch_focus_question(this, 1);
        return true;
      } else if (e->key() == Qt::Key_Up) {
        main_window->switch_focus_question(this, -1);
        return true;
      } else if (e->key() == Qt::Key_Left && buttons_widgets.first() == object) {
        buttons_widgets.last()->setFocus();
        return true;
      } else if (e->key() == Qt::Key_Right && buttons_widgets.last() == object) {
        buttons_widgets.first()->setFocus();
        return true;
      }
      bool ok;
      int number = e->text().toInt(&ok);
      if (ok) {
        for(int i = 0; i < buttons.count(); i++) {
          if (buttons[i].number == number) {
            answered(buttons[i].data);
            main_window->get_active_pane()->setFocus();
            deleteLater();
            return true;
          }
        }
      }
    } else if (event->type() == QEvent::FocusOut) {
      //ui->answer_frame->hide();
    }
  }
  return false;
}
Beispiel #5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    preferences(NULL),
    _consoleWindow(NULL),
    _stateDebugDialog(NULL)

{
    ui->setupUi(this);

    /* Setup the taskbar icon */
    sysTray = new QSystemTrayIcon(QIcon(":/images/taskbar_icon"), this);
    sysTray->setToolTip(tr("FSComm"));

    /* Connect DTMF buttons */
    dialpadMapper = new QSignalMapper(this);
    connect(ui->dtmf0Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf1Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf2Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf3Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf4Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf5Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf6Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf7Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf8Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmf9Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmfABtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmfBBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmfCBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmfDBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmfAstBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    connect(ui->dtmfPoundBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
    dialpadMapper->setMapping(ui->dtmf0Btn, QString("0"));
    dialpadMapper->setMapping(ui->dtmf1Btn, QString("1"));
    dialpadMapper->setMapping(ui->dtmf2Btn, QString("2"));
    dialpadMapper->setMapping(ui->dtmf3Btn, QString("3"));
    dialpadMapper->setMapping(ui->dtmf4Btn, QString("4"));
    dialpadMapper->setMapping(ui->dtmf5Btn, QString("5"));
    dialpadMapper->setMapping(ui->dtmf6Btn, QString("6"));
    dialpadMapper->setMapping(ui->dtmf7Btn, QString("7"));
    dialpadMapper->setMapping(ui->dtmf8Btn, QString("8"));
    dialpadMapper->setMapping(ui->dtmf9Btn, QString("9"));
    dialpadMapper->setMapping(ui->dtmfABtn, QString("A"));
    dialpadMapper->setMapping(ui->dtmfBBtn, QString("B"));
    dialpadMapper->setMapping(ui->dtmfCBtn, QString("C"));
    dialpadMapper->setMapping(ui->dtmfDBtn, QString("D"));
    dialpadMapper->setMapping(ui->dtmfAstBtn, QString("*"));
    dialpadMapper->setMapping(ui->dtmfPoundBtn, QString("#"));
    connect(dialpadMapper, SIGNAL(mapped(QString)), this, SLOT(sendDTMF(QString)));

    /* Connect events related to FreeSWITCH */
    connect(g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady()));
    connect(g_FSHost, SIGNAL(ringing(QSharedPointer<Call>)), this, SLOT(ringing(QSharedPointer<Call>)));
    connect(g_FSHost, SIGNAL(answered(QSharedPointer<Call>)), this, SLOT(answered(QSharedPointer<Call>)));
    connect(g_FSHost, SIGNAL(hungup(QSharedPointer<Call>)), this, SLOT(hungup(QSharedPointer<Call>)));
    connect(g_FSHost, SIGNAL(newOutgoingCall(QSharedPointer<Call>)), this, SLOT(newOutgoingCall(QSharedPointer<Call>)));
    connect(g_FSHost, SIGNAL(callFailed(QSharedPointer<Call>)), this, SLOT(callFailed(QSharedPointer<Call>)));
    connect(g_FSHost, SIGNAL(accountStateChange(QSharedPointer<Account>)), this, SLOT(accountStateChanged(QSharedPointer<Account>)));
    connect(g_FSHost, SIGNAL(newAccount(QSharedPointer<Account>)), this, SLOT(accountAdd(QSharedPointer<Account>)));
    connect(g_FSHost, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountDel(QSharedPointer<Account>)));
    connect(g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));

    /* Connect call commands */
    connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
    connect(ui->answerBtn, SIGNAL(clicked()), this, SLOT(paAnswer()));
    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()));
    connect(ui->actionConsole, SIGNAL(triggered()), this, SLOT(debugConsoleTriggered()));
    connect(ui->actionEvents, SIGNAL(triggered()), this, SLOT(debugEventsTriggered()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
    connect(ui->actionSetDefaultAccount, SIGNAL(triggered(bool)), this, SLOT(setDefaultAccount()));
    connect(sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayActivated(QSystemTrayIcon::ActivationReason)));

    /* Set the context menus */
    ui->tableAccounts->addAction(ui->actionSetDefaultAccount);

    /* Set other properties */
    ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);

    /* Set the call timer */
    callTimer = new QTimer(this);
    callTimer->setInterval(1000);
    connect(callTimer, SIGNAL(timeout()), this, SLOT(updateCallTimers()));
    callTimer->start();
}
Beispiel #6
0
void down_click_handler(ClickRecognizerRef recognizer, void *context) {
    if (theState == SHOWING_TWO_FACES) {
        answered(false);
    }
}