diff --git a/Makefile.am b/Makefile.am index ae923b4923d285d9ebb21607cf23f81ff40dd634..3e5d0f7296035b5629ce4055fb593b06088944ff 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 a902031be5200f61393edd886f8c63dfc896cd29..5518a3f6f9f22ff4289c11d3a2067cd9bccf62e2 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 93d944d9fe0ac558e9ed46646438f2e66ec89c60..e0645e1d77fafd8ec0514ba7b09703e9dc49af6b 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 27400415053f9856dd4b1f30eeeaf53155392ea3..7181325ba4c644064dad2e4dedc14caa20ebe07c 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 6db2eb3dc0efb3b73f3073ea0a642a81b4256d60..cf317dd3aba3d4ad54e1891454273086c3d4194d 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 89327ab80dc24b3e062f12734c471ee3ada6f982..68deee6bdc5277ba4a65e47aab712c72eaaf10b9 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>