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(); }
FluushOption::FluushOption(QWidget *parent) : QDialog(parent), ui(new Ui::FluushOption) { ui->setupUi(this); QMenu *contextMenu = new QMenu(this); QAction *takeFullScreen, *showMe, *quit; takeFullScreen = new QAction(tr("Take the full screen"), this); takeFullScreen->setCheckable(true); takeFullScreen->setChecked(ui->full_screen->isChecked()); connect(takeFullScreen, SIGNAL(toggled(bool)), ui->full_screen, SLOT(setChecked(bool))); connect(ui->full_screen, SIGNAL(toggled(bool)), takeFullScreen, SLOT(setChecked(bool))); showMe = new QAction(tr("Show options"), this); connect(showMe, SIGNAL(triggered()), this, SLOT(show())); quit = new QAction(tr("Quit"), this); connect(quit, SIGNAL(triggered()), this, SLOT(quit())); contextMenu->addAction(takeFullScreen); contextMenu->addSeparator(); contextMenu->addAction(showMe); contextMenu->addAction(quit); trayIcon = new QSystemTrayIcon(QIcon(":/icons/fluush-icon"), this); trayIcon->setContextMenu(contextMenu); trayIcon->show(); trayIcon->setToolTip(tr("Fluush - Right click to configure")); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayActivated(QSystemTrayIcon::ActivationReason))); net = new FluushNetwork(this); dia = new QProgressDialog(tr("Uploading to puush"), tr("Cancel"), 0, 100, this); dia->setVisible(false); dia->setAutoReset(false); dia->setAutoClose(false); connect(net, SIGNAL(showProgress()), dia, SLOT(show())); connect(net, SIGNAL(hideProgress()), dia, SLOT(hide())); connect(net, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(uploadProgress(qint64,qint64))); loadSettings(); }