From 96bbda4e2b640a65976ae4ff647d4aafa0ca962f Mon Sep 17 00:00:00 2001 From: yanmorin <yanmorin> Date: Wed, 14 Sep 2005 15:25:06 +0000 Subject: [PATCH] Patch to integrate a text server --enable-maintener to play with it --- Makefile.am | 1 - configure.ac | 3 ++- src/main.cpp | 31 +++++++++++++++++++++++++------ src/managerimpl.cpp | 9 ++++++--- src/sipvoiplink.cpp | 2 +- src/user_cfg.h | 1 - 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index ae923b4923..3e5d0f7296 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1 @@ SUBDIRS = utilspp stund src skins rings pixmaps - diff --git a/configure.ac b/configure.ac index a902031be5..5518a3f6f9 100644 --- a/configure.ac +++ b/configure.ac @@ -179,7 +179,8 @@ src/audio/pacpp/source/Makefile \ src/audio/pacpp/source/portaudiocpp/Makefile \ src/gui/Makefile \ src/gui/qt/Makefile \ -src/zeroconf/Makefile +src/gui/server/Makefile \ +src/zeroconf/Makefile \ utilspp/Makefile \ utilspp/functor/Makefile \ utilspp/singleton/Makefile \ diff --git a/src/main.cpp b/src/main.cpp index 93d944d9fe..e0645e1d77 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,13 +17,13 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define GUI_QT // remove when others UI are implemented +#include "user_cfg.h" -#if defined(GUI_QT) +#if defined(ENABLE_MAINTENER) +# include "gui/server/guiserver.h" +#elif defined(GUI_QT) # include <qapplication.h> # include "gui/qt/qtGUImainwindow.h" -#elif defined(GUI_TEXT1) -# error "GUI_TEXT1 not implemented yet." #elif defined(GUI_COCOA) # error "GUI_COCOA not implemented yet." #endif @@ -40,7 +40,25 @@ main (int argc, char **argv) { Config::setTree(new ConfigurationTree()); GuiFramework *GUI; -#if defined(GUI_QT) +#if defined(ENABLE_MAINTENER) + { + Manager::instance().initConfigFile(); + try { + Manager::instance().init(); + } + catch (...) { + std::cerr << + "An unknown exception occured when initializing the system." << + std::endl; + } + + GUI = new GUIServer(); + Manager::instance().setGui(GUI); + exit_code = ((GUIServer*)GUI)->exec(); + Manager::instance().terminate(); + delete GUI; + } +#elif defined(GUI_QT) { QApplication a(argc, argv); Manager::instance().initConfigFile(); @@ -66,8 +84,9 @@ main (int argc, char **argv) { a.setMainWidget((QtGUIMainWindow*)GUI); exit_code = a.exec(); Manager::instance().terminate(); -#endif } + +#endif return exit_code; } diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 2740041505..7181325ba4 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -46,7 +46,6 @@ #include "configuration.h" #include "configurationtree.h" #include "error.h" -#include "sipvoiplink.h" #include "user_cfg.h" #include "voIPLink.h" #include "gui/guiframework.h" @@ -118,7 +117,7 @@ ManagerImpl::init (void) // Set a sip voip link by default _voIPLinkVector.push_back(new SipVoIPLink(DFT_VOIP_LINK)); - + if (_exist == 0) { _debug("Cannot create config file in your home directory\n"); } @@ -145,11 +144,14 @@ ManagerImpl::init (void) { displayError("An unknown exception occured."); } - + _voIPLinkVector.at(DFT_VOIP_LINK)->init(); + + if (_voIPLinkVector.at(DFT_VOIP_LINK)->checkNetwork()) { // If network is available + if (get_config_fields_int(SIGNALISATION, AUTO_REGISTER) == YES and _exist == 1) { if (registerVoIPLink() != 1) { @@ -157,6 +159,7 @@ ManagerImpl::init (void) } } } + } void ManagerImpl::terminate() diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 6db2eb3dc0..cf317dd3ab 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -1301,7 +1301,7 @@ SipVoIPLink::startCall (short id, const string& from, const string& to, // Keep the cid in case of cancelling setCid(i); - + return i; } diff --git a/src/user_cfg.h b/src/user_cfg.h index 89327ab80d..68deee6bdc 100644 --- a/src/user_cfg.h +++ b/src/user_cfg.h @@ -20,7 +20,6 @@ #ifndef __USER_CFG_H__ #define __USER_CFG_H__ -//#define GUI_TEXT1 #define GUI_QT #include <stdlib.h> -- GitLab