提交 8b9cd950 authored 作者: João Mesquita's avatar João Mesquita

GUI tuning.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@16122 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 597b99b7
...@@ -30,3 +30,4 @@ HEADERS += mainwindow.h \ ...@@ -30,3 +30,4 @@ HEADERS += mainwindow.h \
call.h \ call.h \
mod_qsettings/mod_qsettings.h mod_qsettings/mod_qsettings.h
FORMS += mainwindow.ui FORMS += mainwindow.ui
RESOURCES += resources.qrc
<include>
<gateway name="voicetechnology.com.ar">
<!--/// account username *required* ///-->
<param name="username" value="1001"/>
<!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>-->
<!--/// username to use in from: *optional* same as username, if blank ///-->
<!--<param name="from-user" value="cluecon"/>-->
<!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--<param name="from-domain" value="asterlink.com"/>-->
<!--/// account password *required* ///-->
<param name="password" value="cerrito2p"/>
<!--/// extension for inbound calls: *optional* same as username, if blank ///-->
<!--<param name="extension" value="cluecon"/>-->
<!--/// proxy host: *optional* same as realm, if blank ///-->
<!--<param name="proxy" value="asterlink.com"/>-->
<!--/// send register to this proxy: *optional* same as proxy, if blank ///-->
<!--<param name="register-proxy" value="mysbc.com"/>-->
<!--/// expire in seconds: *optional* 3600, if blank ///-->
<!--<param name="expire-seconds" value="60"/>-->
<!--/// do not register ///-->
<!--<param name="register" value="false"/>-->
<!-- which transport to use for register -->
<!--<param name="register-transport" value="udp"/>-->
<!--How many seconds before a retry when a failure or timeout occurs -->
<!--<param name="retry-seconds" value="30"/>-->
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
</gateway>
</include>
差异被折叠。
...@@ -20,17 +20,28 @@ FSHost::FSHost(QObject *parent) : ...@@ -20,17 +20,28 @@ FSHost::FSHost(QObject *parent) :
void FSHost::run(void) void FSHost::run(void)
{ {
switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT; switch_core_flag_t flags = SCF_USE_SQL; //| SCF_USE_AUTO_NAT;
const char *err = NULL; const char *err = NULL;
switch_bool_t console = SWITCH_FALSE; switch_bool_t console = SWITCH_FALSE;
switch_status_t destroy_status; switch_status_t destroy_status;
QDir conf_dir = QDir(QCoreApplication::applicationDirPath());
if (conf_dir.cd("conf"))
{
SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(conf_dir.absolutePath().toAscii().constData()) + 1);
if (!SWITCH_GLOBAL_dirs.conf_dir) {
fprintf(stderr, "Allocation error\n");
emit coreLoadingError(err);
}
strcpy(SWITCH_GLOBAL_dirs.conf_dir, conf_dir.absolutePath().toAscii().constData());
}
/* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */ /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
printf("Initializing core...\n"); printf("Initializing core...\n");
/* Initialize the core and load modules, that will startup FS completely */ /* Initialize the core and load modules, that will startup FS completely */
if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) { if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err); fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
return; emit coreLoadingError(err);
} }
printf("Everything OK, Entering runtime loop.\n"); printf("Everything OK, Entering runtime loop.\n");
......
...@@ -43,6 +43,7 @@ protected: ...@@ -43,6 +43,7 @@ protected:
void run(void); void run(void);
signals: signals:
void coreLoadingError(QString);
void ready(void); void ready(void);
void ringing(QString); void ringing(QString);
void answered(QString); void answered(QString);
......
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QSplashScreen>
#include "mainwindow.h" #include "mainwindow.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; QCoreApplication::setOrganizationName("FreeSWITCH");
w.show(); QCoreApplication::setOrganizationDomain("freeswitch.org");
QCoreApplication::setApplicationName("FSPhone");
QPixmap image(":/images/splash.png");
QSplashScreen *splash = new QSplashScreen(image);
splash->show();
splash->showMessage("Loading, please wait...", Qt::AlignRight|Qt::AlignBottom, Qt::blue);
QObject::connect(&g_FSHost, SIGNAL(ready()), splash, SLOT(close()));
MainWindow w;
QObject::connect(&g_FSHost, SIGNAL(ready()), &w, SLOT(show()));
g_FSHost.start();
return a.exec(); return a.exec();
} }
#include <QInputDialog> #include <QInputDialog>
#include <QMessageBox>
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
...@@ -41,13 +42,12 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -41,13 +42,12 @@ MainWindow::MainWindow(QWidget *parent) :
connect(&g_FSHost, SIGNAL(hungup(QString)), this, SLOT(hungup(QString))); connect(&g_FSHost, SIGNAL(hungup(QString)), this, SLOT(hungup(QString)));
connect(&g_FSHost, SIGNAL(newOutgoingCall(QString)), this, SLOT(newOutgoingCall(QString))); connect(&g_FSHost, SIGNAL(newOutgoingCall(QString)), this, SLOT(newOutgoingCall(QString)));
connect(&g_FSHost, SIGNAL(gwStateChange(QString,int)), this, SLOT(gwStateChanged(QString,int))); connect(&g_FSHost, SIGNAL(gwStateChange(QString,int)), this, SLOT(gwStateChanged(QString,int)));
/*connect(&g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));*/
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()));
connect(ui->listCalls, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(callListDoubleClick(QListWidgetItem*))); connect(ui->listCalls, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(callListDoubleClick(QListWidgetItem*)));
g_FSHost.start();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
...@@ -58,6 +58,12 @@ MainWindow::~MainWindow() ...@@ -58,6 +58,12 @@ MainWindow::~MainWindow()
g_FSHost.wait(); g_FSHost.wait();
} }
void MainWindow::coreLoadingError(QString err)
{
QMessageBox::warning(this, "Error Loading Core...", err, QMessageBox::Ok);
QApplication::exit(255);
}
void MainWindow::gwStateChanged(QString gw, int state) void MainWindow::gwStateChanged(QString gw, int state)
{ {
ui->statusBar->showMessage(tr("Account %1 is %2").arg(gw, g_FSHost.getGwStateName(state))); ui->statusBar->showMessage(tr("Account %1 is %2").arg(gw, g_FSHost.getGwStateName(state)));
......
...@@ -57,6 +57,7 @@ signals: ...@@ -57,6 +57,7 @@ signals:
void dtmfDialed(QString); void dtmfDialed(QString);
private slots: private slots:
void coreLoadingError(QString);
void gwStateChanged(QString, int); void gwStateChanged(QString, int);
void dialDTMF(QString); void dialDTMF(QString);
void callListDoubleClick(QListWidgetItem *); void callListDoubleClick(QListWidgetItem *);
......
...@@ -33,11 +33,6 @@ ...@@ -33,11 +33,6 @@
#include "mod_qsettings/mod_qsettings.h" #include "mod_qsettings/mod_qsettings.h"
/*
SWITCH_MODULE_DEFINITION(mod_qsettings, mod_qsettings_load, mod_qsettings_shutdown, NULL);
*/
struct xml_binding { struct xml_binding {
char *bindings; char *bindings;
}; };
......
<RCC>
<qresource prefix="/images">
<file alias="splash.png">resources/splash.png</file>
</qresource>
</RCC>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论