Add more information to splash screen and warn users when very important modules are not loaded.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17135 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1382239370
commit
bc0b04d255
|
@ -45,6 +45,13 @@ FSHost::FSHost(QObject *parent) :
|
|||
qRegisterMetaType<QSharedPointer<Call> >("QSharedPointer<Call>");
|
||||
qRegisterMetaType<QSharedPointer<Account> >("QSharedPointer<Account>");
|
||||
|
||||
connect(this, SIGNAL(loadedModule(QString,QString,QString)), this, SLOT(minimalModuleLoaded(QString,QString,QString)));
|
||||
|
||||
}
|
||||
|
||||
QBool FSHost::isModuleLoaded(QString modName)
|
||||
{
|
||||
return _loadedModules.contains(modName);
|
||||
}
|
||||
|
||||
void FSHost::createFolders()
|
||||
|
@ -117,14 +124,14 @@ void FSHost::run(void)
|
|||
createFolders();
|
||||
|
||||
/* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
|
||||
qDebug() << "Initializing core..." << endl;
|
||||
qDebug() << "Initializing core...";
|
||||
/* Initialize the core and load modules, that will startup FS completely */
|
||||
if (switch_core_init(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
|
||||
emit coreLoadingError(err);
|
||||
}
|
||||
|
||||
qDebug() << "Everything OK, Entering runtime loop ..." << endl;
|
||||
qDebug() << "Everything OK, Entering runtime loop ...";
|
||||
|
||||
if (switch_event_bind("FSHost", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, eventHandlerCallback, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
|
@ -136,12 +143,14 @@ void FSHost::run(void)
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load mod_qsettings\n");
|
||||
}
|
||||
|
||||
emit loadingModules("Loading modules...", Qt::AlignRight|Qt::AlignBottom, Qt::blue);
|
||||
if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
|
||||
emit coreLoadingError(err);
|
||||
}
|
||||
|
||||
emit ready();
|
||||
|
||||
/* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set
|
||||
* If its false, it initializes the libedit for the console, then does the same thing
|
||||
*/
|
||||
|
@ -154,7 +163,7 @@ void FSHost::run(void)
|
|||
destroy_status = switch_core_destroy();
|
||||
if (destroy_status == SWITCH_STATUS_SUCCESS)
|
||||
{
|
||||
qDebug() << "We have properly shutdown the core." << endl;
|
||||
qDebug() << "We have properly shutdown the core.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,11 +416,27 @@ void FSHost::generalEventHandler(switch_event_t *event)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SWITCH_EVENT_MODULE_LOAD:
|
||||
{
|
||||
QString modType = switch_event_get_header_nil(event, "type");
|
||||
QString modName = switch_event_get_header_nil(event, "name");
|
||||
QString modKey = switch_event_get_header_nil(event, "key");
|
||||
emit loadedModule(modType, modName, modKey);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FSHost::minimalModuleLoaded(QString modType, QString modName, QString modKey)
|
||||
{
|
||||
if (modType == "endpoint")
|
||||
{
|
||||
_loadedModules.append(modKey);
|
||||
}
|
||||
}
|
||||
|
||||
void FSHost::accountReloadCmd(QSharedPointer<Account> acc)
|
||||
{
|
||||
QString res;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define FSHOST_H
|
||||
|
||||
#include <QThread>
|
||||
#include <QColor>
|
||||
#include <QHash>
|
||||
#include <QSharedPointer>
|
||||
#include <switch.h>
|
||||
|
@ -50,12 +51,15 @@ public:
|
|||
QSharedPointer<Account> getCurrentDefaultAccount();
|
||||
QSharedPointer<Account> getAccountByName(QString accStr);
|
||||
void accountReloadCmd(QSharedPointer<Account> acc);
|
||||
QBool isModuleLoaded(QString);
|
||||
|
||||
protected:
|
||||
void run(void);
|
||||
|
||||
signals:
|
||||
void coreLoadingError(QString);
|
||||
void loadingModules(QString, int, QColor);
|
||||
void loadedModule(QString, QString, QString);
|
||||
void ready(void);
|
||||
void ringing(QSharedPointer<Call>);
|
||||
void answered(QSharedPointer<Call>);
|
||||
|
@ -69,6 +73,7 @@ signals:
|
|||
private slots:
|
||||
/* We need to wait for the gateway deletion before reloading it */
|
||||
void accountReloadSlot(QSharedPointer<Account>);
|
||||
void minimalModuleLoaded(QString, QString, QString);
|
||||
|
||||
private:
|
||||
switch_status_t processBlegEvent(switch_event_t *, QString);
|
||||
|
@ -79,6 +84,7 @@ private:
|
|||
QHash<QString, QSharedPointer<Account> > _accounts;
|
||||
QHash<QString, QString> _bleg_uuids;
|
||||
QList<QString> _reloading_Accounts;
|
||||
QList<QString> _loadedModules;
|
||||
};
|
||||
|
||||
extern FSHost g_FSHost;
|
||||
|
|
|
@ -41,7 +41,9 @@ int main(int argc, char *argv[])
|
|||
QPixmap image(":/images/splash.png");
|
||||
QSplashScreen *splash = new QSplashScreen(image);
|
||||
splash->show();
|
||||
splash->showMessage("Loading, please wait...", Qt::AlignRight|Qt::AlignBottom, Qt::blue);
|
||||
splash->showMessage("Loading core, please wait...", Qt::AlignRight|Qt::AlignBottom, Qt::blue);
|
||||
|
||||
QObject::connect(&g_FSHost, SIGNAL(loadingModules(QString,int,QColor)), splash, SLOT(showMessage(QString,int,QColor)));
|
||||
|
||||
QObject::connect(&g_FSHost, SIGNAL(ready()), splash, SLOT(close()));
|
||||
MainWindow w;
|
||||
|
|
|
@ -90,7 +90,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
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(&g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));
|
||||
|
||||
/* Connect call commands */
|
||||
connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
|
||||
|
@ -163,8 +163,9 @@ void MainWindow::prefTriggered()
|
|||
|
||||
void MainWindow::coreLoadingError(QString err)
|
||||
{
|
||||
QMessageBox::warning(this, "Error Loading Core...", err, QMessageBox::Ok);
|
||||
QApplication::exit(255);
|
||||
QMessageBox::critical(this, tr("Core error!"),
|
||||
tr("The core failed to load. Please, ask for help as the softphone will not be useable. Error code: %1").arg(err),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
void MainWindow::accountAdd(QSharedPointer<Account> acc)
|
||||
|
@ -283,6 +284,19 @@ void MainWindow::fshostReady()
|
|||
ui->textEdit->setText("Ready to dial and receive calls!");
|
||||
sysTray->show();
|
||||
sysTray->showMessage(tr("Status"), tr("FSComm has initialized!"), QSystemTrayIcon::Information, 5000);
|
||||
|
||||
if (!g_FSHost.isModuleLoaded("mod_sofia"))
|
||||
{
|
||||
QMessageBox::warning(this, tr("SIP not available"),
|
||||
tr("Sofia could not be loaded, therefore, SIP will not be available."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
if (!g_FSHost.isModuleLoaded("mod_portaudio"))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Audio not available"),
|
||||
tr("Portaudio could not be loaded. Please check if mod_portaudio is properly compiled."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::paAnswer()
|
||||
|
|
Loading…
Reference in New Issue