├── .gitignore ├── COPYING ├── Makefile.am ├── README.md ├── autogen.sh ├── configure.ac ├── debian ├── bluecherry-client.install ├── changelog ├── compat ├── control ├── copyright └── rules ├── linux └── bluecherry-client.desktop ├── mac ├── Info.plist.in ├── deploy.sh ├── package.sh └── replacepath.py ├── macosx-user.cmake ├── msys2 ├── README.md ├── build-client.sh ├── build-installer.sh └── mxe │ └── tools │ └── copydlldeps.sh ├── res ├── application-resize-full.png ├── arrow-circle-double.png ├── audio-stream-available.png ├── audio-stream-on.png ├── bluecherry-client.png ├── bluecherry.icns ├── bluecherry.ico ├── brightness.png ├── cassette.png ├── collapse-all.png ├── color.png ├── contrast.png ├── control-000-small.png ├── control-180-small.png ├── control-double-000-small.png ├── control-double-180-small.png ├── control-double-180.png ├── control-double.png ├── control-pause.png ├── control-stop-180.png ├── control-stop-square.png ├── control-stop.png ├── control.png ├── cross.png ├── down-arrow.png ├── exclamation-red.png ├── exclamation-yellow.png ├── expand-all.png ├── icon16.png ├── icon32.png ├── icon64.png ├── layout-12.png ├── layout-16.png ├── layout-32.png ├── layout-4.png ├── layout-9.png ├── layout-join-vertical.png ├── layout-join.png ├── layout-split-vertical.png ├── layout-split.png ├── layout.png ├── license.txt ├── loading-circle.gif ├── loading.gif ├── logo.png ├── pencil.png ├── plus.png ├── ptz-arrow.png ├── resources.qrc ├── status-alert.png ├── status-error.png ├── status-offline.png ├── status.png ├── system-monitor.png ├── tick.png ├── webcam.png └── windows.rc ├── scripts └── symbolstore.py ├── src ├── audio │ ├── AudioPlayer.cpp │ └── AudioPlayer.h ├── camera │ ├── DVRCamera.cpp │ ├── DVRCamera.h │ ├── DVRCameraData.cpp │ ├── DVRCameraData.h │ ├── DVRCameraSettingsReader.cpp │ ├── DVRCameraSettingsReader.h │ ├── DVRCameraSettingsWriter.cpp │ ├── DVRCameraSettingsWriter.h │ ├── DVRCameraStreamReader.cpp │ ├── DVRCameraStreamReader.h │ ├── DVRCameraStreamWriter.cpp │ ├── DVRCameraStreamWriter.h │ ├── DVRCameraXMLReader.cpp │ ├── DVRCameraXMLReader.h │ └── RecordingState.h ├── core │ ├── BluecherryApp.cpp │ ├── BluecherryApp.h │ ├── CameraPtzControl.cpp │ ├── CameraPtzControl.h │ ├── EventData.cpp │ ├── EventData.h │ ├── LanguageController.cpp │ ├── LanguageController.h │ ├── LiveStream.cpp │ ├── LiveStream.h │ ├── LiveViewManager.cpp │ ├── LiveViewManager.h │ ├── LoggableUrl.cpp │ ├── LoggableUrl.h │ ├── MJpegStream.cpp │ ├── MJpegStream.h │ ├── PtzPresetsModel.cpp │ ├── PtzPresetsModel.h │ ├── ServerRequestManager.cpp │ ├── ServerRequestManager.h │ ├── ThreadPause.cpp │ ├── ThreadPause.h │ ├── TransferRateCalculator.cpp │ ├── TransferRateCalculator.h │ ├── UpdateChecker.cpp │ ├── UpdateChecker.h │ ├── VaapiHWAccel.cpp │ ├── VaapiHWAccel.h │ ├── Version.cpp │ └── Version.h ├── event │ ├── CameraEventFilter.cpp │ ├── CameraEventFilter.h │ ├── EventDownloadManager.cpp │ ├── EventDownloadManager.h │ ├── EventFilter.cpp │ ├── EventFilter.h │ ├── EventList.cpp │ ├── EventList.h │ ├── EventParser.cpp │ ├── EventParser.h │ ├── EventVideoDownload.cpp │ ├── EventVideoDownload.h │ ├── EventsCursor.cpp │ ├── EventsCursor.h │ ├── EventsLoader.cpp │ ├── EventsLoader.h │ ├── EventsUpdater.cpp │ ├── EventsUpdater.h │ ├── MediaEventFilter.cpp │ ├── MediaEventFilter.h │ ├── ModelEventsCursor.cpp │ ├── ModelEventsCursor.h │ ├── ThumbnailManager.cpp │ └── ThumbnailManager.h ├── main.cpp ├── network │ ├── MediaDownloadManager.cpp │ ├── MediaDownloadManager.h │ ├── RemotePortChecker.cpp │ ├── RemotePortChecker.h │ ├── SocketError.cpp │ └── SocketError.h ├── rtsp-stream │ ├── RtspStream.cpp │ ├── RtspStream.h │ ├── RtspStreamFrame.cpp │ ├── RtspStreamFrame.h │ ├── RtspStreamFrameFormatter.cpp │ ├── RtspStreamFrameFormatter.h │ ├── RtspStreamFrameQueue.cpp │ ├── RtspStreamFrameQueue.h │ ├── RtspStreamThread.cpp │ ├── RtspStreamThread.h │ ├── RtspStreamWorker.cpp │ └── RtspStreamWorker.h ├── server │ ├── DVRServer.cpp │ ├── DVRServer.h │ ├── DVRServerConfiguration.cpp │ ├── DVRServerConfiguration.h │ ├── DVRServerConnectionType.h │ ├── DVRServerRepository.cpp │ ├── DVRServerRepository.h │ ├── DVRServerSettingsReader.cpp │ ├── DVRServerSettingsReader.h │ ├── DVRServerSettingsWriter.cpp │ └── DVRServerSettingsWriter.h ├── ui │ ├── AboutDialog.cpp │ ├── AboutDialog.h │ ├── CrashReportDialog.cpp │ ├── CrashReportDialog.h │ ├── DVRServersView.cpp │ ├── DVRServersView.h │ ├── EventCommentsWidget.cpp │ ├── EventCommentsWidget.h │ ├── EventTagsDelegate.cpp │ ├── EventTagsDelegate.h │ ├── EventTagsView.cpp │ ├── EventTagsView.h │ ├── EventTimelineDatePainter.cpp │ ├── EventTimelineDatePainter.h │ ├── EventTimelineWidget.cpp │ ├── EventTimelineWidget.h │ ├── EventTypesFilter.cpp │ ├── EventTypesFilter.h │ ├── EventVideoDownloadWidget.cpp │ ├── EventVideoDownloadWidget.h │ ├── EventVideoDownloadsWindow.cpp │ ├── EventVideoDownloadsWindow.h │ ├── EventVideoPlayer.cpp │ ├── EventVideoPlayer.h │ ├── EventViewWindow.cpp │ ├── EventViewWindow.h │ ├── EventsView.cpp │ ├── EventsView.h │ ├── EventsWindow.cpp │ ├── EventsWindow.h │ ├── ExpandingTextEdit.cpp │ ├── ExpandingTextEdit.h │ ├── MacSplitter.cpp │ ├── MacSplitter.h │ ├── MacSplitterHandle.cpp │ ├── MacSplitterHandle.h │ ├── MainWindow.cpp │ ├── MainWindow.h │ ├── NumericOffsetWidget.cpp │ ├── NumericOffsetWidget.h │ ├── OptionsDialog.cpp │ ├── OptionsDialog.h │ ├── OptionsGeneralPage.cpp │ ├── OptionsGeneralPage.h │ ├── OptionsServerPage.cpp │ ├── OptionsServerPage.h │ ├── RemotePortCheckerWidget.cpp │ ├── RemotePortCheckerWidget.h │ ├── ServerMenu.cpp │ ├── ServerMenu.h │ ├── SetupWizard.cpp │ ├── SetupWizard.h │ ├── SetupWizard_p.h │ ├── StatusBandwidthWidget.cpp │ ├── StatusBandwidthWidget.h │ ├── StatusBandwidthWidget_mac.mm │ ├── StatusBarServerAlert.cpp │ ├── StatusBarServerAlert.h │ ├── SwitchEventsWidget.cpp │ ├── SwitchEventsWidget.h │ ├── TimeRangeScrollBar.cpp │ ├── TimeRangeScrollBar.h │ ├── VisibleTimeRange.cpp │ ├── VisibleTimeRange.h │ ├── WebRtpPortCheckerWidget.cpp │ ├── WebRtpPortCheckerWidget.h │ ├── liveview │ │ ├── LiveViewWindow.cpp │ │ ├── LiveViewWindow.h │ │ ├── PtzPresetsWindow.cpp │ │ ├── PtzPresetsWindow.h │ │ ├── cameracontainerwidget.cpp │ │ └── cameracontainerwidget.h │ └── model │ │ ├── DVRServersModel.cpp │ │ ├── DVRServersModel.h │ │ ├── DVRServersProxyModel.cpp │ │ ├── DVRServersProxyModel.h │ │ ├── EventSourcesModel.cpp │ │ ├── EventSourcesModel.h │ │ ├── EventTagsModel.cpp │ │ ├── EventTagsModel.h │ │ ├── EventsModel.cpp │ │ ├── EventsModel.h │ │ ├── EventsProxyModel.cpp │ │ ├── EventsProxyModel.h │ │ ├── SavedLayoutsModel.cpp │ │ └── SavedLayoutsModel.h ├── utils │ ├── Breakpad.cpp │ ├── DateTimeRange.cpp │ ├── DateTimeRange.h │ ├── DateTimeUtils.cpp │ ├── DateTimeUtils.h │ ├── FileUtils.cpp │ ├── FileUtils.h │ ├── ImageDecodeTask.cpp │ ├── ImageDecodeTask.h │ ├── PlatformOSX.mm │ ├── Range.cpp │ ├── Range.h │ ├── RangeMap.cpp │ ├── RangeMap.h │ ├── StringUtils.cpp │ ├── StringUtils.h │ ├── ThreadTask.cpp │ ├── ThreadTask.h │ ├── ThreadTaskCourier.cpp │ ├── ThreadTaskCourier.h │ ├── explorerstyle.cpp │ └── explorerstyle.h └── video │ ├── MediaDownload.cpp │ ├── MediaDownload.h │ ├── MediaDownload_p.h │ ├── VideoHttpBuffer.cpp │ ├── VideoHttpBuffer.h │ ├── VideoPlayerBackend.cpp │ ├── VideoPlayerBackend.h │ ├── VideoPlayerFactory.h │ ├── VideoWidget.cpp │ ├── VideoWidget.h │ └── libmpv │ ├── MpvVideoPlayerBackend.cpp │ ├── MpvVideoPlayerBackend.h │ ├── MpvVideoPlayerFactory.cpp │ ├── MpvVideoPlayerFactory.h │ ├── MpvVideoWidget.cpp │ └── MpvVideoWidget.h ├── tests ├── data │ └── event │ │ ├── category-level-alarm.xml │ │ ├── category-level-camera-audio-lost.xml │ │ ├── category-level-camera-continuous.xml │ │ ├── category-level-camera-motion.xml │ │ ├── category-level-camera-not-found.xml │ │ ├── category-level-camera-video-lost.xml │ │ ├── category-level-critical.xml │ │ ├── category-level-info.xml │ │ ├── category-level-invalid-category.xml │ │ ├── category-level-invalid-format.xml │ │ ├── category-level-invalid-level.xml │ │ ├── category-level-invalid-location-id.xml │ │ ├── category-level-invalid-scheme.xml │ │ ├── category-level-no-scheme.xml │ │ ├── category-level-system-boot.xml │ │ ├── category-level-system-crash.xml │ │ ├── category-level-system-disk-space.xml │ │ ├── category-level-system-power-outage.xml │ │ ├── category-level-system-reboot.xml │ │ ├── category-level-system-shutdown.xml │ │ ├── category-level-unknown.xml │ │ ├── category-level-warning.xml │ │ ├── ended-before-start.xml │ │ ├── non-utc-date-time-event-with-non-zero-duration.xml │ │ ├── non-utc-date-time-event-with-zero-duration.xml │ │ ├── non-utc-date-time-event-without-duration.xml │ │ ├── timezone-changed.xml │ │ ├── utc-date-time-event-with-non-zero-duration.xml │ │ ├── utc-date-time-event-with-zero-duration.xml │ │ ├── utc-date-time-event-without-duration.xml │ │ ├── v2demo-single-full-item.xml │ │ ├── v2demo.xml │ │ ├── with-media.xml │ │ ├── without-media-invalid-attribute.xml │ │ ├── without-media-no-attribute.xml │ │ └── without-media-verbatim-value.xml ├── src │ ├── core │ │ └── VersionTestCase.cpp │ ├── event │ │ └── EventParserTestCase.cpp │ └── utils │ │ ├── DateTimeRangeTestCase.cpp │ │ ├── RangeMapTestCase.cpp │ │ └── RangeTestCase.cpp └── tests.pro ├── translations ├── README ├── bluecherryclient_de_DE.ts ├── bluecherryclient_en.ts ├── bluecherryclient_es.ts ├── bluecherryclient_no.ts ├── bluecherryclient_pl.ts ├── bluecherryclient_ru.ts ├── bluecherryclient_sv_SE.ts └── setup-transifex.sh └── win ├── cross_build_mxe.sh ├── installer32.nsi.in ├── installer64.nsi.in └── mxe.patch /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.o 3 | moc_*.cpp 4 | qrc_*.cpp 5 | /Makefile 6 | tests-build-* 7 | *.user 8 | *.obj 9 | *.dll 10 | *.res 11 | *.ilk 12 | *.pdb 13 | *.intermediate.* 14 | *kdev4* 15 | user.cmake 16 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | autoreconf -i 4 | 5 | -------------------------------------------------------------------------------- /debian/bluecherry-client.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/bin/bluecherry-client 2 | linux/bluecherry-client.desktop usr/share/applications 3 | res/bluecherry-client.png usr/share/pixmaps 4 | debian/tmp/usr/share/bluecherry-client/translations/*.qm 5 | 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: bluecherry-client 2 | Section: net 3 | Priority: optional 4 | Maintainer: Bluecherry 5 | Build-Depends: debhelper (>= 7), qtbase5-dev, libmpv-dev, libsdl2-dev, libavcodec-dev, libavformat-dev, libswscale-dev, libavfilter-dev, libavdevice-dev, yasm, zlib1g-dev, libasound2-dev, libva-dev 6 | Standards-Version: 3.8.4 7 | 8 | Package: bluecherry-client 9 | Architecture: any 10 | Depends: ${shlibs:Depends}, ${misc:Depends} 11 | Description: Bluecherry DVR Client 12 | This package contains the client for the Bluecherry DVR system. It can 13 | also be used to connect to remote instances of the Bluecherry DVR server. 14 | 15 | Package: bluecherry-client-dbg 16 | Architecture: any 17 | Section: debug 18 | Priority: extra 19 | Depends: 20 | bluecherry-client (= ${binary:Version}), ${misc:Depends} 21 | Description: debugging symbols for bluecherry-client 22 | This package contains the debugging symbols for Bluecherry DVR Client 23 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format-Specification: http://dep.debian.net/deps/dep5/ 2 | Name: Bluecherry DVR Client 3 | Maintainer: Bluecherry 4 | 5 | Files: * 6 | Copyright: 2011-2014, Bluecherry, LLC 7 | License: GPL-2+ 8 | 9 | Files: */breakpad 10 | Copyright: 2006, Google Inc. 11 | Licence: BSD-3-clause 12 | 13 | Files: */breakpad-bin 14 | Copyright: 2006, Google Inc. 15 | Licence: BSD-3-clause 16 | 17 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with autoreconf --parallel 5 | 6 | override_dh_strip: 7 | dh_strip --dbg-package=bluecherry-client-dbg 8 | 9 | 10 | -------------------------------------------------------------------------------- /linux/bluecherry-client.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Type=Application 4 | Name=Bluecherry Client 5 | Categories=Network;Qt 6 | Comment=Bluecherry DVR Client 7 | Icon=bluecherry-client 8 | Exec=bluecherry-client 9 | Terminal=false 10 | -------------------------------------------------------------------------------- /mac/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | bluecherry-client 9 | CFBundleGetInfoString 10 | Bluecherry Client 11 | CFBundleIconFile 12 | bluecherry.icns 13 | CFBundleIdentifier 14 | Bluecherry Client 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | @VERSION@ 19 | CFBundleName 20 | Bluecherry Client 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | @VERSION@ 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | @VERSION@ 29 | CSResourcesFileMapped 30 | 31 | NSHumanReadableCopyright 32 | Copyright 2010-2021 Bluecherry 33 | 34 | 35 | -------------------------------------------------------------------------------- /mac/package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z $1 ]; then 4 | echo "Usage: mac/package.sh path/to/build" 5 | exit 6 | fi 7 | 8 | if [ ! -e $1/bluecherry-client.app ]; then 9 | echo "$1/bluecherry-client.app does not exist" 10 | exit 11 | fi 12 | 13 | rm -r "$1/Bluecherry Client.app" 14 | cp -R "$1/bluecherry-client.app" "$1/Bluecherry Client.app" 15 | 16 | hdiutil create -srcfolder "$1/Bluecherry Client.app" BluecherryClient.dmg 17 | hdiutil internet-enable -yes BluecherryClient.dmg 18 | 19 | rm -r "$1/Bluecherry Client.app" 20 | -------------------------------------------------------------------------------- /macosx-user.cmake: -------------------------------------------------------------------------------- 1 | set (LIBAVCODEC_INCLUDE_DIRS ~/dev/usr/include) 2 | set (LIBAVCODEC_LIBRARY_DIRS ~/dev/usr/lib) 3 | set (LIBAVFORMAT_INCLUDE_DIRS ~/dev/usr/include) 4 | set (LIBAVFORMAT_LIBRARY_DIRS ~/dev/usr/lib) 5 | set (LIBAVUTIL_INCLUDE_DIRS ~/dev/usr/include) 6 | set (LIBAVUTIL_LIBRARY_DIRS ~/dev/usr/lib) 7 | set (LIBSWSCALE_INCLUDE_DIRS ~/dev/usr/include) 8 | set (LIBSWSCALE_LIBRARY_DIRS ~/dev/usr/lib) 9 | set (MACOSX_BREAKPAD_BIN_DIR ${CMAKE_SOURCE_DIR}/breakpad-bin/mac) 10 | set (MACOSX_BREAKPAD_SRC_DIR ${CMAKE_SOURCE_DIR}/breakpad/src) 11 | -------------------------------------------------------------------------------- /msys2/README.md: -------------------------------------------------------------------------------- 1 | # Building for Windows using MSYS2 2 | 3 | ## Installing MSYS2 4 | Download the installer from [official site](https://www.msys2.org/) or [GitHub Releases page](https://github.com/msys2/msys2-installer/releases). 5 | 6 | Run the installer. When done, run "MSYS2 MSYS" from Start menu. 7 | 8 | Update the package database and base packages: 9 | 10 | ```bash 11 | pacman -Syu 12 | ``` 13 | 14 | Terminal will be closed. Run "MSYS2 MSYS" from Start menu again and update the rest of base packages: 15 | 16 | ```bash 17 | pacman -Su 18 | ``` 19 | 20 | ## Installing developer tools and dependency packages 21 | Run "MSYS2 MSYS" from Start menu and install packages: 22 | 23 | ```bash 24 | pacman -S base-devel git mingw-w64-{i686,x86_64}-toolchain mingw-w64-{i686,x86_64}-nsis mingw-w64-{i686,x86_64}-ffmpeg mingw-w64-{i686,x86_64}-mpv mingw-w64-{i686,x86_64}-qt5 25 | ``` 26 | 27 | ## Building client application and installer 28 | Run "MSYS2 MinGW 32-bit" or "MSYS2 MinGW 64-bit" from Start Menu. 29 | 30 | Clone repository: 31 | 32 | ```bash 33 | cd /c/$ProjectDir/ 34 | 35 | git clone https://github.com/bluecherrydvr/bluecherry-client.git 36 | ``` 37 | 38 | Build: 39 | 40 | ```bash 41 | cd bluecherry-client/msys2/ 42 | 43 | ./build-client.sh 44 | 45 | ./build-installer.sh 46 | ``` 47 | 48 | >Note: `build-installer.sh` shell script relies on `copydlldeps.sh` shell script from MXE (M cross environment). 49 | It is copied from MXE repository [mxe/tools/copydlldeps.sh](https://github.com/mxe/mxe/blob/74dd24ca82a5e48ccaf0b549eaef1db07ed382ad/tools/copydlldeps.sh). 50 | This is a leftover after porting from MXE to MSYS2 building environment. 51 | 52 | Run client application without installing: 53 | 54 | ```bash 55 | bluechery-client 56 | ``` 57 | -------------------------------------------------------------------------------- /msys2/build-client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # print current MSYSTEM 4 | echo "==== MSYSTEM: $MSYSTEM ====" 5 | 6 | # set SRC_DIR and BUILD_DIR variables 7 | SRC_DIR=bluecherry-client 8 | BUILD_DIR=build-$SRC_DIR-MSYS2-$MSYSTEM 9 | 10 | # run autoreconf 11 | cd ../ 12 | 13 | ./autogen.sh 14 | 15 | # create build directory outside from source directory 16 | cd ../ 17 | 18 | mkdir -p $BUILD_DIR 19 | 20 | # configure, build and install 21 | cd $BUILD_DIR 22 | 23 | ../$SRC_DIR/configure 24 | make -j $(nproc) 25 | make install 26 | -------------------------------------------------------------------------------- /msys2/build-installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # print current MSYSTEM 4 | echo "==== MSYSTEM: $MSYSTEM ====" 5 | 6 | # set SRC_DIR, BUILD_DIR and BUILD_INSTALLER_DIR variables 7 | SRC_DIR=bluecherry-client 8 | BUILD_DIR=build-$SRC_DIR-MSYS2-$MSYSTEM 9 | BUILD_INSTALLER_DIR=build-$SRC_DIR-installer-MSYS2-$MSYSTEM 10 | 11 | # create build directory outside from source directory 12 | cd ../../ 13 | 14 | mkdir -p $BUILD_INSTALLER_DIR 15 | 16 | # copy files 17 | if [ "MINGW32" = $MSYSTEM ] 18 | then 19 | cp $BUILD_DIR/win/installer32.nsi $BUILD_INSTALLER_DIR/installer.nsi 20 | cp $MSYSTEM_PREFIX/bin/libssl-1_1.dll $BUILD_INSTALLER_DIR/ 21 | elif [ "MINGW64" = $MSYSTEM ] 22 | then 23 | cp $BUILD_DIR/win/installer64.nsi $BUILD_INSTALLER_DIR/installer.nsi 24 | cp $MSYSTEM_PREFIX/bin/libssl-1_1-x64.dll $BUILD_INSTALLER_DIR/ 25 | else 26 | echo "ERROR: Unknown MSYSTEM: $MSYSTEM" 27 | exit 1 28 | fi 29 | 30 | cp $MSYSTEM_PREFIX/bin/bluecherry-client.exe $BUILD_INSTALLER_DIR/ 31 | cp $MSYSTEM_PREFIX/share/bluecherry-client/translations/*.qm $BUILD_INSTALLER_DIR/ 32 | cp $SRC_DIR/COPYING $BUILD_INSTALLER_DIR/ 33 | cp $SRC_DIR/res/bluecherry.ico $BUILD_INSTALLER_DIR/ 34 | 35 | # copy dlls, strip, build installer 36 | cd $BUILD_INSTALLER_DIR 37 | 38 | ../$SRC_DIR/msys2/mxe/tools/copydlldeps.sh --infile ./bluecherry-client.exe --destdir ./ --srcdirs $MSYSTEM_PREFIX/bin --copy --enforcedir $MSYSTEM_PREFIX/share/qt5/plugins/platforms/ --enforcedir $MSYSTEM_PREFIX/share/qt5/plugins/imageformats/ 39 | strip *.dll *.exe imageformats/*.dll platforms/*.dll 40 | 41 | rm -f dll_list.nsh 42 | 43 | for dll in *.dll 44 | do 45 | echo "File $dll" >> dll_list.nsh 46 | done 47 | 48 | makensis installer.nsi 49 | -------------------------------------------------------------------------------- /res/application-resize-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/application-resize-full.png -------------------------------------------------------------------------------- /res/arrow-circle-double.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/arrow-circle-double.png -------------------------------------------------------------------------------- /res/audio-stream-available.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/audio-stream-available.png -------------------------------------------------------------------------------- /res/audio-stream-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/audio-stream-on.png -------------------------------------------------------------------------------- /res/bluecherry-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/bluecherry-client.png -------------------------------------------------------------------------------- /res/bluecherry.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/bluecherry.icns -------------------------------------------------------------------------------- /res/bluecherry.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/bluecherry.ico -------------------------------------------------------------------------------- /res/brightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/brightness.png -------------------------------------------------------------------------------- /res/cassette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/cassette.png -------------------------------------------------------------------------------- /res/collapse-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/collapse-all.png -------------------------------------------------------------------------------- /res/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/color.png -------------------------------------------------------------------------------- /res/contrast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/contrast.png -------------------------------------------------------------------------------- /res/control-000-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-000-small.png -------------------------------------------------------------------------------- /res/control-180-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-180-small.png -------------------------------------------------------------------------------- /res/control-double-000-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-double-000-small.png -------------------------------------------------------------------------------- /res/control-double-180-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-double-180-small.png -------------------------------------------------------------------------------- /res/control-double-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-double-180.png -------------------------------------------------------------------------------- /res/control-double.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-double.png -------------------------------------------------------------------------------- /res/control-pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-pause.png -------------------------------------------------------------------------------- /res/control-stop-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-stop-180.png -------------------------------------------------------------------------------- /res/control-stop-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-stop-square.png -------------------------------------------------------------------------------- /res/control-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control-stop.png -------------------------------------------------------------------------------- /res/control.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/control.png -------------------------------------------------------------------------------- /res/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/cross.png -------------------------------------------------------------------------------- /res/down-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/down-arrow.png -------------------------------------------------------------------------------- /res/exclamation-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/exclamation-red.png -------------------------------------------------------------------------------- /res/exclamation-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/exclamation-yellow.png -------------------------------------------------------------------------------- /res/expand-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/expand-all.png -------------------------------------------------------------------------------- /res/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/icon16.png -------------------------------------------------------------------------------- /res/icon32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/icon32.png -------------------------------------------------------------------------------- /res/icon64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/icon64.png -------------------------------------------------------------------------------- /res/layout-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-12.png -------------------------------------------------------------------------------- /res/layout-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-16.png -------------------------------------------------------------------------------- /res/layout-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-32.png -------------------------------------------------------------------------------- /res/layout-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-4.png -------------------------------------------------------------------------------- /res/layout-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-9.png -------------------------------------------------------------------------------- /res/layout-join-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-join-vertical.png -------------------------------------------------------------------------------- /res/layout-join.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-join.png -------------------------------------------------------------------------------- /res/layout-split-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-split-vertical.png -------------------------------------------------------------------------------- /res/layout-split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout-split.png -------------------------------------------------------------------------------- /res/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/layout.png -------------------------------------------------------------------------------- /res/license.txt: -------------------------------------------------------------------------------- 1 |
Copyright © 2021, Bluecherry LLC. All rights reserved.
2 |


3 | The following software is distributed under the terms of the GNU Lesser General Public License, either version 2.0, 2.1, or 2.1 or later, as indicated with their distribution: 4 | 12 | The Qt Toolkit contains code under other licenses and by specific authors. A complete list of copyrights is included with Qt's documentation, or available online here. 13 |


14 | SDL 2.0 is distributed under the zlib license. This license allows you to use SDL freely in any software. 15 | 18 |
19 | -------------------------------------------------------------------------------- /res/loading-circle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/loading-circle.gif -------------------------------------------------------------------------------- /res/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/loading.gif -------------------------------------------------------------------------------- /res/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/logo.png -------------------------------------------------------------------------------- /res/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/pencil.png -------------------------------------------------------------------------------- /res/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/plus.png -------------------------------------------------------------------------------- /res/ptz-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/ptz-arrow.png -------------------------------------------------------------------------------- /res/status-alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/status-alert.png -------------------------------------------------------------------------------- /res/status-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/status-error.png -------------------------------------------------------------------------------- /res/status-offline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/status-offline.png -------------------------------------------------------------------------------- /res/status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/status.png -------------------------------------------------------------------------------- /res/system-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/system-monitor.png -------------------------------------------------------------------------------- /res/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/tick.png -------------------------------------------------------------------------------- /res/webcam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluecherrydvr/bluecherry-client/3af027eec3d8124616f63cc6a5b28cc5bbf818c1/res/webcam.png -------------------------------------------------------------------------------- /res/windows.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "bluecherry.ico" -------------------------------------------------------------------------------- /src/audio/AudioPlayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef AUDIOPLAYER_H 19 | #define AUDIOPLAYER_H 20 | 21 | #include 22 | 23 | extern "C" 24 | { 25 | #include 26 | } 27 | 28 | class AudioPlayer : public QObject 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit AudioPlayer(QObject *parent = 0); 34 | ~AudioPlayer(); 35 | 36 | bool isDeviceEnabled() const { return m_deviceEnabled; } 37 | 38 | public slots: 39 | void play(); 40 | void stop(); 41 | void setAudioFormat(enum AVSampleFormat fmt, int channelsNum, int sampleRate); 42 | void feedSamples(void *data, int samplesNum, int bytesNum); 43 | 44 | private: 45 | 46 | bool m_isDeviceOpened; 47 | bool m_isPlaying; 48 | int m_deviceID; 49 | bool m_deviceEnabled; 50 | }; 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /src/camera/DVRCameraData.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "DVRCameraData.h" 19 | #include "DVRCamera.h" 20 | #include "server/DVRServer.h" 21 | 22 | DVRCameraData::DVRCameraData(int id, DVRServer *server) 23 | : m_id(id), m_server(server), m_disabled(false), m_ptzProtocol(DVRCamera::UnknownProtocol) 24 | { 25 | } 26 | 27 | DVRCameraData::~DVRCameraData() 28 | { 29 | } 30 | 31 | void DVRCameraData::setDisplayName(const QString &name) 32 | { 33 | if (m_displayName == name) 34 | return; 35 | 36 | m_displayName = name; 37 | emit changed(); 38 | } 39 | 40 | void DVRCameraData::setDisabled(bool disabled) 41 | { 42 | if (m_disabled == disabled) 43 | return; 44 | 45 | m_disabled = disabled; 46 | emit changed(); 47 | } 48 | 49 | void DVRCameraData::setPtzProtocol(qint8 ptzProtocol) 50 | { 51 | if (m_ptzProtocol == ptzProtocol) 52 | return; 53 | 54 | m_ptzProtocol = ptzProtocol; 55 | emit changed(); 56 | } 57 | 58 | int DVRCameraData::id() const 59 | { 60 | return m_id; 61 | } 62 | 63 | DVRServer* DVRCameraData::server() const 64 | { 65 | return m_server; 66 | } 67 | 68 | QString DVRCameraData::displayName() const 69 | { 70 | return m_displayName; 71 | } 72 | 73 | bool DVRCameraData::disabled() const 74 | { 75 | return m_disabled; 76 | } 77 | 78 | qint8 DVRCameraData::ptzProtocol() const 79 | { 80 | return m_ptzProtocol; 81 | } 82 | -------------------------------------------------------------------------------- /src/camera/DVRCameraData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRCAMERADATA_H 19 | #define DVRCAMERADATA_H 20 | 21 | #include 22 | #include 23 | 24 | class DVRServer; 25 | 26 | class DVRCameraData : public QObject 27 | { 28 | Q_OBJECT 29 | Q_DISABLE_COPY(DVRCameraData) 30 | 31 | public: 32 | explicit DVRCameraData(int id, DVRServer *server); 33 | virtual ~DVRCameraData(); 34 | 35 | int id() const; 36 | DVRServer * server() const; 37 | 38 | QString displayName() const; 39 | void setDisplayName(const QString &displayName); 40 | 41 | bool disabled() const; 42 | void setDisabled(bool disabled); 43 | 44 | qint8 ptzProtocol() const; 45 | void setPtzProtocol(qint8 ptzProtocol); 46 | 47 | signals: 48 | void changed(); 49 | 50 | private: 51 | const int m_id; 52 | DVRServer * const m_server; 53 | QString m_displayName; 54 | bool m_disabled; 55 | qint8 m_ptzProtocol; 56 | 57 | }; 58 | 59 | #endif // DVRCAMERADATA_H 60 | -------------------------------------------------------------------------------- /src/camera/DVRCameraSettingsReader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "DVRCamera.h" 19 | #include "DVRCameraSettingsReader.h" 20 | #include "server/DVRServer.h" 21 | #include 22 | 23 | DVRCamera * DVRCameraSettingsReader::readCamera(int cameraId, DVRServer *server) const 24 | { 25 | Q_ASSERT(server); 26 | Q_ASSERT(cameraId >= 0); 27 | 28 | DVRCamera *camera = new DVRCamera(cameraId, server); 29 | 30 | QSettings settings; 31 | camera->data().setDisplayName(settings.value(QString::fromLatin1("servers/%1/cameras/%2").arg(server->configuration().id()).arg(cameraId)).toString()); 32 | 33 | return camera; 34 | } 35 | -------------------------------------------------------------------------------- /src/camera/DVRCameraSettingsReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRCAMERASETTINGSREADER_H 19 | #define DVRCAMERASETTINGSREADER_H 20 | 21 | #include 22 | 23 | class DVRCamera; 24 | class DVRServer; 25 | 26 | class DVRCameraSettingsReader 27 | { 28 | public: 29 | DVRCamera * readCamera(int cameraId, DVRServer *server) const; 30 | 31 | }; 32 | 33 | #endif // DVRCAMERASETTINGSREADER_H 34 | -------------------------------------------------------------------------------- /src/camera/DVRCameraSettingsWriter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "DVRCamera.h" 19 | #include "DVRCameraSettingsWriter.h" 20 | #include "server/DVRServer.h" 21 | #include 22 | 23 | void DVRCameraSettingsWriter::writeCamera(DVRCamera *camera) const 24 | { 25 | Q_ASSERT(camera); 26 | Q_ASSERT(camera->data().server()); 27 | 28 | int serverId = camera->data().server()->configuration().id(); 29 | Q_ASSERT(serverId >= 0); 30 | 31 | QSettings settings; 32 | settings.beginGroup(QString::fromLatin1("servers/%1/cameras/").arg(serverId)); 33 | settings.setValue(QString::number(camera->data().id()), camera->data().displayName()); 34 | } 35 | -------------------------------------------------------------------------------- /src/camera/DVRCameraSettingsWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRCAMERASETTINGSWRITER_H 19 | #define DVRCAMERASETTINGSWRITER_H 20 | 21 | #include 22 | 23 | class DVRCamera; 24 | 25 | class DVRCameraSettingsWriter 26 | { 27 | public: 28 | void writeCamera(DVRCamera *camera) const; 29 | 30 | }; 31 | 32 | #endif // DVRCAMERASETTINGSWRITER_H 33 | -------------------------------------------------------------------------------- /src/camera/DVRCameraStreamReader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "camera/DVRCamera.h" 19 | #include "server/DVRServer.h" 20 | #include "server/DVRServerRepository.h" 21 | #include "DVRCameraStreamReader.h" 22 | #include 23 | 24 | DVRCameraStreamReader::DVRCameraStreamReader(DVRServerRepository *serverRepository, QDataStream &dataStream) 25 | : m_serverRepository(serverRepository), m_dataStream(dataStream) 26 | { 27 | Q_ASSERT(m_serverRepository); 28 | } 29 | 30 | DVRCamera * DVRCameraStreamReader::readCamera() 31 | { 32 | int serverId = -1; 33 | m_dataStream >> serverId; 34 | 35 | if (m_dataStream.status() != QDataStream::Ok || serverId < 0) 36 | return 0; 37 | 38 | int cameraId = -1; 39 | m_dataStream >> cameraId; 40 | return getCamera(serverId, cameraId); 41 | } 42 | 43 | DVRCamera * DVRCameraStreamReader::getCamera(int serverID, int cameraID) 44 | { 45 | DVRServer *server = m_serverRepository->serverByID(serverID); 46 | if (!server) 47 | return 0; 48 | 49 | return server->getCamera(cameraID); 50 | } 51 | -------------------------------------------------------------------------------- /src/camera/DVRCameraStreamReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRCAMERASTREAMREADER_H 19 | #define DVRCAMERASTREAMREADER_H 20 | 21 | class QDataStream; 22 | class DVRCamera; 23 | class DVRServerRepository; 24 | 25 | class DVRCameraStreamReader 26 | { 27 | public: 28 | explicit DVRCameraStreamReader(DVRServerRepository *serverRepository, QDataStream &dataStream); 29 | 30 | DVRCamera * readCamera(); 31 | 32 | private: 33 | DVRServerRepository *m_serverRepository; 34 | QDataStream &m_dataStream; 35 | 36 | DVRCamera * getCamera(int serverID, int cameraID); 37 | 38 | }; 39 | 40 | #endif // DVRCAMERASTREAMREADER_H 41 | -------------------------------------------------------------------------------- /src/camera/DVRCameraStreamWriter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "camera/DVRCamera.h" 19 | #include "server/DVRServer.h" 20 | #include "server/DVRServerConfiguration.h" 21 | #include "DVRCameraStreamWriter.h" 22 | #include 23 | 24 | DVRCameraStreamWriter::DVRCameraStreamWriter(QDataStream &dataStream) 25 | : m_dataStream(dataStream) 26 | { 27 | } 28 | 29 | void DVRCameraStreamWriter::writeCamera(DVRCamera *camera) 30 | { 31 | if (!camera) 32 | m_dataStream << (qint32)-1; 33 | else 34 | m_dataStream << (qint32) camera->data().server()->configuration().id() << (qint32)camera->data().id(); 35 | } 36 | -------------------------------------------------------------------------------- /src/camera/DVRCameraStreamWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRCAMERASTREAMWRITER_H 19 | #define DVRCAMERASTREAMWRITER_H 20 | 21 | class QDataStream; 22 | class DVRCamera; 23 | 24 | class DVRCameraStreamWriter 25 | { 26 | public: 27 | explicit DVRCameraStreamWriter(QDataStream &dataStream); 28 | 29 | void writeCamera(DVRCamera *camera); 30 | 31 | private: 32 | QDataStream &m_dataStream; 33 | 34 | }; 35 | 36 | #endif // DVRCAMERASTREAMWRITER_H 37 | -------------------------------------------------------------------------------- /src/camera/DVRCameraXMLReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVR_CAMERA_XML_READER_H 19 | #define DVR_CAMERA_XML_READER_H 20 | 21 | #include 22 | 23 | class DVRCamera; 24 | 25 | class DVRCameraXMLReader 26 | { 27 | public: 28 | bool readCamera(DVRCamera *camera, QXmlStreamReader &xmlStreamReader) const; 29 | 30 | }; 31 | 32 | #endif // DVR_CAMERA_XML_READER_H 33 | -------------------------------------------------------------------------------- /src/camera/RecordingState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef RECORDINGSTATE_H 19 | #define RECORDINGSTATE_H 20 | 21 | enum RecordingState { 22 | NoRecording = 0, 23 | Continuous, 24 | MotionInactive, 25 | MotionActive 26 | }; 27 | 28 | #endif // RECORDINGSTATE_H 29 | -------------------------------------------------------------------------------- /src/core/LanguageController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef LANGUAGECONTROLLER_H 19 | #define LANGUAGECONTROLLER_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | class LanguageController 27 | { 28 | public: 29 | LanguageController(); 30 | 31 | void setTranslationFilesPaths(const QStringList &paths); 32 | 33 | QMap supportedLanguages(); 34 | void loadLanguage(const QString &languageCode); 35 | 36 | bool supportsLanguage(const QString &languageCode); 37 | 38 | QString currentLanguage() const { return m_currentLanguageCode; } 39 | 40 | private: 41 | void loadLanguages(); 42 | void switchTranslator(QTranslator &translator, const QString &filename, const QString &directory); 43 | 44 | QStringList m_paths; 45 | mutable QMap m_languages; 46 | mutable QMap m_languagesPaths; 47 | QString m_currentLanguageCode; 48 | 49 | QTranslator m_appTranslator; 50 | QTranslator m_QtTranslator; 51 | 52 | }; 53 | 54 | #endif // LANGUAGECONTROLLER_H 55 | -------------------------------------------------------------------------------- /src/core/LiveStream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "LiveStream.h" 19 | 20 | LiveStream::LiveStream(QObject *parent) : 21 | QObject(parent) 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /src/core/LiveViewManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef LIVEVIEWMANAGER_H 19 | #define LIVEVIEWMANAGER_H 20 | 21 | #include 22 | 23 | class LiveStream; 24 | class QAction; 25 | 26 | class LiveViewManager : public QObject 27 | { 28 | Q_OBJECT 29 | Q_ENUMS(BandwidthMode) 30 | 31 | Q_PROPERTY(int bandwidthMode READ bandwidthMode WRITE setBandwidthMode NOTIFY bandwidthModeChanged) 32 | 33 | public: 34 | enum BandwidthMode 35 | { 36 | FullBandwidth, 37 | LowBandwidth 38 | }; 39 | 40 | explicit LiveViewManager(QObject *parent = 0); 41 | 42 | QList streams() const; 43 | 44 | BandwidthMode bandwidthMode() const { return m_bandwidthMode; } 45 | 46 | QList bandwidthActions(int currentMode, QObject *target, const char *slot) const; 47 | 48 | public slots: 49 | void setBandwidthMode(int value); 50 | void setBandwidthModeFromAction(); 51 | 52 | signals: 53 | void bandwidthModeChanged(int value); 54 | 55 | private: 56 | QList m_streams; 57 | BandwidthMode m_bandwidthMode; 58 | 59 | friend class RtspStream; 60 | friend class MJpegStream; 61 | 62 | void addStream(LiveStream *stream); 63 | void removeStream(LiveStream *stream); 64 | void switchAudio(LiveStream *stream); 65 | }; 66 | 67 | #endif // LIVEVIEWMANAGER_H 68 | -------------------------------------------------------------------------------- /src/core/LoggableUrl.cpp: -------------------------------------------------------------------------------- 1 | #include "LoggableUrl.h" 2 | 3 | #include 4 | 5 | LoggableUrl::LoggableUrl(const QUrl &url) : 6 | m_url(url) 7 | { 8 | } 9 | 10 | LoggableUrl::LoggableUrl(const LoggableUrl ©Me) 11 | { 12 | *this = copyMe; 13 | } 14 | 15 | LoggableUrl & LoggableUrl::operator = (const LoggableUrl ©Me) 16 | { 17 | m_url = copyMe.m_url; 18 | 19 | return *this; 20 | } 21 | 22 | void LoggableUrl::setUrl(const QUrl &url) 23 | { 24 | m_url = url; 25 | } 26 | 27 | QUrl LoggableUrl::url() const 28 | { 29 | return m_url; 30 | } 31 | 32 | QDebug & operator << (QDebug &debug, const LoggableUrl &loggableUrl) 33 | { 34 | QUrl urlWithHiddenPassword = loggableUrl.url(); 35 | urlWithHiddenPassword.setPassword(QLatin1String("***")); 36 | debug << urlWithHiddenPassword.toString(); 37 | 38 | return debug; 39 | } 40 | -------------------------------------------------------------------------------- /src/core/LoggableUrl.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGGABLE_URL_H 2 | #define LOGGABLE_URL_H 3 | 4 | #include 5 | 6 | class QDebug; 7 | 8 | class LoggableUrl 9 | { 10 | 11 | public: 12 | explicit LoggableUrl(const QUrl &url); 13 | LoggableUrl(const LoggableUrl ©Me); 14 | 15 | LoggableUrl & operator = (const LoggableUrl ©Me); 16 | 17 | void setUrl(const QUrl &url); 18 | QUrl url() const; 19 | 20 | private: 21 | QUrl m_url; 22 | 23 | }; 24 | 25 | QDebug & operator << (QDebug &debug, const LoggableUrl &loggableUrl); 26 | 27 | #endif // LOGGABLE_URL_H 28 | -------------------------------------------------------------------------------- /src/core/PtzPresetsModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef PTZPRESETSMODEL_H 19 | #define PTZPRESETSMODEL_H 20 | 21 | #include 22 | 23 | class CameraPtzControl; 24 | 25 | class PtzPresetsModel : public QAbstractListModel 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | enum 31 | { 32 | PresetIdRole = Qt::UserRole 33 | }; 34 | 35 | explicit PtzPresetsModel(QObject *parent = 0); 36 | 37 | void setPtzController(CameraPtzControl *ptzController); 38 | 39 | virtual int rowCount(const QModelIndex &parent) const; 40 | virtual Qt::ItemFlags flags(const QModelIndex &index) const; 41 | virtual QVariant data(const QModelIndex &index, int role) const; 42 | virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; 43 | virtual bool setData(const QModelIndex &index, const QVariant &value, int role); 44 | 45 | private slots: 46 | void updatePresets(); 47 | void updateCurrentPreset(); 48 | void clearPtzController() { setPtzController(0); } 49 | 50 | private: 51 | CameraPtzControl *m_ptz; 52 | QList > m_presets; 53 | }; 54 | 55 | #endif // PTZPRESETSMODEL_H 56 | -------------------------------------------------------------------------------- /src/core/ThreadPause.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "ThreadPause.h" 19 | #include 20 | 21 | ThreadPause::ThreadPause() : m_paused(false) 22 | { 23 | } 24 | 25 | ThreadPause::~ThreadPause() 26 | { 27 | setPaused(false); 28 | } 29 | 30 | void ThreadPause::setPaused(bool paused) 31 | { 32 | QMutexLocker mutexLocked(&m_pauseMutex); 33 | 34 | if (paused == m_paused) 35 | return; 36 | 37 | m_paused = paused; 38 | if (!m_paused) 39 | m_pauseWaitCondition.wakeOne(); 40 | } 41 | 42 | bool ThreadPause::shouldPause() 43 | { 44 | QMutexLocker mutexLocked(&m_pauseMutex); 45 | 46 | return m_paused; 47 | } 48 | 49 | void ThreadPause::pause() 50 | { 51 | m_pauseWaitConditionMutex.lock(); 52 | m_pauseWaitCondition.wait(&m_pauseWaitConditionMutex); 53 | m_pauseWaitConditionMutex.unlock(); 54 | } 55 | -------------------------------------------------------------------------------- /src/core/ThreadPause.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef THREAD_PAUSE_H 19 | #define THREAD_PAUSE_H 20 | 21 | #include 22 | #include 23 | 24 | class ThreadPause 25 | { 26 | public: 27 | ThreadPause(); 28 | ~ThreadPause(); 29 | 30 | void setPaused(bool paused); 31 | bool shouldPause(); 32 | void pause(); 33 | 34 | private: 35 | volatile bool m_paused; 36 | QMutex m_pauseMutex; 37 | QMutex m_pauseWaitConditionMutex; 38 | QWaitCondition m_pauseWaitCondition; 39 | 40 | }; 41 | 42 | #endif // THREAD_PAUSE_H 43 | -------------------------------------------------------------------------------- /src/core/TransferRateCalculator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "TransferRateCalculator.h" 19 | #include 20 | 21 | TransferRateCalculator::TransferRateCalculator(QObject *parent) 22 | : QObject(parent), m_nextSample(0), m_nSample(0) 23 | { 24 | memset(m_samples, 0, sizeof(m_samples)); 25 | } 26 | 27 | void TransferRateCalculator::addSampleValue(unsigned bytes) 28 | { 29 | Q_ASSERT(bytes < 0x80000000); 30 | m_nextSample.fetchAndAddAcquire((int)bytes); 31 | if (!m_timer.isActive()) 32 | m_timer.start(interval, this); 33 | } 34 | 35 | unsigned TransferRateCalculator::currentRate() 36 | { 37 | unsigned r = 0; 38 | for (int i = 0; i < sampleCount; ++i) 39 | r += m_samples[i]; 40 | return r/sampleCount; 41 | } 42 | 43 | void TransferRateCalculator::timerEvent(QTimerEvent *) 44 | { 45 | m_samples[m_nSample] = m_nextSample; 46 | m_nextSample = 0; 47 | if (++m_nSample == sampleCount) 48 | m_nSample = 0; 49 | 50 | unsigned r = currentRate(); 51 | if (!r) 52 | m_timer.stop(); 53 | emit rateUpdated(r); 54 | } 55 | -------------------------------------------------------------------------------- /src/core/TransferRateCalculator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef TRANSFERRATECALCULATOR_H 19 | #define TRANSFERRATECALCULATOR_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | class TransferRateCalculator : public QObject 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(unsigned currentRate READ currentRate NOTIFY rateUpdated) 29 | 30 | public: 31 | TransferRateCalculator(QObject *parent = 0); 32 | 33 | /* Current transfer rate in bytes per second */ 34 | unsigned currentRate(); 35 | 36 | public slots: 37 | /* Record that x bytes have been added since the last sample. This 38 | * function is threadsafe, if you can guarantee that the instance will 39 | * not be destroyed. */ 40 | void addSampleValue(unsigned bytes); 41 | 42 | signals: 43 | void rateUpdated(unsigned currentRate); 44 | 45 | protected: 46 | virtual void timerEvent(QTimerEvent *ev); 47 | 48 | private: 49 | static const int interval = 750; 50 | static const int sampleCount = (3*(1000/interval)); 51 | 52 | QBasicTimer m_timer; 53 | QAtomicInt m_nextSample; 54 | unsigned m_samples[sampleCount]; 55 | qint8 m_nSample; 56 | 57 | void startTimer(); 58 | 59 | }; 60 | 61 | #endif // TRANSFERRATECALCULATOR_H 62 | -------------------------------------------------------------------------------- /src/core/UpdateChecker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef UPDATECHECKER_H 19 | #define UPDATECHECKER_H 20 | 21 | #include "core/Version.h" 22 | #include 23 | 24 | class QNetworkAccessManager; 25 | class QTimer; 26 | 27 | class UpdateChecker : public QObject 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit UpdateChecker(QNetworkAccessManager *networkAccessManager, QObject *parent = 0); 33 | virtual ~UpdateChecker(); 34 | 35 | void start(int interval); 36 | void stop(); 37 | 38 | signals: 39 | void newVersionAvailable(const Version &newVersion); 40 | 41 | private slots: 42 | void performVersionCheck(); 43 | void versionInfoReceived(); 44 | 45 | private: 46 | QNetworkAccessManager *m_networkAccessManager; 47 | QTimer *m_timer; 48 | bool m_doingUpdateCheck; 49 | 50 | }; 51 | 52 | #endif // UPDATECHECKER_H 53 | -------------------------------------------------------------------------------- /src/core/VaapiHWAccel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef VAAPIHWACCEL_H 19 | #define VAAPIHWACCEL_H 20 | 21 | #include 22 | 23 | #if defined(Q_OS_LINUX) 24 | 25 | extern "C" 26 | { 27 | #include 28 | #include 29 | #include 30 | #include 31 | } 32 | 33 | class VaapiHWAccel 34 | { 35 | 36 | public: 37 | VaapiHWAccel(); 38 | ~VaapiHWAccel(); 39 | 40 | bool isAvailable() {return m_available;} 41 | 42 | //AVCodecContext callbacks 43 | static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts); 44 | static int decoderInit(AVCodecContext *s); 45 | static int retrieveData(AVCodecContext *s, AVFrame *input); 46 | private: 47 | static VaapiHWAccel *m_instance; 48 | 49 | bool m_available; 50 | AVBufferRef *m_hw_device_ctx; 51 | 52 | }; 53 | #endif 54 | 55 | #endif // VAAPIHWACCEL_H 56 | -------------------------------------------------------------------------------- /src/core/Version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef VERSION_H 19 | #define VERSION_H 20 | 21 | #include 22 | 23 | class Version 24 | { 25 | 26 | public: 27 | static Version fromString(const QString &string); 28 | 29 | explicit Version(quint16 major, quint16 minor, quint16 fix, const QString &spec); 30 | 31 | Version(); 32 | Version(const Version ©Me); 33 | 34 | Version operator = (const Version ©Me); 35 | bool operator > (const Version &compareTo) const; 36 | 37 | bool isValid() const; 38 | QString toString() const; 39 | 40 | quint16 major() const; 41 | quint16 minor() const; 42 | quint16 fix() const; 43 | QString spec() const; 44 | 45 | private: 46 | quint16 m_major; 47 | quint16 m_minor; 48 | quint16 m_fix; 49 | QString m_spec; 50 | 51 | }; 52 | 53 | #endif // VERSION_H 54 | -------------------------------------------------------------------------------- /src/event/CameraEventFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "CameraEventFilter.h" 19 | #include "core/EventData.h" 20 | 21 | CameraEventFilter::CameraEventFilter() 22 | { 23 | } 24 | 25 | CameraEventFilter::~CameraEventFilter() 26 | { 27 | } 28 | 29 | bool CameraEventFilter::accept(const EventData &event) const 30 | { 31 | return event.isCamera(); 32 | } 33 | -------------------------------------------------------------------------------- /src/event/CameraEventFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef CAMERAEVENTFILTER_H 19 | #define CAMERAEVENTFILTER_H 20 | 21 | #include "EventFilter.h" 22 | 23 | class CameraEventFilter : public EventFilter 24 | { 25 | public: 26 | CameraEventFilter(); 27 | virtual ~CameraEventFilter(); 28 | 29 | virtual bool accept(const EventData &event) const; 30 | }; 31 | 32 | #endif // CAMERAEVENTFILTER_H 33 | -------------------------------------------------------------------------------- /src/event/EventFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "EventFilter.h" 19 | 20 | EventFilter::EventFilter() 21 | { 22 | } 23 | 24 | EventFilter::~EventFilter() 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /src/event/EventFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTFILTER_H 19 | #define EVENTFILTER_H 20 | 21 | class EventData; 22 | 23 | class EventFilter 24 | { 25 | public: 26 | EventFilter(); 27 | virtual ~EventFilter(); 28 | 29 | virtual bool accept(const EventData &event) const = 0; 30 | }; 31 | 32 | #endif // EVENTFILTER_H 33 | -------------------------------------------------------------------------------- /src/event/EventList.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "EventList.h" 19 | #include "camera/DVRCamera.h" 20 | #include "event/EventFilter.h" 21 | #include 22 | 23 | EventList EventList::filter(const EventFilter &eventFilter) const 24 | { 25 | EventList result; 26 | foreach (const EventData &event, *this) 27 | if (eventFilter.accept(event)) 28 | result.append(event); 29 | return result; 30 | } 31 | 32 | QSet EventList::cameras() const 33 | { 34 | QSet result; 35 | foreach (const EventData &cameraEventData, *this) 36 | { 37 | DVRCamera *camera = cameraEventData.locationCamera(); 38 | if (camera) 39 | result.insert(camera); 40 | } 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /src/event/EventList.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTLIST_H 19 | #define EVENTLIST_H 20 | 21 | #include "core/EventData.h" 22 | #include 23 | 24 | class EventFilter; 25 | 26 | class EventList : public QList 27 | { 28 | public: 29 | EventList filter(const EventFilter &eventFilter) const; 30 | QSet cameras() const; 31 | }; 32 | 33 | #endif // EVENTLIST_H 34 | -------------------------------------------------------------------------------- /src/event/EventParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTPARSER_H 19 | #define EVENTPARSER_H 20 | 21 | #include 22 | 23 | class DVRServer; 24 | class EventData; 25 | class QXmlStreamReader; 26 | 27 | class EventParser 28 | { 29 | public: 30 | static QList > parseEvents(DVRServer *server, const QByteArray &input); 31 | 32 | private: 33 | static EventData * parseEntry(DVRServer *server, QXmlStreamReader &reader); 34 | 35 | }; 36 | 37 | #endif // EVENTPARSER_H 38 | -------------------------------------------------------------------------------- /src/event/EventsCursor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "EventsCursor.h" 19 | 20 | EventsCursor::EventsCursor(QObject *parent) 21 | : QObject(parent) 22 | { 23 | } 24 | 25 | EventsCursor::~EventsCursor() 26 | { 27 | } 28 | 29 | void EventsCursor::emitAvailabilitySignals() 30 | { 31 | emit previousAvailabilityChanged(hasPrevious()); 32 | emit nextAvailabilityChanged(hasNext()); 33 | } 34 | -------------------------------------------------------------------------------- /src/event/EventsCursor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTSCURSOR_H 19 | #define EVENTSCURSOR_H 20 | 21 | #include 22 | 23 | class EventData; 24 | 25 | class EventsCursor : public QObject 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit EventsCursor(QObject *parent = 0); 31 | virtual ~EventsCursor(); 32 | 33 | virtual EventData * current() const = 0; 34 | virtual bool hasNext() = 0; 35 | virtual bool hasPrevious() = 0; 36 | 37 | public slots: 38 | virtual void moveToNext() = 0; 39 | virtual void moveToPrevious() = 0; 40 | 41 | signals: 42 | void eventSwitched(EventData *event); 43 | 44 | void nextAvailabilityChanged(bool hasNext); 45 | void previousAvailabilityChanged(bool hasPrevious); 46 | 47 | protected slots: 48 | void emitAvailabilitySignals(); 49 | }; 50 | 51 | #endif // EVENTSCURSOR_H 52 | -------------------------------------------------------------------------------- /src/event/EventsLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTSLOADER_H 19 | #define EVENTSLOADER_H 20 | 21 | #include 22 | #include 23 | #include "server/DVRServer.h" 24 | 25 | class EventData; 26 | 27 | class EventsLoader : public QObject 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit EventsLoader(DVRServer *server, QObject *parent = 0); 33 | virtual ~EventsLoader(); 34 | 35 | DVRServer * server() const { return m_server.data(); } 36 | 37 | void setLimit(int limit); 38 | void setStartTime(const QDateTime &startTime); 39 | void setEndTime(const QDateTime &endTime); 40 | void setLastId(int lastId); 41 | 42 | void loadEvents(); 43 | 44 | signals: 45 | void eventsLoaded(DVRServer *server, bool ok, const QList > &events); 46 | 47 | private slots: 48 | void serverRequestFinished(); 49 | void eventParseFinished(); 50 | 51 | private: 52 | QWeakPointer m_server; 53 | int m_limit; 54 | QDateTime m_startTime; 55 | QDateTime m_endTime; 56 | int m_lastId; 57 | 58 | }; 59 | 60 | #endif // EVENTSLOADER_H 61 | -------------------------------------------------------------------------------- /src/event/EventsUpdater.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTS_UPDATER_H 19 | #define EVENTS_UPDATER_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | class DVRServer; 27 | class DVRServerRepository; 28 | class EventData; 29 | 30 | class EventsUpdater : public QObject 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit EventsUpdater(DVRServerRepository *serverRepository, QObject *parent = 0); 36 | virtual ~EventsUpdater(); 37 | 38 | bool isUpdating() const; 39 | 40 | public slots: 41 | void setUpdateInterval(int miliseconds); 42 | void setLimit(int limit); 43 | void setDay(const QDate &date); 44 | void setTimeRange(const QDateTime &from, const QDateTime &to); 45 | 46 | void updateServer(DVRServer *server); 47 | void updateServers(); 48 | 49 | signals: 50 | void loadingStarted(); 51 | void loadingFinished(); 52 | 53 | void serverEventsAvailable(DVRServer *server, const QList > &events); 54 | 55 | private slots: 56 | void serverAdded(DVRServer *server); 57 | void eventsLoaded(DVRServer *server, bool ok, const QList > &events); 58 | 59 | private: 60 | DVRServerRepository *m_serverRepository; 61 | QSet m_updatingServers; 62 | 63 | QTimer m_updateTimer; 64 | int m_limit; 65 | QDateTime m_startTime; 66 | QDateTime m_endTime; 67 | 68 | }; 69 | 70 | #endif // EVENTS_UPDATER_H 71 | -------------------------------------------------------------------------------- /src/event/MediaEventFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "MediaEventFilter.h" 19 | #include "core/EventData.h" 20 | 21 | MediaEventFilter::MediaEventFilter() 22 | { 23 | } 24 | 25 | MediaEventFilter::~MediaEventFilter() 26 | { 27 | } 28 | 29 | bool MediaEventFilter::accept(const EventData &event) const 30 | { 31 | return event.hasMedia(); 32 | } 33 | -------------------------------------------------------------------------------- /src/event/MediaEventFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MEDIAEVENTFILTER_H 19 | #define MEDIAEVENTFILTER_H 20 | 21 | #include "EventFilter.h" 22 | 23 | class MediaEventFilter : public EventFilter 24 | { 25 | public: 26 | MediaEventFilter(); 27 | virtual ~MediaEventFilter(); 28 | 29 | virtual bool accept(const EventData &event) const; 30 | }; 31 | 32 | #endif // MEDIAEVENTFILTER_H 33 | -------------------------------------------------------------------------------- /src/event/ModelEventsCursor.h: -------------------------------------------------------------------------------- 1 | #ifndef MODELEVENTSCURSOR_H 2 | #define MODELEVENTSCURSOR_H 3 | 4 | #include "event/EventsCursor.h" 5 | #include "camera/DVRCamera.h" 6 | #include 7 | 8 | class QAbstractItemModel; 9 | 10 | class ModelEventsCursor : public EventsCursor 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit ModelEventsCursor(QObject *parent = 0); 16 | virtual ~ModelEventsCursor(); 17 | 18 | virtual EventData * current() const; 19 | virtual bool hasNext(); 20 | virtual bool hasPrevious(); 21 | virtual void moveToNext(); 22 | virtual void moveToPrevious(); 23 | 24 | void setModel(QAbstractItemModel *model); 25 | QAbstractItemModel * model() const { return m_model; } 26 | 27 | void setCameraFilter(DVRCamera *cameraFilter); 28 | DVRCamera * cameraFilter() const { return m_cameraFilter.data(); } 29 | 30 | void setIndex(int index); 31 | int index() const { return m_index; } 32 | 33 | signals: 34 | void indexUpdated(); 35 | 36 | private slots: 37 | void modelReset(); 38 | void rowsInserted(const QModelIndex &parent, int start, int end); 39 | void rowsMoved(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild); 40 | void rowsRemoved(const QModelIndex &parent, int start, int end); 41 | 42 | void modelDestroyed(); 43 | 44 | private: 45 | QWeakPointer m_cameraFilter; 46 | QAbstractItemModel *m_model; 47 | int m_index; 48 | int m_cachedNextIndex; 49 | int m_cachedPreviousIndex; 50 | 51 | bool invert() const; 52 | int nextIndex(int currentIndex) const; 53 | int previousIndex(int currentIndex) const; 54 | 55 | bool isValidIndex(int index) const; 56 | bool acceptIndex(int index) const; 57 | void invalidateIndexCache(); 58 | void computeNextIndex(); 59 | void computePreviousIndex(); 60 | 61 | bool indexNotMoved(int index, int sourceFirst, int sourceLast, int destinationChild) const; 62 | 63 | bool indexDirectlyMoved(int index, int sourceFirst, int sourceLast) const; 64 | int indexAfterDirectMove(int index, int sourceLast, int destinationChild) const; 65 | }; 66 | 67 | #endif // MODELEVENTSCURSOR_H 68 | -------------------------------------------------------------------------------- /src/event/ThumbnailManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef THUMBNAILMANAGER_H 19 | #define THUMBNAILMANAGER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | 27 | class DVRServer; 28 | class DVRServerRepository; 29 | class EventData; 30 | class QString; 31 | 32 | struct ThumbnailData; 33 | 34 | class ThumbnailManager : public QObject 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | 40 | enum Status 41 | { 42 | Unknown, 43 | Available, 44 | Loading, 45 | NotFound 46 | }; 47 | 48 | explicit ThumbnailManager(QObject *parent = 0); 49 | ~ThumbnailManager(); 50 | 51 | Status getThumbnail(const EventData *event, QString &imgPath); 52 | 53 | private: 54 | 55 | QMap m_thumbnails; 56 | QString thumbnailFilePath(const QString &keyStr); 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/network/MediaDownloadManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MEDIADOWNLOADMANAGER_H 19 | #define MEDIADOWNLOADMANAGER_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | class MediaDownload; 27 | class QNetworkCookieJar; 28 | 29 | class MediaDownloadManager : public QObject 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit MediaDownloadManager(QObject *parent = 0); 35 | virtual ~MediaDownloadManager(); 36 | 37 | QNetworkCookieJar *cookieJar() const { return m_cookieJar; } 38 | void setCookieJar(QNetworkCookieJar *cookieJar); 39 | 40 | MediaDownload * acquireMediaDownload(const QUrl &url); 41 | void releaseMediaDownload(const QUrl &url); 42 | 43 | private: 44 | QMap m_mediaDownloads; 45 | QMutex m_mapMutex; 46 | QNetworkCookieJar *m_cookieJar; 47 | 48 | MediaDownload * getOrCreate(const QUrl &url); 49 | }; 50 | 51 | #endif // MEDIADOWNLOADMANAGER_H 52 | -------------------------------------------------------------------------------- /src/network/RemotePortChecker.cpp: -------------------------------------------------------------------------------- 1 | #include "RemotePortChecker.h" 2 | #include "network/SocketError.h" 3 | #include 4 | #include 5 | 6 | RemotePortChecker::RemotePortChecker(const QString &name, quint16 port, QObject *parent) 7 | : QObject(parent), m_name(name), m_port(port) 8 | { 9 | QTimer::singleShot(0, this, SLOT(checkNow())); 10 | } 11 | 12 | RemotePortChecker::~RemotePortChecker() 13 | { 14 | } 15 | 16 | bool RemotePortChecker::isValid() const 17 | { 18 | return m_port != 0 && !m_name.isEmpty(); 19 | } 20 | 21 | void RemotePortChecker::checkNow() 22 | { 23 | if (!isValid()) 24 | { 25 | emit notAvailable(tr("Invalid server address")); 26 | return; 27 | } 28 | 29 | if (m_tcpSocket) 30 | m_tcpSocket->disconnect(this); 31 | 32 | m_tcpSocket.reset(new QTcpSocket()); 33 | connect(m_tcpSocket.data(), SIGNAL(connected()), 34 | this, SLOT(socketConnected()), Qt::QueuedConnection); 35 | connect(m_tcpSocket.data(), SIGNAL(error(QAbstractSocket::SocketError)), 36 | this, SLOT(socketError(QAbstractSocket::SocketError)), Qt::QueuedConnection); 37 | m_tcpSocket->connectToHost(m_name, m_port); 38 | } 39 | 40 | void RemotePortChecker::socketConnected() 41 | { 42 | emit available(); 43 | } 44 | 45 | void RemotePortChecker::socketError(QAbstractSocket::SocketError socketError) 46 | { 47 | emit notAvailable(SocketError::toString(socketError)); 48 | } 49 | -------------------------------------------------------------------------------- /src/network/RemotePortChecker.h: -------------------------------------------------------------------------------- 1 | #ifndef REMOTEPORTCHECKER_H 2 | #define REMOTEPORTCHECKER_H 3 | 4 | #include 5 | #include 6 | 7 | class RemotePortChecker : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | explicit RemotePortChecker(const QString &name, quint16 port, QObject *parent = 0); 13 | virtual ~RemotePortChecker(); 14 | 15 | QString name() const { return m_name; } 16 | quint16 port() const { return m_port; } 17 | 18 | signals: 19 | void available(); 20 | void notAvailable(const QString &errorMessage); 21 | 22 | private slots: 23 | void checkNow(); 24 | void socketConnected(); 25 | void socketError(QAbstractSocket::SocketError socketError); 26 | 27 | private: 28 | QScopedPointer m_tcpSocket; 29 | QString m_name; 30 | quint16 m_port; 31 | 32 | bool isValid() const; 33 | }; 34 | 35 | #endif // REMOTEPORTCHECKER_H 36 | -------------------------------------------------------------------------------- /src/network/SocketError.h: -------------------------------------------------------------------------------- 1 | #ifndef SOCKETERROR_H 2 | #define SOCKETERROR_H 3 | 4 | #include 5 | 6 | class SocketError 7 | { 8 | Q_DISABLE_COPY(SocketError) 9 | 10 | public: 11 | static QString toString(QAbstractSocket::SocketError socketError); 12 | 13 | private: 14 | SocketError() {} 15 | }; 16 | 17 | #endif // SOCKETERROR_H 18 | -------------------------------------------------------------------------------- /src/rtsp-stream/RtspStreamFrame.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "RtspStreamFrame.h" 19 | 20 | extern "C" { 21 | # include "libavformat/avformat.h" 22 | } 23 | 24 | RtspStreamFrame::RtspStreamFrame(AVFrame *avFrame, int width, int height) 25 | : m_avFrame(avFrame), m_streamWidth(width), m_streamHeight(height) 26 | { 27 | Q_ASSERT(m_avFrame); 28 | } 29 | 30 | RtspStreamFrame::~RtspStreamFrame() 31 | { 32 | av_free(m_avFrame->data[0]); 33 | av_frame_free(&m_avFrame); 34 | } 35 | 36 | AVFrame * RtspStreamFrame::avFrame() const 37 | { 38 | return m_avFrame; 39 | } 40 | -------------------------------------------------------------------------------- /src/rtsp-stream/RtspStreamFrame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef RTSP_STREAM_FRAME_H 19 | #define RTSP_STREAM_FRAME_H 20 | 21 | #include 22 | 23 | struct AVFrame; 24 | 25 | class RtspStreamFrame 26 | { 27 | Q_DISABLE_COPY(RtspStreamFrame); 28 | 29 | public: 30 | explicit RtspStreamFrame(AVFrame *avFrame, int width, int height); 31 | ~RtspStreamFrame(); 32 | 33 | AVFrame * avFrame() const; 34 | int width() { return m_streamWidth; } 35 | int height() { return m_streamHeight; } 36 | 37 | private: 38 | AVFrame *m_avFrame; 39 | int m_streamWidth; 40 | int m_streamHeight; 41 | }; 42 | 43 | #endif // RTSP_STREAM_FRAME_H 44 | -------------------------------------------------------------------------------- /src/rtsp-stream/RtspStreamFrameFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef RTSP_STREAM_FRAME_FORMATTER_H 19 | #define RTSP_STREAM_FRAME_FORMATTER_H 20 | 21 | extern "C" { 22 | # include "libavutil/pixfmt.h" 23 | } 24 | 25 | class RtspStreamFrame; 26 | struct AVFrame; 27 | struct AVStream; 28 | 29 | struct SwsContext; 30 | 31 | class RtspStreamFrameFormatter 32 | { 33 | public: 34 | explicit RtspStreamFrameFormatter(AVStream *stream); 35 | ~RtspStreamFrameFormatter(); 36 | 37 | void setAutoDeinterlacing(bool autoDeinterlacing); 38 | RtspStreamFrame * formatFrame(AVFrame *avFrame, int width, int height); 39 | 40 | private: 41 | AVStream *m_stream; 42 | SwsContext *m_sws_context; 43 | AVPixelFormat m_pixelFormat; 44 | bool m_autoDeinterlacing; 45 | bool m_shouldTryDeinterlaceStream; 46 | int m_width; 47 | int m_height; 48 | 49 | bool shouldTryDeinterlaceStream(); 50 | bool shouldTryDeinterlaceFrame(AVFrame *avFrame); 51 | void deinterlaceFrame(AVFrame *avFrame); 52 | AVFrame * scaleFrame(AVFrame *avFrame, int width, int height); 53 | void updateSWSContext(int dstWidth, int dstHeight); 54 | 55 | }; 56 | 57 | #endif // RTSP_STREAM_FRAME_FORMATTER_H 58 | -------------------------------------------------------------------------------- /src/rtsp-stream/RtspStreamFrameQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef RTSP_STREAM_FRAME_QUEUE_H 19 | #define RTSP_STREAM_FRAME_QUEUE_H 20 | 21 | #include "core/ThreadPause.h" 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | class RtspStreamFrame; 29 | 30 | class RtspStreamFrameQueue 31 | { 32 | Q_DISABLE_COPY(RtspStreamFrameQueue) 33 | 34 | public: 35 | RtspStreamFrameQueue(quint16 sizeLimit); 36 | ~RtspStreamFrameQueue(); 37 | 38 | RtspStreamFrame * dequeue(); 39 | void enqueue(RtspStreamFrame *frame); 40 | void clear(); 41 | 42 | private: 43 | QMutex m_frameQueueLock; 44 | QQueue m_frameQueue; 45 | quint16 m_sizeLimit; 46 | qint64 m_ptsBase; 47 | QElapsedTimer m_ptsTimer; 48 | 49 | void dropOldFrames(); 50 | 51 | }; 52 | 53 | #endif // RTSP_STREAM_FRAME_QUEUE_H 54 | -------------------------------------------------------------------------------- /src/server/DVRServerConnectionType.h: -------------------------------------------------------------------------------- 1 | #ifndef DVRSERVERCONNECTIONTYPE_H 2 | #define DVRSERVERCONNECTIONTYPE_H 3 | 4 | namespace DVRServerConnectionType 5 | { 6 | enum Type 7 | { 8 | RTSP = 0, 9 | MJPEG = 1 10 | }; 11 | } 12 | 13 | #endif // DVRSERVERCONNECTIONTYPE_H 14 | -------------------------------------------------------------------------------- /src/server/DVRServerRepository.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRSERVERREPOSITORY_H 19 | #define DVRSERVERREPOSITORY_H 20 | 21 | #include 22 | #include 23 | 24 | class DVRServer; 25 | 26 | class DVRServerRepository : public QObject 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit DVRServerRepository(QObject *parent = 0); 32 | virtual ~DVRServerRepository(); 33 | 34 | DVRServer * createServer(const QString &name); 35 | 36 | void loadServers(); 37 | void storeServers(); 38 | 39 | int serverCount() const; 40 | const QList & servers() const; 41 | DVRServer * serverByID(int id) const; 42 | QList serversWithAlerts() const; 43 | 44 | signals: 45 | void serverAboutToBeAdded(DVRServer *server); 46 | void serverAdded(DVRServer *server); 47 | 48 | void serverAboutToBeRemoved(DVRServer *server); 49 | void serverRemoved(DVRServer *server); 50 | 51 | void serverAlertsChanged(); 52 | 53 | private slots: 54 | void onServerRemoved(DVRServer *server); 55 | 56 | private: 57 | QList m_servers; 58 | int m_maxServerId; 59 | 60 | }; 61 | 62 | Q_DECLARE_METATYPE(DVRServerRepository *); 63 | 64 | #endif // DVRSERVERREPOSITORY_H 65 | -------------------------------------------------------------------------------- /src/server/DVRServerSettingsReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRSERVERSETTINGSREADER_H 19 | #define DVRSERVERSETTINGSREADER_H 20 | 21 | #include 22 | 23 | class DVRServer; 24 | 25 | class DVRServerSettingsReader 26 | { 27 | public: 28 | DVRServer * readServer(int serverId) const; 29 | 30 | private: 31 | QVariant readSetting(int serverId, const QString &key, const QVariant &def = QVariant()) const; 32 | 33 | }; 34 | 35 | #endif // DVRSERVERSETTINGSREADER_H 36 | -------------------------------------------------------------------------------- /src/server/DVRServerSettingsWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRSERVERSETTINGSWRITER_H 19 | #define DVRSERVERSETTINGSWRITER_H 20 | 21 | #include 22 | 23 | class DVRServer; 24 | class QSettings; 25 | 26 | class DVRServerSettingsWriter 27 | { 28 | public: 29 | void writeServer(DVRServer *server) const; 30 | 31 | private: 32 | void writeSetting(QSettings &settings, int serverId, const QString &key, const QVariant &value) const; 33 | }; 34 | 35 | #endif // DVRSERVERSETTINGSWRITER_H 36 | -------------------------------------------------------------------------------- /src/ui/AboutDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef ABOUTDIALOG_H 19 | #define ABOUTDIALOG_H 20 | 21 | #include 22 | 23 | class QLabel; 24 | 25 | class AboutDialog : public QDialog 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit AboutDialog(QWidget *parent = 0); 31 | 32 | protected: 33 | virtual void changeEvent(QEvent *event); 34 | 35 | private: 36 | QString getLicenseText() const; 37 | void retranslateUI(); 38 | 39 | QLabel *m_versionText; 40 | }; 41 | 42 | #endif // ABOUTDIALOG_H 43 | -------------------------------------------------------------------------------- /src/ui/DVRServersView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRSERVERSVIEW_H 19 | #define DVRSERVERSVIEW_H 20 | 21 | #include 22 | 23 | class DVRServer; 24 | class DVRServerRepository; 25 | 26 | class DVRServersView : public QTreeView 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit DVRServersView(DVRServerRepository *serverRepository, QWidget *parent = 0); 32 | virtual ~DVRServersView(); 33 | 34 | DVRServer *currentServer() const; 35 | 36 | void checkOnlyIndex(const QModelIndex &index); 37 | 38 | virtual void setModel(QAbstractItemModel *model); 39 | 40 | protected: 41 | virtual void contextMenuEvent(QContextMenuEvent *event); 42 | virtual void mouseDoubleClickEvent(QMouseEvent *event); 43 | 44 | virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); 45 | 46 | private slots: 47 | void rowsAboutToBeInserted(const QModelIndex &parent, int start, int end); 48 | 49 | private: 50 | DVRServerRepository *m_serverRepository; 51 | 52 | }; 53 | 54 | #endif // DVRSERVERSVIEW_H 55 | -------------------------------------------------------------------------------- /src/ui/EventCommentsWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "EventCommentsWidget.h" 19 | #include 20 | #include 21 | #include 22 | 23 | EventCommentsWidget::EventCommentsWidget(QWidget *parent) 24 | : QTextEdit(parent) 25 | { 26 | setReadOnly(true); 27 | } 28 | 29 | QSize EventCommentsWidget::minimumSizeHint() const 30 | { 31 | return QSize(); 32 | } 33 | 34 | void EventCommentsWidget::appendComment(const QString &author, const QDateTime &date, const QString &text) 35 | { 36 | QTextCursor cursor(document()); 37 | cursor.movePosition(QTextCursor::End); 38 | if (!cursor.atBlockStart()) 39 | cursor.insertBlock(); 40 | 41 | cursor.insertHtml(QString::fromLatin1("" 42 | "" 43 | "
%1%2

%3
").arg(Qt::escape(author), date.toString(), 44 | Qt::escape(text))); 45 | } 46 | -------------------------------------------------------------------------------- /src/ui/EventCommentsWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTCOMMENTSWIDGET_H 19 | #define EVENTCOMMENTSWIDGET_H 20 | 21 | #include 22 | 23 | class QDateTime; 24 | 25 | class EventCommentsWidget : public QTextEdit 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit EventCommentsWidget(QWidget *parent = 0); 31 | 32 | virtual QSize minimumSizeHint() const; 33 | 34 | void appendComment(const QString &author, const QDateTime &date, const QString &text); 35 | }; 36 | 37 | #endif // EVENTCOMMENTSWIDGET_H 38 | -------------------------------------------------------------------------------- /src/ui/EventTagsDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTTAGSDELEGATE_H 19 | #define EVENTTAGSDELEGATE_H 20 | 21 | #include 22 | 23 | class EventTagsDelegate : public QStyledItemDelegate 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit EventTagsDelegate(QObject *parent = 0); 29 | 30 | virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; 31 | bool hitTestDelButton(const QModelIndex &index, const QSize &size, const QPoint &pos) const; 32 | }; 33 | 34 | #endif // EVENTTAGSDELEGATE_H 35 | -------------------------------------------------------------------------------- /src/ui/EventTagsView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTTAGSVIEW_H 19 | #define EVENTTAGSVIEW_H 20 | 21 | #include 22 | 23 | class EventTagsView : public QListView 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit EventTagsView(QWidget *parent = 0); 29 | 30 | virtual QSize sizeHint() const; 31 | virtual QSize minimumSizeHint() const; 32 | 33 | virtual void setModel(QAbstractItemModel *model); 34 | virtual void reset(); 35 | 36 | public slots: 37 | void removeTag(const QModelIndex &index); 38 | 39 | protected: 40 | virtual void rowsInserted(const QModelIndex &parent, int start, int end); 41 | virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); 42 | 43 | virtual void mousePressEvent(QMouseEvent *event); 44 | virtual void mouseMoveEvent(QMouseEvent *event); 45 | 46 | private: 47 | QSize cachedSizeHint; 48 | 49 | void calculateSizeHint(); 50 | }; 51 | 52 | #endif // EVENTTAGSVIEW_H 53 | -------------------------------------------------------------------------------- /src/ui/EventTypesFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTTYPESFILTER_H 19 | #define EVENTTYPESFILTER_H 20 | 21 | #include 22 | #include 23 | 24 | class EventType; 25 | 26 | class EventTypesFilter : public QTreeWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit EventTypesFilter(QWidget *parent = 0); 32 | 33 | QBitArray checkedTypes() const; 34 | 35 | signals: 36 | void checkedTypesChanged(const QBitArray &checkedTypes); 37 | 38 | protected: 39 | virtual void changeEvent(QEvent *event); 40 | 41 | 42 | private slots: 43 | void checkStateChanged(QTreeWidgetItem *item); 44 | 45 | private: 46 | QTreeWidgetItem *addItem(const QString &name, EventType min, EventType max); 47 | }; 48 | 49 | #endif // EVENTTYPESFILTER_H 50 | -------------------------------------------------------------------------------- /src/ui/EventVideoDownloadWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTVIDEODOWNLOADWIDGET_H 19 | #define EVENTVIDEODOWNLOADWIDGET_H 20 | 21 | #include 22 | 23 | class QLabel; 24 | class QProgressBar; 25 | class QPushButton; 26 | class EventVideoDownload; 27 | 28 | class EventVideoDownloadWidget : public QWidget 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit EventVideoDownloadWidget(EventVideoDownload *eventVideoDownload, QWidget *parent = 0); 34 | virtual ~EventVideoDownloadWidget(); 35 | 36 | protected: 37 | virtual void changeEvent(QEvent *event); 38 | 39 | private slots: 40 | void closeClicked(); 41 | void updateProgress(); 42 | 43 | private: 44 | QWeakPointer m_eventVideoDownload; 45 | QPushButton *m_closeButton; 46 | QProgressBar *m_progressBar; 47 | QLabel *m_progressLabel; 48 | QTimer *m_progressTimer; 49 | 50 | void retranslateUI(); 51 | }; 52 | 53 | #endif // EVENTVIDEODOWNLOADWIDGET_H 54 | -------------------------------------------------------------------------------- /src/ui/EventVideoDownloadsWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTVIDEODOWNLOADSWINDOW_H 19 | #define EVENTVIDEODOWNLOADSWINDOW_H 20 | 21 | #include 22 | #include 23 | 24 | class QVBoxLayout; 25 | class EventDownloadManager; 26 | class EventVideoDownload; 27 | class EventVideoDownloadWidget; 28 | 29 | class EventVideoDownloadsWindow : public QFrame 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit EventVideoDownloadsWindow(QWidget *parent = 0); 35 | virtual ~EventVideoDownloadsWindow(); 36 | 37 | void setEventDownloadManager(EventDownloadManager *eventDownloadManager); 38 | 39 | protected: 40 | virtual void changeEvent(QEvent *event); 41 | 42 | private slots: 43 | void eventVideoDownloadAdded(EventVideoDownload *eventVideoDownload); 44 | void eventVideoDownloadRemoved(EventVideoDownload *eventVideoDownload); 45 | 46 | void saveSettings(); 47 | 48 | private: 49 | QWeakPointer m_eventDownloadManager; 50 | QMap m_downloadWidgets; 51 | QVBoxLayout *m_downloadLayout; 52 | 53 | void rebuildWidgets(); 54 | }; 55 | 56 | #endif // EVENTVIDEODOWNLOADSWINDOW_H 57 | -------------------------------------------------------------------------------- /src/ui/EventsView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTSVIEW_H 19 | #define EVENTSVIEW_H 20 | 21 | #include "core/EventData.h" 22 | #include "ui/model/EventsProxyModel.h" 23 | #include 24 | 25 | class EventData; 26 | class EventList; 27 | class EventsModel; 28 | class QLabel; 29 | 30 | class EventsView : public QTreeView 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit EventsView(QWidget *parent = 0); 36 | 37 | void setModel(EventsModel *model, bool loading); 38 | 39 | EventList selectedEvents() const; 40 | 41 | public slots: 42 | void loadingStarted(); 43 | void loadingFinished(); 44 | 45 | void setIncompletePlace(EventsProxyModel::IncompletePlace incompletePlace); 46 | void setMinimumLevel(EventLevel minimumLevel); 47 | void setTypes(QBitArray types); 48 | void setDay(const QDate &day); 49 | void setTimeRange(const QDateTime &from, const QDateTime &to); 50 | void setSources(const QMap > &sources); 51 | 52 | void sortEvents(int logicalIndex, Qt::SortOrder sortOrder); 53 | 54 | private slots: 55 | void openEvent(const QModelIndex &index); 56 | 57 | protected: 58 | virtual bool eventFilter(QObject *obj, QEvent *ev); 59 | 60 | private: 61 | QLabel *loadingIndicator; 62 | EventsModel *m_eventsModel; 63 | EventsProxyModel *m_eventsProxyModel; 64 | 65 | using QTreeView::setModel; 66 | }; 67 | 68 | #endif // EVENTSVIEW_H 69 | -------------------------------------------------------------------------------- /src/ui/ExpandingTextEdit.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "ExpandingTextEdit.h" 19 | 20 | ExpandingTextEdit::ExpandingTextEdit(QWidget *parent) 21 | : QTextEdit(parent) 22 | { 23 | setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); 24 | setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 25 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 26 | 27 | connect(document(), SIGNAL(contentsChanged()), SLOT(documentChanged())); 28 | } 29 | 30 | QSize ExpandingTextEdit::sizeHint() const 31 | { 32 | QSize sz = document()->size().toSize(); 33 | QRect cr = contentsRect(); 34 | sz += QSize(cr.x()*2, cr.y()*2); 35 | return sz; 36 | } 37 | 38 | QSize ExpandingTextEdit::minimumSizeHint() const 39 | { 40 | return QSize(); 41 | } 42 | 43 | void ExpandingTextEdit::resizeEvent(QResizeEvent *event) 44 | { 45 | QTextEdit::resizeEvent(event); 46 | document()->setTextWidth(viewport()->width()); 47 | updateGeometry(); 48 | } 49 | -------------------------------------------------------------------------------- /src/ui/ExpandingTextEdit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EXPANDINGTEXTEDIT_H 19 | #define EXPANDINGTEXTEDIT_H 20 | 21 | #include 22 | 23 | class ExpandingTextEdit : public QTextEdit 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit ExpandingTextEdit(QWidget *parent = 0); 29 | 30 | virtual QSize sizeHint() const; 31 | virtual QSize minimumSizeHint() const; 32 | 33 | private slots: 34 | void documentChanged() { updateGeometry(); } 35 | 36 | protected: 37 | virtual void resizeEvent(QResizeEvent *event); 38 | }; 39 | 40 | #endif // EXPANDINGTEXTEDIT_H 41 | -------------------------------------------------------------------------------- /src/ui/MacSplitter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "MacSplitter.h" 19 | #include "MacSplitterHandle.h" 20 | 21 | MacSplitter::MacSplitter(Qt::Orientation o, QWidget* parent) : QSplitter(o, parent) 22 | { 23 | } 24 | 25 | QSplitterHandle* MacSplitter::createHandle() 26 | { 27 | return new MacSplitterHandle(orientation(), this); 28 | } 29 | -------------------------------------------------------------------------------- /src/ui/MacSplitter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MACSPLITTER_H 19 | #define MACSPLITTER_H 20 | 21 | #include 22 | 23 | class MacSplitter : public QSplitter 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit MacSplitter(Qt::Orientation o, QWidget *parent = 0); 29 | 30 | protected: 31 | virtual QSplitterHandle *createHandle(); 32 | 33 | }; 34 | 35 | #endif // MACSPLITTER_H 36 | -------------------------------------------------------------------------------- /src/ui/MacSplitterHandle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MACSPLITTERHANDLE_H 19 | #define MACSPLITTERHANDLE_H 20 | 21 | #include 22 | 23 | class MacSplitterHandle : public QSplitterHandle 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | MacSplitterHandle(Qt::Orientation o, QSplitter *parent); 29 | ~MacSplitterHandle(); 30 | 31 | virtual QSize sizeHint() const; 32 | 33 | protected: 34 | virtual void paintEvent(QPaintEvent *e); 35 | virtual void enterEvent(QEvent *e); 36 | virtual bool eventFilter(QObject *, QEvent *); 37 | 38 | private: 39 | bool isMouseGrabbed; 40 | }; 41 | 42 | #endif // MACSPLITTERHANDLE_H 43 | -------------------------------------------------------------------------------- /src/ui/NumericOffsetWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef NUMERICOFFSETWIDGET_H 19 | #define NUMERICOFFSETWIDGET_H 20 | 21 | #include 22 | 23 | class NumericOffsetWidget : public QWidget 24 | { 25 | Q_OBJECT 26 | Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged STORED true USER true) 27 | 28 | public: 29 | explicit NumericOffsetWidget(QWidget *parent = 0); 30 | 31 | int value() const { return m_value; } 32 | 33 | virtual QSize sizeHint() const; 34 | 35 | public slots: 36 | void setValue(int value); 37 | void clear() { setValue(0); } 38 | void increase() { setValue(value()+1); } 39 | void decrease() { setValue(value()-1); } 40 | 41 | signals: 42 | void valueChanged(int value); 43 | 44 | protected: 45 | virtual void paintEvent(QPaintEvent *event); 46 | virtual void mousePressEvent(QMouseEvent *event); 47 | 48 | private: 49 | int m_value; 50 | 51 | QSize textAreaSize() const; 52 | }; 53 | 54 | #endif // NUMERICOFFSETWIDGET_H 55 | -------------------------------------------------------------------------------- /src/ui/OptionsDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef OPTIONSDIALOG_H 19 | #define OPTIONSDIALOG_H 20 | 21 | #include 22 | 23 | class QTabWidget; 24 | class QDialogButtonBox; 25 | class DVRServerRepository; 26 | 27 | class OptionsDialog : public QDialog 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | enum OptionsPage 33 | { 34 | GeneralPage = 0, 35 | ServerPage 36 | }; 37 | 38 | explicit OptionsDialog(DVRServerRepository *serverRepository, QWidget *parent = 0); 39 | ~OptionsDialog(); 40 | 41 | void showPage(OptionsPage page); 42 | QWidget *pageWidget(OptionsPage page) const; 43 | 44 | static bool isDialogCreated() {return m_dialogCreated;}; 45 | 46 | protected: 47 | virtual void closeEvent(QCloseEvent *event); 48 | 49 | private: 50 | QTabWidget *m_tabWidget; 51 | QDialogButtonBox *m_buttons; 52 | 53 | static bool m_dialogCreated; 54 | }; 55 | 56 | class OptionsDialogPage : public QWidget 57 | { 58 | Q_OBJECT 59 | 60 | public: 61 | OptionsDialogPage(QWidget *parent = 0) : QWidget(parent) { } 62 | 63 | virtual bool hasUnsavedChanges() const { Q_ASSERT(alwaysSaveChanges()); return false; } 64 | virtual bool alwaysSaveChanges() const { return false; } 65 | 66 | public slots: 67 | virtual void saveChanges() = 0; 68 | }; 69 | 70 | #endif // OPTIONSDIALOG_H 71 | -------------------------------------------------------------------------------- /src/ui/OptionsGeneralPage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef OPTIONSGENERALPAGE_H 19 | #define OPTIONSGENERALPAGE_H 20 | 21 | #include "OptionsDialog.h" 22 | 23 | class QCheckBox; 24 | class QComboBox; 25 | 26 | class OptionsGeneralPage : public OptionsDialogPage 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit OptionsGeneralPage(QWidget *parent = 0); 32 | 33 | virtual bool alwaysSaveChanges() const { return true; } 34 | virtual void saveChanges(); 35 | 36 | private slots: 37 | /*void ssUpdateForNever(); 38 | void ssUpdateForOthers(bool checked);*/ 39 | void updateStartup(bool on); 40 | 41 | private: 42 | QCheckBox *m_eventsPauseLive, *m_closeToTray, *m_vaapiDecodingAcceleration, 43 | *m_deinterlace, *m_updateNotifications, *m_thumbnails, 44 | *m_session, *m_fullScreen, *m_startup /*, 45 | *m_ssFullscreen, *m_ssVideo, *m_ssNever*/; 46 | 47 | QComboBox *m_languages; 48 | QComboBox *m_mpvvo; 49 | 50 | void fillLanguageComboBox(); 51 | void fillMpvVOComboBox(); 52 | }; 53 | 54 | #endif // OPTIONSGENERALPAGE_H 55 | -------------------------------------------------------------------------------- /src/ui/RemotePortCheckerWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "RemotePortCheckerWidget.h" 2 | #include "network/RemotePortChecker.h" 3 | 4 | RemotePortCheckerWidget::RemotePortCheckerWidget(const QString &portName, QWidget *parent) 5 | : QLabel(parent), m_portName(portName), m_lastCheckedPort(0) 6 | { 7 | setPixmap(QPixmap(QLatin1String(":icons/status-offline.png"))); 8 | } 9 | 10 | RemotePortCheckerWidget::~RemotePortCheckerWidget() 11 | { 12 | } 13 | 14 | void RemotePortCheckerWidget::check(const QString &name, quint16 port) 15 | { 16 | if (m_lastCheckedName == name && m_lastCheckedPort == port) 17 | return; 18 | 19 | setPixmap(QPixmap(QLatin1String(":icons/status-offline.png"))); 20 | setChecker(new RemotePortChecker(name, port)); 21 | } 22 | 23 | void RemotePortCheckerWidget::setChecker(RemotePortChecker *checker) 24 | { 25 | if (m_checker) 26 | { 27 | m_checker->disconnect(this); 28 | m_checker->deleteLater(); 29 | } 30 | 31 | m_checker.reset(checker); 32 | 33 | if (m_checker) 34 | { 35 | connect(m_checker.data(), SIGNAL(available()), this, SLOT(available())); 36 | connect(m_checker.data(), SIGNAL(notAvailable(QString)), this, SLOT(notAvailable(QString))); 37 | } 38 | } 39 | 40 | void RemotePortCheckerWidget::available() 41 | { 42 | updateLastChecked(); 43 | 44 | if (m_portName.isEmpty()) 45 | setToolTip(QLatin1String("OK")); 46 | else 47 | setToolTip(QString::fromLatin1("%1: OK").arg(m_portName)); 48 | setPixmap(QPixmap(QLatin1String(":icons/status.png"))); 49 | setChecker(0); 50 | } 51 | 52 | void RemotePortCheckerWidget::notAvailable(const QString &errorMessage) 53 | { 54 | updateLastChecked(); 55 | 56 | if (m_portName.isEmpty()) 57 | setToolTip(errorMessage); 58 | else 59 | setToolTip(QString::fromLatin1("%2: %1").arg(errorMessage).arg(m_portName)); 60 | setPixmap(QPixmap(QLatin1String(":icons/status-error.png"))); 61 | setChecker(0); 62 | } 63 | 64 | void RemotePortCheckerWidget::updateLastChecked() 65 | { 66 | Q_ASSERT(m_checker); 67 | 68 | m_lastCheckedName = m_checker->name(); 69 | m_lastCheckedPort = m_checker->port(); 70 | } 71 | -------------------------------------------------------------------------------- /src/ui/RemotePortCheckerWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef REMOTEPORTCHECKERWIDGET_H 2 | #define REMOTEPORTCHECKERWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class RemotePortChecker; 9 | 10 | class RemotePortCheckerWidget : public QLabel 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit RemotePortCheckerWidget(const QString &portName, QWidget *parent = 0); 16 | virtual ~RemotePortCheckerWidget(); 17 | 18 | void check(const QString &name, quint16 port); 19 | 20 | private slots: 21 | void available(); 22 | void notAvailable(const QString &errorMessage); 23 | 24 | private: 25 | QString m_portName; 26 | QScopedPointer m_checker; 27 | QString m_lastCheckedName; 28 | quint16 m_lastCheckedPort; 29 | void setChecker(RemotePortChecker *checker); 30 | void updateLastChecked(); 31 | }; 32 | 33 | #endif // REMOTEPORTCHECKERWIDGET_H 34 | -------------------------------------------------------------------------------- /src/ui/ServerMenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SERVERMENU_H 19 | #define SERVERMENU_H 20 | 21 | #include 22 | #include 23 | 24 | class DVRServer; 25 | 26 | class QAction; 27 | 28 | class ServerMenu : public QMenu 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit ServerMenu(DVRServer *server, const QString &title, QWidget *parent = 0); 34 | ~ServerMenu(); 35 | 36 | signals: 37 | void showEventsWindow(); 38 | void openServerConfig(); 39 | void openServerSettings(); 40 | 41 | protected: 42 | virtual void changeEvent(QEvent *event); 43 | 44 | private: 45 | DVRServer *m_server; 46 | 47 | QAction *m_connectAction; 48 | QAction *m_browseEventsAction; 49 | QAction *m_configureServerAction; 50 | QAction *m_refreshDevicesAction; 51 | QAction *m_settingsAction; 52 | 53 | void createActions(); 54 | void retranslateUI(); 55 | 56 | private slots: 57 | void updateMenuForServer(); 58 | 59 | }; 60 | 61 | Q_DECLARE_METATYPE(ServerMenu*) 62 | 63 | 64 | #endif // SERVERMENU_H 65 | -------------------------------------------------------------------------------- /src/ui/SetupWizard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SETUPWIZARD_H 19 | #define SETUPWIZARD_H 20 | 21 | #include 22 | 23 | class DVRServerRepository; 24 | 25 | class SetupWizard : public QWizard 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit SetupWizard(DVRServerRepository *serverRepository, QWidget *parent = 0); 31 | 32 | public slots: 33 | void skip(); 34 | 35 | protected: 36 | virtual bool validateCurrentPage(); 37 | 38 | private: 39 | bool skipFlag; 40 | 41 | }; 42 | 43 | #endif // SETUPWIZARD_H 44 | -------------------------------------------------------------------------------- /src/ui/StatusBandwidthWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef STATUSBANDWIDTHWIDGET_H 19 | #define STATUSBANDWIDTHWIDGET_H 20 | 21 | #include 22 | 23 | #include 24 | 25 | class StatusBandwidthWidget : public QToolButton 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit StatusBandwidthWidget(QWidget *parent = 0); 31 | 32 | private slots: 33 | void bandwidthModeChanged(int value); 34 | void rateUpdated(unsigned currentRate); 35 | }; 36 | 37 | 38 | #endif // STATUSBANDWIDTHWIDGET_H 39 | -------------------------------------------------------------------------------- /src/ui/StatusBarServerAlert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef STATUSBARSERVERALERT_H 19 | #define STATUSBARSERVERALERT_H 20 | 21 | #include 22 | 23 | class QLabel; 24 | class DVRServerRepository; 25 | 26 | class StatusBarServerAlert : public QWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit StatusBarServerAlert(DVRServerRepository *serverRepository, QWidget *parent = 0); 32 | 33 | private slots: 34 | void updateAlert(); 35 | 36 | protected: 37 | virtual void changeEvent(QEvent *event); 38 | virtual void mousePressEvent(QMouseEvent *); 39 | 40 | private: 41 | DVRServerRepository *m_serverRepository; 42 | QLabel *alertText; 43 | 44 | }; 45 | 46 | #endif // STATUSBARSERVERALERT_H 47 | -------------------------------------------------------------------------------- /src/ui/SwitchEventsWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef SWITCHEVENTSWIDGET_H 2 | #define SWITCHEVENTSWIDGET_H 3 | 4 | #include 5 | 6 | class QPushButton; 7 | class EventsCursor; 8 | 9 | class SwitchEventsWidget : public QWidget 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit SwitchEventsWidget(QWidget *parent = 0); 15 | virtual ~SwitchEventsWidget(); 16 | 17 | void setEventsCursor(const QSharedPointer &eventsCursor); 18 | EventsCursor * eventsCursor() const { return m_eventsCursor.data(); } 19 | 20 | private slots: 21 | void updateButtonsState(); 22 | 23 | protected: 24 | virtual void changeEvent(QEvent *event); 25 | 26 | private: 27 | QSharedPointer m_eventsCursor; 28 | QPushButton *m_previousButton; 29 | QPushButton *m_nextButton; 30 | 31 | void retranslateUI(); 32 | }; 33 | 34 | #endif // SWITCHEVENTSWIDGET_H 35 | -------------------------------------------------------------------------------- /src/ui/TimeRangeScrollBar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "TimeRangeScrollBar.h" 19 | 20 | TimeRangeScrollBar::TimeRangeScrollBar(QWidget *parent) 21 | : QScrollBar(parent) 22 | { 23 | } 24 | 25 | TimeRangeScrollBar::~TimeRangeScrollBar() 26 | { 27 | } 28 | 29 | void TimeRangeScrollBar::setInvisibleSeconds(int invisibleSeconds) 30 | { 31 | setRange(0, invisibleSeconds); 32 | } 33 | 34 | void TimeRangeScrollBar::setPrimaryTickSecs(int primaryTickSecs) 35 | { 36 | setPageStep(primaryTickSecs); 37 | setSingleStep(primaryTickSecs); 38 | } 39 | -------------------------------------------------------------------------------- /src/ui/TimeRangeScrollBar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef TIMERANGESCROLLBAR_H 19 | #define TIMERANGESCROLLBAR_H 20 | 21 | #include 22 | 23 | class TimeRangeScrollBar : public QScrollBar 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit TimeRangeScrollBar(QWidget *parent = 0); 29 | virtual ~TimeRangeScrollBar(); 30 | 31 | public slots: 32 | void setInvisibleSeconds(int invisibleSeconds); 33 | void setPrimaryTickSecs(int primaryTickSecs); 34 | 35 | }; 36 | 37 | #endif // TIMERANGESCROLLBAR_H 38 | -------------------------------------------------------------------------------- /src/ui/WebRtpPortCheckerWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "WebRtpPortCheckerWidget.h" 2 | #include "ui/RemotePortCheckerWidget.h" 3 | #include 4 | 5 | WebRtpPortCheckerWidget::WebRtpPortCheckerWidget(QWidget *parent) 6 | : QWidget(parent) 7 | { 8 | QHBoxLayout *layout = new QHBoxLayout(this); 9 | 10 | webPortChecker = new RemotePortCheckerWidget(tr("Web port")); 11 | rtpPortChecker = new RemotePortCheckerWidget(tr("RTP port")); 12 | layout->addWidget(webPortChecker); 13 | layout->addWidget(rtpPortChecker); 14 | } 15 | 16 | WebRtpPortCheckerWidget::~WebRtpPortCheckerWidget() 17 | { 18 | } 19 | 20 | void WebRtpPortCheckerWidget::check(const QString &name, quint16 webPort) 21 | { 22 | webPortChecker->check(name, webPort); 23 | rtpPortChecker->check(name, webPort + 1); 24 | } 25 | -------------------------------------------------------------------------------- /src/ui/WebRtpPortCheckerWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef WEBRTPPORTCHECKERWIDGET_H 2 | #define WEBRTPPORTCHECKERWIDGET_H 3 | 4 | #include 5 | 6 | class RemotePortCheckerWidget; 7 | 8 | class WebRtpPortCheckerWidget : public QWidget 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit WebRtpPortCheckerWidget(QWidget *parent = 0); 14 | virtual ~WebRtpPortCheckerWidget(); 15 | 16 | void check(const QString &name, quint16 webPort); 17 | 18 | private: 19 | RemotePortCheckerWidget *webPortChecker; 20 | RemotePortCheckerWidget *rtpPortChecker; 21 | }; 22 | 23 | #endif // WEBRTPPORTCHECKERWIDGET_H 24 | -------------------------------------------------------------------------------- /src/ui/liveview/PtzPresetsWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef PTZPRESETSWINDOW_H 19 | #define PTZPRESETSWINDOW_H 20 | 21 | #include 22 | #include 23 | 24 | class CameraPtzControl; 25 | class QAction; 26 | class QModelIndex; 27 | class QToolBar; 28 | class QTreeView; 29 | class PtzPresetsModel; 30 | 31 | class PtzPresetsWindow : public QWidget 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | explicit PtzPresetsWindow(CameraPtzControl *ptzControl, QWidget *parent = 0); 37 | 38 | protected: 39 | virtual void changeEvent(QEvent *event); 40 | 41 | private slots: 42 | void newPreset(); 43 | void moveToPreset(const QModelIndex &index = QModelIndex()); 44 | void updatePreset(const QModelIndex &index = QModelIndex()); 45 | void renamePreset(const QModelIndex &index = QModelIndex()); 46 | void deletePreset(const QModelIndex &index = QModelIndex()); 47 | void presetsViewContextMenu(const QPoint &pos); 48 | 49 | private: 50 | CameraPtzControl *m_ptz; 51 | PtzPresetsModel *m_presetsModel; 52 | 53 | QAction *m_newAction; 54 | QAction *m_goToAction; 55 | QAction *m_renameAction; 56 | QAction *m_deleteAction; 57 | QAction *m_refreshPresetAction; 58 | QTreeView *m_presetsView; 59 | QToolBar *m_tb; 60 | 61 | void retranslateUI(); 62 | }; 63 | 64 | #endif // PTZPRESETSWINDOW_H 65 | -------------------------------------------------------------------------------- /src/ui/model/DVRServersProxyModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DVRSERVERSPROXYMODEL_H 19 | #define DVRSERVERSPROXYMODEL_H 20 | 21 | #include 22 | 23 | class DVRCamera; 24 | class DVRServer; 25 | 26 | class DVRServersProxyModel : public QSortFilterProxyModel 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit DVRServersProxyModel(QObject *parent); 32 | virtual ~DVRServersProxyModel(); 33 | 34 | virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; 35 | virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; 36 | 37 | void setHideDisabledCameras(bool hideDisabledCameras); 38 | 39 | private: 40 | bool m_hideDisabledCameras; 41 | 42 | bool lessThan(DVRCamera *left, DVRCamera *right) const; 43 | 44 | }; 45 | 46 | #endif // DVRSERVERSPROXYMODEL_H 47 | -------------------------------------------------------------------------------- /src/ui/model/EventTagsModel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "EventTagsModel.h" 19 | 20 | EventTagsModel::EventTagsModel(QObject *parent) 21 | : QAbstractListModel(parent) 22 | { 23 | /* Placeholder for tags that will be parsed out of the event data */ 24 | tags << QLatin1String("fake tag") << QLatin1String("more tags") << QLatin1String("third tag"); 25 | } 26 | 27 | int EventTagsModel::rowCount(const QModelIndex &parent) const 28 | { 29 | if (!parent.isValid()) 30 | return tags.size(); 31 | else 32 | return 0; 33 | } 34 | 35 | QVariant EventTagsModel::data(const QModelIndex &index, int role) const 36 | { 37 | Q_ASSERT(index.isValid()); 38 | 39 | switch (role) 40 | { 41 | case Qt::DisplayRole: 42 | return tags[index.row()]; 43 | } 44 | 45 | return QVariant(); 46 | } 47 | 48 | void EventTagsModel::removeTag(const QModelIndex &index) 49 | { 50 | /* TODO: Actually remove the tag from wherever we got it */ 51 | if (!index.isValid() || index.row() < 0 || index.row() >= tags.size()) 52 | return; 53 | 54 | beginRemoveRows(QModelIndex(), index.row(), index.row()); 55 | tags.removeAt(index.row()); 56 | endRemoveRows(); 57 | } 58 | -------------------------------------------------------------------------------- /src/ui/model/EventTagsModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENTTAGSMODEL_H 19 | #define EVENTTAGSMODEL_H 20 | 21 | #include 22 | 23 | class EventTagsModel : public QAbstractListModel 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit EventTagsModel(QObject *parent = 0); 29 | 30 | virtual int rowCount(const QModelIndex &parent) const; 31 | virtual QVariant data(const QModelIndex &index, int role) const; 32 | 33 | void removeTag(const QModelIndex &index); 34 | 35 | private: 36 | QList tags; 37 | }; 38 | 39 | #endif // EVENTTAGSMODEL_H 40 | -------------------------------------------------------------------------------- /src/utils/DateTimeRange.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DATETIMERANGE_H 19 | #define DATETIMERANGE_H 20 | 21 | #include 22 | 23 | class DateTimeRange 24 | { 25 | QDateTime m_start; 26 | QDateTime m_end; 27 | 28 | public: 29 | DateTimeRange(const QDateTime &start, const QDateTime &end); 30 | DateTimeRange(); 31 | DateTimeRange(const DateTimeRange ©Me); 32 | 33 | DateTimeRange & operator = (const DateTimeRange ©Me); 34 | bool operator == (const DateTimeRange &compareTo) const; 35 | 36 | bool isNull() const; 37 | 38 | QDateTime start() const; 39 | QDateTime end() const; 40 | 41 | int lengthInSeconds() const; 42 | bool contains(const QDateTime &dateTime) const; 43 | bool contains(const DateTimeRange &dateTimeRange) const; 44 | 45 | DateTimeRange boundedBy(const DateTimeRange &range) const; 46 | DateTimeRange extendWith(const QDateTime &dateTime) const; 47 | DateTimeRange withLengthInSeconds(int lengthInSeconds) const; 48 | DateTimeRange moveInto(const DateTimeRange &dateTime) const; 49 | DateTimeRange moveStart(const QDateTime &start) const; 50 | 51 | }; 52 | 53 | #endif // DATETIMERANGE_H 54 | -------------------------------------------------------------------------------- /src/utils/DateTimeUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DATETIMEUTILS_H 19 | #define DATETIMEUTILS_H 20 | 21 | #include 22 | 23 | class QDateTime; 24 | class QString; 25 | 26 | QDateTime isoToDateTime(const QString &str, qint16 *tzOffsetMins = 0); 27 | 28 | #endif // DATETIMEUTILS_H 29 | -------------------------------------------------------------------------------- /src/utils/FileUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef FILEUTILS_H 19 | #define FILEUTILS_H 20 | 21 | #include 22 | 23 | class QWidget; 24 | 25 | QString sanitizeFilename(const QString &filename); 26 | QString getSaveFileNameExt(QWidget *parent, const QString &caption, const QString &defaultDir, 27 | const QString &dirCacheKey = QString(), const QString &filename = QString(), 28 | const QString &filter = QString(), bool autoSelectFilter = true); 29 | 30 | #endif // FILEUTILS_H 31 | -------------------------------------------------------------------------------- /src/utils/ImageDecodeTask.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "ImageDecodeTask.h" 19 | #include 20 | #include 21 | #include 22 | 23 | /* main.cpp */ 24 | extern const char *jpegFormatName; 25 | 26 | ImageDecodeTask::ImageDecodeTask(QObject *caller, const char *callback, quint64 id) 27 | : ThreadTask(caller, callback), imageId(id) 28 | { 29 | } 30 | 31 | void ImageDecodeTask::runTask() 32 | { 33 | if (isCancelled() || m_data.isNull()) 34 | { 35 | m_data.clear(); 36 | return; 37 | } 38 | 39 | QBuffer buffer(&m_data); 40 | if (!buffer.open(QIODevice::ReadOnly)) 41 | { 42 | qDebug() << "Image decoding buffer error:" << buffer.errorString(); 43 | m_data.clear(); 44 | return; 45 | } 46 | 47 | QImageReader reader(&buffer, jpegFormatName); 48 | /* This would be more efficient, but causes the decoding to fail with 49 | * Qt 4.6.2 on Ubuntu 10.04. Disabled for now as a result. Issue #473 */ 50 | //reader.setAutoDetectImageFormat(false); 51 | 52 | bool ok = reader.read(&m_result); 53 | 54 | buffer.close(); 55 | m_data.clear(); 56 | 57 | if (!ok) 58 | { 59 | if (m_result.isNull()) 60 | { 61 | qDebug() << "Image decoding error:" << reader.errorString(); 62 | return; 63 | } 64 | else 65 | qDebug() << "Image decoding warning:" << reader.errorString(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/utils/ImageDecodeTask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef IMAGEDECODETASK_H 19 | #define IMAGEDECODETASK_H 20 | 21 | #include "ThreadTask.h" 22 | #include 23 | #include 24 | 25 | class ImageDecodeTask : public ThreadTask 26 | { 27 | public: 28 | const quint64 imageId; 29 | 30 | ImageDecodeTask(QObject *caller, const char *callback, quint64 imageId = 0); 31 | 32 | void setData(const QByteArray &data) { m_data = data; } 33 | 34 | QImage result() const { return m_result; } 35 | 36 | protected: 37 | virtual void runTask(); 38 | 39 | private: 40 | QByteArray m_data; 41 | QImage m_result; 42 | }; 43 | 44 | #endif // IMAGEDECODETASK_H 45 | -------------------------------------------------------------------------------- /src/utils/PlatformOSX.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #import 19 | 20 | void resetSystemActivity() 21 | { 22 | UpdateSystemActivity(OverallAct); 23 | } 24 | -------------------------------------------------------------------------------- /src/utils/Range.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "Range.h" 19 | #include 20 | 21 | Range Range::invalid() 22 | { 23 | Range result; 24 | result.m_start = 1; 25 | result.m_end = 0; 26 | 27 | return result; 28 | } 29 | 30 | Range Range::fromValue(unsigned value) 31 | { 32 | Range result; 33 | result.m_start = value; 34 | result.m_end = value; 35 | 36 | return result; 37 | } 38 | 39 | Range Range::fromStartEnd(unsigned start, unsigned end) 40 | { 41 | Range result; 42 | result.m_start = start; 43 | result.m_end = end; 44 | 45 | return result; 46 | } 47 | 48 | Range Range::fromStartSize(unsigned start, unsigned size) 49 | { 50 | Range result; 51 | result.m_start = start; 52 | result.m_end = start + size - 1; 53 | 54 | return result; 55 | } 56 | 57 | Range::Range() 58 | : m_start(1), m_end(0) 59 | { 60 | } 61 | 62 | unsigned Range::size() const 63 | { 64 | if (isValid()) 65 | return m_end - m_start + 1; 66 | else 67 | return 0; 68 | } 69 | 70 | bool Range::isValid() const 71 | { 72 | return m_end >= m_start; 73 | } 74 | 75 | bool Range::includes(unsigned value) const 76 | { 77 | return (value >= m_start) && (value <= m_end); 78 | } 79 | 80 | bool Range::includes(const Range &otherRange) const 81 | { 82 | return (otherRange.start() >= m_start) && (otherRange.end() <= m_end); 83 | } 84 | -------------------------------------------------------------------------------- /src/utils/Range.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef RANGE_H 19 | #define RANGE_H 20 | 21 | class Range 22 | { 23 | public: 24 | static Range invalid(); 25 | static Range fromValue(unsigned value); 26 | static Range fromStartEnd(unsigned start, unsigned end); 27 | static Range fromStartSize(unsigned start, unsigned size); 28 | 29 | Range(); 30 | 31 | unsigned start() const { return m_start; } 32 | unsigned end() const { return m_end; } 33 | unsigned size() const; 34 | 35 | bool isValid() const; 36 | bool includes(unsigned value) const; 37 | bool includes(const Range &otherRange) const; 38 | 39 | private: 40 | 41 | unsigned m_start; // inclusive 42 | unsigned m_end; // inclusive 43 | }; 44 | 45 | #endif // RANGE_H 46 | -------------------------------------------------------------------------------- /src/utils/StringUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "StringUtils.h" 19 | #include 20 | 21 | QString byteSizeString(quint64 bytes, ByteSizeFormat format) 22 | { 23 | double v = bytes / double(1024); 24 | int n = 1; 25 | 26 | for (; v >= 1024; n++) 27 | v /= 1024; 28 | 29 | QString suffix; 30 | if (format == Bytes) 31 | { 32 | switch (n) 33 | { 34 | case 1: suffix = QApplication::translate("byteSizeString", "KB"); break; 35 | case 2: suffix = QApplication::translate("byteSizeString", "MB"); break; 36 | case 3: suffix = QApplication::translate("byteSizeString", "GB"); break; 37 | } 38 | } 39 | else if (format == BytesPerSecond) 40 | { 41 | switch (n) 42 | { 43 | case 1: suffix = QApplication::translate("byteSizeString", "KB/s"); break; 44 | case 2: suffix = QApplication::translate("byteSizeString", "MB/s"); break; 45 | case 3: suffix = QApplication::translate("byteSizeString", "GB/s"); break; 46 | } 47 | } 48 | 49 | return QString::number(v, 'f', 0) + QLatin1Char(' ') + suffix; 50 | } 51 | 52 | QString withSuffix(const QString &string, const QString &suffix) 53 | { 54 | if (string.endsWith(suffix)) 55 | return string; 56 | else 57 | return string + suffix; 58 | } 59 | -------------------------------------------------------------------------------- /src/utils/StringUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef STRINGUTILS_H 19 | #define STRINGUTILS_H 20 | 21 | #include 22 | 23 | enum ByteSizeFormat { 24 | Bytes, 25 | BytesPerSecond 26 | }; 27 | 28 | QString byteSizeString(quint64 bytes, ByteSizeFormat format); 29 | QString withSuffix(const QString &string, const QString &suffix); 30 | 31 | #endif // STRINGUTILS_H 32 | -------------------------------------------------------------------------------- /src/utils/ThreadTask.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "ThreadTask.h" 19 | #include "ThreadTaskCourier.h" 20 | #include 21 | 22 | ThreadTask::ThreadTask(QObject *caller, const char *callback) 23 | : taskCaller(caller), taskCallback(callback), cancelFlag(false) 24 | { 25 | /* This restriction could be removed by making the courier thread-local */ 26 | Q_ASSERT(caller->thread() == qApp->thread()); 27 | 28 | setAutoDelete(false); 29 | ThreadTaskCourier::addTask(caller); 30 | } 31 | 32 | void ThreadTask::run() 33 | { 34 | Q_ASSERT(!autoDelete()); 35 | runTask(); 36 | ThreadTaskCourier::notify(this); 37 | } 38 | -------------------------------------------------------------------------------- /src/utils/ThreadTask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef THREADTASK_H 19 | #define THREADTASK_H 20 | 21 | #include 22 | 23 | class QObject; 24 | class ThreadTaskCourier; 25 | 26 | /* Base class for threaded tasks with support for results, progress, and cancellation. 27 | * This is built on top of QThreadPool/QRunnable, and makes use of the ThreadTaskCourier 28 | * to safely relay results. 29 | * 30 | * Subclasses must implement the runTask() method for the body of their task execution. 31 | * Always check isCancelled() at the beginning of the task and any other appropriate 32 | * points, and return immediately if true. 33 | * 34 | * The ThreadTask instance is passed to the caller as the result (via a meta-method 35 | * invocation of the callback function), who is expected to know how to cast the object 36 | * and retrieve the result from the subclass. The caller may be destroyed at any time, 37 | * and this object will be freed by the courier. */ 38 | 39 | class ThreadTask : public QRunnable 40 | { 41 | friend class ThreadTaskCourier; 42 | 43 | public: 44 | ThreadTask(QObject *caller, const char *callback); 45 | 46 | void cancel() { cancelFlag = true; } 47 | bool isCancelled() const { return cancelFlag; } 48 | 49 | protected: 50 | virtual void runTask() = 0; 51 | virtual void run(); 52 | 53 | private: 54 | QObject *taskCaller; 55 | const char *taskCallback; 56 | volatile bool cancelFlag; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/utils/ThreadTaskCourier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef THREADTASKCOURIER_H 19 | #define THREADTASKCOURIER_H 20 | 21 | #include 22 | #include 23 | 24 | class ThreadTask; 25 | 26 | class ThreadTaskCourier : public QObject 27 | { 28 | Q_OBJECT 29 | Q_DISABLE_COPY(ThreadTaskCourier) 30 | 31 | friend class ThreadTask; 32 | 33 | private slots: 34 | void deliverNotify(ThreadTask *task); 35 | void objectDestroyed(); 36 | 37 | private: 38 | static ThreadTaskCourier *instance; 39 | QHash pending; 40 | 41 | ThreadTaskCourier(); 42 | 43 | static void addTask(QObject *caller); 44 | static void notify(ThreadTask *task); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/video/VideoPlayerBackend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "VideoPlayerBackend.h" 19 | 20 | VideoPlayerBackend::VideoPlayerBackend(QObject *parent) : 21 | QObject(parent) 22 | { 23 | } 24 | 25 | VideoPlayerBackend::~VideoPlayerBackend() 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /src/video/VideoPlayerFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef VIDEO_PLAYER_FACTORY_H 19 | #define VIDEO_PLAYER_FACTORY_H 20 | 21 | class QObject; 22 | class QWidget; 23 | class VideoPlayerBackend; 24 | class VideoWidget; 25 | 26 | class VideoPlayerFactory 27 | { 28 | 29 | public: 30 | virtual ~VideoPlayerFactory() {} 31 | 32 | virtual VideoWidget * createWidget(QWidget *parent = 0) = 0; 33 | virtual VideoPlayerBackend * createBackend(QObject *parent = 0) = 0; 34 | 35 | }; 36 | 37 | #endif // VIDEO_PLAYER_FACTORY_H 38 | -------------------------------------------------------------------------------- /src/video/VideoWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "VideoWidget.h" 19 | 20 | VideoWidget::VideoWidget(QWidget *parent) : 21 | QFrame(parent) 22 | { 23 | } 24 | 25 | VideoWidget::~VideoWidget() 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /src/video/VideoWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2019 Bluecherry, LLC 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef VIDEO_WIDGET_H 19 | #define VIDEO_WIDGET_H 20 | 21 | #include 22 | 23 | class VideoPlayerBackend; 24 | 25 | class VideoWidget : public QFrame 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit VideoWidget(QWidget *parent = 0); 31 | virtual ~VideoWidget(); 32 | 33 | virtual void initVideo(VideoPlayerBackend *videoPlayerBackend) = 0; 34 | virtual void clearVideo() = 0; 35 | virtual void zoomIn() = 0; 36 | virtual void zoomOut() = 0; 37 | virtual double zoom() = 0; 38 | virtual void moveFrame(int dx, int dy) = 0; 39 | 40 | }; 41 | 42 | #endif // VIDEO_WIDGET_H 43 | -------------------------------------------------------------------------------- /src/video/libmpv/MpvVideoPlayerFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2014 Bluecherry 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "MpvVideoPlayerFactory.h" 20 | #include "MpvVideoPlayerBackend.h" 21 | #include "MpvVideoWidget.h" 22 | 23 | MpvVideoPlayerFactory::~MpvVideoPlayerFactory() 24 | { 25 | 26 | } 27 | 28 | VideoWidget * MpvVideoPlayerFactory::createWidget(QWidget *parent) 29 | { 30 | return new MpvVideoWidget(parent); 31 | } 32 | 33 | VideoPlayerBackend * MpvVideoPlayerFactory::createBackend(QObject *parent) 34 | { 35 | return new MpvVideoPlayerBackend(parent); 36 | } 37 | -------------------------------------------------------------------------------- /src/video/libmpv/MpvVideoPlayerFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2014 Bluecherry 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MPV_VIDEO_PLAYER_FACTORY_H 19 | #define MPV_VIDEO_PLAYER_FACTORY_H 20 | 21 | #include "video/VideoPlayerFactory.h" 22 | 23 | class MpvVideoPlayerFactory : public VideoPlayerFactory 24 | { 25 | 26 | public: 27 | virtual ~MpvVideoPlayerFactory(); 28 | 29 | virtual VideoWidget * createWidget(QWidget *parent = 0); 30 | virtual VideoPlayerBackend * createBackend(QObject *parent = 0); 31 | 32 | }; 33 | 34 | #endif // MPV_VIDEO_PLAYER_FACTORY_H 35 | -------------------------------------------------------------------------------- /src/video/libmpv/MpvVideoWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2014 Bluecherry 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MPV_VIDEOWIDGET_H 19 | #define MPV_VIDEOWIDGET_H 20 | 21 | #include "video/VideoWidget.h" 22 | 23 | class MpvVideoWidget : public VideoWidget 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit MpvVideoWidget(QWidget *parent = 0); 29 | virtual ~MpvVideoWidget(); 30 | 31 | virtual void initVideo(VideoPlayerBackend *videoPlayerBackend); 32 | virtual void clearVideo(); 33 | 34 | virtual QSize sizeHint() const; 35 | 36 | virtual void zoomIn(); 37 | virtual void zoomOut(); 38 | virtual double zoom() { return m_zoomFactor;} 39 | virtual void moveFrame(int dx, int dy); 40 | 41 | void setViewport(QWidget *viewport); 42 | 43 | public slots: 44 | void setFullScreen(bool on); 45 | void toggleFullScreen() { setFullScreen(!isFullScreen()); } 46 | 47 | void setOverlayMessage(const QString &message); 48 | void clearOverlayMessage() { setOverlayMessage(QString()); } 49 | 50 | protected: 51 | virtual void resizeEvent(QResizeEvent *ev); 52 | virtual void mouseDoubleClickEvent(QMouseEvent *ev); 53 | virtual void keyPressEvent(QKeyEvent *ev); 54 | 55 | private: 56 | QWidget *m_viewport; 57 | QString m_overlayMsg; 58 | int m_frameWidth, m_frameHeight; 59 | int m_normalFrameStyle; 60 | double m_zoomFactor; 61 | int m_originalWidth; 62 | int m_originalHeight; 63 | 64 | void setZoom(double z); 65 | }; 66 | 67 | #endif //MPV_VIDEOWIDGET_H 68 | -------------------------------------------------------------------------------- /tests/data/event/category-level-alarm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-camera-audio-lost.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-camera-continuous.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-camera-motion.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-camera-not-found.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-camera-video-lost.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-critical.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-info.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-invalid-category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-invalid-format.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-invalid-level.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-invalid-location-id.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-invalid-scheme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-no-scheme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-system-boot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-system-crash.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-system-disk-space.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-system-power-outage.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-system-reboot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-system-shutdown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-unknown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/category-level-warning.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/ended-before-start.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-03-01T02:00:00+00:00 14 | 2013-01-01T03:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/non-utc-date-time-event-with-non-zero-duration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00-05:00 14 | 2013-01-01T01:00:30-05:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/non-utc-date-time-event-with-zero-duration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00-05:00 14 | 2013-01-01T01:00:00-05:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/non-utc-date-time-event-without-duration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00-05:00 14 | 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/timezone-changed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T02:00:00+01:00 14 | 2013-01-01T03:00:30+02:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/utc-date-time-event-with-non-zero-duration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/utc-date-time-event-with-zero-duration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:00+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/utc-date-time-event-without-duration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/v2demo-single-full-item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Bluecherry Events for v2demo.bluecherrydvr.com 4 | 2013-04-16T16:10:03-05:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | BluecherryDVR Events Atom Generator 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=511478 12 | info: continuous event on device 5 13 | 2013-04-16T16:10:03-05:00 14 | 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=505052 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/with-media.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/without-media-invalid-attribute.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/without-media-no-attribute.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/data/event/without-media-verbatim-value.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Event 4 | 2013-04-16T16:10:03+00:00 5 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 6 | 7 | 8 | Test Event 9 | 10 | 11 | http://v2demo.bluecherrydvr.com/events/?id=1 12 | Test Event 13 | 2013-01-01T01:00:00+00:00 14 | 2013-01-01T01:00:30+00:00 15 | 16 | https://v2demo.bluecherrydvr.com:7001/media/request.php?id=1 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/tests.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2013-01-21T21:50:18 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += testlib 8 | QT -= gui 9 | 10 | CONFIG += console 11 | CONFIG -= app_bundle 12 | 13 | TARGET = bluecherry-client-tests 14 | 15 | TEMPLATE = app 16 | 17 | INCLUDEPATH += ../src 18 | 19 | SOURCES += main.cpp \ 20 | ../src/utils/Range.cpp \ 21 | ../src/utils/RangeMap.cpp \ 22 | src/utils/RangeTestCase.cpp \ 23 | src/utils/RangeMapTestCase.cpp 24 | 25 | HEADERS += \ 26 | src/utils/RangeTestCase.h \ 27 | src/utils/RangeMapTestCase.h 28 | 29 | DEFINES += SRCDIR=\\\"$$PWD/\\\" 30 | -------------------------------------------------------------------------------- /translations/README: -------------------------------------------------------------------------------- 1 | To update source (english) translation file run from this directory 2 | 3 | lupdate-qt4 ../src/ -recursive -source-language en -ts bluecherryclient_en.ts 4 | -------------------------------------------------------------------------------- /translations/setup-transifex.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | tx init 4 | tx set --auto-local -r bluecherry-client.bluecherry-client -s en 'translations/bluecherryclient_.ts' -t QT --execute 5 | 6 | ###commands: 7 | 8 | ##push resources: 9 | #tx push -s -t 10 | 11 | ##download transactions: 12 | #tx pull -a 13 | --------------------------------------------------------------------------------