Changeset 3271 in orxonox.OLD for orxonox/branches
- Timestamp:
- Dec 24, 2004, 6:29:38 PM (20 years ago)
- Location:
- orxonox/branches/updater
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/updater/Makefile.in
r3268 r3271 102 102 EGREP = @EGREP@ 103 103 EXEEXT = @EXEEXT@ 104 GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ 105 GTHREAD_LIBS = @GTHREAD_LIBS@ 104 106 GTK2_CFLAGS = @GTK2_CFLAGS@ 105 107 GTK2_LIBS = @GTK2_LIBS@ 106 108 HAVE_CURL_FALSE = @HAVE_CURL_FALSE@ 107 109 HAVE_CURL_TRUE = @HAVE_CURL_TRUE@ 110 HAVE_GTHREAD_FALSE = @HAVE_GTHREAD_FALSE@ 111 HAVE_GTHREAD_TRUE = @HAVE_GTHREAD_TRUE@ 108 112 HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@ 109 113 HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@ -
orxonox/branches/updater/configure
r3268 r3271 312 312 #endif" 313 313 314 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP DEBUG DOXYGEN DOXYGEN_TRUE DOXYGEN_FALSE MSBITFIELDS GTK2_LIBS GTK2_CFLAGS HAVE_GTK2_TRUE HAVE_GTK2_FALSE CURL_LIBS CURL_CFLAGS HAVE_CURL_TRUE HAVE_CURL_FALSE LIBOBJS LTLIBOBJS'314 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP DEBUG DOXYGEN DOXYGEN_TRUE DOXYGEN_FALSE MSBITFIELDS GTK2_LIBS GTK2_CFLAGS HAVE_GTK2_TRUE HAVE_GTK2_FALSE GTHREAD_LIBS GTHREAD_CFLAGS HAVE_GTHREAD_TRUE HAVE_GTHREAD_FALSE CURL_LIBS CURL_CFLAGS HAVE_CURL_TRUE HAVE_CURL_FALSE LIBOBJS LTLIBOBJS' 315 315 ac_subst_files='' 316 316 … … 872 872 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) 873 873 --without-gtk Prevents GTK from being loaded 874 --without-gthread Prevents gThread from being loaded 874 875 --without-curl Prevents libcURL from being loaded 875 876 --without-sdl-image Prevents SDL_image from being loaded … … 3887 3888 fi 3888 3889 3890 ## gThread-disabled 3891 echo "$as_me:$LINENO: checking if gThread should be enabled" >&5 3892 echo $ECHO_N "checking if gThread should be enabled... $ECHO_C" >&6 3893 3894 # Check whether --with-gthread or --without-gthread was given. 3895 if test "${with_gthread+set}" = set; then 3896 withval="$with_gthread" 3897 def_gthread=no 3898 else 3899 def_gthread=yes 3900 fi; 3901 if test "$def_gthread" = yes; then 3902 echo "yes" 3903 fi 3904 if test "$def_gthread" = no; then 3905 echo "no" 3906 fi 3907 3889 3908 ## libCurl disabled? 3890 3909 echo "$as_me:$LINENO: checking if libcURL should be enabled" >&5 … … 6672 6691 6673 6692 6693 ## checking for gThread 6694 if test "$def_gthread" = yes; then 6695 6696 echo "$as_me:$LINENO: checking for gthread" >&5 6697 echo $ECHO_N "checking for gthread... $ECHO_C" >&6 6698 if `pkg-config --exists gthread-2.0`; then 6699 echo "yes" 6700 have_gthread=yes 6701 GTHREAD_LIBS=`pkg-config --libs gthread-2.0` 6702 GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` 6703 6704 cat >>confdefs.h <<_ACEOF 6705 #define HAVE_GTHREAD 1 6706 _ACEOF 6707 6708 else 6709 echo "no" 6710 fi 6711 6712 fi 6713 6714 6715 6716 6717 if test x$have_gthread = xyes; then 6718 HAVE_GTHREAD_TRUE= 6719 HAVE_GTHREAD_FALSE='#' 6720 else 6721 HAVE_GTHREAD_TRUE='#' 6722 HAVE_GTHREAD_FALSE= 6723 fi 6724 6725 6674 6726 ## checking for libcURL 6675 6727 if test "$def_curl" = yes; then … … 7935 7987 Usually this means the macro was only invoked conditionally." >&5 7936 7988 echo "$as_me: error: conditional \"HAVE_GTK2\" was never defined. 7989 Usually this means the macro was only invoked conditionally." >&2;} 7990 { (exit 1); exit 1; }; } 7991 fi 7992 if test -z "${HAVE_GTHREAD_TRUE}" && test -z "${HAVE_GTHREAD_FALSE}"; then 7993 { { echo "$as_me:$LINENO: error: conditional \"HAVE_GTHREAD\" was never defined. 7994 Usually this means the macro was only invoked conditionally." >&5 7995 echo "$as_me: error: conditional \"HAVE_GTHREAD\" was never defined. 7937 7996 Usually this means the macro was only invoked conditionally." >&2;} 7938 7997 { (exit 1); exit 1; }; } … … 8546 8605 s,@HAVE_GTK2_TRUE@,$HAVE_GTK2_TRUE,;t t 8547 8606 s,@HAVE_GTK2_FALSE@,$HAVE_GTK2_FALSE,;t t 8607 s,@GTHREAD_LIBS@,$GTHREAD_LIBS,;t t 8608 s,@GTHREAD_CFLAGS@,$GTHREAD_CFLAGS,;t t 8609 s,@HAVE_GTHREAD_TRUE@,$HAVE_GTHREAD_TRUE,;t t 8610 s,@HAVE_GTHREAD_FALSE@,$HAVE_GTHREAD_FALSE,;t t 8548 8611 s,@CURL_LIBS@,$CURL_LIBS,;t t 8549 8612 s,@CURL_CFLAGS@,$CURL_CFLAGS,;t t -
orxonox/branches/updater/configure.ac
r3268 r3271 53 53 fi 54 54 if test "$def_gtk" = no; then 55 echo "no" 56 fi 57 58 ## gThread-disabled 59 AC_MSG_CHECKING([if gThread should be enabled]) 60 AC_ARG_WITH([gthread], 61 AC_HELP_STRING( [--without-gthread], 62 [Prevents gThread from being loaded]), [def_gthread=no], [def_gthread=yes]) 63 if test "$def_gthread" = yes; then 64 echo "yes" 65 fi 66 if test "$def_gthread" = no; then 55 67 echo "no" 56 68 fi … … 352 364 AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes) 353 365 366 ## checking for gThread 367 if test "$def_gthread" = yes; then 368 369 AC_MSG_CHECKING([for gthread]) 370 if `pkg-config --exists gthread-2.0`; then 371 echo "yes" 372 have_gthread=yes 373 GTHREAD_LIBS=`pkg-config --libs gthread-2.0` 374 GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` 375 AC_DEFINE_UNQUOTED(HAVE_GTHREAD, 1, [if we have gThread]) 376 else 377 echo "no" 378 fi 379 380 fi 381 AC_SUBST(GTHREAD_LIBS) 382 AC_SUBST(GTHREAD_CFLAGS) 383 AM_CONDITIONAL(HAVE_GTHREAD, test x$have_gthread = xyes) 384 354 385 ## checking for libcURL 355 386 if test "$def_curl" = yes; then -
orxonox/branches/updater/src/Makefile.in
r3268 r3271 127 127 EGREP = @EGREP@ 128 128 EXEEXT = @EXEEXT@ 129 GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ 130 GTHREAD_LIBS = @GTHREAD_LIBS@ 129 131 GTK2_CFLAGS = @GTK2_CFLAGS@ 130 132 GTK2_LIBS = @GTK2_LIBS@ 131 133 HAVE_CURL_FALSE = @HAVE_CURL_FALSE@ 132 134 HAVE_CURL_TRUE = @HAVE_CURL_TRUE@ 135 HAVE_GTHREAD_FALSE = @HAVE_GTHREAD_FALSE@ 136 HAVE_GTHREAD_TRUE = @HAVE_GTHREAD_TRUE@ 133 137 HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@ 134 138 HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@ -
orxonox/branches/updater/src/console/Makefile.in
r3268 r3271 104 104 EGREP = @EGREP@ 105 105 EXEEXT = @EXEEXT@ 106 GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ 107 GTHREAD_LIBS = @GTHREAD_LIBS@ 106 108 GTK2_CFLAGS = @GTK2_CFLAGS@ 107 109 GTK2_LIBS = @GTK2_LIBS@ 108 110 HAVE_CURL_FALSE = @HAVE_CURL_FALSE@ 109 111 HAVE_CURL_TRUE = @HAVE_CURL_TRUE@ 112 HAVE_GTHREAD_FALSE = @HAVE_GTHREAD_FALSE@ 113 HAVE_GTHREAD_TRUE = @HAVE_GTHREAD_TRUE@ 110 114 HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@ 111 115 HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@ -
orxonox/branches/updater/src/gui/Makefile.am
r3268 r3271 1 AM_CXXFLAGS=$(GTK2_CFLAGS) $( CURL_CFLAGS) $(MSBITFIELDS)2 #AM_LDFLAGS=$(GTK2_LIBS) 3 LIBS=$(GTK2_LIBS) $( CURL_LIBS)1 AM_CXXFLAGS=$(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 2 #AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) 3 LIBS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 4 4 5 5 bin_PROGRAMS=gui -
orxonox/branches/updater/src/gui/Makefile.in
r3268 r3271 113 113 EGREP = @EGREP@ 114 114 EXEEXT = @EXEEXT@ 115 GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ 116 GTHREAD_LIBS = @GTHREAD_LIBS@ 115 117 GTK2_CFLAGS = @GTK2_CFLAGS@ 116 118 GTK2_LIBS = @GTK2_LIBS@ 117 119 HAVE_CURL_FALSE = @HAVE_CURL_FALSE@ 118 120 HAVE_CURL_TRUE = @HAVE_CURL_TRUE@ 121 HAVE_GTHREAD_FALSE = @HAVE_GTHREAD_FALSE@ 122 HAVE_GTHREAD_TRUE = @HAVE_GTHREAD_TRUE@ 119 123 HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@ 120 124 HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@ … … 125 129 LDFLAGS = @LDFLAGS@ 126 130 LIBOBJS = @LIBOBJS@ 127 #AM_LDFLAGS=$(GTK2_LIBS) 128 LIBS = $(GTK2_LIBS) $( CURL_LIBS)131 #AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) 132 LIBS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 129 133 LTLIBOBJS = @LTLIBOBJS@ 130 134 MAKEINFO = @MAKEINFO@ … … 184 188 target_os = @target_os@ 185 189 target_vendor = @target_vendor@ 186 AM_CXXFLAGS = $(GTK2_CFLAGS) $( CURL_CFLAGS) $(MSBITFIELDS)190 AM_CXXFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 187 191 gui_SOURCES = orxonox_gui.cc \ 188 192 orxonox_gui_gtk.cc \ -
orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc
r3268 r3271 47 47 bool initGTK(int argc, char *argv[]) 48 48 { 49 #ifdef HAVE_GTHREAD 50 PRINTF(3)("Initializing the ThreadSystem of the GUI\n"); 51 g_thread_init(NULL); 52 gdk_threads_init(); 53 #endif /* HAVE_GTHREAD */ 49 54 gtk_init (&argc, &argv); 50 55 gtk_rc_parse( "rc" ); … … 56 61 bool mainloopGTK(void) 57 62 { 58 PRINTF(1)("test\n");63 gdk_threads_enter(); 59 64 gtk_main(); 65 gdk_threads_leave(); 60 66 } 61 67 #endif /* HAVE_GTK2 */ … … 1203 1209 this->progress = this->totalSize; 1204 1210 1205 1206 1211 #ifdef HAVE_GTK2 1207 1212 gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize); 1208 while (gtk_events_pending())1209 gtk_main_iteration_do(TRUE);1210 1213 #endif /* HAVE_GTK2 */ 1211 1214 PRINTF(3)("Progress: %f\n", progress*100.0/totalSize); -
orxonox/branches/updater/src/gui/orxonox_gui_update.cc
r3270 r3271 90 90 #ifdef HAVE_GTK2 91 91 updateDataWindowButton->connectSignal("button_press_event", updateDataWindow, Window::windowOpen); 92 updateDataWindow->connectSignal("destroy", updateDataWindow, cancelDownload);93 updateDataWindow->connectSignal("delete_event", updateDataWindow, cancelDownload);92 updateDataWindow->connectSignal("destroy", updateDataWindow, Window::windowClose); 93 updateDataWindow->connectSignal("delete_event", updateDataWindow, Window::windowClose); 94 94 #endif /* HAVE_GTK2 */ 95 95 … … 149 149 FileInfo* info = new FileInfo; 150 150 151 info->fileName = "0 3%20orxonox%203'.mp3";151 info->fileName = "02%20orxonox%203.mp3"; 152 152 info->webRoot = "http://www.orxonox.ethz.ch/files/"; 153 153 info->localRoot = "./"; 154 154 info->Bar = (ProgressBar*)bar; 155 155 PRINTF(3)("Preparing to download file %s.\n", info->fileName); 156 download(info); 156 download (info); 157 /* 158 if (downloadThreadID == NULL) 159 { 160 if ( (downloadThreadID =g_thread_create(&downloadThread, info, TRUE, NULL)) == 0 ) 161 PRINTF(1)("can't create the thread"); 162 } 163 else 164 PRINTF(1)("thread already in use\n"); 165 */ 157 166 } 158 167 … … 188 197 Bar->setTotalSize(totalSize); 189 198 return 0; 199 190 200 } 191 201 192 202 CURL* OrxonoxGuiUpdate::curlHandle = NULL; 203 GThread* OrxonoxGuiUpdate::downloadThreadID = NULL; 193 204 194 205 void* OrxonoxGuiUpdate::download (void* fileInfo) … … 209 220 if(curlHandle) 210 221 { 222 211 223 outfile = fopen(fileOnDisk, "w"); 212 224 213 225 curl_easy_setopt(curlHandle, CURLOPT_URL, fileOnNet); 214 226 curl_easy_setopt(curlHandle, CURLOPT_WRITEDATA, outfile); … … 218 230 curl_easy_setopt(curlHandle, CURLOPT_PROGRESSFUNCTION, curlProgressFunc); 219 231 curl_easy_setopt(curlHandle, CURLOPT_PROGRESSDATA, info->Bar); 232 233 if (!downloadThreadID) 234 { 235 //! \todo check if threads really were created. 236 downloadThreadID = g_thread_create(&downloadThread, info, TRUE, NULL); 237 238 g_thread_create(&downloadThreadFinished, outfile, TRUE, NULL); 239 } 240 else 241 PRINTF(1)("thread already in use\n"); 242 // res = curl_easy_perform(curlHandle); 220 243 221 res = curl_easy_perform(curlHandle); 222 223 fclose(outfile); 224 if (curlHandle) 225 curl_easy_cleanup(curlHandle); 244 // fclose(outfile); 226 245 } 246 // downloadThreadID = NULL; 227 247 return NULL; 248 } 249 void* OrxonoxGuiUpdate::downloadThread(void* fileInfo) 250 { 251 // gdk_threads_enter(); 252 curl_easy_perform(curlHandle); 253 if (curlHandle) 254 curl_easy_cleanup(curlHandle); 255 gdk_threads_leave(); 256 downloadThreadID = NULL; 257 // g_thread_exit (NULL); 258 } 259 260 void* OrxonoxGuiUpdate::downloadThreadFinished(void* outfile) 261 { 262 g_thread_join(downloadThreadID); 263 PRINTF(3)("Closing the downloaded file.\n"); 264 fclose((FILE*)outfile); 228 265 } 229 266 -
orxonox/branches/updater/src/gui/orxonox_gui_update.h
r3270 r3271 59 59 60 60 static CURL* curlHandle; 61 static void* download (void* fileInfo);62 61 #ifdef HAVE_GTK2 63 62 static gint cancelDownload(GtkWidget* w, GdkEventKey* event, void* bar); 64 63 #endif /* HAVE_GTK2 */ 64 static GThread* downloadThreadID; 65 static void* download (void* fileInfo); 66 static void* downloadThread (void* fileInfo); 67 static void* downloadThreadFinished(void* outfile); 68 69 65 70 #endif /* HAVE_CURL */ 66 71 -
orxonox/branches/updater/src/importer/Makefile.in
r3268 r3271 105 105 EGREP = @EGREP@ 106 106 EXEEXT = @EXEEXT@ 107 GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ 108 GTHREAD_LIBS = @GTHREAD_LIBS@ 107 109 GTK2_CFLAGS = @GTK2_CFLAGS@ 108 110 GTK2_LIBS = @GTK2_LIBS@ 109 111 HAVE_CURL_FALSE = @HAVE_CURL_FALSE@ 110 112 HAVE_CURL_TRUE = @HAVE_CURL_TRUE@ 113 HAVE_GTHREAD_FALSE = @HAVE_GTHREAD_FALSE@ 114 HAVE_GTHREAD_TRUE = @HAVE_GTHREAD_TRUE@ 111 115 HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@ 112 116 HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@
Note: See TracChangeset
for help on using the changeset viewer.