From 32acb4e4422afeb152944cbdbc22cfa0f49886a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Sun, 16 Aug 2015 15:07:17 +0000 Subject: [PATCH] Fixes #13 by introducing vibration where available --- ChangeLog | 4 + ax_check_qt.m4 | 30 +++-- ax_init_standard_project.m4 | 80 ++++++------ bootstrap.sh | 195 ++++++++++++++++++++++++++++- configure.ac | 2 + html/{index.html => index.html.in} | 2 +- html/safechat.js | 17 ++- mac-create-app-bundle.sh | 22 ++++ 8 files changed, 293 insertions(+), 59 deletions(-) rename html/{index.html => index.html.in} (96%) diff --git a/ChangeLog b/ChangeLog index 318f9a7..a1a92d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-07-16 10:54 marc + + * ChangeLog, doc/doxyfile.in: try without searchbox + 2015-07-15 21:33 marc * ChangeLog, html/checknewuser.php, html/documentation.dox, diff --git a/ax_check_qt.m4 b/ax_check_qt.m4 index fc245fb..91c0072 100644 --- a/ax_check_qt.m4 +++ b/ax_check_qt.m4 @@ -1,16 +1,16 @@ # SYNOPSIS # # Check if a module exists: -# AX_CXX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) +# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) # # Abort if a module does not exist: -# AX_CXX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) +# AX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) # # DESCRIPTIONS # # qt_prefix # -# Each call to AX_CXX_CHECK_QT should have a different prefix +# Each call to AX_CHECK_QT should have a different prefix # value (with a few exceptions discussed later on). This value, # usually provided in uppercase, is used as prefix to the # variables holding the compiler flags and libraries reported by @@ -42,13 +42,19 @@ AC_DEFUN([AX_CXX_QT_TOOL], [ HAVE_$1=1 AC_MSG_CHECKING([for $2]) AC_ARG_VAR([$1], [path to Qt tool $2]) - $1=${$1:-$(pkg-config --variable=$2_location Qt5Core)} - $1=${$1:-$(pkg-config --variable=host_bins Qt5Core)/$2} - $1=${$1:-$(pkg-config --variable=$2_location QtCore)} - $1=${$1:-$(pkg-config --variable=host_bins QtCore)/$2} + $1=${$1:-$(${PKG_CONFIG} --variable=$2_location Qt5Core)} + $1=${$1:-$(${PKG_CONFIG} --variable=host_bins Qt5Core)/$2-qt5} + $1=${$1:-$(${PKG_CONFIG} --variable=host_bins Qt5Core)/$2} + $1=${$1:-$(${PKG_CONFIG} --variable=$2_location QtCore)} + $1=${$1:-$(${PKG_CONFIG} --variable=host_bins QtCore)/$2} + $1=${$1:-$(${PKG_CONFIG} --variable=host_bins QtCore)/$2-qt4} if ! which "${$1%% *}" > /dev/null; then - if which "$2" > /dev/null; then + if which "$2-qt5" > /dev/null; then + $1=$2-qt5 + elif which "$2" > /dev/null; then $1=$2 + elif which "$2-qt4" > /dev/null; then + $1=$2-qt4 else HAVE_$1=0 $1="" @@ -100,7 +106,7 @@ AC_DEFUN([AX_CHECK_QT], [ PKG_CHECK_MODULES([$1]5, [${qt_modules//Qt/Qt5}], [ HAVE_$1=1 AC_DEFINE([HAVE_$1]) - QTDIR=$(pkg-config --variable=prefix Qt5Core) + QTDIR=$(${PKG_CONFIG} --variable=prefix Qt5Core) QT_PLUGIN_PATH=${QTDIR}/share/qt5/plugins CPPFLAGS+=" ${[$1]5_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}" @@ -122,7 +128,7 @@ AC_DEFUN([AX_CHECK_QT], [ PKG_CHECK_MODULES([$1], [${qt_modules}], [ HAVE_$1=1 AC_DEFINE([HAVE_$1]) - QTDIR=$(pkg-config --variable=prefix QtCore) + QTDIR=$(${PKG_CONFIG} --variable=prefix QtCore) QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins CPPFLAGS+=" ${$1_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}" @@ -179,13 +185,13 @@ qrc_%.cxx: %.qrc # SYNOPSIS # -# AX_CXX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) +# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) # # DESCRIPTIONS # # qt_prefix # -# Each call to AX_CXX_CHECK_QT should have a different prefix +# Each call to AX_CHECK_QT should have a different prefix # value (with a few exceptions discussed later on). This value, # usually provided in uppercase, is used as prefix to the # variables holding the compiler flags and libraries reported by diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index f987278..f8e0b9c 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -3,45 +3,44 @@ ## 1 2 3 4 5 6 7 8 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890 +# m4_esyscmd_s does not exist on centos 5 and 6 +m4_define([mrw_esyscmd_s], [m4_normalize(m4_esyscmd([$1]))]) + # define least version number from subversion's revision number: # it is taken modulo 256 due to a bug on Apple's MacOSX -m4_define(x_least, m4_esyscmd_s( +m4_define(x_least, mrw_esyscmd_s([ SVN_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout" for path in . .. ../..; do if svn info $path 2>&1 > /dev/null; then SVN_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p') - (cd $path && svn2cl) break; fi done # Mac does not support LEAST > 255 echo $ECHO_N $(($SVN_REVISION%256)) -)) +])) # define version number from subversion's revision number: # it is taken modulo 256 due to a bug on Apple's MacOSX # add to x_minor if revision number is > 256 -m4_define(x_minor_fixed, m4_esyscmd_s( +m4_define(x_minor_diff, mrw_esyscmd_s([ SVN_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout" for path in . .. ../..; do if svn info $path 2>&1 > /dev/null; then SVN_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p') - (cd $path && svn2cl) break; - fi + fi; done # Mac does not support LEAST > 255 - echo $ECHO_N $((x_minor+$SVN_REVISION/256)) -)) + echo $ECHO_N $(($SVN_REVISION/256)) +])) # setup version number -m4_define(x_version, m4_esyscmd_s( - echo $ECHO_N x_major.x_minor_fixed.x_least -)) +m4_define(x_version, [x_major.m4_eval(x_minor+x_minor_diff).x_least]) ## bugreport mail address is taken from in first line of AUTHORS -m4_define(x_bugreport, m4_esyscmd_s( +m4_define(x_bugreport, mrw_esyscmd_s([ head -1 AUTHORS | \ sed -n 's,.*<\([-_.a-z0-9A-Z]*@[-_.a-z0-9A-Z]*\)>.*,\1,gp' -)) +])) m4_include(ax_check_qt.m4) @@ -84,7 +83,7 @@ AC_DEFUN([AX_ADD_MAKEFILE_TARGET_DEP], [ # $1 = variable name AC_DEFUN([AX_SUBST], [ AC_SUBST([$1]) - tmp_var=$(echo "${$1}" | awk 1 ORS='\\n') + tmp_var=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,') tmp_var=${tmp_var//\"/\\\"} tmp_var=${tmp_var//\'/\'\"\'\"\'} tmp_var=${tmp_var//#/\\#} @@ -108,7 +107,15 @@ AC_DEFUN([AX_SUBST], [ # # configures the basic environment AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ - AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_NAME//-/_}'" + MINGW=no + MAC=no + case $host in + *mingw*) MINGW=yes;; + *darwin* | *rhapsody* | *macosx*) MAC=yes;; + esac + AM_CONDITIONAL(MINGW, test "$MINGW" = "yes") + AM_CONDITIONAL(MAC, test "$MAC" = "yes") + AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_TARNAME//[^a-zA-Z0-9]/_}'" AX_SUBST(NUMBERS) AX_SUBST(HOME) README=$(tail -n +3 README) @@ -156,7 +163,6 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ test -f makefile.in && cat >> makefile.in <> makefile.in <
diff --git a/html/safechat.js b/html/safechat.js index 3b3349f..6492d36 100644 --- a/html/safechat.js +++ b/html/safechat.js @@ -119,6 +119,19 @@ function status(text, msg) { }); } +/// Alert user +/** Alert user, e.g. that a new message has arrived. + @param */ +function alert() { + navigator.vibrate = + navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; + if (navigator.vibrate) { + // vibration API supported + navigator.vibrate(1000); + } + (new Audio("A-Tone-His_Self-1266414414.mp3")).play(); +} + /// Check if user name is available /** Calls checknewuser.php on server and displays an error, if the user name is already in use. This function is used when creating a @@ -372,9 +385,7 @@ function get() { // calculate and show emoticons $('#id'+e.id).emoticonize(); // beep for the first new message - if (!beeped) - (new Audio("A-Tone-His_Self-1266414414.mp3")) - .play(); + if (!beeped) alert() beeped = true; success(); }) diff --git a/mac-create-app-bundle.sh b/mac-create-app-bundle.sh index 7a788ec..6ced200 100755 --- a/mac-create-app-bundle.sh +++ b/mac-create-app-bundle.sh @@ -25,6 +25,7 @@ target="$(pwd)/${1}/Contents/MacOS" mkdir -p ${1}/Contents/{Resources,MacOS} ! test -d ${3}/bin || \ find ${3}/bin -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; +executablefile=$(ls -1 ${1}/Contents/MacOS/ | head -1) ! test -d ${3}/lib || \ find ${3}/lib -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; ! test -d ${3}/share/${2} || \ @@ -49,6 +50,7 @@ done # Step 3: resolve all library dependencies found=1 +oldpath="$(pwd)" while [ $found -ne 0 ]; do found=0 cd "${target}" @@ -69,6 +71,7 @@ while [ $found -ne 0 ]; do done done done +cd ${oldpath} # Step 4: if necessary, install qt_menu.nib if test -n "${QTDIR}"; then @@ -79,3 +82,22 @@ if test -n "${QTDIR}"; then test -d ${1}/Contents/Resources/qt_menu.nib fi fi + +# Step 5: copy or create info.plist +infoplist=$(find ${1}/Contents/Resources -name Info.plist) +if test -f "${infoplist}"; then + mv "${infoplist}" ${1}/Contents/Info.plist +else + cat > ${1}/Contents/Info.plist < + + + + CFBundleIdentifier + ${2} + CFBundleExecutable + ${executablefile##/} + + +EOF +fi \ No newline at end of file