From c9bfc4db72b84292f541c795993abde98e22121f Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 6 Mar 2006 10:44:07 +0000 Subject: *** empty log message *** --- acinclude.m4 | 2 +- acinclude.m4.mine | 475 ----------------------------------------------- client/aboutwindow.cc | 12 +- client/aboutwindow.h | 10 +- client/camera.h | 2 +- client/cprquerydialog.cc | 86 +++++---- client/cprquerydialog.h | 45 ++--- client/encoder.h | 2 +- client/historywidget.cc | 8 +- client/historywidget.h | 4 +- client/info_gui.h | 13 +- client/mainwindow.cc | 174 ++++++++++------- client/mainwindow.h | 16 +- client/messagebox.cc | 18 +- client/messagebox.h | 14 +- client/miav_client.cc | 4 +- client/miav_client.h | 2 +- client/player.h | 2 +- client/videowidget.cc | 6 +- client/videowidget.h | 4 +- client/yuv_draw.cc | 8 +- client/yuv_draw.h | 6 +- etc/miav.conf | 3 + server/miav_server.h | 5 - 24 files changed, 240 insertions(+), 681 deletions(-) delete mode 100644 acinclude.m4.mine diff --git a/acinclude.m4 b/acinclude.m4 index b48ee93..17469fc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -151,7 +151,7 @@ case "${host}" in *linux*) QT_LIBS="$QT_LIB" if test $QT_IS_STATIC = yes && test $QT_IS_EMBEDDED = no; then - QT_LIBS="$QT_LIBS -L$x_libraries -lQtCore -lQtGui -lXext -lX11 -lm -lSM -lICE -ldl -ljpeg" + QT_LIBS="$QT_LIBS -L$x_libraries -lQtCore -lQtNetwork -lQtGui -lXext -lX11 -lm -lSM -lICE -ldl -ljpeg" fi ;; diff --git a/acinclude.m4.mine b/acinclude.m4.mine deleted file mode 100644 index 0fc8b65..0000000 --- a/acinclude.m4.mine +++ /dev/null @@ -1,475 +0,0 @@ -########################################################################################################## -dnl Usage: -dnl AM_PATH_FFMPEG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl Test for ffmpeg, and define FFMPEG_CFLAGS and FFMPEG_LIBS - -AC_DEFUN([AM_PATH_FFMPEG], -[ - AC_REQUIRE([AC_FUNC_LRINTF]) - - dnl !!! - it really sucks - Makefile.am can't be optimized even by - dnl !!! preparing some extra variable forward - dnl !!! FFAVFORMAT_SRC= - - AC_REQUIRE([AC_CHECK_OSS]) - test x$enable_oss = xyes && AC_DEFINE(CONFIG_AUDIO_OSS, 1, [Define if you want to have ffmpeg OSS audio support compiled.]) - - AC_REQUIRE([AC_CHECK_V4L]) - test x$enable_v4l = xyes && AC_DEFINE(CONFIG_VIDEO4LINUX, 1, [Define if you have video4linux device. (ffmpeg)]) - - AC_REQUIRE([AC_FIND_ZLIB]) - test x$have_zlib = xyes && AC_DEFINE(CONFIG_ZLIB, 1, [Define if you have z library (-lz) (ffmpeg)]) - - AC_ARG_ENABLE(ffmpeg_faadbin, [ --enable-ffmpeg-faadbin build ffmpeg with FAAD binary support. (default=yes)], - [], enable_ffmpeg_faadbin=yes) - test x$enable_ffmpeg_faadbin = xyes && AC_DEFINE(CONFIG_FAADBIN, 1, [Define if you want to build support for runtime linked libfaad.]) - AC_REQUIRE([AM_PATH_FAAD]) - test x$have_faad = xyes && AC_DEFINE(CONFIG_FAAD, 1, [Define if you want to have AAC support compiled. (ffmpeg)]) - - AC_ARG_ENABLE(ffmpeg_risky, [ --enable-ffmpeg-risky build ffmpeg risky code. (default=yes)], - [], enable_ffmpeg_risky=yes) - - AC_ARG_ENABLE(ffmpeg_a52, [ --enable-ffmpeg-a52 build ffmpeg with A52 (AC3) support. (default=yes)], - [], enable_ffmpeg_a52=yes) - if test x$enable_ffmpeg_a52 = xyes ; then - AC_DEFINE(HAVE_FFMPEG_A52, 1, [Define if you want to use ffmpeg A52 audio decoder.]) - AC_ARG_ENABLE(ffmpeg_a52bin, [ --enable-ffmpeg-a52bin A52 plugin dlopens liba52.so.0 at runtime (default=no)], - [], enable_ffmpeg_a52bin=no) - - if test x$enable_ffmpeg_a52bin = xyes ; then - AC_DEFINE(CONFIG_A52BIN, 1, [Define if you want to build ffmpeg with A52 dlopened decoder.]) - fi - fi - - test x$enable_ffmpeg_risky = xyes && AC_DEFINE(CONFIG_RISKY, 1, [Define if you want to compile patent encumbered codecs. (ffmpeg)]) - - AC_DEFINE(CONFIG_ENCODERS, 1, [Define if you want to build ffmpeg encoders.]) - AC_DEFINE(CONFIG_DECODERS, 1, [Define if you want to build ffmpeg decoders.]) - AC_DEFINE(CONFIG_AC3, 1, [Define if you want to build ffmpeg with AC3 decoder.]) - AC_DEFINE(SIMPLE_IDCT, 1, [Define if you want to build ffmpeg with simples idct.]) - AC_DEFINE(CONFIG_NETWORK, 1, [Define if you want to build ffmpeg with network support.]) - AC_DEFINE(CONFIG_MPEGAUDIO_HP, 1, [Define if you want to have highquality ffmpeg mpeg audio support compiled.]) - AC_DEFINE(HAVE_PTHREADS, 1, [Define if you want to have ffmpeg pthread support compiled.]) - - if test -n "$ffmpeg_profiling" ; then - AC_DEFINE(HAVE_GPROF, 1, [Define if you want to build ffmpeg with gprof support.]) - fi - - test -z "$FFMPEG_CFLAGS" && FFMPEG_CFLAGS="-O4 $DEFAULT_FLAGS" - FFMPEG_CFLAGS="$FFMPEG_CFLAGS $DEFAULT_DEFINES" - - AC_CHECK_GNU_VECTOR(FFMPEG_SSE="-msse"; - AC_DEFINE(HAVE_BUILTIN_VECTOR, 1, [Define if your compiler supports vector builtins (MMX).]), []) - AC_SUBST(FFMPEG_CFLAGS) - AC_SUBST(FFMPEG_SSE) - - AM_CONDITIONAL(AMM_BUILD_STRPTIME, test x$ac_cv_func_strptime != xyes ) - -dnl ffmpeg_x86opt= -dnl test x$enable_x86opt = xno && ffmpeg_x86opt="--disable-mmx" -dnl AC_MSG_RESULT([=== configuring ffmpeg ===]) -dnl ( cd $srcdir/ffmpeg ; \ -dnl ./configure --prefix=$prefix --cc=$CC \ -dnl $ffmpeg_profiling $ffmpeg_cpu \ -dnl $ffmpeg_x86opt --disable-mp3lib \ -dnl --enable-simple_idct ) -]) - - -########################################################################################################## -# Configure paths for SDL -# Sam Lantinga 9/21/99 -# stolen from Manish Singh -# stolen back from Frank Belew -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS -dnl -AC_DEFUN([AM_PATH_SDL], -[dnl -dnl Get the cflags and libraries from the sdl-config script -dnl -AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], - sdl_prefix="$withval", sdl_prefix="") -AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], - sdl_exec_prefix="$withval", sdl_exec_prefix="") -AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], - , enable_sdltest=yes) - - if test x$sdl_exec_prefix != x ; then - sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_args="$sdl_args --prefix=$sdl_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_prefix/bin/sdl-config - fi - fi - - AC_REQUIRE([AC_CANONICAL_TARGET]) - PATH="$prefix/bin:$prefix/usr/bin:$PATH" - AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) - min_sdl_version=ifelse([$1], ,0.11.0,$1) - AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) - no_sdl="" - if test "$SDL_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` - SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` - - sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" -dnl -dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl-config to some extent -dnl - rm -f conf.sdltest - AC_TRY_RUN([ -#include -#include -#include -#include "SDL.h" - -char* -my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else - new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - char *tmp_version; - - /* This hangs on some systems (?) - system ("touch conf.sdltest"); - */ - { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_sdl_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); - printf("*** to point to the correct copy of sdl-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - -],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$SDL_CONFIG" = "no" ; then - echo "*** The sdl-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL_CONFIG environment variable to the" - echo "*** full path to sdl-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - AC_TRY_LINK([ -#include -#include "SDL.h" - -int main(int argc, char *argv[]) -{ return 0; } -#undef main -#define main K_and_R_C_main -], [ return 0; ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - rm -f conf.sdltest -]) - - -###############################################################################################################333 -# Check for Qt compiler flags, linker flags, and binary packages -AC_DEFUN([gw_CHECK_QT], -[ -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PATH_X]) - -AC_MSG_CHECKING([QTDIR]) -AC_ARG_WITH([qtdir], [ --with-qtdir=DIR Qt installation directory [default=$QTDIR]], QTDIR=$withval) -# Check that QTDIR is defined or that --with-qtdir given -if test x"$QTDIR" = x ; then - QT_SEARCH="/usr/lib/qt31 /usr/local/qt31 /usr/lib/qt3 /usr/local/qt3 /usr/lib/qt2 /usr/local/qt2 /usr/lib/qt /usr/local/qt" - for i in $QT_SEARCH; do - if test -f $i/include/qglobal.h -a x$QTDIR = x; then QTDIR=$i; fi - done -fi -if test x"$QTDIR" = x ; then - AC_MSG_ERROR([*** QTDIR must be defined, or --with-qtdir option given]) -fi -AC_MSG_RESULT([$QTDIR]) - -# Change backslashes in QTDIR to forward slashes to prevent escaping -# problems later on in the build process, mainly for Cygwin build -# environment using MSVC as the compiler -# TODO: Use sed instead of perl -QTDIR=`echo $QTDIR | perl -p -e 's/\\\\/\\//g'` - -# Figure out which version of Qt we are using -AC_MSG_CHECKING([Qt version]) -QT_VER=`grep 'define.*QT_VERSION_STR\W' $QTDIR/include/qglobal.h | perl -p -e 's/\D//g'` -case "${QT_VER}" in - 2*) - QT_MAJOR="2" - ;; - 3*) - QT_MAJOR="3" - ;; - *) - AC_MSG_ERROR([*** Don't know how to handle this Qt major version]) - ;; -esac -AC_MSG_RESULT([$QT_VER ($QT_MAJOR)]) - -# Check that moc is in path -AC_CHECK_PROG(MOC, moc, moc) -if test x$MOC = x ; then - AC_MSG_ERROR([*** moc must be in path]) -fi - -# uic is the Qt user interface compiler -AC_CHECK_PROG(UIC, uic, uic) -if test x$UIC = x ; then - AC_MSG_ERROR([*** uic must be in path]) -fi - -# qembed is the Qt data embedding utility. -# It is located in $QTDIR/tools/qembed, and must be compiled and installed -# manually, we'll let it slide if it isn't present -AC_CHECK_PROG(QEMBED, qembed, qembed) - - -# Calculate Qt include path -QT_CXXFLAGS="-I$QTDIR/include" - -QT_IS_EMBEDDED="no" -# On unix, figure out if we're doing a static or dynamic link -case "${host}" in - *-cygwin) - AC_DEFINE_UNQUOTED(WIN32, "", Defined if on Win32 platform) - if test -f "$QTDIR/lib/qt.lib" ; then - QT_LIB="qt.lib" - QT_IS_STATIC="yes" - QT_IS_MT="no" - elif test -f "$QTDIR/lib/qt-mt.lib" ; then - QT_LIB="qt-mt.lib" - QT_IS_STATIC="yes" - QT_IS_MT="yes" - elif test -f "$QTDIR/lib/qt$QT_VER.lib" ; then - QT_LIB="qt$QT_VER.lib" - QT_IS_STATIC="no" - QT_IS_MT="no" - elif test -f "$QTDIR/lib/qt-mt$QT_VER.lib" ; then - QT_LIB="qt-mt$QT_VER.lib" - QT_IS_STATIC="no" - QT_IS_MT="yes" - fi - ;; - - *) - QT_IS_STATIC=`ls $QTDIR/lib/*.a 2> /dev/null` - if test "x$QT_IS_STATIC" = x; then - QT_IS_STATIC="no" - else - QT_IS_STATIC="yes" - fi - if test x$QT_IS_STATIC = xno ; then - QT_IS_DYNAMIC=`ls $QTDIR/lib/*.so 2> /dev/null` - if test "x$QT_IS_DYNAMIC" = x; then - AC_MSG_ERROR([*** Couldn't find any Qt libraries]) - fi - fi - - if test "x`ls $QTDIR/lib/libqt.* 2> /dev/null`" != x ; then - QT_LIB="-lqt" - QT_IS_MT="no" - elif test "x`ls $QTDIR/lib/libqt-mt.* 2> /dev/null`" != x ; then - QT_LIB="-lqt-mt" - QT_IS_MT="yes" - elif test "x`ls $QTDIR/lib/libqte.* 2> /dev/null`" != x ; then - QT_LIB="-lqte" - QT_IS_MT="no" - QT_IS_EMBEDDED="yes" - elif test "x`ls $QTDIR/lib/libqte-mt.* 2> /dev/null`" != x ; then - QT_LIB="-lqte-mt" - QT_IS_MT="yes" - QT_IS_EMBEDDED="yes" - fi - ;; -esac -AC_MSG_CHECKING([if Qt is static]) -AC_MSG_RESULT([$QT_IS_STATIC]) -AC_MSG_CHECKING([if Qt is multithreaded]) -AC_MSG_RESULT([$QT_IS_MT]) -AC_MSG_CHECKING([if Qt is embedded]) -AC_MSG_RESULT([$QT_IS_EMBEDDED]) - -QT_GUILINK="" -QASSISTANTCLIENT_LDADD="-lqassistantclient" -case "${host}" in - *irix*) - QT_LIBS="$QT_LIB" - if test $QT_IS_STATIC = yes ; then - QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE" - fi - ;; - - *linux*) - QT_LIBS="$QT_LIB" - if test $QT_IS_STATIC = yes && test $QT_IS_EMBEDDED = no; then - QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE -ldl -ljpeg" - fi - ;; - - - *osf*) - # Digital Unix (aka DGUX aka Tru64) - QT_LIBS="$QT_LIB" - if test $QT_IS_STATIC = yes ; then - QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE" - fi - ;; - - *solaris*) - QT_LIBS="$QT_LIB" - if test $QT_IS_STATIC = yes ; then - QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE -lresolv -lsocket -lnsl" - fi - ;; - - - *win*) - # linker flag to suppress console when linking a GUI app on Win32 - QT_GUILINK="/subsystem:windows" - - if test $QT_MAJOR = "3" ; then - if test $QT_IS_MT = yes ; then - QT_LIBS="/nodefaultlib:libcmt" - else - QT_LIBS="/nodefaultlib:libc" - fi - fi - - if test $QT_IS_STATIC = yes ; then - QT_LIBS="$QT_LIBS $QT_LIB kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib shell32.lib imm32.lib advapi32.lib wsock32.lib winspool.lib winmm.lib netapi32.lib" - if test $QT_MAJOR = "3" ; then - QT_LIBS="$QT_LIBS qtmain.lib" - fi - else - QT_LIBS="$QT_LIBS $QT_LIB" - if test $QT_MAJOR = "3" ; then - QT_CXXFLAGS="$QT_CXXFLAGS -DQT_DLL" - QT_LIBS="$QT_LIBS qtmain.lib qui.lib user32.lib netapi32.lib" - fi - fi - QASSISTANTCLIENT_LDADD="qassistantclient.lib" - ;; - -esac - - -if test x"$QT_IS_EMBEDDED" = "xyes" ; then - QT_CXXFLAGS="-DQWS $QT_CXXFLAGS" -fi - -if test x"$QT_IS_MT" = "xyes" ; then - QT_CXXFLAGS="$QT_CXXFLAGS -D_REENTRANT -DQT_THREAD_SUPPORT" -fi - -QT_LDADD="-L$QTDIR/lib $QT_LIBS" - -if test x$QT_IS_STATIC = xyes ; then - OLDLIBS="$LIBS" - LIBS="$QT_LDADD" - AC_CHECK_LIB(Xft, XftFontOpen, QT_LDADD="$QT_LDADD -lXft") - LIBS="$LIBS" -fi - -AC_MSG_CHECKING([QT_CXXFLAGS]) -AC_MSG_RESULT([$QT_CXXFLAGS]) -AC_MSG_CHECKING([QT_LDADD]) -AC_MSG_RESULT([$QT_LDADD]) - -AC_SUBST(QT_CXXFLAGS) -AC_SUBST(QT_LDADD) -AC_SUBST(QT_GUILINK) -AC_SUBST(QASSISTANTCLIENT_LDADD) - -]) - diff --git a/client/aboutwindow.cc b/client/aboutwindow.cc index 8743ed8..849608d 100644 --- a/client/aboutwindow.cc +++ b/client/aboutwindow.cc @@ -29,14 +29,14 @@ #include "aboutwindow.h" -#include -#include +#include +#include #include #define MARGIN 12 -AboutWindow::AboutWindow( QWidget* parent, const char* name ) - : QDialog( parent, name ) +AboutWindow::AboutWindow( QWidget* parent) + : QDialog( parent ) { setModal(true); pix_about = new QPixmap(); @@ -44,7 +44,7 @@ AboutWindow::AboutWindow( QWidget* parent, const char* name ) resize(pix_about->width(), pix_about->height()); - setBackgroundColor(QColor(200,200,200)); + // setBackgroundColor(QColor(200,200,200)); btn_ok = new QPushButton(this); btn_ok->setText("OK"); @@ -79,7 +79,7 @@ void AboutWindow::paintEvent( QPaintEvent *event ) painter.drawPixmap(0,0, *pix_about); // Draw title and version - painter.setBrush( SolidPattern ); + painter.setBrush( Qt::SolidPattern ); painter.setFont( QFont( "Arial", 18, QFont::Bold ) ); painter.setPen( Qt::black ); painter.drawText(version_x, version_y, "MIAV-Grab v" VERSION); diff --git a/client/aboutwindow.h b/client/aboutwindow.h index f87a10e..25fb6f0 100644 --- a/client/aboutwindow.h +++ b/client/aboutwindow.h @@ -30,11 +30,9 @@ #ifndef __ABOUTWINDOW_H__ #define __ABOUTWINDOW_H__ -#include -//#include -#include -//#include -#include +#include +#include +#include #define PIXMAP_ABOUT PIXMAPS"/about.png" /* @@ -68,7 +66,7 @@ class AboutWindow : public QDialog { Q_OBJECT public: - AboutWindow(QWidget* parent = 0, const char* name = 0); + AboutWindow(QWidget* parent = 0); ~AboutWindow(); virtual void paintEvent( QPaintEvent *event ); void mouseReleaseEvent(QMouseEvent *event); diff --git a/client/camera.h b/client/camera.h index a0b849a..410b9f5 100644 --- a/client/camera.h +++ b/client/camera.h @@ -50,7 +50,7 @@ using namespace std; #include "thread.h" #include "frame.h" -#include +#include /** * This class represents the symbolic representation of the camera and diff --git a/client/cprquerydialog.cc b/client/cprquerydialog.cc index 19337a4..15e00d1 100644 --- a/client/cprquerydialog.cc +++ b/client/cprquerydialog.cc @@ -27,7 +27,7 @@ #include #ifdef USE_GUI -#include +#include #include "messagebox.h" #include "cprquerydialog.h" @@ -39,10 +39,11 @@ CPRQueryDialog::CPRQueryDialog(Info *info, QWidget *parent, const char *name, QStatusBar *status) - : QDialog(parent, name, TRUE) + : QDialog(parent) { + setModal(true); this->info = info; - setCaption(name); + setWindowTitle(name); // Load image QPixmap pix_backspace; @@ -60,7 +61,7 @@ CPRQueryDialog::CPRQueryDialog(Info *info, cpr[0] = '\0'; internalCpr[0] = '\0'; - cprSocket = new QSocket(this); + cprSocket = new QTcpSocket(this); connect(cprSocket, SIGNAL(readyRead()), SLOT(cprSocket_readyRead())); connect(cprSocket, SIGNAL(connected()), SLOT(cprSocket_connected())); connect(cprSocket, SIGNAL(error(int)), SLOT(cprSocket_error(int))); @@ -72,21 +73,21 @@ CPRQueryDialog::CPRQueryDialog(Info *info, connect(timer, SIGNAL(timeout()), SLOT(cprSocket_timeout())); // Generate input buttons - QGridLayout *gl = new QGridLayout(this, 4, 3, 10, 2); - - QButton *b1 = createButton(this, "1", 1); - QButton *b2 = createButton(this, "2", 2); - QButton *b3 = createButton(this, "3", 3); - QButton *b4 = createButton(this, "4", 4); - QButton *b5 = createButton(this, "5", 5); - QButton *b6 = createButton(this, "6", 6); - QButton *b7 = createButton(this, "7", 7); - QButton *b8 = createButton(this, "8", 8); - QButton *b9 = createButton(this, "9", 9); - QButton *b0 = createButton(this, "0", 0); - QButton *bbs = createButton(this, "", 10); - bbs->setPixmap(pix_backspace); - QButton *bca = createButton(this, "CA", 11); + QGridLayout *gl = new QGridLayout(this);//, 4, 3, 10, 2); + + QPushButton *b1 = createButton(this, "1", 1); + QPushButton *b2 = createButton(this, "2", 2); + QPushButton *b3 = createButton(this, "3", 3); + QPushButton *b4 = createButton(this, "4", 4); + QPushButton *b5 = createButton(this, "5", 5); + QPushButton *b6 = createButton(this, "6", 6); + QPushButton *b7 = createButton(this, "7", 7); + QPushButton *b8 = createButton(this, "8", 8); + QPushButton *b9 = createButton(this, "9", 9); + QPushButton *b0 = createButton(this, "0", 0); + QPushButton *bbs = createButton(this, "", 10); + bbs->setIcon(pix_backspace); + QPushButton *bca = createButton(this, "CA", 11); gl->addWidget(b1, 0,0); gl->addWidget(b2, 0,1); @@ -160,7 +161,8 @@ QPushButton *CPRQueryDialog::createButton(QWidget *parent, const char *text, int { char buf[32]; sprintf(buf, "%d", value); - QPushButton *q = new QPushButton(this, buf); + QPushButton *q = new QPushButton(this); + q->setText(buf); QFont f("Lucida", 48); q->setFixedSize(150, 100); @@ -366,19 +368,19 @@ void CPRQueryDialog::cprSocket_error(int errnum) // Print error message switch(errnum) { - case QSocket::ErrConnectionRefused: // if the connection was refused + case QAbstractSocket::ConnectionRefusedError: // if the connection was refused msg.append("ErrConnectionRefused"); break; - case QSocket::ErrHostNotFound: // if the host was not found + case QAbstractSocket::HostNotFoundError: // if the host was not found msg.append("ErrHostNotFound"); break; - case QSocket::ErrSocketRead: // if a read from the socket failed + case QAbstractSocket::SocketAccessError: // if a read from the socket failed msg.append("ErrSocketRead"); break; } - if(statusbar) statusbar->message(msg, 5000); - MessageBox(this, "Fejl", msg, TYPE_OK, ICON_ERROR).exec(); + if(statusbar) statusbar->showMessage(msg, 5000); + MessageBox(this, "Fejl", msg.toStdString().c_str(), TYPE_OK, ICON_ERROR).exec(); //info->error(msg.c_str()); accept(); } @@ -399,7 +401,7 @@ void CPRQueryDialog::cprSocket_readyRead() if (!cprSocket->canReadLine()) return; QString msg = QString("Recieving name from cpr database..."); - if(statusbar) statusbar->message(msg, 5000); + if(statusbar) statusbar->showMessage(msg, 5000); timer->stop(); while(cprSocket->canReadLine()) { @@ -407,13 +409,13 @@ void CPRQueryDialog::cprSocket_readyRead() if (s.startsWith("0001")) { name.append(s.right(s.length()-4)); lastname.append(s.right(s.length()-4)); - name.setLength(name.length()-1); + name.resize(name.length()-1); if (name.length()) name += QString(", "); } if (s.startsWith("0002")) { name.append(s.right(s.length()-4)); firstname.append(s.right(s.length()-4)); - name.setLength(name.length()-1); + name.resize(name.length()-1); cprSocket->close(); lbl_name->setText(name); accept(); @@ -440,11 +442,11 @@ void CPRQueryDialog::cprSocket_readyRead() void CPRQueryDialog::cprSocket_connected() { QString msg = QString("Connected to cpr database, sending cpr number..."); - if(statusbar) statusbar->message(msg, 5000); + if(statusbar) statusbar->showMessage(msg, 5000); timer->stop(); - cprSocket->writeBlock(internalCpr, 10); - cprSocket->writeBlock("\n", 1); + cprSocket->write(internalCpr, 10); + cprSocket->write("\n", 1); } /** @@ -461,25 +463,31 @@ void CPRQueryDialog::cprSocket_timeout() // Print connection status switch(cprSocket->state()) { - case QSocket::Idle: // if there is no connection - msg.append("Idle"); + case QAbstractSocket::UnconnectedState: // if there is no connection + msg.append("Unconnected"); break; - case QSocket::HostLookup: // during a DNS lookup + case QAbstractSocket::HostLookupState: // during a DNS lookup msg.append("HostLookup"); break; - case QSocket::Connecting: // during TCP connection establishment + case QAbstractSocket::ConnectingState: // during TCP connection establishment msg.append("Connecting"); break; - case QSocket::Connected: // when there is an operational connection + case QAbstractSocket::ConnectedState: // when there is an operational connection msg.append("Conected"); break; - case QSocket::Closing: // if the socket is closing down, but is not yet closed. + case QAbstractSocket::ClosingState: // if the socket is closing down, but is not yet closed. msg.append("Closing"); break; + case QAbstractSocket::BoundState: // + msg.append("Bound"); + break; + case QAbstractSocket::ListeningState: // + msg.append("Listening"); + break; } - if(statusbar) statusbar->message(msg, 5000); - MessageBox(this, "Fejl", msg, TYPE_OK, ICON_ERROR).exec(); + if(statusbar) statusbar->showMessage(msg, 5000); + MessageBox(this, "Fejl", msg.toStdString().c_str(), TYPE_OK, ICON_ERROR).exec(); accept(); } diff --git a/client/cprquerydialog.h b/client/cprquerydialog.h index 85b2659..c70206e 100644 --- a/client/cprquerydialog.h +++ b/client/cprquerydialog.h @@ -49,40 +49,23 @@ /** * Includes */ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include using namespace std; -#include -#include -#include -#include -#include #include "messagebox.h" @@ -125,7 +108,7 @@ private: QLabel *lbl_cpr; QLabel *lbl_name; - QSocket *cprSocket; + QTcpSocket *cprSocket; char cpr[12]; char internalCpr[11]; diff --git a/client/encoder.h b/client/encoder.h index 0fada07..de29646 100644 --- a/client/encoder.h +++ b/client/encoder.h @@ -46,7 +46,7 @@ #include //#include -#include "miav.h" +#include "miav_client.h" #include "util.h" #include "package.h" #include "frame.h" diff --git a/client/historywidget.cc b/client/historywidget.cc index bdeb880..55fb178 100644 --- a/client/historywidget.cc +++ b/client/historywidget.cc @@ -30,6 +30,8 @@ #include "miav_config.h" +#include + HistoryWidget::HistoryWidget(QWidget *p) : QLabel(p) { parent = p; @@ -47,8 +49,10 @@ void HistoryWidget::set_image(QImage *i) image = new QImage(*i); - QImage resized = image->smoothScale(width(), height()); - setPixmap(resized); + QImage resized = image->scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + QPixmap pixmap; + pixmap.fromImage(resized); + setPixmap(pixmap); } QImage * HistoryWidget::get_image() diff --git a/client/historywidget.h b/client/historywidget.h index d464d59..b798ddb 100644 --- a/client/historywidget.h +++ b/client/historywidget.h @@ -29,8 +29,8 @@ #ifndef __MIAV_HISTORYWIDGET_H__ #define __MIAV_HISTORYWIDGET_H__ -#include -#include +#include +#include class HistoryWidget : public QLabel { Q_OBJECT diff --git a/client/info_gui.h b/client/info_gui.h index a4f5135..a607c0f 100644 --- a/client/info_gui.h +++ b/client/info_gui.h @@ -38,8 +38,9 @@ #include "miav_config.h" -#include -#include +#include +#include +#include #include #include @@ -48,11 +49,13 @@ #define TYPE_SHOW_MESSAGEBOX 65432 -class ShowMessageEvent : public QCustomEvent { +class ShowMessageEvent : public QEvent { public: - ShowMessageEvent( MessageBox* msgbox ) - : QCustomEvent( TYPE_SHOW_MESSAGEBOX ), m( msgbox ) {} + ShowMessageEvent( MessageBox* msgbox ) : + QEvent((QEvent::Type)TYPE_SHOW_MESSAGEBOX), + m( msgbox ) {} MessageBox *messagebox() const { return m; } + // Type type() const { return TYPE_SHOW_MESSAGEBOX; } private: MessageBox *m;; }; diff --git a/client/mainwindow.cc b/client/mainwindow.cc index ce3d9bb..0978120 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -29,18 +29,16 @@ #include "mainwindow.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -53,8 +51,8 @@ //"miav-grab.h" //#define WITH_DV -MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name ) - : QWidget( parent, name, WStyle_Customize | WStyle_NoBorder ) +MainWindow::MainWindow(QWidget* parent ) + : QWidget( parent, Qt::FramelessWindowHint ) { info = new InfoGui(qApp, this, config); @@ -140,7 +138,7 @@ QImage *MainWindow::loadButtonIcon( char *name, int height ) int h = (int)(height * unit); int w = (int)((float)img->width() / (float)(img->height() / (float)h)); - scaled = img->smoothScale(w, h); + scaled = img->scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation); delete img; img = new QImage(scaled); @@ -182,29 +180,27 @@ void MainWindow::createGui() * |_______________________________|__________________| */ - QGridLayout *g0 = new QGridLayout(this, 2, 2, 0, -1); - QGridLayout *g1 = new QGridLayout(4, 4, -1); + QPixmap pixmap; + + QGridLayout *g0 = new QGridLayout(this); + QGridLayout *g1 = new QGridLayout(); g0->addLayout(g1, 0, 0); QGroupBox *gb = new QGroupBox(this); - // gb->setRows(NUM_HISTORY); + /* gb->setColumns(1); - // gb->setTitle("fisk"); - // QGridLayout *g2 = new QGridLayout(1, NUM_HISTORY, -1); - // QVBoxLayout *g2 = new QVBoxLayout(this); - // g0->addLayout(g2, 0, 1); - gb->setInsideMargin(HISTORY_LIST_MARGIN); gb->setInsideSpacing(HISTORY_LIST_SPACING); gb->setFlat(true); g0->addWidget(gb, 0, 1); + */ int resolution_w = config->readInt("pixel_width"); int resolution_h = config->readInt("pixel_height"); int output_width = resolution_w - // this->width() - (int)(BUTTON_WIDTH * unit) - - (gb->insideMargin() * 2) - + /* (gb->insideMargin() * 2) - */ g1->margin() * 2 - g0->margin() * 2; @@ -214,28 +210,30 @@ void MainWindow::createGui() g0->margin() * 3; img_recedge = new QLabel(this); - img_recedge->setBackgroundColor(QColor(160,160,160)); + QPalette palette; + palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160)); + img_recedge->setPalette(palette); img_recedge->setFixedSize(output_width, output_height); img_live = new VideoWidget(img_recedge, camera); img_live->setFixedSize(output_width - 20, output_height - 20); img_live->move(10,10); - g1->addMultiCellWidget ( img_recedge, 0, 0, 0, 3, Qt::AlignHCenter); - // QObject::connect( img_live, SIGNAL(clicked()), this, SLOT(live_clicked()) ); + g1->addWidget( img_recedge, 0, 0, 0, 3, Qt::AlignHCenter); // CPR/NAME LABEL + CPR button lbl_cpr = createLabel("", output_width - (int)(BUTTON_WIDTH * unit), BUTTON_HEIGHT); - g1->addMultiCellWidget ( lbl_cpr, 1, 1, 0, 2); + g1->addWidget( lbl_cpr, 1, 1, 0, 2); btn_cpr = createButton(""); btn_cpr->setFocus(); - btn_cpr->setPixmap(*img_cpr); + pixmap.fromImage(*img_cpr); + btn_cpr->setIcon(pixmap); QObject::connect( btn_cpr, SIGNAL(clicked()), this, SLOT(cpr_clicked()) ); // Will also be connected in the MGUI code g1->addWidget(btn_cpr, 1, 3); lbl_name = createLabel("", output_width, (int)(BUTTON_HEIGHT * 0.8f)); - g1->addMultiCellWidget ( lbl_name, 2, 2, 0, 3); + g1->addWidget( lbl_name, 2, 2, 0, 3); /* btn_clear = createButton(""); btn_clear->setPixmap(*img_clear); @@ -245,22 +243,26 @@ void MainWindow::createGui() */ // Rec + Shot + Freeze buttons btn_rec = createButton(""); - btn_rec->setPixmap(*img_record); + pixmap.fromImage(*img_record); + btn_rec->setIcon(pixmap); QObject::connect( btn_rec, SIGNAL(clicked()), this, SLOT(rec_clicked()) ); g1->addWidget(btn_rec, 3, 0); btn_shoot = createButton(""); - btn_shoot->setPixmap(*img_snapshot); + pixmap.fromImage(*img_snapshot); + btn_shoot->setIcon(pixmap); QObject::connect( btn_shoot, SIGNAL(clicked()), this, SLOT(shoot_clicked()) ); g1->addWidget(btn_shoot, 3, 1); btn_freeze = createButton(""); - btn_freeze->setPixmap(*img_freeze); + pixmap.fromImage(*img_freeze); + btn_freeze->setIcon(pixmap); QObject::connect( btn_freeze, SIGNAL(clicked()), this, SLOT(freeze_clicked()) ); g1->addWidget(btn_freeze, 3, 2); btn_mute = createButton(""); - btn_mute->setPixmap(*img_unmute); + pixmap.fromImage(*img_unmute); + btn_mute->setIcon(pixmap); QObject::connect( btn_mute, SIGNAL(clicked()), this, SLOT(mute_clicked()) ); g1->addWidget(btn_mute, 3, 3); @@ -282,38 +284,40 @@ void MainWindow::createGui() // Clear button btn_clear = createButton("", gb); - btn_clear->setPixmap(*img_clear); + pixmap.fromImage(*img_clear); + btn_clear->setIcon(pixmap); QObject::connect( btn_clear, SIGNAL(clicked()), this, SLOT(clear_clicked()) ); // Statusbar status = new QStatusBar(this); status->setSizeGripEnabled(FALSE); // status->setFont(QFont( "Sans Serif", (int)(unit * height / 3), QFont::Normal )); - g0->addMultiCellWidget(status, 4, 4, 0, 1); + g0->addWidget(status, 4, 4, 0, 1); lbl_recordtime = createLabel("", BUTTON_WIDTH, 1); lbl_recordtime->setFixedWidth((int)(BUTTON_WIDTH * unit) + - (gb->insideMargin() * 2) + + /* (gb->insideMargin() * 2) + */ g1->margin() * 2 + g0->margin() * 2); - status->addWidget(lbl_recordtime, 0, TRUE); + status->addWidget(lbl_recordtime, 0); // About button btn_about = new QPushButton("", this); btn_about->setFixedHeight((int)unit); - btn_about->setPixmap(*img_logo); + pixmap.fromImage(*img_logo); + btn_about->setIcon(pixmap); QObject::connect( btn_about, SIGNAL(clicked()), this, SLOT(about_clicked()) ); - status->addWidget(btn_about, 0, TRUE); + status->addWidget(btn_about, 0); // Version label lbl_version = createLabel("MIaV-Grab v" VERSION, BUTTON_WIDTH, 1); lbl_version->setFixedWidth((int)(BUTTON_WIDTH * unit) + - (gb->insideMargin() * 2) + + /* (gb->insideMargin() * 2) + */ g1->margin() * 2 + g0->margin() * 2); - status->addWidget(lbl_version, 0, TRUE); + status->addWidget(lbl_version, 0); - status->message( TXT_READY ); + status->showMessage( TXT_READY ); } @@ -387,14 +391,17 @@ void MainWindow::redraw_edge() { rec_edge_counter += SPEED; float val = fabs(sin(rec_edge_counter)); - img_recedge->setBackgroundColor(QColor((int) ((255 - GREY) * val + GREY), - (int) (GREY - (GREY * val)), - (int) (GREY - (GREY * val)))); + + QPalette palette; + palette.setColor(img_recedge->backgroundRole(), QColor((int) ((255 - GREY) * val + GREY), + (int) (GREY - (GREY * val)), + (int) (GREY - (GREY * val)))); + img_recedge->setPalette(palette); } void MainWindow::message(char *msg) { - status->message(msg); + status->showMessage(msg); info->log("Message: %s", msg); } @@ -447,8 +454,8 @@ void MainWindow::cpr_clicked() info->log("Activated CPR chooser."); // Save CPR and name, from the labels. - strcpy(oldname, lbl_name->text().ascii()); - strcpy(oldcpr, lbl_cpr->text().ascii()); + strcpy(oldname, lbl_name->text().toStdString().c_str()); + strcpy(oldcpr, lbl_cpr->text().toStdString().c_str()); clear(); @@ -462,25 +469,29 @@ void MainWindow::cpr_clicked() info->log("Cancelled CPR chooser."); } else { // Change CPR camera. - info->log("New CPR %s (old %s).", (char*)lbl_cpr->text().ascii(), oldcpr); - strcpy(oldname, lbl_name->text().ascii()); - strcpy(oldcpr, lbl_cpr->text().ascii()); + info->log("New CPR %s (old %s).", (char*)lbl_cpr->text().toStdString().c_str(), oldcpr); + strcpy(oldname, lbl_name->text().toStdString().c_str()); + strcpy(oldcpr, lbl_cpr->text().toStdString().c_str()); clear(); lbl_name->setText(oldname); lbl_cpr->setText(oldcpr); - camera->setCpr((char*)lbl_cpr->text().ascii(), (char*)lbl_name->text().ascii()); + camera->setCpr((char*)lbl_cpr->text().toStdString().c_str(), (char*)lbl_name->text().toStdString().c_str()); } } void MainWindow::rec_clicked() { + QPalette palette; + QPixmap pixmap; + if(!recording) { info->log("Start recording."); recording = 1; // Start flashing the edge rec_edge_counter = 0.0f; timer->start(100); - btn_rec->setPixmap(*img_stop); + pixmap.fromImage(*img_stop); + btn_rec->setIcon(pixmap); camera->start(); } else { switch(MessageBox(this, @@ -493,8 +504,10 @@ void MainWindow::rec_clicked() recording = 0; camera->stop(SAVE); timer->stop(); - img_recedge->setBackgroundColor(QColor(160,160,160)); - btn_rec->setPixmap(*img_record); + palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160)); + img_recedge->setPalette(palette); + pixmap.fromImage(*img_record); + btn_rec->setIcon(pixmap); break; case MSG_NO: @@ -502,8 +515,10 @@ void MainWindow::rec_clicked() recording = 0; camera->stop(DELETE); timer->stop(); - img_recedge->setBackgroundColor(QColor(160,160,160)); - btn_rec->setPixmap(*img_record); + palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160)); + img_recedge->setPalette(palette); + pixmap.fromImage(*img_record); + btn_rec->setIcon(pixmap); break; case MSG_MAYBE: @@ -511,8 +526,10 @@ void MainWindow::rec_clicked() recording = 0; camera->stop(LATER); timer->stop(); - img_recedge->setBackgroundColor(QColor(160,160,160)); - btn_rec->setPixmap(*img_record); + palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160)); + img_recedge->setPalette(palette); + pixmap.fromImage(*img_record); + btn_rec->setIcon(pixmap); break; case MSG_CANCEL: @@ -527,7 +544,7 @@ void MainWindow::shoot_clicked() // unsigned char pixels[720*576*3]; info->log("Snapshot (%s).", frozen?"frozen":"unfrozen"); - QImage screenshot(720, 576, 32); + QImage screenshot(720, 576, QImage::Format_RGB32); camera->snapshot(screenshot.bits()); @@ -540,8 +557,12 @@ void MainWindow::shoot_clicked() if(frozen) { camera->unfreeze(); - btn_freeze->setPixmap(*img_freeze); - btn_freeze->setOn(false); + + QPixmap pixmap; + pixmap.fromImage(*img_freeze); + btn_freeze->setIcon(pixmap); + + btn_freeze->setDown(false); frozen = false; } } @@ -551,23 +572,38 @@ void MainWindow::freeze_clicked() if(frozen) { info->log("Unfreeze."); camera->unfreeze(); - btn_freeze->setPixmap(*img_freeze); - btn_freeze->setOn(false); + + QPixmap pixmap; + pixmap.fromImage(*img_freeze); + btn_freeze->setIcon(pixmap); + + btn_freeze->setDown(false); frozen = false; } else { info->log("Freeze."); camera->freeze(); - btn_freeze->setPixmap(*img_unfreeze); - btn_freeze->setOn(true); + + QPixmap pixmap; + pixmap.fromImage(*img_freeze); + btn_freeze->setIcon(pixmap); + + btn_freeze->setDown(true); frozen = true; } } void MainWindow::mute_clicked() { + QPixmap pixmap; + muted = !muted; - if(muted) btn_mute->setPixmap(*img_mute); - else btn_mute->setPixmap(*img_unmute); + if(muted) { + pixmap.fromImage(*img_mute); + btn_mute->setIcon(pixmap); + } else { + pixmap.fromImage(*img_unmute); + btn_mute->setIcon(pixmap); + } camera->setMute(muted); } diff --git a/client/mainwindow.h b/client/mainwindow.h index 2ac7d82..435d20d 100644 --- a/client/mainwindow.h +++ b/client/mainwindow.h @@ -33,13 +33,13 @@ #include using namespace std; -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include "videowidget.h" #include "camera.h" @@ -100,7 +100,7 @@ class MainWindow : public QWidget { Q_OBJECT public: - MainWindow(QApplication *qApp, QWidget* parent = 0, const char* name = 0); + MainWindow(QWidget* parent = 0); ~MainWindow(); void message(char* msg); diff --git a/client/messagebox.cc b/client/messagebox.cc index fd812eb..abd7479 100644 --- a/client/messagebox.cc +++ b/client/messagebox.cc @@ -43,14 +43,14 @@ MessageBox::MessageBox(QWidget* parent, const char* text, msg_type type, msg_icon icon) - : QDialog(parent, name, TRUE) + : QDialog(parent) { int resolution_w = config->readInt("pixel_width"); //int resolution_h = config->readInt("pixel_height"); unit = ((float)resolution_w / config->readFloat("screensize")) / INCH_IN_CM; - setCaption(name); + setWindowTitle(name); QFrame *topf = new QFrame(this); topf->setFrameStyle(QFrame::Box | QFrame::Raised); topf->setLineWidth(3); @@ -116,7 +116,7 @@ MessageBox::MessageBox(QWidget* parent, // lbl_text->setFont(QFont("Arial", 18)); QFrame *f = new QFrame(topf); - QVBoxLayout *blayout = new QVBoxLayout(topf, 20, 20); + QVBoxLayout *blayout = new QVBoxLayout(topf); blayout->addWidget(lbl_icon); blayout->addWidget(lbl_text); @@ -127,7 +127,7 @@ MessageBox::MessageBox(QWidget* parent, case TYPE_OK: { QPushButton *bok = createButton(f, TXT_OK ); - QGridLayout *glayout = new QGridLayout(f, 1, 1, 20, 20); + QGridLayout *glayout = new QGridLayout(f); glayout->addWidget(bok, 0, 0); connect(bok, SIGNAL( clicked() ), SLOT(bok_clicked())); break; @@ -136,7 +136,7 @@ MessageBox::MessageBox(QWidget* parent, { QPushButton *bok = createButton(f, TXT_OK ); QPushButton *bcancel = createButton(f, TXT_CANCEL ); - QGridLayout *glayout = new QGridLayout(f, 1, 2, 20, 20); + QGridLayout *glayout = new QGridLayout(f); glayout->addWidget(bcancel, 0, 1); glayout->addWidget(bok, 0, 2); connect(bcancel, SIGNAL( clicked() ), SLOT(bcancel_clicked())); @@ -147,7 +147,7 @@ MessageBox::MessageBox(QWidget* parent, { QPushButton *bno = createButton(f, TXT_NO ); QPushButton *byes = createButton(f, TXT_YES ); - QGridLayout *glayout = new QGridLayout(f, 1, 2, 20, 20); + QGridLayout *glayout = new QGridLayout(f); glayout->addWidget(bno, 0, 0); glayout->addWidget(byes, 0, 1); connect(byes, SIGNAL( clicked() ), SLOT(byes_clicked())); @@ -159,7 +159,7 @@ MessageBox::MessageBox(QWidget* parent, QPushButton *bmaybe = createButton(f, TXT_MAYBE ); QPushButton *bno = createButton(f, TXT_NO ); QPushButton *byes = createButton(f, TXT_YES ); - QGridLayout *glayout = new QGridLayout(f, 1, 3, 20, 20); + QGridLayout *glayout = new QGridLayout(f); glayout->addWidget(bno, 0, 0); glayout->addWidget(byes, 0, 1); glayout->addWidget(bmaybe, 0, 2); @@ -173,7 +173,7 @@ MessageBox::MessageBox(QWidget* parent, QPushButton *bcancel = createButton(f, TXT_CANCEL ); QPushButton *bno = createButton(f, TXT_NO ); QPushButton *byes = createButton(f, TXT_YES ); - QGridLayout *glayout = new QGridLayout(f, 1, 3, 20, 20); + QGridLayout *glayout = new QGridLayout(f); glayout->addWidget(bno, 0, 0); glayout->addWidget(bcancel, 0, 1); glayout->addWidget(byes, 0, 2); @@ -188,7 +188,7 @@ MessageBox::MessageBox(QWidget* parent, QPushButton *bcancel = createButton(f, TXT_CANCEL ); QPushButton *bno = createButton(f, TXT_NO ); QPushButton *byes = createButton(f, TXT_YES ); - QGridLayout *glayout = new QGridLayout(f, 1, 4, 20, 20); + QGridLayout *glayout = new QGridLayout(f); glayout->addWidget(bno, 0, 0); glayout->addWidget(bcancel, 0, 1); glayout->addWidget(byes, 0, 2); diff --git a/client/messagebox.h b/client/messagebox.h index 30a8307..e2c576c 100644 --- a/client/messagebox.h +++ b/client/messagebox.h @@ -30,13 +30,13 @@ #ifndef __MIAV_MESSAGEBOX_H__ #define __MIAV_MESSAGEBOX_H__ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include typedef enum { ICON_NONE, // No icon is used diff --git a/client/miav_client.cc b/client/miav_client.cc index a8e9f7c..f8ea6d2 100644 --- a/client/miav_client.cc +++ b/client/miav_client.cc @@ -42,6 +42,7 @@ QApplication *miav_app; * This function starts the MIaV gui. */ int main(int argc, char *argv[]) +{ QApplication miav_grab( argc, argv ); miav_app = &miav_grab; @@ -52,8 +53,7 @@ int main(int argc, char *argv[]) InfoEventHandler *eventhandler = new InfoEventHandler( ); miav_grab.installEventFilter( eventhandler ); - MainWindow mainwindow( &miav_grab ); - miav_grab.setMainWidget( &mainwindow ); + MainWindow mainwindow; info.setParent(&mainwindow); return miav_grab.exec(); diff --git a/client/miav_client.h b/client/miav_client.h index ce7842a..7b14912 100644 --- a/client/miav_client.h +++ b/client/miav_client.h @@ -35,7 +35,7 @@ #include "queue.h" #ifdef USE_GUI -#include +#include extern QApplication *miav_app; #endif/*USE_GUI*/ diff --git a/client/player.h b/client/player.h index 0f5ca51..4e826ad 100644 --- a/client/player.h +++ b/client/player.h @@ -51,7 +51,7 @@ #include "thread.h" #include "frame.h" -#include +#include #include "yuv_draw.h" diff --git a/client/videowidget.cc b/client/videowidget.cc index 61b5c8e..a2d5a14 100644 --- a/client/videowidget.cc +++ b/client/videowidget.cc @@ -32,7 +32,7 @@ #include "miav_config.h" -VideoWidget::VideoWidget(QWidget *p, Camera *c, QWidget* old) : QWidget(p, "") +VideoWidget::VideoWidget(QWidget *p, Camera *c, QWidget* old) : QWidget(p) { camera = c; parent = p; @@ -41,7 +41,7 @@ VideoWidget::VideoWidget(QWidget *p, Camera *c, QWidget* old) : QWidget(p, "") // A welltested hack to force SDL to draw in the QWidget QString ids; - setenv("SDL_WINDOWID", ids.setNum(winId()), 1); + setenv("SDL_WINDOWID", ids.setNum(winId()).toStdString().c_str(), 1); } VideoWidget::~VideoWidget() @@ -59,7 +59,7 @@ void VideoWidget::mouseReleaseEvent(QMouseEvent *event) { if(!parent) { // We are a fullscreen window QString ids; - setenv("SDL_WINDOWID", ids.setNum(oldWindow->winId()), 1); + setenv("SDL_WINDOWID", ids.setNum(oldWindow->winId()).toStdString().c_str(), 1); camera->resize(oldWindow->width(), oldWindow->height(), false); destroy(); } else { // We are a nested window diff --git a/client/videowidget.h b/client/videowidget.h index b9ac9d6..f088bfc 100644 --- a/client/videowidget.h +++ b/client/videowidget.h @@ -30,8 +30,8 @@ #ifndef __VIDEOWIDGET_H__ #define __VIDEOWIDGET_H__ -#include -#include +#include +#include #include "camera.h" diff --git a/client/yuv_draw.cc b/client/yuv_draw.cc index 21e5c28..156c705 100644 --- a/client/yuv_draw.cc +++ b/client/yuv_draw.cc @@ -29,7 +29,7 @@ #include "yuv_draw.h" // for miav_app -#include "miav.h" +#include "miav_client.h" #include @@ -47,7 +47,7 @@ static QImage *loadIcon( char *name, int height ) int h = height; int w = (int)((float)img->width() / (float)(img->height() / (float)h)); - scaled = img->smoothScale(w, h); + scaled = img->scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation); delete img; img = new QImage(scaled); @@ -107,6 +107,7 @@ void YUVDraw::addPixel(int x, int y, int val) void YUVDraw::setTopText(char* text) { + /* miav_app->lock(); top_pixmap->fill(); @@ -125,10 +126,12 @@ void YUVDraw::setTopText(char* text) } } miav_app->unlock(); + */ } void YUVDraw::setBottomText(char* text) { + /* miav_app->lock(); bottom_pixmap->fill(); @@ -147,6 +150,7 @@ void YUVDraw::setBottomText(char* text) } } miav_app->unlock(); + */ } void YUVDraw::draw() diff --git a/client/yuv_draw.h b/client/yuv_draw.h index 62f7d02..9f70798 100644 --- a/client/yuv_draw.h +++ b/client/yuv_draw.h @@ -31,9 +31,9 @@ #include -#include -#include -#include +#include +#include +#include #define ICON_HEIGHT 48 #define ICON_WIDTH 48 diff --git a/etc/miav.conf b/etc/miav.conf index b551d64..55fefe8 100644 --- a/etc/miav.conf +++ b/etc/miav.conf @@ -6,6 +6,9 @@ client_log_file = "/tmp/miav_client.log" server_log_file = "/tmp/miav_server.log" +# Cpr listen port +cprlisten_port = 18107 + # Cpr Database configuration cpr_host = "cpr.j.auh.dk" cpr_port = 10301 diff --git a/server/miav_server.h b/server/miav_server.h index ce7842a..6d5068a 100644 --- a/server/miav_server.h +++ b/server/miav_server.h @@ -34,9 +34,4 @@ #include "socket.h" #include "queue.h" -#ifdef USE_GUI -#include -extern QApplication *miav_app; -#endif/*USE_GUI*/ - #endif/*__LIBMIAV_H__*/ -- cgit v1.2.3