diff --git a/.gitignore b/.gitignore
index caa12f24..2b0f916e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
*.lo
CMakeFiles
CMakeCache.txt
+*.cxx_parameters
autom4te.cache
*.cmake
!cmake_modules
diff --git a/DSView/CMake/FindFFTW.cmake b/DSView/CMake/FindFFTW.cmake
new file mode 100644
index 00000000..df9c8b38
--- /dev/null
+++ b/DSView/CMake/FindFFTW.cmake
@@ -0,0 +1,71 @@
+# - Find FFTW
+# Find the native FFTW includes and library
+# This module defines
+# FFTW_INCLUDE_DIR, where to find fftw3.h, etc.
+# FFTW_LIBRARIES, the libraries needed to use FFTW.
+# FFTW_FOUND, If false, do not try to use FFTW.
+# also defined, but not for general use are
+# FFTW_LIBRARY, where to find the FFTW library.
+
+FIND_PATH(FFTW_INCLUDE_DIR fftw3.h
+/usr/local/include
+/usr/include
+/opt/local/lib
+)
+
+SET(FFTW_NAMES ${FFTW_NAMES} fftw3 fftw3f fftw3-3)
+FIND_LIBRARY(FFTW_LIBRARY
+ NAMES ${FFTW_NAMES}
+ PATHS /usr/lib /usr/local/lib /opt/locala/lib
+ )
+
+# Find threads part of FFTW
+
+SET(FFTW_THREADS_NAMES ${FFTW_THREADS_NAMES} fftw3f_threads fftw3_threads fftw3-3_threads)
+FIND_LIBRARY(FFTW_THREADS_LIBRARY
+ NAMES ${FFTW_THREADS_NAMES}
+ PATHS /usr/lib /usr/local/lib /opt/local/lib
+ )
+
+IF (FFTW_THREADS_LIBRARY AND FFTW_INCLUDE_DIR)
+ SET(FFTW_THREADS_LIBRARIES ${FFTW_THREADS_LIBRARY})
+ SET(FFTW_THREADS_FOUND "YES")
+ELSE (FFTW_THREADS_LIBRARY AND FFTW_INCLUDE_DIR)
+ SET(FFTW_THREADS_FOUND "NO")
+ENDIF (FFTW_THREADS_LIBRARY AND FFTW_INCLUDE_DIR)
+
+
+IF (FFTW_THREADS_FOUND)
+ IF (NOT FFTW_THREADS_FIND_QUIETLY)
+ MESSAGE(STATUS "Found FFTW threads: ${FFTW_THREADS_LIBRARIES}")
+ ENDIF (NOT FFTW_THREADS_FIND_QUIETLY)
+ELSE (FFTW_THREADS_FOUND)
+ IF (FFTW_THREADS_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find FFTW threads library")
+ ENDIF (FFTW_THREADS_FIND_REQUIRED)
+ENDIF (FFTW_THREADS_FOUND)
+
+
+IF (FFTW_LIBRARY AND FFTW_INCLUDE_DIR)
+ SET(FFTW_LIBRARIES ${FFTW_LIBRARY})
+ SET(FFTW_FOUND "YES")
+ELSE (FFTW_LIBRARY AND FFTW_INCLUDE_DIR)
+ SET(FFTW_FOUND "NO")
+ENDIF (FFTW_LIBRARY AND FFTW_INCLUDE_DIR)
+
+
+IF (FFTW_FOUND)
+ IF (NOT FFTW_FIND_QUIETLY)
+ MESSAGE(STATUS "Found FFTW: ${FFTW_LIBRARIES}")
+ ENDIF (NOT FFTW_FIND_QUIETLY)
+ELSE (FFTW_FOUND)
+ IF (FFTW_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find FFTW library")
+ ENDIF (FFTW_FIND_REQUIRED)
+ENDIF (FFTW_FOUND)
+
+SET (ON_UNIX ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+ ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+IF (${ON_UNIX})
+ SET (FFTW_EXECUTABLE_LIBRARIES fftw3f fftw3f_threads)
+ENDIF (${ON_UNIX})
diff --git a/DSView/CMakeLists.txt b/DSView/CMakeLists.txt
index c5703c64..fad159d8 100644
--- a/DSView/CMakeLists.txt
+++ b/DSView/CMakeLists.txt
@@ -93,6 +93,7 @@ find_package(Threads)
find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED)
find_package(libusb-1.0 REQUIRED)
+find_package(FFTW REQUIRED)
#===============================================================================
#= Config Header
@@ -103,7 +104,7 @@ set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab")
set(DS_VERSION_MAJOR 0)
set(DS_VERSION_MINOR 9)
-set(DS_VERSION_MICRO 5)
+set(DS_VERSION_MICRO 6)
set(DS_VERSION_STRING
${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}
)
@@ -118,107 +119,147 @@ configure_file (
#-------------------------------------------------------------------------------
set(DSView_SOURCES
- main.cpp
- pv/devicemanager.cpp
- pv/mainwindow.cpp
- pv/sigsession.cpp
- pv/storesession.cpp
- pv/data/analog.cpp
- pv/data/analogsnapshot.cpp
- pv/data/dso.cpp
- pv/data/dsosnapshot.cpp
- pv/data/group.cpp
- pv/data/groupsnapshot.cpp
- pv/data/logic.cpp
- pv/data/logicsnapshot.cpp
- pv/data/signaldata.cpp
- pv/data/snapshot.cpp
- pv/device/devinst.cpp
- pv/device/device.cpp
- pv/device/file.cpp
- pv/device/inputfile.cpp
- pv/device/sessionfile.cpp
- pv/dialogs/about.cpp
- pv/dialogs/deviceoptions.cpp
- pv/dialogs/search.cpp
- pv/dialogs/storeprogress.cpp
- pv/dialogs/streamoptions.cpp
- pv/dialogs/waitingdialog.cpp
- pv/dialogs/dsomeasure.cpp
- pv/dock/dsotriggerdock.cpp
- pv/dock/measuredock.cpp
- pv/dock/searchdock.cpp
- pv/dock/triggerdock.cpp
- pv/prop/bool.cpp
- pv/prop/double.cpp
- pv/prop/enum.cpp
- pv/prop/int.cpp
- pv/prop/property.cpp
- pv/prop/string.cpp
- pv/prop/binding/binding.cpp
- pv/prop/binding/binding_deviceoptions.cpp
- pv/toolbars/filebar.cpp
- pv/toolbars/logobar.cpp
- pv/toolbars/samplingbar.cpp
- pv/toolbars/trigbar.cpp
- pv/view/analogsignal.cpp
- pv/view/cursor.cpp
- pv/view/devmode.cpp
- pv/view/dsldial.cpp
- pv/view/dsosignal.cpp
- pv/view/groupsignal.cpp
- pv/view/header.cpp
- pv/view/logicsignal.cpp
- pv/view/ruler.cpp
- pv/view/selectableitem.cpp
- pv/view/signal.cpp
- pv/view/timemarker.cpp
- pv/view/trace.cpp
- pv/view/view.cpp
- pv/view/viewport.cpp
- pv/widgets/fakelineedit.cpp
+ main.cpp
+ pv/sigsession.cpp
+ pv/mainwindow.cpp
+ pv/devicemanager.cpp
+ pv/data/snapshot.cpp
+ pv/data/signaldata.cpp
+ pv/data/logicsnapshot.cpp
+ pv/data/logic.cpp
+ pv/data/analogsnapshot.cpp
+ pv/data/analog.cpp
+ pv/dialogs/deviceoptions.cpp
+ pv/prop/property.cpp
+ pv/prop/int.cpp
+ pv/prop/enum.cpp
+ pv/prop/double.cpp
+ pv/prop/bool.cpp
+ pv/prop/binding/binding.cpp
+ pv/toolbars/samplingbar.cpp
+ pv/view/viewport.cpp
+ pv/view/view.cpp
+ pv/view/timemarker.cpp
+ pv/view/signal.cpp
+ pv/view/ruler.cpp
+ pv/view/logicsignal.cpp
+ pv/view/header.cpp
+ pv/view/cursor.cpp
+ pv/view/analogsignal.cpp
+ pv/prop/binding/binding_deviceoptions.cpp
+ pv/toolbars/trigbar.cpp
+ pv/toolbars/filebar.cpp
+ pv/dock/protocoldock.cpp
+ pv/dock/triggerdock.cpp
+ pv/dock/measuredock.cpp
+ pv/dock/searchdock.cpp
+ pv/toolbars/logobar.cpp
+ pv/data/groupsnapshot.cpp
+ pv/view/groupsignal.cpp
+ pv/data/group.cpp
+ pv/dialogs/about.cpp
+ pv/dialogs/search.cpp
+ pv/data/dsosnapshot.cpp
+ pv/data/dso.cpp
+ pv/view/dsosignal.cpp
+ pv/view/dsldial.cpp
+ pv/dock/dsotriggerdock.cpp
+ pv/view/trace.cpp
+ pv/view/selectableitem.cpp
+ pv/data/decoderstack.cpp
+ pv/data/decode/rowdata.cpp
+ pv/data/decode/row.cpp
+ pv/data/decode/decoder.cpp
+ pv/data/decode/annotation.cpp
+ pv/view/decodetrace.cpp
+ pv/prop/binding/decoderoptions.cpp
+ pv/widgets/fakelineedit.cpp
+ pv/widgets/decodermenu.cpp
+ pv/widgets/decodergroupbox.cpp
+ pv/prop/string.cpp
+ pv/device/sessionfile.cpp
+ pv/device/inputfile.cpp
+ pv/device/file.cpp
+ pv/device/devinst.cpp
+ pv/dialogs/storeprogress.cpp
+ pv/storesession.cpp
+ pv/view/devmode.cpp
+ pv/device/device.cpp
+ pv/dialogs/waitingdialog.cpp
+ pv/dialogs/dsomeasure.cpp
+ pv/dialogs/calibration.cpp
+ pv/data/decodermodel.cpp
+ pv/dialogs/protocollist.cpp
+ pv/dialogs/protocolexp.cpp
+ pv/dialogs/fftoptions.cpp
+ pv/data/mathstack.cpp
+ pv/view/mathtrace.cpp
+ dsapplication.cpp
+ pv/widgets/viewstatus.cpp
+ pv/toolbars/titlebar.cpp
+ pv/mainframe.cpp
+ pv/widgets/border.cpp
+ pv/dialogs/dsmessagebox.cpp
+ pv/dialogs/shadow.cpp
+ pv/dialogs/dsdialog.cpp
)
set(DSView_HEADERS
- pv/mainwindow.h
- pv/sigsession.h
- pv/storesession.h
- pv/device/devinst.h
- pv/dialogs/about.h
- pv/dialogs/deviceoptions.h
- pv/dialogs/search.h
- pv/dialogs/storeprogress.h
- pv/dialogs/streamoptions.h
- pv/dialogs/waitingdialog.h
- pv/dialogs/dsomeasure.h
- pv/dock/dsotriggerdock.h
- pv/dock/measuredock.h
- pv/dock/searchdock.h
- pv/dock/triggerdock.h
- pv/prop/bool.h
- pv/prop/double.h
- pv/prop/enum.h
- pv/prop/int.h
- pv/prop/property.h
- pv/prop/string.h
- pv/toolbars/filebar.h
- pv/toolbars/logobar.h
- pv/toolbars/samplingbar.h
- pv/toolbars/trigbar.h
- pv/view/cursor.h
- pv/view/devmode.h
- pv/view/header.h
- pv/view/ruler.h
- pv/view/selectableitem.h
- pv/view/timemarker.h
- pv/view/trace.h
- pv/view/view.h
- pv/view/viewport.h
- pv/widgets/fakelineedit.h
+ pv/sigsession.h
+ pv/mainwindow.h
+ pv/dialogs/deviceoptions.h
+ pv/prop/property.h
+ pv/prop/int.h
+ pv/prop/enum.h
+ pv/prop/double.h
+ pv/prop/bool.h
+ pv/toolbars/samplingbar.h
+ pv/view/viewport.h
+ pv/view/view.h
+ pv/view/timemarker.h
+ pv/view/ruler.h
+ pv/view/header.h
+ pv/view/cursor.h
+ pv/toolbars/trigbar.h
+ pv/toolbars/filebar.h
+ pv/dock/protocoldock.h
+ pv/dock/triggerdock.h
+ pv/dock/measuredock.h
+ pv/dock/searchdock.h
+ pv/toolbars/logobar.h
+ pv/dialogs/about.h
+ pv/dialogs/search.h
+ pv/dock/dsotriggerdock.h
+ pv/view/trace.h
+ pv/view/selectableitem.h
+ pv/data/decoderstack.h
+ pv/view/decodetrace.h
+ pv/widgets/fakelineedit.h
+ pv/widgets/decodermenu.h
+ pv/widgets/decodergroupbox.h
+ pv/prop/string.h
+ pv/device/devinst.h
+ pv/dialogs/storeprogress.h
+ pv/storesession.h
+ pv/view/devmode.h
+ pv/dialogs/waitingdialog.h
+ pv/dialogs/dsomeasure.h
+ pv/dialogs/calibration.h
+ pv/dialogs/protocollist.h
+ pv/dialogs/protocolexp.h
+ pv/dialogs/fftoptions.h
+ pv/data/mathstack.h
+ pv/view/mathtrace.h
+ pv/widgets/viewstatus.h
+ pv/toolbars/titlebar.h
+ pv/mainframe.h
+ pv/widgets/border.h
+ pv/dialogs/dsmessagebox.h
+ pv/dialogs/shadow.h
+ pv/dialogs/dsdialog.h
)
set(DSView_FORMS
- pv/dialogs/about.ui
)
set(DSView_RESOURCES
@@ -310,6 +351,7 @@ set(DSVIEW_LINK_LIBS
${CMAKE_THREAD_LIBS_INIT}
${QT_LIBRARIES}
${LIBUSB_1_LIBRARIES}
+ ${FFTW_LIBRARIES}
)
if(STATIC_PKGDEPS_LIBS)
@@ -352,21 +394,11 @@ set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "/usr/local/lib")
# Install the executable.
install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
-install(FILES res/DSLogic.fw DESTINATION bin/res/)
-install(FILES res/DSLogic33.bin DESTINATION bin/res/)
-install(FILES res/DSLogic50.bin DESTINATION bin/res/)
-install(FILES res/DSLogicPro.fw DESTINATION bin/res/)
-install(FILES res/DSLogicPro.bin DESTINATION bin/res/)
-install(FILES res/DSCope.fw DESTINATION bin/res/)
-install(FILES res/DSCope.bin DESTINATION bin/res/)
-install(FILES res/DSLogic0.dsc DESTINATION bin/res/)
-install(FILES res/DSLogic0.def.dsc DESTINATION bin/res/)
-install(FILES res/DSLogic1.dsc DESTINATION bin/res/)
-install(FILES res/DSLogic1.def.dsc DESTINATION bin/res/)
-install(FILES res/DSLogic2.dsc DESTINATION bin/res/)
-install(FILES res/DSLogic2.def.dsc DESTINATION bin/res/)
-install(FILES res/DSCope1.dsc DESTINATION bin/res/)
-install(FILES res/DSCope1.def.dsc DESTINATION bin/res/)
+install(DIRECTORY res DESTINATION share/${PROJECT_NAME})
+install(DIRECTORY ../libsigrokdecode4DSL/decoders DESTINATION share/${PROJECT_NAME})
+install(FILES icons/logo.png DESTINATION share/${PROJECT_NAME} RENAME logo.png)
+install(FILES DreamSourceLab.rules DESTINATION /etc/udev/rules.d/)
+install(FILES DSView.desktop DESTINATION /usr/share/applications/)
#===============================================================================
#= Packaging (handled by CPack)
diff --git a/DSView/DSView.desktop b/DSView/DSView.desktop
new file mode 100755
index 00000000..fba3202a
--- /dev/null
+++ b/DSView/DSView.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=0.96
+Exec=/usr/local/bin/DSView
+Name=DSView
+Comment=GUI Program for DreamSourceLab USB-based Instruments
+Icon=/usr/local/share/DSView/logo.png
+Type=Application
+Terminal=false
+Categories=Development
diff --git a/DSView/DSView.qrc b/DSView/DSView.qrc
index 05955d6d..f58808ff 100644
--- a/DSView/DSView.qrc
+++ b/DSView/DSView.qrc
@@ -36,25 +36,24 @@
icons/gear.png
icons/wiki.png
icons/wait.gif
- icons/file_cn.png
- icons/file_dis_cn.png
- icons/instant_cn.png
- icons/measure_cn.png
- icons/measure_dis_cn.png
- icons/params_cn.png
- icons/params_dis_cn.png
- icons/protocol_dis_cn.png
- icons/search-bar_cn.png
- icons/search-bar_dis_cn.png
- icons/start_cn.png
- icons/stop_cn.png
- icons/trigger_cn.png
- icons/trigger_dis_cn.png
- icons/protocol_cn.png
icons/instant_dis.png
- icons/instant_dis_cn.png
icons/start_dis.png
- icons/start_dis_cn.png
icons/settings.png
+ darkstyle/style.qss
+ icons/export.png
+ icons/single.png
+ icons/single_dis.png
+ icons/math.png
+ icons/math_dis.png
+ icons/fft.png
+ icons/Blackman.png
+ icons/Flat_top.png
+ icons/Hamming.png
+ icons/Hann.png
+ icons/Rectangle.png
+ icons/close.png
+ icons/maximize.png
+ icons/minimize.png
+ icons/restore.png
diff --git a/DSView/DreamSourceLab.rules b/DSView/DreamSourceLab.rules
new file mode 100644
index 00000000..05f68bad
--- /dev/null
+++ b/DSView/DreamSourceLab.rules
@@ -0,0 +1 @@
+SUBSYSTEM=="usb", ATTRS{idVendor}=="2a0e", MODE="0666"
diff --git a/DSView/darkstyle/rc/branch_closed-on.png b/DSView/darkstyle/rc/branch_closed-on.png
new file mode 100755
index 00000000..d081e9b3
Binary files /dev/null and b/DSView/darkstyle/rc/branch_closed-on.png differ
diff --git a/DSView/darkstyle/rc/branch_closed.png b/DSView/darkstyle/rc/branch_closed.png
new file mode 100755
index 00000000..d652159a
Binary files /dev/null and b/DSView/darkstyle/rc/branch_closed.png differ
diff --git a/DSView/darkstyle/rc/branch_open-on.png b/DSView/darkstyle/rc/branch_open-on.png
new file mode 100755
index 00000000..ec372b27
Binary files /dev/null and b/DSView/darkstyle/rc/branch_open-on.png differ
diff --git a/DSView/darkstyle/rc/branch_open.png b/DSView/darkstyle/rc/branch_open.png
new file mode 100755
index 00000000..66f8e1ac
Binary files /dev/null and b/DSView/darkstyle/rc/branch_open.png differ
diff --git a/DSView/darkstyle/rc/checkbox_checked.png b/DSView/darkstyle/rc/checkbox_checked.png
new file mode 100755
index 00000000..830cfee6
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_checked.png differ
diff --git a/DSView/darkstyle/rc/checkbox_checked_disabled.png b/DSView/darkstyle/rc/checkbox_checked_disabled.png
new file mode 100755
index 00000000..cb63cc2f
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_checked_disabled.png differ
diff --git a/DSView/darkstyle/rc/checkbox_checked_focus.png b/DSView/darkstyle/rc/checkbox_checked_focus.png
new file mode 100755
index 00000000..3cf0e540
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_checked_focus.png differ
diff --git a/DSView/darkstyle/rc/checkbox_indeterminate.png b/DSView/darkstyle/rc/checkbox_indeterminate.png
new file mode 100755
index 00000000..41024f76
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_indeterminate.png differ
diff --git a/DSView/darkstyle/rc/checkbox_indeterminate_disabled.png b/DSView/darkstyle/rc/checkbox_indeterminate_disabled.png
new file mode 100755
index 00000000..abdc01d9
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_indeterminate_disabled.png differ
diff --git a/DSView/darkstyle/rc/checkbox_indeterminate_focus.png b/DSView/darkstyle/rc/checkbox_indeterminate_focus.png
new file mode 100755
index 00000000..a9a16f7e
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_indeterminate_focus.png differ
diff --git a/DSView/darkstyle/rc/checkbox_unchecked.png b/DSView/darkstyle/rc/checkbox_unchecked.png
new file mode 100755
index 00000000..2159aca9
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_unchecked.png differ
diff --git a/DSView/darkstyle/rc/checkbox_unchecked_disabled.png b/DSView/darkstyle/rc/checkbox_unchecked_disabled.png
new file mode 100755
index 00000000..ade721e8
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_unchecked_disabled.png differ
diff --git a/DSView/darkstyle/rc/checkbox_unchecked_focus.png b/DSView/darkstyle/rc/checkbox_unchecked_focus.png
new file mode 100755
index 00000000..66f5bf56
Binary files /dev/null and b/DSView/darkstyle/rc/checkbox_unchecked_focus.png differ
diff --git a/DSView/darkstyle/rc/close-hover.png b/DSView/darkstyle/rc/close-hover.png
new file mode 100755
index 00000000..657943a6
Binary files /dev/null and b/DSView/darkstyle/rc/close-hover.png differ
diff --git a/DSView/darkstyle/rc/close-pressed.png b/DSView/darkstyle/rc/close-pressed.png
new file mode 100755
index 00000000..937d0059
Binary files /dev/null and b/DSView/darkstyle/rc/close-pressed.png differ
diff --git a/DSView/darkstyle/rc/close.png b/DSView/darkstyle/rc/close.png
new file mode 100755
index 00000000..bc0f5761
Binary files /dev/null and b/DSView/darkstyle/rc/close.png differ
diff --git a/DSView/darkstyle/rc/down_arrow.png b/DSView/darkstyle/rc/down_arrow.png
new file mode 100755
index 00000000..e271f7f9
Binary files /dev/null and b/DSView/darkstyle/rc/down_arrow.png differ
diff --git a/DSView/darkstyle/rc/down_arrow_disabled.png b/DSView/darkstyle/rc/down_arrow_disabled.png
new file mode 100755
index 00000000..5805d984
Binary files /dev/null and b/DSView/darkstyle/rc/down_arrow_disabled.png differ
diff --git a/DSView/darkstyle/rc/left_arrow.png b/DSView/darkstyle/rc/left_arrow.png
new file mode 100755
index 00000000..f808d2d7
Binary files /dev/null and b/DSView/darkstyle/rc/left_arrow.png differ
diff --git a/DSView/darkstyle/rc/left_arrow_disabled.png b/DSView/darkstyle/rc/left_arrow_disabled.png
new file mode 100755
index 00000000..f5b9af8a
Binary files /dev/null and b/DSView/darkstyle/rc/left_arrow_disabled.png differ
diff --git a/DSView/darkstyle/rc/radio_checked.png b/DSView/darkstyle/rc/radio_checked.png
new file mode 100755
index 00000000..235e6b0b
Binary files /dev/null and b/DSView/darkstyle/rc/radio_checked.png differ
diff --git a/DSView/darkstyle/rc/radio_checked_disabled.png b/DSView/darkstyle/rc/radio_checked_disabled.png
new file mode 100755
index 00000000..bf0051ed
Binary files /dev/null and b/DSView/darkstyle/rc/radio_checked_disabled.png differ
diff --git a/DSView/darkstyle/rc/radio_checked_focus.png b/DSView/darkstyle/rc/radio_checked_focus.png
new file mode 100755
index 00000000..14b1cb1c
Binary files /dev/null and b/DSView/darkstyle/rc/radio_checked_focus.png differ
diff --git a/DSView/darkstyle/rc/radio_unchecked.png b/DSView/darkstyle/rc/radio_unchecked.png
new file mode 100755
index 00000000..9a4def65
Binary files /dev/null and b/DSView/darkstyle/rc/radio_unchecked.png differ
diff --git a/DSView/darkstyle/rc/radio_unchecked_disabled.png b/DSView/darkstyle/rc/radio_unchecked_disabled.png
new file mode 100755
index 00000000..6ece890e
Binary files /dev/null and b/DSView/darkstyle/rc/radio_unchecked_disabled.png differ
diff --git a/DSView/darkstyle/rc/radio_unchecked_focus.png b/DSView/darkstyle/rc/radio_unchecked_focus.png
new file mode 100755
index 00000000..27af8112
Binary files /dev/null and b/DSView/darkstyle/rc/radio_unchecked_focus.png differ
diff --git a/DSView/darkstyle/rc/right_arrow.png b/DSView/darkstyle/rc/right_arrow.png
new file mode 100755
index 00000000..9b0a4e6a
Binary files /dev/null and b/DSView/darkstyle/rc/right_arrow.png differ
diff --git a/DSView/darkstyle/rc/right_arrow_disabled.png b/DSView/darkstyle/rc/right_arrow_disabled.png
new file mode 100755
index 00000000..5c0bee40
Binary files /dev/null and b/DSView/darkstyle/rc/right_arrow_disabled.png differ
diff --git a/DSView/darkstyle/rc/sizegrip.png b/DSView/darkstyle/rc/sizegrip.png
new file mode 100755
index 00000000..350583aa
Binary files /dev/null and b/DSView/darkstyle/rc/sizegrip.png differ
diff --git a/DSView/darkstyle/rc/stylesheet-branch-end.png b/DSView/darkstyle/rc/stylesheet-branch-end.png
new file mode 100755
index 00000000..cb5d3b51
Binary files /dev/null and b/DSView/darkstyle/rc/stylesheet-branch-end.png differ
diff --git a/DSView/darkstyle/rc/stylesheet-branch-more.png b/DSView/darkstyle/rc/stylesheet-branch-more.png
new file mode 100755
index 00000000..62711409
Binary files /dev/null and b/DSView/darkstyle/rc/stylesheet-branch-more.png differ
diff --git a/DSView/darkstyle/rc/stylesheet-vline.png b/DSView/darkstyle/rc/stylesheet-vline.png
new file mode 100755
index 00000000..87536cce
Binary files /dev/null and b/DSView/darkstyle/rc/stylesheet-vline.png differ
diff --git a/DSView/darkstyle/rc/transparent.png b/DSView/darkstyle/rc/transparent.png
new file mode 100755
index 00000000..483df251
Binary files /dev/null and b/DSView/darkstyle/rc/transparent.png differ
diff --git a/DSView/darkstyle/rc/undock.png b/DSView/darkstyle/rc/undock.png
new file mode 100755
index 00000000..88691d77
Binary files /dev/null and b/DSView/darkstyle/rc/undock.png differ
diff --git a/DSView/darkstyle/rc/up_arrow.png b/DSView/darkstyle/rc/up_arrow.png
new file mode 100755
index 00000000..abcc7245
Binary files /dev/null and b/DSView/darkstyle/rc/up_arrow.png differ
diff --git a/DSView/darkstyle/rc/up_arrow_disabled.png b/DSView/darkstyle/rc/up_arrow_disabled.png
new file mode 100755
index 00000000..b9c8e3b5
Binary files /dev/null and b/DSView/darkstyle/rc/up_arrow_disabled.png differ
diff --git a/DSView/darkstyle/style.qrc b/DSView/darkstyle/style.qrc
new file mode 100755
index 00000000..055e402f
--- /dev/null
+++ b/DSView/darkstyle/style.qrc
@@ -0,0 +1,42 @@
+
+
+ rc/up_arrow_disabled.png
+ rc/stylesheet-branch-end.png
+ rc/branch_closed-on.png
+ rc/stylesheet-vline.png
+ rc/branch_closed.png
+ rc/branch_open-on.png
+ rc/transparent.png
+ rc/right_arrow_disabled.png
+ rc/sizegrip.png
+ rc/close.png
+ rc/close-hover.png
+ rc/close-pressed.png
+ rc/down_arrow.png
+ rc/left_arrow.png
+ rc/stylesheet-branch-more.png
+ rc/up_arrow.png
+ rc/right_arrow.png
+ rc/left_arrow_disabled.png
+ rc/branch_open.png
+ rc/down_arrow_disabled.png
+ rc/undock.png
+ rc/checkbox_checked_disabled.png
+ rc/checkbox_checked_focus.png
+ rc/checkbox_checked.png
+ rc/checkbox_indeterminate.png
+ rc/checkbox_indeterminate_focus.png
+ rc/checkbox_unchecked_disabled.png
+ rc/checkbox_unchecked_focus.png
+ rc/checkbox_unchecked.png
+ rc/radio_checked_disabled.png
+ rc/radio_checked_focus.png
+ rc/radio_checked.png
+ rc/radio_unchecked_disabled.png
+ rc/radio_unchecked_focus.png
+ rc/radio_unchecked.png
+
+
+ style.qss
+
+
diff --git a/DSView/darkstyle/style.qss b/DSView/darkstyle/style.qss
new file mode 100755
index 00000000..21455512
--- /dev/null
+++ b/DSView/darkstyle/style.qss
@@ -0,0 +1,1302 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) <2013-2014>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+QProgressBar:horizontal {
+ border: 1px solid #3A3939;
+ text-align: center;
+ padding: 1px;
+ background: #201F1F;
+}
+QProgressBar::chunk:horizontal {
+ background-color: qlineargradient(spread:reflect, x1:1, y1:0.545, x2:1, y2:0, stop:0 rgba(28, 66, 111, 255), stop:1 rgba(37, 87, 146, 255));
+}
+
+QToolTip
+{
+ border: 1px solid #3A3939;
+ background-color: rgb(90, 102, 117);;
+ color: white;
+ padding: 1px;
+ opacity: 200;
+}
+
+QWidget
+{
+ color: silver;
+ background-color: #302F2F;
+ selection-background-color:#3d8ec9;
+ selection-color: black;
+ background-clip: border;
+ border-image: none;
+ outline: 0;
+}
+
+QWidget:item:hover
+{
+ background-color: #78879b;
+ color: black;
+}
+
+QWidget:item:selected
+{
+ background-color: #3d8ec9;
+}
+
+QCheckBox
+{
+ spacing: 5px;
+ outline: none;
+ color: #bbb;
+ margin-bottom: 2px;
+}
+
+QCheckBox:disabled
+{
+ color: #777777;
+}
+QCheckBox::indicator,
+QGroupBox::indicator
+{
+ width: 18px;
+ height: 18px;
+}
+QGroupBox::indicator
+{
+ margin-left: 2px;
+}
+
+QCheckBox::indicator:unchecked,
+QCheckBox::indicator:unchecked:hover,
+QGroupBox::indicator:unchecked,
+QGroupBox::indicator:unchecked:hover
+{
+ image: url(:/qss_icons/rc/checkbox_unchecked.png);
+}
+
+QCheckBox::indicator:unchecked:focus,
+QCheckBox::indicator:unchecked:pressed,
+QGroupBox::indicator:unchecked:focus,
+QGroupBox::indicator:unchecked:pressed
+{
+ border: none;
+ image: url(:/qss_icons/rc/checkbox_unchecked_focus.png);
+}
+
+QCheckBox::indicator:checked,
+QCheckBox::indicator:checked:hover,
+QGroupBox::indicator:checked,
+QGroupBox::indicator:checked:hover
+{
+ image: url(:/qss_icons/rc/checkbox_checked.png);
+}
+
+QCheckBox::indicator:checked:focus,
+QCheckBox::indicator:checked:pressed,
+QGroupBox::indicator:checked:focus,
+QGroupBox::indicator:checked:pressed
+{
+ border: none;
+ image: url(:/qss_icons/rc/checkbox_checked_focus.png);
+}
+
+QCheckBox::indicator:indeterminate,
+QCheckBox::indicator:indeterminate:hover,
+QCheckBox::indicator:indeterminate:pressed
+QGroupBox::indicator:indeterminate,
+QGroupBox::indicator:indeterminate:hover,
+QGroupBox::indicator:indeterminate:pressed
+{
+ image: url(:/qss_icons/rc/checkbox_indeterminate.png);
+}
+
+QCheckBox::indicator:indeterminate:focus,
+QGroupBox::indicator:indeterminate:focus
+{
+ image: url(:/qss_icons/rc/checkbox_indeterminate_focus.png);
+}
+
+QCheckBox::indicator:checked:disabled,
+QGroupBox::indicator:checked:disabled
+{
+ image: url(:/qss_icons/rc/checkbox_checked_disabled.png);
+}
+
+QCheckBox::indicator:unchecked:disabled,
+QGroupBox::indicator:unchecked:disabled
+{
+ image: url(:/qss_icons/rc/checkbox_unchecked_disabled.png);
+}
+
+QRadioButton
+{
+ spacing: 5px;
+ outline: none;
+ color: #bbb;
+ margin-bottom: 2px;
+}
+
+QRadioButton:disabled
+{
+ color: #777777;
+}
+QRadioButton::indicator
+{
+ width: 21px;
+ height: 21px;
+}
+
+QRadioButton::indicator:unchecked,
+QRadioButton::indicator:unchecked:hover
+{
+ image: url(:/qss_icons/rc/radio_unchecked.png);
+}
+
+QRadioButton::indicator:unchecked:focus,
+QRadioButton::indicator:unchecked:pressed
+{
+ border: none;
+ outline: none;
+ image: url(:/qss_icons/rc/radio_unchecked_focus.png);
+}
+
+QRadioButton::indicator:checked,
+QRadioButton::indicator:checked:hover
+{
+ border: none;
+ outline: none;
+ image: url(:/qss_icons/rc/radio_checked.png);
+}
+
+QRadioButton::indicator:checked:focus,
+QRadioButton::indicato::menu-arrowr:checked:pressed
+{
+ border: none;
+ outline: none;
+ image: url(:/qss_icons/rc/radio_checked_focus.png);
+}
+
+QRadioButton::indicator:indeterminate,
+QRadioButton::indicator:indeterminate:hover,
+QRadioButton::indicator:indeterminate:pressed
+{
+ image: url(:/qss_icons/rc/radio_indeterminate.png);
+}
+
+QRadioButton::indicator:checked:disabled
+{
+ outline: none;
+ image: url(:/qss_icons/rc/radio_checked_disabled.png);
+}
+
+QRadioButton::indicator:unchecked:disabled
+{
+ image: url(:/qss_icons/rc/radio_unchecked_disabled.png);
+}
+
+
+QMenuBar
+{
+ background-color: #302F2F;
+ color: silver;
+}
+
+QMenuBar::item
+{
+ background: transparent;
+}
+
+QMenuBar::item:selected
+{
+ background: transparent;
+ border: 1px solid #3A3939;
+}
+
+QMenuBar::item:pressed
+{
+ border: 1px solid #3A3939;
+ background-color: #3d8ec9;
+ color: black;
+ margin-bottom:-1px;
+ padding-bottom:1px;
+}
+
+QMenu
+{
+ border: 1px solid #3A3939;
+ color: silver;
+ margin: 0px;
+}
+
+QMenu::item
+{
+ padding: 5px 30px 5px 30px;
+ margin-left: 2px;
+ border: 1px solid transparent; /* reserve space for selection border */
+}
+
+QMenu::item:selected
+{
+ color: black;
+}
+
+QMenu::separator {
+ height: 2px;
+ background: lightblue;
+ margin-left: 10px;
+ margin-right: 5px;
+}
+
+QMenu::indicator {
+ width: 18px;
+ height: 18px;
+}
+
+/* non-exclusive indicator = check box style indicator
+ (see QActionGroup::setExclusive) */
+QMenu::indicator:non-exclusive:unchecked {
+ image: url(:/qss_icons/rc/checkbox_unchecked.png);
+}
+
+QMenu::indicator:non-exclusive:unchecked:selected {
+ image: url(:/qss_icons/rc/checkbox_unchecked_disabled.png);
+}
+
+QMenu::indicator:non-exclusive:checked {
+ image: url(:/qss_icons/rc/checkbox_checked.png);
+}
+
+QMenu::indicator:non-exclusive:checked:selected {
+ image: url(:/qss_icons/rc/checkbox_checked_disabled.png);
+}
+
+/* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */
+QMenu::indicator:exclusive:unchecked {
+ image: url(:/qss_icons/rc/radio_unchecked.png);
+}
+
+QMenu::indicator:exclusive:unchecked:selected {
+ image: url(:/qss_icons/rc/radio_unchecked_disabled.png);
+}
+
+QMenu::indicator:exclusive:checked {
+ image: url(:/qss_icons/rc/radio_checked.png);
+}
+
+QMenu::indicator:exclusive:checked:selected {
+ image: url(:/qss_icons/rc/radio_checked_disabled.png);
+}
+
+QMenu::right-arrow {
+ margin: 5px;
+ image: url(:/qss_icons/rc/right_arrow.png)
+}
+
+
+QWidget:disabled
+{
+ color: #404040;
+ background-color: #302F2F;
+}
+
+QAbstractItemView
+{
+ alternate-background-color: #3A3939;
+ color: silver;
+ border: 1px solid 3A3939;
+ border-radius: 2px;
+ padding: 1px;
+}
+
+QTabWidget:focus, QCheckBox:focus, QRadioButton:focus, QSlider:focus
+{
+ border: none;
+}
+
+QLineEdit
+{
+ background-color: #201F1F;
+ padding: 2px;
+ border-style: solid;
+ border: 1px solid #3A3939;
+ border-radius: 2px;
+ color: silver;
+}
+
+QGroupBox {
+ border:1px solid #3A3939;
+ border-radius: 2px;
+ margin-top: 20px;
+}
+
+QGroupBox::title {
+ subcontrol-origin: margin;
+ subcontrol-position: top center;
+ padding-left: 10px;
+ padding-right: 10px;
+ padding-top: 10px;
+}
+
+QScrollBar:horizontal
+{
+ height: 15px;
+ margin: 3px 15px 3px 15px;
+ border: 1px transparent #2A2929;
+ border-radius: 4px;
+ background-color: #2A2929;
+}
+
+QScrollBar::handle:horizontal
+{
+ background-color: #605F5F;
+ min-width: 15px;
+ border-radius: 4px;
+}
+
+QScrollBar::add-line:horizontal
+{
+ margin: 0px 3px 0px 3px;
+ border-image: url(:/qss_icons/rc/right_arrow_disabled.png);
+ width: 10px;
+ height: 10px;
+ subcontrol-position: right;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::sub-line:horizontal
+{
+ margin: 0px 3px 0px 3px;
+ border-image: url(:/qss_icons/rc/left_arrow_disabled.png);
+ height: 10px;
+ width: 10px;
+ subcontrol-position: left;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::add-line:horizontal:hover,QScrollBar::add-line:horizontal:on
+{
+ border-image: url(:/qss_icons/rc/right_arrow.png);
+ height: 10px;
+ width: 10px;
+ subcontrol-position: right;
+ subcontrol-origin: margin;
+}
+
+
+QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:on
+{
+ border-image: url(:/qss_icons/rc/left_arrow.png);
+ height: 10px;
+ width: 10px;
+ subcontrol-position: left;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::up-arrow:horizontal, QScrollBar::down-arrow:horizontal
+{
+ background: none;
+}
+
+
+QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal
+{
+ background: none;
+}
+
+QScrollBar:vertical
+{
+ background-color: #2A2929;
+ width: 15px;
+ margin: 15px 3px 15px 3px;
+ border: 1px transparent #2A2929;
+ border-radius: 4px;
+}
+
+QScrollBar::handle:vertical
+{
+ background-color: #605F5F;
+ min-height: 15px;
+ border-radius: 4px;
+}
+
+QScrollBar::sub-line:vertical
+{
+ margin: 3px 0px 3px 0px;
+ border-image: url(:/qss_icons/rc/up_arrow_disabled.png);
+ height: 10px;
+ width: 10px;
+ subcontrol-position: top;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::add-line:vertical
+{
+ margin: 3px 0px 3px 0px;
+ border-image: url(:/qss_icons/rc/down_arrow_disabled.png);
+ height: 10px;
+ width: 10px;
+ subcontrol-position: bottom;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::sub-line:vertical:hover,QScrollBar::sub-line:vertical:on
+{
+
+ border-image: url(:/qss_icons/rc/up_arrow.png);
+ height: 10px;
+ width: 10px;
+ subcontrol-position: top;
+ subcontrol-origin: margin;
+}
+
+
+QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on
+{
+ border-image: url(:/qss_icons/rc/down_arrow.png);
+ height: 10px;
+ width: 10px;
+ subcontrol-position: bottom;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical
+{
+ background: none;
+}
+
+
+QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
+{
+ background: none;
+}
+
+QTextEdit
+{
+ background-color: #201F1F;
+ color: silver;
+ border: 1px solid #3A3939;
+ margin: 0;
+}
+
+QPlainTextEdit
+{
+ background-color: #201F1F;;
+ color: silver;
+ border-radius: 2px;
+ border: 1px solid #3A3939;
+}
+
+QHeaderView::section
+{
+ background-color: #3A3939;
+ color: silver;
+ padding-left: 4px;
+ border: 1px solid #6c6c6c;
+}
+
+QSizeGrip {
+ image: url(:/qss_icons/rc/sizegrip.png);
+ width: 12px;
+ height: 12px;
+}
+
+
+QMenu::separator
+{
+ height: 1px;
+ background-color: #3A3939;
+ color: white;
+ padding-left: 4px;
+ margin-left: 10px;
+ margin-right: 5px;
+}
+
+QFrame
+{
+ border-radius: 2px;
+ border: 1px solid #444;
+}
+
+QFrame[frameShape="0"]
+{
+ border-radius: 2px;
+ border: 1px transparent #444;
+}
+
+QStackedWidget
+{
+ border: 1px transparent black;
+}
+
+QToolBar {
+ border: 1px transparent #393838;
+ background: 1px solid #302F2F;
+ font-weight: bold;
+}
+
+QPushButton
+{
+ color: silver;
+ background-color: #302F2F;
+ border-width: 1px;
+ border-color: #202020;
+ border-style: solid;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ padding-left: 5px;
+ padding-right: 5px;
+ border-radius: 5px;
+ outline: none;
+}
+
+QPushButton:disabled
+{
+ background-color: #302F2F;
+ border-width: 1px;
+ border-color: #3A3939;
+ border-style: solid;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ padding-left: 10px;
+ padding-right: 10px;
+ border-radius: 5px;
+ color: #454545;
+}
+
+QComboBox
+{
+ selection-background-color: #3d8ec9;
+ background-color: #201F1F;
+ border-style: solid;
+ border: 1px solid #3A3939;
+ border-radius: 2px;
+ padding: 2px;
+ min-width: 30px;
+}
+
+QPushButton:checked{
+background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F,
+ stop: 0.5 #6a6868,
+ stop: 1 #302F2F);
+}
+
+QPushButton:hover
+{
+background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F, stop: 0.4 #4E4D4D,
+ stop: 0.5 #6a6868,
+ stop: 0.6 #4E4D4D, stop: 1 #302F2F);
+}
+
+QComboBox:hover,QAbstractSpinBox:hover,QLineEdit:hover,QTextEdit:hover,QPlainTextEdit:hover,QAbstractView:hover,QTreeView:hover
+{
+ border: 1px solid #606060;
+ color: silver;
+}
+
+QComboBox:on
+{
+ background-color: #626873;
+ padding-top: 3px;
+ padding-left: 4px;
+ selection-background-color: #4a4a4a;
+}
+
+QComboBox QAbstractItemView
+{
+ background-color: #201F1F;
+ border-radius: 2px;
+ border: 1px solid #444;
+ selection-background-color: #3d8ec9;
+}
+
+QComboBox::drop-down
+{
+ subcontrol-origin: padding;
+ subcontrol-position: top right;
+ width: 15px;
+
+ border-left-width: 0px;
+ border-left-color: darkgray;
+ border-left-style: solid;
+ border-top-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+}
+
+QComboBox::down-arrow
+{
+ image: url(:/qss_icons/rc/down_arrow_disabled.png);
+}
+
+QComboBox::down-arrow:on, QComboBox::down-arrow:hover,
+QComboBox::down-arrow:focus
+{
+ image: url(:/qss_icons/rc/down_arrow.png);
+}
+
+QAbstractSpinBox {
+ padding-top: 2px;
+ padding-bottom: 2px;
+ border: 1px solid #3A3939;
+ background-color: #201F1F;
+ color: silver;
+ border-radius: 2px;
+ min-width: 60px;
+}
+
+QAbstractSpinBox:up-button
+{
+ background-color: transparent;
+ subcontrol-origin: border;
+ subcontrol-position: center right;
+}
+
+QAbstractSpinBox:down-button
+{
+ background-color: transparent;
+ subcontrol-origin: border;
+ subcontrol-position: center left;
+}
+
+QAbstractSpinBox::up-arrow,QAbstractSpinBox::up-arrow:disabled,QAbstractSpinBox::up-arrow:off {
+ image: url(:/qss_icons/rc/up_arrow_disabled.png);
+ width: 10px;
+ height: 10px;
+}
+QAbstractSpinBox::up-arrow:hover
+{
+ image: url(:/qss_icons/rc/up_arrow.png);
+}
+
+
+QAbstractSpinBox::down-arrow,QAbstractSpinBox::down-arrow:disabled,QAbstractSpinBox::down-arrow:off
+{
+ image: url(:/qss_icons/rc/down_arrow_disabled.png);
+ width: 10px;
+ height: 10px;
+}
+QAbstractSpinBox::down-arrow:hover
+{
+ image: url(:/qss_icons/rc/down_arrow.png);
+}
+
+
+QLabel
+{
+ border: 0px solid black;
+ margin-left: 2px;
+ margin-right: 2px;
+}
+
+QTabWidget{
+ border: 1px transparent black;
+}
+
+QTabWidget::pane {
+ border: 1px transparent #444;
+ border-radius: 3px;
+ padding: 3px;
+}
+
+QTabBar
+{
+ qproperty-drawBase: 0;
+ left: 5px; /* move to the right by 5px */
+}
+
+QTabBar:focus
+{
+ border: 0px transparent black;
+}
+
+QTabBar::close-button {
+ image: url(:/qss_icons/rc/close.png);
+ background: transparent;
+}
+
+QTabBar::close-button:hover
+{
+ image: url(:/qss_icons/rc/close-hover.png);
+ background: transparent;
+}
+
+QTabBar::close-button:pressed {
+ image: url(:/qss_icons/rc/close-pressed.png);
+ background: transparent;
+}
+
+/* TOP TABS */
+QTabBar::tab:top {
+ color: #b1b1b1;
+ border: 1px solid #4A4949;
+ border-bottom: 1px transparent black;
+ background-color: #302F2F;
+ padding: 5px;
+ border-top-left-radius: 2px;
+ border-top-right-radius: 2px;
+}
+
+QTabBar::tab:top:!selected
+{
+ color: #b1b1b1;
+ background-color: #201F1F;
+ border: 1px transparent #4A4949;
+ border-bottom: 1px transparent #4A4949;
+ border-top-left-radius: 0px;
+ border-top-right-radius: 0px;
+}
+
+QTabBar::tab:top:!selected:hover {
+ background-color: #48576b;
+}
+
+/* BOTTOM TABS */
+QTabBar::tab:bottom {
+ color: #b1b1b1;
+ border: 1px solid #4A4949;
+ border-top: 1px transparent black;
+ background-color: #302F2F;
+ padding: 5px;
+ border-bottom-left-radius: 2px;
+ border-bottom-right-radius: 2px;
+}
+
+QTabBar::tab:bottom:!selected
+{
+ color: #b1b1b1;
+ background-color: #201F1F;
+ border: 1px transparent #4A4949;
+ border-top: 1px transparent #4A4949;
+ border-bottom-left-radius: 0px;
+ border-bottom-right-radius: 0px;
+}
+
+QTabBar::tab:bottom:!selected:hover {
+ background-color: #78879b;
+}
+
+/* LEFT TABS */
+QTabBar::tab:left {
+ color: #b1b1b1;
+ border: 1px transparent #4A4949;
+ border-left: 1px transparent black;
+ background-color: #48576b;
+ padding: 5px;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
+}
+
+QTabBar::tab:left:!selected
+{
+ color: #b1b1b1;
+ background-color: #302F2F;
+ border: 1px transparent #4A4949;
+ border-right: 1px transparent #4A4949;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
+}
+
+QTabBar::tab:left:hover {
+ background-color: #48576b;
+}
+
+QTabBar::tab:left:disabled
+{
+ color: #3A3939;
+ background-color: #302F2F;
+ border: 1px transparent #4A4949;
+ border-right: 1px transparent #4A4949;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
+}
+
+
+
+/* RIGHT TABS */
+QTabBar::tab:right {
+ color: #b1b1b1;
+ border: 1px solid #4A4949;
+ border-right: 1px transparent black;
+ background-color: #302F2F;
+ padding: 5px;
+ border-top-left-radius: 2px;
+ border-bottom-left-radius: 2px;
+}
+
+QTabBar::tab:right:!selected
+{
+ color: #b1b1b1;
+ background-color: #201F1F;
+ border: 1px transparent #4A4949;
+ border-right: 1px transparent #4A4949;
+ border-top-left-radius: 0px;
+ border-bottom-left-radius: 0px;
+}
+
+QTabBar::tab:right:!selected:hover {
+ background-color: #48576b;
+}
+
+QTabBar QToolButton::right-arrow:enabled {
+ image: url(:/qss_icons/rc/right_arrow.png);
+ }
+
+ QTabBar QToolButton::left-arrow:enabled {
+ image: url(:/qss_icons/rc/left_arrow.png);
+ }
+
+QTabBar QToolButton::right-arrow:disabled {
+ image: url(:/qss_icons/rc/right_arrow_disabled.png);
+ }
+
+ QTabBar QToolButton::left-arrow:disabled {
+ image: url(:/qss_icons/rc/left_arrow_disabled.png);
+ }
+
+
+QDockWidget {
+ border: 1px transparent #403F3F;
+ titlebar-close-icon: url(:/qss_icons/rc/close.png);
+ titlebar-normal-icon: url(:/qss_icons/rc/undock.png);
+}
+
+QDockWidget::title {
+ border: 1px solid #282727;
+ background-color: #2b2a2a;
+}
+
+QDockWidget::close-button, QDockWidget::float-button {
+ border: 1px solid transparent;
+ border-radius: 2px;
+ background: transparent;
+}
+
+QDockWidget::close-button:hover, QDockWidget::float-button:hover {
+ background: rgba(255, 255, 255, 10);
+}
+
+QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
+ padding: 1px -1px -1px 1px;
+ background: rgba(255, 255, 255, 10);
+}
+
+QTreeView, QListView
+{
+ border: 1px solid #444;
+ background-color: #201F1F;
+}
+
+QTreeView:branch:selected, QTreeView:branch:hover
+{
+ background: url(:/qss_icons/rc/transparent.png);
+}
+
+QTreeView::branch:has-siblings:!adjoins-item {
+ border-image: url(:/qss_icons/rc/transparent.png);
+}
+
+QTreeView::branch:has-siblings:adjoins-item {
+ border-image: url(:/qss_icons/rc/transparent.png);
+}
+
+QTreeView::branch:!has-children:!has-siblings:adjoins-item {
+ border-image: url(:/qss_icons/rc/transparent.png);
+}
+
+QTreeView::branch:has-children:!has-siblings:closed,
+QTreeView::branch:closed:has-children:has-siblings {
+ image: url(:/qss_icons/rc/branch_closed.png);
+}
+
+QTreeView::branch:open:has-children:!has-siblings,
+QTreeView::branch:open:has-children:has-siblings {
+ image: url(:/qss_icons/rc/branch_open.png);
+}
+
+QTreeView::branch:has-children:!has-siblings:closed:hover,
+QTreeView::branch:closed:has-children:has-siblings:hover {
+ image: url(:/qss_icons/rc/branch_closed-on.png);
+ }
+
+QTreeView::branch:open:has-children:!has-siblings:hover,
+QTreeView::branch:open:has-children:has-siblings:hover {
+ image: url(:/qss_icons/rc/branch_open-on.png);
+ }
+
+QListView::item:!selected:hover, QListView::item:!selected:hover, QTreeView::item:!selected:hover {
+ background: rgba(0, 0, 0, 0);
+ outline: 0;
+ color: #FFFFFF
+}
+
+QListView::item:selected:hover, QListView::item:selected:hover, QTreeView::item:selected:hover {
+ background: #3d8ec9;
+ color: #FFFFFF;
+}
+
+QSlider::groove:horizontal {
+ border: 1px solid #3A3939;
+ height: 8px;
+ background: #201F1F;
+ margin: 2px 0;
+ border-radius: 2px;
+}
+
+QSlider::groove:horizontal:disabled {
+ border: 1px solid #3A3939;
+ height: 8px;
+ background: #282727;
+ margin: 2px 0;
+ border-radius: 2px;
+}
+
+QSlider::handle:horizontal {
+ background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 silver, stop: 0.2 #a8a8a8, stop: 1 #727272);
+ border: 1px solid #3A3939;
+ width: 10px;
+ height: 14px;
+ margin: -4px 0;
+ border-radius: 2px;
+}
+
+QSlider::handle:horizontal:disabled {
+ background: #4A4949;
+ border: 1px solid #3A3939;
+ width: 10px;
+ height: 14px;
+ margin: -4px 0;
+ border-radius: 2px;
+}
+
+QSlider::groove:vertical {
+ border: 1px solid #3A3939;
+ width: 8px;
+ background: #201F1F;
+ margin: 0 0px;
+ border-radius: 2px;
+}
+
+QSlider::groove:vertical:disabled {
+ border: 1px solid #3A3939;
+ height: 8px;
+ background: #403F3F;
+ margin: 2px 0;
+ border-radius: 2px;
+}
+
+QSlider::handle:vertical {
+ background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 silver,
+ stop: 0.2 #a8a8a8, stop: 1 #727272);
+ border: 1px solid #3A3939;
+ width: 14px;
+ height: 10px;
+ margin: 0 -4px;
+ border-radius: 2px;
+}
+
+QSlider::handle:vertical:disabled {
+ background: #4A4949;
+ border: 1px solid #3A3939;
+ width: 14px;
+ height: 10px;
+ margin: 0 -4px;
+ border-radius: 2px;
+}
+
+QToolButton#MaximizeButton {
+ background-color: transparent;
+ border-left: 1px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F, stop: 0.3 #606060,
+ stop: 0.5 #707070,
+ stop: 0.7 #606060, stop: 1 #302F2F);
+ border-right: 1px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F, stop: 0.3 #606060,
+ stop: 0.5 #707070,
+ stop: 0.7 #606060, stop: 1 #302F2F);
+ border-radius: 0px;
+ margin: 0px;
+ padding: 0px;
+}
+
+QToolButton#MinimizeButton,
+QToolButton#CloseButton {
+ background-color: transparent;
+ border: 1px transparent #808080;
+ border-radius: 0px;
+ margin: 0px;
+ padding: 0px;
+}
+
+QToolButton#MinimizeButton:hover, QToolButton#MinimizeButton::menu-button:hover,
+QToolButton#MaximizeButton:hover, QToolButton#MaximizeButton::menu-button:hover{
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F, stop: 0.4 #4E4D4D,
+ stop: 0.5 #4A4949,
+ stop: 0.6 #4E4D4D, stop: 1 #302F2F);
+}
+
+QToolButton#CloseButton:hover, QToolButton#CloseButton::menu-button:hover {
+background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F, stop: 0.2 #A82F2F,
+ stop: 0.5 #E83E4A,
+ stop: 0.8 #A82F2F, stop: 1 #302F2F);
+}
+
+QToolButton {
+ background-color: transparent;
+ border: 1px transparent #4A4949;
+ border-radius: 2px;
+ margin: 3px;
+ padding: 3px;
+}
+
+QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
+ padding-right: 20px; /* make way for the popup button */
+ border: 1px transparent #4A4949;
+ border-radius: 5px;
+}
+
+QToolButton[popupMode="2"] { /* only for InstantPopup */
+ padding-right: 10px; /* make way for the popup button */
+ border: 1px transparent #4A4949;
+}
+
+
+QToolButton:hover, QToolButton::menu-button:hover {
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F, stop: 0.4 #4E4D4D,
+ stop: 0.5 #4A4949,
+ stop: 0.6 #4E4D4D, stop: 1 #302F2F);
+}
+
+QToolButton:checked, QToolButton:pressed,
+QToolButton::menu-button:pressed {
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F,
+ stop: 0.5 #4A4949,
+ stop: 1.0 #302F2F);
+}
+
+/* the subcontrol below is used only in the InstantPopup or DelayedPopup mode */
+QToolButton::menu-indicator {
+ image: url(:/qss_icons/rc/down_arrow.png);
+ top: -7px; left: -2px; /* shift it a bit */
+}
+
+/* the subcontrols below are used only in the MenuButtonPopup mode */
+QToolButton::menu-button {
+ border: 1px transparent #4A4949;
+ border-top-right-radius: 6px;
+ border-bottom-right-radius: 6px;
+ /* 16px width + 4px for border = 20px allocated above */
+ width: 16px;
+ outline: none;
+}
+
+QToolButton::menu-arrow {
+ image: url(:/qss_icons/rc/down_arrow.png);
+}
+
+QToolButton::menu-arrow:open {
+ top: 1px; left: 1px; /* shift it a bit */
+ border: 1px solid #3A3939;
+}
+
+QPushButton::menu-indicator {
+ subcontrol-origin: padding;
+ subcontrol-position: bottom right;
+ left: 8px;
+}
+
+QTableView
+{
+ border: 1px transparent #444;
+ gridline-color: #6c6c6c;
+ background-color: #201F1F;
+}
+
+
+QTableView, QHeaderView
+{
+ border-radius: 0px;
+}
+
+QTableView::item:pressed, QListView::item:pressed, QTreeView::item:pressed {
+ background: #78879b;
+ color: #FFFFFF;
+}
+
+QTableView::item:selected:active, QTreeView::item:selected:active, QListView::item:selected:active {
+ background: #3d8ec9;
+ color: #FFFFFF;
+}
+
+QHeaderView
+{
+ border: 1px transparent;
+ border-radius: 2px;
+ margin: 0px;
+ padding: 0px;
+}
+
+QHeaderView::section {
+ background-color: #302F2F;
+ color: silver;
+ padding: 4px;
+ border: 1px transparent #6c6c6c;
+ border-radius: 0px;
+ text-align: center;
+}
+
+QHeaderView::section::vertical::first, QHeaderView::section::vertical::only-one
+{
+ border-top: 1px transparent #6c6c6c;
+}
+
+QHeaderView::section::vertical
+{
+ border-top: transparent;
+}
+
+QHeaderView::section::horizontal::first, QHeaderView::section::horizontal::only-one
+{
+ border-left: 1px transparent #6c6c6c;
+}
+
+QHeaderView::section::horizontal
+{
+ border-left: transparent;
+}
+
+
+QHeaderView::section:checked
+ {
+ color: white;
+ background-color: #5A5959;
+ }
+
+ /* style the sort indicator */
+QHeaderView::down-arrow {
+ image: url(:/qss_icons/rc/down_arrow.png);
+}
+
+QHeaderView::up-arrow {
+ image: url(:/qss_icons/rc/up_arrow.png);
+}
+
+
+QTableCornerButton::section {
+ background-color: #3A3939;
+ border: 1px solid #3A3939;
+ border-radius: 2px;
+}
+
+QToolBox {
+ padding: 3px;
+ border: 1px transparent black;
+}
+
+QToolBox::tab {
+ color: #b1b1b1;
+ background-color: #302F2F;
+ border: 1px solid #4A4949;
+ border-bottom: 1px transparent #302F2F;
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+}
+
+ QToolBox::tab:selected { /* italicize selected tabs */
+ font: italic;
+ background-color: #302F2F;
+ border-color: #3d8ec9;
+ }
+
+QStatusBar::item {
+ border: 1px solid #3A3939;
+ border-radius: 2px;
+ }
+
+QFrame[height="3"], QFrame[width="3"] {
+ background-color: #444;
+}
+
+QAbstractScrollArea
+{
+ border-radius: 2px;
+ border: 0px transparent #3A3939;
+ background-color: #302F2F;
+}
+
+QSplitter::handle:horizontal,
+QMainWindow::separator
+{
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F,
+ stop: 0.4 #333333,
+ stop: 0.5 #404040,
+ stop: 0.6 #333333,
+ stop: 1 #302F2F);
+ color: white;
+ padding-left: 0px;
+ spacing: 0px;
+ width: 3px;
+ border: 0px solid #202020;
+}
+
+QSplitter::handle:horizontal:hover,
+QMainWindow::separator:hover
+{
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0.0 #302F2F,
+ stop: 0.1 #333333,
+ stop: 0.5 #404040,
+ stop: 0.9 #333333,
+ stop: 1 #302F2F);
+ color: white;
+ padding-left: 0px;
+ spacing: 0px;
+ width: 3px;
+ border: 0px solid #202020;
+}
+
+QSplitter::handle:vertical {
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,
+ stop: 0.0 #302F2F,
+ stop: 0.3 #505050,
+ stop: 0.5 #606060,
+ stop: 0.7 #505050,
+ stop: 1 #302F2F);
+ height: 3px;
+}
+
+QSplitter::handle:vertical:hover {
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,
+ stop: 0.0 #302F2F,
+ stop: 0.1 #505050,
+ stop: 0.5 #606060,
+ stop: 0.8 #505050,
+ stop: 1 #302F2F);
+ height: 3px;
+}
diff --git a/DSView/dsapplication.cpp b/DSView/dsapplication.cpp
new file mode 100644
index 00000000..9facc855
--- /dev/null
+++ b/DSView/dsapplication.cpp
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the DSView project.
+ * DSView is based on PulseView.
+ *
+ * Copyright (C) 2016 DreamSourceLab
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "dsapplication.h"
+
+#include
+
+DSApplication::DSApplication(int &argc, char **argv):
+ QApplication(argc, argv)
+{
+}
+
+bool DSApplication::notify(QObject *receiver_, QEvent *event_)
+{
+ try {
+ return QApplication::notify(receiver_, event_);
+ } catch ( std::exception& e ) {
+ QMessageBox msg(NULL);
+ msg.setText("Application Error");
+ msg.setInformativeText(e.what());
+ msg.setStandardButtons(QMessageBox::Ok);
+ msg.setIcon(QMessageBox::Warning);
+ msg.exec();
+ } catch (...) {
+ QMessageBox msg(NULL);
+ msg.setText("Application Error");
+ msg.setInformativeText("An unexpected error occurred");
+ msg.setStandardButtons(QMessageBox::Ok);
+ msg.setIcon(QMessageBox::Warning);
+ msg.exec();
+ }
+ return false;
+}
diff --git a/DSView/dsapplication.h b/DSView/dsapplication.h
new file mode 100644
index 00000000..7e804745
--- /dev/null
+++ b/DSView/dsapplication.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the DSView project.
+ * DSView is based on PulseView.
+ *
+ * Copyright (C) 2016 DreamSourceLab
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef DSVIEW_DSAPPLICATION_H
+#define DSVIEW_DSAPPLICATION_H
+
+#include
+#include
+
+class DSApplication : public QApplication
+{
+public:
+ DSApplication(int &argc, char ** argv);
+ // ~MyApplication();
+private:
+ bool notify(QObject *receiver_, QEvent *event_);
+};
+
+#endif // DSVIEW_DSAPPLICATION_H
diff --git a/DSView/extdef.h b/DSView/extdef.h
index 549c0629..7fc608fe 100644
--- a/DSView/extdef.h
+++ b/DSView/extdef.h
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,4 +29,10 @@
#define begin_element(x) (&x[0])
#define end_element(x) (&x[countof(x)])
+enum View_type {
+ TIME_VIEW,
+ FFT_VIEW,
+ ALL_VIEW
+};
+
#endif // DSVIEW_EXTDEF_H
diff --git a/DSView/icons/Blackman.png b/DSView/icons/Blackman.png
new file mode 100644
index 00000000..b3a268e5
Binary files /dev/null and b/DSView/icons/Blackman.png differ
diff --git a/DSView/icons/Flat_top.png b/DSView/icons/Flat_top.png
new file mode 100644
index 00000000..56093184
Binary files /dev/null and b/DSView/icons/Flat_top.png differ
diff --git a/DSView/icons/Hamming.png b/DSView/icons/Hamming.png
new file mode 100644
index 00000000..c9160ea0
Binary files /dev/null and b/DSView/icons/Hamming.png differ
diff --git a/DSView/icons/Hann.png b/DSView/icons/Hann.png
new file mode 100644
index 00000000..01d68b1d
Binary files /dev/null and b/DSView/icons/Hann.png differ
diff --git a/DSView/icons/Rectangle.png b/DSView/icons/Rectangle.png
new file mode 100644
index 00000000..cacd4711
Binary files /dev/null and b/DSView/icons/Rectangle.png differ
diff --git a/DSView/icons/about.png b/DSView/icons/about.png
index ac389095..c8f40c62 100644
Binary files a/DSView/icons/about.png and b/DSView/icons/about.png differ
diff --git a/DSView/icons/close.png b/DSView/icons/close.png
new file mode 100644
index 00000000..529f2ed1
Binary files /dev/null and b/DSView/icons/close.png differ
diff --git a/DSView/icons/export.png b/DSView/icons/export.png
new file mode 100644
index 00000000..57ee72ff
Binary files /dev/null and b/DSView/icons/export.png differ
diff --git a/DSView/icons/fft.png b/DSView/icons/fft.png
new file mode 100644
index 00000000..f2e0db4a
Binary files /dev/null and b/DSView/icons/fft.png differ
diff --git a/DSView/icons/file.png b/DSView/icons/file.png
index 2a4715da..78c469cc 100644
Binary files a/DSView/icons/file.png and b/DSView/icons/file.png differ
diff --git a/DSView/icons/file_cn.png b/DSView/icons/file_cn.png
deleted file mode 100644
index 00096c50..00000000
Binary files a/DSView/icons/file_cn.png and /dev/null differ
diff --git a/DSView/icons/file_dis.png b/DSView/icons/file_dis.png
index 65373110..5c27e1ae 100644
Binary files a/DSView/icons/file_dis.png and b/DSView/icons/file_dis.png differ
diff --git a/DSView/icons/file_dis_cn.png b/DSView/icons/file_dis_cn.png
deleted file mode 100644
index b6e24584..00000000
Binary files a/DSView/icons/file_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/instant.png b/DSView/icons/instant.png
index 2aa5c250..c3e249d3 100644
Binary files a/DSView/icons/instant.png and b/DSView/icons/instant.png differ
diff --git a/DSView/icons/instant_cn.png b/DSView/icons/instant_cn.png
deleted file mode 100644
index 0e586094..00000000
Binary files a/DSView/icons/instant_cn.png and /dev/null differ
diff --git a/DSView/icons/instant_dis.png b/DSView/icons/instant_dis.png
old mode 100755
new mode 100644
index e3f8adfc..9c24bf07
Binary files a/DSView/icons/instant_dis.png and b/DSView/icons/instant_dis.png differ
diff --git a/DSView/icons/instant_dis_cn.png b/DSView/icons/instant_dis_cn.png
deleted file mode 100755
index 4477a544..00000000
Binary files a/DSView/icons/instant_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/math.png b/DSView/icons/math.png
new file mode 100644
index 00000000..dbb83a78
Binary files /dev/null and b/DSView/icons/math.png differ
diff --git a/DSView/icons/math_dis.png b/DSView/icons/math_dis.png
new file mode 100644
index 00000000..9850dd5e
Binary files /dev/null and b/DSView/icons/math_dis.png differ
diff --git a/DSView/icons/maximize.png b/DSView/icons/maximize.png
new file mode 100644
index 00000000..bb4bffb8
Binary files /dev/null and b/DSView/icons/maximize.png differ
diff --git a/DSView/icons/measure.png b/DSView/icons/measure.png
index c858a50d..461bb7c9 100644
Binary files a/DSView/icons/measure.png and b/DSView/icons/measure.png differ
diff --git a/DSView/icons/measure_cn.png b/DSView/icons/measure_cn.png
deleted file mode 100644
index 71619a88..00000000
Binary files a/DSView/icons/measure_cn.png and /dev/null differ
diff --git a/DSView/icons/measure_dis.png b/DSView/icons/measure_dis.png
index 8510560a..3f152eee 100644
Binary files a/DSView/icons/measure_dis.png and b/DSView/icons/measure_dis.png differ
diff --git a/DSView/icons/measure_dis_cn.png b/DSView/icons/measure_dis_cn.png
deleted file mode 100644
index d023a23d..00000000
Binary files a/DSView/icons/measure_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/minimize.png b/DSView/icons/minimize.png
new file mode 100644
index 00000000..7c9a9fd3
Binary files /dev/null and b/DSView/icons/minimize.png differ
diff --git a/DSView/icons/next.png b/DSView/icons/next.png
index cc35544b..d3efe6f2 100644
Binary files a/DSView/icons/next.png and b/DSView/icons/next.png differ
diff --git a/DSView/icons/params.png b/DSView/icons/params.png
index ea7c1a0e..d6a9fff7 100644
Binary files a/DSView/icons/params.png and b/DSView/icons/params.png differ
diff --git a/DSView/icons/params_cn.png b/DSView/icons/params_cn.png
deleted file mode 100644
index 86e2811f..00000000
Binary files a/DSView/icons/params_cn.png and /dev/null differ
diff --git a/DSView/icons/params_dis.png b/DSView/icons/params_dis.png
index 277a3266..af2518a7 100644
Binary files a/DSView/icons/params_dis.png and b/DSView/icons/params_dis.png differ
diff --git a/DSView/icons/params_dis_cn.png b/DSView/icons/params_dis_cn.png
deleted file mode 100644
index fcb8a611..00000000
Binary files a/DSView/icons/params_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/pre.png b/DSView/icons/pre.png
index f7ccd2eb..ee773259 100644
Binary files a/DSView/icons/pre.png and b/DSView/icons/pre.png differ
diff --git a/DSView/icons/protocol.png b/DSView/icons/protocol.png
index 91423ec2..acf434e2 100644
Binary files a/DSView/icons/protocol.png and b/DSView/icons/protocol.png differ
diff --git a/DSView/icons/protocol_cn.png b/DSView/icons/protocol_cn.png
deleted file mode 100644
index 213fd151..00000000
Binary files a/DSView/icons/protocol_cn.png and /dev/null differ
diff --git a/DSView/icons/protocol_dis.png b/DSView/icons/protocol_dis.png
index b5278b68..3836866f 100644
Binary files a/DSView/icons/protocol_dis.png and b/DSView/icons/protocol_dis.png differ
diff --git a/DSView/icons/protocol_dis_cn.png b/DSView/icons/protocol_dis_cn.png
deleted file mode 100644
index 005d3add..00000000
Binary files a/DSView/icons/protocol_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/restore.png b/DSView/icons/restore.png
new file mode 100644
index 00000000..ceaa6235
Binary files /dev/null and b/DSView/icons/restore.png differ
diff --git a/DSView/icons/search-bar.png b/DSView/icons/search-bar.png
index 20b94274..1e58096d 100644
Binary files a/DSView/icons/search-bar.png and b/DSView/icons/search-bar.png differ
diff --git a/DSView/icons/search-bar_cn.png b/DSView/icons/search-bar_cn.png
deleted file mode 100644
index b8a249e4..00000000
Binary files a/DSView/icons/search-bar_cn.png and /dev/null differ
diff --git a/DSView/icons/search-bar_dis.png b/DSView/icons/search-bar_dis.png
index a19d5834..1b2d6955 100644
Binary files a/DSView/icons/search-bar_dis.png and b/DSView/icons/search-bar_dis.png differ
diff --git a/DSView/icons/search-bar_dis_cn.png b/DSView/icons/search-bar_dis_cn.png
deleted file mode 100644
index f21aa2d4..00000000
Binary files a/DSView/icons/search-bar_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/settings.png b/DSView/icons/settings.png
old mode 100755
new mode 100644
diff --git a/DSView/icons/single.png b/DSView/icons/single.png
new file mode 100644
index 00000000..c0565af0
Binary files /dev/null and b/DSView/icons/single.png differ
diff --git a/DSView/icons/single_dis.png b/DSView/icons/single_dis.png
new file mode 100644
index 00000000..4e1221f8
Binary files /dev/null and b/DSView/icons/single_dis.png differ
diff --git a/DSView/icons/start.png b/DSView/icons/start.png
index bd42b602..4c2d7e61 100644
Binary files a/DSView/icons/start.png and b/DSView/icons/start.png differ
diff --git a/DSView/icons/start_cn.png b/DSView/icons/start_cn.png
deleted file mode 100644
index 6052468a..00000000
Binary files a/DSView/icons/start_cn.png and /dev/null differ
diff --git a/DSView/icons/start_dis.png b/DSView/icons/start_dis.png
old mode 100755
new mode 100644
index 62eee6d5..56f6e901
Binary files a/DSView/icons/start_dis.png and b/DSView/icons/start_dis.png differ
diff --git a/DSView/icons/start_dis_cn.png b/DSView/icons/start_dis_cn.png
deleted file mode 100755
index 86531127..00000000
Binary files a/DSView/icons/start_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/stop.png b/DSView/icons/stop.png
index 969a6999..77aa105d 100644
Binary files a/DSView/icons/stop.png and b/DSView/icons/stop.png differ
diff --git a/DSView/icons/stop_cn.png b/DSView/icons/stop_cn.png
deleted file mode 100644
index da13d848..00000000
Binary files a/DSView/icons/stop_cn.png and /dev/null differ
diff --git a/DSView/icons/trigger.png b/DSView/icons/trigger.png
index 5f8f4965..6b1ca1b8 100644
Binary files a/DSView/icons/trigger.png and b/DSView/icons/trigger.png differ
diff --git a/DSView/icons/trigger_cn.png b/DSView/icons/trigger_cn.png
deleted file mode 100644
index 8f98b4dd..00000000
Binary files a/DSView/icons/trigger_cn.png and /dev/null differ
diff --git a/DSView/icons/trigger_dis.png b/DSView/icons/trigger_dis.png
index 9c804d0e..eb401cff 100644
Binary files a/DSView/icons/trigger_dis.png and b/DSView/icons/trigger_dis.png differ
diff --git a/DSView/icons/trigger_dis_cn.png b/DSView/icons/trigger_dis_cn.png
deleted file mode 100644
index e17bfce7..00000000
Binary files a/DSView/icons/trigger_dis_cn.png and /dev/null differ
diff --git a/DSView/icons/wait.gif b/DSView/icons/wait.gif
index 58279b9f..b3ba36a6 100644
Binary files a/DSView/icons/wait.gif and b/DSView/icons/wait.gif differ
diff --git a/DSView/icons/wiki.png b/DSView/icons/wiki.png
index 4515019c..8e06ac1d 100644
Binary files a/DSView/icons/wiki.png and b/DSView/icons/wiki.png differ
diff --git a/DSView/main.cpp b/DSView/main.cpp
index bd131f65..d63b2e7f 100644
--- a/DSView/main.cpp
+++ b/DSView/main.cpp
@@ -34,9 +34,11 @@
#include
#include
#include
+#include
+#include "dsapplication.h"
#include "pv/devicemanager.h"
-#include "pv/mainwindow.h"
+#include "pv/mainframe.h"
#include "config.h"
@@ -59,22 +61,11 @@ int main(int argc, char *argv[])
struct sr_context *sr_ctx = NULL;
const char *open_file = NULL;
- QApplication a(argc, argv);
-
- // Language
-#ifdef LANGUAGE_ZH_CN
- QTranslator qtTrans;
- qtTrans.load(":/qt_zh_CN");
- a.installTranslator(&qtTrans);
-
- QTranslator DSViewTrans;
- DSViewTrans.load(":/DSView_zh");
- a.installTranslator(&DSViewTrans);
-#endif
+ DSApplication a(argc, argv);
// Set some application metadata
QApplication::setApplicationVersion(DS_VERSION_STRING);
- QApplication::setApplicationName("DSView(Beta)");
+ QApplication::setApplicationName("DSView");
QApplication::setOrganizationDomain("http://www.DreamSourceLab.com");
// Parse arguments
@@ -129,7 +120,6 @@ int main(int argc, char *argv[])
}
do {
-
#ifdef ENABLE_DECODE
// Initialise libsigrokdecode
if (srd_init(NULL) != SRD_OK) {
@@ -145,12 +135,13 @@ int main(int argc, char *argv[])
// Create the device manager, initialise the drivers
pv::DeviceManager device_manager(sr_ctx);
- // Initialise the main window
- pv::MainWindow w(device_manager, open_file);
- QFile qss(":/stylesheet.qss");
- qss.open(QFile::ReadOnly);
- a.setStyleSheet(qss.readAll());
- qss.close();
+ // Initialise the main frame
+ pv::MainFrame w(device_manager, open_file);
+ //QFile qss(":/stylesheet.qss");
+ QFile qss(":darkstyle/style.qss");
+ qss.open(QFile::ReadOnly);
+ a.setStyleSheet(qss.readAll());
+ qss.close();
w.show();
// Run the application
diff --git a/DSView/pv/data/analog.cpp b/DSView/pv/data/analog.cpp
index ad0c052f..4d3c5ca5 100644
--- a/DSView/pv/data/analog.cpp
+++ b/DSView/pv/data/analog.cpp
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
#include "analog.h"
#include "analogsnapshot.h"
+#include
+
using namespace boost;
using namespace std;
@@ -47,7 +49,15 @@ deque< boost::shared_ptr >& Analog::get_snapshots()
void Analog::clear()
{
- _snapshots.clear();
+ //_snapshots.clear();
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->clear();
+}
+void Analog::init()
+{
+ //_snapshots.clear();
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->init();
}
} // namespace data
diff --git a/DSView/pv/data/analog.h b/DSView/pv/data/analog.h
index b53aff6e..c28b649f 100644
--- a/DSView/pv/data/analog.h
+++ b/DSView/pv/data/analog.h
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,6 +46,7 @@ public:
get_snapshots();
void clear();
+ void init();
private:
std::deque< boost::shared_ptr > _snapshots;
diff --git a/DSView/pv/data/analogsnapshot.cpp b/DSView/pv/data/analogsnapshot.cpp
index 085cf20c..005885c7 100644
--- a/DSView/pv/data/analogsnapshot.cpp
+++ b/DSView/pv/data/analogsnapshot.cpp
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,26 +46,101 @@ const float AnalogSnapshot::LogEnvelopeScaleFactor =
logf(EnvelopeScaleFactor);
const uint64_t AnalogSnapshot::EnvelopeDataUnit = 64*1024; // bytes
-AnalogSnapshot::AnalogSnapshot(const sr_datafeed_analog &analog, uint64_t _total_sample_len, unsigned int channel_num) :
- Snapshot(sizeof(uint16_t)*channel_num, _total_sample_len, channel_num)
+AnalogSnapshot::AnalogSnapshot() :
+ Snapshot(sizeof(uint16_t), 1, 1)
{
- boost::lock_guard lock(_mutex);
memset(_envelope_levels, 0, sizeof(_envelope_levels));
- init(_total_sample_len * channel_num);
- append_payload(analog);
}
AnalogSnapshot::~AnalogSnapshot()
{
- boost::lock_guard lock(_mutex);
- BOOST_FOREACH(Envelope &e, _envelope_levels[0])
- free(e.samples);
+ free_envelop();
+}
+
+void AnalogSnapshot::free_envelop()
+{
+ for (unsigned int i = 0; i < _channel_num; i++) {
+ BOOST_FOREACH(Envelope &e, _envelope_levels[i]) {
+ if (e.samples)
+ free(e.samples);
+ }
+ }
+ memset(_envelope_levels, 0, sizeof(_envelope_levels));
+}
+
+void AnalogSnapshot::init()
+{
+ boost::lock_guard lock(_mutex);
+ _sample_count = 0;
+ _ring_sample_count = 0;
+ _memory_failed = false;
+ _last_ended = true;
+ for (unsigned int i = 0; i < _channel_num; i++) {
+ for (unsigned int level = 0; level < ScaleStepCount; level++) {
+ _envelope_levels[i][level].length = 0;
+ _envelope_levels[i][level].data_length = 0;
+ }
+ }
+}
+
+void AnalogSnapshot::clear()
+{
+ boost::lock_guard lock(_mutex);
+ free_data();
+ free_envelop();
+ init();
+}
+
+void AnalogSnapshot::first_payload(const sr_datafeed_analog &analog, uint64_t total_sample_count, unsigned int channel_num)
+{
+ _total_sample_count = total_sample_count;
+ _channel_num = channel_num;
+ _unit_size = sizeof(uint16_t)*channel_num;
+
+ bool isOk = true;
+ uint64_t size = _total_sample_count * _unit_size + sizeof(uint64_t);
+ if (size != _capacity) {
+ free_data();
+ _data = malloc(size);
+ if (_data) {
+ free_envelop();
+ for (unsigned int i = 0; i < _channel_num; i++) {
+ uint64_t envelop_count = _total_sample_count / EnvelopeScaleFactor;
+ for (unsigned int level = 0; level < ScaleStepCount; level++) {
+ envelop_count = ((envelop_count + EnvelopeDataUnit - 1) /
+ EnvelopeDataUnit) * EnvelopeDataUnit;
+ _envelope_levels[i][level].samples = (EnvelopeSample*)malloc(envelop_count * sizeof(EnvelopeSample));
+ if (!_envelope_levels[i][level].samples) {
+ isOk = false;
+ break;
+ }
+ envelop_count = envelop_count / EnvelopeScaleFactor;
+ }
+ if (!isOk)
+ break;
+ }
+ } else {
+ isOk = true;
+ }
+ }
+
+ if (isOk) {
+ _capacity = size;
+ _memory_failed = false;
+ append_payload(analog);
+ _last_ended = false;
+ } else {
+ free_data();
+ free_envelop();
+ _capacity = 0;
+ _memory_failed = true;
+ }
}
void AnalogSnapshot::append_payload(
const sr_datafeed_analog &analog)
{
- boost::lock_guard lock(_mutex);
+ boost::lock_guard lock(_mutex);
append_data(analog.data, analog.num_samples);
// Generate the first mip-map from the data
@@ -83,8 +158,6 @@ const uint16_t* AnalogSnapshot::get_samples(
assert(end_sample < (int64_t)get_sample_count());
assert(start_sample <= end_sample);
- boost::lock_guard lock(_mutex);
-
// uint16_t *const data = new uint16_t[end_sample - start_sample];
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
// (end_sample - start_sample));
@@ -99,8 +172,6 @@ void AnalogSnapshot::get_envelope_section(EnvelopeSection &s,
assert(start <= end);
assert(min_length > 0);
- boost::lock_guard lock(_mutex);
-
const unsigned int min_level = max((int)floorf(logf(min_length) /
LogEnvelopeScaleFactor) - 1, 0);
const unsigned int scale_power = (min_level + 1) *
@@ -124,8 +195,8 @@ void AnalogSnapshot::reallocate_envelope(Envelope &e)
if (new_data_length > e.data_length)
{
e.data_length = new_data_length;
- e.samples = (EnvelopeSample*)realloc(e.samples,
- new_data_length * sizeof(EnvelopeSample));
+// e.samples = (EnvelopeSample*)realloc(e.samples,
+// new_data_length * sizeof(EnvelopeSample));
}
}
@@ -139,7 +210,7 @@ void AnalogSnapshot::append_payload_to_envelope_levels()
// Expand the data buffer to fit the new samples
prev_length = e0.length;
- e0.length = get_sample_count() / EnvelopeScaleFactor;
+ e0.length = _sample_count / EnvelopeScaleFactor;
// Break off if there are no new samples to compute
// if (e0.length == prev_length)
diff --git a/DSView/pv/data/analogsnapshot.h b/DSView/pv/data/analogsnapshot.h
index 3282f257..3f2b015a 100644
--- a/DSView/pv/data/analogsnapshot.h
+++ b/DSView/pv/data/analogsnapshot.h
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,10 +69,15 @@ private:
static const uint64_t EnvelopeDataUnit;
public:
- AnalogSnapshot(const sr_datafeed_analog &analog, uint64_t _total_sample_len, unsigned int channel_num);
+ AnalogSnapshot();
virtual ~AnalogSnapshot();
+ void clear();
+ void init();
+
+ void first_payload(const sr_datafeed_analog &analog, uint64_t total_sample_count, unsigned int channel_num);
+
void append_payload(const sr_datafeed_analog &analog);
const uint16_t* get_samples(int64_t start_sample,
@@ -82,8 +87,8 @@ public:
uint64_t start, uint64_t end, float min_length, int probe_index) const;
private:
+ void free_envelop();
void reallocate_envelope(Envelope &l);
-
void append_payload_to_envelope_levels();
private:
diff --git a/DSView/pv/data/decode/annotation.cpp b/DSView/pv/data/decode/annotation.cpp
index a474dd90..f2d30df5 100644
--- a/DSView/pv/data/decode/annotation.cpp
+++ b/DSView/pv/data/decode/annotation.cpp
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2012 Joel Holdsworth
+ * Copyright (C) 2016 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,6 +42,7 @@ Annotation::Annotation(const srd_proto_data *const pdata) :
assert(pda);
_format = pda->ann_class;
+ _type = pda->ann_type;
const char *const *annotations = (char**)pda->ann_text;
while(*annotations) {
@@ -49,6 +51,12 @@ Annotation::Annotation(const srd_proto_data *const pdata) :
}
}
+Annotation::Annotation()
+{
+ _start_sample = 0;
+ _end_sample = 0;
+}
+
Annotation::~Annotation()
{
_annotations.clear();
@@ -69,6 +77,11 @@ int Annotation::format() const
return _format;
}
+int Annotation::type() const
+{
+ return _type;
+}
+
const std::vector& Annotation::annotations() const
{
return _annotations;
diff --git a/DSView/pv/data/decode/annotation.h b/DSView/pv/data/decode/annotation.h
index a2676bd3..03e208ef 100644
--- a/DSView/pv/data/decode/annotation.h
+++ b/DSView/pv/data/decode/annotation.h
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2013 Joel Holdsworth
+ * Copyright (C) 2016 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,17 +36,20 @@ class Annotation
{
public:
Annotation(const srd_proto_data *const pdata);
+ Annotation();
~Annotation();
uint64_t start_sample() const;
uint64_t end_sample() const;
int format() const;
+ int type() const;
const std::vector& annotations() const;
private:
uint64_t _start_sample;
uint64_t _end_sample;
int _format;
+ int _type;
std::vector _annotations;
};
diff --git a/DSView/pv/data/decode/decoder.cpp b/DSView/pv/data/decode/decoder.cpp
index 00d6a1f5..8d54d7f6 100644
--- a/DSView/pv/data/decode/decoder.cpp
+++ b/DSView/pv/data/decode/decoder.cpp
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2013 Joel Holdsworth
+ * Copyright (C) 2014 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -93,11 +94,32 @@ void Decoder::set_option(const char *id, GVariant *value)
_setted = true;
}
+void Decoder::set_decode_region(uint64_t start, uint64_t end)
+{
+ _decode_start_back = start;
+ _decode_end_back = end;
+ if (_decode_start != start ||
+ _decode_end != end)
+ _setted = true;
+}
+
+uint64_t Decoder::decode_start() const
+{
+ return _decode_start;
+}
+
+uint64_t Decoder::decode_end() const
+{
+ return _decode_end;
+}
+
bool Decoder::commit()
{
if (_setted) {
_probes = _probes_back;
_options = _options_back;
+ _decode_start = _decode_start_back;
+ _decode_end = _decode_end_back;
_setted = false;
return true;
} else {
diff --git a/DSView/pv/data/decode/decoder.h b/DSView/pv/data/decode/decoder.h
index ae51c1d3..40fde4e6 100644
--- a/DSView/pv/data/decode/decoder.h
+++ b/DSView/pv/data/decode/decoder.h
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2013 Joel Holdsworth
+ * Copyright (C) 2014 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -73,6 +74,10 @@ public:
std::set< boost::shared_ptr > get_data();
+ void set_decode_region(uint64_t start, uint64_t end);
+ uint64_t decode_start() const;
+ uint64_t decode_end() const;
+
bool commit();
private:
@@ -88,6 +93,9 @@ private:
_probes_back;
std::map _options_back;
+ uint64_t _decode_start, _decode_end;
+ uint64_t _decode_start_back, _decode_end_back;
+
bool _setted;
};
diff --git a/DSView/pv/data/decode/row.cpp b/DSView/pv/data/decode/row.cpp
index 1c0ee9cc..46fb337f 100644
--- a/DSView/pv/data/decode/row.cpp
+++ b/DSView/pv/data/decode/row.cpp
@@ -68,8 +68,8 @@ const QString Row::title() const
bool Row::operator<(const Row &other) const
{
- return (_decoder < other._decoder) ||
- (_decoder == other._decoder && _row < other._row);
+ return (_decoder < other._decoder) ||
+ (_decoder == other._decoder && _row < other._row);
}
} // decode
diff --git a/DSView/pv/data/decode/row.h b/DSView/pv/data/decode/row.h
index 6826c0fc..73324302 100644
--- a/DSView/pv/data/decode/row.h
+++ b/DSView/pv/data/decode/row.h
@@ -46,7 +46,7 @@ public:
const QString title() const;
- bool operator<(const Row &other) const;
+ bool operator<(const Row &other) const;
private:
const srd_decoder *_decoder;
diff --git a/DSView/pv/data/decode/rowdata.cpp b/DSView/pv/data/decode/rowdata.cpp
index 840459a6..8d3e41e0 100644
--- a/DSView/pv/data/decode/rowdata.cpp
+++ b/DSView/pv/data/decode/rowdata.cpp
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2014 Joel Holdsworth
+ * Copyright (C) 2016 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +24,7 @@
#include "rowdata.h"
using std::max;
+using std::min;
using std::vector;
namespace pv {
@@ -30,7 +32,8 @@ namespace data {
namespace decode {
RowData::RowData() :
- _max_annotation(0)
+ _max_annotation(0),
+ _min_annotation(UINT64_MAX)
{
}
@@ -51,6 +54,11 @@ uint64_t RowData::get_max_annotation() const
return _max_annotation;
}
+uint64_t RowData::get_min_annotation() const
+{
+ return _min_annotation;
+}
+
void RowData::get_annotation_subset(
vector &dest,
uint64_t start_sample, uint64_t end_sample) const
@@ -62,10 +70,33 @@ void RowData::get_annotation_subset(
dest.push_back(*i);
}
-void RowData::push_annotation(const Annotation &a)
+bool RowData::push_annotation(const Annotation &a)
{
- _annotations.push_back(a);
- _max_annotation = max(_max_annotation, a.end_sample() - a.start_sample());
+ try {
+ _annotations.push_back(a);
+ _max_annotation = max(_max_annotation, a.end_sample() - a.start_sample());
+ if (a.end_sample() != a.start_sample())
+ _min_annotation = min(_min_annotation, a.end_sample() - a.start_sample());
+ return true;
+ } catch (const std::bad_alloc&) {
+ return false;
+ }
+}
+
+uint64_t RowData::get_annotation_size() const
+{
+ return _annotations.size();
+}
+
+bool RowData::get_annotation(Annotation &ann,
+ uint64_t index) const
+{
+ if (index < _annotations.size()) {
+ ann = _annotations[index];
+ return true;
+ } else {
+ return false;
+ }
}
} // decode
diff --git a/DSView/pv/data/decode/rowdata.h b/DSView/pv/data/decode/rowdata.h
index 03076494..40792cb7 100644
--- a/DSView/pv/data/decode/rowdata.h
+++ b/DSView/pv/data/decode/rowdata.h
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2014 Joel Holdsworth
+ * Copyright (C) 2016 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,11 +35,11 @@ class RowData
public:
RowData();
~RowData();
-
public:
uint64_t get_max_sample() const;
uint64_t get_max_annotation() const;
+ uint64_t get_min_annotation() const;
/**
* Extracts sorted annotations between two period into a vector.
*/
@@ -46,10 +47,16 @@ public:
std::vector &dest,
uint64_t start_sample, uint64_t end_sample) const;
- void push_annotation(const Annotation &a);
+ bool push_annotation(const Annotation &a);
+
+ uint64_t get_annotation_size() const;
+
+ bool get_annotation(pv::data::decode::Annotation &ann,
+ uint64_t index) const;
private:
uint64_t _max_annotation;
+ uint64_t _min_annotation;
std::vector _annotations;
};
diff --git a/DSView/pv/data/decodermodel.cpp b/DSView/pv/data/decodermodel.cpp
new file mode 100644
index 00000000..078111a4
--- /dev/null
+++ b/DSView/pv/data/decodermodel.cpp
@@ -0,0 +1,108 @@
+/*
+ * This file is part of the DSView project.
+ *
+ * Copyright (C) 2016 DreamSourceLab
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include
+
+#include
+#include
+
+#include
+#include
+
+#include "decoderstack.h"
+#include "decodermodel.h"
+
+using namespace boost;
+using namespace std;
+
+namespace pv {
+namespace data {
+
+DecoderModel::DecoderModel(QObject *parent)
+ : QAbstractTableModel(parent),
+ _decoder_stack(NULL)
+{
+}
+
+void DecoderModel::setDecoderStack(boost::shared_ptr decoder_stack)
+{
+ beginResetModel();
+ _decoder_stack = decoder_stack;
+ endResetModel();
+}
+
+const boost::shared_ptr& DecoderModel::getDecoderStack() const
+{
+ return _decoder_stack;
+}
+
+int DecoderModel::rowCount(const QModelIndex & /* parent */) const
+{
+ if (_decoder_stack)
+ return _decoder_stack->list_annotation_size();
+ else
+ return 100;
+}
+int DecoderModel::columnCount(const QModelIndex & /* parent */) const
+{
+ if (_decoder_stack)
+ return _decoder_stack->list_rows_size();
+ else
+ return 1;
+}
+
+QVariant DecoderModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ if (role == Qt::TextAlignmentRole) {
+ return int(Qt::AlignLeft | Qt::AlignVCenter);
+ } else if (role == Qt::DisplayRole) {
+ if (_decoder_stack) {
+ pv::data::decode::Annotation ann;
+ if (_decoder_stack->list_annotation(ann, index.column(), index.row())) {
+ return ann.annotations().at(0);
+ }
+ }
+ }
+ return QVariant();
+}
+
+QVariant DecoderModel::headerData(int section,
+ Qt::Orientation orientation,
+ int role) const
+{
+ if (role != Qt::DisplayRole)
+ return QVariant();
+
+ if (orientation == Qt::Vertical)
+ return section;
+
+ if (_decoder_stack) {
+ QString title;
+ if (_decoder_stack->list_row_title(section, title))
+ return title;
+ }
+ return QVariant();
+}
+
+} // namespace data
+} // namespace pv
diff --git a/DSView/pv/data/decodermodel.h b/DSView/pv/data/decodermodel.h
new file mode 100644
index 00000000..09032729
--- /dev/null
+++ b/DSView/pv/data/decodermodel.h
@@ -0,0 +1,62 @@
+/*
+ * This file is part of the DSView project.
+ *
+ * Copyright (C) 2016 DreamSourceLab
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef DSVIEW_PV_DATA_DECODERMODEL_H
+#define DSVIEW_PV_DATA_DECODERMODEL_H
+
+#include
+
+#include
+
+#include
+
+namespace pv {
+namespace data {
+
+class DecoderStack;
+
+namespace decode {
+class Annotation;
+class Decoder;
+class Row;
+}
+
+class DecoderModel : public QAbstractTableModel
+{
+public:
+ DecoderModel(QObject *parent = 0);
+
+ int rowCount(const QModelIndex & /*parent*/) const;
+ int columnCount(const QModelIndex & /*parent*/) const;
+ QVariant data(const QModelIndex &index, int role) const;
+ QVariant headerData(int section, Qt::Orientation orientation,
+ int role) const;
+
+ void setDecoderStack(boost::shared_ptr decoder_stack);
+ const boost::shared_ptr& getDecoderStack() const;
+
+private:
+ boost::shared_ptr _decoder_stack;
+};
+
+} // namespace data
+} // namespace pv
+
+#endif // DSVIEW_PV_DATA_DECODERMODEL_H
diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp
index 1df0abb0..233dcc4d 100644
--- a/DSView/pv/data/decoderstack.cpp
+++ b/DSView/pv/data/decoderstack.cpp
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2012 Joel Holdsworth
+ * Copyright (C) 2014 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,12 +18,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include
-
#include
#include
#include
+#include
#include
@@ -56,8 +56,9 @@ namespace data {
const double DecoderStack::DecodeMargin = 1.0;
const double DecoderStack::DecodeThreshold = 0.2;
-const int64_t DecoderStack::DecodeChunkLength = 1024 * 1024;
-const unsigned int DecoderStack::DecodeNotifyPeriod = 1;
+const int64_t DecoderStack::DecodeChunkLength = 4 * 1024;
+//const int64_t DecoderStack::DecodeChunkLength = 1024 * 1024;
+const unsigned int DecoderStack::DecodeNotifyPeriod = 1024;
mutex DecoderStack::_global_decode_mutex;
@@ -68,7 +69,8 @@ DecoderStack::DecoderStack(pv::SigSession &session,
_frame_complete(false),
_samples_decoded(0),
_decode_state(Stopped),
- _options_changed(false)
+ _options_changed(false),
+ _no_memory(false)
{
connect(&_session, SIGNAL(frame_began()),
this, SLOT(on_new_frame()));
@@ -79,6 +81,8 @@ DecoderStack::DecoderStack(pv::SigSession &session,
_stack.push_back(shared_ptr(
new decode::Decoder(dec)));
+
+ build_row();
}
DecoderStack::~DecoderStack()
@@ -89,7 +93,10 @@ DecoderStack::~DecoderStack()
// }
stop_decode();
_stack.clear();
- clear();
+ _rows.clear();
+ _rows_gshow.clear();
+ _rows_lshow.clear();
+ _class_rows.clear();
}
const std::list< boost::shared_ptr >&
@@ -102,75 +109,106 @@ void DecoderStack::push(boost::shared_ptr decoder)
{
assert(decoder);
_stack.push_back(decoder);
+ build_row();
+ _options_changed = true;
}
-void DecoderStack::remove(int index)
+void DecoderStack::remove(boost::shared_ptr &decoder)
{
- assert(index >= 0);
- assert(index < (int)_stack.size());
-
// Find the decoder in the stack
list< shared_ptr >::iterator iter = _stack.begin();
- for(int i = 0; i < index; i++, iter++)
- assert(iter != _stack.end());
+ for(unsigned int i = 0; i < _stack.size(); i++, iter++)
+ if ((*iter) == decoder)
+ break;
// Delete the element
- _stack.erase(iter);
+ if (iter != _stack.end())
+ _stack.erase(iter);
+
+ build_row();
+ _options_changed = true;
+}
+
+void DecoderStack::build_row()
+{
+ _rows.clear();
+ // Add classes
+ BOOST_FOREACH (const shared_ptr &dec, _stack)
+ {
+ assert(dec);
+ const srd_decoder *const decc = dec->decoder();
+ assert(dec->decoder());
+
+ // Add a row for the decoder if it doesn't have a row list
+ if (!decc->annotation_rows) {
+ const Row row(decc);
+ _rows[row] = decode::RowData();
+ std::map::const_iterator iter = _rows_gshow.find(row);
+ if (iter == _rows_gshow.end()) {
+ _rows_gshow[row] = true;
+ if (row.title().contains("bit", Qt::CaseInsensitive) ||
+ row.title().contains("warning", Qt::CaseInsensitive)) {
+ _rows_lshow[row] = false;
+ } else {
+ _rows_lshow[row] = true;
+ }
+ }
+ }
+
+ // Add the decoder rows
+ for (const GSList *l = decc->annotation_rows; l; l = l->next)
+ {
+ const srd_decoder_annotation_row *const ann_row =
+ (srd_decoder_annotation_row *)l->data;
+ assert(ann_row);
+
+ const Row row(decc, ann_row);
+
+ // Add a new empty row data object
+ _rows[row] = decode::RowData();
+ std::map::const_iterator iter = _rows_gshow.find(row);
+ if (iter == _rows_gshow.end()) {
+ _rows_gshow[row] = true;
+ if (row.title().contains("bit", Qt::CaseInsensitive) ||
+ row.title().contains("warning", Qt::CaseInsensitive)) {
+ _rows_lshow[row] = false;
+ } else {
+ _rows_lshow[row] = true;
+ }
+ }
+
+ // Map out all the classes
+ for (const GSList *ll = ann_row->ann_classes;
+ ll; ll = ll->next)
+ _class_rows[make_pair(decc,
+ GPOINTER_TO_INT(ll->data))] = row;
+ }
+ }
}
int64_t DecoderStack::samples_decoded() const
{
- lock_guard decode_lock(_output_mutex);
+ lock_guard decode_lock(_output_mutex);
return _samples_decoded;
}
-std::vector< std::pair > DecoderStack::get_visible_rows() const
-{
- lock_guard lock(_output_mutex);
-
- std::vector< std::pair > rows;
-
- BOOST_FOREACH (const shared_ptr &dec, _stack)
- {
- assert(dec);
-
- const srd_decoder *const decc = dec->decoder();
- assert(dec->decoder());
-
- // Add a row for the decoder if it doesn't have a row list
- if (!decc->annotation_rows)
- rows.push_back(make_pair(Row(decc), dec->shown()));
-
- // Add the decoder rows
- for (const GSList *l = decc->annotation_rows; l; l = l->next)
- {
- const srd_decoder_annotation_row *const ann_row =
- (srd_decoder_annotation_row *)l->data;
- assert(ann_row);
- rows.push_back(make_pair(Row(decc, ann_row), dec->shown()));
- }
- }
-
- return rows;
-}
-
void DecoderStack::get_annotation_subset(
std::vector &dest,
const Row &row, uint64_t start_sample,
uint64_t end_sample) const
{
- lock_guard lock(_output_mutex);
+ //lock_guard lock(_output_mutex);
- std::map::const_iterator iter =
- _rows.find(row);
- if (iter != _rows.end())
+ std::map::const_iterator iter =
+ _rows.find(row);
+ if (iter != _rows.end())
(*iter).second.get_annotation_subset(dest,
start_sample, end_sample);
}
uint64_t DecoderStack::get_max_annotation(const Row &row)
{
- lock_guard lock(_output_mutex);
+ //lock_guard lock(_output_mutex);
std::map::const_iterator iter =
_rows.find(row);
@@ -180,9 +218,57 @@ uint64_t DecoderStack::get_max_annotation(const Row &row)
return 0;
}
+uint64_t DecoderStack::get_min_annotation(const Row &row)
+{
+ //lock_guard lock(_output_mutex);
+
+ std::map::const_iterator iter =
+ _rows.find(row);
+ if (iter != _rows.end())
+ return (*iter).second.get_min_annotation();
+
+ return 0;
+}
+
+std::map DecoderStack::get_rows_gshow()
+{
+ std::map rows_gshow;
+ for (std::map::const_iterator i = _rows_gshow.begin();
+ i != _rows_gshow.end(); i++) {
+ rows_gshow[(*i).first] = (*i).second;
+ }
+ return rows_gshow;
+}
+
+std::map DecoderStack::get_rows_lshow()
+{
+ std::map rows_lshow;
+ for (std::map::const_iterator i = _rows_lshow.begin();
+ i != _rows_lshow.end(); i++) {
+ rows_lshow[(*i).first] = (*i).second;
+ }
+ return rows_lshow;
+}
+
+void DecoderStack::set_rows_gshow(const decode::Row row, bool show)
+{
+ std::map::const_iterator iter = _rows_gshow.find(row);
+ if (iter != _rows_gshow.end()) {
+ _rows_gshow[row] = show;
+ }
+}
+
+void DecoderStack::set_rows_lshow(const decode::Row row, bool show)
+{
+ std::map::const_iterator iter = _rows_lshow.find(row);
+ if (iter != _rows_lshow.end()) {
+ _rows_lshow[row] = show;
+ }
+}
+
bool DecoderStack::has_annotations(const Row &row) const
{
- lock_guard lock(_output_mutex);
+ //lock_guard lock(_output_mutex);
std::map::const_iterator iter =
_rows.find(row);
@@ -195,26 +281,107 @@ bool DecoderStack::has_annotations(const Row &row) const
return false;
}
+uint64_t DecoderStack::list_annotation_size() const
+{
+ lock_guard lock(_output_mutex);
+ uint64_t max_annotation_size = 0;
+ for (map::const_iterator i = _rows.begin();
+ i != _rows.end(); i++) {
+ map::const_iterator iter = _rows_lshow.find((*i).first);
+ if (iter != _rows_lshow.end() && (*iter).second)
+ max_annotation_size = max(max_annotation_size,
+ (*i).second.get_annotation_size());
+ }
+
+ return max_annotation_size;
+}
+
+uint64_t DecoderStack::list_annotation_size(uint16_t row_index) const
+{
+ //lock_guard lock(_output_mutex);
+ //int row = 0;
+ for (map::const_iterator i = _rows.begin();
+ i != _rows.end(); i++) {
+ map::const_iterator iter = _rows_lshow.find((*i).first);
+ if (iter != _rows_lshow.end() && (*iter).second)
+ if (row_index-- == 0) {
+ return (*i).second.get_annotation_size();
+ }
+ }
+ return 0;
+}
+
+bool DecoderStack::list_annotation(pv::data::decode::Annotation &ann,
+ uint16_t row_index, uint64_t col_index) const
+{
+ //lock_guard lock(_output_mutex);
+ for (map::const_iterator i = _rows.begin();
+ i != _rows.end(); i++) {
+ map::const_iterator iter = _rows_lshow.find((*i).first);
+ if (iter != _rows_lshow.end() && (*iter).second) {
+ if (row_index-- == 0) {
+ return (*i).second.get_annotation(ann, col_index);
+ }
+ }
+ }
+
+ return false;
+}
+
+
+bool DecoderStack::list_row_title(int row, QString &title) const
+{
+ //lock_guard lock(_output_mutex);
+ for (map::const_iterator i = _rows.begin();
+ i != _rows.end(); i++) {
+ map::const_iterator iter = _rows_lshow.find((*i).first);
+ if (iter != _rows_lshow.end() && (*iter).second) {
+ if (row-- == 0) {
+ title = (*i).first.title();
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
QString DecoderStack::error_message()
{
- lock_guard lock(_output_mutex);
+ //lock_guard lock(_output_mutex);
return _error_message;
}
void DecoderStack::clear()
{
+ //lock_guard decode_lock(_output_mutex);
_sample_count = 0;
- _frame_complete = false;
- _samples_decoded = 0;
+ _frame_complete = false;
+ _samples_decoded = 0;
+ new_decode_data();
_error_message = QString();
- _rows.clear();
- _class_rows.clear();
+ for (map::iterator i = _rows.begin();
+ i != _rows.end(); i++)
+ _rows[(*i).first] = decode::RowData();
+// _rows.clear();
+// _rows_gshow.clear();
+// _rows_lshow.clear();
+// _class_rows.clear();
+ _no_memory = false;
+}
+
+void DecoderStack::init()
+{
+ clear();
}
void DecoderStack::stop_decode()
{
- if(_decode_state == Stopped)
+ //_snapshot.reset();
+
+ if(_decode_state == Stopped) {
+ clear();
return;
+ }
if (_decode_thread.get()) {
_decode_thread->interrupt();
@@ -222,6 +389,7 @@ void DecoderStack::stop_decode()
_decode_state = Stopped;
}
_decode_thread.reset();
+ clear();
}
void DecoderStack::begin_decode()
@@ -231,14 +399,13 @@ void DecoderStack::begin_decode()
if (!_options_changed)
return;
+ _options_changed = false;
// if (_decode_thread.joinable()) {
// _decode_thread.interrupt();
// _decode_thread.join();
// }
stop_decode();
- clear();
-
// Check that all decoders have the required channels
BOOST_FOREACH(const shared_ptr &dec, _stack)
if (!dec->have_required_probes()) {
@@ -247,36 +414,8 @@ void DecoderStack::begin_decode()
return;
}
- // Add classes
- BOOST_FOREACH (const shared_ptr &dec, _stack)
- {
- assert(dec);
- const srd_decoder *const decc = dec->decoder();
- assert(dec->decoder());
-
- // Add a row for the decoder if it doesn't have a row list
- if (!decc->annotation_rows)
- _rows[Row(decc)] = decode::RowData();
-
- // Add the decoder rows
- for (const GSList *l = decc->annotation_rows; l; l = l->next)
- {
- const srd_decoder_annotation_row *const ann_row =
- (srd_decoder_annotation_row *)l->data;
- assert(ann_row);
-
- const Row row(decc, ann_row);
-
- // Add a new empty row data object
- _rows[row] = decode::RowData();
-
- // Map out all the classes
- for (const GSList *ll = ann_row->ann_classes;
- ll; ll = ll->next)
- _class_rows[make_pair(decc,
- GPOINTER_TO_INT(ll->data))] = row;
- }
- }
+// // Build rows
+// build_row();
// We get the logic data of the first channel in the list.
// This works because we are currently assuming all
@@ -296,12 +435,14 @@ void DecoderStack::begin_decode()
if (snapshots.empty())
return;
_snapshot = snapshots.front();
+ if (_snapshot->empty())
+ return;
// Get the samplerate and start time
_start_time = data->get_start_time();
_samplerate = data->samplerate();
- if (_samplerate == 0.0)
- _samplerate = 1.0;
+ if (_samplerate == 0.0)
+ return;
//_decode_thread = boost::thread(&DecoderStack::decode_proc, this);
_decode_thread.reset(new boost::thread(&DecoderStack::decode_proc, this));
@@ -311,8 +452,8 @@ uint64_t DecoderStack::get_max_sample_count() const
{
uint64_t max_sample_count = 0;
- for (map::const_iterator i = _rows.begin();
- i != _rows.end(); i++)
+ for (map::const_iterator i = _rows.begin();
+ i != _rows.end(); i++)
max_sample_count = max(max_sample_count,
(*i).second.get_max_sample());
@@ -321,10 +462,10 @@ uint64_t DecoderStack::get_max_sample_count() const
boost::optional DecoderStack::wait_for_data() const
{
- unique_lock input_lock(_input_mutex);
+ //unique_lock input_lock(_input_mutex);
while(!boost::this_thread::interruption_requested() &&
!_frame_complete && (uint64_t)_samples_decoded >= _sample_count)
- _input_cond.wait(input_lock);
+ //_input_cond.wait(input_lock);
return boost::make_optional(
!boost::this_thread::interruption_requested() &&
((uint64_t)_samples_decoded < _sample_count || !_frame_complete),
@@ -332,45 +473,95 @@ boost::optional DecoderStack::wait_for_data() const
}
void DecoderStack::decode_data(
- const uint64_t sample_count, const unsigned int unit_size,
- srd_session *const session)
+ const uint64_t decode_start, const uint64_t decode_end,
+ const unsigned int unit_size, srd_session *const session)
{
- //uint8_t chunk[DecodeChunkLength];
uint8_t *chunk = NULL;
- //chunk = (uint8_t *)realloc(chunk, DecodeChunkLength);
-
+ uint64_t last_cnt = 0;
+ uint64_t notify_cnt = (decode_end - decode_start + 1)/100;
const uint64_t chunk_sample_count =
- DecodeChunkLength / _snapshot->unit_size();
+ DecodeChunkLength / _snapshot->unit_size();
+ srd_decoder_inst *logic_di = NULL;
+ // find the first level decoder instant
+ for (GSList *d = session->di_list; d; d = d->next) {
+ srd_decoder_inst *di = (srd_decoder_inst *)d->data;
+ srd_decoder *decoder = di->decoder;
+ const bool have_probes = (decoder->channels || decoder->opt_channels) != 0;
+ if (have_probes) {
+ logic_di = di;
+ break;
+ }
+ }
- for (uint64_t i = 0;
- !boost::this_thread::interruption_requested() &&
- i < sample_count;
- i += chunk_sample_count)
- {
+ uint64_t entry_cnt = 0;
+ uint8_t chunk_type = 0;
+ uint64_t i = decode_start;
+ char *error = NULL;
+ while(!boost::this_thread::interruption_requested() &&
+ i < decode_end && !_no_memory)
+ {
//lock_guard decode_lock(_global_decode_mutex);
const uint64_t chunk_end = min(
- i + chunk_sample_count, sample_count);
+ i + chunk_sample_count, decode_end);
chunk = _snapshot->get_samples(i, chunk_end);
- if (srd_session_send(session, i, i + sample_count, chunk,
- (chunk_end - i) * unit_size, unit_size) != SRD_OK) {
- _error_message = tr("Decoder reported an error");
- break;
- }
+ if (srd_session_send(session, chunk_type, i, chunk_end, chunk,
+ (chunk_end - i) * unit_size, unit_size, &error) != SRD_OK) {
+ _error_message = QString::fromLocal8Bit(error);
+ break;
+ }
- {
- lock_guard lock(_output_mutex);
- _samples_decoded = chunk_end;
- }
+ if (logic_di && logic_di->logic_mask != 0) {
+ uint64_t cur_pos = logic_di->cur_pos;
+ assert(cur_pos < _snapshot->get_sample_count());
+ uint64_t sample = _snapshot->get_sample(cur_pos) & logic_di->logic_mask;
+ if (logic_di->edge_index == -1) {
+ std::vector pos_vector;
+ cur_pos++;
+ for (int j =0 ; j < logic_di->dec_num_channels; j++) {
+ int index = logic_di->dec_channelmap[j];
+ if (index != -1 && (logic_di->logic_mask & (1 << index))) {
+ bool last_sample = (sample & (1 << index)) ? 1 : 0;
+ pos_vector.push_back(cur_pos);
+ _snapshot->get_nxt_edge(pos_vector.back(), last_sample, decode_end, 1, index);
+ }
+ }
+ cur_pos = *std::min_element(pos_vector.begin(), pos_vector.end());
+ } else {
+ bool last_sample = (sample & (1 << logic_di->edge_index)) ? 1 : 0;
+ do {
+ cur_pos++;
+ if (!_snapshot->get_nxt_edge(cur_pos, last_sample, decode_end, 1, logic_di->edge_index))
+ break;
+ sample = _snapshot->get_sample(cur_pos) & logic_di->logic_mask;
+ last_sample = (sample & (1 << logic_di->edge_index)) ? 1 : 0;
+ } while(sample != logic_di->exp_logic);
+ }
- if (i % DecodeNotifyPeriod == 0)
+ i = cur_pos;
+ if (i >= decode_end)
+ i = decode_end;
+ chunk_type = 0;
+ } else {
+ i += chunk_sample_count;
+ chunk_type = 1;
+ }
+
+ {
+ lock_guard lock(_output_mutex);
+ _samples_decoded = i - decode_start + 1;
+ }
+
+ if ((i - last_cnt) > notify_cnt) {
+ last_cnt = i;
new_decode_data();
-
- }
- _options_changed = false;
+ }
+ entry_cnt++;
+ }
+ if (error)
+ g_free(error);
decode_done();
- //new_decode_data();
}
void DecoderStack::decode_proc()
@@ -380,6 +571,8 @@ void DecoderStack::decode_proc()
optional sample_count;
srd_session *session;
srd_decoder_inst *prev_di = NULL;
+ uint64_t decode_start = 0;
+ uint64_t decode_end = 0;
assert(_snapshot);
@@ -392,6 +585,12 @@ void DecoderStack::decode_proc()
// Create the decoders
const unsigned int unit_size = _snapshot->unit_size();
+ // Get the intial sample count
+ {
+ //unique_lock input_lock(_input_mutex);
+ sample_count = _sample_count = _snapshot->get_sample_count();
+ }
+
BOOST_FOREACH(const shared_ptr &dec, _stack)
{
srd_decoder_inst *const di = dec->create_decoder_inst(session, unit_size);
@@ -407,12 +606,8 @@ void DecoderStack::decode_proc()
srd_inst_stack (session, prev_di, di);
prev_di = di;
- }
-
- // Get the intial sample count
- {
- unique_lock input_lock(_input_mutex);
- sample_count = _sample_count = _snapshot->get_sample_count();
+ decode_start = dec->decode_start();
+ decode_end = min(dec->decode_end(), _sample_count-1);
}
// Start the session
@@ -422,14 +617,15 @@ void DecoderStack::decode_proc()
srd_pd_output_callback_add(session, SRD_OUTPUT_ANN,
DecoderStack::annotation_callback, this);
- srd_session_start(session);
-
-// do {
-// decode_data(*sample_count, unit_size, session);
-// } while(_error_message.isEmpty() && (sample_count = wait_for_data()));
- decode_data(*sample_count, unit_size, session);
+ char *error = NULL;
+ if (srd_session_start(session, &error) == SRD_OK)
+ decode_data(decode_start, decode_end, unit_size, session);
+ else
+ _error_message = QString::fromLocal8Bit(error);
// Destroy the session
+ if (error)
+ g_free(error);
srd_session_destroy(session);
_decode_state = Stopped;
@@ -437,7 +633,15 @@ void DecoderStack::decode_proc()
uint64_t DecoderStack::sample_count() const
{
- return _sample_count;
+ if (_snapshot)
+ return _snapshot->get_sample_count();
+ else
+ return 0;
+}
+
+uint64_t DecoderStack::sample_rate() const
+{
+ return _samplerate;
}
void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
@@ -448,7 +652,10 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
DecoderStack *const d = (DecoderStack*)decoder;
assert(d);
- lock_guard lock(d->_output_mutex);
+ //lock_guard lock(d->_output_mutex);
+
+ if (d->_no_memory)
+ return;
const Annotation a(pdata);
@@ -458,29 +665,31 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
const srd_decoder *const decc = pdata->pdo->di->decoder;
assert(decc);
- map::iterator row_iter = d->_rows.end();
+ map::iterator row_iter = d->_rows.end();
// Try looking up the sub-row of this class
const map, Row>::const_iterator r =
d->_class_rows.find(make_pair(decc, a.format()));
if (r != d->_class_rows.end())
- row_iter = d->_rows.find((*r).second);
+ row_iter = d->_rows.find((*r).second);
else
{
// Failing that, use the decoder as a key
- row_iter = d->_rows.find(Row(decc));
+ row_iter = d->_rows.find(Row(decc));
}
- assert(row_iter != d->_rows.end());
- if (row_iter == d->_rows.end()) {
- qDebug() << "Unexpected annotation: decoder = " << decc <<
- ", format = " << a.format();
- assert(0);
- return;
- }
+ assert(row_iter != d->_rows.end());
+ if (row_iter == d->_rows.end()) {
+ qDebug() << "Unexpected annotation: decoder = " << decc <<
+ ", format = " << a.format();
+ assert(0);
+ return;
+ }
// Add the annotation
- (*row_iter).second.push_annotation(a);
+ lock_guard lock(d->_output_mutex);
+ if (!(*row_iter).second.push_annotation(a))
+ d->_no_memory = true;
}
void DecoderStack::on_new_frame()
@@ -510,24 +719,33 @@ void DecoderStack::on_frame_ended()
begin_decode();
}
-int DecoderStack::cur_rows_size()
+int DecoderStack::list_rows_size()
{
+ //lock_guard lock(_output_mutex);
int rows_size = 0;
for (map::const_iterator i = _rows.begin();
- i != _rows.end(); i++)
- if ((*i).second.get_max_sample() != 0)
+ i != _rows.end(); i++) {
+ map::const_iterator iter = _rows_lshow.find((*i).first);
+ if (iter != _rows_lshow.end() && (*iter).second)
rows_size++;
-
- if (rows_size == 0)
- return 1;
- else
- return rows_size;
+ }
+ return rows_size;
}
-void DecoderStack::options_changed(bool changed)
+bool DecoderStack::options_changed() const
+{
+ return _options_changed;
+}
+
+void DecoderStack::set_options_changed(bool changed)
{
_options_changed = changed;
}
+bool DecoderStack::out_of_memory() const
+{
+ return _no_memory;
+}
+
} // namespace data
} // namespace pv
diff --git a/DSView/pv/data/decoderstack.h b/DSView/pv/data/decoderstack.h
index b2cd65f8..281a5428 100644
--- a/DSView/pv/data/decoderstack.h
+++ b/DSView/pv/data/decoderstack.h
@@ -2,6 +2,7 @@
* This file is part of the PulseView project.
*
* Copyright (C) 2012 Joel Holdsworth
+ * Copyright (C) 2014 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +21,7 @@
#ifndef DSVIEW_PV_DATA_DECODERSTACK_H
#define DSVIEW_PV_DATA_DECODERSTACK_H
-
-#include "signaldata.h"
+#include
#include
@@ -32,14 +32,9 @@
#include
#include
-#include
-#include
-
-struct srd_decoder;
-struct srd_decoder_annotation_row;
-struct srd_channel;
-struct srd_proto_data;
-struct srd_session;
+#include "../data/decode/row.h"
+#include "../data/decode/rowdata.h"
+#include "../data/signaldata.h"
namespace DecoderStackTest {
class TwoDecoderStack;
@@ -86,14 +81,13 @@ public:
virtual ~DecoderStack();
- const std::list< boost::shared_ptr >& stack() const;
+ const std::list< boost::shared_ptr >& stack() const;
void push(boost::shared_ptr decoder);
- void remove(int index);
+ void remove(boost::shared_ptr& decoder);
+ void build_row();
int64_t samples_decoded() const;
- std::vector< std::pair > get_visible_rows() const;
-
/**
* Extracts sorted annotations between two period into a vector.
*/
@@ -103,12 +97,29 @@ public:
uint64_t end_sample) const;
uint64_t get_max_annotation(const decode::Row &row);
+ uint64_t get_min_annotation(const decode::Row &row); // except instant(end=start) annotation
+
+ std::map get_rows_gshow();
+ std::map get_rows_lshow();
+ void set_rows_gshow(const decode::Row row, bool show);
+ void set_rows_lshow(const decode::Row row, bool show);
bool has_annotations(const decode::Row &row) const;
+ uint64_t list_annotation_size() const;
+ uint64_t list_annotation_size(uint16_t row_index) const;
+
+
+ bool list_annotation(decode::Annotation &ann,
+ uint16_t row_index, uint64_t col_index) const;
+
+
+ bool list_row_title(int row, QString &title) const;
+
QString error_message();
void clear();
+ void init();
uint64_t get_max_sample_count() const;
@@ -116,16 +127,23 @@ public:
void stop_decode();
- int cur_rows_size();
+ int list_rows_size();
- void options_changed(bool changed);
+ bool options_changed() const;
+ void set_options_changed(bool changed);
uint64_t sample_count() const;
+ uint64_t sample_rate() const;
+
+ bool out_of_memory() const;
private:
boost::optional wait_for_data() const;
- void decode_data(const uint64_t sample_count,
+// void decode_data(const uint64_t sample_count,
+// const unsigned int unit_size, srd_session *const session);
+
+ void decode_data(const uint64_t decode_start, const uint64_t decode_end,
const unsigned int unit_size, srd_session *const session);
void decode_proc();
@@ -153,23 +171,25 @@ private:
* @todo A proper solution should be implemented to allow multiple
* decode operations.
*/
- static boost::mutex _global_decode_mutex;
+ static boost::mutex _global_decode_mutex;
std::list< boost::shared_ptr > _stack;
boost::shared_ptr _snapshot;
- mutable boost::mutex _input_mutex;
- mutable boost::condition_variable _input_cond;
+ //mutable boost::mutex _input_mutex;
+ //mutable boost::condition_variable _input_cond;
uint64_t _sample_count;
bool _frame_complete;
- mutable boost::mutex _output_mutex;
+ mutable boost::recursive_mutex _output_mutex;
+ //mutable boost::mutex _output_mutex;
int64_t _samples_decoded;
- std::map _rows;
-
- std::map, decode::Row> _class_rows;
+ std::map _rows;
+ std::map _rows_gshow;
+ std::map _rows_lshow;
+ std::map, decode::Row> _class_rows;
QString _error_message;
@@ -177,6 +197,7 @@ private:
decode_state _decode_state;
bool _options_changed;
+ bool _no_memory;
friend class DecoderStackTest::TwoDecoderStack;
};
diff --git a/DSView/pv/data/dso.cpp b/DSView/pv/data/dso.cpp
index 43663737..2a6ce2c7 100644
--- a/DSView/pv/data/dso.cpp
+++ b/DSView/pv/data/dso.cpp
@@ -2,7 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,8 @@
#include "dso.h"
#include "dsosnapshot.h"
+#include
+
using namespace boost;
using namespace std;
@@ -46,7 +48,16 @@ deque< boost::shared_ptr >& Dso::get_snapshots()
void Dso::clear()
{
- _snapshots.clear();
+ //_snapshots.clear();
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->clear();
+}
+
+void Dso::init()
+{
+ //_snapshots.clear();
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->init();
}
} // namespace data
diff --git a/DSView/pv/data/dso.h b/DSView/pv/data/dso.h
index be987821..0902972a 100644
--- a/DSView/pv/data/dso.h
+++ b/DSView/pv/data/dso.h
@@ -2,7 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,6 +45,7 @@ public:
get_snapshots();
void clear();
+ void init();
private:
std::deque< boost::shared_ptr > _snapshots;
diff --git a/DSView/pv/data/dsosnapshot.cpp b/DSView/pv/data/dsosnapshot.cpp
index 4e0e1b26..665c0dbe 100644
--- a/DSView/pv/data/dsosnapshot.cpp
+++ b/DSView/pv/data/dsosnapshot.cpp
@@ -2,7 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,30 +47,106 @@ const uint64_t DsoSnapshot::EnvelopeDataUnit = 4*1024; // bytes
const int DsoSnapshot::VrmsScaleFactor = 1 << 8;
-DsoSnapshot::DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num, bool instant) :
- Snapshot(sizeof(uint16_t), _total_sample_len, channel_num),
+DsoSnapshot::DsoSnapshot() :
+ Snapshot(sizeof(uint16_t), 1, 1),
_envelope_en(false),
_envelope_done(false),
- _instant(instant)
+ _instant(false)
{
- boost::lock_guard lock(_mutex);
memset(_envelope_levels, 0, sizeof(_envelope_levels));
- init(_total_sample_len);
- append_payload(dso);
}
DsoSnapshot::~DsoSnapshot()
{
- boost::lock_guard lock(_mutex);
- BOOST_FOREACH(Envelope &e, _envelope_levels[0])
- free(e.samples);
+ free_envelop();
+}
+
+void DsoSnapshot::free_envelop()
+{
+ for (unsigned int i = 0; i < _channel_num; i++) {
+ BOOST_FOREACH(Envelope &e, _envelope_levels[i]) {
+ if (e.samples)
+ free(e.samples);
+ }
+ }
+ memset(_envelope_levels, 0, sizeof(_envelope_levels));
+}
+
+void DsoSnapshot::init()
+{
+ boost::lock_guard lock(_mutex);
+ _sample_count = 0;
+ _ring_sample_count = 0;
+ _memory_failed = false;
+ _last_ended = true;
+ _envelope_done = false;
+ for (unsigned int i = 0; i < _channel_num; i++) {
+ for (unsigned int level = 0; level < ScaleStepCount; level++) {
+ _envelope_levels[i][level].length = 0;
+ _envelope_levels[i][level].data_length = 0;
+ }
+ }
+}
+
+void DsoSnapshot::clear()
+{
+ boost::lock_guard lock(_mutex);
+ free_data();
+ free_envelop();
+ init();
+}
+
+void DsoSnapshot::first_payload(const sr_datafeed_dso &dso, uint64_t total_sample_count, unsigned int channel_num, bool instant)
+{
+ _total_sample_count = total_sample_count;
+ _channel_num = channel_num;
+ _instant = instant;
+
+ bool isOk = true;
+ uint64_t size = _total_sample_count * _unit_size + sizeof(uint64_t);
+ if (size != _capacity) {
+ free_data();
+ _data = malloc(size);
+ if (_data) {
+ free_envelop();
+ for (unsigned int i = 0; i < _channel_num; i++) {
+ uint64_t envelop_count = _total_sample_count / EnvelopeScaleFactor;
+ for (unsigned int level = 0; level < ScaleStepCount; level++) {
+ envelop_count = ((envelop_count + EnvelopeDataUnit - 1) /
+ EnvelopeDataUnit) * EnvelopeDataUnit;
+ _envelope_levels[i][level].samples = (EnvelopeSample*)malloc(envelop_count * sizeof(EnvelopeSample));
+ if (!_envelope_levels[i][level].samples) {
+ isOk = false;
+ break;
+ }
+ envelop_count = envelop_count / EnvelopeScaleFactor;
+ }
+ if (!isOk)
+ break;
+ }
+ } else {
+ isOk = true;
+ }
+ }
+
+ if (isOk) {
+ _capacity = size;
+ _memory_failed = false;
+ append_payload(dso);
+ _last_ended = false;
+ } else {
+ free_data();
+ free_envelop();
+ _capacity = 0;
+ _memory_failed = true;
+ }
}
void DsoSnapshot::append_payload(const sr_datafeed_dso &dso)
{
- boost::lock_guard lock(_mutex);
+ boost::lock_guard lock(_mutex);
- if (_channel_num > 0) {
+ if (_channel_num > 0 && dso.num_samples != 0) {
refill_data(dso.data, dso.num_samples, _instant);
// Generate the first mip-map from the data
@@ -81,6 +157,7 @@ void DsoSnapshot::append_payload(const sr_datafeed_dso &dso)
void DsoSnapshot::enable_envelope(bool enable)
{
+ boost::lock_guard lock(_mutex);
if (!_envelope_done && enable)
append_payload_to_envelope_levels(true);
_envelope_en = enable;
@@ -89,7 +166,7 @@ void DsoSnapshot::enable_envelope(bool enable)
const uint8_t *DsoSnapshot::get_samples(
int64_t start_sample, int64_t end_sample, uint16_t index) const
{
- (void)end_sample;
+ (void)end_sample;
assert(start_sample >= 0);
assert(start_sample < (int64_t)get_sample_count());
@@ -97,8 +174,6 @@ const uint8_t *DsoSnapshot::get_samples(
assert(end_sample < (int64_t)get_sample_count());
assert(start_sample <= end_sample);
- boost::lock_guard lock(_mutex);
-
// uint16_t *const data = new uint16_t[end_sample - start_sample];
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
// (end_sample - start_sample));
@@ -113,7 +188,10 @@ void DsoSnapshot::get_envelope_section(EnvelopeSection &s,
assert(start <= end);
assert(min_length > 0);
- boost::lock_guard lock(_mutex);
+ if (!_envelope_done) {
+ s.length = 0;
+ return;
+ }
const unsigned int min_level = max((int)floorf(logf(min_length) /
LogEnvelopeScaleFactor) - 1, 0);
@@ -124,9 +202,9 @@ void DsoSnapshot::get_envelope_section(EnvelopeSection &s,
s.start = start << scale_power;
s.scale = 1 << scale_power;
- //if (_envelope_levels[probe_index][min_level].length < get_sample_count() / EnvelopeScaleFactor)
- // s.length = 0;
- //else
+ if (_envelope_levels[probe_index][min_level].length == 0)
+ s.length = 0;
+ else
s.length = end - start;
// s.samples = new EnvelopeSample[s.length];
// memcpy(s.samples, _envelope_levels[min_level].samples + start,
@@ -141,8 +219,8 @@ void DsoSnapshot::reallocate_envelope(Envelope &e)
if (new_data_length > e.data_length)
{
e.data_length = new_data_length;
- e.samples = (EnvelopeSample*)realloc(e.samples,
- new_data_length * sizeof(EnvelopeSample));
+// e.samples = (EnvelopeSample*)realloc(e.samples,
+// new_data_length * sizeof(EnvelopeSample));
}
}
@@ -240,7 +318,7 @@ void DsoSnapshot::append_payload_to_envelope_levels(bool header)
double DsoSnapshot::cal_vrms(double zero_off, int index) const
{
assert(index >= 0);
- assert(index < _channel_num);
+ //assert(index < _channel_num);
// root-meam-squart value
double vrms_pre = 0;
@@ -249,8 +327,8 @@ double DsoSnapshot::cal_vrms(double zero_off, int index) const
// Iterate through the samples to populate the first level mipmap
const uint8_t *const stop_src_ptr = (uint8_t*)_data +
- _sample_count * _channel_num;
- for (const uint8_t *src_ptr = (uint8_t*)_data + index;
+ get_sample_count() * _channel_num;
+ for (const uint8_t *src_ptr = (uint8_t*)_data + (index % _channel_num);
src_ptr < stop_src_ptr; src_ptr += VrmsScaleFactor * _channel_num)
{
const uint8_t * begin_src_ptr =
@@ -264,7 +342,7 @@ double DsoSnapshot::cal_vrms(double zero_off, int index) const
vrms += tmp * tmp;
begin_src_ptr += _channel_num;
}
- vrms = vrms_pre + vrms / _sample_count;
+ vrms = vrms_pre + vrms / get_sample_count();
vrms_pre = vrms;
}
vrms = std::pow(vrms, 0.5);
@@ -275,7 +353,7 @@ double DsoSnapshot::cal_vrms(double zero_off, int index) const
double DsoSnapshot::cal_vmean(int index) const
{
assert(index >= 0);
- assert(index < _channel_num);
+ //assert(index < _channel_num);
// mean value
double vmean_pre = 0;
@@ -283,8 +361,8 @@ double DsoSnapshot::cal_vmean(int index) const
// Iterate through the samples to populate the first level mipmap
const uint8_t *const stop_src_ptr = (uint8_t*)_data +
- _sample_count * _channel_num;
- for (const uint8_t *src_ptr = (uint8_t*)_data + index;
+ get_sample_count() * _channel_num;
+ for (const uint8_t *src_ptr = (uint8_t*)_data + (index % _channel_num);
src_ptr < stop_src_ptr; src_ptr += VrmsScaleFactor * _channel_num)
{
const uint8_t * begin_src_ptr =
@@ -297,7 +375,7 @@ double DsoSnapshot::cal_vmean(int index) const
vmean += *begin_src_ptr;
begin_src_ptr += _channel_num;
}
- vmean = vmean_pre + vmean / _sample_count;
+ vmean = vmean_pre + vmean / get_sample_count();
vmean_pre = vmean;
}
diff --git a/DSView/pv/data/dsosnapshot.h b/DSView/pv/data/dsosnapshot.h
index eb3788bc..df6376e0 100644
--- a/DSView/pv/data/dsosnapshot.h
+++ b/DSView/pv/data/dsosnapshot.h
@@ -2,7 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -70,10 +70,15 @@ private:
static const int VrmsScaleFactor;
public:
- DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num, bool instant);
+ DsoSnapshot();
virtual ~DsoSnapshot();
+ void clear();
+ void init();
+
+ void first_payload(const sr_datafeed_dso &dso, uint64_t total_sample_count, unsigned int channel_num, bool instant);
+
void append_payload(const sr_datafeed_dso &dso);
const uint8_t* get_samples(int64_t start_sample,
@@ -88,8 +93,8 @@ public:
double cal_vmean(int index) const;
private:
+ void free_envelop();
void reallocate_envelope(Envelope &l);
-
void append_payload_to_envelope_levels(bool header);
private:
diff --git a/DSView/pv/data/group.cpp b/DSView/pv/data/group.cpp
index e0aab57f..7d027db3 100644
--- a/DSView/pv/data/group.cpp
+++ b/DSView/pv/data/group.cpp
@@ -2,8 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +23,8 @@
#include "group.h"
#include "groupsnapshot.h"
+#include
+
using namespace boost;
using namespace std;
@@ -47,7 +48,14 @@ deque< boost::shared_ptr >& Group::get_snapshots()
void Group::clear()
{
- _snapshots.clear();
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->clear();
+}
+
+void Group::init()
+{
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->init();
}
} // namespace data
diff --git a/DSView/pv/data/group.h b/DSView/pv/data/group.h
index 25f9fb29..1312c6ee 100644
--- a/DSView/pv/data/group.h
+++ b/DSView/pv/data/group.h
@@ -2,8 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,6 +45,7 @@ public:
get_snapshots();
void clear();
+ void init();
private:
std::deque< boost::shared_ptr > _snapshots;
diff --git a/DSView/pv/data/groupsnapshot.cpp b/DSView/pv/data/groupsnapshot.cpp
index 69a18f1a..e7cac5d3 100644
--- a/DSView/pv/data/groupsnapshot.cpp
+++ b/DSView/pv/data/groupsnapshot.cpp
@@ -2,8 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -55,7 +54,7 @@ GroupSnapshot::GroupSnapshot(const boost::shared_ptr &_logic_snap
{
assert(_logic_snapshot);
- boost::lock_guard lock(_mutex);
+ //boost::lock_guard lock(_mutex);
memset(_envelope_levels, 0, sizeof(_envelope_levels));
_data = _logic_snapshot->get_data();
_sample_count = _logic_snapshot->get_sample_count();
@@ -97,20 +96,30 @@ GroupSnapshot::GroupSnapshot(const boost::shared_ptr &_logic_snap
GroupSnapshot::~GroupSnapshot()
{
- boost::lock_guard lock(_mutex);
+ //boost::lock_guard lock(_mutex);
BOOST_FOREACH(Envelope &e, _envelope_levels)
free(e.samples);
}
+void GroupSnapshot::init()
+{
+
+}
+
+void GroupSnapshot::clear()
+{
+
+}
+
uint64_t GroupSnapshot::get_sample_count() const
{
- boost::lock_guard lock(_mutex);
+ //boost::lock_guard lock(_mutex);
return _sample_count;
}
void GroupSnapshot::append_payload()
{
- boost::lock_guard lock(_mutex);
+ //boost::lock_guard lock(_mutex);
// Generate the first mip-map from the data
append_payload_to_envelope_levels();
@@ -127,7 +136,7 @@ const uint16_t* GroupSnapshot::get_samples(
int64_t i;
uint16_t tmpl, tmpr;
- boost::lock_guard lock(_mutex);
+ //boost::lock_guard lock(_mutex);
uint16_t *const data = new uint16_t[end_sample - start_sample];
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
@@ -156,7 +165,7 @@ void GroupSnapshot::get_envelope_section(EnvelopeSection &s,
assert(start <= end);
assert(min_length > 0);
- boost::lock_guard lock(_mutex);
+ //boost::lock_guard lock(_mutex);
const unsigned int min_level = max((int)floorf(logf(min_length) /
LogEnvelopeScaleFactor) - 1, 0);
diff --git a/DSView/pv/data/groupsnapshot.h b/DSView/pv/data/groupsnapshot.h
index 729b57a7..4d87b001 100644
--- a/DSView/pv/data/groupsnapshot.h
+++ b/DSView/pv/data/groupsnapshot.h
@@ -2,8 +2,7 @@
* This file is part of the DSView project.
* DSView is based on PulseView.
*
- * Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,6 +79,9 @@ public:
virtual ~GroupSnapshot();
+ void clear();
+ void init();
+
void append_payload();
uint64_t get_sample_count() const;
@@ -97,8 +99,8 @@ private:
private:
struct Envelope _envelope_levels[ScaleStepCount];
- mutable boost::recursive_mutex _mutex;
- void *_data;
+ //mutable boost::recursive_mutex _mutex;
+ const void *_data;
uint64_t _sample_count;
int _unit_size;
boost::shared_ptr _signal;
diff --git a/DSView/pv/data/logic.cpp b/DSView/pv/data/logic.cpp
index 4116942a..ee499f43 100644
--- a/DSView/pv/data/logic.cpp
+++ b/DSView/pv/data/logic.cpp
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
#include "logic.h"
#include "logicsnapshot.h"
+#include
+
using namespace boost;
using namespace std;
@@ -48,7 +50,16 @@ deque< boost::shared_ptr >& Logic::get_snapshots()
void Logic::clear()
{
- _snapshots.clear();
+ //_snapshots.clear();
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->clear();
+}
+
+void Logic::init()
+{
+ //_snapshots.clear();
+ BOOST_FOREACH(const boost::shared_ptr s, _snapshots)
+ s->init();
}
} // namespace data
diff --git a/DSView/pv/data/logic.h b/DSView/pv/data/logic.h
index c7a97158..f163b35c 100644
--- a/DSView/pv/data/logic.h
+++ b/DSView/pv/data/logic.h
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,6 +47,8 @@ public:
void clear();
+ void init();
+
private:
std::deque< boost::shared_ptr > _snapshots;
};
diff --git a/DSView/pv/data/logicsnapshot.cpp b/DSView/pv/data/logicsnapshot.cpp
index ebdb904e..40ee3087 100644
--- a/DSView/pv/data/logicsnapshot.cpp
+++ b/DSView/pv/data/logicsnapshot.cpp
@@ -3,7 +3,7 @@
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth
- * Copyright (C) 2013 DreamSourceLab
+ * Copyright (C) 2013 DreamSourceLab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,8 @@
#include
+#include
+
#include
#include
#include
@@ -43,21 +45,88 @@ const int LogicSnapshot::MipMapScaleFactor = 1 << MipMapScalePower;
const float LogicSnapshot::LogMipMapScaleFactor = logf(MipMapScaleFactor);
const uint64_t LogicSnapshot::MipMapDataUnit = 64*1024; // bytes
-LogicSnapshot::LogicSnapshot(const sr_datafeed_logic &logic, uint64_t _total_sample_len, unsigned int channel_num) :
- Snapshot(logic.unitsize, _total_sample_len, channel_num),
- _last_append_sample(0)
+LogicSnapshot::LogicSnapshot() :
+ Snapshot(1, 1, 1),
+ _last_append_sample(0)
{
- boost::lock_guard