Add a taskbar icon. We need a designer, please...
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16429 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1e6bb3a47e
commit
be510fac1b
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "call.h"
|
#include "call.h"
|
||||||
|
#include <QtGui>
|
||||||
#include <fshost.h>
|
#include <fshost.h>
|
||||||
|
|
||||||
Call::Call()
|
Call::Call()
|
||||||
|
@ -67,3 +68,13 @@ switch_status_t Call::toggleRecord(bool startRecord)
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Call::sendDTMF(QString digit)
|
||||||
|
{
|
||||||
|
QString result;
|
||||||
|
QString dtmf_string = QString("dtmf %1").arg(digit);
|
||||||
|
if (g_FSHost.sendCmd("pa", dtmf_string.toAscii(), &result) == SWITCH_STATUS_FALSE) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not send DTMF digit %s on call[%s]", digit.toAscii().data(), _uuid.toAscii().data());
|
||||||
|
QMessageBox::critical(0, QWidget::tr("DTMF Error"), QWidget::tr("There was an error sending DTMF, please report this bug."), QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
void setActive(bool isActive) { _isActive = isActive; }
|
void setActive(bool isActive) { _isActive = isActive; }
|
||||||
bool isActive() { return _isActive == true; }
|
bool isActive() { return _isActive == true; }
|
||||||
switch_status_t toggleRecord(bool);
|
switch_status_t toggleRecord(bool);
|
||||||
|
void sendDTMF(QString digit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _call_id;
|
int _call_id;
|
||||||
|
|
|
@ -40,6 +40,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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);
|
dialpadMapper = new QSignalMapper(this);
|
||||||
connect(ui->dtmf0Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
|
connect(ui->dtmf0Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
|
||||||
connect(ui->dtmf1Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
|
connect(ui->dtmf1Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
|
||||||
|
@ -73,8 +78,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
dialpadMapper->setMapping(ui->dtmfDBtn, QString("D"));
|
dialpadMapper->setMapping(ui->dtmfDBtn, QString("D"));
|
||||||
dialpadMapper->setMapping(ui->dtmfAstBtn, QString("*"));
|
dialpadMapper->setMapping(ui->dtmfAstBtn, QString("*"));
|
||||||
dialpadMapper->setMapping(ui->dtmfPoundBtn, QString("#"));
|
dialpadMapper->setMapping(ui->dtmfPoundBtn, QString("#"));
|
||||||
connect(dialpadMapper, SIGNAL(mapped(QString)), this, SLOT(dialDTMF(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(ready()),this, SLOT(fshostReady()));
|
||||||
connect(&g_FSHost, SIGNAL(ringing(QSharedPointer<Call>)), this, SLOT(ringing(QSharedPointer<Call>)));
|
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(answered(QSharedPointer<Call>)), this, SLOT(answered(QSharedPointer<Call>)));
|
||||||
|
@ -86,6 +92,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
connect(&g_FSHost, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountDel(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(&g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));*/
|
||||||
|
|
||||||
|
/* Connect call commands */
|
||||||
connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
|
connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
|
||||||
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()));
|
||||||
|
@ -95,6 +102,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
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()));
|
||||||
connect(ui->actionSetDefaultAccount, SIGNAL(triggered(bool)), this, SLOT(setDefaultAccount()));
|
connect(ui->actionSetDefaultAccount, SIGNAL(triggered(bool)), this, SLOT(setDefaultAccount()));
|
||||||
|
connect(sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayActivated(QSystemTrayIcon::ActivationReason)));
|
||||||
|
|
||||||
/* Set the context menus */
|
/* Set the context menus */
|
||||||
ui->tableAccounts->addAction(ui->actionSetDefaultAccount);
|
ui->tableAccounts->addAction(ui->actionSetDefaultAccount);
|
||||||
|
@ -186,13 +194,9 @@ void MainWindow::accountStateChanged(QSharedPointer<Account> acc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::dialDTMF(QString dtmf)
|
void MainWindow::sendDTMF(QString dtmf)
|
||||||
{
|
{
|
||||||
QString result;
|
g_FSHost.getCurrentActiveCall().data()->sendDTMF(dtmf);
|
||||||
QString dtmf_string = QString("dtmf %1").arg(dtmf);
|
|
||||||
if (g_FSHost.sendCmd("pa", dtmf_string.toAscii(), &result) == SWITCH_STATUS_FALSE) {
|
|
||||||
ui->textEdit->setText("Error sending that command");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::callListDoubleClick(QListWidgetItem *item)
|
void MainWindow::callListDoubleClick(QListWidgetItem *item)
|
||||||
|
@ -228,6 +232,8 @@ void MainWindow::fshostReady()
|
||||||
ui->newCallBtn->setEnabled(true);
|
ui->newCallBtn->setEnabled(true);
|
||||||
ui->textEdit->setEnabled(true);
|
ui->textEdit->setEnabled(true);
|
||||||
ui->textEdit->setText("Ready to dial and receive calls!");
|
ui->textEdit->setText("Ready to dial and receive calls!");
|
||||||
|
sysTray->show();
|
||||||
|
sysTray->showMessage(tr("Status"), tr("FSComm has initialized!"), QSystemTrayIcon::Information, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::paAnswer()
|
void MainWindow::paAnswer()
|
||||||
|
@ -464,3 +470,23 @@ void MainWindow::showAbout()
|
||||||
"<p>Compiled FSComm version: %1"
|
"<p>Compiled FSComm version: %1"
|
||||||
"<p>%2").arg(SWITCH_VERSION_FULL, result));
|
"<p>%2").arg(SWITCH_VERSION_FULL, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::sysTrayActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
|
{
|
||||||
|
switch(reason)
|
||||||
|
{
|
||||||
|
case QSystemTrayIcon::Trigger:
|
||||||
|
{
|
||||||
|
if (this->isVisible())
|
||||||
|
this->hide();
|
||||||
|
else {
|
||||||
|
this->show();
|
||||||
|
this->activateWindow();
|
||||||
|
this->raise();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <fshost.h>
|
#include <fshost.h>
|
||||||
#include <call.h>
|
#include <call.h>
|
||||||
|
@ -44,7 +45,6 @@ namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -61,7 +61,7 @@ private slots:
|
||||||
void showAbout();
|
void showAbout();
|
||||||
void prefTriggered();
|
void prefTriggered();
|
||||||
void coreLoadingError(QString);
|
void coreLoadingError(QString);
|
||||||
void dialDTMF(QString);
|
void sendDTMF(QString);
|
||||||
void callListDoubleClick(QListWidgetItem *);
|
void callListDoubleClick(QListWidgetItem *);
|
||||||
void makeCall();
|
void makeCall();
|
||||||
void fshostReady();
|
void fshostReady();
|
||||||
|
@ -78,11 +78,13 @@ private slots:
|
||||||
void accountAdd(QSharedPointer<Account>);
|
void accountAdd(QSharedPointer<Account>);
|
||||||
void accountDel(QSharedPointer<Account>);
|
void accountDel(QSharedPointer<Account>);
|
||||||
void accountStateChanged(QSharedPointer<Account>);
|
void accountStateChanged(QSharedPointer<Account>);
|
||||||
|
void sysTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QSignalMapper *dialpadMapper;
|
QSignalMapper *dialpadMapper;
|
||||||
PrefDialog *preferences;
|
PrefDialog *preferences;
|
||||||
|
QSystemTrayIcon *sysTray;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<file alias="pref_audio.gif">resources/pref_audio.gif</file>
|
<file alias="pref_audio.gif">resources/pref_audio.gif</file>
|
||||||
<file alias="pref_general.jpg">resources/pref_general.jpg</file>
|
<file alias="pref_general.jpg">resources/pref_general.jpg</file>
|
||||||
<file alias="pref_accounts.jpg">resources/pref_accounts.jpg</file>
|
<file alias="pref_accounts.jpg">resources/pref_accounts.jpg</file>
|
||||||
|
<file alias="taskbar_icon.png">resources/taskbar_icon.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/confs">
|
<qresource prefix="/confs">
|
||||||
<file alias="freeswitch.xml">conf/freeswitch.xml</file>
|
<file alias="freeswitch.xml">conf/freeswitch.xml</file>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue