pax_global_header00006660000000000000000000000064115443373420014520gustar00rootroot0000000000000052 comment=f787da4846ce3894c15ae29e42e874fffee04505 sigviewer-0.5.1+svn556/000077500000000000000000000000001154433734200145715ustar00rootroot00000000000000sigviewer-0.5.1+svn556/COPYING000066400000000000000000000431311154433734200156260ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. sigviewer-0.5.1+svn556/Changelog.txt000066400000000000000000000112011154433734200172140ustar00rootroot00000000000000Version 0.5.1 (B) Fixed bug where signals could be distorted (*) Removed libgdf (*) Removed downsampling/decimation (*) Events are now always displayed in a separate tab (B) Fixed file drag & drop bug Version 0.5.0 (*) Optimized gdf reading (background downsampling/decimation) (*) Support for large gdf (2) files (*) Using libgdf to read gdf 2 files (http://libgdf.sourceforge.net, svn revision 57) (B) Bug fix (memory leak) Version 0.4.3 (*) switched to new libgdf (http://libgdf.sourceforge.net, svn revision 9) (*) removed dependency on boost-library (only headers are needed) (B) Bug fix (fixed chrash on Win XP when deselecting channels) Version 0.4.2 (+) Convert to GDF (using libgdf) (+) Command-line options (e.g. --convert-to-gdf, --help) (+) Improved y-grid drawing (+) Improved y-grid labels (displaying units) (+) Improved y-scaling, new dialog (*) Power-spectrum is now displayed in log10 (B) Bug fixes (instant viewport update after color changing and scaling, no chrash if signal processing leads to overflow) (*) Refactoring and code cleanups (*) switched from FFTW to FFTReal Version 0.4.1 (*) Speeded up animations (now duration is settable via the View menu) (*) Renamed "Shift Signal Mode" to "View Options Mode" (+) Animated event browsing (+) Reset event colors (+) Setting default channel color (B) fixed bugs (3021230, 3020031, 3019593, 3019592) Version 0.4.0 (*) Works on Mac OS X (again) (+) Animated zoom (+) Export to GDF (+) Export to PNG (+) Calculate power spectrum averaged over an event type (+) Calculate mean and standard deviation averaged over an event type (+) Color settings for signal channels (+) Mode-specific widgets (for editing selected events) (+) New context menu for channels (*) Improved dialogs (event table, event type selection) (B) Fixed many bugs (*) Refactoring and code clean-ups Version 0.3.0 (*) Removed all Qt3 stuff, now completely ported to Qt4 (+) Dropping files on SigViewer opens the file (+) Open files via command line parameter (+) Event toolbar (for editing selected events) (+) Calculate mean (alpha version) (+) Undo/redo for editing events (+) Insert event (Ctrl+I), creates new event over the selected event (+) Event browsing (Ctrl+Right, Ctrl+Left), go to next/previous event of same type as selected event (+) Fit view to selected event (+) Hie events of other type (+) Highlighting on x-axis when editing or creating an event (+) New context menu for events (+) Simple hiding/showing label and axis widgets (-) Scrolling during creation of events is not possible (will be added as soon as possible) (B) Fixed many bugs (*) Refactoring and code clean-ups (especially decoupling of classes) Version 0.2.6 (+) Qt Creator support (+) Added signal buffer options (whole subsampling selection, disable initial min-max search) (B) Fixed many bugs related to loading files, especially slow loading under Windows network shares is resolved (*) Cleaned up code in biosig_reader.cpp Version 0.2.5 (+) Added preferences dialog (*) Removed some Qt3 stuff, but still not everything Version 0.2.4 (+) Update biosig4c++ to support more file formats Version 0.2.3 (+) Improve support for BCI2000 1.1 data format Version 0.2.2 (B) Fixed export and import of EVT files (B) Fixed missing file name in window title (+) Added new file formats (BCI2000, MIT/Physiobank) (+) Improved handling of some file formats (EDF+, GDF1, BrainVision, AINF) Version 0.2.1 (B) Fixed CNT and VHDR errors Version 0.2.0 (+) Added support for biosig4c++, loading and saving is now done with this library. Therefore, many new formats are supported (GDF, BKR, CNT, EDF, ...) (B) Channel selection works (+) Scrolling during creation of events is now possible (*) Standard zoom setting is now auto (*) Zero level on the y-axis is now in the middle of the channel window (+) Should now compile and work on big endian machines (e.g. PPC) Version 0.1.7 (B) Fix export of EVT files with a sampling rate higher than 256Hz Version 0.1.6 (B) Fix serious bug where SigViewer crashed when opening a file (probably due to a Windows update) Version 0.1.5 (B) Remove bug where SigViewer crashed when exiting Version 0.1.4 (B) Remove bug in SignalBuffer Version 0.1.3 (+) Added y-axis (*) Removed SettingsManager and use QSettings instead Version 0.1.2 (+) Status bar with length, number of channels and number of trials (+) Export events to EVT files (B) Removed signal shift bug (B) Channel selection has no effect on scale (+) After opening a file, show all channels Version 0.1.1 (*) Use QString and Qt container instead of STL stuff (B) No line wrap in LogDialog sigviewer-0.5.1+svn556/README000066400000000000000000000016561154433734200154610ustar00rootroot00000000000000Content ======= - Compiling - Building Installation Packages Compiling --------- SigViewer depends on the following external libraries: - QT 4 (qt4-core and qt4-gui) http://www.qtsoftware.com - libgdf http://libgdf.sourceforge.net - biosig4c++ http://biosig.sourceforge.net General building steps: 1. install qt4 development packages 2. download the "extern"-archive which fits to your platform from http://sigviewer.sf.net 3. extract the "extern"-archive into the sigviewer-directory (in the same directory where "sigviewer.pro" is located) 4. use qmake to generate a makefile and call make: qmake sigviewer.pro && make The SigViewer binary can be found in the "bin" directory (release or debug) Building Installation Packages ------------------------------ Debian / Ubuntu / Kubuntu: 1. build/compile SigViewer 2. run the script build-deb.sh ./build-deb.sh 3. the deb file is automatically generatedsigviewer-0.5.1+svn556/build-deb.sh000077500000000000000000000025521154433734200167630ustar00rootroot00000000000000#!/bin/sh dir=.deb-build # create temporary build directories mkdir -p $dir/sigviewer/usr/bin mkdir -p $dir/sigviewer/usr/share mkdir -p $dir/sigviewer/usr/share/pixmaps mkdir -p $dir/sigviewer/usr/share/applications mkdir -p $dir/sigviewer/DEBIAN # copy necessary files cp ./bin/release/sigviewer ./$dir/sigviewer/usr/bin/ cp ./deb_building_stuff/sigviewer128.png ./$dir/sigviewer/usr/share/pixmaps/ cp ./deb_building_stuff/sigviewer.desktop ./$dir/sigviewer/usr/share/applications/ # get current version of sigviewer version=`head -n 1 src/version.txt` # get local architecture architecture=`dpkg-architecture -l | grep DEB_BUILD_ARCH= | sed -e '/DEB_BUILD_ARCH=/s/DEB_BUILD_ARCH=//'` # get file size of the binary filesizestring=`ls -s bin/release/sigviewer` set -- $filesizestring filesize=$1 # replace architecture, file size and version in the control file sed -e '/Architecture: /s//'$architecture'/' ./deb_building_stuff/deb_control_template | sed -e '/Installed-Size: /s//'$filesize'/' | sed -e '/Version: /s//'$version'/' | sed -e '/Replaces: /s//'$version'/' > ./$dir/sigviewer/DEBIAN/control # build the SigViewer package dpkg -b ./$dir/sigviewer sigviewer-$version-$architecture.deb # delete all temporary build directories rm -r $dir tar czvf extern-$architecture.tar.gz --exclude=".*" extern sigviewer-0.5.1+svn556/build-src-zip.sh000077500000000000000000000005671154433734200176240ustar00rootroot00000000000000# get current version of sigviewer version=`head -n 1 src/version.txt` revision=`svn info | grep Revision: | sed -e '/Revision:/s/Revision: //'` # set directory and zip file name name=sigviewer-$version-r$revision-src # rm -r $name # svn export of current working copy svn export . ./$name # zip directory zip -r -q $name.zip $name # remove temporary files rm -r $namesigviewer-0.5.1+svn556/deb_building_stuff/000077500000000000000000000000001154433734200204075ustar00rootroot00000000000000sigviewer-0.5.1+svn556/deb_building_stuff/deb_control_template000066400000000000000000000007521154433734200245230ustar00rootroot00000000000000Package: sigviewer Version: Section: science Priority: extra Architecture: Depends: libqtcore4 (>=4.7), libqtgui4 (>=4.7), libqt4-xml (>=4.7) Replaces: sigviewer (<< ) Installed-Size: Maintainer: Christoph Eibel Homepage: http://sigviewer.sourceforge.net Description: SigViewer is a powerful viewing application for biosignals, originally designed to display electroencephalographic (EEG) data. sigviewer-0.5.1+svn556/deb_building_stuff/sigviewer.desktop000066400000000000000000000003301154433734200240020ustar00rootroot00000000000000[Desktop Entry] Name=SigViewer Version=1.0 Comment=Viewer for biosignals such as EEG, EMG, and ECG. http://sigviewer.sf.net Exec=/usr/bin/sigviewer Icon=sigviewer128.png Type=Application Categories=Education;Science;sigviewer-0.5.1+svn556/deb_building_stuff/sigviewer128.png000066400000000000000000000325061154433734200233620ustar00rootroot00000000000000PNG  IHDR>abKGDC pHYs  tIME l IDATx}ixו[ի[ݒՒZ+]X`;v2&$LMY2&3;dIkl6$ 8b֬YFɛ-}tfϞtdggߐU>˲u秧C#-- ,h.++[ j E|4MΙ37$:ʆ'X(BZZ, n7v;<2N[ntǹǏFZBN\$:<fH̿), OƵieYo, aT׋H$rWzqv=Ȍ<,K7 #@`Y ߏj*//FEEbYE xP' J ^m.ҝ9Aq'ES)r>ű>Η~!ns+T= ,XV?+>窏_a3,LݚYbD5 XUh&:jp80-;tҠX~["(XiH ϡAS2@@%k Fβ,c ǀA# )[ƎM X\aHɄ@K:(ՄlQD#7`)cǂeYn~Ca1YBX*sS'vD'4eC,@kK)`@IiLd$+A8 @j\%RpY`Xf>Arpmy5BjZCUfAuE@ G2q_v}!  % 7L_`>2AT\Ѩz))z7/\ԍo \)|30,aAp>LH^N ].nV.`|Na$̘F:t{t՛ ,Ra$P=z4x fe~S.aavNv0%A3I`a3,X(ee#=M@ ݃Q05u:\:S$_`T>t$ GPiYPwY\0iT_{rlS#0,FӒ&0_YƶL×We4*k|I8& {L|ɋcqΪGQƽ2I၊,\/l+]/4z6H2N֡0崩욠I' e3 2kezllMY㴇S  叾b;ϲl6'ψď׸07$=/ma$ 2,5hdXf7_  wHfR97g%N<4ǫzP@y _YSmjߠj_| kP=CPB Јr%N=&8.$/tHX5ˡο!oP^ِj@8ߘ*qV5cA ˰HȂt<ߤ f $XlR=AGp\-`vArYu`cRGvX@gf In(0 ): (iyeVk p_,bâ -kFCw'ZB N; G!P)sr 8YȌc-a|FNN Y_nÉa1&0 |38-`DR<G,S NWGc щYHݻ3zd |ҚFF=- 0*Y EkMIͲ,_Vi4U*ըyȲ@ :y`^ I[J*f?ڜGhF,oN F}Z9quh>4 RoT3 3'gRh96Yf?`e g|qfP~\Ųi6jWwS*`&A Fpl\?Huy` <en4N e38})OTVuGŹߎ5 %,|i61B8O0 Rc4{}ٹxa/˫fѸ]al9]1 !yT/cW/-!Ջ:/#D$p$+cY}aX&VܱOrW{vblj>c4LkFq%fa`(-H?G 64tE0%G>ԺCX;ώ=þAя(qrjfʡ~|r)Wɴ%oD 1E.݅Ʈ0ɉ0~Qζ6qVuɕ9Yc <؅}:ӧ5s5#KJ $:L:6/w /j/$g|= aQ4vF;;;eF|̟LGwPЛ ?i bryHr`Y׮nLuU+g5Ə{n5X_ӁԮ("%w/4*4 t,X,*(Pda=k#[Y M?϶w5(d$ aT_ "' 23yXFW((?RfQq?`Fڸ%z{p8,hEږh3 ^<ą-GyD =,A( TdG8$ <Ez|ql9>7gϱG,_<P c>A9Fi)+b x{vsp{B`x({mmmOʆ^Os<% ڀ( D|T/g!TMVMW6&.{#u 1y~OQ 20HcʗX,-(,rj {9Qdf RHJ㻟`ی}>hIˀ@kae) J) ?N惋0.suJ hiEH˲x2_F>|4} |q~==D"qaɿUo>?bC2nh bNJyDA"[5.K|x~(;_>d!(IK0a) 2 +`䣆7Ȁa9=ݾNhGɕ'pQ$åf/ l.<,GnIW 0pt*.geW_GpE /|q ^X2&<Ѽ[f8n%2lzMq)j 0 -pNEs!b%AmIOy6|"d 8X66Cotb`r30Ku_&=%5< ,fLچp_f0R^b9nМb&w KsT\<Ђ`04dg3AkOh\@0\7JrMX<# GS<6cn 6yeXe`v-A|\7i@̀`ݾ(g/iy.)MG8F]Tl?ދBzZn|LX7ɒzYSmYh9ixbe.BX='SFdJ S,䳐iF#MYB 4-ۏyvbanV9oFSMt[ Wem(p[P`mIp@s0ZE$ 1 İh^HUd1f҉Ho?l0hyNjcC OhO(ǿ}h,&tq;"sL{Mh o6U3'zP4/1l5%JB'/C+־vP/޼v*jw/A&5:8XۇY^_/l_om2|yz:= +)\ `v|e}?ދo{0Ԏ,v YaXg?9BkJ ЎThp@}?کa)E6 2(JעA;d/j< \ٖ vr2s`r3 9xxY($V*+OqQP4Y Ã`ЄdTy /Hڅe_j- >*W.⇯4t0M+(a |گbtXEu'|?&ڈXÓgh@$h t |FO0luOJ @~I z #)Q`'{񣍍\B)~6EPh I K1X !Yfd O~6 |j0(@]Sjd@8Ep) OZm/H!ke^o@$CY: Fbɫyp)wƇtcO?~/cZ|\pڍ2FPè) (5g;/.RKqef~h l87@J2L}VF%M6biSbÁsDA`ih (nZ;]oATC?>O TyϹF(ar۝DIFݔJQ?r(/8 dye3; 1cXDy3/87Os`fg/s Nv^XjMӄ֌PmZēD h6i3{ 6oo -j&#r.`JMQV/R;N7|ZʹY*r ))A&d1A<VdꖙT rv `>̚ !Pd:ynX^gD~qgb ߉4 Y09W=3Krj'gྛs<'% Xu3w`Sz]3[ξX?1RZ+X1}P1CWpnFDc zsL`J/ eJs3z.w0"4$VRO2d>I"9I6L7AOWb# lQ4G`a`K㇏OC DLǙoLJt%z4&;.Sn_A:IDAT<4]&L3FVQGUA&j&AF@(“y)3ׁZ<1v,yF+NnRp^gZ·]:ۮlk2b,v "H/K#(|؋͇%:C7ASULz[ .$#hU"  _0 9U*@@TvP(Dz9~чmǼ)xK08òcAl:'iFZ3x4MsPj앳ba0ެE(Ȁvގ緵oBuOmCx}y]1A*2E%?/jW6GS. Յ`~N3,vcDZP/](^[xUC[ggʦjq)oF0?=Pa!# .`cwxdIzql:҇j}u4c(4E:Qw{zpSMl3_ ""f /xf9c?vcW梮u2N7Ol Z]QV|BD "QnS}+9fCϮkhy I=yE~afXk’id΁( .  z?GU$ꭣxh~YgZCX1UXsPtz a#@ɀ*G+H$(` ު7eca/?5%`ip%${SY2FP͟cR'Q$!,"~ "QoUfNB*#D¹Ў2qPˀhG u(x4WȦ5+s[[67*@VP8Ar܇,nbŞ7vbǀ/L0mv})PEbI$ŌM\q(8@,LőځJ;H Z+@yBHz!0?w{yv`Eb Ŀs-`'^$n+,&{H[Osa_rKK\iMCLa NMZ.- (’鸱|K*S4  dsȁEє5N^UVv7aY]( ue0yq~FlW/V/\l3SlR3 ,) >)9$qI|.g>_4e`#H+9:iO?d2hmm=KQ~o`6zڢilܸt$骫o>"ubGJ$Dw!9p8GkjjZ Vk͛7 >c1w~Cחu:Ԅ&l޼#<vH#jٖvn>u |Պr|>ܹ555~.hJjkk{.Ḩ( iD Qzbԩzضm~m x8@@@ƍ_h4`ssiҥx<'wo•\'}fNPG}}=jkk/Uhӌ @)6lx*770==%%%x<07b׋f|m۪op@ TJ̝;wҥKggghkg|3g4WUU Mo"\< dk jzn+))'ÕIc[ss3Ξ=]vmonnn{#O;o._csw?C8?t =F-EMðX, rop4Mj|F˯bZjϥy`nH 0uJdz6///޼y6mڸ | {A__:z8p`7ߙ xG~%UR|Vx9sdL>}MZZڗz}8Nh4{G7Q&;{Aee%qIpx{$7Gm$Cd<§[.h4~oPp:?>nҥKxWpw"77w}L&_^744'Nĉ8y$  #t fnݺL-AQcҥPX[o=5-޽O?4rrr4qAx^bC}w|@T3jbҤIa09jX ;v+V뵇BN9vZ<;cƌo~Ic* (//ǁ [nԩSq_Q ,\Ɔ;}gϞ== p<3YNsϼy򕯌| Dg*;;v >رc8~8Ν ˅~B! 1?#ͳp:hnnd2tR}iiiə㏏Y܋YٺpBEaѢEx<n뛚pbDQD"bhɲ%K ׾}V@2וxᇳ^Yvh܄/fSLjEMM Ο?p8`4ǭ|'F4̙3t:W$Aoo/233Ӎq1[VVV4VcҫGa D䲳rڊ-[ ++ .kTDގvtuu\..\(w"Hz_,"# A[L&,ZxDizmXZJKK1ydDQ@$ɤ.>zFAQV+O.V> ٽL+z ddd ^O r ! BN ߆ dbЅBn+hf3FcW@4|7]I#^00(Mh`p v88_s Gs! ~yߏf ^q"@,`pb`llfS9㱜9s8r 4555qz@h|j9EAA]Q0fD/^۳g'X>aU$Pĉ w 8X"5F,æMkGlQ/\py^ڹ 3gPUUX,]v?~ 4c L4XsΝ-++[DlMMMZ7ϲ裏PWWp8ݳgϡ{GnG0| x霷nݺO9;x/@Oŋ_}WCCE^4wOH.jB(p b'"SV\ymh4@ff&O? wwwSN{w@y|Maͼ&0)##c=sٳ1`@~~SZގ .  ۻ^{N>1I #pnpYrΜ9 L&?5 ˃3x.^W78(AU]]ţG?qD#o߻y< #\mR(Ńk7 `ҥ -Zt:'Z,8Nvvdee]SB|?6TUUutt3tO|ə~~󮚪/a"̐f& T6_ :0x&>ďمma韺Яhi=a*ȃDOD9 B1Gj1BkIz+ Ph6s O#&MB0Z Wa.>Cs].ʇ;OÏIENDB`sigviewer-0.5.1+svn556/doc/000077500000000000000000000000001154433734200153365ustar00rootroot00000000000000sigviewer-0.5.1+svn556/doc/Makefile000066400000000000000000000107761154433734200170110ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/SigViewer.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/SigViewer.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/SigViewer" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/SigViewer" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." sigviewer-0.5.1+svn556/doc/make.bat000066400000000000000000000100241154433734200167400ustar00rootroot00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\SigViewer.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\SigViewer.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end sigviewer-0.5.1+svn556/doc/source/000077500000000000000000000000001154433734200166365ustar00rootroot00000000000000sigviewer-0.5.1+svn556/doc/source/conf.py000066400000000000000000000157461154433734200201520ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # SigViewer documentation build configuration file, created by # sphinx-quickstart on Tue Sep 21 15:24:28 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.pngmath'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'SigViewer' copyright = u'2010, BCI Lab, Institute for Knowledge Discovery, TU Graz, Austria' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.4.2' # The full version, including alpha/beta/rc tags. release = '0.4.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'traditional' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'SigViewerdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'SigViewer.tex', u'SigViewer Documentation', u'BCI Lab, Institute for Knowledge Discovery, TU Graz', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'sigviewer', u'SigViewer Documentation', [u'BCI Lab, Institute for Knowledge Discovery, TU Graz, Austria'], 1) ] sigviewer-0.5.1+svn556/doc/source/index.rst000066400000000000000000000007111154433734200204760ustar00rootroot00000000000000.. SigViewer documentation master file, created by sphinx-quickstart on Tue Sep 21 15:24:28 2010. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to SigViewer's documentation! ===================================== Contents: .. toctree:: :maxdepth: 3 introduction using Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` sigviewer-0.5.1+svn556/doc/source/introduction.rst000066400000000000000000000007461154433734200221200ustar00rootroot00000000000000Introduction ============ SigViewer is a powerful viewing application for biosignals, originally designed to display electroencephalographic (EEG) data. .. _supported-file-formats: Supported File Formats ^^^^^^^^^^^^^^^^^^^^^^ Generally, all file formats which can be read by the biosig library can be handeled by SigViewer. However, the primary file format is GDF 2 [Sch99]_. .. [Sch99] Schlögl A.: GDF - A general dataformat for biosignals. http:///arxiv.org/abs/cs.DB/0608052sigviewer-0.5.1+svn556/doc/source/open-dialog.png000066400000000000000000000460201154433734200215440ustar00rootroot00000000000000PNG  IHDR_ʷsRGBbKGD pHYsLL{qptIME  ?ܖ IDATxw|SjҴdtR - CDL~*+^ช(`( @Y-m3mvr~#m6-m)yȣ9w>U洖߿3ڠjQUKSRjS9R*t)mT\of8OD3V?gM=EQp=~#'7ihjtqE^K0m Uii~8u?@Xʱ>JM5t8j j!zsηfr|y[&5 h5P* `Yӷ/o:HHhKt:-:NEѠ*ۃzq,^^yItM\W ?4"##1U*ĀUt#TڭS_<X+`!`S6J|M Qթ|82!**YP@zz: UM%&66piiDFEb0eJVqqq)ҮL^CBBSSSkmvc)tLRRRfh(:ubDGGc22v;33ҥKm'&%XS%Inݪml6ӥKvItTTm/˒k+Lnعc5η(hU !#{bw-nH833KGp6\<-O^HTpP5qݤt:pe7Ӂaq91CpЃd|%.[K6zU(u@mɲYfRVZV=vj;3j45Mkn_g0AV<~Qc{LWCsPZ;&myg;g~Gm UM.CѩSǠ:Vv Ji$&vĊm0uͫĤmW^j5y`I /K/yrE}Ʋ9<?n1?w0VHnn.0TjtU{(@Hnnnن ȱSVѢU5PGև8sSt5@ѠQ4h:u@Sﹷ<`5̈!md|c#:`Aq0 @j.2Յͺ> _fZ X]\p 3_ڃ5u1+bUUh4V63gc#%%z¶7 ޯZ>$l% m4 9sxg*ߗ Pֶ)4>|5 ZaPq眮LAz.>᧡5> x<lwhUjE^n.'ή?$Գj=jm|= Yw%zx>m5 Y/}i.ʷkq XϠ+b/T|/*Z^DTӽL5~]yc+-ھy<rh{is :lW\q%?Cm322<<O!/?v[ᨰ;]CYS]lٲR2memm[9wW_rxWXd1{oYטWՆ/V!DOv>Trp;|!Q#~(vZB*y#^:j.#Gt(l65, ZML@嗅0Kg{/qes~:wD쀣< ґN=q~ ґN=/2qf~31pC.оk7z-g sxϸ7-bJI_=GXzǷ'ičb/}x- c8: ł_KT; MNPrn !zЕ,xq"Zp;v%66ncn}ϙNlL41|Uajw5jYnj5LOL(;Oۧ1 .ܹ<WIP}}nwTr>Iص󘘠MgÖw46Л}6|~|v潱;2݀EcǖrO*[u.%V=ӯæ;/$/2H~.%] ]+Ns;Q=Y|q]W|*a'; t~3Axsخ;Oz,1xO8i,6ҪZŷNŖBrحeBwukenew=FE%|>EvUP6{__/x{%+lG70M<|}̣f͟Vϔ$C2X2~OIw{iEN9,ļ yRVZ uw?ؙ́;na{Hƶͭ.{}?>_*ŋ99r^a'R%}'p[oq9cuEUMgY]}lEEEs=X,EkW^ɒ%`/_0Sjwe1$I&_1vXNkՊvXWwn-}^fsӿ ]ۿ5#xrv7BC Ў-Lx+REQPJu[zxU_EQ &#u7ߤ$ruiY'{k-7$&DOtu 'BQSI,JW#J^ӻ8 Gi;ڡ1E{9v*˅kECs'v|1tG}-ySI2vnr -u-xutNJͷ\nj8Iڷ=VԓKW|TՖDh"8ʛ`{ nz0Ms^r.2~ch6^_eoZ G\w3%Kzn5z4]~‚f]z{OQTTĬYrA/_P>xͷxۛBR$ ߬滆yW%2YpK~ҥ?#We`+QVm*: z-m[zG\MzR U4XmnohAazQP(%yh|HK;TXՒ!$FS\ƾ[NѠx=xU[^=*Íjp9ݨ(S} E*(䊂jÓ^dmOoa;c(X*AE-2K*m8m<oT}5}5ZϡV}ա ^U[eVU/^mշ_l*l: JIߦAS [T<.7B{a(Xh˹Ϯcؾ_Yj5_?9?Ȋ/$λߨjJm+T6m[<ʚWSxiɃ,u&B)*}_(Y{śxo|86Op38z&jXbaҥ+m3$$^LFSe/((vϘ9c:K|,K`(h4Unz4;'rϽުR͇F^t)+V`DFF|J&M^g`@S .|BtꭽxDoJ[na^`V;sq_w1g|ZWW0nJHYVz -` y&j)_NN=5t$$7c;ʦoi,?Sw&9ȢG`6;W{/FÔүi'Q^nRVo5 %q,IFMsE}\w}Ǐc ֪c˾bYȡ;& dL]8717K({:K «Lӯ%}k:SX!l6*[K+: >yaGYHx{P-[(]1+`Z~dK0'aejśyݍXsk$K⼫&c=Ʒ_-`yVow&\O̿*0%qN=ƦůS[Ǽ p_/\Hr|[ێےZ-͌4lUM7Vq۬4OZp呞vUWCnNN}zmgʾ[a^S`Ϯ]ÇFY[NJ+ 5ػg_~EΝޘ\c۪/|}3ߞ|wz}R{K~۵_nW|n _{^MЦMkطNڛ``:tmhm<ޯ{:+Wmd׷WsF\}-FV2j]aWQ5m\Z2ON) Ivr-s/iGӆ /ɥE/2WzM^@ڰV}B8=1Fu%+:qs4mқ\jy}9Y҆]N0vc. I ~qw;W`,=zUm4Ӟ^/_7_ITm ^x?\cfbgt. dP5[\RI:_OshSk8C>̞Y \w/tBx3{f;{V3f] ~G83w}9tLQzI}>UQC{39bt {aTom4G2GS{1܈^Q+m@ 9X}q?Mepe&^{&k,%mX2LcY}.dEEOЦmbn&MvW6h۶mI@~Ym6Ui;// ѣG݁m۔Zu/o51em;΀yp:nߞ6dJ.o{u:p\>| gvm}*WG_TT;޽;SwIg֭[q晾jvdjsNV8(Yݻq\уs+'}s͂Ix~ tӕ|[4҈[=a-8 ,TPLP ZVlUAcYX]pNKqI:BBMtՃnQgϿۢoxWNÎEUt\V܊St: ׍n-7 ^\N.-FWfw=!e1Bʿ^<.'.Jb0j|]4.Z;VAEAh\v'*F(*=D[Aӡ^QNWwN[xq9\Z=z6{ `^ߐ/Ƿzp;]zP4:ܥhUP=N[U/nGEKHVb1u+hb4q%Z{m|=nViA1TjͳT[ЖOj,ngf}v }={x<ٓۦn2fǎCj.m^a333ٱs'&Lq:ޣG]%v$Zkb ncxcr2ƍCQTTbAQ\.6X,|nÇZÇI=t۷szlFUdeeyVCxbbb״JXbG).VkڪEuJ-!(b~85L &#Ê[tu6q0% F^}NAbᮖ1\j6ڨk|m餦ҿ_fv6[A~oߞZn7_1v͖[ӷok; vT)s5UI vfV[6oWķoOtttDU1װrzzI||az,h۴;E`n$?zK{Պ^ } ׶)4!|^^oCkX&UwW5p]6^I>s  ⦮tU2< n mJ8дagJMW JOv}B;V7/滶_]MP9Za\VUk`oj7rK&AiNTn5e V^*SARQj T7h%ܐ\-rMbgV\t%'ISV{ ;]j{`+polTK# ԲqUAOD*>D딽81HU1mn]+ N۠]5|"[9\k.`Ou^ki6rmAekS827d%܄Upc `7`lVB4,)Y$B$|BW!N %}, !㷌 IDAThTFZ,K!DGpIj*A!D/t;t", D!BH !ĩAw,޶m,A!)iI߽V,Rv'nk@Q[4] E҆Sfgl;>?Ń Egnψ+oH0ދ><17^K*" dF5V$jXk$T~5Q [[߇ɷD ﲰ.>8QQUu0|6}BWB8'2eshxn= tD'ڄPrrfathۓs.fVrnqbVzY~A.'߳OwqW=< PLYlY@gE㼼6ZpZ泣H>!+NX a꿻K9{*Cr]#IyB<}g_4c)Js:__.^\t&)_B'{ |Z\^N8m6&NrII!I/99&s`>:$tHCHP|B!W5B&J+ͤ=v 9BHFBSEt;Nl[S~Ol6Hњr9~q %c''Bfu>W7fn~;$xYBNͧۡ90!hb(uI+ʷsV[V R n߇I6?݅ڮj+dJ &Zw9[FPmiՅ6!̰uSJ!m5V兵J=#[wu7\:,rhV-dGkn&3*#MvxTz>\ϓsԗ'+TAjvLp=w,<ŞFⰋxdEfC_g}^"%eg==g]5W_$6NY98+ߺp\*A k=Ҕ6\16Oѯ–\2mP/xmJE\V|ߒqn[qU^XzFO=Vҝ&:ʃU~aa8s-[Җ64滹 A8%*Ml|a5cZMb$穨ՒkOJNzq-(`\5KR6nA̙p zoh:aY}=SbG f[]XDz#@ӯWɹ'<6|yelv"<8O=;S|I%xcE!Vx!_BFu_07OjQ6}&a-<~>;{^C3֝fŽik2w&/f^ˮ^VL! W:\݅uE :p2B4:ՙ9,*Zܐ%B4W ߭rk&U/+lS~6ǟ 盗+'\L]+ ыxB _!854ʥ`: !NʷjVߑ,*h#Y!DR&1Um$ !h %qLz$j+}80B&h4xG(vqf̡GHBf[ W,GR<.t^_8ZY,|)xK7,\p-q Sd-B4H FP^W+B4ʷ#Y4k,՜km{<2"<4%%k9dd'XyC"Fc!sVS,z-kT'HeO?@5orsEBpdR)r޸+FؗHDH cᝧX7d{b .B:ShoƠj*w~=̘ZdsSPz海/_ˆ=^tx083渳p4}Q^ !N99rdaMCmlZڞy m}NfA1$6 ږt 7^1~N eU 3Y_К W1'uzeB4QCdqib8cP,{xu_0֓=C2kw1o-6 ץuHՄFNQ!|U[V :DΡ⊗Jw[0DcR,\qD0uHy҆o!EgF:.rkM'ĩP!gO,LLfOGFp9~*o4 }]B ٔ<"UǙ/>aMШ#YhqJeL7v7EhMrm/áby;X:^},9 >݊5{&ND{[HCfz`"|/ XDP\,}t%te, FǠF_g8emB·q#Y1L N]UkE宋cĐa3FY{|^/yL<{8Ckw~JK)gKQ=&lj홝uq=x5/x$o:E}뗱要}k>O鼶RvlBȓoDGrX<qq\ijm?+I1td}b%m-_;׾xcNk @ծu׃;ZO?,p^?w,ynzaZʁe }K oՏ?7-KR*U G;RzHn&m5#7#3MOk=Їw;>琭;]:W2y>},Ӟ{׫y'9d iDs6#g` 8|t RQ-oJZD d;.!}|~2=[遞L>k0iTkM~\p{A})?!JW/ihiM9ɶy <@ z8'\_1Ǵ:3gIf=8Pq{[ q[8pt7N;)ݩs,H3QnC.3_WxW-/㵷^އ=Mۢ^b1w;Pbqjcs jwiUbH _ XמP-)[&2|c3ߦ;j"P[J=˲ l{Nci:8K(=LM>6c!D rCnAGY[ K&>}9xacsؖęe >~dڛ*=u:;K|%|W!~[h1˒g>4 .=?SOW@S9ׁɃm| v;qdpOozz eSQO $|4vaۢ?b$Sn}oǭrMo(FNo\3 J[uƦWncڨa5:mO]H Nqݼz$Fì?,:Ǝ\2>#nK[ pfo:#/qj:׬GլmY7m۶۶mcA.7 W[\~wޛC[Z%;IJlb]a*18,_ eT÷CBGYῒ) 㥊mb8Ƅ.i>{ F^ߝ"[?YeI, D1bYA/2YB!+B!NEpBV9gB@X82Xdf6/icyM}([KXH-u61btddϜLLH-Ӻs퓥I_fi0%hȎ@{&o!;@j9̘Ѓ0؜[dzP=M\XwOHg!)h\P[qT(W1 ٟm!ܡq ɀ?4!Nȑ}hgP5Nz lܕA7G3U/'K!L IΟ{l|[Gq$}=ě,lOB:&l@x66M%+㮜Ib ;)~ĺxfoUüi]l\/],[XIٸ1|tgt F@u]Vi9ar4_!N,7MƟM?Ybz{ &sdd?w>;BsG4[6`<7 omӺ ع_CFӽ5ج*zE q8:LVVG_ O4g!KNv ! :Ƈbp6)]1zeǛO,صomz{ lVӣnEH3=h'Ϳɑ& !{Q@.khZ#u =2^'y~kk@Kli[ہ^[*fB}w~f/o' gHhc!c&CBZ;Qe?>$B58ص#!g?CkЂ^L䙝h-]36-fLSC:d% /fP\*kx'+'\[3 )|ͯ4FZtcV䡣U1d~]EBZ۠m5'¢qڢZö7@N0U8b'}Y3|DW=SĞĎH3lڤ(?Bf!7lUA9zyu_G ϟ??OCVp!$|EuHFxM͸U xIDAT;^KB8{ƽ|ˊ._-fp = %weݢz@{jVu4b Ofλa)U\9T_1θfndB·*{{1wwlm Xoyo7n۷oq OjR}f+*#36/3{? 8-A ; 2,ڂ0n:[PB· ʭwM_d(628˯dEIRyùN1y}t7|f{1Bч'0kipS۴| ᅯ1Z$r sfEx)c1ёzFsQۿy| N\?Ճ5mҖhMhT/L]ټye~vN;. yUUQU |6O.Zq9- {\6.OihGYׅmWF}! (5Wޟ;`{&~q&2~ZO>yC>m{r̊W}lmH#ɰUXjd}go?EDžs*+TL~O\†C\^CxF DE;?~JRog#Kؐj嶓k=oϛώ{j؁|lʴ*La WQE;m~ݶKn6<>ZKu!$|N(oI[yso0\ [ۻLbr`D<2s BkKמ?%KTiMtE괁G4X`"X< :u>+be=Pp]:V!+D=zDHO+CDD:5!\W4d&N\ԷmƄ8x`,0?&6NvBvB _!B!+X4I2ڬB4q*"KQ!:|k:S!D`+B!+BW!$|BH !B _!B!+Bq"'/X) AH є&L$ AH dbq>_!B _!D| -c'Yu$H TU`[QTX?$|I!+,eqY ,k"}BqH !BH !B _!8X=n6,B\d}\03[xl\n*pהXkv89 6}4`Wgze☩<7ov}=<9yIGh߷~1ϲhbrN7~{ap稭x!;.~tV\-_3FcGiJo)g'hKw3{&3=g]z8 "KFQpFzN‰[yb[-źQrg^m.y6{_]w}s /X+jڭ̋t\gw+|Eg*otf3}P/-A;'eἛgwd7~WNOX?H q7GQg>15oؘ|.y]`ZbF9&'Elb:S'N>Ά<ղ9/IW,Hn%%d &m^ ]8zFi"'Q+%^&ӲvUg<|w++i!x<,vnxgT `Bѝ4dk)~Oŧ0 EJ#v=x4+5Y/\=c}'Du6? qM~$w*|El)ᲇgvFl83;f/׵F.~CѰWDD"" _2tDkDYQ-"}dXTR+"___t\-3Ea!Ia`5B*!"APa$3db iAD$;_ ;D4|Au""f&Vvp2D ""zStMD$RvxMSɘ1c1 [=3$""׶u: )*7v|bfï5ED nxb_[ K]vwpo'hZZSDZnLiٚ N.uz' s´IENDB`sigviewer-0.5.1+svn556/doc/source/using.rst000066400000000000000000000026041154433734200205170ustar00rootroot00000000000000Using SigViewer =============== .. |View Options Icon| image:: ../../src/images/icons/configure.png .. |New Event Icon| image:: ../../src/images/new_22x22.png .. |Edit Event Icon| image:: ../../src/images/pointer_22x22.png .. |Scroll Icon| image:: ../../src/images/hand_22x22.png .. |Open Icon| image:: ../../src/images/icons/fileopen.png .. |Delete Event Icon| image:: ../../src/images/icons/editdelete.png .. |Change Channel Icon| image:: ../../src/images/change_channel_22x22.png .. |Change Type Icon| image:: ../../src/images/change_type_22x22.png Basics ------ Commandline Arguments ^^^^^^^^^^^^^^^^^^^^^ Usage: ``sigviewer [OPTION] [FILE]`` Options: -t, --test starts SigViewer in testing mode -c, --convert-to-gdf converts the input file into gdf and saves it to the file given by the option '-o' -o FILE, --output-file FILE output file name for converted file Remark: Converting to GDF is in an experimental state!!! Modes ^^^^^ SigViewer supports different mouse modes. Each mode leads to different behavior of the mouse in the signal view widget. |New Event Icon| New Event Inserting new events. |Edit Event Icon| Edit Event Selecting and editing events. |Scroll Icon| Scroll Scrolling the viewport. |View Options Icon| View Options Adapting the viewport. .. include:: using_open_files.rst .. include:: using_adapting_signal_view.rst .. include:: using_editing_events.rst sigviewer-0.5.1+svn556/doc/source/using_adapting_signal_view.rst000066400000000000000000000003461154433734200247560ustar00rootroot00000000000000Adapting Signal View -------------------- The View Options Mode |View Options Icon| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Zooming ^^^^^^^ Scaling ^^^^^^^ Hide Channels ^^^^^^^^^^^^^ Individual channels can be hidden.sigviewer-0.5.1+svn556/doc/source/using_editing_events.rst000066400000000000000000000015421154433734200236060ustar00rootroot00000000000000Editing Events -------------- ==================================== ======== ================= ============ Action Shortcut Context Menu Main Menu ==================================== ======== ================= ============ |Delete Event Icon| Delete Event Del Delete Edit->Delete |Change Channel Icon| Change Channel Change Channel... Edit-> |Change Type Icon| Change Type Change Type... ==================================== ======== ================= ============ .. index:: single: Event; Delete single: Action; Delete Event Delete Event |Delete Event Icon| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ An event marker can be deleted via its context-menu. .. index:: single: Event; Insert Insert Event ^^^^^^^^^^^^ .. index:: single: Event; Create Create Event ^^^^^^^^^^^^ sigviewer-0.5.1+svn556/doc/source/using_open_files.rst000066400000000000000000000013631154433734200227230ustar00rootroot00000000000000Opening Files ------------- Files can be opened via * the main menu ``File -> Open...`` * the toolbar icon |Open Icon| (Open) * the operating system standard shortcut for opening (on most platforms it's Ctrl+O) * starting SigViewer with the filename as commandline parameter (e.g. ``sigviewer my_file.gdf``) * dragging and dropping a file into the SigViewer window After a file is opened, a dialog is shown which allows selecting the channels that should be displayed. .. figure:: open-dialog.png :alt: Open File Dialog This dialog is shown when a file is opened. The chapter :ref:`supported-file-formats` gives an overview of supported file formats. Initial Downsampling ^^^^^^^^^^^^^^^^^^^^ Will be available in the next release 0.4.3. sigviewer-0.5.1+svn556/sigviewer.nsi000066400000000000000000000061701154433734200173140ustar00rootroot00000000000000;Include Modern UI !include "MUI.nsh" !define VERSION 0.5.1 ;General ;Name and file Name "SigViewer" OutFile "sigviewer-${VERSION}-win32.exe" ;Default installation folder InstallDir "$PROGRAMFILES\SigViewer" ;Interface Settings !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "src\images\sigviewer_installer.bmp" !define MUI_ABORTWARNING ;Pages !insertmacro MUI_PAGE_LICENSE "COPYING" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;Languages !insertmacro MUI_LANGUAGE "English" ;Installer Sections Section "SigViewer" SecSigViewer SetOutPath "$INSTDIR" File "bin\release\sigviewer.exe" File "bin\release\mingwm10.dll" File "bin\release\libgcc_s_dw2-1.dll" File "bin\release\QtCore4.dll" File "bin\release\QtGui4.dll" File "bin\release\QtXml4.dll" ;Store uninstall information in Add/Remove Programs WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SigViewer" "DisplayName" "SigViewer" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SigViewer" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SigViewer" "DisplayVersion" "${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SigViewer" "Publisher" "Graz University of Technology" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SigViewer" "DisplayIcon" "$\"$INSTDIR\sigviewer.exe$\"" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SigViewer" "EstimatedSize" "15000" ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" SectionEnd Section "Start Menu Entries" SecSMEntries SetShellVarContext all CreateDirectory $SMPROGRAMS\SigViewer CreateShortCut "$SMPROGRAMS\SigViewer\SigViewer.lnk" "$INSTDIR\sigviewer.exe" "" CreateShortCut "$SMPROGRAMS\SigViewer\Uninstall SigViewer.lnk" "$INSTDIR\Uninstall.exe" SectionEnd ;Descriptions ;Language strings LangString DESC_SecSigViewer ${LANG_ENGLISH} "Installs the program with all required components." LangString DESC_SecSMEntries ${LANG_ENGLISH} "Adds shortcuts to the start menu." ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecSigViewer} $(DESC_SecSigViewer) !insertmacro MUI_DESCRIPTION_TEXT ${SecSMEntries} $(DESC_SecSMEntries) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;Uninstaller Section Section "Uninstall" SetShellVarContext all ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\sigviewer.exe" Delete "$INSTDIR\mingwm10.dll" Delete "$INSTDIR\libgcc_s_dw2-1.dll" Delete "$INSTDIR\QtCore4.dll" Delete "$INSTDIR\QtGui4.dll" Delete "$INSTDIR\QtXml4.dll" RMDir "$INSTDIR" Delete "$SMPROGRAMS\SigViewer\SigViewer.lnk" Delete "$SMPROGRAMS\SigViewer\Uninstall SigViewer.lnk" RMDir /r $SMPROGRAMS\SigViewer DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SigViewer" SectionEnd sigviewer-0.5.1+svn556/sigviewer.pro000066400000000000000000000000351154433734200173150ustar00rootroot00000000000000TEMPLATE=subdirs SUBDIRS=src sigviewer-0.5.1+svn556/src/000077500000000000000000000000001154433734200153605ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/application_context_impl.cpp000066400000000000000000000110441154433734200231540ustar00rootroot00000000000000#include "application_context_impl.h" #include "base/exception.h" #include "gui_impl/main_window_model_impl.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- QSharedPointer ApplicationContextImpl::getInstance (bool cleanup) { static QSharedPointer instance (new ApplicationContextImpl); if (cleanup) instance.clear(); if (instance.isNull ()) { instance = QSharedPointer (new ApplicationContextImpl); qDebug () << "ApplicationContextImpl::getInstance() created new instance = " << instance.data(); } return instance; } //------------------------------------------------------------------------- void ApplicationContextImpl::init (std::set activated_modes) { qDebug () << "ApplicationContextImpl::init() instance = " << getInstance(); getInstance()->activated_modes_ = activated_modes; getInstance()->setState (APP_STATE_NO_FILE_OPEN); if (activated_modes.count (APPLICATION_NON_GUI_MODE) == 0) { getInstance()->color_manager_ = QSharedPointer (new ColorManager); getInstance()->main_window_model_ = QSharedPointer (new MainWindowModelImpl (getInstance())); } } //------------------------------------------------------------------------- void ApplicationContextImpl::cleanup () { qDebug () << "ApplicationContextImpl::cleanup()"; getInstance (true); } //----------------------------------------------------------------------------- ApplicationContextImpl::~ApplicationContextImpl () { qDebug () << "deleting ApplicationContextImpl"; } //------------------------------------------------------------------------- bool ApplicationContextImpl::modeActivated (ApplicationMode mode) const { return activated_modes_.count (mode) > 0; } //------------------------------------------------------------------------- QSharedPointer ApplicationContextImpl::getCurrentFileContext () { return current_file_context_; } //------------------------------------------------------------------------- void ApplicationContextImpl::setCurrentTabContext (QSharedPointer tab_context) { if (!current_tab_context_.isNull()) current_tab_context_->disconnect (this); current_tab_context_ = tab_context; if (!connect (current_tab_context_.data(), SIGNAL(selectionStateChanged(TabSelectionState)), SIGNAL(currentTabSelectionStateChanged(TabSelectionState)))) throw (Exception ("ApplicationContext::setCurrentTabContext failed to connect to selectionStateChanged")); if (!connect (current_tab_context_.data(), SIGNAL(editStateChanged(TabEditState)), SIGNAL(currentTabEditStateChanged(TabEditState)))) throw (Exception ("ApplicationContext::setCurrentTabContext failed to connect to editStateChanged")); } //------------------------------------------------------------------------- QSharedPointer ApplicationContextImpl::getCurrentCommandExecuter () { return current_tab_context_; } //------------------------------------------------------------------------- void ApplicationContextImpl::addFileContext (QSharedPointerfile_context) { current_file_context_ = file_context; if (!connect (current_file_context_.data(), SIGNAL(stateChanged(FileState)), SIGNAL(currentFileStateChanged(FileState)))) throw (Exception ("ApplicationContext::addFileContext faild to connect stateChanged(FileState)")); setState (APP_STATE_FILE_OPEN); } //------------------------------------------------------------------------- void ApplicationContextImpl::removeCurrentFileContext () { if (!current_file_context_.isNull()) current_file_context_->disconnect (); current_file_context_ = QSharedPointer (0); setState (APP_STATE_NO_FILE_OPEN); } //----------------------------------------------------------------------------- QSharedPointer ApplicationContextImpl::getMainWindowModel () { return main_window_model_; } //------------------------------------------------------------------------- QSharedPointer ApplicationContextImpl::getEventColorManager () { return color_manager_; } //----------------------------------------------------------------------------- void ApplicationContextImpl::setState (ApplicationState state) { qDebug () << "ApplicationContextImpl::setState " << state << "; this = " << this; state_ = state; emit stateChanged (state_); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/application_context_impl.h000066400000000000000000000057551154433734200226350ustar00rootroot00000000000000#ifndef APPLICATION_CONTEXT_IMPL_H #define APPLICATION_CONTEXT_IMPL_H #include "base/application_states.h" #include "gui/color_manager.h" #include "gui/main_window_model.h" #include "gui/application_context.h" #include "file_context.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// ApplicationContext /// /// exists once in an application class ApplicationContextImpl : public QObject, public ApplicationContext { Q_OBJECT public: //------------------------------------------------------------------------- static QSharedPointer getInstance (bool cleanup = false); //------------------------------------------------------------------------- static void init (std::set activated_modes); //------------------------------------------------------------------------- static void cleanup (); //------------------------------------------------------------------------- ApplicationContextImpl () {} virtual ~ApplicationContextImpl (); //------------------------------------------------------------------------- virtual bool modeActivated (ApplicationMode mode) const; //------------------------------------------------------------------------- virtual QSharedPointer getCurrentFileContext (); //------------------------------------------------------------------------- virtual void setCurrentTabContext (QSharedPointer tab_context); //------------------------------------------------------------------------- virtual QSharedPointer getCurrentCommandExecuter (); //------------------------------------------------------------------------- /// NO MULTI-FILE SUPPORT IMPLEMENTED YET!!! /// THIS CALL WILL REPLACE ACTUAL FILE CONTEXT virtual void addFileContext (QSharedPointer file_context); //------------------------------------------------------------------------- virtual void removeCurrentFileContext (); //------------------------------------------------------------------------- virtual QSharedPointer getMainWindowModel (); //------------------------------------------------------------------------- virtual QSharedPointer getEventColorManager (); signals: void stateChanged (ApplicationState state); void currentFileStateChanged (FileState state); void currentTabSelectionStateChanged (TabSelectionState state); void currentTabEditStateChanged (TabEditState state); private: void setState (ApplicationState state); std::set activated_modes_; QSharedPointer color_manager_; QSharedPointer main_window_model_; QSharedPointer current_file_context_; QSharedPointer current_tab_context_; ApplicationState state_; }; } // namespace SigViewer_ #endif // APPLICATION_CONTEXT_IMPL_H sigviewer-0.5.1+svn556/src/base/000077500000000000000000000000001154433734200162725ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/base/application_states.h000066400000000000000000000003051154433734200223270ustar00rootroot00000000000000#ifndef APPLICATION_STATES_H #define APPLICATION_STATES_H namespace SigViewer_ { enum ApplicationState { APP_STATE_NO_FILE_OPEN, APP_STATE_FILE_OPEN }; } #endif // APPLICATION_STATES_H sigviewer-0.5.1+svn556/src/base/base.pri000066400000000000000000000007241154433734200177230ustar00rootroot00000000000000HEADERS += base/application_states.h \ base/data_block.h \ base/exception.h \ base/file_states.h \ base/math_utils.h \ base/signal_channel.h \ base/signal_event.h \ base/tab_states.h \ base/sigviewer_user_types.h \ #base/filter.h \ base/fixed_data_block.h SOURCES += base/data_block.cpp \ base/exception.cpp \ base/math_utils.cpp \ base/signal_channel.cpp \ base/signal_event.cpp \ base/fixed_data_block.cpp sigviewer-0.5.1+svn556/src/base/data_block.cpp000066400000000000000000000041751154433734200210700ustar00rootroot00000000000000#include "data_block.h" #include "signal_processing/FFTReal.h" #include #include #include namespace SigViewer_ { unsigned DataBlock::instance_count_ = 0; //----------------------------------------------------------------------------- DataBlock::DataBlock (unsigned length, float32 sample_rate_per_unit) : length_ (length), sample_rate_per_unit_ (sample_rate_per_unit) { instance_count_++; } //----------------------------------------------------------------------------- DataBlock::DataBlock (DataBlock const& src, unsigned new_length) : length_ (new_length), sample_rate_per_unit_ (src.sample_rate_per_unit_), label_ (src.label_) { } //------------------------------------------------------------------------- DataBlock::~DataBlock () { instance_count_--; // qDebug () << "DataBlock::instance_count_ = " << instance_count_ << " deleting"; } //----------------------------------------------------------------------------- uint32 DataBlock::size () const { return length_; } //------------------------------------------------------------------------- std::string DataBlock::getLabel () const { return label_; } //------------------------------------------------------------------------- void DataBlock::setLabel (std::string const &label) { label_ = label; } //------------------------------------------------------------------------- void DataBlock::setXUnitLabel (std::string const &unit_label) { x_unit_label_ = unit_label; } //------------------------------------------------------------------------- std::string DataBlock::getXUnitLabel () const { return x_unit_label_; } //------------------------------------------------------------------------- void DataBlock::setYUnitLabel (std::string const &unit_label) { y_unit_label_ = unit_label; } //------------------------------------------------------------------------- std::string DataBlock::getYUnitLabel () const { return y_unit_label_; } //------------------------------------------------------------------------- float32 DataBlock::getSampleRatePerUnit () const { return sample_rate_per_unit_; } } sigviewer-0.5.1+svn556/src/base/data_block.h000066400000000000000000000047701154433734200205360ustar00rootroot00000000000000#ifndef DATA_BLOCK_H #define DATA_BLOCK_H #include "sigviewer_user_types.h" #include #include #include #include #include namespace SigViewer_ { //------------------------------------------------------------------------- /// DataBlock /// /// basic class to store channel data and sections of it class DataBlock { public: //------------------------------------------------------------------------- virtual ~DataBlock (); //------------------------------------------------------------------------- virtual QSharedPointer createSubBlock (uint32 start, uint32 length) const = 0; //------------------------------------------------------------------------- virtual float32 const& operator[] (uint32 index) const = 0; //------------------------------------------------------------------------- virtual float32 getMin () const = 0; //------------------------------------------------------------------------- virtual float32 getMax () const = 0; //------------------------------------------------------------------------- /// length of the block uint32 size () const; //------------------------------------------------------------------------- std::string getLabel () const; //------------------------------------------------------------------------- void setLabel (std::string const &label); //------------------------------------------------------------------------- /// sets the x-unit label (e.g. "hz" or "s") void setXUnitLabel (std::string const &unit_label); //------------------------------------------------------------------------- std::string getXUnitLabel () const; //------------------------------------------------------------------------- /// sets the y-unit label (e.g. "hz" or "s") void setYUnitLabel (std::string const &unit_label); //------------------------------------------------------------------------- std::string getYUnitLabel () const; //------------------------------------------------------------------------- float32 getSampleRatePerUnit () const; protected: // protected constructors here: DataBlock (unsigned length, float32 sample_rate_per_unit); DataBlock (DataBlock const& src, unsigned new_length); private: uint32 length_; float32 sample_rate_per_unit_; std::string label_; std::string x_unit_label_; std::string y_unit_label_; static unsigned instance_count_; }; } #endif // DATA_BLOCK_H sigviewer-0.5.1+svn556/src/base/exception.cpp000066400000000000000000000006141154433734200207750ustar00rootroot00000000000000#include "exception.h" namespace SigViewer_ { //----------------------------------------------------------------------------- Exception::Exception (std::string const& what) throw () : what_ (what) { // nothing to do here } //----------------------------------------------------------------------------- const char* Exception::what() const throw() { return what_.c_str (); } } sigviewer-0.5.1+svn556/src/base/exception.h000066400000000000000000000005371154433734200204460ustar00rootroot00000000000000#ifndef EXCEPTION_H #define EXCEPTION_H #include #include namespace SigViewer_ { class Exception : public std::exception { public: Exception (std::string const& what) throw (); virtual ~Exception () throw () {} virtual const char* what() const throw(); private: std::string what_; }; } #endif // EXCEPTION_H sigviewer-0.5.1+svn556/src/base/file_states.h000066400000000000000000000002131154433734200207410ustar00rootroot00000000000000#ifndef FILE_STATES_H #define FILE_STATES_H enum FileState { FILE_STATE_UNCHANGED, FILE_STATE_CHANGED }; #endif // FILE_STATES_H sigviewer-0.5.1+svn556/src/base/fixed_data_block.cpp000066400000000000000000000165261154433734200222520ustar00rootroot00000000000000#include "fixed_data_block.h" #include "signal_processing/FFTReal.h" #include #include namespace SigViewer_ { //------------------------------------------------------------------------------------------------- FixedDataBlock::FixedDataBlock (QSharedPointer > data, float32 sample_rate_per_unit) : DataBlock (data->size(), sample_rate_per_unit), data_ (data), start_index_ (0) { // nothing to do here } //--------------------------------------------------------------------------------------------- FixedDataBlock::FixedDataBlock (FixedDataBlock const& base, unsigned new_start, unsigned new_length) : DataBlock (base, new_length), data_ (base.data_), start_index_ (new_start) { // nothing to do here } //------------------------------------------------------------------------- QSharedPointer FixedDataBlock::createSubBlock (uint32 start, uint32 length) const { return QSharedPointer (new FixedDataBlock (*this, start, length)); } //------------------------------------------------------------------------------------------------- float32 const& FixedDataBlock::operator[] (uint32 index) const { return data_->at(start_index_ + index); } //------------------------------------------------------------------------------------------------- float32 FixedDataBlock::getMin () const { QVector::const_iterator start = data_->begin() + start_index_; QVector::const_iterator end = data_->begin() + start_index_ + size (); QVector::const_iterator min_element = std::min_element (start, end); if (min_element != end) return *min_element; else return 0; } //------------------------------------------------------------------------------------------------- float32 FixedDataBlock::getMax () const { QVector::const_iterator start = data_->begin() + start_index_; QVector::const_iterator end = data_->begin() + start_index_ + size (); QVector::const_iterator max_element = std::max_element (start, end); if (max_element != end) return *max_element; else return 0; } //----------------------------------------------------------------------------- QSharedPointer FixedDataBlock::createPowerSpectrum (QSharedPointer data_block) { unsigned num_samples = data_block->size(); unsigned fft_samples = 1; while (fft_samples < num_samples) fft_samples *= 2; FFTReal::flt_t* in = new FFTReal::flt_t [fft_samples]; FFTReal::flt_t* out = new FFTReal::flt_t [fft_samples]; double factor = 0; for (unsigned x = 0; x < fft_samples; x++) { if (((x < ((fft_samples - num_samples)) / 2) || (x > (fft_samples - (((fft_samples - num_samples) / 2)))))) in[x] = 0; else { if (x * 2 < fft_samples) factor += (2.0 / num_samples); else factor -= (2.0 / num_samples); in[x] = (*data_block)[x-((fft_samples - num_samples) / 2)] * factor; } } FFTReal fft_object (fft_samples); fft_object.do_fft(out, in); fft_object.rescale (out); QSharedPointer > spectrum_data (new QVector); for (unsigned index = 0; index < (fft_samples / 2) ; index++) { spectrum_data->push_back (log10(pow(out[index], 2) + pow(out[(fft_samples/2)+index], 2))); } delete[] in; delete[] out; return QSharedPointer (new FixedDataBlock (spectrum_data, static_cast(fft_samples) / data_block->getSampleRatePerUnit())); /* double* data_in = new double[num_samples * 2]; for (unsigned x = 0; x < num_samples; x++) data_in[x] = data_->at(start_index_ + x); unsigned out_length = (num_samples / 2); Complex* data_out = fftwpp::FFTWComplex(out_length * 4); fftwpp::rcfft1d forward (num_samples, data_in, data_out); forward.fft0Normalized (data_in, data_out); QSharedPointer > spectrum_data (new std::vector); for (unsigned index = 1; index < out_length + 1; index++) { spectrum_data->push_back (log10(pow(data_out[index].real(),2) + pow(data_out[index].imag(), 2))); } return QSharedPointer (new DataBlock (spectrum_data, static_cast(num_samples) / sample_rate_per_unit_));*/ } //----------------------------------------------------------------------------- QSharedPointer FixedDataBlock::calculateMean (std::list > const &data_blocks) { if (data_blocks.size() == 0) return QSharedPointer (0); std::list >::const_iterator it = data_blocks.begin(); QSharedPointer > mean (new QVector); float32 sample_rate = (*it)->getSampleRatePerUnit (); float32 tmp_mean = 0; for (unsigned index = 0; index < (*(data_blocks.begin()))->size(); index++) { it = data_blocks.begin(); tmp_mean = 0; while (it != data_blocks.end()) { tmp_mean += (**it)[index]; ++it; } mean->push_back(tmp_mean / data_blocks.size()); } return QSharedPointer (new FixedDataBlock (mean, sample_rate)); } //------------------------------------------------------------------------- QSharedPointer FixedDataBlock::calculateStandardDeviation (std::list > const &data_blocks) { return calculateStandardDeviationImpl (data_blocks, calculateMean(data_blocks)); } //------------------------------------------------------------------------- QSharedPointer FixedDataBlock::calculateStandardDeviation (std::list > const &data_blocks, QSharedPointer means) { return calculateStandardDeviationImpl (data_blocks, means); } //------------------------------------------------------------------------- QSharedPointer FixedDataBlock::calculateStandardDeviationImpl (std::list > const & data_blocks, QSharedPointer means) { QSharedPointer > stddev (new QVector); if (data_blocks.size() == 0) return QSharedPointer(0); std::list >::const_iterator it = data_blocks.begin(); float32 sample_rate = (*it)->getSampleRatePerUnit (); float32 tmp_stddev = 0; for (unsigned index = 0; index < (*(data_blocks.begin()))->size(); index++) { it = data_blocks.begin(); tmp_stddev = 0; float32 mean = (*means)[index]; while (it != data_blocks.end()) { tmp_stddev += pow(((**it)[index] - mean), 2); ++it; } stddev->push_back(sqrt(tmp_stddev / (data_blocks.size()))); } QSharedPointer stddev_block (new FixedDataBlock (stddev, sample_rate)); return stddev_block; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/base/fixed_data_block.h000066400000000000000000000060761154433734200217160ustar00rootroot00000000000000#ifndef FIXED_DATA_BLOCK_H #define FIXED_DATA_BLOCK_H #include "data_block.h" #include #include #include #include namespace SigViewer_ { //------------------------------------------------------------------------- /// FixedDataBlock /// /// basic class to store data class FixedDataBlock : public DataBlock { public: //------------------------------------------------------------------------- /// @param sample_rate_per_unit as a data_block must not represent data which /// is associated to time, the sample_rate is given /// in "per unit" (e.g. "s" or "hz", etc.) FixedDataBlock (QSharedPointer > data, float32 sample_rate_per_unit); //------------------------------------------------------------------------- virtual ~FixedDataBlock () {} //------------------------------------------------------------------------- virtual QSharedPointer createSubBlock (uint32 start, uint32 length) const; //------------------------------------------------------------------------- virtual float32 const& operator[] (uint32 index) const; //------------------------------------------------------------------------- virtual float32 getMin () const; //------------------------------------------------------------------------- virtual float32 getMax () const; //--------------------------------------------------------------------------------------------- static QSharedPointer createPowerSpectrum (QSharedPointer data_block); //--------------------------------------------------------------------------------------------- static QSharedPointer calculateMean (std::list > const &data_blocks); //--------------------------------------------------------------------------------------------- static QSharedPointer calculateStandardDeviation (std::list > const &data_blocks); //--------------------------------------------------------------------------------------------- static QSharedPointer calculateStandardDeviation (std::list > const &data_blocks, QSharedPointer means); private: Q_DISABLE_COPY (FixedDataBlock); //--------------------------------------------------------------------------------------------- FixedDataBlock (FixedDataBlock const& base, unsigned new_start, unsigned new_length); //--------------------------------------------------------------------------------------------- static QSharedPointer calculateStandardDeviationImpl (std::list > const &data_blocks, QSharedPointer means); QSharedPointer > data_; unsigned start_index_; static unsigned instance_count_; }; } #endif // FIXED_DATA_BLOCK_H sigviewer-0.5.1+svn556/src/base/math_utils.cpp000066400000000000000000000034061154433734200211520ustar00rootroot00000000000000/* $Id: math_utils.cpp,v 1.2 2009-01-20 10:00:35 schloegl Exp $ Copyright (C) Thomas Brunner 2005,2006 Clemens Brunner 2005 Alois Schloegl 2009 This file is part of the "SigViewer" repository at http://biosig.sf.net/ SigViewer 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 3 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, see . */ // math_utils.cpp #include "math_utils.h" #include #include namespace SigViewer_ { namespace MathUtils_ { //----------------------------------------------------------------------------- float64 round125(float64 value) { float64 sign = value < 0 ? -1 : 1; value = value * sign; float64 tmp = pow (10.0, floor (log10(value))); if (tmp < value) tmp *= 2.0; if (tmp < value) tmp *= 1.5; if (tmp < value) tmp *= (4.0 / 3.0); if (tmp < value) tmp *= (5.0 / 4.0); if (tmp < value) tmp *= (7.5 / 5.0); return sign * tmp; } //----------------------------------------------------------------------------- int sampleRateToDecimalPrecision (float sample_rate) { int precision = 0; for (; sample_rate > 10; sample_rate /= 10) precision++; return precision; } } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/base/math_utils.h000066400000000000000000000025041154433734200206150ustar00rootroot00000000000000/* $Id: math_utils.h,v 1.3 2009-01-20 10:00:35 schloegl Exp $ Copyright (C) Thomas Brunner 2005,2006 Clemens Brunner 2005 Alois Schloegl 2009 This file is part of the "SigViewer" repository at http://biosig.sf.net/ SigViewer 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 3 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, see . */ // math_utils.h #ifndef MATH_UTILS_H #define MATH_UTILS_H #include "sigviewer_user_types.h" namespace SigViewer_ { namespace MathUtils_ { // round to 1, 2 or 5 float64 round125(float64 value); //----------------------------------------------------------------------------- /// @return number of decimals needed to display time intervals correctly int sampleRateToDecimalPrecision (float sample_rate); } } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/base/signal_channel.cpp000066400000000000000000000076751154433734200217620ustar00rootroot00000000000000/* $Id: signal_channel.cpp,v 1.11 2009-03-10 09:46:31 schloegl Exp $ Copyright (C) Thomas Brunner 2006,2007 Copyright (C) Christoph Eibel 2007,2008, Copyright (C) Clemens Brunner 2006,2007,2008 Copyright (C) Alois Schloegl 2008,2009 This file is part of the "SigViewer" repository at http://biosig.sf.net/ 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 3 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, see . */ // signal_channel.cpp #include "signal_channel.h" namespace SigViewer_ { //----------------------------------------------------------------------------- SignalChannel::SignalChannel (unsigned number, QString const& label, QString const& phys_y_dimension_label) : number_ (number), label_ (label), phys_y_dimension_label_ (phys_y_dimension_label) { } //----------------------------------------------------------------------------- uint32 SignalChannel::getNumber() const { return number_; } //----------------------------------------------------------------------------- const QString& SignalChannel::getLabel() const { return label_; } //----------------------------------------------------------------------------- float64 SignalChannel::getLowpass() const { return lowpass_; } //----------------------------------------------------------------------------- float64 SignalChannel::getHighpass() const { return highpass_; } //----------------------------------------------------------------------------- bool SignalChannel::getNotch() const { return notch_; } //----------------------------------------------------------------------------- const QString& SignalChannel::getPhysicalDim() const { return phys_y_dimension_label_; } //----------------------------------------------------------------------------- float64 SignalChannel::getPhysicalMaximum() const { return physical_maximum_; } //----------------------------------------------------------------------------- float64 SignalChannel::getDigitalMaximum() const { return digital_maximum_; } //----------------------------------------------------------------------------- float64 SignalChannel::getPhysicalMinimum() const { return physical_minimum_; } //----------------------------------------------------------------------------- float64 SignalChannel::getDigitalMinimum() const { return digital_minimum_; } //----------------------------------------------------------------------------- QString SignalChannel::typeString() const { if (data_type_ > UBITN) { return QString("ubit%1").arg(data_type_ - UBITN); } if (data_type_ > BITN) { return QString("bit%1").arg(data_type_ - BITN); } switch (data_type_) { case CHAR: return "char"; case INT8: return "int8"; case UINT8: return "uint8"; case INT16: return "int16"; case UINT16: return "uint16"; case INT32: return "int32"; case UINT32: return "uint32"; case INT64: return "int64"; case UINT64: return "uint64"; case FLOAT32: return "float32"; case FLOAT64: return "float64"; case FLOAT128: return "float128"; default: return "?"; } return "?"; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/base/signal_channel.h000066400000000000000000000054011154433734200214100ustar00rootroot00000000000000/* $Id: signal_channel.h,v 1.10 2009-03-10 09:38:23 schloegl Exp $ Copyright (C) Thomas Brunner 2006,2007 Copyright (C) Christoph Eibel 2007,2008, Copyright (C) Clemens Brunner 2006,2007,2008 Copyright (C) Alois Schloegl 2008,2009 This file is part of the "SigViewer" repository at http://biosig.sf.net/ 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 3 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, see . */ // signal_channel.h #ifndef SIGNAL_CHANNEL_H #define SIGNAL_CHANNEL_H #include "sigviewer_user_types.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// @class SignalChannel /// @brief data about a signal channel class SignalChannel { public: //------------------------------------------------------------------------- SignalChannel (unsigned number, QString const& label, QString const& phys_y_dimension_label = ""); //------------------------------------------------------------------------- QString typeString() const; uint32 getNumber() const; const QString& getLabel() const; float64 getLowpass() const; float64 getHighpass() const; bool getNotch() const; const QString& getPhysicalDim() const; float64 getPhysicalMaximum() const; float64 getDigitalMaximum() const; float64 getPhysicalMinimum() const; float64 getDigitalMinimum() const; private: // from GDF format enum Type { CHAR = 0, INT8 = 1, UINT8 = 2, INT16 = 3, UINT16 = 4, INT32 = 5, UINT32 = 6, INT64 = 7, UINT64 = 8, FLOAT32 = 16, FLOAT64 = 17, FLOAT128 = 18, // add N to code BITN = 255, UBITN = 511 }; mutable QMutex mutex_; uint32 number_; QString label_; QString phys_y_dimension_label_; uint16 physical_dimcode_; float64 physical_maximum_; float64 digital_maximum_; float64 physical_minimum_; float64 digital_minimum_; uint16_t data_type_; float64 lowpass_; float64 highpass_; bool notch_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/base/signal_event.cpp000066400000000000000000000065431154433734200214640ustar00rootroot00000000000000// signal_event.cpp #include "signal_event.h" namespace SigViewer_ { // constructor SignalEvent::SignalEvent() : id_(UNDEFINED_EVENT_ID), position_(0xFFFFFFFF), sample_rate_ (1), type_(0xFFFF), channel_(UNDEFINED_CHANNEL), duration_(UNDEFINED_DURATION) { // nothing } // constructor SignalEvent::SignalEvent(uint32 position, EventType type, float64 sample_rate, ChannelID channel, uint32 duration, int32 id) : id_(id), position_(position), sample_rate_ (sample_rate), type_(type), channel_(channel), duration_(duration) { // nothing } // constructor SignalEvent::SignalEvent(const SignalEvent& src, int32 id) : id_(id), position_(src.position_), sample_rate_ (src.sample_rate_), type_(src.type_), channel_(src.channel_), duration_(src.duration_) { // nothing } // copy-constructor SignalEvent::SignalEvent(const SignalEvent& src) : id_(src.id_), position_(src.position_), sample_rate_ (src.sample_rate_), type_(src.type_), channel_(src.channel_), duration_(src.duration_) { // nothing } SignalEvent& SignalEvent::operator= (const SignalEvent& src) { id_ = src.id_; position_ = src.position_; sample_rate_ = src.sample_rate_; type_ = src.type_; channel_ = src.channel_; duration_ = src.duration_; return *this; } // get id int32 SignalEvent::getId() const { return id_; } // get position uint32 SignalEvent::getPosition() const { return position_; } //----------------------------------------------------------------------------- float32 SignalEvent::getPositionInSec() const { return static_cast(position_) / sample_rate_; } // get type uint16 SignalEvent::getType() const { return type_; } // get channel ChannelID SignalEvent::getChannel() const { return channel_; } // get duration uint32 SignalEvent::getDuration() const { return duration_; } //----------------------------------------------------------------------------- float32 SignalEvent::getDurationInSec() const { return static_cast(duration_) / sample_rate_; } //----------------------------------------------------------------------------- float32 SignalEvent::getEndInSec () const { return (static_cast(duration_ + position_)) / sample_rate_; } //----------------------------------------------------------------------------- float64 SignalEvent::getSampleRate () const { return sample_rate_; } //----------------------------------------------------------------------------- void SignalEvent::setId (EventID id) { id_ = id; } // set position void SignalEvent::setPosition(uint32 position) { position_ = position; } // set type void SignalEvent::setType(EventType type) { type_ = type; } // set channel void SignalEvent::setChannel(ChannelID channel) { channel_ = channel; } // set duration void SignalEvent::setDuration(uint32 duration) { duration_ = duration; } //----------------------------------------------------------------------------- bool SignalEvent::equals (SignalEvent const& event) const { if (duration_ != event.duration_) return false; if (type_ != event.type_) return false; if (position_ != event.position_) return false; if (sample_rate_ != event.sample_rate_) return false; if (channel_ != event.channel_) return false; return true; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/base/signal_event.h000066400000000000000000000024301154433734200211200ustar00rootroot00000000000000// signal_event.h #ifndef SIGNAL_EVENT_H #define SIGNAL_EVENT_H #include "sigviewer_user_types.h" namespace SigViewer_ { // SignalEvent class SignalEvent { public: SignalEvent(); SignalEvent(uint32 position, EventType type, float64 sample_rate, ChannelID channel = UNDEFINED_CHANNEL, uint32 duration = 0, EventID id = UNDEFINED_EVENT_ID); SignalEvent(const SignalEvent& src, int32 id); SignalEvent(const SignalEvent& src); SignalEvent& operator= (const SignalEvent& src); int32 getId() const; uint32 getPosition() const; float32 getPositionInSec() const; uint16 getType() const; ChannelID getChannel() const; uint32 getDuration() const; float32 getDurationInSec() const; float32 getEndInSec () const; float64 getSampleRate () const; void setId (EventID id); void setPosition(uint32 position); void setType(EventType type); void setChannel(ChannelID channel); void setDuration(uint32 duration); bool equals (SignalEvent const& event) const; private: static const int32 UNDEFINED_DURATION = 0; EventID id_; uint32 position_; float64 sample_rate_; EventType type_; ChannelID channel_; uint32 duration_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/base/sigviewer_user_types.h000066400000000000000000000036171154433734200227400ustar00rootroot00000000000000/* $Id: user_types.h,v 1.3 2009-02-10 13:19:57 schloegl Exp $ Copyright (C) Thomas Brunner 2005,2006 Clemens Brunner 2006 Alois Schloegl 2009 This file is part of the "SigViewer" repository at http://biosig.sf.net/ 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 3 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, see . */ // sigviewer_user_types.h #ifndef SIGVIEWER_USER_TYPES_H #define SIGVIEWER_USER_TYPES_H namespace SigViewer_ { enum ScaleMode { MAX_TO_MAX, MIN_TO_MAX }; // standard types // compiler specific types #ifdef _MSC_VER typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #endif } #ifdef __GNUG__ #include #endif namespace SigViewer_ { typedef int8_t int8; typedef uint8_t uint8; typedef int16_t int16; typedef uint16_t uint16; typedef int32_t int32; typedef uint32_t uint32; typedef float float32; typedef double float64; typedef int64_t int64; typedef uint64_t uint64; typedef int32 EventID; typedef uint16 EventType; typedef int ChannelID; const ChannelID UNDEFINED_CHANNEL = -1; const EventID UNDEFINED_EVENT_ID = -1; const EventType UNDEFINED_EVENT_TYPE = -1; } #endif // SIGVIEWER_USER_TYPES_H sigviewer-0.5.1+svn556/src/base/tab_states.h000066400000000000000000000006731154433734200206020ustar00rootroot00000000000000#ifndef TAB_STATES_H #define TAB_STATES_H namespace SigViewer_ { enum TabSelectionState { NO_TAB_SELECTION_STATE, TAB_STATE_NO_EVENT_SELECTED, TAB_STATE_EVENT_SELECTED_ONE_CHANNEL, TAB_STATE_EVENT_SELECTED_ALL_CHANNELS }; enum TabEditState { NO_TAB_EDIT_STATE, TAB_STATE_NO_REDO, TAB_STATE_NO_UNDO, TAB_STATE_NO_REDO_NO_UNDO, TAB_STATE_CAN_REDO_UNDO }; } // namespace SigViewer_ #endif // TAB_STATES_H sigviewer-0.5.1+svn556/src/color_settings.xml000066400000000000000000000011361154433734200211410ustar00rootroot00000000000000 sigviewer-0.5.1+svn556/src/command_executer.h000066400000000000000000000005101154433734200210470ustar00rootroot00000000000000#ifndef COMMAND_EXECUTER_H #define COMMAND_EXECUTER_H #include namespace SigViewer_ { class CommandExecuter { public: virtual ~CommandExecuter () {} virtual void executeCommand (QUndoCommand* command) = 0; virtual void undo () = 0; virtual void redo () = 0; }; } #endif // COMMAND_EXECUTER_H sigviewer-0.5.1+svn556/src/commands/000077500000000000000000000000001154433734200171615ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/commands/commands.pri000066400000000000000000000002551154433734200215000ustar00rootroot00000000000000HEADERS += \ commands/convert_file_command.h \ commands/open_file_command.h SOURCES += \ commands/convert_file_command.cpp \ commands/open_file_command.cpp sigviewer-0.5.1+svn556/src/commands/convert_file_command.cpp000066400000000000000000000022411154433734200240410ustar00rootroot00000000000000#include "convert_file_command.h" #include "open_file_command.h" #include "file_handling/file_signal_writer_factory.h" #include "gui/progress_bar.h" namespace SigViewer_ { //----------------------------------------------------------------------------- QString ConvertFileCommand::execute () { if (destination_file_path_.size() == 0) return "Error: no output-file defined"; OpenFileCommand open_file_command (application_context_, source_file_path_); QString open_error = open_file_command.execute (); if (open_error.size ()) return open_error; QSharedPointer writer (FileSignalWriterFactory::getInstance()->getHandler (destination_file_path_)); ProgressBar::instance().initAndShow (application_context_->getCurrentFileContext()->getChannelManager().getNumberSamples() + application_context_->getCurrentFileContext()->getEventManager()->getNumberOfEvents(), "Converting", application_context_); QString result = writer->save (application_context_->getCurrentFileContext()); ProgressBar::instance().close (); return result; } } sigviewer-0.5.1+svn556/src/commands/convert_file_command.h000066400000000000000000000013501154433734200235060ustar00rootroot00000000000000#ifndef CONVERT_FILE_COMMAND_H #define CONVERT_FILE_COMMAND_H #include "gui/application_context.h" #include namespace SigViewer_ { class ConvertFileCommand { public: ConvertFileCommand (QSharedPointer application_context, QString const& source_file_path, QString const& destination_file_path) : application_context_ (application_context), source_file_path_ (source_file_path), destination_file_path_ (destination_file_path) {} QString execute (); private: QSharedPointer application_context_; QString source_file_path_; QString destination_file_path_; }; } #endif // CONVERT_FILE_COMMAND_H sigviewer-0.5.1+svn556/src/commands/open_file_command.cpp000066400000000000000000000022051154433734200233220ustar00rootroot00000000000000#include "open_file_command.h" #include "file_handling/file_signal_reader_factory.h" #include "file_handling/channel_manager.h" #include "file_handling_impl/channel_manager_impl.h" #include "file_handling_impl/event_manager_impl.h" #include "file_context.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString OpenFileCommand::execute () { QString file_path = QDir::toNativeSeparators (filename_and_path_); FileSignalReader* file_signal_reader (FileSignalReaderFactory::getInstance()->getHandler (file_path)); if (file_signal_reader == 0) return QString ("Can't open file ") + file_path; ChannelManager* channel_manager (new ChannelManagerImpl (file_signal_reader)); QSharedPointer event_manager (new EventManagerImpl (*file_signal_reader)); QSharedPointer file_context (new FileContext (file_path, event_manager, channel_manager, file_signal_reader->getBasicHeader())); application_context_->addFileContext (file_context); return ""; } } sigviewer-0.5.1+svn556/src/commands/open_file_command.h000066400000000000000000000012621154433734200227710ustar00rootroot00000000000000#ifndef OPEN_FILE_COMMAND_H #define OPEN_FILE_COMMAND_H #include "gui/application_context.h" #include namespace SigViewer_ { class OpenFileCommand { public: OpenFileCommand (QSharedPointer application_context, QString const& filename_and_path) : application_context_ (application_context), filename_and_path_ (filename_and_path), non_gui_mode_ (true) {} QString execute (); private: void openFileInNonGuiMode (); QSharedPointer application_context_; QString filename_and_path_; bool instantly_; bool non_gui_mode_; }; } #endif // OPEN_FILE_COMMAND_H sigviewer-0.5.1+svn556/src/editing_commands/000077500000000000000000000000001154433734200206645ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/editing_commands/change_channel_undo_command.cpp000066400000000000000000000026451154433734200270370ustar00rootroot00000000000000#include "change_channel_undo_command.h" #include "file_handling/event_manager.h" namespace SigViewer_ { //----------------------------------------------------------------------------- ChangeChannelUndoCommand::ChangeChannelUndoCommand (QSharedPointer event_manager, EventID event_id, ChannelID new_channel) : event_manager_ (event_manager), event_id_ (event_id), new_channel_ (new_channel) { // nothing to do here } //----------------------------------------------------------------------------- ChangeChannelUndoCommand::~ChangeChannelUndoCommand () { // nothing to do here } //----------------------------------------------------------------------------- void ChangeChannelUndoCommand::undo () { QSharedPointer signal_event_ = event_manager_->getAndLockEventForEditing (event_id_); signal_event_->setChannel (old_channel_); event_manager_->updateAndUnlockEvent (signal_event_->getId()); } //----------------------------------------------------------------------------- void ChangeChannelUndoCommand::redo () { QSharedPointer signal_event_ = event_manager_->getAndLockEventForEditing (event_id_); old_channel_ = signal_event_->getChannel(); signal_event_->setChannel (new_channel_); event_manager_->updateAndUnlockEvent (signal_event_->getId()); } } sigviewer-0.5.1+svn556/src/editing_commands/change_channel_undo_command.h000066400000000000000000000027361154433734200265050ustar00rootroot00000000000000#ifndef CHANGE_CHANNEL_UNDO_COMMAND_H #define CHANGE_CHANNEL_UNDO_COMMAND_H #include "base/signal_event.h" #include "file_handling/event_manager.h" #include #include namespace SigViewer_ { class ChangeChannelUndoCommand : public QUndoCommand { public: //------------------------------------------------------------------------- ChangeChannelUndoCommand (QSharedPointer event_manager, EventID event_id, ChannelID new_channel); //------------------------------------------------------------------------- virtual ~ChangeChannelUndoCommand(); //------------------------------------------------------------------------- /// recreates the deleted event virtual void undo (); //------------------------------------------------------------------------- /// deletes the event virtual void redo (); private: //------------------------------------------------------------------------- /// copy-constructor disabled ChangeChannelUndoCommand (ChangeChannelUndoCommand const &); //------------------------------------------------------------------------- /// assignment-operator disabled ChangeChannelUndoCommand& operator= (ChangeChannelUndoCommand const &); QSharedPointer event_manager_; EventID event_id_; ChannelID new_channel_; ChannelID old_channel_; }; } #endif // CHANGE_CHANNEL_UNDO_COMMAND_H sigviewer-0.5.1+svn556/src/editing_commands/change_type_undo_command.cpp000066400000000000000000000023441154433734200264040ustar00rootroot00000000000000#include "change_type_undo_command.h" #include "file_handling/event_manager.h" namespace SigViewer_ { //----------------------------------------------------------------------------- ChangeTypeUndoCommand::ChangeTypeUndoCommand (QSharedPointer event_manager, EventID event_id, EventType new_type) : event_id_ (event_id), event_manager_ (event_manager), new_type_ (new_type) { // nothing to do here } //----------------------------------------------------------------------------- ChangeTypeUndoCommand::~ChangeTypeUndoCommand () { // nothing to do here } //----------------------------------------------------------------------------- void ChangeTypeUndoCommand::undo () { signal_event_->setType(old_type_); event_manager_->updateAndUnlockEvent (signal_event_->getId()); } //----------------------------------------------------------------------------- void ChangeTypeUndoCommand::redo () { signal_event_ = event_manager_->getAndLockEventForEditing (event_id_); old_type_ = signal_event_->getType(); signal_event_->setType(new_type_); event_manager_->updateAndUnlockEvent (signal_event_->getId()); } } sigviewer-0.5.1+svn556/src/editing_commands/change_type_undo_command.h000066400000000000000000000027621154433734200260550ustar00rootroot00000000000000#ifndef CHANGE_TYPE_UNDO_COMMAND_H #define CHANGE_TYPE_UNDO_COMMAND_H #include "base/signal_event.h" #include "file_handling/event_manager.h" #include #include #include namespace SigViewer_ { class ChangeTypeUndoCommand : public QUndoCommand { public: //------------------------------------------------------------------------- ChangeTypeUndoCommand (QSharedPointer event_manager, EventID event_id, EventType new_type); //------------------------------------------------------------------------- virtual ~ChangeTypeUndoCommand(); //------------------------------------------------------------------------- /// recreates the deleted event virtual void undo (); //------------------------------------------------------------------------- /// deletes the event virtual void redo (); private: //------------------------------------------------------------------------- /// copy-constructor disabled ChangeTypeUndoCommand (ChangeTypeUndoCommand const &); //------------------------------------------------------------------------- /// assignment-operator disabled ChangeTypeUndoCommand& operator= (ChangeTypeUndoCommand const &); EventID event_id_; QSharedPointer event_manager_; EventType new_type_; EventType old_type_; QSharedPointer signal_event_; }; } #endif // CHANGE_TYPE_UNDO_COMMAND_H sigviewer-0.5.1+svn556/src/editing_commands/delete_event_undo_command.cpp000066400000000000000000000022361154433734200265610ustar00rootroot00000000000000#include "delete_event_undo_command.h" #include "file_handling/event_manager.h" namespace SigViewer_ { //----------------------------------------------------------------------------- DeleteEventUndoCommand::DeleteEventUndoCommand (QSharedPointer event_manager, EventID event_id) : event_manager_ (event_manager), deleted_event_ (event_manager->getEvent (event_id)) { // nothing to do here } //----------------------------------------------------------------------------- DeleteEventUndoCommand::~DeleteEventUndoCommand () { // nothing to do here } //----------------------------------------------------------------------------- void DeleteEventUndoCommand::undo () { event_manager_->createEvent ( deleted_event_->getChannel (), deleted_event_->getPosition (), deleted_event_->getDuration (), deleted_event_->getType (), deleted_event_->getId ()); } //----------------------------------------------------------------------------- void DeleteEventUndoCommand::redo () { event_manager_->removeEvent (deleted_event_->getId ()); } } sigviewer-0.5.1+svn556/src/editing_commands/delete_event_undo_command.h000066400000000000000000000026731154433734200262330ustar00rootroot00000000000000#ifndef DELETE_EVENT_UNDO_COMMAND_H #define DELETE_EVENT_UNDO_COMMAND_H #include "base/signal_event.h" #include "file_handling/event_manager.h" #include #include namespace SigViewer_ { class DeleteEventUndoCommand : public QUndoCommand { public: //------------------------------------------------------------------------- /// constructor DeleteEventUndoCommand (QSharedPointer event_manager, EventID event_id); //------------------------------------------------------------------------- /// destructor virtual ~DeleteEventUndoCommand (); //------------------------------------------------------------------------- /// recreates the deleted event virtual void undo (); //------------------------------------------------------------------------- /// deletes the event virtual void redo (); private: QSharedPointer event_manager_; EventID event_id_; QSharedPointer deleted_event_; //------------------------------------------------------------------------- /// copy-constructor disabled DeleteEventUndoCommand (DeleteEventUndoCommand const &); //------------------------------------------------------------------------- /// assignment-operator disabled DeleteEventUndoCommand& operator= (DeleteEventUndoCommand const &); }; } #endif // DELETE_EVENT_UNDO_COMMAND_H sigviewer-0.5.1+svn556/src/editing_commands/editing_commands.pri000066400000000000000000000011501154433734200247010ustar00rootroot00000000000000HEADERS += editing_commands/change_channel_undo_command.h \ editing_commands/change_type_undo_command.h \ editing_commands/delete_event_undo_command.h \ editing_commands/macro_undo_command.h \ editing_commands/new_event_undo_command.h \ editing_commands/resize_event_undo_command.h SOURCES += editing_commands/change_channel_undo_command.cpp \ editing_commands/change_type_undo_command.cpp \ editing_commands/delete_event_undo_command.cpp \ editing_commands/macro_undo_command.cpp \ editing_commands/new_event_undo_command.cpp \ editing_commands/resize_event_undo_command.cpp sigviewer-0.5.1+svn556/src/editing_commands/macro_undo_command.cpp000066400000000000000000000013461154433734200252200ustar00rootroot00000000000000#include "macro_undo_command.h" namespace SigViewer_ { //----------------------------------------------------------------------------- MacroUndoCommand::MacroUndoCommand (QList > const& commands) : commands_ (commands) { // nothing to do here } //----------------------------------------------------------------------------- void MacroUndoCommand::undo () { for (int index = commands_.length () - 1; index > -1; index--) commands_[index]->undo (); } //----------------------------------------------------------------------------- void MacroUndoCommand::redo () { for (int index = 0; index < commands_.length (); index++) commands_[index]->redo (); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/editing_commands/macro_undo_command.h000066400000000000000000000023021154433734200246560ustar00rootroot00000000000000#ifndef MACRO_UNDO_COMMAND_H #define MACRO_UNDO_COMMAND_H #include #include namespace SigViewer_ { class MacroUndoCommand : public QUndoCommand { public: //------------------------------------------------------------------------- /// constructor MacroUndoCommand (QList > const& commands); //------------------------------------------------------------------------- /// destructor virtual ~MacroUndoCommand () {} //------------------------------------------------------------------------- /// undos the all commands virtual void undo (); //------------------------------------------------------------------------- /// executes the macro virtual void redo (); private: QList > commands_; //------------------------------------------------------------------------- /// copy-constructor disabled MacroUndoCommand (MacroUndoCommand const &); //------------------------------------------------------------------------- /// assignment-operator disabled MacroUndoCommand& operator= (MacroUndoCommand const &); }; } #endif // MACRO_UNDO_COMMAND_H sigviewer-0.5.1+svn556/src/editing_commands/new_event_undo_command.cpp000066400000000000000000000027561154433734200261170ustar00rootroot00000000000000#include "new_event_undo_command.h" namespace SigViewer_ { //----------------------------------------------------------------------------- NewEventUndoCommand::NewEventUndoCommand (QSharedPointer event_manager, QSharedPointer signal_event, float scene_to_signal_factor) : event_manager_ (event_manager), raw_signal_event_ (new SignalEvent (*signal_event)) { raw_signal_event_->setPosition (scene_to_signal_factor * raw_signal_event_->getPosition()); raw_signal_event_->setDuration (scene_to_signal_factor * raw_signal_event_->getDuration()); } //----------------------------------------------------------------------------- NewEventUndoCommand::~NewEventUndoCommand () { // nothing to do here } //----------------------------------------------------------------------------- void NewEventUndoCommand::undo () { event_manager_->removeEvent (created_signal_event_->getId ()); } //----------------------------------------------------------------------------- void NewEventUndoCommand::redo () { EventID id = UNDEFINED_EVENT_ID; if (!created_signal_event_.isNull()) id = created_signal_event_->getId (); created_signal_event_ = event_manager_->createEvent ( raw_signal_event_->getChannel(), raw_signal_event_->getPosition(), raw_signal_event_->getDuration(), raw_signal_event_->getType(), id); } } sigviewer-0.5.1+svn556/src/editing_commands/new_event_undo_command.h000066400000000000000000000032251154433734200255540ustar00rootroot00000000000000#ifndef NEW_EVENT_UNDO_COMMAND_H #define NEW_EVENT_UNDO_COMMAND_H #include "base/signal_event.h" #include "file_handling/event_manager.h" #include #include namespace SigViewer_ { class NewEventUndoCommand : public QUndoCommand { public: //------------------------------------------------------------------------- NewEventUndoCommand (QSharedPointer event_manager, QSharedPointer signal_event, float scene_to_signal_factor = 1); //------------------------------------------------------------------------- virtual ~NewEventUndoCommand (); //------------------------------------------------------------------------- /// recreates the deleted event virtual void undo (); //------------------------------------------------------------------------- /// deletes the event virtual void redo (); //------------------------------------------------------------------------- EventID getIDOfNewlyCreatedEvent () const {return created_signal_event_->getId();} private: QSharedPointer event_manager_; QSharedPointer raw_signal_event_; QSharedPointer created_signal_event_; //------------------------------------------------------------------------- /// copy-constructor disabled NewEventUndoCommand (NewEventUndoCommand const &); //------------------------------------------------------------------------- /// assignment-operator disabled NewEventUndoCommand& operator= (NewEventUndoCommand const &); }; } #endif // NEW_EVENT_UNDO_COMMAND_H sigviewer-0.5.1+svn556/src/editing_commands/resize_event_undo_command.cpp000066400000000000000000000026611154433734200266220ustar00rootroot00000000000000#include "resize_event_undo_command.h" #include "file_handling/event_manager.h" namespace SigViewer_ { //----------------------------------------------------------------------------- ResizeEventUndoCommand::ResizeEventUndoCommand (QSharedPointer event_manager, EventID id, uint32 new_start_position, uint32 new_duration) : event_manager_ (event_manager), event_id_ (id), new_start_position_ (new_start_position), new_duration_ (new_duration) { // nothing to do here } //----------------------------------------------------------------------------- void ResizeEventUndoCommand::undo () { QSharedPointer event = event_manager_->getAndLockEventForEditing (event_id_); event->setDuration (old_duration_); event->setPosition (old_start_position_); event_manager_->updateAndUnlockEvent (event->getId()); } //----------------------------------------------------------------------------- void ResizeEventUndoCommand::redo () { QSharedPointer event = event_manager_->getAndLockEventForEditing (event_id_); old_duration_ = event->getDuration(); old_start_position_ = event->getPosition(); event->setDuration (new_duration_); event->setPosition (new_start_position_); event_manager_->updateAndUnlockEvent (event->getId()); } } sigviewer-0.5.1+svn556/src/editing_commands/resize_event_undo_command.h000066400000000000000000000023111154433734200262570ustar00rootroot00000000000000#ifndef RESIZE_EVENT_UNDO_COMMAND_H #define RESIZE_EVENT_UNDO_COMMAND_H #include "base/signal_event.h" #include "file_handling/event_manager.h" #include #include namespace SigViewer_ { class ResizeEventUndoCommand : public QUndoCommand { public: //------------------------------------------------------------------------- /// constructor ResizeEventUndoCommand (QSharedPointer event_manager, EventID id, uint32 new_start_position, uint32 new_duration); //------------------------------------------------------------------------- /// destructor virtual ~ResizeEventUndoCommand () {} //------------------------------------------------------------------------- /// undos the resizing virtual void undo (); //------------------------------------------------------------------------- /// resizes the event virtual void redo (); private: QSharedPointer event_manager_; EventID event_id_; uint32 new_start_position_; uint32 new_duration_; uint32 old_start_position_; uint32 old_duration_; }; } #endif // RESIZE_EVENT_UNDO_COMMAND_H sigviewer-0.5.1+svn556/src/eventcodes.txt000066400000000000000000000127201154433734200202620ustar00rootroot00000000000000### Table of event codes. # This file is part of the biosig project http://biosig.sf.net/ # Copyright (C) 2004,2005,2006 Alois Schloegl # $Id: eventcodes.txt,v 1.4 2008-04-27 10:03:09 cle1109 Exp $ # ### table of event codes: lines starting with # are omitted ### add 0x8000 to indicate end of event # ### 0x010_ EEG artifacts 0x0101 artifact:EOG (blinks, fast, large amplitude) 0x0102 artifact:ECG 0x0103 artifact:EMG/Muscle 0x0104 artifact:Movement 0x0105 artifact:Failing Electrode 0x0106 artifact:Sweat 0x0107 artifact:50/60 Hz mains interference 0x0108 artifact:breathing 0x0109 artifact:pulse 0x010a artifact:EOG (slow, small amplitudes) #0x010f calibration ### 0x011_ EEG patterns 0x0111 eeg:Sleep spindles 0x0112 eeg:K-complexes 0x0113 eeg:Saw-tooth waves 0x0114 eeg:Idling EEG - eyes open 0x0115 eeg:Idling EEG - eyes closed 0x0116 eeg:spike 0x0117 eeg:seizure #0x0118 eeg:Electrographic seizure #0x0119 eeg:Clinical seizure #0x011a eeg:Subclinical seizure #0x011b eeg:Stimulating for seizure ### 0x012_ Stimulus for Evoked potentials 0x0121 VEP: visual EP 0x0122 AEP: auditory EP 0x0123 SEP: somato-sensory EP 0x012F TMS: transcranial magnetic stimulation ### 0x013_ Stimulus for Steady State Evoked potentials 0x0131 SSVEP 0x0132 SSAEP 0x0133 SSSEP ### 0x014_ Response 0x0144 Go 0x0145 NoGo ### 0x03__ BCI: Trigger, cues, classlabels, 0x0300 Start of Trial, Trigger at t=0s 0x0301 Left - cue onset (BCI experiment) 0x0302 Right - cue onset (BCI experiment) 0x0303 Foot - cue onset (BCI experiment) 0x0304 Tongue - cue onset (BCI experiment) 0x0305 class5 - cue onset 0x0306 Down - cue onset (BCI experiment) 0x0307 class7 - cue onset 0x0308 class8 - cue onset 0x0309 class9 - cue onset 0x030A class10 - cue onset 0x030B class11 - cue onset 0x030C Up - cue onset (BCI experiment) 0x030D Feedback (continuous) - onset (BCI experiment) 0x030E Feedback (discrete) - onset (BCI experiment) 0x030F cue unknown/undefined (used for BCI competition) 0x0311 Beep (accustic stimulus, BCI experiment) 0x0312 Cross on screen (BCI experiment) 0x0313 Flashing light #0x031b - 0x037f reserved for ASCII characters #27-#127 0x0381 target hit, task successful, correct classification 0x0382 target missed, task not reached, incorrect classification 0x03ff Rejection of whole trial ### 0x040_ Respiratory Events 0x0401 Obstructive Apnea/Hypopnea Event (OAHE) 0x0402 Respiratory Effort Related Arousal (RERA) 0x0403 Central Apnea/Hypopnea Event (CAHE) 0x0404 Cheyne-Stokes Breathing (CSB) 0x0405 Sleep Hypoventilation 0x040e (time of) maximum inspiration 0x040f Start of inspiration, (end of expiration) ### 0x041_ Sleep stages according to Rechtschaffen&Kales 0x0410 Wake 0x0411 Stage 1 0x0412 Stage 2 0x0413 Stage 3 0x0414 Stage 4 0x0415 REM ### 0x042_ Sleep 0x0420 Lights on #0x8420 Lights off ### 0x043_ Eye movements 0x0430 Eye activity 0x0431 Eyes left 0x0432 Eyes right 0x0433 Eyes up 0x0434 Eyes down 0x0435 Horizontal eye movement 0x0436 Vertical eye movement 0x0437 Eye rotation (clockwise) 0x0438 Eye rotation (counterclockwise) 0x0439 Eye blinks #0x043f [obsolete] merged with 0x0114 ### 0x044_ muscle activity (for checking on EEG artifacts) 0x0441 left hand movement 0x0442 right hand movement 0x0443 head movement 0x0444 tongue movement 0x0445 swallowing 0x0446 biting, chewing, teeth griding 0x0447 foot movement %0x0448 foot (right) movement 0x0449 arm movement 0x044a arm (right) movement ### 0x050_ ECG events 0x0501 ecg:Fiducial point of QRS complex 0x0502 ecg:P-wave 0x0503 ecg:QRS-complex 0x0504 ecg:R-point 0x0506 ecg:T-wave 0x0507 ecg:U-wave # related but non-concordant defintions can be found in # - WFDB/MIT-BIH http://www.physionet.org/physiotools/wfdb/lib/ecgcodes.h # - SCP-ECG http://www.centc251.org/TCmeet/doclist/TCdoc02/N02-015-prEN1064.pdf # - FEF/Vital/11073 p.83 # Unification is desired # ### 0x058_ ergometric events 0x0580 start 0x0581 25 Watt 0x0582 50 Watt 0x0583 75 Watt 0x0584 100 Watt 0x0585 125 Watt 0x0586 150 Watt 0x0587 175 Watt 0x0588 200 Watt 0x0589 225 Watt 0x058a 250 Watt 0x058b 275 Watt 0x058c 300 Watt 0x058d 325 Watt 0x058e 350 Watt #0x8580 end ### 0x00__ user specific events # the use of these types is discouraged, because of ambigous definitions. 0x0001 condition 1 0x0002 condition 2 0x0003 condition 3 0x0004 condition 4 0x0005 condition 5 0x0006 condition 6 0x0007 condition 7 0x0008 condition 8 0x0009 condition 9 0x000a condition 10 0x000b condition 11 0x000c condition 12 0x000d condition 13 0x000e condition 14 0x000f condition 15 0x0010 condition 16 0x0011 condition 17 0x0012 condition 18 0x0013 condition 19 0x0014 condition 20 0x0015 condition 21 0x0016 condition 22 0x0017 condition 23 0x0018 condition 24 0x0019 condition 25 0x001a condition 26 0x0020 condition 32 # 0x002f condition 47 0x0030 condition 48 0x0031 condition 49 0x0032 condition 50 0x0033 condition 51 0x0034 condition 52 0x0035 condition 53 0x0036 condition 54 0x0037 condition 55 0x0038 condition 56 0x0039 condition 57 0x003a condition 58 0x003b condition 59 0x003c condition 60 0x003d condition 61 0x003e condition 62 0x003f condition 63 0x0040 condition 64 0x0041 condition 65 0x0042 condition 66 0x0046 condition 70 0x0051 condition 81 0x0052 condition 82 0x0053 condition 83 0x005b condition 91 0x005c condition 92 0x005d condition 93 0x0060 condition 96 0x0063 condition 99 0x0080 condition 128 0x00a6 condition 166 0x00a7 condition 167 0x00a8 condition 168 0x00a9 condition 169 ### 0x7f__ special codes 0x7ffe start of a new segment (after a break) 0x7fff non-equidistant sampling value # sigviewer-0.5.1+svn556/src/file_context.cpp000066400000000000000000000065731154433734200205620ustar00rootroot00000000000000#include "file_context.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- FileContext::FileContext (QString const& file_path_and_name, QSharedPointer event_manager, ChannelManager* channel_manager, QSharedPointer header) : state_ (FILE_STATE_UNCHANGED), file_path_and_name_ (file_path_and_name), event_manager_ (event_manager), channel_manager_ (channel_manager), basic_header_ (header) { connect (event_manager_.data(), SIGNAL(changed()), SLOT(setAsChanged())); } //----------------------------------------------------------------------------- FileContext::~FileContext () { qDebug () << "deleting FileContext"; delete channel_manager_; } //------------------------------------------------------------------------- void FileContext::resetFilePathAndName (QString const& new_file_path_and_name) { file_path_and_name_ = new_file_path_and_name; emit fileNameChanged (file_path_and_name_.section (QDir::separator(), -1)); } //------------------------------------------------------------------------- QString FileContext::getFilePath () const { QString file_name = getFileName (); return file_path_and_name_.left (file_path_and_name_.length() - file_name.length()); } //----------------------------------------------------------------------------- QString const& FileContext::getFilePathAndName () const { return file_path_and_name_; } //----------------------------------------------------------------------------- QString FileContext::getFileName () const { return file_path_and_name_.section (QDir::separator(), -1); } //------------------------------------------------------------------------- QSharedPointer FileContext::getMainVisualisationModel () { return main_signal_vis_model_; } //------------------------------------------------------------------------- void FileContext::setMainVisualisationModel (QSharedPointer signal_vis_model) { main_signal_vis_model_ = signal_vis_model; } //----------------------------------------------------------------------------- QSharedPointer FileContext::getEventManager () const { return event_manager_; } //----------------------------------------------------------------------------- QSharedPointer FileContext::getEventManager () { return event_manager_; } //----------------------------------------------------------------------------- ChannelManager const& FileContext::getChannelManager () const { return *channel_manager_; } //----------------------------------------------------------------------------- ChannelManager& FileContext::getChannelManager () { return *channel_manager_; } //------------------------------------------------------------------------- FileState FileContext::getState () const { return state_; } //----------------------------------------------------------------------------- void FileContext::setState (FileState state) { state_ = state; emit stateChanged (state_); } //----------------------------------------------------------------------------- void FileContext::setAsChanged () { state_ = FILE_STATE_CHANGED; emit stateChanged (state_); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_context.h000066400000000000000000000073441154433734200202240ustar00rootroot00000000000000#ifndef FILE_CONTEXT_H #define FILE_CONTEXT_H #include "file_handling/event_manager.h" #include "file_handling/basic_header.h" #include "file_handling/channel_manager.h" #include "gui/signal_visualisation_model.h" #include "base/file_states.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// /// FileContext /// /// exists once per opened file... /// class FileContext : public QObject { Q_OBJECT public: //------------------------------------------------------------------------- /// /// @param channel_manager the FileContext takes ownership of the given /// ChannelManager and destroys it if the FileContext /// is deleted FileContext (QString const & file_path_and_name, QSharedPointer event_manager, ChannelManager* channel_manager, QSharedPointer header); //------------------------------------------------------------------------- ~FileContext (); //------------------------------------------------------------------------- void resetFilePathAndName (QString const& new_file_path_and_name); //------------------------------------------------------------------------- QString getFilePath () const; //------------------------------------------------------------------------- QString const& getFilePathAndName () const; //------------------------------------------------------------------------- QString getFileName () const; //------------------------------------------------------------------------- QSharedPointer getMainVisualisationModel (); //------------------------------------------------------------------------- void setMainVisualisationModel (QSharedPointer signal_vis_model); //------------------------------------------------------------------------- QSharedPointer getEventManager () const; //------------------------------------------------------------------------- QSharedPointer getEventManager (); //------------------------------------------------------------------------- ChannelManager const & getChannelManager () const; //------------------------------------------------------------------------- ChannelManager& getChannelManager (); //------------------------------------------------------------------------- QSharedPointer getHeader () {return basic_header_;} //------------------------------------------------------------------------- FileState getState () const; signals: //------------------------------------------------------------------------- void stateChanged (FileState state); //------------------------------------------------------------------------- void fileNameChanged (QString const& file_path_and_name); public slots: //------------------------------------------------------------------------- void setState (FileState state); //------------------------------------------------------------------------- void setAsChanged (); private: //------------------------------------------------------------------------- // disabled FileContext (FileContext const&); FileContext& operator= (FileContext const&); FileState state_; QString file_path_and_name_; QSharedPointer event_manager_; ChannelManager* channel_manager_; QSharedPointer basic_header_; QSharedPointer main_signal_vis_model_; }; } // namespace SigViewer_ #endif // FILE_CONTEXT_H sigviewer-0.5.1+svn556/src/file_handling/000077500000000000000000000000001154433734200201435ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/file_handling/basic_header.cpp000066400000000000000000000035231154433734200232430ustar00rootroot00000000000000// basic_header.cpp #include "basic_header.h" namespace SigViewer_ { //----------------------------------------------------------------------------- QString BasicHeader::getFileTypeString () const { return file_type_string_; } //----------------------------------------------------------------------------- float32 BasicHeader::getSampleRate () const { return sample_rate_; } //----------------------------------------------------------------------------- uint32 BasicHeader::getNumberEvents() const { return number_events_; } void BasicHeader::setNumberEvents (uint32 number_events) { number_events_ = number_events; } // get event samplerate double BasicHeader::getEventSamplerate() const { return sample_rate_; } void BasicHeader::setEventSamplerate (double event_sample_rate) { event_sample_rate_ = event_sample_rate; } //------------------------------------------------------------------------- QSharedPointer BasicHeader::getChannel (ChannelID id) const { if (channels_.contains(id)) return channels_[id]; return QSharedPointer (0); } //------------------------------------------------------------------------- unsigned BasicHeader::getNumberChannels() const { return channels_.size(); } //------------------------------------------------------------------------- void BasicHeader::setFileTypeString (QString const& file_type_string) { file_type_string_ = file_type_string; } //------------------------------------------------------------------------- void BasicHeader::setSampleRate (float sample_rate) { sample_rate_ = sample_rate; } //------------------------------------------------------------------------- void BasicHeader::addChannel (ChannelID id, QSharedPointer channel) { channels_[id] = channel; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_handling/basic_header.h000066400000000000000000000066651154433734200227220ustar00rootroot00000000000000// basic_header.h #ifndef BASIC_HEADER_H #define BASIC_HEADER_H #include "base/signal_channel.h" #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// @class BasicHeader (common for all file formats) /// @brief base class for any biosignal file header class BasicHeader { public: //------------------------------------------------------------------------- virtual ~BasicHeader() {} //------------------------------------------------------------------------- QString getFileTypeString () const; //------------------------------------------------------------------------- QString getFilePath () const {return file_path_;} //------------------------------------------------------------------------- virtual QMap getPatientInfo () const {return patient_info_;} //------------------------------------------------------------------------- /// may include recording time, triggered, etc. virtual QMap getRecordingInfo () const {return recording_info_;} //------------------------------------------------------------------------- float getSampleRate () const; //------------------------------------------------------------------------- QSharedPointer getChannel (ChannelID id) const; //------------------------------------------------------------------------- unsigned getNumberChannels() const; //------------------------------------------------------------------------- virtual uint32 getNumberOfSamples () const = 0; //------------------------------------------------------------------------- virtual QMap getNamesOfUserSpecificEvents () const {return QMap();} uint32 getNumberEvents() const; void setNumberEvents (uint32 number_events); double getEventSamplerate() const; void setEventSamplerate (double event_sample_rate); protected: //------------------------------------------------------------------------- BasicHeader (QString const& file_path) : file_path_ (file_path) {} // events uint32 number_events_; double event_sample_rate_; //------------------------------------------------------------------------- /// optional void setFileTypeString (QString const& file_type_string); //------------------------------------------------------------------------- /// required void setSampleRate (float sample_rate); //------------------------------------------------------------------------- /// required void addChannel (ChannelID id, QSharedPointer channel); //------------------------------------------------------------------------- /// optional void addRecordingInfo (QString const& info_label, QString const& value) {recording_info_[info_label] = value;} //------------------------------------------------------------------------- /// optional void addPatientInfo (QString const& info_label, QString const& value) {patient_info_[info_label] = value;} private: QString const file_path_; QString file_type_string_; float sample_rate_; QMap > channels_; QMap recording_info_; QMap patient_info_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling/channel_manager.cpp000066400000000000000000000070521154433734200237550ustar00rootroot00000000000000#include "channel_manager.h" #include "gui/progress_bar.h" #include namespace SigViewer_ { //------------------------------------------------------------------------- void ChannelManager::addDownsampledMinMaxVersion (ChannelID id, QSharedPointer min, QSharedPointer max, unsigned factor) { downsampled_max_map_[id][factor] = max; downsampled_min_map_[id][factor] = min; } //------------------------------------------------------------------------- unsigned ChannelManager::getNearestDownsamplingFactor (ChannelID id, unsigned factor) const { if (!downsampled_min_map_.contains (id)) return 0; unsigned nearest_factor = 1; bool search = true; for (nearest_factor = factor + 1; search && (nearest_factor > 1); --nearest_factor) if (downsampled_min_map_[id].contains (nearest_factor - 1)) search = false; return nearest_factor; } //------------------------------------------------------------------------- QSharedPointer ChannelManager::getDownsampledMin (ChannelID id, unsigned factor) const { return downsampled_min_map_[id][factor]; } //------------------------------------------------------------------------- QSharedPointer ChannelManager::getDownsampledMax (ChannelID id, unsigned factor) const { return downsampled_max_map_[id][factor]; } //------------------------------------------------------------------------- float64 ChannelManager::getValueRange (std::set const& channels) const { return getMaxValue (channels) - getMinValue (channels); } //------------------------------------------------------------------------- float64 ChannelManager::getMinValue (std::set const& channels) const { if (!min_max_initialized_) initMinMax(); float64 min = std::numeric_limits::max(); foreach (ChannelID channel, channels) min = std::min (min, min_values_[channel]); return min; } //------------------------------------------------------------------------- float64 ChannelManager::getMaxValue (std::set const& channels) const { if (!min_max_initialized_) initMinMax(); float64 max = std::numeric_limits::min(); foreach (ChannelID channel, channels) max = std::max (max, max_values_[channel]); return max; } //------------------------------------------------------------------------- float64 ChannelManager::getMinValue (ChannelID channel_id) const { if (!min_max_initialized_) initMinMax(); if (min_values_.count (channel_id)) return min_values_[channel_id]; else return std::numeric_limits::min(); } //------------------------------------------------------------------------- float64 ChannelManager::getMaxValue (ChannelID channel_id) const { if (!min_max_initialized_) initMinMax(); if (max_values_.count (channel_id)) return max_values_[channel_id]; else return std::numeric_limits::max(); } //------------------------------------------------------------------------- void ChannelManager::initMinMax () const { if (min_max_initialized_) return; foreach (ChannelID id, getChannels()) { QSharedPointer data = getData (id, 0, getNumberSamples ()); max_values_[id] = data->getMax (); min_values_[id] = data->getMin (); ProgressBar::instance().increaseValue (1, QObject::tr("Searching for Min-Max")); } min_max_initialized_ = true; } } sigviewer-0.5.1+svn556/src/file_handling/channel_manager.h000066400000000000000000000105541154433734200234230ustar00rootroot00000000000000#ifndef CHANNEL_MANAGER_INTERFACE_H #define CHANNEL_MANAGER_INTERFACE_H #include "base/sigviewer_user_types.h" #include "base/data_block.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// ChannelManager /// /// abstract base class for any channel handling class ChannelManager { public: //------------------------------------------------------------------------- /// destructor virtual ~ChannelManager () {} //------------------------------------------------------------------------- virtual std::set getChannels () const = 0; //------------------------------------------------------------------------- virtual uint32 getNumberChannels () const = 0; //------------------------------------------------------------------------- virtual QString getChannelLabel (ChannelID id) const = 0; //------------------------------------------------------------------------- virtual QString getChannelYUnitString (ChannelID id) const = 0; //------------------------------------------------------------------------- /// @param channel_id the id of the channel /// @param start_pos starting sample /// @param length length given in samples virtual QSharedPointer getData (ChannelID id, unsigned start_pos, unsigned length) const = 0; //------------------------------------------------------------------------- virtual float32 getDurationInSec () const = 0; //------------------------------------------------------------------------- virtual uint32 getNumberSamples () const = 0; //------------------------------------------------------------------------- virtual float32 getSampleRate () const = 0; //------------------------------------------------------------------------- void addDownsampledMinMaxVersion (ChannelID id, QSharedPointer min, QSharedPointer max, unsigned factor); //------------------------------------------------------------------------- unsigned getNearestDownsamplingFactor (ChannelID id, unsigned factor) const; //------------------------------------------------------------------------- QSharedPointer getDownsampledMin (ChannelID id, unsigned factor) const; //------------------------------------------------------------------------- QSharedPointer getDownsampledMax (ChannelID id, unsigned factor) const; //------------------------------------------------------------------------- float64 getValueRange (std::set const& channels) const; //------------------------------------------------------------------------- float64 getMinValue (std::set const& channels) const; //------------------------------------------------------------------------- float64 getMaxValue (std::set const& channels) const; //------------------------------------------------------------------------- float64 getMinValue (ChannelID channel_id) const; //------------------------------------------------------------------------- float64 getMaxValue (ChannelID channel_id) const; //------------------------------------------------------------------------- void setXAxisUnitLabel (QString const& label) {x_axis_unit_label_ = label;} //------------------------------------------------------------------------- QString getXAxisUnitLabel () const {return x_axis_unit_label_;} protected: ChannelManager () : min_max_initialized_ (false) {} private: //------------------------------------------------------------------------- void initMinMax () const; mutable bool min_max_initialized_; mutable std::map max_values_; mutable std::map min_values_; QString x_axis_unit_label_; QMap > > downsampled_max_map_; // [channel][factor] -> maximum downsampled_data QMap > > downsampled_min_map_; // [channel][factor] -> minimum downsampled_data }; } // namespace SigViewer_ #endif // CHANNEL_MANAGER_INTERFACE_H sigviewer-0.5.1+svn556/src/file_handling/event_manager.h000066400000000000000000000102661154433734200231340ustar00rootroot00000000000000#ifndef EVENT_MANAGER_H #define EVENT_MANAGER_H #include "base/sigviewer_user_types.h" #include "base/signal_event.h" #include #include #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// EventManager /// /// interface (abstract base class) for the the central /// access point for any event manipulation class EventManager : public QObject { Q_OBJECT public: //------------------------------------------------------------------------- /// virtual destructor virtual ~EventManager () {} //------------------------------------------------------------------------- virtual QSharedPointer getEvent (EventID id) const = 0; //------------------------------------------------------------------------- /// returns the event for editing and locks the event virtual QSharedPointer getAndLockEventForEditing (EventID id) = 0; //------------------------------------------------------------------------- /// changes the type of the event of the given type /// and emits the signal eventChanged (id) virtual void updateAndUnlockEvent (EventID id) = 0; //------------------------------------------------------------------------- /// /// @return const pointer to the newly created event virtual QSharedPointer createEvent (ChannelID channel_id, unsigned pos, unsigned length, EventType type, EventID id = UNDEFINED_EVENT_ID) = 0; //------------------------------------------------------------------------- /// removes the event with the given id virtual void removeEvent (EventID id) = 0; //------------------------------------------------------------------------- /// /// @return set of event_id of events at the given position virtual std::set getEventsAt (unsigned pos, ChannelID channel_id) const = 0; //------------------------------------------------------------------------- /// @return sample rate of events virtual double getSampleRate () const = 0; //------------------------------------------------------------------------- virtual unsigned getMaxEventPosition () const = 0; //------------------------------------------------------------------------- /// @return the name of the given event type virtual QString getNameOfEventType (EventType type) const = 0; //------------------------------------------------------------------------- /// @return the name of the given event virtual QString getNameOfEvent (EventID event) const = 0; //------------------------------------------------------------------------- /// @return list of event_id of all events virtual QList getAllEvents () const = 0; //------------------------------------------------------------------------- /// @return amount of events virtual unsigned getNumberOfEvents () const = 0; //------------------------------------------------------------------------- virtual std::set getEventTypes () const {return getEventTypes ("");} //------------------------------------------------------------------------- virtual std::set getEventTypes (QString group_id) const = 0; //------------------------------------------------------------------------- virtual std::set getEventTypeGroupIDs () const = 0; //------------------------------------------------------------------------- /// @return set of event_ids of events of the given type virtual QList getEvents (EventType type) const = 0; //------------------------------------------------------------------------- virtual EventID getNextEventOfSameType (EventID id) const = 0; //------------------------------------------------------------------------- virtual EventID getPreviousEventOfSameType (EventID id) const = 0; signals: void eventChanged (EventID id); void eventCreated (QSharedPointer event); void eventRemoved (EventID id); void changed (); }; } // namespace SigViewer_ #endif // EVENT_MANAGER_INTERFACE_H sigviewer-0.5.1+svn556/src/file_handling/file_handler_factory.h000066400000000000000000000075621154433734200244710ustar00rootroot00000000000000#ifndef FILE_HANDLER_FACTORY_H #define FILE_HANDLER_FACTORY_H #include "base/exception.h" #include #include #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// FileHandlerFactory /// generic file handler factory for storing readers or writers or whatever :) template class FileHandlerFactory { public: //------------------------------------------------------------------------- bool registerHandler (QString const& file_ending, QSharedPointer file_handler); //------------------------------------------------------------------------- void registerDefaultHandler (QSharedPointer file_handler); //------------------------------------------------------------------------- FileHandlerType* getHandler (QString const& file_path); //------------------------------------------------------------------------- QStringList getAllFileEndingsWithWildcards () const; protected : FileHandlerFactory () {} virtual ~FileHandlerFactory () {} private: // not allowed FileHandlerFactory (const FileHandlerFactory& src); const FileHandlerFactory& operator=(const FileHandlerFactory& src); std::map > handler_map_; QSharedPointer default_handler_; QStringList wildcard_file_endings_; }; //------------------------------------------------------------------------- template bool FileHandlerFactory::registerHandler (QString const& file_ending, QSharedPointer file_handler) { if (handler_map_.count (file_ending)) return false; handler_map_[file_ending] = file_handler; qDebug () << "FileHandlerFactory::registerHandler: file_ending = " << file_ending; wildcard_file_endings_ << QString("*.") + file_ending; return true; } //------------------------------------------------------------------------- template void FileHandlerFactory::registerDefaultHandler (QSharedPointer file_handler) { qDebug () << "FileHandlerFactory::registerDefaultHandler"; default_handler_ = file_handler; } //------------------------------------------------------------------------- template FileHandlerType* FileHandlerFactory::getHandler (QString const& file_path) { QString file_ending = file_path.section('.', -1); qDebug () << "FACTORY " << file_ending; if (handler_map_.count(file_ending)) { QPair handler = handler_map_[file_ending]->createInstance (file_path); if (handler.first) return handler.first; else { handler = default_handler_->createInstance (file_path); if (handler.first) return handler.first; else { QMessageBox::information (0, QObject::tr("File Opening"), handler.second); return 0; } } } else if (!default_handler_.isNull()) { QPair handler = default_handler_->createInstance (file_path); if (handler.second.size()) QMessageBox::information (0, QObject::tr("File Opening"), handler.second); return handler.first; } else return 0; } //------------------------------------------------------------------------- template QStringList FileHandlerFactory::getAllFileEndingsWithWildcards () const { return wildcard_file_endings_; } } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling/file_handling.pri000066400000000000000000000010111154433734200234330ustar00rootroot00000000000000HEADERS += file_handling/file_signal_reader.h \ file_handling/file_handler_factory.h \ file_handling/event_manager.h \ file_handling/file_signal_writer.h \ file_handling/file_signal_reader_factory.h \ file_handling/file_signal_writer_factory.h \ file_handling/basic_header.h \ file_handling/channel_manager.h SOURCES += file_handling/file_signal_reader_factory.cpp \ file_handling/file_signal_writer_factory.cpp \ file_handling/basic_header.cpp \ file_handling/channel_manager.cpp sigviewer-0.5.1+svn556/src/file_handling/file_signal_reader.h000066400000000000000000000023271154433734200241160ustar00rootroot00000000000000#ifndef FILE_SIGNAL_READER_H #define FILE_SIGNAL_READER_H #include "basic_header.h" #include "base/signal_event.h" #include "base/data_block.h" #include #include #include #include class QString; namespace SigViewer_ { //----------------------------------------------------------------------------- /// FileSignalReader /// /// abstract base class for reading signals from a file class FileSignalReader { public: typedef QVector SignalEventVector; virtual ~FileSignalReader() {} virtual QPair createInstance (QString const& file_path) = 0; virtual QSharedPointer getSignalData (ChannelID channel_id, unsigned start_sample, unsigned length) const = 0; virtual QList > getEvents () const = 0; virtual QSharedPointer getBasicHeader () = 0; virtual QSharedPointer getBasicHeader () const = 0; protected: FileSignalReader () {} private: Q_DISABLE_COPY(FileSignalReader) }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling/file_signal_reader_factory.cpp000066400000000000000000000006221154433734200261740ustar00rootroot00000000000000#include "file_signal_reader_factory.h" namespace SigViewer_ { //------------------------------------------------------------------------- FileSignalReaderFactory* FileSignalReaderFactory::getInstance () { static std::auto_ptr instance; if (!instance.get()) instance.reset(new FileSignalReaderFactory); return instance.get(); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_handling/file_signal_reader_factory.h000066400000000000000000000010431154433734200256370ustar00rootroot00000000000000// file_signal_reader_factory.h #ifndef FILE_SIGNAL_READER_FACTORY_H #define FILE_SIGNAL_READER_FACTORY_H #include "file_handler_factory.h" #include "file_signal_reader.h" #include #include #include namespace SigViewer_ { //------------------------------------------------------------------------- // file signal reader Factory as singleton class FileSignalReaderFactory : public FileHandlerFactory { public: static FileSignalReaderFactory* getInstance (); }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling/file_signal_writer.h000066400000000000000000000032461154433734200241710ustar00rootroot00000000000000// file_signal_writer.h #ifndef FILE_SIGNAL_WRITER_H #define FILE_SIGNAL_WRITER_H #include "file_signal_reader.h" #include "file_context.h" #include "event_manager.h" #include "channel_manager.h" #include "base/signal_event.h" namespace SigViewer_ { // abstract signal writer class FileSignalWriter { public: virtual ~FileSignalWriter() {} //------------------------------------------------------------------------- virtual QPair createInstance (QString const& file_path) = 0; //------------------------------------------------------------------------- virtual bool supportsSavingEvents () const {return false;} //------------------------------------------------------------------------- virtual QString saveEventsToSignalFile (QSharedPointer, std::set const& types) = 0; //------------------------------------------------------------------------- virtual QString save (QSharedPointer file_context) { QSharedPointer event_manager = file_context->getEventManager(); if (event_manager.isNull()) return save (file_context, std::set ()); else return save (file_context, event_manager->getEventTypes ("")); } //------------------------------------------------------------------------- virtual QString save (QSharedPointer file_context, std::set const& types) = 0; protected: FileSignalWriter () {} private: Q_DISABLE_COPY(FileSignalWriter) }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling/file_signal_writer_factory.cpp000066400000000000000000000005251154433734200262500ustar00rootroot00000000000000#include "file_signal_writer_factory.h" namespace SigViewer_ { // get instance FileSignalWriterFactory* FileSignalWriterFactory::getInstance() { static std::auto_ptr instance; if (!instance.get()) instance.reset(new FileSignalWriterFactory); return instance.get(); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_handling/file_signal_writer_factory.h000066400000000000000000000006641154433734200257210ustar00rootroot00000000000000// file_signal_writer_factory.h #ifndef FILE_SIGNAL_WRITER_FACTORY_H #define FILE_SIGNAL_WRITER_FACTORY_H #include "file_signal_writer.h" #include "file_handler_factory.h" #include namespace SigViewer_ { // file signal reader Factory as singleton class FileSignalWriterFactory : public FileHandlerFactory { public: static FileSignalWriterFactory* getInstance(); }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling_impl/000077500000000000000000000000001154433734200211645ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/file_handling_impl/biosig_basic_header.cpp000066400000000000000000000102321154433734200256130ustar00rootroot00000000000000#include "biosig_basic_header.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- BiosigBasicHeader::BiosigBasicHeader (HDRTYPE* raw_header, QString const& file_path) : BasicHeader (file_path), number_samples_ (raw_header->NRec * raw_header->SPR) { if (raw_header->EVENT.CodeDesc) { for (unsigned index = 0; index < raw_header->EVENT.LenCodeDesc; index++) { if (raw_header->EVENT.CodeDesc[index]) user_defined_event_map_[index+1] = QString(raw_header->EVENT.CodeDesc[index]); } } setFileTypeString (QString (GetFileTypeString(raw_header->TYPE)).append(" v").append(QString::number(raw_header->VERSION))); float sampling_rate = raw_header->SampleRate; setSampleRate (sampling_rate); readChannelsInfo (raw_header); readPatientInfo (raw_header); readRecordingInfo (raw_header); } //----------------------------------------------------------------------------- uint32 BiosigBasicHeader::getNumberOfSamples () const { return ceil(static_cast(number_samples_)); } //----------------------------------------------------------------------------- QMap BiosigBasicHeader::getNamesOfUserSpecificEvents () const { return user_defined_event_map_; } //------------------------------------------------------------------------- void BiosigBasicHeader::readChannelsInfo (HDRTYPE const* raw_header) { for (unsigned channel_index = 0; channel_index < raw_header->NS; channel_index++) { QString label = QString (QByteArray(raw_header->CHANNEL[channel_index].Label, MAX_LENGTH_LABEL)).trimmed(); char p[MAX_LENGTH_PHYSDIM+1]; p[MAX_LENGTH_PHYSDIM] = 0; PhysDim(raw_header->CHANNEL[channel_index].PhysDimCode, p); QString phys_y_dim_label = QString (p).trimmed(); if (phys_y_dim_label.compare("uV") == 0) phys_y_dim_label = QString (QChar((ushort)0xb5)).append("V"); QSharedPointer channel (new SignalChannel(channel_index, label, phys_y_dim_label)); addChannel (channel_index, channel); } } //------------------------------------------------------------------------- void BiosigBasicHeader::readPatientInfo (HDRTYPE const* raw_header) { switch (raw_header->Patient.Handedness) { case 1: addPatientInfo ("Handedness", "Right"); break; case 2: addPatientInfo ("Handedness", "Left"); break; case 3: addPatientInfo ("Handedness", "Equal"); break; } switch (raw_header->Patient.Sex) { case 1: addPatientInfo ("Sex", "Male"); break; case 2: addPatientInfo ("Sex", "Female"); break; } switch (raw_header->Patient.Smoking) { case 1: addPatientInfo ("Smoking", "No"); break; case 2: addPatientInfo ("Smoking", "Yes"); break; } switch (raw_header->Patient.Smoking) { case 1: addPatientInfo ("Smoking", "No"); break; case 2: addPatientInfo ("Smoking", "Yes"); break; } QString patient_id; for (unsigned i = 0; i < MAX_LENGTH_PID && raw_header->Patient.Id[i]; i++) patient_id.append (raw_header->Patient.Id[i]); addPatientInfo ("Id", patient_id.trimmed()); if (raw_header->Patient.Birthday) { time_t birthday_t = mktime(gdf_time2tm_time (raw_header->Patient.Birthday)); addPatientInfo ("Birthday", QString (ctime(&birthday_t)).trimmed()); } if (raw_header->Patient.Weight) addPatientInfo ("Weight", QString::number(raw_header->Patient.Weight).append("kg")); if (raw_header->Patient.Height) addPatientInfo ("Height", QString::number(raw_header->Patient.Height).append("cm")); } //------------------------------------------------------------------------- void BiosigBasicHeader::readRecordingInfo (HDRTYPE const* raw_header) { if (raw_header->T0) { time_t recording_t = mktime(gdf_time2tm_time (raw_header->T0)); addRecordingInfo("Recording Time", QString (ctime(&recording_t)).trimmed()); } } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_handling_impl/biosig_basic_header.h000066400000000000000000000023571154433734200252710ustar00rootroot00000000000000#ifndef BIOSIG_BASIC_HEADER_H #define BIOSIG_BASIC_HEADER_H #include "file_handling/basic_header.h" #include "biosig.h" namespace SigViewer_ { class BiosigBasicHeader : public BasicHeader { public: //------------------------------------------------------------------------- BiosigBasicHeader (HDRTYPE* raw_header, QString const& file_path); //------------------------------------------------------------------------- virtual uint32 getNumberOfSamples () const; //------------------------------------------------------------------------- virtual QMap getNamesOfUserSpecificEvents () const; private: //------------------------------------------------------------------------- void readChannelsInfo (HDRTYPE const* raw_header); //------------------------------------------------------------------------- void readPatientInfo (HDRTYPE const* raw_header); //------------------------------------------------------------------------- void readRecordingInfo (HDRTYPE const* raw_header); unsigned number_samples_; QMap user_defined_event_map_; QMap > channels_; }; } // namespace SigViewer_ #endif // BIOSIG_BASIC_HEADER_H sigviewer-0.5.1+svn556/src/file_handling_impl/biosig_reader.cpp000066400000000000000000000245441154433734200244770ustar00rootroot00000000000000/* $Id: biosig_reader.cpp,v 1.36 2009/03/03 11:57:07 cle1109 Exp $ Copyright (C) Thomas Brunner 2005,2006,2007 Copyright (C) Christoph Eibel 2007,2008 Copyright (C) Clemens Brunner 2006,2007,2008 Copyright (C) Alois Schloegl 2008,2009 Copyright (C) Oliver Terbu 2008 This file is part of the "SigViewer" repository at http://biosig.sf.net/ 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 3 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, see . */ #include "biosig_reader.h" #include "biosig_basic_header.h" #include "file_handler_factory_registrator.h" #include "gui/progress_bar.h" #include "base/fixed_data_block.h" #include "biosig.h" #include #include #include #include #include #include #include #include #include using namespace std; namespace SigViewer_ { //----------------------------------------------------------------------------- FILE_SIGNAL_READER_REGISTRATION(gdf, BioSigReader); FILE_SIGNAL_READER_REGISTRATION(edf, BioSigReader); FILE_SIGNAL_READER_REGISTRATION(bdf, BioSigReader); FILE_SIGNAL_READER_REGISTRATION(dat, BioSigReader); FILE_SIGNAL_READER_REGISTRATION(cnt, BioSigReader); FILE_SIGNAL_READER_REGISTRATION(vhdr, BioSigReader); FILE_SIGNAL_READER_REGISTRATION(bkr, BioSigReader); FILE_SIGNAL_READER_REGISTRATION(evt, BioSigReader); FILE_SIGNAL_READER_DEFAULT_REGISTRATION(BioSigReader); //----------------------------------------------------------------------------- BioSigReader::BioSigReader() : basic_header_ (0), biosig_header_ (0), buffered_all_channels_ (false), buffered_all_events_ (false) { qDebug () << "Constructed BioSigReader"; // nothing to do here } //----------------------------------------------------------------------------- BioSigReader::~BioSigReader() { doClose(); } //----------------------------------------------------------------------------- QPair BioSigReader::createInstance (QString const& file_path) { BioSigReader* reader (new BioSigReader); if (file_path.section('.', -1) == "evt") reader->buffered_all_channels_ = true; QString error = reader->open (file_path); if (error.size() > 0) { qDebug () << error; //QMessageBox::critical(0, QObject::tr("Error"), error); return QPair (0, error); } else return QPair (reader, ""); } //----------------------------------------------------------------------------- void BioSigReader::doClose () const { if (biosig_header_) { sclose (biosig_header_); destructHDR (biosig_header_); } biosig_header_ = 0; } //----------------------------------------------------------------------------- QSharedPointer BioSigReader::getSignalData (ChannelID channel_id, unsigned start_sample, unsigned length) const { QMutexLocker lock (&mutex_); if (!buffered_all_channels_) bufferAllChannels(); if (!channel_map_.contains(channel_id)) return QSharedPointer (0); if (length == basic_header_->getNumberOfSamples() && start_sample == 0) return channel_map_[channel_id]; else return channel_map_[channel_id]->createSubBlock (start_sample, length); } //----------------------------------------------------------------------------- QList > BioSigReader::getEvents () const { QMutexLocker lock (&mutex_); QList > empty_list; if (!biosig_header_) return empty_list; if (!buffered_all_events_) bufferAllEvents(); return events_; } //----------------------------------------------------------------------------- QString BioSigReader::open (QString const& file_name) { QMutexLocker lock (&mutex_); return loadFixedHeader (file_name); } //----------------------------------------------------------------------------- QString BioSigReader::loadFixedHeader(const QString& file_name) { QMutexLocker locker (&biosig_access_lock_); char *c_file_name = new char[file_name.length() + 1]; strcpy (c_file_name, file_name.toLocal8Bit ().data()); c_file_name[file_name.length()] = '\0'; tzset(); // set flags if(biosig_header_==NULL) { biosig_header_ = constructHDR (0,0); biosig_header_->FLAG.UCAL = 0; biosig_header_->FLAG.OVERFLOWDETECTION = 0; } biosig_header_ = sopen(c_file_name, "r", biosig_header_ ); basic_header_ = QSharedPointer (new BiosigBasicHeader (biosig_header_, file_name)); /// waldesel: REMOVE OLD STUFF from here downwards /// and move it into BiosigBasicHeader!!! if (biosig_header_ == NULL || serror()) { sclose (biosig_header_); destructHDR(biosig_header_); biosig_header_ = 0; delete c_file_name; return "file not supported"; } // (C) 2008 AS: EVENT.DUR and EVENT.CHN are optional in SOPEN, but SigViewer needs them. convert2to4_eventtable(biosig_header_); //hdr2ascii(biosig_header_,stdout,4); delete c_file_name; c_file_name = 0; uint16_t NS=0; // count number of selected channels - status channels are already converted to event table for (uint16_t k=0; kNS; k++) { if (biosig_header_->CHANNEL[k].OnOff) NS++; } basic_header_->setNumberEvents(biosig_header_->EVENT.N); // Hack Hack: Transforming Events to have the same sample rate as the signals /*if (biosig_header_->EVENT.SampleRate) basic_header_->setEventSamplerate(biosig_header_->EVENT.SampleRate); else*/ basic_header_->setEventSamplerate(biosig_header_->SampleRate); //#ifdef CHOLMOD_H // if (biosig_header_->Calib==NULL) { //#endif // uint16_t chan=0; // for (uint16_t channel_index = 0; channel_index < biosig_header_->NS; ++channel_index) // if (biosig_header_->CHANNEL[channel_index].OnOff) // show only selected channels - status channels are not shown. // { // SignalChannel* channel = new SignalChannel(chan++, // biosig_header_->SPR, // biosig_header_->CHANNEL[channel_index]); // basic_header_->addChannel(channel); // } //#ifdef CHOLMOD_H // } else // for (uint16_t channel_index = 0; channel_index < biosig_header_->Calib->ncol; ++channel_index) // { // SignalChannel* channel = new SignalChannel(channel_index, // biosig_header_->SPR, // biosig_header_->rerefCHANNEL[channel_index]); // basic_header_->addChannel(channel); // } //#endif return ""; } //----------------------------------------------------------------------------- QSharedPointer BioSigReader::getBasicHeader () { //QMutexLocker lock (&mutex_); return basic_header_; } //----------------------------------------------------------------------------- void BioSigReader::bufferAllChannels () const { uint32 length = biosig_header_->NRec * biosig_header_->SPR; biosig_data_type* read_data = new biosig_data_type[length]; biosig_header_->FLAG.ROW_BASED_CHANNELS = 0; for (unsigned channel_id_sub = 0; channel_id_sub < basic_header_->getNumberChannels(); ++channel_id_sub) biosig_header_->CHANNEL[channel_id_sub].OnOff = 0; QString progress_name = QObject::tr("Loading data..."); for (unsigned channel_id = 0; channel_id < basic_header_->getNumberChannels(); ++channel_id) { ProgressBar::instance().increaseValue (1, progress_name); if (channel_id > 0) biosig_header_->CHANNEL[channel_id-1].OnOff = 0; biosig_header_->CHANNEL[channel_id].OnOff = 1; sread (read_data, 0, length / biosig_header_->SPR, biosig_header_); QSharedPointer > raw_data (new QVector (basic_header_->getNumberOfSamples())); for (unsigned data_index = 0; data_index < basic_header_->getNumberOfSamples(); data_index++) raw_data->operator [](data_index) = read_data[data_index]; QSharedPointer data_block (new FixedDataBlock (raw_data, basic_header_->getSampleRate())); channel_map_[channel_id] = data_block; } buffered_all_channels_ = true; if (buffered_all_events_) doClose(); delete[] read_data; } //------------------------------------------------------------------------- void BioSigReader::bufferAllEvents () const { unsigned number_events = biosig_header_->EVENT.N; for (unsigned index = 0; index < number_events; index++) { // Hack Hack: Transforming Events to have the same sample rate as the signals double rate_transition = basic_header_->getEventSamplerate() / biosig_header_->EVENT.SampleRate; QSharedPointer event (new SignalEvent (biosig_header_->EVENT.POS[index] * rate_transition, biosig_header_->EVENT.TYP[index], biosig_header_->EVENT.SampleRate * rate_transition)); if (biosig_header_->EVENT.CHN) { if (biosig_header_->EVENT.CHN[index] == 0) event->setChannel (UNDEFINED_CHANNEL); else event->setChannel (biosig_header_->EVENT.CHN[index] - 1); event->setDuration (biosig_header_->EVENT.DUR[index] * rate_transition); } events_.append (event); } buffered_all_events_ = true; if (buffered_all_channels_) doClose(); } } sigviewer-0.5.1+svn556/src/file_handling_impl/biosig_reader.h000066400000000000000000000044231154433734200241360ustar00rootroot00000000000000#ifndef BIOSIG_READER_H_ #define BIOSIG_READER_H_ #include "file_handling/file_signal_reader.h" #include "biosig.h" #include #include #include namespace SigViewer_ { class BioSigReader : public FileSignalReader { public: BioSigReader (); virtual ~BioSigReader(); //------------------------------------------------------------------------- QPair createInstance (QString const& file_path); //------------------------------------------------------------------------- virtual QSharedPointer getSignalData (ChannelID channel_id, unsigned start_sample, unsigned length) const; //------------------------------------------------------------------------- virtual QList > getEvents () const; //------------------------------------------------------------------------- virtual QSharedPointer getBasicHeader (); //------------------------------------------------------------------------- virtual QSharedPointer getBasicHeader () const {return basic_header_;} private: //------------------------------------------------------------------------- QString open (QString const& file_name); //------------------------------------------------------------------------- void bufferAllChannels () const; //------------------------------------------------------------------------- void applyFilters (double* &in, double* &out, int length) const; //------------------------------------------------------------------------- void bufferAllEvents () const; Q_DISABLE_COPY(BioSigReader) QString loadFixedHeader(const QString& file_name); void doClose () const; QSharedPointer basic_header_; mutable QMutex mutex_; mutable QMutex biosig_access_lock_; mutable HDRTYPE* biosig_header_; mutable bool buffered_all_channels_; mutable bool buffered_all_events_; mutable QMap > channel_map_; mutable QList > events_; }; } // namespace SigViewer_ #endif /*CNT_READER_H_*/ sigviewer-0.5.1+svn556/src/file_handling_impl/biosig_writer.cpp000066400000000000000000000130221154433734200245360ustar00rootroot00000000000000/* $Id: biosig_writer.cpp,v 1.7 2009/02/22 12:36:46 cle1109 Exp $ Copyright (C) Thomas Brunner 2006,2007 Christoph Eibel 2007,2008, Clemens Brunner 2006,2007,2008 Alois Schloegl 2008 This file is part of the "SigViewer" repository at http://biosig.sf.net/ 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 3 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, see . */ #include "biosig_writer.h" #include "file_handler_factory_registrator.h" #include #include #include #include namespace SigViewer_ { FILE_SIGNAL_WRITER_REGISTRATION(gdf, BioSigWriter); //----------------------------------------------------------------------------- BioSigWriter::BioSigWriter () : target_type_ (GDF) { file_formats_support_event_saving_.insert(GDF1); file_formats_support_event_saving_.insert(GDF); } //----------------------------------------------------------------------------- BioSigWriter::BioSigWriter (FileFormat target_type, QString new_file_path) : target_type_ (target_type), new_file_path_ (new_file_path) { // nothing to do here } //------------------------------------------------------------------------- QPair BioSigWriter::createInstance (QString const& file_path) { BioSigWriter* writer (new BioSigWriter); writer->new_file_path_ = file_path; return QPair (writer, ""); } //----------------------------------------------------------------------------- bool BioSigWriter::supportsSavingEvents () const { return file_formats_support_event_saving_.count(target_type_) > 0; } //----------------------------------------------------------------------------- QString BioSigWriter::saveEventsToSignalFile (QSharedPointer event_manager, std::set const& types) { if (file_formats_support_event_saving_.count(target_type_) == 0) return QObject::tr("Can't write events to that file that file type!"); QList events; foreach (EventType type, types) events.append(event_manager->getEvents(type)); unsigned number_events = events.size(); qDebug () << "number_events = " <getNumberOfEvents() = " << event_manager->getNumberOfEvents(); HDRTYPE* header = constructHDR (0, number_events); qDebug () << "BioSigWriter::saveEventsToSignalFile to " << new_file_path_; header = sopen (new_file_path_.toStdString().c_str(), "r", header); header->EVENT.SampleRate = event_manager->getSampleRate(); header->EVENT.N = number_events; header->EVENT.TYP = (typeof(header->EVENT.TYP)) realloc(header->EVENT.TYP,number_events * sizeof(typeof(*header->EVENT.TYP))); header->EVENT.POS = (typeof(header->EVENT.POS)) realloc(header->EVENT.POS,number_events * sizeof(typeof(*header->EVENT.POS))); header->EVENT.CHN = (typeof(header->EVENT.CHN)) realloc(header->EVENT.CHN,number_events * sizeof(typeof(*header->EVENT.CHN))); header->EVENT.DUR = (typeof(header->EVENT.DUR)) realloc(header->EVENT.DUR,number_events * sizeof(typeof(*header->EVENT.DUR))); for (unsigned index = 0; index < number_events; index++) { QSharedPointer event = event_manager->getEvent(events[index]); if (event->getChannel() == UNDEFINED_CHANNEL) header->EVENT.CHN[index] = 0; else header->EVENT.CHN[index] = event->getChannel() + 1; header->EVENT.TYP[index] = event->getType (); header->EVENT.POS[index] = event->getPosition(); header->EVENT.DUR[index] = event->getDuration(); } int error = sflush_gdf_event_table (header); if (error) QMessageBox::critical(0, "Events not saved!!!", QString::number(error)); sclose (header); destructHDR (header); return ""; } //----------------------------------------------------------------------------- QString BioSigWriter::save (QSharedPointer file_context, std::set const& types) { QString source_file_path = file_context->getFilePathAndName(); HDRTYPE* read_header = sopen (source_file_path.toStdString().c_str(), "r", NULL); uint32 read_data_size = read_header->NS * read_header->NRec * read_header->SPR; biosig_data_type* read_data = new biosig_data_type[read_data_size]; sread (read_data, 0, read_data_size, read_header); read_header->TYPE = target_type_; if (target_type_ == GDF) read_header->VERSION = 2; HDRTYPE* write_header = sopen (new_file_path_.toStdString().c_str(), "w", read_header); qDebug() << "write NELEM = " << swrite (read_data, read_header->NRec, write_header); delete read_data; sclose (write_header); sclose (read_header); destructHDR (write_header); if (file_formats_support_event_saving_.count(target_type_)) saveEventsToSignalFile (file_context->getEventManager (), types); return ""; } } sigviewer-0.5.1+svn556/src/file_handling_impl/biosig_writer.h000066400000000000000000000031371154433734200242110ustar00rootroot00000000000000#ifndef BIOIGWRITER_H_ #define BIOIGWRITER_H_ #include "file_handling/file_signal_writer.h" #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- class BioSigWriter : public FileSignalWriter { public: //------------------------------------------------------------------------- BioSigWriter (); //------------------------------------------------------------------------- virtual QPair createInstance (QString const& file_path); //------------------------------------------------------------------------- virtual ~BioSigWriter() {} //------------------------------------------------------------------------- virtual bool supportsSavingEvents () const; //------------------------------------------------------------------------- virtual QString saveEventsToSignalFile (QSharedPointer, std::set const& types); //------------------------------------------------------------------------- virtual QString save (QSharedPointer file_context, std::set const& types); private: //------------------------------------------------------------------------- BioSigWriter (FileFormat target_type, QString new_file_path); FileFormat target_type_; QString new_file_path_; std::set file_formats_support_event_saving_; mutable QMutex mutex_; }; } #endif /*BIOIGWRITER_H_*/ sigviewer-0.5.1+svn556/src/file_handling_impl/channel_manager_impl.cpp000066400000000000000000000053171154433734200260210ustar00rootroot00000000000000#include "channel_manager_impl.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- ChannelManagerImpl::ChannelManagerImpl (FileSignalReader* file_signal_reader) : reader_ (file_signal_reader) { setXAxisUnitLabel ("s"); } //----------------------------------------------------------------------------- ChannelManagerImpl::~ChannelManagerImpl () { delete reader_; } //------------------------------------------------------------------------- std::set ChannelManagerImpl::getChannels () const { std::set channels; for (ChannelID id = 0; id < static_cast(reader_->getBasicHeader()->getNumberChannels()); ++id) channels.insert(id); return channels; } //----------------------------------------------------------------------------- uint32 ChannelManagerImpl::getNumberChannels () const { return reader_->getBasicHeader()->getNumberChannels(); } //------------------------------------------------------------------------- QString ChannelManagerImpl::getChannelLabel (ChannelID id) const { if (id == UNDEFINED_CHANNEL) return QObject::tr("All Channels"); else if (!reader_->getBasicHeader()->getChannel (id).isNull()) return reader_->getBasicHeader()->getChannel (id)->getLabel(); else return QObject::tr("Invalid Channel"); } //------------------------------------------------------------------------- QString ChannelManagerImpl::getChannelYUnitString (ChannelID id) const { if (id != UNDEFINED_CHANNEL) return reader_->getBasicHeader()->getChannel(id)->getPhysicalDim(); else return ""; // reader_->getBasicHeader()->get } //----------------------------------------------------------------------------- QSharedPointer ChannelManagerImpl::getData (ChannelID id, unsigned start_pos, unsigned length) const { if (((start_pos + length) > getNumberSamples()) || length == 0) return QSharedPointer (0); else return reader_->getSignalData (id, start_pos, length); } //----------------------------------------------------------------------------- float32 ChannelManagerImpl::getDurationInSec () const { return reader_->getBasicHeader()->getNumberOfSamples() / reader_->getBasicHeader()->getSampleRate(); } //----------------------------------------------------------------------------- uint32 ChannelManagerImpl::getNumberSamples () const { return reader_->getBasicHeader()->getNumberOfSamples(); } //----------------------------------------------------------------------------- float32 ChannelManagerImpl::getSampleRate () const { return reader_->getBasicHeader()->getSampleRate(); } } sigviewer-0.5.1+svn556/src/file_handling_impl/channel_manager_impl.h000066400000000000000000000042071154433734200254630ustar00rootroot00000000000000#ifndef CHANNEL_MANAGER_IMPL_H #define CHANNEL_MANAGER_IMPL_H #include "file_handling/channel_manager.h" #include "file_handling/file_signal_reader.h" namespace SigViewer_ { //----------------------------------------------------------------------------- /// ChannelManagerImpl /// /// implementation of ChannelManager /// class ChannelManagerImpl : public ChannelManager { public: //--------------------------------------------------------------------------------------------- /// @param file_signal_reader the ChannelManagerImpl takes ownership of the given FileSignalReader /// and destroys it if the ChannelManagerImpl is destructed ChannelManagerImpl (FileSignalReader* file_signal_reader); //--------------------------------------------------------------------------------------------- virtual ~ChannelManagerImpl (); //------------------------------------------------------------------------- virtual std::set getChannels () const; //------------------------------------------------------------------------- virtual uint32 getNumberChannels () const; //------------------------------------------------------------------------- virtual QString getChannelLabel (ChannelID id) const; //------------------------------------------------------------------------- virtual QString getChannelYUnitString (ChannelID id) const; //------------------------------------------------------------------------- virtual QSharedPointer getData (ChannelID id, unsigned start_pos, unsigned length) const; //------------------------------------------------------------------------- virtual float32 getDurationInSec () const; //------------------------------------------------------------------------- virtual uint32 getNumberSamples () const; //------------------------------------------------------------------------- virtual float32 getSampleRate () const; private: FileSignalReader* reader_; }; } #endif // CHANNEL_MANAGER_IMPL_H sigviewer-0.5.1+svn556/src/file_handling_impl/down_sampling_thread.cpp000066400000000000000000000146701154433734200260700ustar00rootroot00000000000000#include "down_sampling_thread.h" #include #include "signal_processing/SPUC/butterworth.h" #include "base/fixed_data_block.h" #include "gui/background_processes.h" #include #include #include namespace SigViewer_ { QString DownSamplingThread::PROCESS_NAME_ ("Downsampling..."); //----------------------------------------------------------------------------- DownSamplingThread::DownSamplingThread (QList > data, unsigned downsampling_step, unsigned downsampling_max) : basis_data_ (data), data_ (data), downsampling_step_ (downsampling_step), downsampling_max_ (downsampling_max) { } //----------------------------------------------------------------------------- DownSamplingThread::DownSamplingThread (QSharedPointer channel_manager, unsigned downsampling_step, unsigned downsampling_max) : channel_manager_ (channel_manager), downsampling_step_ (downsampling_step), downsampling_max_ (downsampling_max) { } //----------------------------------------------------------------------------- DownSamplingThread::~DownSamplingThread () { BackgroundProcesses::instance().removeProcess (PROCESS_NAME_); } //----------------------------------------------------------------------------- void DownSamplingThread::run () { running_ = true; qDebug () << "DownSamplingThread::run started downsampling; QThread::currentThread = " << QThread::currentThread(); if (!channel_manager_.isNull()) minMaxDownsampling (); else downsampleAllOnBasisData (); //downsampleOnDownsampledData (); qDebug () << "DownSamplingThread::run FINISHED!"; running_ = false; } //------------------------------------------------------------------------- void DownSamplingThread::minMaxDownsampling () { } //------------------------------------------------------------------------- void DownSamplingThread::downsampleAllOnBasisData () { QMap > > > raw_downsampled_data; QMap > > > low_pass_filters; QMap > sample_rates; unsigned max_channel_length = 0; for (unsigned downsampling_factor = downsampling_step_; downsampling_factor < downsampling_max_; downsampling_factor *= downsampling_step_) { for (int channel = 0; channel < data_.size(); channel++) { max_channel_length = std::max (max_channel_length, basis_data_[channel]->size()); sample_rates[downsampling_factor].append (basis_data_[channel]->getSampleRatePerUnit() / downsampling_factor); QSharedPointer > raw_data_vector (new QVector (static_cast(basis_data_[channel]->size () / downsampling_factor) + 1)); QSharedPointer downsampled_data (new FixedDataBlock (raw_data_vector, sample_rates[downsampling_factor][channel])); basis_data_[channel]->addDownSampledVersion (downsampled_data, downsampling_factor); raw_downsampled_data[downsampling_factor].append (raw_data_vector); low_pass_filters[downsampling_factor].append (QSharedPointer > (new SPUC::butterworth (0.5 / downsampling_factor, 4, 3))); } } BackgroundProcesses::instance().addProcess (PROCESS_NAME_, max_channel_length); for (unsigned sample_index = 0; sample_index < max_channel_length; sample_index++) { for (int channel = 0; channel < basis_data_.size(); channel++) { if (basis_data_[channel]->size() > sample_index) { foreach (unsigned downsampling_factor, low_pass_filters.keys()) { float32 value = low_pass_filters[downsampling_factor][channel]->clock (basis_data_[channel]->operator [](sample_index)); if ((sample_index + 1) % downsampling_factor == 0) raw_downsampled_data[downsampling_factor][channel]->operator []((sample_index + 1) / downsampling_factor) = value; } } } if (sample_index % 100 == 0) BackgroundProcesses::instance().setProcessState (PROCESS_NAME_, sample_index); } BackgroundProcesses::instance().removeProcess (PROCESS_NAME_); } //------------------------------------------------------------------------- void DownSamplingThread::downsampleOnDownsampledData () { for (unsigned downsampling_factor = downsampling_step_; downsampling_factor < downsampling_max_; downsampling_factor *= downsampling_step_) { unsigned max_channel_length = 0; QVector > > raw_downsampled_data; QVector > > low_pass_filters; QVector sample_rates_; for (int channel = 0; channel < data_.size(); channel++) { max_channel_length = std::max (max_channel_length, data_[channel]->size()); raw_downsampled_data.append (QSharedPointer > (new QVector (static_cast(data_[channel]->size () / downsampling_step_) + 1))); low_pass_filters.append (QSharedPointer > (new SPUC::butterworth (0.9 / downsampling_step_, 4, 3))); sample_rates_.append (data_[channel]->getSampleRatePerUnit() / downsampling_step_); } for (unsigned sample_index = 0; sample_index < max_channel_length; sample_index++) { for (int channel = 0; channel < data_.size(); channel++) { if (data_[channel]->size() > sample_index) { float32 value = low_pass_filters[channel]->clock (data_[channel]->operator [](sample_index)); if ((sample_index + 1) % downsampling_step_ == 0) raw_downsampled_data[channel]->operator []((sample_index + 1) / downsampling_step_) = value; } } } data_.clear (); low_pass_filters.clear(); for (int channel = 0; channel < raw_downsampled_data.size(); channel++) { QSharedPointer downsampled_data (new FixedDataBlock (raw_downsampled_data[channel], sample_rates_[channel])); basis_data_[channel]->addDownSampledVersion (downsampled_data, downsampling_factor); data_.append (downsampled_data); } } } } sigviewer-0.5.1+svn556/src/file_handling_impl/down_sampling_thread.h000066400000000000000000000036401154433734200255300ustar00rootroot00000000000000#ifndef DOWN_SAMPLING_THREAD_H #define DOWN_SAMPLING_THREAD_H #include "base/data_block.h" #include "file_handling/channel_manager.h" #include #include #include #include #include namespace SigViewer_ { class DownSamplingThread : public QThread { Q_OBJECT public: //------------------------------------------------------------------------- DownSamplingThread (QList > data, unsigned downsampling_step, unsigned downsampling_max); //------------------------------------------------------------------------- DownSamplingThread (QSharedPointer channel_manager, unsigned downsampling_step, unsigned downsampling_max); //------------------------------------------------------------------------- virtual ~DownSamplingThread (); signals: //------------------------------------------------------------------------- void downsamplingDataFinished (QSharedPointer data, ChannelID channel, unsigned factor); private: //------------------------------------------------------------------------- virtual void run (); //------------------------------------------------------------------------- void minMaxDownsampling (); //------------------------------------------------------------------------- void downsampleAllOnBasisData (); //------------------------------------------------------------------------- void downsampleOnDownsampledData (); //------------------------------------------------------------------------- QSharedPointer channel_manager_; QList > basis_data_; QList > data_; QList > new_data_; unsigned downsampling_step_; unsigned downsampling_max_; bool running_; static QString PROCESS_NAME_; }; } #endif // DOWN_SAMPLING_THREAD_H sigviewer-0.5.1+svn556/src/file_handling_impl/event_manager_impl.cpp000066400000000000000000000232541154433734200255320ustar00rootroot00000000000000#include "event_manager_impl.h" #include "file_handling/file_signal_reader.h" #include "base/exception.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- EventManagerImpl::EventManagerImpl (FileSignalReader const& reader) : max_event_position_ (reader.getBasicHeader()->getNumberOfSamples()), caller_mutex_ (new QMutex) { QList > signal_events = reader.getEvents (); next_free_id_ = 0; for (int index = 0; index < signal_events.size(); index++) { event_map_.insert (next_free_id_, QSharedPointer ( new SignalEvent(*(signal_events[index]), next_free_id_))); mutex_map_.insert (next_free_id_, QSharedPointer ( new QMutex)); position_event_map_.insertMulti (signal_events[index]->getPosition (), next_free_id_); if (!event_table_reader_.entryExists (signal_events[index]->getType())) event_table_reader_.addEntry (signal_events[index]->getType()); next_free_id_++; } sample_rate_ = reader.getBasicHeader()->getEventSamplerate(); QMap event_names = reader.getBasicHeader()->getNamesOfUserSpecificEvents(); for (QMap::iterator name_iter = event_names.begin(); name_iter != event_names.end(); ++name_iter) event_table_reader_.setEventName (name_iter.key(), name_iter.value()); } //----------------------------------------------------------------------------- EventManagerImpl::~EventManagerImpl () { event_table_reader_.restoreEventNames (); delete caller_mutex_; } //----------------------------------------------------------------------------- QSharedPointer EventManagerImpl::getEvent (EventID id) const { QMutexLocker locker (caller_mutex_); EventMap::ConstIterator event_it = event_map_.find (id); if (event_it == event_map_.end()) return QSharedPointer (0); else return event_it.value(); } //----------------------------------------------------------------------------- QSharedPointer EventManagerImpl::getAndLockEventForEditing (EventID id) { QMutexLocker locker (caller_mutex_); EventMap::Iterator event_it = event_map_.find (id); if (event_it == event_map_.end()) return QSharedPointer (0); else { temp_event_position_map_.insert (id, event_it.value()->getPosition ()); mutex_map_[id]->lock (); return event_it.value(); } } //----------------------------------------------------------------------------- void EventManagerImpl::updateAndUnlockEvent (EventID id) { if (!mutex_map_.contains (id)) return; position_event_map_.remove (temp_event_position_map_[id], id); temp_event_position_map_.remove (id); position_event_map_.insertMulti (event_map_[id]->getPosition (), id); mutex_map_[id]->unlock (); emit eventChanged (id); emit changed (); } //----------------------------------------------------------------------------- QSharedPointer EventManagerImpl::createEvent ( ChannelID channel_id, unsigned pos, unsigned duration, EventType type, EventID id) { if (id == UNDEFINED_EVENT_ID) { id = next_free_id_; next_free_id_++; } else if (event_map_.contains(id)) return QSharedPointer(0); QSharedPointer new_event ( new SignalEvent(pos, type, sample_rate_, channel_id, duration, id)); event_map_[id] = new_event; mutex_map_[id] = QSharedPointer (new QMutex); position_event_map_.insertMulti (pos, id); emit eventCreated (new_event); emit changed (); return new_event; } //----------------------------------------------------------------------------- void EventManagerImpl::removeEvent (EventID id) { qDebug () << "EventManagerImpl::removeEvent " << id; EventMap::iterator event_iter = event_map_.find (id); if (event_iter == event_map_.end()) return; position_event_map_.remove (event_map_[id]->getPosition(), id); event_map_.remove (id); mutex_map_.remove (id); qDebug () << "EventManagerImpl::removeEvent " << id << " emitting"; emit eventRemoved (id); emit changed (); qDebug () << "EventManagerImpl::removeEvent " << id << " finished"; } //----------------------------------------------------------------------------- std::set EventManagerImpl::getEventsAt (unsigned pos, ChannelID channel_id) const { QMutexLocker locker (caller_mutex_); std::set events; QSharedPointer event_ptr; foreach (uint32 position, position_event_map_.keys()) { foreach (EventID event, position_event_map_.values (position)) { event_ptr = event_map_[event]; if (event_ptr->getPosition() <= pos && event_ptr->getPosition () + event_ptr->getDuration() >= pos && (event_ptr->getChannel() == channel_id || event_ptr->getChannel() == UNDEFINED_CHANNEL)) events.insert (event); } } return events; } //----------------------------------------------------------------------------- double EventManagerImpl::getSampleRate () const { QMutexLocker locker (caller_mutex_); return sample_rate_; } //------------------------------------------------------------------------- unsigned EventManagerImpl::getMaxEventPosition () const { return max_event_position_; } //----------------------------------------------------------------------------- QString EventManagerImpl::getNameOfEventType (EventType type) const { QMutexLocker locker (caller_mutex_); return event_table_reader_.getEventName (type); } //------------------------------------------------------------------------- QString EventManagerImpl::getNameOfEvent (EventID event) const { if (event_map_.contains (event)) return event_table_reader_.getEventName (event_map_[event]->getType ()); else return ""; } //----------------------------------------------------------------------------- QList EventManagerImpl::getAllEvents () const { QMutexLocker locker (caller_mutex_); return event_map_.keys (); } //----------------------------------------------------------------------------- unsigned EventManagerImpl::getNumberOfEvents () const { QMutexLocker locker (caller_mutex_); return event_map_.size (); } //----------------------------------------------------------------------------- std::set EventManagerImpl::getEventTypes (QString group_id) const { QMutexLocker locker (caller_mutex_); if (group_id.size ()) return event_table_reader_.getEventsOfGroup (group_id); else return event_table_reader_.getAllEventTypes (); } //------------------------------------------------------------------------- std::set EventManagerImpl::getEventTypeGroupIDs () const { std::set groups; for (EventTableFileReader::StringIterator group = event_table_reader_.getGroupIdBegin(); group != event_table_reader_.getGroupIdEnd(); ++group) groups.insert (*group); return groups; } //----------------------------------------------------------------------------- QList EventManagerImpl::getEvents (EventType type) const { QMutexLocker locker (caller_mutex_); QList events; for (EventMap::ConstIterator event_iter = event_map_.begin (); event_iter != event_map_.end (); ++event_iter) if (event_iter.value ()->getType () == type) { events.push_back (event_iter.key ()); } return events; } //------------------------------------------------------------------------- EventID EventManagerImpl::getNextEventOfSameType (EventID id) const { QMutexLocker locker (caller_mutex_); if (!event_map_.contains(id)) return UNDEFINED_EVENT_ID; EventType type = event_map_[id]->getType (); PositionMap::const_iterator iter = position_event_map_.find (event_map_[id]->getPosition ()); ++iter; while (iter != position_event_map_.end ()) { foreach (EventID next_event_id, position_event_map_.values (iter.key())) if (event_map_[next_event_id]->getType () == type && next_event_id != id) return next_event_id; ++iter; } return UNDEFINED_EVENT_ID; } //------------------------------------------------------------------------- EventID EventManagerImpl::getPreviousEventOfSameType (EventID id) const { QMutexLocker locker (caller_mutex_); if (!event_map_.contains(id)) return UNDEFINED_EVENT_ID; EventType type = event_map_[id]->getType (); PositionMap::const_iterator iter = position_event_map_.find (event_map_[id]->getPosition ()); if (iter == position_event_map_.begin ()) return UNDEFINED_EVENT_ID; --iter; while (iter != position_event_map_.begin ()) { foreach (EventID previous_event_id, position_event_map_.values (iter.key())) if (event_map_[previous_event_id]->getType () == type && previous_event_id != id) return previous_event_id; --iter; } foreach (EventID previous_event_id, position_event_map_.values (iter.key())) if (event_map_[previous_event_id]->getType () == type && previous_event_id != id) return previous_event_id; return UNDEFINED_EVENT_ID; } } sigviewer-0.5.1+svn556/src/file_handling_impl/event_manager_impl.h000066400000000000000000000076411154433734200252010ustar00rootroot00000000000000#ifndef EVENT_MANAGER_IMPL_H #define EVENT_MANAGER_IMPL_H #include "file_handling/event_manager.h" #include "file_handling/file_signal_reader.h" #include "event_table_file_reader.h" #include #include #include namespace SigViewer_ { class EventManagerImpl : public EventManager { public: EventManagerImpl (FileSignalReader const& reader); virtual ~EventManagerImpl (); //------------------------------------------------------------------------- /// see base class virtual QSharedPointer getEvent (EventID id) const; //------------------------------------------------------------------------- /// see base class virtual QSharedPointer getAndLockEventForEditing (EventID id); //------------------------------------------------------------------------- /// see base class virtual void updateAndUnlockEvent (EventID id); //------------------------------------------------------------------------- /// see base class virtual QSharedPointer createEvent (ChannelID channel_id, unsigned pos, unsigned length, EventType type, EventID id = UNDEFINED_EVENT_ID); //------------------------------------------------------------------------- /// see base class virtual void removeEvent (EventID id); //------------------------------------------------------------------------- /// see base class virtual std::set getEventsAt (unsigned pos, ChannelID channel_id) const; //------------------------------------------------------------------------- /// see base class virtual double getSampleRate () const; //------------------------------------------------------------------------- virtual unsigned getMaxEventPosition () const; //------------------------------------------------------------------------- /// see base class virtual QString getNameOfEventType (EventType type) const; //------------------------------------------------------------------------- /// see base class virtual QString getNameOfEvent (EventID event) const; //------------------------------------------------------------------------- /// see base class virtual QList getAllEvents () const; //------------------------------------------------------------------------- /// see base class virtual unsigned getNumberOfEvents () const; //------------------------------------------------------------------------- /// see base class virtual std::set getEventTypes (QString group_id = "") const; //------------------------------------------------------------------------- virtual std::set getEventTypeGroupIDs () const; //------------------------------------------------------------------------- /// see base class virtual QList getEvents (EventType type) const; //------------------------------------------------------------------------- virtual EventID getNextEventOfSameType (EventID id) const; //------------------------------------------------------------------------- virtual EventID getPreviousEventOfSameType (EventID id) const; private: EventTableFileReader event_table_reader_; unsigned const max_event_position_; double sample_rate_; QMutex* caller_mutex_; typedef QMap > EventMap; typedef QMap > MutexMap; typedef QMultiMap PositionMap; EventMap event_map_; MutexMap mutex_map_; EventID next_free_id_; PositionMap position_event_map_; QMap temp_event_position_map_; }; } #endif // EVENT_MANAGER_IMPL_H sigviewer-0.5.1+svn556/src/file_handling_impl/event_table_file_reader.cpp000066400000000000000000000135601154433734200265060ustar00rootroot00000000000000#include "event_table_file_reader.h" #include #include #include #include #include namespace SigViewer_ { //------------------------------------------------------------------------------------------------- QString const EventTableFileReader::UNKNOWN_GROUP_ID = "Unknown Group"; //------------------------------------------------------------------------------------------------- EventTableFileReader::EventTableFileReader() { QSettings settings; QString event_codes_file = settings.value ("eventcodes_file", ":/eventcodes.txt").toString(); load (event_codes_file); event_group_ids_.append (UNKNOWN_GROUP_ID); group_id2name_[UNKNOWN_GROUP_ID] = UNKNOWN_GROUP_ID; } // destructor EventTableFileReader::~EventTableFileReader() { // nothing } // load bool EventTableFileReader::load(const QString& file_name) { event_file_path_ = file_name; QFile file(file_name); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return false; // load event type table QTextStream file_stream(&file); QString group_id; while (true) { QString one_line = file_stream.readLine(); if (one_line.isEmpty()) { break; } if (one_line.indexOf("### 0x") == 0) { group_id = one_line.mid(4, 6); if (!group_id2name_.contains(group_id)) { QString group_name; int32 begin_name = one_line.indexOf(QRegExp("[^ \t]"), 10); if (begin_name != -1) { group_name = one_line.mid(begin_name); } group_id2name_[group_id] = group_name; event_group_ids_ << group_id; } } else if (one_line.indexOf("0x") == 0) { uint16 event_type_id = one_line.mid(0, 6).toInt(0, 16); if (!event_type2name_.contains(event_type_id)) { EventItem item; int32 begin_name = one_line.indexOf(QRegExp("[^ \t]"), 6); if (begin_name != -1) { item.name = one_line.mid(begin_name); } item.group_id = group_id; event_type2name_[event_type_id] = item; event_types_ << event_type_id; } } } file.close(); qSort(event_types_); qSort(event_group_ids_); return true; } // get group id begin EventTableFileReader::StringIterator EventTableFileReader::getGroupIdBegin() const { return event_group_ids_.begin(); } // get group id end EventTableFileReader::StringIterator EventTableFileReader::getGroupIdEnd() const { return event_group_ids_.end(); } // get event types begin EventTableFileReader::IntIterator EventTableFileReader::eventTypesBegin() { return event_types_.begin(); } // get event types end EventTableFileReader::IntIterator EventTableFileReader::eventTypesEnd() { return event_types_.end(); } // get event name QString EventTableFileReader::getEventName(uint16 event_type_id) const { Int2EventItemMap::const_iterator it = event_type2name_.find(event_type_id); return it != event_type2name_.end() ? it.value().name : "NO SUCH EVENT TYPE"; } //----------------------------------------------------------------------------- void EventTableFileReader::setEventName (EventType event_type_id, QString const& name) { event_type2name_[event_type_id].name = name; } //----------------------------------------------------------------------------- void EventTableFileReader::restoreEventNames () { load (event_file_path_); } //----------------------------------------------------------------------------- std::set EventTableFileReader::getEventsOfGroup (QString const& group_id) const { std::set group_types; foreach (EventType event_type, event_types_) if (event_type2name_[event_type].group_id == group_id) group_types.insert (event_type); return group_types; } // get event group id QString EventTableFileReader::getEventGroupId(uint16 event_type_id) const { Int2EventItemMap::const_iterator it = event_type2name_.find(event_type_id); return it != event_type2name_.end() ? it.value().group_id : ""; } //------------------------------------------------------------------------------------------------- bool EventTableFileReader::entryExists (EventType type) const { return event_types_.contains (type); } //------------------------------------------------------------------------------------------------- void EventTableFileReader::addEntry (EventType type, QString const& name, QString group_id) { if (event_types_.contains (type)) return; event_types_.append (type); if (!event_group_ids_.contains (group_id)) group_id = UNKNOWN_GROUP_ID; EventItem item; item.group_id = group_id; if (name.size()) item.name = name; else { item.name = QString::number (type, 16); while (item.name.size() < 4) item.name.prepend ("0"); item.name.prepend("0x"); } event_type2name_[type] = item; } //------------------------------------------------------------------- std::set EventTableFileReader::getAllEventTypes () const { std::set type_set; for (IntIterator it = event_types_.begin(); it != event_types_.end(); ++it) { type_set.insert (*it); } return type_set; } // get event group name QString EventTableFileReader::getEventGroupName(const QString& group_id) const { String2StringMap::const_iterator it = group_id2name_.find(group_id); return it != group_id2name_.end() ? it.value() : ""; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_handling_impl/event_table_file_reader.h000066400000000000000000000042111154433734200261440ustar00rootroot00000000000000// event_table_file_reader.h #ifndef EVENT_TABLE_FILE_READER #define EVENT_TABLE_FILE_READER #include "base/sigviewer_user_types.h" #include #include #include #include class QTextStream; namespace SigViewer_ { //----------------------------------------------------------------------------- /// /// EventTableFileReader /// /// responsible for mapping of EventType to String (name of event) class EventTableFileReader { public: typedef QList::const_iterator IntIterator; typedef QStringList::const_iterator StringIterator; EventTableFileReader(); ~EventTableFileReader(); StringIterator getGroupIdBegin() const; StringIterator getGroupIdEnd() const; QString getEventGroupName(const QString& group_id) const; IntIterator eventTypesBegin(); IntIterator eventTypesEnd(); QString getEventName (EventType event_type_id) const; void setEventName (EventType event_type_id, QString const& name); void restoreEventNames (); std::set getEventsOfGroup (QString const& group_id) const; QString getEventGroupId (EventType event_type_id) const; //--------------------------------------------------------------------------------------------- /// @return true if an the eventtablefilereader has an entry of this type; /// false if not bool entryExists (EventType type) const; //--------------------------------------------------------------------------------------------- void addEntry (EventType type, QString const& name = "", QString group_id = ""); std::set getAllEventTypes () const; private: bool load(const QString& file_name); static QString const UNKNOWN_GROUP_ID; struct EventItem { QString name; QString group_id; }; typedef QMap Int2EventItemMap; typedef QMap String2StringMap; Q_DISABLE_COPY(EventTableFileReader) QList event_types_; QStringList event_group_ids_; Int2EventItemMap event_type2name_; String2StringMap group_id2name_; QString event_file_path_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling_impl/evt_writer.cpp000066400000000000000000000236001154433734200240630ustar00rootroot00000000000000/* $Id: evt_writer.cpp,v 1.6 2009/02/22 12:36:46 cle1109 Exp $ Copyright (C) Thomas Brunner 2006,2007 Christoph Eibel 2007,2008, Clemens Brunner 2006,2007,2008 Alois Schloegl 2008 This file is part of the "SigViewer" repository at http://biosig.sf.net/ 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 3 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, see . */ #include "evt_writer.h" #include "file_handling/file_signal_writer_factory.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- EVTWriter EVTWriter::prototype_instance_ (true); //----------------------------------------------------------------------------- EVTWriter::EVTWriter() { // nothing to do here } //----------------------------------------------------------------------------- EVTWriter::EVTWriter (bool) { FileSignalWriterFactory::getInstance()->registerHandler("evt", QSharedPointer(new EVTWriter)); } //----------------------------------------------------------------------------- EVTWriter::EVTWriter (QString const& new_file_path) : new_file_path_ (new_file_path) { // nothing to do here } //----------------------------------------------------------------------------- EVTWriter::~EVTWriter() { // nothing to do here } //------------------------------------------------------------------------- QPair EVTWriter::createInstance (QString const& new_file_path) { return QPair (new EVTWriter (new_file_path), ""); } //----------------------------------------------------------------------------- QString EVTWriter::save(QSharedPointer file_context, std::set const& types) { QSharedPointer event_manager = file_context->getEventManager(); QList events; foreach (EventType type, types) events.append(event_manager->getEvents(type)); unsigned number_events = events.size(); HDRTYPE* header = constructHDR (0, number_events); header->TYPE = GDF; header->VERSION = 2.0; header->SampleRate = event_manager->getSampleRate(); header->EVENT.SampleRate = event_manager->getSampleRate(); header->EVENT.N = number_events; header->EVENT.TYP = (typeof(header->EVENT.TYP)) realloc(header->EVENT.TYP,number_events * sizeof(typeof(*header->EVENT.TYP))); header->EVENT.POS = (typeof(header->EVENT.POS)) realloc(header->EVENT.POS,number_events * sizeof(typeof(*header->EVENT.POS))); header->EVENT.CHN = (typeof(header->EVENT.CHN)) realloc(header->EVENT.CHN,number_events * sizeof(typeof(*header->EVENT.CHN))); header->EVENT.DUR = (typeof(header->EVENT.DUR)) realloc(header->EVENT.DUR,number_events * sizeof(typeof(*header->EVENT.DUR))); for (unsigned index = 0; index < number_events; index++) { QSharedPointer event = event_manager->getEvent(events[index]); if (event->getChannel() == UNDEFINED_CHANNEL) header->EVENT.CHN[index] = 0; else header->EVENT.CHN[index] = event->getChannel() + 1; header->EVENT.TYP[index] = event->getType (); header->EVENT.POS[index] = event->getPosition(); header->EVENT.DUR[index] = event->getDuration(); } // int error = sflush_gdf_event_table (header); // if (error) // QMessageBox::critical(0, "Events not saved!!!", QString::number(error)); qDebug () << "write events to " << new_file_path_; HDRTYPE *new_header = sopen (new_file_path_.toLocal8Bit().data(), "w", header); sclose (new_header); destructHDR (new_header); return ""; // // if (file_name == file_signal_reader.getBasicHeader()->getFullFileName()) // return "cannot remove signal data from open file"; // // HDRTYPE *header = constructHDR(0, event_vector.size ()); // header->TYPE = GDF; // header->VERSION = 2.0; // // header->EVENT.SampleRate = file_signal_reader.getBasicHeader()->getEventSamplerate(); // HDRTYPE *old_header = file_signal_reader.getRawHeader(); // header->SPR = old_header->SPR; // header->SampleRate = old_header->SampleRate; // // /* (C) 2008 AS: keep patient information */ // header->T0 = old_header->T0; // strcpy(header->Patient.Id, old_header->Patient.Id); // header->Patient.Sex = old_header->Patient.Sex; // header->Patient.Weight = old_header->Patient.Weight; // header->Patient.Height = old_header->Patient.Height; // header->Patient.Birthday = old_header->Patient.Birthday; // header->Patient.Handedness = old_header->Patient.Handedness; // header->Patient.Smoking = old_header->Patient.Smoking; // header->Patient.AlcoholAbuse= old_header->Patient.AlcoholAbuse; // header->Patient.DrugAbuse = old_header->Patient.DrugAbuse; // header->Patient.Medication = old_header->Patient.Medication; // header->Patient.Impairment.Visual = old_header->Patient.Impairment.Visual; // // /* (C) 2008 AS: managing Event table simplified */ // uint32 event_nr = 0; // for (SignalEventVector::iterator iter = event_vector.begin(); iter != event_vector.end(); ++iter, event_nr++) // { // header->EVENT.POS[event_nr] = iter->getPosition (); // header->EVENT.TYP[event_nr] = iter->getType (); // header->EVENT.DUR[event_nr] = iter->getDuration (); // if (iter->getChannel() != UNDEFINED_CHANNEL) // header->EVENT.CHN[event_nr] = iter->getChannel () + 1; // else // header->EVENT.CHN[event_nr] = 0; // } // header->EVENT.N = event_nr; // header->EVENT.SampleRate = header->SampleRate; // // HDRTYPE *new_header = sopen (file_name.toLocal8Bit ().data(), "w", header); // sclose (new_header); //// new_header = sopen (file_name.toLocal8Bit ().data(), "r", 0); // //// new_header->EVENT.N = event_vector.size (); //// new_header->EVENT.SampleRate = file_signal_reader.getBasicHeader()->getEventSamplerate(); //// bool dur_was_set = false; //// bool chn_was_set = false; //// if (old_header->EVENT.DUR && new_header->EVENT.DUR) //// dur_was_set = true; //// else if (old_header->EVENT.DUR && !(new_header->EVENT.DUR)) //// { //// dur_was_set = true; //// new_header->EVENT.DUR = new uint32_t [event_vector.size ()]; //// } //// else if (!(old_header->EVENT.DUR) && new_header->EVENT.DUR) //// delete[] new_header->EVENT.DUR; //// //// if (old_header->EVENT.CHN && new_header->EVENT.CHN) //// chn_was_set = true; //// else if (old_header->EVENT.CHN && !(new_header->EVENT.CHN)) //// { //// chn_was_set = true; //// new_header->EVENT.CHN = new uint16_t [event_vector.size ()]; //// } //// else if (!(old_header->EVENT.CHN) && new_header->EVENT.CHN) //// delete[] new_header->EVENT.CHN; //// //// //// //// uint32 event_nr = 0; //// for (SignalEventVector::iterator iter = event_vector.begin(); iter != event_vector.end(); ++iter, event_nr++) //// { //// new_header->EVENT.POS[event_nr] = iter->getPosition (); //// new_header->EVENT.TYP[event_nr] = iter->getType (); //// if (dur_was_set) //// new_header->EVENT.DUR[event_nr] = iter->getDuration (); //// if (chn_was_set) //// { //// if (iter->getChannel() >= -1) //// new_header->EVENT.CHN[event_nr] = iter->getChannel () + 1; //// else //// new_header->EVENT.CHN[event_nr] = 0; //// } //// } //// //// if (sflush_gdf_event_table(new_header)) //// return "save event table failed"; // // return ""; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_handling_impl/evt_writer.h000066400000000000000000000027151154433734200235340ustar00rootroot00000000000000// evt_writer.h #ifndef EVT_WRITER_H #define EVT_WRITER_H #include "file_handling/file_signal_writer.h" #include namespace SigViewer_ { // EVT writer class EVTWriter : public FileSignalWriter { public: //------------------------------------------------------------------------- EVTWriter (); //------------------------------------------------------------------------- EVTWriter (bool prototype_instance); //------------------------------------------------------------------------- virtual QPair createInstance (QString const& file_path); //------------------------------------------------------------------------- virtual ~EVTWriter(); //------------------------------------------------------------------------- virtual QString saveEventsToSignalFile (QSharedPointer, std::set const&) {return "not implemented!";} //------------------------------------------------------------------------- virtual QString save (QSharedPointer file_context, std::set const& types); private: //------------------------------------------------------------------------- EVTWriter (QString const& new_file_path); static EVTWriter prototype_instance_; QString new_file_path_; // not allowed Q_DISABLE_COPY(EVTWriter) }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/file_handling_impl/file_handler_factory_registrator.h000066400000000000000000000037451154433734200301360ustar00rootroot00000000000000#ifndef FILE_HANDLER_FACTORY_REGISTRATOR_H #define FILE_HANDLER_FACTORY_REGISTRATOR_H #include "file_handling/file_signal_writer_factory.h" #include "file_handling/file_signal_reader_factory.h" namespace SigViewer_ { #define FILE_SIGNAL_WRITER_REGISTRATION(file_ending, writer) \ namespace Registrators_ { \ FileSignalWriterFactoryRegistrator file_writer_registrator ## writer ## file_ending (#file_ending, QSharedPointer (new writer)); \ } #define FILE_SIGNAL_READER_REGISTRATION(file_ending, reader) \ namespace Registrators_ { \ FileSignalReaderFactoryRegistrator file_reader_registrator ## reader ## file_ending (#file_ending, QSharedPointer (new reader)); \ } #define FILE_SIGNAL_READER_DEFAULT_REGISTRATION(reader) \ namespace Registrators_ { \ FileSignalReaderFactoryRegistrator file_reader_registrator ## reader (QSharedPointer (new reader)); \ } namespace Registrators_ { //----------------------------------------------------------------------------- class FileSignalWriterFactoryRegistrator { public: FileSignalWriterFactoryRegistrator (QString const& file_ending, QSharedPointer writer) { FileSignalWriterFactory::getInstance()->registerHandler (file_ending, writer); } }; //----------------------------------------------------------------------------- class FileSignalReaderFactoryRegistrator { public: FileSignalReaderFactoryRegistrator (QString const& file_ending, QSharedPointer reader) { FileSignalReaderFactory::getInstance()->registerHandler (file_ending, reader); } FileSignalReaderFactoryRegistrator (QSharedPointer reader) { FileSignalReaderFactory::getInstance()->registerDefaultHandler (reader); } }; } // namespace Registrators_ } // namespace SigViewer_ #endif // FILE_HANDLER_FACTORY_REGISTRATOR_H sigviewer-0.5.1+svn556/src/file_handling_impl/file_handling_impl.pri000066400000000000000000000032071154433734200255060ustar00rootroot00000000000000HEADERS += file_handling_impl/event_manager_impl.h \ file_handling_impl/biosig_reader.h \ file_handling_impl/biosig_writer.h \ file_handling_impl/evt_writer.h \ file_handling_impl/event_table_file_reader.h \ file_handling_impl/channel_manager_impl.h \ file_handling_impl/biosig_basic_header.h \ file_handling_impl/sinus_dummy_reader.h \ file_handling_impl/sinus_dummy_header.h \ file_handling_impl/file_handler_factory_registrator.h #\ #file_handling_impl/gdf/gdf_file_signal_writer.h \ #file_handling_impl/gdf/gdf_file_signal_reader.h \ #file_handling_impl/gdf/gdf_basic_header.h \ #file_handling_impl/gdf/gdf_data_block.h \ #file_handling_impl/signal_cache.h # \ #file_handling_impl/gdf/gdf_signal_cache.h \ #\ #file_handling_impl/down_sampling_thread.h #file_handling_impl/gdf/gdf_load_data_thread.h SOURCES += file_handling_impl/event_manager_impl.cpp \ file_handling_impl/biosig_reader.cpp \ file_handling_impl/biosig_writer.cpp \ file_handling_impl/evt_writer.cpp \ file_handling_impl/event_table_file_reader.cpp \ file_handling_impl/channel_manager_impl.cpp \ file_handling_impl/biosig_basic_header.cpp \ file_handling_impl/sinus_dummy_reader.cpp \ file_handling_impl/sinus_dummy_header.cpp #\ #file_handling_impl/gdf/gdf_file_signal_writer.cpp \ #file_handling_impl/gdf/gdf_file_signal_reader.cpp \ #file_handling_impl/gdf/gdf_basic_header.cpp \ #file_handling_impl/gdf/gdf_data_block.cpp \ #file_handling_impl/gdf/gdf_signal_cache.cpp \ #\ #file_handling_impl/down_sampling_thread.cpp #file_handling_impl/gdf/gdf_load_data_thread.cpp sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/000077500000000000000000000000001154433734200217245ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_basic_header.cpp000066400000000000000000000020241154433734200256370ustar00rootroot00000000000000#include "gdf_basic_header.h" namespace SigViewer_ { //------------------------------------------------------------------------------------------------- GDFBasicHeader::GDFBasicHeader (QString const& file_path, gdf::GDFHeaderAccess const& header_access) : BasicHeader (file_path), header_access_ (header_access) { setDownSamplingFactor (1); setSampleRate (header_access_.getSignalHeader_readonly(0).get_samplerate()); for (unsigned index = 0; index < header_access_.getNumSignals(); index++) { QSharedPointer channel (new SignalChannel (index, QString::number(index))); addChannel (index, channel); } } //--------------------------------------------------------------------------------------------- uint32 GDFBasicHeader::getNumberOfSamples () const { return header_access_.getSignalHeader_readonly(0).get_samples_per_record() * header_access_.getMainHeader_readonly().get_num_datarecords() / getDownSamplingFactor (); } } sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_basic_header.h000066400000000000000000000013431154433734200253070ustar00rootroot00000000000000#ifndef GDF_BASICH_EADER_H #define GDF_BASICH_EADER_H #include "file_handling/basic_header.h" #include namespace SigViewer_ { //------------------------------------------------------------------------------------------------- class GDFBasicHeader : public BasicHeader { public: //--------------------------------------------------------------------------------------------- GDFBasicHeader (QString const& file_path, gdf::GDFHeaderAccess const& header_access); //--------------------------------------------------------------------------------------------- virtual uint32 getNumberOfSamples () const; private: gdf::GDFHeaderAccess const& header_access_; }; } #endif // GDF_BASICH_EADER_H sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_data_block.cpp000066400000000000000000000057221154433734200253410ustar00rootroot00000000000000#include "gdf_data_block.h" #include #include #include namespace SigViewer_ { //------------------------------------------------------------------------------------------------- GDFDataBlock::GDFDataBlock (QSharedPointer cache, ChannelID channel, unsigned length, float32 sample_rate) : DataBlock (length, sample_rate), channel_ (channel), start_sample_ (0), current_min_ (-200), current_max_ (200), cache_ (cache) { } //------------------------------------------------------------------------------------------------- GDFDataBlock::GDFDataBlock (GDFDataBlock const& src, unsigned start_sample, unsigned length) : DataBlock (src, length), channel_ (src.channel_), start_sample_ (start_sample), current_min_ (src.current_min_), current_max_ (src.current_max_), downsampled_map_ (src.downsampled_map_), cache_ (src.cache_) { } //------------------------------------------------------------------------------------------------- GDFDataBlock::~GDFDataBlock () { } //------------------------------------------------------------------------------------------------- QSharedPointer GDFDataBlock::createSubBlock (uint32 start, uint32 length) const { return QSharedPointer (new GDFDataBlock (*this, start_sample_ + start, length)); } //------------------------------------------------------------------------------------------------- float32 const& GDFDataBlock::operator[] (uint32 index) const { current_value_ = cache_->getSample (channel_, start_sample_ + index); return current_value_; } //------------------------------------------------------------------------- float32 GDFDataBlock::getMin () const { return current_min_; } //------------------------------------------------------------------------- float32 GDFDataBlock::getMax () const { return current_max_; } //------------------------------------------------------------------------- void GDFDataBlock::addDownSampledVersion (QSharedPointer data, unsigned downsampling_factor) { downsampled_map_[downsampling_factor] = data; } //------------------------------------------------------------------------- std::pair, unsigned> GDFDataBlock::getNearbyDownsampledBlock (unsigned downsampling_factor) const { unsigned nearest_factor = 1; bool search = true; for (nearest_factor = downsampling_factor + 1; search && (nearest_factor > 1); --nearest_factor) if (downsampled_map_.contains (nearest_factor - 1)) search = false; if ((nearest_factor <= downsampling_factor) && (nearest_factor > 1)) { return std::pair, unsigned> (downsampled_map_[nearest_factor]->createSubBlock(start_sample_ / nearest_factor, size() / nearest_factor), nearest_factor); } else return std::pair, unsigned> (createSubBlock (0, size ()), 1); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_data_block.h000066400000000000000000000045661154433734200250130ustar00rootroot00000000000000#ifndef GDF_DATA_BLOCK_H #define GDF_DATA_BLOCK_H #include "base/data_block.h" #include "gdf_signal_cache.h" #include "GDF/Reader.h" #include #include namespace SigViewer_ { //------------------------------------------------------------------------------------------------- class GDFDataBlock : public DataBlock { public: //--------------------------------------------------------------------------------------------- GDFDataBlock (QSharedPointer cache, ChannelID channel, unsigned length, float32 sample_rate); //--------------------------------------------------------------------------------------------- virtual ~GDFDataBlock (); //--------------------------------------------------------------------------------------------- virtual QSharedPointer createSubBlock (uint32 start, uint32 length) const; //--------------------------------------------------------------------------------------------- virtual float32 const& operator[] (uint32 index) const; //------------------------------------------------------------------------- virtual float32 getMin () const; //------------------------------------------------------------------------- virtual float32 getMax () const; //------------------------------------------------------------------------- void addDownSampledVersion (QSharedPointer data, unsigned downsampling_factor); //------------------------------------------------------------------------- std::pair, unsigned> getNearbyDownsampledBlock (unsigned downsampling_factor) const; private: //--------------------------------------------------------------------------------------------- GDFDataBlock (GDFDataBlock const& src, unsigned start_sample, unsigned length); //--------------------------------------------------------------------------------------------- Q_DISABLE_COPY (GDFDataBlock); //--------------------------------------------------------------------------------------------- ChannelID channel_; unsigned start_sample_; mutable float32 current_min_; mutable float32 current_max_; mutable float32 current_value_; QMap > downsampled_map_; mutable QSharedPointer cache_; }; } // namespace SigViewer_ #endif // GDF_DATA_BLOCK_H sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_file_signal_reader.cpp000066400000000000000000000122541154433734200270520ustar00rootroot00000000000000#include "gdf_file_signal_reader.h" #include "../file_handler_factory_registrator.h" #include "gdf_data_block.h" #include "GDF/EventConverter.h" #include namespace SigViewer_ { //------------------------------------------------------------------------------------------------- //FILE_SIGNAL_READER_REGISTRATION(gdf, GDFFileSignalReader); //------------------------------------------------------------------------------------------------- GDFFileSignalReader::GDFFileSignalReader() : reader_ (0), downsampling_thread_ (0) { // nothing to do here } //------------------------------------------------------------------------------------------------- GDFFileSignalReader::~GDFFileSignalReader() { if (downsampling_thread_) { downsampling_thread_->terminate(); downsampling_thread_->wait(); } delete downsampling_thread_; if (reader_) { reader_->close (); delete reader_; } qDebug () << "deleting GDFFileSignalReader"; } //------------------------------------------------------------------------------------------------- QPair GDFFileSignalReader::createInstance (QString const& file_path) { GDFFileSignalReader* reader = new GDFFileSignalReader (); QString error = reader->open (file_path); if (error.size()) return QPair (0, error); else return QPair (reader, ""); } //------------------------------------------------------------------------------------------------- QSharedPointer GDFFileSignalReader::getSignalData (ChannelID channel_id, unsigned start_sample, unsigned length) const { if (channel_map_.size() == 0) { QList > data_for_downsampling; unsigned max_channel_length = 0; for (unsigned channel_index = 0; channel_index < reader_->getMainHeader_readonly().get_num_signals(); channel_index++) { unsigned current_channel_length = reader_->getSignalHeader_readonly(channel_index).get_samples_per_record() * reader_->getMainHeader_readonly().get_num_datarecords(); max_channel_length = std::max (max_channel_length, current_channel_length); QSharedPointer data (new GDFDataBlock (cache_, channel_index, current_channel_length, reader_->getSignalHeader_readonly(channel_index).get_samplerate())); channel_map_[channel_index] = data; data_for_downsampling.append (data); } downsampling_thread_ = new DownSamplingThread (data_for_downsampling, 3, max_channel_length / 2000); downsampling_thread_->start (QThread::LowestPriority); } return channel_map_[channel_id]->createSubBlock (start_sample, length); } //------------------------------------------------------------------------------------------------- QList > GDFFileSignalReader::getEvents () const { try { //qDebug () << "Number events " << reader_->getEventHeader()->getNumEvents() << "; Event Mode = " << reader_->getEventHeader()->getMode(); if (events_.size ()) return events_; std::vector mode_3_events; if (reader_->getEventHeader()->getMode() == 1) mode_3_events = gdf::convertMode1EventsIntoMode3Events (reader_->getEventHeader()->getMode1Events()); else mode_3_events = reader_->getEventHeader()->getMode3Events(); for (unsigned index = 0; index < mode_3_events.size (); index++) { gdf::Mode3Event& gdf_event = mode_3_events[index]; QSharedPointer event (new SignalEvent (gdf_event.position / header_->getDownSamplingFactor(), gdf_event.type, reader_->getEventHeader()->getSamplingRate() / header_->getDownSamplingFactor(), gdf_event.channel - 1, gdf_event.duration / header_->getDownSamplingFactor())); events_.push_back (event); } } catch (...) { //QMessageBox::critical (0, "Error", tr(exc.what())); } return events_; } //------------------------------------------------------------------------------------------------- QSharedPointer GDFFileSignalReader::getBasicHeader () { return header_; } //------------------------------------------------------------------------------------------------- QString GDFFileSignalReader::open (QString const& file_path) { if (reader_) delete reader_; reader_ = new gdf::Reader (); reader_->enableCache (false); try { reader_->open (file_path.toStdString()); } catch (std::exception& exc) { return QString (exc.what ()); } header_ = QSharedPointer (new GDFBasicHeader (file_path, reader_->getHeaderAccess_readonly())); cache_ = QSharedPointer (new GDFSignalCache (reader_)); return ""; } } // namespace sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_file_signal_reader.h000066400000000000000000000042221154433734200265130ustar00rootroot00000000000000#ifndef GDF_FILE_SIGNAL_READER_H #define GDF_FILE_SIGNAL_READER_H #include "file_handling/file_signal_reader.h" #include "gdf_basic_header.h" #include "gdf_signal_cache.h" #include "gdf_data_block.h" #include "../down_sampling_thread.h" #include "GDF/Reader.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- class GDFFileSignalReader : public QObject, public FileSignalReader { Q_OBJECT public: //------------------------------------------------------------------------- GDFFileSignalReader (); //------------------------------------------------------------------------- virtual ~GDFFileSignalReader(); //------------------------------------------------------------------------- QPair createInstance (QString const& file_path); //------------------------------------------------------------------------- virtual QSharedPointer getSignalData (ChannelID channel_id, unsigned start_sample, unsigned length) const; //------------------------------------------------------------------------- virtual QList > getEvents () const; //------------------------------------------------------------------------- virtual QSharedPointer getBasicHeader (); //------------------------------------------------------------------------- virtual QSharedPointer getBasicHeader () const {return header_;} private: //------------------------------------------------------------------------- QString open (QString const& file_path); Q_DISABLE_COPY(GDFFileSignalReader) gdf::Reader* reader_; mutable DownSamplingThread* downsampling_thread_; QSharedPointer cache_; QSharedPointer header_; mutable QMap > channel_map_; mutable QList > events_; }; } // namespace #endif // GDF_FILE_SIGNAL_READER_H sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_file_signal_writer.cpp000066400000000000000000000126251154433734200271260ustar00rootroot00000000000000#include "gdf_file_signal_writer.h" #include "file_handling/file_signal_writer_factory.h" #include "../file_handler_factory_registrator.h" #include "gui/progress_bar.h" #include "biosig.h" #include #include #include #include namespace SigViewer_ { //FILE_SIGNAL_WRITER_REGISTRATION(gdf, GDFFileSignalWriter); //------------------------------------------------------------------------- GDFFileSignalWriter::GDFFileSignalWriter() { qDebug() << "GDFFileSignalWriter constructed!"; } //------------------------------------------------------------------------- GDFFileSignalWriter::GDFFileSignalWriter (QString const& file_path) : new_file_path_ (file_path) { // nothing to do here } //------------------------------------------------------------------------- QPair GDFFileSignalWriter::createInstance (QString const& file_path) { return QPair (new GDFFileSignalWriter (file_path), ""); } //------------------------------------------------------------------------- QString GDFFileSignalWriter::saveEventsToSignalFile (QSharedPointer event_manager, std::set const& types) { gdf::Modifier modifier; modifier.open (new_file_path_.toStdString()); gdf::EventHeader* event_header = modifier.getEventHeader(); float32 event_sampling_rate = event_header->getSamplingRate(); event_header->clear(); event_header->setMode (3); event_header->setSamplingRate (event_sampling_rate); QList events; foreach (EventType type, types) events.append(event_manager->getEvents(type)); for (int index = 0; index < events.size(); index++) { gdf::Mode3Event gdf_event; QSharedPointer event = event_manager->getEvent(events[index]); if (event->getChannel() == UNDEFINED_CHANNEL) gdf_event.channel = 0; else gdf_event.channel = event->getChannel() + 1; gdf_event.duration = event->getDurationInSec() * event_sampling_rate; gdf_event.type = event->getType(); gdf_event.position = event->getPositionInSec() * event_sampling_rate; event_header->addEvent (gdf_event); } event_header->sort (); modifier.saveChanges (); modifier.close (); return ""; } //------------------------------------------------------------------------- QString GDFFileSignalWriter::save (QSharedPointer file_context, std::set const&) { qDebug () << "GDFFileSignalWriter::save"; gdf::Writer writer; writer.getMainHeader ().set_recording_id (file_context->getFileName().append(" converted to GDF2").toStdString()); // GDFWriter writer (new_file_path_.toStdString()); ChannelManager const& channel_manager = file_context->getChannelManager(); foreach (ChannelID channel, channel_manager.getChannels()) { writer.createSignal (channel); writer.getSignalHeader(channel).set_label (channel_manager.getChannelLabel (channel).toStdString()); writer.getSignalHeader(channel).set_datatype (gdf::FLOAT64); writer.getSignalHeader(channel).set_samplerate (channel_manager.getSampleRate()); writer.getSignalHeader(channel).set_digmin (-1); writer.getSignalHeader(channel).set_digmax (1); writer.getSignalHeader(channel).set_physmin (channel_manager.getMinValue (channel)); writer.getSignalHeader(channel).set_physmax (channel_manager.getMaxValue (channel)); } try { writer.setEventMode (3); writer.open (new_file_path_.toStdString(), gdf::writer_ev_memory | gdf::writer_overwrite); } catch (gdf::exception::header_issues &exception) { QString errors; if (exception.warnings.size () > 0) { foreach (std::string error, exception.errors) errors.append (error.c_str()); QMessageBox::warning (0, "Warning", errors); } if (exception.errors.size () > 0) { foreach (std::string error, exception.errors) errors.append (error.c_str()); return errors; } } try { QString progressbar_string = "Writing samples..."; for (unsigned sample_index = 0; sample_index < channel_manager.getNumberSamples(); sample_index++) { foreach (ChannelID channel_id, channel_manager.getChannels()) { writer.addSamplePhys (channel_id, (*(channel_manager.getData (channel_id, sample_index, 1)))[0]); } ProgressBar::instance().increaseValue (1, progressbar_string); } progressbar_string = "Writing events..."; QSharedPointer event_manager = file_context->getEventManager(); if (!event_manager.isNull()) { foreach (EventID event_id, event_manager->getAllEvents()) { QSharedPointer event = event_manager->getEvent(event_id); writer.addEvent (event->getPosition()+1, event->getType(), event->getChannel()+1, event->getDuration()); ProgressBar::instance().increaseValue (1, progressbar_string); } } } catch (std::exception & exception) { return exception.what(); } writer.close(); return ""; } } sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_file_signal_writer.h000066400000000000000000000024151154433734200265670ustar00rootroot00000000000000#ifndef GDF_WRITER_H #define GDF_WRITER_H #include "file_handling/file_signal_writer.h" namespace SigViewer_ { //----------------------------------------------------------------------------- class GDFFileSignalWriter : public FileSignalWriter { public: //------------------------------------------------------------------------- GDFFileSignalWriter (); //------------------------------------------------------------------------- virtual QPair createInstance (QString const& file_path); //------------------------------------------------------------------------- virtual bool supportsSavingEvents () const {return true;} //------------------------------------------------------------------------- virtual QString saveEventsToSignalFile (QSharedPointer, std::set const& types); //------------------------------------------------------------------------- virtual QString save (QSharedPointer file_context, std::set const& types); private: GDFFileSignalWriter (QString const& file_path); QString new_file_path_; Q_DISABLE_COPY(GDFFileSignalWriter) }; } #endif // GDF_WRITER_H sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_load_data_thread.cpp000066400000000000000000000010001154433734200264760ustar00rootroot00000000000000#include "gdf_load_data_thread.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- GDFLoadDataThread::GDFLoadDataThread(QObject *parent) : QThread(parent) { } //----------------------------------------------------------------------------- void GDFLoadDataThread::setNextIndex (unsigned sample_index) { } //----------------------------------------------------------------------------- void GDFLoadDataThread::run () { } } sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_load_data_thread.h000066400000000000000000000011371154433734200261560ustar00rootroot00000000000000#ifndef GDF_LOAD_DATA_THREAD_H #define GDF_LOAD_DATA_THREAD_H #include #include namespace SigViewer_ { class GDFLoadDataThread : public QThread { Q_OBJECT public: explicit GDFLoadDataThread (QVector& channel_buffers_, QObject *parent = 0); void setNextIndex (unsigned sample_index); private: virtual void run (); bool currently_loading_; unsigned next_index_; unsigned current_index_; bool running_; QMutex current_index_mutex_; QMutex next_index_mutex_; QMutex currently_loading_mutex_; }; } #endif // GDF_LOAD_DATA_THREAD_H sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_signal_cache.cpp000066400000000000000000000102311154433734200256450ustar00rootroot00000000000000#include "gdf_signal_cache.h" #include #include #include namespace SigViewer_ { unsigned const GDFSignalCache::CACHE_SIZE_PER_CHANNEL_ = 5000; //----------------------------------------------------------------------------- GDFSignalCache::GDFSignalCache (gdf::Reader* reader) : reader_ (reader) { qDebug () << "GDFSignalCache::GDFSignalCache"; } //----------------------------------------------------------------------------- GDFSignalCache::~GDFSignalCache () { foreach (QVector channel_buffer, channel_buffers_) { foreach (double* double_buffer, channel_buffer) { delete[] double_buffer; } } } //----------------------------------------------------------------------------- float32 GDFSignalCache::getSample (ChannelID channel, unsigned sample_index) { QMutexLocker locker (&rebuild_mutex_); if (!thread_cache_index_map_.contains (QThread::currentThread())) createNewThreadCacheIndex (); unsigned cache_index = thread_cache_index_map_[QThread::currentThread()]; if (!hasSampleIndex (cache_index, channel, sample_index)) rebuildCache (cache_index, channel, sample_index); return channel_buffers_[cache_index][channel][((sample_index - start_[cache_index][channel]) + cyclic_start_[cache_index][channel]) % CACHE_SIZE_PER_CHANNEL_]; } //----------------------------------------------------------------------------- bool GDFSignalCache::hasSampleIndex (unsigned cache_index, ChannelID channel, unsigned sample_index) const { return (sample_index >= start_[cache_index][channel]) && (sample_index < (start_[cache_index][channel] + CACHE_SIZE_PER_CHANNEL_)); } //----------------------------------------------------------------------------- void GDFSignalCache::rebuildCache (unsigned cache_index, ChannelID /*channel*/, unsigned sample_index) { // QMutexLocker locker (&rebuild_mutex_); size_t start = sample_index; // if (start > CACHE_SIZE_PER_CHANNEL_ / 2) // start -= CACHE_SIZE_PER_CHANNEL_ / 2; // else // start = 0; qDebug () << "GDFSignalCache::rebuildCache " << cache_index << " for thread " << thread_cache_index_map_.key (cache_index) << "; start = " << start; reader_->enableCache (true); //reader_->initCache(); for (int index = 0; index < channel_buffers_[cache_index].size (); index++) { // size_t old_start = start_[cache_index][index]; // size_t old_end = std::min(old_start + CACHE_SIZE_PER_CHANNEL_, reader_->getSignalHeader_readonly(index).get_samples_per_record() * reader_->getMainHeader_readonly().get_num_datarecords()); // unsigned old_cyclic_start = cyclic_start_[cache_index][index]; start_[cache_index][index] = start; size_t end = std::min(start + CACHE_SIZE_PER_CHANNEL_, reader_->getSignalHeader_readonly(index).get_samples_per_record() * reader_->getMainHeader_readonly().get_num_datarecords()); // unsigned cyclic_start = 0; // if (start > old_start && start < old_end) // { // cyclic_start = start - old_start; // } reader_->getSignal (index, channel_buffers_[cache_index][index], start, end); } reader_->resetCache (); } //----------------------------------------------------------------------------- unsigned GDFSignalCache::createNewThreadCacheIndex () { // QMutexLocker locker (&rebuild_mutex_); unsigned new_cache_index = channel_buffers_.size(); qDebug () << "GDFSignalCache::createNewThreadCacheIndex for thread " << QThread::currentThread() << "; new cache index = " << new_cache_index; channel_buffers_.append (QVector ()); start_.push_back (QVector ()); cyclic_start_.push_back (QVector ()); for (unsigned index = 0; index < reader_->getMainHeader_readonly().get_num_signals(); index++) { channel_buffers_[new_cache_index].push_back (new double[CACHE_SIZE_PER_CHANNEL_]); start_[new_cache_index].push_back (std::numeric_limits::max()); cyclic_start_[new_cache_index].push_back (0); } thread_cache_index_map_[QThread::currentThread()] = new_cache_index; return new_cache_index; } } sigviewer-0.5.1+svn556/src/file_handling_impl/gdf/gdf_signal_cache.h000066400000000000000000000020401154433734200253110ustar00rootroot00000000000000#ifndef GDF_SIGNAL_CACHE_H #define GDF_SIGNAL_CACHE_H #include "../signal_cache.h" #include "GDF/Reader.h" #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- class GDFSignalCache : public SignalCache { public: GDFSignalCache (gdf::Reader* reader); virtual ~GDFSignalCache (); virtual float32 getSample (ChannelID channel, unsigned sample_index); private: bool hasSampleIndex (unsigned cache_index, ChannelID channel, unsigned sample_index) const; void rebuildCache (unsigned cache_index, ChannelID channel, unsigned sample_index); unsigned createNewThreadCacheIndex (); gdf::Reader* reader_; static unsigned const CACHE_SIZE_PER_CHANNEL_; QList > channel_buffers_; QVector > start_; QVector > cyclic_start_; QMap thread_cache_index_map_; QMutex rebuild_mutex_; }; } #endif // GDF_SIGNAL_CACHE_H sigviewer-0.5.1+svn556/src/file_handling_impl/signal_cache.h000066400000000000000000000004301154433734200237320ustar00rootroot00000000000000#ifndef SIGNAL_CACHE_H #define SIGNAL_CACHE_H #include "base/sigviewer_user_types.h" namespace SigViewer_ { class SignalCache { public: virtual ~SignalCache () {} virtual float32 getSample (ChannelID channel, unsigned sample_index) = 0; }; } #endif // SIGNAL_CACHE_H sigviewer-0.5.1+svn556/src/file_handling_impl/sinus_dummy_header.cpp000066400000000000000000000003011154433734200255460ustar00rootroot00000000000000#include "sinus_dummy_header.h" namespace SigViewer_ { SinusDummyHeader::SinusDummyHeader() : BasicHeader ("") { setSampleRate (100); setFileTypeString("sinus dummy v1.0"); } } sigviewer-0.5.1+svn556/src/file_handling_impl/sinus_dummy_header.h000066400000000000000000000016001154433734200252160ustar00rootroot00000000000000#ifndef SINUS_DUMMY_HEADER_H #define SINUS_DUMMY_HEADER_H #include "file_handling/basic_header.h" namespace SigViewer_ { class SinusDummyHeader : public BasicHeader { public: //------------------------------------------------------------------------- SinusDummyHeader (); //------------------------------------------------------------------------- virtual uint32 getNumberOfSamples () const {return 10000;} //------------------------------------------------------------------------- void addDummyChannel (ChannelID id, QSharedPointer channel) { addChannel (id, channel); } //------------------------------------------------------------------------- virtual QMap getNamesOfUserSpecificEvents () const {return QMap();} }; } // namespace SigViewer_ #endif // SINUS_DUMMY_HEADER_H sigviewer-0.5.1+svn556/src/file_handling_impl/sinus_dummy_reader.cpp000066400000000000000000000055231154433734200255730ustar00rootroot00000000000000#include "sinus_dummy_reader.h" #include "file_handler_factory_registrator.h" #include "sinus_dummy_header.h" #include "base/signal_channel.h" #include "base/fixed_data_block.h" #include #include #include using namespace std; namespace SigViewer_ { //----------------------------------------------------------------------------- FILE_SIGNAL_READER_REGISTRATION(sinusdummy, SinusDummyReader); //----------------------------------------------------------------------------- SinusDummyReader::SinusDummyReader () { QSharedPointer header (new SinusDummyHeader); for (int i = 0; i < 10; i++) { QSharedPointer > data (new QVector); for (float sample_index = 0; sample_index < 10000; sample_index++) data->push_back (sin(sample_index / ((i*i+1)))); QSharedPointer data_block (new FixedDataBlock (data, 100)); data_.insert(i, data_block); QSharedPointer channel (new SignalChannel(i, QString::number(i))); header->addDummyChannel(i, channel); header_ = header; } for (int i = 0; i < 40; i++) { QSharedPointer event (new SignalEvent ((i) * 200, 1, 100, UNDEFINED_CHANNEL, 75)); events_.push_back (event); if ((i % 10) == 0) { event = QSharedPointer (new SignalEvent((i) * 200, 2, 100, UNDEFINED_CHANNEL, 500)); events_.push_back (event); } } header_->setEventSamplerate(100); header_->setNumberEvents(events_.size()); } //------------------------------------------------------------------------- SinusDummyReader::~SinusDummyReader() { qDebug () << "deleting SinusDummyReader"; } //------------------------------------------------------------------------- QPair SinusDummyReader::createInstance (QString const&) { qDebug () << "creating SinusDummyReader"; return QPair (new SinusDummyReader, ""); } //------------------------------------------------------------------------- QSharedPointer SinusDummyReader::getSignalData (ChannelID channel_id, unsigned start_sample, unsigned length) const { return data_[channel_id]->createSubBlock(start_sample, length); } //------------------------------------------------------------------------- QList > SinusDummyReader::getEvents () const { return events_; } //------------------------------------------------------------------------- QSharedPointer SinusDummyReader::getBasicHeader () { return header_; } } sigviewer-0.5.1+svn556/src/file_handling_impl/sinus_dummy_reader.h000066400000000000000000000027131154433734200252360ustar00rootroot00000000000000#ifndef SINUS_DUMMY_READER_H #define SINUS_DUMMY_READER_H #include "file_handling/file_signal_reader.h" #include "base/data_block.h" #include namespace SigViewer_ { class SinusDummyReader : public FileSignalReader { public: SinusDummyReader (); virtual ~SinusDummyReader(); //------------------------------------------------------------------------- virtual QPair createInstance (QString const& file_path); //------------------------------------------------------------------------- virtual QSharedPointer getSignalData (ChannelID channel_id, unsigned start_sample, unsigned length) const; //------------------------------------------------------------------------- virtual QList > getEvents () const; //------------------------------------------------------------------------- virtual QSharedPointer getBasicHeader (); //------------------------------------------------------------------------- virtual QSharedPointer getBasicHeader () const {return header_;} private: QMap > data_; QList > events_; QSharedPointer header_; }; } // namespace SigViewer_ #endif // SINUS_DUMMY_READER_H sigviewer-0.5.1+svn556/src/gui/000077500000000000000000000000001154433734200161445ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/gui/application_context.h000066400000000000000000000034331154433734200223670ustar00rootroot00000000000000#ifndef APPLICATION_CONTEXT_H #define APPLICATION_CONTEXT_H #include "color_manager.h" #include "main_window_model.h" #include "command_executer.h" #include "tab_context.h" #include namespace SigViewer_ { enum ApplicationMode { APPLICATION_TEST_MODE, APPLICATION_NON_GUI_MODE }; ///---------------------------------------------------------------------------- /// ApplicationContext class ApplicationContext { public: //------------------------------------------------------------------------- virtual ~ApplicationContext () {} //------------------------------------------------------------------------- virtual bool modeActivated (ApplicationMode mode) const = 0; //------------------------------------------------------------------------- virtual QSharedPointer getCurrentFileContext () = 0; //------------------------------------------------------------------------- virtual void removeCurrentFileContext () = 0; //------------------------------------------------------------------------- virtual void addFileContext (QSharedPointerfile_context) = 0; //------------------------------------------------------------------------- virtual void setCurrentTabContext (QSharedPointer tab_context) = 0; //------------------------------------------------------------------------- virtual QSharedPointer getCurrentCommandExecuter () = 0; //------------------------------------------------------------------------- virtual QSharedPointer getMainWindowModel () = 0; //------------------------------------------------------------------------- virtual QSharedPointer getEventColorManager () = 0; }; } #endif // APPLICATION_CONTEXT_H sigviewer-0.5.1+svn556/src/gui/background_processes.cpp000066400000000000000000000014571154433734200230640ustar00rootroot00000000000000#include "background_processes.h" namespace SigViewer_ { //------------------------------------------------------------------------- BackgroundProcesses& BackgroundProcesses::instance () { static BackgroundProcesses instance; return instance; } //------------------------------------------------------------------------- void BackgroundProcesses::addProcess (QString const& name, int max) { emit newProcess (name, max); } //------------------------------------------------------------------------- void BackgroundProcesses::setProcessState (QString const& name, int state) { emit processChangedState (name, state); } //------------------------------------------------------------------------- void BackgroundProcesses::removeProcess (QString const& name) { emit processRemoved (name); } } sigviewer-0.5.1+svn556/src/gui/background_processes.h000066400000000000000000000017371154433734200225320ustar00rootroot00000000000000#ifndef BACK_GROUND_PROCESSES_H #define BACK_GROUND_PROCESSES_H #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- class BackgroundProcesses : public QObject { Q_OBJECT public: //------------------------------------------------------------------------- static BackgroundProcesses& instance (); //------------------------------------------------------------------------- void addProcess (QString const& name, int max); //------------------------------------------------------------------------- void setProcessState (QString const& name, int state); //------------------------------------------------------------------------- void removeProcess (QString const& name); signals: void newProcess (QString name, int max); void processChangedState (QString name, int state); void processRemoved (QString name); }; } #endif // BACK_GROUND_PROCESSES_H sigviewer-0.5.1+svn556/src/gui/color_manager.cpp000066400000000000000000000171311154433734200214630ustar00rootroot00000000000000#include "color_manager.h" #include #include #include #include namespace SigViewer_ { const char* ColorManager::DEFAULT_CHANNEL_COLOR_SETTING_ = "Default Channel Color"; //----------------------------------------------------------------------------- ColorManager::ColorManager () { qDebug() << "constructing event color manager"; loadDefaultEventColors (); loadSettings(); } //----------------------------------------------------------------------------- ColorManager::~ColorManager () { qDebug() << "destructing event color manager"; } //----------------------------------------------------------------------------- QColor ColorManager::getChannelColor (ChannelID channel_id) const { if (channel_color_map_.contains (channel_id)) return channel_color_map_[channel_id]; else return default_channel_color_; } //----------------------------------------------------------------------------- QColor ColorManager::getDefaultChannelColor () const { return default_channel_color_; } //----------------------------------------------------------------------------- void ColorManager::setDefaultChannelColor (QColor const& color) { default_channel_color_ = color; QSettings settings ("SigViewer"); settings.beginGroup ("ColorManager"); settings.setValue (DEFAULT_CHANNEL_COLOR_SETTING_, color); settings.endGroup (); default_channel_color_ = color; } //----------------------------------------------------------------------------- void ColorManager::setChannelColor (ChannelID channel_id, QColor const& color) { channel_color_map_[channel_id] = color; } //----------------------------------------------------------------------------- QColor ColorManager::getEventColor (EventType type) const { if (type == 800) qDebug () << "ups"; EventColorMap::const_iterator it = event_type2color_.find(type); if (it == event_type2color_.end()) { if (default_event_colors_.contains (type)) return default_event_colors_[type]; else return default_event_color_; } else return *it; } //----------------------------------------------------------------------------- QColor ColorManager::getDefaultEventColor (EventType type) const { if (default_event_colors_.contains (type)) return default_event_colors_[type]; else return default_event_color_; } //----------------------------------------------------------------------------- void ColorManager::setEventColor (EventType type, const QColor& color) { event_type2color_[type] = color; } //----------------------------------------------------------------------------- bool ColorManager::isDark (QColor const& color) { double alpha_factor = color.alpha() / 255.0; double tmp = 255 * (1 - alpha_factor); float64 y = 0.299 * (tmp + color.red() * alpha_factor)+ 0.587 * (tmp + color.green() * alpha_factor) + 0.114 * (tmp + color.blue() * alpha_factor); return y < 127; } //----------------------------------------------------------------------------- void ColorManager::loadSettings() { // get event types from event table reader QColor alpha_color(0, 0, 0, 50); event_type2color_[-1] = alpha_color; EventTableFileReader::IntIterator it; for (it = event_table_file_reader_.eventTypesBegin(); it != event_table_file_reader_.eventTypesEnd(); it++) { event_type2color_[*it] = default_event_colors_[*it]; } QSettings settings("SigViewer"); settings.beginGroup("ColorManager"); default_channel_color_ = Qt::darkBlue; if (settings.contains (DEFAULT_CHANNEL_COLOR_SETTING_)) default_channel_color_ = settings.value (DEFAULT_CHANNEL_COLOR_SETTING_).value(); else settings.setValue (DEFAULT_CHANNEL_COLOR_SETTING_, default_channel_color_); int size = settings.beginReadArray("event"); for (int i = 0; i < size; i++) { settings.setArrayIndex(i); int32 id = settings.value("id").toInt(); QColor color = settings.value("color").toString(); color.setAlpha(settings.value("alpha").toInt()); event_type2color_[id] = color; } settings.endArray(); size = settings.beginReadArray("channel"); for (int i = 0; i < size; i++) { settings.setArrayIndex(i); ChannelID id = settings.value("id").toInt (); QColor color = settings.value("color").toString(); channel_color_map_[id] = color; } settings.endArray(); settings.endGroup(); } //----------------------------------------------------------------------------- void ColorManager::saveSettings() { qDebug() << "color manager save settings"; QSettings settings("SigViewer"); settings.beginGroup("ColorManager"); settings.beginWriteArray("event"); int32 i = 0; for (EventColorMap::const_iterator it = event_type2color_.begin(); it != event_type2color_.end(); it++) { if (it.key() == UNDEFINED_EVENT_TYPE) { continue; } settings.setArrayIndex(i++); settings.setValue("id", it.key()); settings.setValue("color", it->name()); settings.setValue("alpha", it->alpha()); } settings.endArray(); i = 0; settings.beginWriteArray("channel"); foreach (ChannelID id, channel_color_map_.keys ()) { settings.setArrayIndex (i++); settings.setValue ("id", id); settings.setValue ("color", channel_color_map_[id]); } settings.endArray(); settings.endGroup(); } //----------------------------------------------------------------------------- void ColorManager::loadDefaultEventColors () { QFile color_settings_file (":/color_settings.xml"); QDomDocument color_doc; QString error_msg; int error_line; color_doc.setContent (&color_settings_file, true, &error_msg, &error_line); QDomElement root = color_doc.documentElement(); QDomNodeList default_elements = root.elementsByTagName("default"); if (default_elements.size() != 1) return; QDomElement default_node = default_elements.at(0).toElement(); QColor default_color; default_color.setAlpha (default_node.attribute("alpha").toUInt()); default_color.setRed (default_node.attribute("red").toUInt()); default_color.setGreen (default_node.attribute("green").toUInt()); default_color.setBlue (default_node.attribute("blue").toUInt()); default_event_colors_[UNDEFINED_EVENT_TYPE] = default_color; default_event_color_ = default_color; QDomNodeList event_elements = root.elementsByTagName("event"); for (int index = 0; index < event_elements.size(); index++) { QDomElement element = event_elements.at(index).toElement(); QColor event_color = default_color; if (element.hasAttribute("red")) event_color.setRed(element.attribute("red").toUInt()); if (element.hasAttribute("green")) event_color.setGreen(element.attribute("green").toUInt()); if (element.hasAttribute("blue")) event_color.setBlue(element.attribute("blue").toUInt()); if (element.hasAttribute("alpha")) event_color.setAlpha(element.attribute("alpha").toUInt()); default_event_colors_[element.attribute("type").toInt(0, 16)] = event_color; } EventTableFileReader::IntIterator it; for (it = event_table_file_reader_.eventTypesBegin(); it != event_table_file_reader_.eventTypesEnd(); it++) { if (!default_event_colors_.contains(*it)) default_event_colors_[*it] = default_color; } } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui/color_manager.h000066400000000000000000000025101154433734200211230ustar00rootroot00000000000000#ifndef EVENT_COLOR_MANAGER #define EVENT_COLOR_MANAGER #include "base/sigviewer_user_types.h" #include "file_handling_impl/event_table_file_reader.h" #include #include #include namespace SigViewer_ { // color manager class ColorManager { public: ColorManager (); ~ColorManager (); void saveSettings(); QColor getChannelColor (ChannelID channel_id) const; QColor getDefaultChannelColor () const; void setDefaultChannelColor (QColor const& color); void setChannelColor (ChannelID channel_id, QColor const& color); QColor getEventColor (EventType type) const; QColor getDefaultEventColor (EventType type = UNDEFINED_EVENT_TYPE) const; void setEventColor (EventType type, const QColor& color); static bool isDark (QColor const& color); private: Q_DISABLE_COPY(ColorManager) void loadSettings(); void loadDefaultEventColors (); static const char* DEFAULT_CHANNEL_COLOR_SETTING_; QColor default_channel_color_; QColor default_event_color_; typedef QMap EventColorMap; typedef QMap ChannelColorMap; EventColorMap event_type2color_; EventColorMap default_event_colors_; ChannelColorMap channel_color_map_; EventTableFileReader event_table_file_reader_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/gui/event_view.h000066400000000000000000000035031154433734200204710ustar00rootroot00000000000000#ifndef EVENT_VIEW_H #define EVENT_VIEW_H #include "base/sigviewer_user_types.h" #include "file_handling/event_manager.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- class EventView { public: //------------------------------------------------------------------------- EventView (bool events_hidable = true, bool events_slidable = true) : events_hidable_ (events_hidable), events_slidable_ (events_slidable) {} //------------------------------------------------------------------------- virtual ~EventView () {} //------------------------------------------------------------------------- virtual bool eventsHidable () const {return events_hidable_;} //------------------------------------------------------------------------- virtual bool eventsSlidable () const {return events_slidable_;} //------------------------------------------------------------------------- virtual void setShownEventTypes (std::set const& event_types) = 0; //------------------------------------------------------------------------- virtual std::set getShownEventTypes () const = 0; //------------------------------------------------------------------------- virtual QSharedPointer getEventManager () const = 0; //------------------------------------------------------------------------- virtual QSharedPointer getEventManager () = 0; //------------------------------------------------------------------------- /// @return the id of the currently selected signal event virtual QList getSelectedEvents () const = 0; private: bool events_hidable_; bool events_slidable_; }; } #endif // EVENT_VIEW_H sigviewer-0.5.1+svn556/src/gui/gui.pri000066400000000000000000000011761154433734200174510ustar00rootroot00000000000000HEADERS += gui/gui_action_command.h \ gui/gui_action_factory.h \ gui/gui_action_factory_registrator.h \ gui/main_window_model.h \ gui/signal_visualisation_model.h \ gui/signal_visualisation_modes.h \ gui/color_manager.h \ gui/signal_visualisation_view.h \ gui/application_context.h \ gui/progress_bar.h \ gui/event_view.h \ gui/signal_view_settings.h \ gui/background_processes.h SOURCES += gui/gui_action_command.cpp \ gui/color_manager.cpp \ gui/gui_action_factory.cpp \ gui/signal_visualisation_model.cpp \ gui/signal_view_settings.cpp \ gui/background_processes.cpp sigviewer-0.5.1+svn556/src/gui/gui_action_command.cpp000066400000000000000000000220421154433734200224670ustar00rootroot00000000000000#include "gui_action_command.h" #include "gui_action_factory.h" #include "application_context_impl.h" #include namespace SigViewer_ { class GuiActionCommandException : public Exception { public: explicit GuiActionCommandException (QString const& action_id, std::string const& error) : Exception (std::string ("GuiActionCommand: \"") + action_id.toStdString () + "\" failed: " + error) {} }; //----------------------------------------------------------------------------- GuiActionCommand::GuiActionCommand (QStringList const& action_ids) : tab_edit_state_ (TAB_STATE_NO_REDO_NO_UNDO) { for (QStringList::const_iterator iter = action_ids.begin(); iter != action_ids.end(); ++iter) { action_map_[*iter] = new QAction (*iter, this); connectors_.push_back (new ActionConnector (this, *iter)); connectors_.last ()->connect (action_map_[*iter], SIGNAL(triggered()), SLOT(trigger())); connect (connectors_.last (), SIGNAL(triggered(QString const&)), SLOT(trigger(QString const&))); } qDebug () << "GuiActionCommand::GuiActionCommand connecting to ApplicationContextImpl::getInstance() = " << ApplicationContextImpl::getInstance(); if (!connect (ApplicationContextImpl::getInstance().data(), SIGNAL(stateChanged(ApplicationState)), SLOT(updateEnablednessToApplicationState(ApplicationState)))) throw (GuiActionCommandException (action_ids.first(), "connect to signal stateChanged(ApplicationState)")); else qDebug () << "GuiActionCommand::GuiActionCommand connect to signal stateChanged(ApplicationState) = true"; if (!connect (ApplicationContextImpl::getInstance().data(), SIGNAL(currentTabSelectionStateChanged(TabSelectionState)), SLOT(updateEnablednessToTabSelectionState (TabSelectionState)))) throw (GuiActionCommandException (action_ids.first(), "connect to signal currentTabSelectionStateChanged(TabSelectionState)")); if (!connect (ApplicationContextImpl::getInstance().data(), SIGNAL(currentTabEditStateChanged(TabEditState)), SLOT(updateEnablednessToTabEditState (TabEditState)))) throw (GuiActionCommandException (action_ids.first(), "connect to signal currentTabEditStateChanged(TabEditState)")); if (!connect (ApplicationContextImpl::getInstance().data(), SIGNAL(currentFileStateChanged(FileState)), SLOT(updateEnablednessToFileState (FileState)))) throw (GuiActionCommandException (action_ids.first(), "connect to signal currentFileStateChanged(FileState)")); } //----------------------------------------------------------------------------- QList GuiActionCommand::getQActions () { return action_map_.values (); } //----------------------------------------------------------------------------- QList GuiActionCommand::getActionIDs () const { return action_map_.keys (); } //----------------------------------------------------------------------------- QAction* GuiActionCommand::getQAction (QString const& id) { if (action_map_.contains (id)) return action_map_[id]; else throw GuiActionCommandException (id, "not exists"); return 0; } //----------------------------------------------------------------------------- void GuiActionCommand::updateEnablednessToApplicationState (ApplicationState state) { app_state_ = state; applicationStateChanged (); evaluateEnabledness (); } //----------------------------------------------------------------------------- void GuiActionCommand::updateEnablednessToFileState (FileState state) { file_state_ = state; evaluateEnabledness (); } //----------------------------------------------------------------------------- void GuiActionCommand::updateEnablednessToTabSelectionState (TabSelectionState state) { tab_selection_state_ = state; evaluateEnabledness (); } //----------------------------------------------------------------------------- void GuiActionCommand::updateEnablednessToTabEditState (TabEditState state) { tab_edit_state_ = state; evaluateEnabledness (); } //----------------------------------------------------------------------------- void GuiActionCommand::resetActionTriggerSlot (QString const& action_id, const char* slot) { if (!action_map_.contains (action_id)) throw (GuiActionCommandException (action_id, "resetActionTriggerSlot, action not exists")); QAction* action = action_map_[action_id]; action->disconnect (SIGNAL(triggered())); if (!connect (action, SIGNAL(triggered()), slot)) throw (GuiActionCommandException (action_id, std::string ("connect triggered to ") + slot)); } //----------------------------------------------------------------------------- void GuiActionCommand::setShortcut (QString const& action_id, QKeySequence const& key_sequence) { if (!action_map_.contains (action_id)) throw (GuiActionCommandException (action_id, "setting shortcut, action not exists")); action_map_[action_id]->setShortcut (key_sequence); } //----------------------------------------------------------------------------- void GuiActionCommand::setIcon (QString const& action_id, QIcon const& icon) { if (!action_map_.contains (action_id)) throw (GuiActionCommandException (action_id, "setting icon, action not exists")); action_map_[action_id]->setIcon (icon); } //------------------------------------------------------------------------- void GuiActionCommand::evaluateEnabledness () { } //------------------------------------------------------------------------- QSharedPointer GuiActionCommand::currentEventView () { QSharedPointer event_view; QSharedPointer main_window_model = ApplicationContextImpl::getInstance()->getMainWindowModel (); if (!main_window_model.isNull()) event_view = main_window_model->getCurrentEventView (); return event_view; } //------------------------------------------------------------------------- QSharedPointer GuiActionCommand::currentVisModel () { QSharedPointer model; QSharedPointer main_window_model = ApplicationContextImpl::getInstance()->getMainWindowModel (); if (!main_window_model.isNull()) model = main_window_model->getCurrentSignalVisualisationModel(); return model; } //------------------------------------------------------------------------- QSharedPointer GuiActionCommand::currentSignalViewSettings () { QSharedPointer settings; QSharedPointer vis_model = currentVisModel(); if (!vis_model.isNull()) settings = vis_model->getSignalViewSettings(); return settings; } //------------------------------------------------------------------------- QSharedPointer GuiActionCommand::currentFileContext () { return ApplicationContextImpl::getInstance()->getCurrentFileContext(); } //------------------------------------------------------------------------- QSharedPointer GuiActionCommand::applicationContext () { return ApplicationContextImpl::getInstance(); } //------------------------------------------------------------------------- bool GuiActionCommand::disableIfNoSignalIsVisualised (QStringList const &actions) { bool no_signal_is_visualised = currentVisModel().isNull(); if (no_signal_is_visualised) foreach (QString action, actions) action_map_[action]->setDisabled (no_signal_is_visualised); return no_signal_is_visualised; } //------------------------------------------------------------------------- bool GuiActionCommand::disableIfNoEventsPossible (QStringList const &actions) { bool no_events_possible = false; if (!currentEventView().isNull()) { if (currentEventView()->getEventManager().isNull()) no_events_possible = true; } else no_events_possible = true; foreach (QString action, actions) action_map_[action]->setDisabled (no_events_possible); return no_events_possible; } //------------------------------------------------------------------------- void GuiActionCommand::disableIfNoEventSelected (QStringList const &actions) { bool no_event_selected = app_state_ == APP_STATE_NO_FILE_OPEN || tab_selection_state_ == TAB_STATE_NO_EVENT_SELECTED || tab_selection_state_ == NO_TAB_SELECTION_STATE; foreach (QString action, actions) action_map_[action]->setDisabled (no_event_selected); } //------------------------------------------------------------------------- bool GuiActionCommand::disableIfNoFileIsOpened (QStringList const &actions) { bool no_file_open = (app_state_ == APP_STATE_NO_FILE_OPEN); foreach (QString action, actions) action_map_[action]->setDisabled (no_file_open); return no_file_open; } } sigviewer-0.5.1+svn556/src/gui/gui_action_command.h000066400000000000000000000120301154433734200221300ustar00rootroot00000000000000#ifndef GUI_ACTION_COMMAND_H #define GUI_ACTION_COMMAND_H #include "application_context.h" #include "base/application_states.h" #include "base/tab_states.h" #include "base/file_states.h" #include "base/exception.h" #include "signal_visualisation_model.h" #include "event_view.h" #include "signal_view_settings.h" #include #include #include namespace SigViewer_ { class ActionConnector; class GuiActionCommand : public QObject { Q_OBJECT public: //------------------------------------------------------------------------- virtual ~GuiActionCommand () {} //------------------------------------------------------------------------- QList getQActions (); //------------------------------------------------------------------------- QList getActionIDs () const; //------------------------------------------------------------------------- virtual void init () = 0; public slots: //------------------------------------------------------------------------- virtual void trigger (QString const&) {} //------------------------------------------------------------------------- void updateEnablednessToApplicationState (ApplicationState state); //------------------------------------------------------------------------- void updateEnablednessToFileState (FileState state); //------------------------------------------------------------------------- void updateEnablednessToTabSelectionState (TabSelectionState state); //------------------------------------------------------------------------- void updateEnablednessToTabEditState (TabEditState state); //------------------------------------------------------------------------- QAction* getQAction (QString const& id); protected: //------------------------------------------------------------------------- GuiActionCommand (QStringList const& action_ids); //------------------------------------------------------------------------- void resetActionTriggerSlot (QString const& action_id, const char* slot); //------------------------------------------------------------------------- void setShortcut (QString const& action_id, QKeySequence const& key_sequence); //------------------------------------------------------------------------- void setIcon (QString const& action_id, QIcon const& icon); //------------------------------------------------------------------------- virtual void applicationStateChanged () {} //------------------------------------------------------------------------- virtual void evaluateEnabledness (); //------------------------------------------------------------------------- QSharedPointer currentEventView (); //------------------------------------------------------------------------- QSharedPointer currentVisModel (); //------------------------------------------------------------------------- QSharedPointer currentSignalViewSettings (); //------------------------------------------------------------------------- QSharedPointer currentFileContext (); //------------------------------------------------------------------------- QSharedPointer applicationContext (); //------------------------------------------------------------------------- ApplicationState getApplicationState () const {return app_state_;} //------------------------------------------------------------------------- FileState getFileState () const {return file_state_;} //------------------------------------------------------------------------- TabSelectionState getTabSelectionState () const {return tab_selection_state_;} //------------------------------------------------------------------------- TabEditState getTabEditState () const {return tab_edit_state_;} //------------------------------------------------------------------------- bool disableIfNoSignalIsVisualised (QStringList const &actions); //------------------------------------------------------------------------- bool disableIfNoEventsPossible (QStringList const &actions); //------------------------------------------------------------------------- void disableIfNoEventSelected (QStringList const &actions); //------------------------------------------------------------------------- bool disableIfNoFileIsOpened (QStringList const &actions); private: QMap action_map_; QList connectors_; ApplicationState app_state_; FileState file_state_; TabSelectionState tab_selection_state_; TabEditState tab_edit_state_; }; class ActionConnector : public QObject { Q_OBJECT public: ActionConnector (QObject* parent, QString const& name) : QObject (parent), name_ (name) {} public slots: void trigger () {emit triggered (name_);} signals: void triggered (QString const& name); private: QString name_; }; } #endif // GUI_ACTION_COMMAND_H sigviewer-0.5.1+svn556/src/gui/gui_action_factory.cpp000066400000000000000000000037011154433734200225210ustar00rootroot00000000000000#include "gui_action_factory.h" namespace SigViewer_ { GuiActionFactory* GuiActionFactory::instance_ = 0; //----------------------------------------------------------------------------- GuiActionFactory* GuiActionFactory::getInstance () { if (!instance_) { instance_ = new GuiActionFactory; } return instance_; } //----------------------------------------------------------------------------- void GuiActionFactory::registerCommand (QString const& name, QSharedPointer command) { command_map_[name] = command; QStringList action_ids = command->getActionIDs(); for (QStringList::const_iterator id_iter = action_ids.begin (); id_iter != action_ids.end (); ++id_iter) action_to_command_map_[*id_iter] = command; } //----------------------------------------------------------------------------- QList GuiActionFactory::getQActions (QString const& command_name) const { if (command_name.size() == 0) { QList actions; foreach (QSharedPointer command, command_map_.values()) actions.append (command->getQActions()); return actions; } else if (!command_map_.contains (command_name)) return QList(); else return command_map_[command_name]->getQActions (); } //----------------------------------------------------------------------------- QAction* GuiActionFactory::getQAction (QString const& action_id) const { if (!action_to_command_map_.contains (action_id)) return 0; else return action_to_command_map_[action_id]->getQAction (action_id); } //----------------------------------------------------------------------------- void GuiActionFactory::initAllCommands () { for (CommandMap::iterator cmd_iter = command_map_.begin (); cmd_iter != command_map_.end (); ++cmd_iter) cmd_iter.value()->init (); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui/gui_action_factory.h000066400000000000000000000022541154433734200221700ustar00rootroot00000000000000#ifndef GUI_ACTION_FACTORY_H #define GUI_ACTION_FACTORY_H #include "gui_action_command.h" #include #include #include #include namespace SigViewer_ { class GuiActionFactory { public: static GuiActionFactory* getInstance (); //------------------------------------------------------------------------- void registerCommand (QString const& name, QSharedPointer command); //------------------------------------------------------------------------- /// the caller must not delete QList getQActions (QString const& command_name = "") const; //------------------------------------------------------------------------- /// the caller must not delete QAction* getQAction (QString const& action_id) const; //------------------------------------------------------------------------- void initAllCommands (); private: static GuiActionFactory* instance_; typedef QMap > CommandMap; CommandMap command_map_; CommandMap action_to_command_map_; }; } // namespace SigViewer_ #endif // GUI_ACTION_FACTORY_H sigviewer-0.5.1+svn556/src/gui/gui_action_factory_registrator.h000066400000000000000000000010061154433734200246070ustar00rootroot00000000000000#ifndef GUI_ACTION_FACTORY_REGISTRATOR_H #define GUI_ACTION_FACTORY_REGISTRATOR_H #include "gui_action_command.h" #include "gui_action_factory.h" #include #include namespace SigViewer_ { class GuiActionFactoryRegistrator { public: GuiActionFactoryRegistrator (QString const& name, QSharedPointer command) { GuiActionFactory::getInstance()->registerCommand (name, command); } }; } // namespace SigViewer_ #endif // GUI_ACTION_FACTORY_REGISTRATOR_H sigviewer-0.5.1+svn556/src/gui/main_window_model.h000066400000000000000000000023351154433734200220130ustar00rootroot00000000000000#ifndef MAIN_WINDOW_MODEL_H #define MAIN_WINDOW_MODEL_H #include "signal_visualisation_model.h" #include "event_view.h" #include "file_context.h" namespace SigViewer_ { class MainWindowModel { public: //------------------------------------------------------------------------- virtual ~MainWindowModel () {} //------------------------------------------------------------------------- virtual void closeCurrentFileTabs () = 0; //------------------------------------------------------------------------- virtual QSharedPointer createSignalVisualisation (QString const& title, ChannelManager const& channel_manager) = 0; //------------------------------------------------------------------------- virtual QSharedPointer createSignalVisualisationOfFile (QSharedPointer file_ctx) = 0; //------------------------------------------------------------------------- virtual QSharedPointer getCurrentSignalVisualisationModel () = 0; //------------------------------------------------------------------------- virtual QSharedPointer getCurrentEventView () = 0; }; } #endif // MAIN_WINDOW_MODEL_H sigviewer-0.5.1+svn556/src/gui/progress_bar.h000066400000000000000000000031671154433734200210140ustar00rootroot00000000000000#ifndef PROGRESS_BAR_H #define PROGRESS_BAR_H #include "application_context.h" #include #include #include namespace SigViewer_ { class ProgressBar { public: static ProgressBar& instance () { static ProgressBar instance_; return instance_; } void initAndShow (int max_value, QString const& title, QSharedPointer app_context) { non_gui_mode_ = app_context->modeActivated (APPLICATION_NON_GUI_MODE); value_ = 0; max_value_ = max_value; if (non_gui_mode_) return; progress_dialog_ = new QProgressDialog; progress_dialog_->setModal (true); progress_dialog_->setMinimumDuration (2000); progress_dialog_->setWindowTitle (title); progress_dialog_->setMinimum (value_); progress_dialog_->setMaximum (max_value); progress_dialog_->setValue (value_); qDebug () << title << ": max_value = " << max_value; } void close () { delete progress_dialog_; } bool increaseValue (int step, QString const& description) { value_ += step; if (non_gui_mode_) return true; if (progress_dialog_.isNull()) return true; if (progress_dialog_->wasCanceled()) return false; progress_dialog_->setLabelText (description); progress_dialog_->setValue (value_); return true; } private: QPointer progress_dialog_; bool non_gui_mode_; int max_value_; int value_; }; } #endif // PROGRESS_BAR_H sigviewer-0.5.1+svn556/src/gui/signal_view_settings.cpp000066400000000000000000000036761154433734200231130ustar00rootroot00000000000000#include "signal_view_settings.h" namespace SigViewer_ { //----------------------------------------------------------------------------- SignalViewSettings::SignalViewSettings (ChannelManager const& channel_manager) : pixels_per_sample_ (1), channel_overlapping_ (0), channel_heigth_in_pixels_ (20), channel_manager_ (channel_manager) { grid_fragmentation_[Qt::Horizontal] = 10; grid_fragmentation_[Qt::Vertical] = 4; } //----------------------------------------------------------------------------- void SignalViewSettings::setPixelsPerSample (float pixels_per_sample) { float old_pixel_per_sample = pixels_per_sample_; pixels_per_sample_ = pixels_per_sample; if (old_pixel_per_sample != pixels_per_sample_) emit pixelsPerSampleChanged (); } //----------------------------------------------------------------------------- void SignalViewSettings::setChannelOverlapping (float channel_overlapping) { float old_channel_overlapping = channel_overlapping_; channel_overlapping_ = channel_overlapping; if (old_channel_overlapping != channel_overlapping_) emit channelOverlappingChanged (); } //------------------------------------------------------------------------- void SignalViewSettings::setChannelHeight (int channel_heigth_in_pixels) { int old_channel_height = channel_heigth_in_pixels_; channel_heigth_in_pixels_ = channel_heigth_in_pixels; if (old_channel_height != channel_heigth_in_pixels_) { emit channelHeightChanged (); emit channelHeightChanged (channel_heigth_in_pixels_); } } //------------------------------------------------------------------------- void SignalViewSettings::setGridFragmentation (Qt::Orientation orientation, int fragmentation) { int old_fragmentation = grid_fragmentation_[orientation]; grid_fragmentation_[orientation] = fragmentation; if (old_fragmentation != fragmentation) emit gridFragmentationChanged (); } } sigviewer-0.5.1+svn556/src/gui/signal_view_settings.h000066400000000000000000000070131154433734200225450ustar00rootroot00000000000000#ifndef SIGNAL_VIEW_SETTINGS_H #define SIGNAL_VIEW_SETTINGS_H #include "base/sigviewer_user_types.h" #include "file_handling/channel_manager.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// SignalViewSettings /// /// provides methods for changing the visualisation of a signal class SignalViewSettings : public QObject { Q_OBJECT Q_PROPERTY(float pixelsPerSample READ getPixelsPerSample WRITE setPixelsPerSample) Q_PROPERTY(float channelOverlapping READ getChannelOverlapping WRITE setChannelOverlapping) Q_PROPERTY(int channelHeight READ getChannelHeight WRITE setChannelHeight) public: //------------------------------------------------------------------------- SignalViewSettings (ChannelManager const& channel_manager); //------------------------------------------------------------------------- ChannelManager const& getChannelManager () const {return channel_manager_;} //------------------------------------------------------------------------- float getPixelsPerSample () const {return pixels_per_sample_;} //------------------------------------------------------------------------- float getChannelOverlapping () const {return channel_overlapping_;} //------------------------------------------------------------------------- int getChannelHeight () const {return channel_heigth_in_pixels_;} //------------------------------------------------------------------------- float getSampleRate () const {return channel_manager_.getSampleRate();} //------------------------------------------------------------------------- int getGridFragmentation (Qt::Orientation orientation) const {return grid_fragmentation_[orientation];} //------------------------------------------------------------------------- /// @return a set of ids of the shown channels //std::set getShownChannels () const {return shown_channels_;} public slots: //------------------------------------------------------------------------- void setPixelsPerSample (float pixel_per_sample); //------------------------------------------------------------------------- void setChannelOverlapping (float channel_overlapping); //------------------------------------------------------------------------- void setChannelHeight (int channel_heigth_in_pixels); //------------------------------------------------------------------------- void setGridFragmentation (Qt::Orientation orientation, int fragmentation); //------------------------------------------------------------------------- /// @param channels a set of ids of channels that should be visible //void setShownChannels (std::set const& channels) {shown_channels_ = channels; // shownChannelsChanged (shown_channels_);} //------------------------------------------------------------------------- //virtual QSharedPointer getChannelManager () const = 0; signals: void pixelsPerSampleChanged (); void channelOverlappingChanged (); void channelHeightChanged (); void channelHeightChanged (unsigned channel_height_in_pixel); void gridFragmentationChanged (); private: //std::set shown_channels_; float pixels_per_sample_; float channel_overlapping_; int channel_heigth_in_pixels_; QMap grid_fragmentation_; ChannelManager const& channel_manager_; }; } #endif // SIGNAL_VIEW_SETTINGS_H sigviewer-0.5.1+svn556/src/gui/signal_visualisation_model.cpp000066400000000000000000000061661154433734200242700ustar00rootroot00000000000000#include "signal_visualisation_model.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- SignalVisualisationModel::SignalVisualisationModel (std::set const& shown_types, ChannelManager const& channel_manager) : signal_view_settings_ (new SignalViewSettings (channel_manager)), //pixel_per_sample_ (1), mode_ (MODE_HAND), event_creation_type_ (1), shown_event_types_ (shown_types), scale_mode_ (MIN_TO_MAX), selected_channel_ (UNDEFINED_CHANNEL), info_widget_ (0) { // nothing to do here } //----------------------------------------------------------------------------- void SignalVisualisationModel::setMode (SignalVisualisationMode mode) { mode_ = mode; emit modeChanged (mode_); modeChangedImpl (mode_); } //----------------------------------------------------------------------------- SignalVisualisationMode SignalVisualisationModel::getMode () const { return mode_; } //----------------------------------------------------------------------------- void SignalVisualisationModel::setInfoWidget (QWidget* info_widget) { info_widget_ = info_widget; } //------------------------------------------------------------------------- ChannelID SignalVisualisationModel::getSelectedChannel () const { return selected_channel_; } //------------------------------------------------------------------------- void SignalVisualisationModel::selectChannel (ChannelID channel) { selected_channel_ = channel; } //----------------------------------------------------------------------------- QList SignalVisualisationModel::getSelectedEvents () const { return QList (); } //----------------------------------------------------------------------------- std::set SignalVisualisationModel::getShownEventTypes () const { return shown_event_types_; } //----------------------------------------------------------------------------- void SignalVisualisationModel::setShownEventTypes (std::set const& event_types) { shown_event_types_ = event_types; emit shownEventTypesChanged (shown_event_types_); shownEventTypesChangedImpl (); } //----------------------------------------------------------------------------- EventType SignalVisualisationModel::getActualEventCreationType () const { return event_creation_type_; } //------------------------------------------------------------------------- void SignalVisualisationModel::setAutoScaleMode (ScaleMode scale_mode) { scale_mode_ = scale_mode; } //------------------------------------------------------------------------- ScaleMode SignalVisualisationModel::getAutoScaleMode () const { return scale_mode_; } //----------------------------------------------------------------------------- void SignalVisualisationModel::setActualEventCreationType (EventType type) { event_creation_type_ = type; } //----------------------------------------------------------------------------- QWidget* SignalVisualisationModel::infoWidget () { return info_widget_; } } sigviewer-0.5.1+svn556/src/gui/signal_visualisation_model.h000066400000000000000000000125561154433734200237350ustar00rootroot00000000000000#ifndef SIGNAL_VISUALISATION_MODEL_H #define SIGNAL_VISUALISATION_MODEL_H #include "base/sigviewer_user_types.h" #include "base/signal_event.h" #include "file_handling/channel_manager.h" #include "file_handling/event_manager.h" #include "signal_visualisation_modes.h" #include "signal_visualisation_view.h" #include "event_view.h" #include "signal_view_settings.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// SignalVisualisationModel /// /// base class for all class SignalVisualisationModel : public QObject, public EventView { Q_OBJECT Q_PROPERTY(int sample_position_ READ getShownPosition WRITE goToSample) public: //------------------------------------------------------------------------- /// virtual destructor virtual ~SignalVisualisationModel () {} //------------------------------------------------------------------------- QSharedPointer getSignalViewSettings () {return signal_view_settings_;} //------------------------------------------------------------------------- QSharedPointer getSignalViewSettings () const {return signal_view_settings_;} //------------------------------------------------------------------------- virtual std::set getShownChannels () const = 0; //------------------------------------------------------------------------- virtual void setShownChannels (std::set const& shown_channels) = 0; //------------------------------------------------------------------------- void setMode (SignalVisualisationMode mode); //------------------------------------------------------------------------- SignalVisualisationMode getMode () const; //------------------------------------------------------------------------- /// the visualisation view takes ownership of the info_widget void setInfoWidget (QWidget* info_widget); //------------------------------------------------------------------------- virtual void scaleChannel (ChannelID id, float32 lower_value, float32 upper_value) = 0; //------------------------------------------------------------------------- virtual void scaleChannel (ChannelID id) = 0; //------------------------------------------------------------------------- virtual ChannelManager const& getChannelManager () const = 0; //------------------------------------------------------------------------- /// @return the number of sample which is shown on the left side virtual unsigned getShownPosition () const = 0; //------------------------------------------------------------------------- /// sets the view that the given sample is on the left side virtual void goToSample (unsigned sample) = 0; //------------------------------------------------------------------------- virtual ChannelID getSelectedChannel () const; //------------------------------------------------------------------------- virtual void selectChannel (ChannelID channel); //------------------------------------------------------------------------- /// @return the id of the currently selected signal event virtual QList getSelectedEvents () const; //------------------------------------------------------------------------- virtual std::set getShownEventTypes () const; //------------------------------------------------------------------------- virtual void setShownEventTypes (std::set const& event_types); //------------------------------------------------------------------------- virtual void selectEvent (EventID) = 0; //------------------------------------------------------------------------- EventType getActualEventCreationType () const; //------------------------------------------------------------------------- void setAutoScaleMode (ScaleMode scale_mode); //------------------------------------------------------------------------- ScaleMode getAutoScaleMode () const; //------------------------------------------------------------------------- virtual SignalVisualisationView const* view () const = 0; //------------------------------------------------------------------------- QWidget* infoWidget (); public slots: //------------------------------------------------------------------------- virtual void update () {} //------------------------------------------------------------------------- void setActualEventCreationType (EventType type); signals: void shownEventTypesChanged (std::set const& shown_event_types); void signalHeightChanged (uint32 signal_height); void modeChanged (SignalVisualisationMode mode); protected: SignalVisualisationModel (std::set const& shown_types, ChannelManager const& channel_manager); virtual void shownEventTypesChangedImpl () = 0; virtual void modeChangedImpl (SignalVisualisationMode) {} private: QSharedPointer signal_view_settings_; SignalVisualisationMode mode_; EventType event_creation_type_; std::set shown_event_types_; unsigned sample_position_; ScaleMode scale_mode_; ChannelID selected_channel_; QWidget* info_widget_; }; } // namespace SigViewer_ #endif // SIGNAL_VISUALISATION_MODEL_H sigviewer-0.5.1+svn556/src/gui/signal_visualisation_modes.h000066400000000000000000000003631154433734200237350ustar00rootroot00000000000000#ifndef SIGNAL_BROWSER_MODES_H #define SIGNAL_BROWSER_MODES_H namespace SigViewer_ { enum SignalVisualisationMode { MODE_NEW, MODE_POINTER, MODE_HAND, MODE_VIEW_OPTIONS, MODE_INFO }; }; #endif // SIGNAL_BROWSER_MODES_H sigviewer-0.5.1+svn556/src/gui/signal_visualisation_view.h000066400000000000000000000010631154433734200235760ustar00rootroot00000000000000#ifndef SIGNAL_VISUALISATION_VIEW_H #define SIGNAL_VISUALISATION_VIEW_H #include #include #include namespace SigViewer_ { class SignalVisualisationView { public: virtual QSharedPointer renderVisibleScene () const = 0; virtual bool getXAxisVisibility () const = 0; virtual bool getYAxisVisibility () const = 0; virtual bool getLabelsVisibility () const = 0; virtual int getViewportHeight () const = 0; virtual int getViewportWidth () const = 0; }; } #endif // SIGNAL_VISUALISATION_VIEW_H sigviewer-0.5.1+svn556/src/gui_impl/000077500000000000000000000000001154433734200171655ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/gui_impl/commands/000077500000000000000000000000001154433734200207665ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/gui_impl/commands/adapt_channel_view_gui_command.cpp000066400000000000000000000234001154433734200276460ustar00rootroot00000000000000#include "adapt_channel_view_gui_command.h" #include "gui_impl/gui_helper_functions.h" #include "gui_impl/dialogs/scale_channel_dialog.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const AdaptChannelViewGuiCommand::CHANNELS_ = "Channels..."; QString const AdaptChannelViewGuiCommand::CHANGE_COLOR_ = "Change Color..."; QString const AdaptChannelViewGuiCommand::SCALE_ = "Scale..."; QString const AdaptChannelViewGuiCommand::APPLY_SCALE_TO_OTHER_CHANNELS_ = "Apply Scale to Other Channels"; QString const AdaptChannelViewGuiCommand::HIDE_ = "Hide Channel"; QString const AdaptChannelViewGuiCommand::SCALE_ALL_ = "Scale All..."; QString const AdaptChannelViewGuiCommand::SET_AUTO_SCALE_MAX_TO_MAX_ = "Zero Line Centered"; QString const AdaptChannelViewGuiCommand::SET_AUTO_SCALE_MIN_TO_MAX_ = "Zero Line Fitted"; QString const AdaptChannelViewGuiCommand::ANIMATIONS_ = "Animations"; QString const AdaptChannelViewGuiCommand::SET_ANIMATION_DURATION_ = "Set Animation Duration"; QStringList const AdaptChannelViewGuiCommand::ACTIONS_ = QStringList() << AdaptChannelViewGuiCommand::CHANNELS_ << AdaptChannelViewGuiCommand::SCALE_ALL_ << AdaptChannelViewGuiCommand::SET_AUTO_SCALE_MAX_TO_MAX_ << AdaptChannelViewGuiCommand::SET_AUTO_SCALE_MIN_TO_MAX_ << AdaptChannelViewGuiCommand::CHANGE_COLOR_ << AdaptChannelViewGuiCommand::SCALE_ << AdaptChannelViewGuiCommand::HIDE_ << AdaptChannelViewGuiCommand::ANIMATIONS_ << AdaptChannelViewGuiCommand::SET_ANIMATION_DURATION_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator registrator_ ("Adapt Channel View", QSharedPointer (new AdaptChannelViewGuiCommand)); //----------------------------------------------------------------------------- AdaptChannelViewGuiCommand::AdaptChannelViewGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::init () { setIcon (CHANNELS_, QIcon(":/images/channels_22x22.png")); setIcon (SCALE_ALL_, QIcon(":/images/icons/autoscale.png")); resetActionTriggerSlot (CHANNELS_, SLOT(selectShownChannels())); resetActionTriggerSlot (SCALE_ALL_, SLOT(scaleAll())); resetActionTriggerSlot (CHANGE_COLOR_, SLOT(changeColor())); resetActionTriggerSlot (SCALE_, SLOT(scale())); resetActionTriggerSlot (HIDE_, SLOT(hide())); QActionGroup* scale_mode_action_group = new QActionGroup (this); scale_mode_action_group->setExclusive(true); scale_mode_action_group->addAction (getQAction(SET_AUTO_SCALE_MAX_TO_MAX_)); scale_mode_action_group->addAction (getQAction(SET_AUTO_SCALE_MIN_TO_MAX_)); getQAction(SET_AUTO_SCALE_MAX_TO_MAX_)->setCheckable(true); getQAction(SET_AUTO_SCALE_MIN_TO_MAX_)->setCheckable(true); getQAction(ANIMATIONS_)->setCheckable(true); QSettings settings ("SigViewer"); settings.beginGroup("Animations"); getQAction(ANIMATIONS_)->setChecked (settings.value("activated", false).toBool()); settings.endGroup(); resetActionTriggerSlot (SET_AUTO_SCALE_MAX_TO_MAX_, SLOT(setScaleModeZeroCentered())); resetActionTriggerSlot (SET_AUTO_SCALE_MIN_TO_MAX_, SLOT(setScaleModeZeroFitted())); resetActionTriggerSlot (ANIMATIONS_, SLOT(toggleAnimations())); resetActionTriggerSlot (SET_ANIMATION_DURATION_, SLOT(setAnimationDuration())); } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::selectShownChannels () { QSharedPointer sv_model = currentVisModel (); std::set previous_shown_channels = sv_model->getShownChannels (); std::set new_shown_channels = GuiHelper::selectChannels (sv_model->getChannelManager(), applicationContext()->getEventColorManager(), QSharedPointer(0), sv_model); if (previous_shown_channels != new_shown_channels) sv_model->setShownChannels (new_shown_channels); sv_model->update (); } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::evaluateEnabledness () { QStringList disabled_actions_if_no_file = ACTIONS_; disabled_actions_if_no_file.removeAll(ANIMATIONS_); disabled_actions_if_no_file.removeAll(SET_ANIMATION_DURATION_); disableIfNoFileIsOpened (disabled_actions_if_no_file); disableIfNoSignalIsVisualised (disabled_actions_if_no_file); if (!currentVisModel().isNull()) { getQAction (SET_AUTO_SCALE_MAX_TO_MAX_)->setChecked (currentVisModel()->getAutoScaleMode() == MAX_TO_MAX); getQAction (SET_AUTO_SCALE_MIN_TO_MAX_)->setChecked (currentVisModel()->getAutoScaleMode() == MIN_TO_MAX); } } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::changeColor () { if (currentVisModel().isNull()) return; ChannelID channel = currentVisModel()->getSelectedChannel(); if (channel == UNDEFINED_CHANNEL) return; QSharedPointer color_manager = applicationContext()->getEventColorManager(); QColor old_color = color_manager->getChannelColor(channel); QColorDialog color_dialog (old_color); if (color_dialog.exec() == QDialog::Accepted) { color_manager->setChannelColor (channel, color_dialog.selectedColor()); color_manager->saveSettings (); currentVisModel()->update(); } } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::scale () { ChannelID channel = currentVisModel()->getSelectedChannel(); if (channel == UNDEFINED_CHANNEL) return; ScaleChannelDialog scale_dialog (channel, currentVisModel()->getShownChannels(), currentVisModel()->getChannelManager()); if (scale_dialog.exec() == QDialog::Accepted) { currentVisModel()->scaleChannel (channel, scale_dialog.lowerValue(), scale_dialog.upperValue()); } } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::applyScaleToOtherChannels () { ChannelID channel = currentVisModel()->getSelectedChannel(); if (channel == UNDEFINED_CHANNEL) return; // TODO: implement! } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::hide () { ChannelID channel = currentVisModel()->getSelectedChannel(); if (channel == UNDEFINED_CHANNEL) return; std::set shown_channels = currentVisModel()->getShownChannels(); shown_channels.erase (channel); currentVisModel()->setShownChannels (shown_channels); currentVisModel()->update(); } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::scaleAll () { ScaleChannelDialog scale_dialog (UNDEFINED_CHANNEL, currentVisModel()->getShownChannels(), currentVisModel()->getChannelManager()); if (scale_dialog.exec() == QDialog::Accepted) { if (scale_dialog.autoScaling()) { currentVisModel()->setAutoScaleMode (MIN_TO_MAX); currentVisModel()->scaleChannel(UNDEFINED_CHANNEL); } else currentVisModel()->scaleChannel (UNDEFINED_CHANNEL, scale_dialog.lowerValue(), scale_dialog.upperValue()); } } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::setScaleModeZeroCentered () { currentVisModel()->setAutoScaleMode (MAX_TO_MAX); currentVisModel()->scaleChannel(UNDEFINED_CHANNEL); } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::setScaleModeZeroFitted () { currentVisModel()->setAutoScaleMode (MIN_TO_MAX); currentVisModel()->scaleChannel(UNDEFINED_CHANNEL); } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::toggleAnimations () { QSettings settings ("SigViewer"); settings.beginGroup ("Animations"); settings.setValue ("activated", getQAction(ANIMATIONS_)->isChecked ()); settings.endGroup (); } //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::setAnimationDuration () { QSettings settings ("SigViewer"); settings.beginGroup ("Animations"); bool ok = false; int new_duration = QInputDialog::getInt(0, tr("Set Animation Duration"), tr("Milliseconds:"), settings.value("duration", 200).toInt(), 0, 1000, 100, &ok); if (ok) settings.setValue ("duration", new_duration); settings.endGroup (); } } sigviewer-0.5.1+svn556/src/gui_impl/commands/adapt_channel_view_gui_command.h000066400000000000000000000047271154433734200273260ustar00rootroot00000000000000#ifndef VIEW_OPTIONS_GUI_COMMAND_H #define VIEW_OPTIONS_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" namespace SigViewer_ { //----------------------------------------------------------------------------- class AdaptChannelViewGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- AdaptChannelViewGuiCommand (); //------------------------------------------------------------------------- virtual ~AdaptChannelViewGuiCommand () {} //------------------------------------------------------------------------- virtual void init (); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private slots: //------------------------------------------------------------------------- void selectShownChannels (); //------------------------------------------------------------------------- void changeColor (); //------------------------------------------------------------------------- void scale (); //------------------------------------------------------------------------- void applyScaleToOtherChannels (); //------------------------------------------------------------------------- void hide (); //------------------------------------------------------------------------- void scaleAll (); //------------------------------------------------------------------------- void setScaleModeZeroCentered (); //------------------------------------------------------------------------- void setScaleModeZeroFitted (); //------------------------------------------------------------------------- void toggleAnimations (); //------------------------------------------------------------------------- void setAnimationDuration (); private: static QString const CHANNELS_; static QString const CHANGE_COLOR_; static QString const SCALE_; static QString const APPLY_SCALE_TO_OTHER_CHANNELS_; static QString const HIDE_; static QString const SCALE_ALL_; static QString const SET_AUTO_SCALE_MAX_TO_MAX_; static QString const SET_AUTO_SCALE_MIN_TO_MAX_; static QString const ANIMATIONS_; static QString const SET_ANIMATION_DURATION_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } #endif // VIEW_OPTIONS_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/adapt_event_view_gui_command.cpp000066400000000000000000000176721154433734200273750ustar00rootroot00000000000000#include "adapt_event_view_gui_command.h" #include "gui_impl/gui_helper_functions.h" #include "gui/signal_visualisation_model.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const AdaptEventViewGuiCommand::FIT_TO_EVENT_ = "Fit View to Selected Event"; QString const AdaptEventViewGuiCommand::HIDE_EVENTS_OF_OTHER_TYPE_ = "Hide Events of other Type"; QString const AdaptEventViewGuiCommand::SHOW_ALL_EVENTS_ = "Show all Events"; QString const AdaptEventViewGuiCommand::GO_TO_NEXT_EVENT_ = "Goto and Select Next Event"; QString const AdaptEventViewGuiCommand::GO_TO_PREVIOUS_EVENT_ = "Goto and Select Previous Event"; QString const AdaptEventViewGuiCommand::SET_SHOWN_EVENTS_ = "Events..."; QStringList const AdaptEventViewGuiCommand::ACTIONS_ = QStringList() << AdaptEventViewGuiCommand::FIT_TO_EVENT_ << AdaptEventViewGuiCommand::GO_TO_NEXT_EVENT_ << AdaptEventViewGuiCommand::GO_TO_PREVIOUS_EVENT_ << AdaptEventViewGuiCommand::HIDE_EVENTS_OF_OTHER_TYPE_ << AdaptEventViewGuiCommand::SHOW_ALL_EVENTS_ << AdaptEventViewGuiCommand::SET_SHOWN_EVENTS_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator AdaptEventViewGuiCommand::registrator_ ("Adapt Event View", QSharedPointer (new AdaptEventViewGuiCommand)); //----------------------------------------------------------------------------- AdaptEventViewGuiCommand::AdaptEventViewGuiCommand () : GuiActionCommand (ACTIONS_), current_event_ (UNDEFINED_EVENT_ID), next_event_ (UNDEFINED_EVENT_ID), previous_event_ (UNDEFINED_EVENT_ID) { // nothing to do here } //----------------------------------------------------------------------------- void AdaptEventViewGuiCommand::init () { setShortcut (GO_TO_NEXT_EVENT_, QKeySequence("Ctrl+Right")); setShortcut (GO_TO_PREVIOUS_EVENT_, QKeySequence("Ctrl+Left")); setIcon (GO_TO_NEXT_EVENT_, QIcon(":/images/icons/next.png")); setIcon (GO_TO_PREVIOUS_EVENT_, QIcon(":/images/icons/previous.png")); setIcon (SET_SHOWN_EVENTS_, QIcon(":/images/events_22x22.png")); setIcon (FIT_TO_EVENT_, QIcon(":/images/icons/zoom_fit_event_horizontal.png")); resetActionTriggerSlot (HIDE_EVENTS_OF_OTHER_TYPE_, SLOT(hideEventsOfOtherType())); resetActionTriggerSlot (SHOW_ALL_EVENTS_, SLOT(showAllEvents())); resetActionTriggerSlot (SET_SHOWN_EVENTS_, SLOT(setShownEvents())); } //----------------------------------------------------------------------------- void AdaptEventViewGuiCommand::trigger (QString const& action_name) { if (action_name == FIT_TO_EVENT_) fitViewToEvent (); else if (action_name == GO_TO_NEXT_EVENT_) gotoAndSelectEvent (true); else if (action_name == GO_TO_PREVIOUS_EVENT_) gotoAndSelectEvent (false); } //------------------------------------------------------------------------- void AdaptEventViewGuiCommand::hideEventsOfOtherType () { QList > events = GuiHelper::getSelectedEvents (currentEventView()); if (events.size() != 1) return; std::set shown_types; shown_types.insert (events.first()->getType ()); currentVisModel()->setShownEventTypes (shown_types); } //------------------------------------------------------------------------- void AdaptEventViewGuiCommand::showAllEvents () { std::set shown_types = currentVisModel()->getEventManager()->getEventTypes(); currentVisModel()->setShownEventTypes (shown_types); } //------------------------------------------------------------------------- void AdaptEventViewGuiCommand::setShownEvents () { std::set shown_types = currentVisModel()->getShownEventTypes (); std::set new_shown_types = GuiHelper::selectEventTypes (shown_types, currentVisModel()->getEventManager(), applicationContext()->getEventColorManager(), true); if (shown_types != new_shown_types) currentVisModel()->setShownEventTypes (new_shown_types); currentVisModel()->update (); } //------------------------------------------------------------------------- void AdaptEventViewGuiCommand::evaluateEnabledness () { if (disableIfNoFileIsOpened (ACTIONS_)) return; if (disableIfNoEventsPossible (ACTIONS_)) return; disableIfNoEventSelected (QStringList() << HIDE_EVENTS_OF_OTHER_TYPE_ << FIT_TO_EVENT_); setNextAndPreviousEvent (); getQAction (SET_SHOWN_EVENTS_)->setEnabled (currentEventView()->eventsHidable()); getQAction (HIDE_EVENTS_OF_OTHER_TYPE_)->setEnabled (currentEventView()->eventsHidable()); getQAction (SHOW_ALL_EVENTS_)->setEnabled (currentEventView()->eventsHidable()); getQAction (FIT_TO_EVENT_)->setEnabled (currentEventView()->eventsHidable()); getQAction (GO_TO_NEXT_EVENT_)->setEnabled (currentEventView()->eventsSlidable()); getQAction (GO_TO_PREVIOUS_EVENT_)->setEnabled (currentEventView()->eventsSlidable()); } //------------------------------------------------------------------------- void AdaptEventViewGuiCommand::fitViewToEvent () { QList > events = GuiHelper::getSelectedEvents (currentVisModel()); if (events.size() != 1) return; QSharedPointer event = events.first(); float32 width = currentVisModel()->view()->getViewportWidth(); float32 desired_pixel_per_sample = width / event->getDuration (); currentSignalViewSettings()->setPixelsPerSample (desired_pixel_per_sample); currentVisModel()->goToSample (event->getPosition ()); } //------------------------------------------------------------------------- void AdaptEventViewGuiCommand::gotoAndSelectEvent (bool forward) { QSharedPointer event_manager = currentVisModel()->getEventManager(); if (event_manager.isNull()) { qCritical() << "AdaptEventViewGuiCommand::gotoAndSelectEvent no EventManager available!!"; return; } EventID event_id; if (forward) event_id = next_event_; else event_id = previous_event_; QSharedPointer event = event_manager->getEvent (event_id); if (!event.isNull()) { GuiHelper::animateProperty(currentVisModel().data(), "sample_position_", currentVisModel()->getShownPosition(), event->getPosition()); currentVisModel()->selectEvent (event->getId()); } } //------------------------------------------------------------------------- void AdaptEventViewGuiCommand::setNextAndPreviousEvent () { QList > events = GuiHelper::getSelectedEvents (currentVisModel()); if (events.size() != 1) return; QSharedPointer event = events.first(); if (!event.isNull ()) { if (current_event_ == event->getId ()) return; current_event_ = event->getId (); QSharedPointer event_manager = currentVisModel()->getEventManager (); next_event_ = event_manager->getNextEventOfSameType (event->getId ()); previous_event_ = event_manager->getPreviousEventOfSameType (event->getId ()); qDebug () << "next event " << next_event_; qDebug () << "previous event "<< previous_event_; } getQAction (GO_TO_NEXT_EVENT_)->setEnabled (next_event_ != UNDEFINED_EVENT_ID); getQAction (GO_TO_PREVIOUS_EVENT_)->setEnabled (previous_event_ != UNDEFINED_EVENT_ID); } } sigviewer-0.5.1+svn556/src/gui_impl/commands/adapt_event_view_gui_command.h000066400000000000000000000044551154433734200270350ustar00rootroot00000000000000#ifndef FIT_VIEW_GUI_COMMAND_H #define FIT_VIEW_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" #include namespace SigViewer_ { //------------------------------------------------------------------------- class AdaptEventViewGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- AdaptEventViewGuiCommand (); //------------------------------------------------------------------------- virtual ~AdaptEventViewGuiCommand () {} //------------------------------------------------------------------------- virtual void init (); public slots: //------------------------------------------------------------------------- virtual void trigger (QString const& action_name); //------------------------------------------------------------------------- void hideEventsOfOtherType (); //------------------------------------------------------------------------- void showAllEvents (); //------------------------------------------------------------------------- void setShownEvents (); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private: //------------------------------------------------------------------------- void fitViewToEvent (); //------------------------------------------------------------------------- void gotoAndSelectEvent (bool forward); //------------------------------------------------------------------------- void setNextAndPreviousEvent (); //------------------------------------------------------------------------- EventID current_event_; EventID next_event_; EventID previous_event_; //------------------------------------------------------------------------- static QString const FIT_TO_EVENT_; static QString const HIDE_EVENTS_OF_OTHER_TYPE_; static QString const SHOW_ALL_EVENTS_; static QString const GO_TO_NEXT_EVENT_; static QString const GO_TO_PREVIOUS_EVENT_; static QString const SET_SHOWN_EVENTS_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } // namespace SigViewer_ #endif // FIT_VIEW_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/close_file_gui_command.cpp000066400000000000000000000060211154433734200261370ustar00rootroot00000000000000#include "close_file_gui_command.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const CloseFileGuiCommand::CLOSE_FILE_ = "Close"; QString const CloseFileGuiCommand::EXIT_APPLICATION_ = "Exit"; QStringList const CloseFileGuiCommand::ACTIONS_ = QStringList() << CloseFileGuiCommand::CLOSE_FILE_ << CloseFileGuiCommand::EXIT_APPLICATION_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator CloseFileGuiCommand::registrator_ ("Closing", QSharedPointer (new CloseFileGuiCommand)); //----------------------------------------------------------------------------- CloseFileGuiCommand::CloseFileGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //----------------------------------------------------------------------------- void CloseFileGuiCommand::init () { getQAction(CLOSE_FILE_)->setShortcut (QKeySequence::Close); getQAction(CLOSE_FILE_)->setIcon (QIcon(":/images/icons/fileclose.png")); #if QT_VERSION >= 0x040600 getQAction(EXIT_APPLICATION_)->setShortcut (QKeySequence::Quit); #endif getQAction(EXIT_APPLICATION_)->setIcon (QIcon(":/images/icons/exit.png")); resetActionTriggerSlot(CLOSE_FILE_, SLOT(closeFile())); resetActionTriggerSlot(EXIT_APPLICATION_, SLOT(exitApplication())); } //------------------------------------------------------------------------- bool CloseFileGuiCommand::closeCurrentFile () { QSharedPointer current_file_context = applicationContext()->getCurrentFileContext(); if (current_file_context.isNull()) return true; if (current_file_context->getState () == FILE_STATE_CHANGED) { QString file_name = current_file_context->getFileName (); QMessageBox::StandardButton pressed_button = QMessageBox::question (0, tr("Really close?"), tr("Changes in '%1' are not saved!!").arg(file_name) + "\n" + tr("Really close?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (pressed_button == QMessageBox::No) return false; } applicationContext()->getMainWindowModel ()->closeCurrentFileTabs (); applicationContext()->removeCurrentFileContext (); return true; } //------------------------------------------------------------------------- void CloseFileGuiCommand::closeFile () { closeCurrentFile (); } //------------------------------------------------------------------------- void CloseFileGuiCommand::exitApplication () { if (closeCurrentFile ()) QApplication::exit (); } //------------------------------------------------------------------------- void CloseFileGuiCommand::evaluateEnabledness () { disableIfNoFileIsOpened (QStringList() << CLOSE_FILE_); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/commands/close_file_gui_command.h000066400000000000000000000034771154433734200256200ustar00rootroot00000000000000#ifndef CLOSE_FILE_GUI_COMMAND_H #define CLOSE_FILE_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" #include "file_handling/file_signal_reader.h" namespace SigViewer_ { //----------------------------------------------------------------------------- /// CloseFileGuiCommand /// /// command for closing a file class CloseFileGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- CloseFileGuiCommand (); //------------------------------------------------------------------------- virtual ~CloseFileGuiCommand () {} //------------------------------------------------------------------------- virtual void init (); //------------------------------------------------------------------------- bool closeCurrentFile (); public slots: //------------------------------------------------------------------------- void closeFile (); //------------------------------------------------------------------------- void exitApplication (); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private: static QString const CLOSE_FILE_; static QString const EXIT_APPLICATION_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; //------------------------------------------------------------------------- QString showCloseDialog (QString const& path, QString const& extensions); //------------------------------------------------------------------------- QSharedPointer createAndCloseFileSignalReader (QString const& file_path) const; }; } // namespace SigViewer_ #endif // CLOSE_FILE_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/commands.pri000066400000000000000000000021361154433734200233050ustar00rootroot00000000000000HEADERS += gui_impl/commands/adapt_channel_view_gui_command.h \ gui_impl/commands/adapt_event_view_gui_command.h \ gui_impl/commands/close_file_gui_command.h \ gui_impl/commands/event_editing_gui_command.h \ gui_impl/commands/save_gui_command.h \ gui_impl/commands/signal_processing_gui_command.h \ gui_impl/commands/undo_redo_gui_command.h \ gui_impl/commands/zoom_gui_command.h \ gui_impl/commands/help_gui_command.h \ gui_impl/commands/mouse_mode_gui_command.h \ gui_impl/commands/open_file_gui_command.h SOURCES += gui_impl/commands/adapt_channel_view_gui_command.cpp \ gui_impl/commands/adapt_event_view_gui_command.cpp \ gui_impl/commands/close_file_gui_command.cpp \ gui_impl/commands/event_editing_gui_command.cpp \ gui_impl/commands/help_gui_command.cpp \ gui_impl/commands/mouse_mode_gui_command.cpp \ gui_impl/commands/open_file_gui_command.cpp \ gui_impl/commands/save_gui_command.cpp \ gui_impl/commands/signal_processing_gui_command.cpp \ gui_impl/commands/undo_redo_gui_command.cpp \ gui_impl/commands/zoom_gui_command.cpp sigviewer-0.5.1+svn556/src/gui_impl/commands/event_editing_gui_command.cpp000066400000000000000000000226431154433734200266670ustar00rootroot00000000000000#include "event_editing_gui_command.h" #include "gui_impl/gui_helper_functions.h" #include "editing_commands/delete_event_undo_command.h" #include "editing_commands/change_type_undo_command.h" #include "editing_commands/change_channel_undo_command.h" #include "editing_commands/new_event_undo_command.h" #include "editing_commands/macro_undo_command.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const EventEditingGuiCommand::DELETE_ = "Delete"; QString const EventEditingGuiCommand::CHANGE_TYPE_ = "Change Type..."; QString const EventEditingGuiCommand::CHANGE_CHANNEL_ = "Change Channel..."; QString const EventEditingGuiCommand::TO_ALL_CHANNEL_ = "To all Channels"; QString const EventEditingGuiCommand::COPY_TO_CHANNELS_ = "Copy to Channels..."; QString const EventEditingGuiCommand::INSERT_OVER_ = "Insert Over"; QStringList const EventEditingGuiCommand::ACTIONS_ = QStringList () << EventEditingGuiCommand::DELETE_ << EventEditingGuiCommand::CHANGE_TYPE_ << EventEditingGuiCommand::CHANGE_CHANNEL_ << EventEditingGuiCommand::TO_ALL_CHANNEL_ << EventEditingGuiCommand::COPY_TO_CHANNELS_ << EventEditingGuiCommand::INSERT_OVER_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator EventEditingGuiCommand::registrator_ ("Event Editing", QSharedPointer (new EventEditingGuiCommand)); //----------------------------------------------------------------------------- EventEditingGuiCommand::EventEditingGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //----------------------------------------------------------------------------- EventEditingGuiCommand::~EventEditingGuiCommand () { // nothing to do here } //----------------------------------------------------------------------------- void EventEditingGuiCommand::init () { resetActionTriggerSlot (DELETE_, SLOT (deleteSelectedEvent())); resetActionTriggerSlot (CHANGE_TYPE_, SLOT (changeTypeSelectedEvent())); resetActionTriggerSlot (CHANGE_CHANNEL_, SLOT (changeChannelSelectedEvent())); resetActionTriggerSlot (TO_ALL_CHANNEL_, SLOT (toAllChannelsSelectedEvent())); resetActionTriggerSlot (COPY_TO_CHANNELS_, SLOT (copyToChannelsSelectedEvent())); resetActionTriggerSlot (INSERT_OVER_, SLOT (insertEventOverSelectedEvent())); getQAction (DELETE_)->setIcon (QIcon(":/images/icons/editdelete.png")); getQAction (CHANGE_TYPE_)->setIcon (QIcon (":/images/change_type_22x22.png")); getQAction (CHANGE_CHANNEL_)->setIcon (QIcon (":/images/change_channel_22x22.png")); getQAction (TO_ALL_CHANNEL_)->setIcon (QIcon (":/images/to_all_channels_22x22.png")); getQAction (COPY_TO_CHANNELS_)->setIcon (QIcon (":/images/copy_to_channels_22x22.png")); getQAction (INSERT_OVER_)->setIcon (QIcon (":/images/icons/add.png")); getQAction (DELETE_)->setShortcut (QKeySequence::Delete); getQAction (INSERT_OVER_)->setShortcut (QKeySequence("Ctrl+I")); } //----------------------------------------------------------------------------- void EventEditingGuiCommand::deleteSelectedEvent () { QList > commands; foreach (EventID event, GuiHelper::getSelectedEventIDs (currentEventView())) { commands.append (QSharedPointer (new DeleteEventUndoCommand ( currentEventView()->getEventManager(), event))); } executeCommands (commands); } //----------------------------------------------------------------------------- void EventEditingGuiCommand::changeTypeSelectedEvent () { QList > commands; foreach (EventID event, GuiHelper::getSelectedEventIDs (currentEventView())) { QSharedPointer event_manager = currentVisModel()->getEventManager(); EventType pre_selected_type = event_manager->getEvent (event)->getType (); EventType new_type = GuiHelper::selectEventType (pre_selected_type, currentVisModel()); if (new_type == UNDEFINED_EVENT_TYPE) return; commands.append (QSharedPointer (new ChangeTypeUndoCommand ( event_manager, event, new_type))); } executeCommands (commands); } //------------------------------------------------------------------------- void EventEditingGuiCommand::changeChannelSelectedEvent () { QList > commands; foreach (EventID event, GuiHelper::getSelectedEventIDs (currentEventView())) { QSharedPointer event_manager = currentVisModel()->getEventManager(); ChannelID preselected_channel = event_manager->getEvent (event)->getChannel (); ChannelID new_channel = GuiHelper::selectChannel (preselected_channel, currentVisModel()); if (new_channel == preselected_channel) return; commands.append (QSharedPointer (new ChangeChannelUndoCommand (event_manager, event, new_channel))); } executeCommands (commands); } //------------------------------------------------------------------------- void EventEditingGuiCommand::toAllChannelsSelectedEvent () { QList > commands; foreach (EventID event, GuiHelper::getSelectedEventIDs (currentEventView())) { QSharedPointer event_manager = currentVisModel()->getEventManager(); if (event_manager->getEvent (event)->getChannel () == UNDEFINED_CHANNEL) return; commands.append (QSharedPointer (new ChangeChannelUndoCommand (event_manager, event, UNDEFINED_CHANNEL))); } executeCommands (commands); } //------------------------------------------------------------------------- void EventEditingGuiCommand::copyToChannelsSelectedEvent () { QList > commands; foreach (EventID event_id, GuiHelper::getSelectedEventIDs (currentEventView())) { QSharedPointer event_manager = currentVisModel()->getEventManager(); QSharedPointer event = event_manager->getEvent (event_id); std::set channels = GuiHelper::selectShownChannels (event->getChannel (), currentVisModel()); if (channels.size () == 0) return; for (std::set::iterator channel_iter = channels.begin(); channel_iter != channels.end(); ++channel_iter) { QSharedPointer new_event (new SignalEvent (*event)); new_event->setChannel (*channel_iter); QSharedPointer command (new NewEventUndoCommand (event_manager, new_event, 1)); commands.append (command); } } executeCommands (commands); } //------------------------------------------------------------------------- void EventEditingGuiCommand::insertEventOverSelectedEvent () { QList > commands; foreach (EventID event, GuiHelper::getSelectedEventIDs (currentEventView())) { if (event == UNDEFINED_EVENT_ID) return; QSharedPointer event_manager = currentVisModel()->getEventManager(); QSharedPointer sv_model = currentVisModel(); QSharedPointer new_event (new SignalEvent (*(event_manager->getEvent (event)))); new_event->setType (sv_model->getActualEventCreationType ()); commands.append (QSharedPointer(new NewEventUndoCommand (event_manager, new_event, 1))); } executeCommands (commands); } //------------------------------------------------------------------------- void EventEditingGuiCommand::evaluateEnabledness () { if (disableIfNoFileIsOpened (ACTIONS_)) return; if (disableIfNoEventsPossible (ACTIONS_)) return; bool event_one_channel_selected = (getTabSelectionState() == TAB_STATE_EVENT_SELECTED_ONE_CHANNEL); getQAction(COPY_TO_CHANNELS_)->setEnabled(event_one_channel_selected); getQAction(TO_ALL_CHANNEL_)->setEnabled(event_one_channel_selected); disableIfNoEventSelected (QStringList() << INSERT_OVER_ << CHANGE_CHANNEL_ << CHANGE_TYPE_ << DELETE_); } //------------------------------------------------------------------------- void EventEditingGuiCommand::executeCommands (QList > commands) { MacroUndoCommand* macro = new MacroUndoCommand (commands); applicationContext()->getCurrentCommandExecuter()->executeCommand (macro); } } sigviewer-0.5.1+svn556/src/gui_impl/commands/event_editing_gui_command.h000066400000000000000000000037101154433734200263260ustar00rootroot00000000000000#ifndef EVENT_EDITING_GUI_COMMAND_H #define EVENT_EDITING_GUI_COMMAND_H #include "base/sigviewer_user_types.h" #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" #include namespace SigViewer_ { class EventEditingGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- EventEditingGuiCommand (); //------------------------------------------------------------------------- virtual ~EventEditingGuiCommand (); //------------------------------------------------------------------------- virtual void init (); public slots: //------------------------------------------------------------------------- void deleteSelectedEvent (); //------------------------------------------------------------------------- void changeTypeSelectedEvent (); //------------------------------------------------------------------------- void changeChannelSelectedEvent (); //------------------------------------------------------------------------- void toAllChannelsSelectedEvent (); //------------------------------------------------------------------------- void copyToChannelsSelectedEvent (); //------------------------------------------------------------------------- void insertEventOverSelectedEvent (); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private: void executeCommands (QList > commands); static QString const DELETE_; static QString const CHANGE_TYPE_; static QString const CHANGE_CHANNEL_; static QString const TO_ALL_CHANNEL_; static QString const COPY_TO_CHANNELS_; static QString const INSERT_OVER_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } #endif // EVENT_EDITING_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/help_gui_command.cpp000066400000000000000000000035441154433734200247720ustar00rootroot00000000000000#include "help_gui_command.h" #include "tests/tests_dialog.h" #include "ui_about_dialog.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const HelpGuiCommand::ABOUT_ = "About"; QString const HelpGuiCommand::RUN_TESTS_ = "Run Tests..."; QStringList const HelpGuiCommand::ACTIONS_ = QStringList() << HelpGuiCommand::ABOUT_ << HelpGuiCommand::RUN_TESTS_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator HelpGuiCommand::registrator_ ("Help", QSharedPointer(new HelpGuiCommand)); //----------------------------------------------------------------------------- HelpGuiCommand::HelpGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //----------------------------------------------------------------------------- void HelpGuiCommand::init () { resetActionTriggerSlot (ABOUT_, SLOT(showAboutDialog())); resetActionTriggerSlot (RUN_TESTS_, SLOT(runTests())); } //----------------------------------------------------------------------------- void HelpGuiCommand::showAboutDialog () { QFile version_file (":version.txt"); version_file.open(QIODevice::ReadOnly); QByteArray version_array = version_file.readLine(); QDialog dialog; Ui::aboutDialog ui; ui.setupUi (&dialog); ui.aboutLabel->setText(ui.aboutLabel->text().replace(QString("[VERSION-NUMBER]"), QString (version_array))); dialog.exec(); } //----------------------------------------------------------------------------- void HelpGuiCommand::runTests () { TestsDialog tests_dialog; tests_dialog.exec (); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/commands/help_gui_command.h000066400000000000000000000017751154433734200244430ustar00rootroot00000000000000#ifndef HELP_GUI_COMMAND_H #define HELP_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" namespace SigViewer_ { class HelpGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- HelpGuiCommand (); //------------------------------------------------------------------------- virtual ~HelpGuiCommand () {} //------------------------------------------------------------------------- virtual void init (); private slots: //------------------------------------------------------------------------- void showAboutDialog (); //------------------------------------------------------------------------- void runTests (); private: static QString const ABOUT_; static QString const RUN_TESTS_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } // namespace SigViewer_ #endif // HELP_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/mouse_mode_gui_command.cpp000066400000000000000000000077621154433734200262040ustar00rootroot00000000000000#include "mouse_mode_gui_command.h" #include "gui/signal_visualisation_model.h" namespace SigViewer_ { //----------------------------------------------------------------------------- QString const MouseModeGuiCommand::NEW_MODE_TEXT_ = "New Event"; QString const MouseModeGuiCommand::POINTER_MODE_TEXT_ = "Edit Event"; QString const MouseModeGuiCommand::HAND_MODE_TEXT_ = "Scroll"; QString const MouseModeGuiCommand::VIEW_OPTIONS_TEXT_ = "View Options"; QString const MouseModeGuiCommand::INFO_MODE_TEXT_ = "Info"; QStringList const MouseModeGuiCommand::MODE_TEXTS_ = QStringList() << MouseModeGuiCommand::NEW_MODE_TEXT_ << MouseModeGuiCommand::POINTER_MODE_TEXT_ << MouseModeGuiCommand::HAND_MODE_TEXT_ << MouseModeGuiCommand::VIEW_OPTIONS_TEXT_; //<< MouseModeGuiCommand::INFO_MODE_TEXT_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator MouseModeGuiCommand::registrator_ ("Mouse Modes", QSharedPointer (new MouseModeGuiCommand)); //----------------------------------------------------------------------------- MouseModeGuiCommand::MouseModeGuiCommand () : GuiActionCommand (MODE_TEXTS_) { action_to_mode_map_[NEW_MODE_TEXT_] = MODE_NEW; action_to_mode_map_[POINTER_MODE_TEXT_] = MODE_POINTER; action_to_mode_map_[HAND_MODE_TEXT_] = MODE_HAND; action_to_mode_map_[VIEW_OPTIONS_TEXT_] = MODE_VIEW_OPTIONS; //action_to_mode_map_[INFO_MODE_TEXT_] = MODE_INFO; } //----------------------------------------------------------------------------- MouseModeGuiCommand::~MouseModeGuiCommand () { // nothing to do here } //----------------------------------------------------------------------------- void MouseModeGuiCommand::init () { QActionGroup* mouse_mode_action_group = new QActionGroup (this); mouse_mode_action_group->setExclusive(true); getQAction (NEW_MODE_TEXT_)->setIcon (QIcon(":/images/new_22x22.png")); getQAction (POINTER_MODE_TEXT_)->setIcon (QIcon(":/images/pointer_22x22.png")); getQAction (HAND_MODE_TEXT_)->setIcon (QIcon(":/images/hand_22x22.png")); getQAction (VIEW_OPTIONS_TEXT_)->setIcon (QIcon(":/images/icons/configure.png")); getQAction (NEW_MODE_TEXT_)->setShortcut (QString("Ctrl+1")); getQAction (POINTER_MODE_TEXT_)->setShortcut (QString("Ctrl+2")); getQAction (HAND_MODE_TEXT_)->setShortcut (QString("Ctrl+3")); getQAction (VIEW_OPTIONS_TEXT_)->setShortcut (QString("Ctrl+4")); //getQAction (INFO_MODE_TEXT_)->setShortcut (QString("Ctrl+5")); QList actions = getQActions (); foreach (QAction* action, actions) { mouse_mode_action_group->addAction (action); action->setCheckable (true); } getQAction (HAND_MODE_TEXT_)->setChecked (true); } //----------------------------------------------------------------------------- void MouseModeGuiCommand::trigger (QString const& action_name) { currentVisModel()->setMode (action_to_mode_map_[action_name]); } //------------------------------------------------------------------------- void MouseModeGuiCommand::evaluateEnabledness () { if (disableIfNoFileIsOpened (MODE_TEXTS_)) return; if (disableIfNoSignalIsVisualised(MODE_TEXTS_)) return; if (!currentVisModel().isNull()) { getQAction(NEW_MODE_TEXT_)->setDisabled(currentVisModel()->getEventManager().isNull()); getQAction(POINTER_MODE_TEXT_)->setDisabled(currentVisModel()->getEventManager().isNull()); } } //----------------------------------------------------------------------------- void MouseModeGuiCommand::applicationStateChanged () { if (getApplicationState () == APP_STATE_FILE_OPEN) getQAction (HAND_MODE_TEXT_)->setChecked (true); } } sigviewer-0.5.1+svn556/src/gui_impl/commands/mouse_mode_gui_command.h000066400000000000000000000023711154433734200256400ustar00rootroot00000000000000#ifndef MOUSE_MODE_GUI_COMMAND_H #define MOUSE_MODE_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" #include "gui/signal_visualisation_modes.h" #include #include namespace SigViewer_ { class MouseModeGuiCommand : public GuiActionCommand { Q_OBJECT public: MouseModeGuiCommand (); virtual ~MouseModeGuiCommand (); virtual void init (); public slots: //------------------------------------------------------------------------- virtual void trigger (QString const& action_name); protected: //------------------------------------------------------------------------- virtual void applicationStateChanged (); //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private: static QString const NEW_MODE_TEXT_; static QString const POINTER_MODE_TEXT_; static QString const HAND_MODE_TEXT_; static QString const VIEW_OPTIONS_TEXT_; static QString const INFO_MODE_TEXT_; static QStringList const MODE_TEXTS_; static GuiActionFactoryRegistrator registrator_; QMap action_to_mode_map_; }; } #endif // MOUSE_MODE_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/open_file_gui_command.cpp000066400000000000000000000175321154433734200260040ustar00rootroot00000000000000#include "open_file_gui_command.h" #include "gui_impl/gui_helper_functions.h" #include "gui_impl/dialogs/basic_header_info_dialog.h" #include "gui/signal_visualisation_model.h" #include "file_handling/file_signal_reader_factory.h" #include "file_handling_impl/event_manager_impl.h" #include "file_handling_impl/channel_manager_impl.h" #include "tab_context.h" #include "file_context.h" #include "gui/main_window_model.h" #include "editing_commands/macro_undo_command.h" #include "editing_commands/new_event_undo_command.h" #include "gui/progress_bar.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const OpenFileGuiCommand::IMPORT_EVENTS_ = "Import Events..."; QString const OpenFileGuiCommand::OPEN_ = "Open..."; QString const OpenFileGuiCommand::SHOW_FILE_INFO_ = "Info..."; QStringList const OpenFileGuiCommand::ACTIONS_ = QStringList() << OpenFileGuiCommand::IMPORT_EVENTS_ << OpenFileGuiCommand::OPEN_ << OpenFileGuiCommand::SHOW_FILE_INFO_; //----------------------------------------------------------------------------- QSharedPointer OpenFileGuiCommand::instance_ = QSharedPointer (new OpenFileGuiCommand); //----------------------------------------------------------------------------- GuiActionFactoryRegistrator OpenFileGuiCommand::registrator_ ("Opening", OpenFileGuiCommand::instance_); //----------------------------------------------------------------------------- OpenFileGuiCommand::OpenFileGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //------------------------------------------------------------------------- OpenFileGuiCommand::~OpenFileGuiCommand () { // nothing to do here } //----------------------------------------------------------------------------- void OpenFileGuiCommand::init () { setShortcut (OPEN_, QKeySequence::Open); setIcon (OPEN_, QIcon(":/images/icons/fileopen.png")); setIcon (SHOW_FILE_INFO_, QIcon(":/images/info_16x16.png")); resetActionTriggerSlot (OPEN_, SLOT(open())); resetActionTriggerSlot (IMPORT_EVENTS_, SLOT(importEvents())); resetActionTriggerSlot (SHOW_FILE_INFO_, SLOT(showFileInfo())); } //----------------------------------------------------------------------------- void OpenFileGuiCommand::openFile (QString file_path, bool instantly) { instance_->openFileImpl (file_path, instantly); } //------------------------------------------------------------------------- void OpenFileGuiCommand::evaluateEnabledness () { bool file_opened = (getApplicationState() == APP_STATE_FILE_OPEN); getQAction (IMPORT_EVENTS_)->setEnabled (file_opened); getQAction (SHOW_FILE_INFO_)->setEnabled (file_opened); } //------------------------------------------------------------------------- void OpenFileGuiCommand::open () { QStringList extension_list = FileSignalReaderFactory::getInstance()->getAllFileEndingsWithWildcards(); QString extensions; foreach (QString extension, extension_list) extensions.append (extension + " "); QSettings settings ("SigViewer"); QString open_path = settings.value ("file_open_path").toString(); if (!open_path.length()) open_path = QDir::homePath (); QString file_path = showOpenDialog (open_path, extensions); if (file_path.isEmpty()) return; openFileImpl (file_path); } //------------------------------------------------------------------------- void OpenFileGuiCommand::importEvents () { QString extensions = "*.evt"; QSettings settings ("SigViewer"); QString open_path = settings.value ("file_open_path").toString(); if (!open_path.length()) open_path = QDir::homePath (); QString file_path = showOpenDialog (open_path, extensions); FileSignalReader* file_signal_reader = FileSignalReaderFactory::getInstance()->getHandler (file_path); if (file_signal_reader == 0) return; QList > events = file_signal_reader->getEvents (); QSharedPointer event_manager = currentVisModel()->getEventManager(); QList > creation_commands; foreach (QSharedPointer event, events) { QSharedPointer creation_command (new NewEventUndoCommand (event_manager, event)); creation_commands.append (creation_command); } MacroUndoCommand* macro_command = new MacroUndoCommand (creation_commands); applicationContext()->getCurrentCommandExecuter()->executeCommand (macro_command); delete file_signal_reader; } //------------------------------------------------------------------------- void OpenFileGuiCommand::showFileInfo () { BasicHeaderInfoDialog basic_header_info_dialog(applicationContext()->getCurrentFileContext()->getHeader()); basic_header_info_dialog.loadSettings(); basic_header_info_dialog.exec(); basic_header_info_dialog.saveSettings(); } //------------------------------------------------------------------------- void OpenFileGuiCommand::openFileImpl (QString file_path, bool instantly) { file_path = QDir::toNativeSeparators (file_path); FileSignalReader* file_signal_reader = FileSignalReaderFactory::getInstance()->getHandler (file_path); if (file_signal_reader == 0) return; QString file_name = file_path.section (QDir::separator(), -1); ChannelManager* channel_manager (new ChannelManagerImpl (file_signal_reader)); std::set shown_channels; if (instantly) shown_channels = channel_manager->getChannels(); else shown_channels = GuiHelper::selectChannels (*channel_manager, applicationContext()->getEventColorManager(), file_signal_reader->getBasicHeader()); if (shown_channels.size() == 0) { delete channel_manager; return; } ProgressBar::instance().initAndShow (channel_manager->getNumberChannels() * 3, tr("Opening ") + file_name, applicationContext()); QSharedPointer event_manager (new EventManagerImpl (*file_signal_reader)); QSharedPointer file_context (new FileContext (file_path, event_manager, channel_manager, file_signal_reader->getBasicHeader())); QSettings settings("SigViewer"); settings.setValue("file_open_path", file_path.left (file_path.length() - file_name.length())); QSharedPointer signal_visualisation_model = applicationContext()->getMainWindowModel()->createSignalVisualisationOfFile (file_context); signal_visualisation_model->setShownChannels (shown_channels); signal_visualisation_model->update(); applicationContext()->addFileContext (file_context); ProgressBar::instance().close(); } //----------------------------------------------------------------------------- QString OpenFileGuiCommand::showOpenDialog (QString const& path, QString const& extensions) { QString extension_selection = tr("Signal files (%1)").arg(extensions); QStringList ext_list = extensions.split (" "); for (QStringList::iterator it = ext_list.begin(); it != ext_list.end(); it++) { if (it->size ()) extension_selection += ";; " + *it +" (" + *it + ")"; } extension_selection += ";; *.* (*.*)"; return QFileDialog::getOpenFileName (0, tr("Chose signal file to open"), path, extension_selection); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/commands/open_file_gui_command.h000066400000000000000000000037471154433734200254540ustar00rootroot00000000000000#ifndef OPEN_FILE_GUI_COMMAND_H #define OPEN_FILE_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" #include "file_handling/file_signal_reader.h" namespace SigViewer_ { //----------------------------------------------------------------------------- /// OpenFileGuiCommand /// /// command for opening a file class OpenFileGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- OpenFileGuiCommand (); //------------------------------------------------------------------------- virtual ~OpenFileGuiCommand (); //------------------------------------------------------------------------- virtual void init (); //------------------------------------------------------------------------- static void openFile (QString file_path, bool instantly = true); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private slots: //------------------------------------------------------------------------- void open (); //------------------------------------------------------------------------- void importEvents (); //------------------------------------------------------------------------- void showFileInfo (); private: static QString const IMPORT_EVENTS_; static QString const OPEN_; static QString const SHOW_FILE_INFO_; static QStringList const ACTIONS_; static QSharedPointer instance_; static GuiActionFactoryRegistrator registrator_; //------------------------------------------------------------------------- void openFileImpl (QString file_path, bool instantly = true); //------------------------------------------------------------------------- QString showOpenDialog (QString const& path, QString const& extensions); }; } // namespace SigViewer_ #endif // OPEN_FILE_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/save_gui_command.cpp000066400000000000000000000243221154433734200247750ustar00rootroot00000000000000#include "save_gui_command.h" #include "gui_impl/gui_helper_functions.h" #include "file_handling/file_signal_writer_factory.h" #include "open_file_gui_command.h" #include #include #include #include #include #include namespace SigViewer_ { QString const SaveGuiCommand::SAVE_AS_ = "Save as..."; QString const SaveGuiCommand::SAVE_ = "Save"; QString const SaveGuiCommand::EXPORT_TO_PNG_ = "Export to PNG..."; QString const SaveGuiCommand::EXPORT_TO_GDF_ = "Export to GDF..."; QString const SaveGuiCommand::EXPORT_EVENTS_ = "Export Events..."; QStringList const SaveGuiCommand::ACTIONS_ = QStringList() << SaveGuiCommand::SAVE_AS_ << SaveGuiCommand::SAVE_ << SaveGuiCommand::EXPORT_TO_GDF_ << SaveGuiCommand::EXPORT_EVENTS_ << SaveGuiCommand::EXPORT_TO_PNG_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator SaveGuiCommand::registrator_ ("Saving", QSharedPointer (new SaveGuiCommand)); //----------------------------------------------------------------------------- SaveGuiCommand::SaveGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //----------------------------------------------------------------------------- void SaveGuiCommand::init () { setIcon(SAVE_, QIcon (":/images/icons/filesave.png")); setShortcut (SAVE_, QKeySequence::Save); setShortcut (SAVE_AS_, QKeySequence::SaveAs); resetActionTriggerSlot (SAVE_AS_, SLOT(saveAs())); resetActionTriggerSlot (SAVE_, SLOT(save())); resetActionTriggerSlot (EXPORT_TO_PNG_, SLOT(exportToPNG())); resetActionTriggerSlot (EXPORT_TO_GDF_, SLOT(exportToGDF())); resetActionTriggerSlot (EXPORT_EVENTS_, SLOT(exportEvents())); } //----------------------------------------------------------------------------- void SaveGuiCommand::saveAs () { QSharedPointer file_context = applicationContext()->getCurrentFileContext(); QString old_file_path = file_context->getFilePath (); QString old_file_path_and_name = file_context->getFilePathAndName(); QString file_name = file_context->getFileName(); QString extension = file_name.mid(file_name.lastIndexOf('.')); extension = "*" + extension; QString new_file_path = GuiHelper::getFilePathFromSaveAsDialog (old_file_path, extension, tr("Signal files")); if (new_file_path.size()) { if (QFile::exists (new_file_path)) { if (QMessageBox::question(0, tr("Overwrite"), tr("Replace ") + new_file_path + tr("?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) QFile::remove(new_file_path); else return; } if (QFile::copy (old_file_path_and_name, new_file_path)) { FileSignalWriter* writer (FileSignalWriterFactory::getInstance()->getHandler(new_file_path)); bool can_save_events = false; if (writer) can_save_events = writer->supportsSavingEvents (); QSharedPointer event_mgr = file_context->getEventManager(); if (writer && can_save_events) { QString error = writer->saveEventsToSignalFile (event_mgr, event_mgr->getEventTypes()); if (error.size()) QMessageBox::critical(0, new_file_path, error); else { file_context->resetFilePathAndName (new_file_path); file_context->setState(FILE_STATE_UNCHANGED); } } else if (event_mgr->getNumberOfEvents() > 0) QMessageBox::information(0, "", "Events not stored to " + new_file_path + "\n If you want to store events export the file to GDF or export the events into a EVT file!"); delete writer; } else QMessageBox::critical(0, "Saving.... failed!", "Could not save " + file_name + " to " + new_file_path); } } //----------------------------------------------------------------------------- void SaveGuiCommand::save () { QString file_path = applicationContext()->getCurrentFileContext()->getFilePathAndName(); QString file_name = applicationContext()->getCurrentFileContext()->getFileName(); FileSignalWriter* writer = FileSignalWriterFactory::getInstance()->getHandler (file_path); bool can_save_events = false; if (writer) can_save_events = writer->supportsSavingEvents(); if (writer && can_save_events) { QSharedPointer event_mgr = currentVisModel()->getEventManager(); QString error = writer->saveEventsToSignalFile(event_mgr, event_mgr->getEventTypes()); if (error.size()) QMessageBox::critical (0, tr("Error"), error); else applicationContext()->getCurrentFileContext()->setState(FILE_STATE_UNCHANGED); } else { QMessageBox::StandardButton pressed_button = QMessageBox::question (0, file_name, tr("Saving of Events is not possible to this file format! Do you want to convert this file into GDF?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if (pressed_button == QMessageBox::Yes) exportToGDF (); } delete writer; } //----------------------------------------------------------------------------- void SaveGuiCommand::exportToPNG () { QString extension = "*.png"; QString file_path = GuiHelper::getFilePathFromSaveAsDialog (applicationContext()->getCurrentFileContext()->getFilePath(), extension, tr("PNG files")); SignalVisualisationView const* view = currentVisModel()->view(); QSharedPointer image = view->renderVisibleScene (); image->save (file_path, "PNG", 100); } //----------------------------------------------------------------------------- void SaveGuiCommand::exportToGDF () { QMessageBox::information (0, "Information", "Attention: Converting to GDF is in testing phase. Meta-data will not be converted."); QString extensions = "*.gdf"; QString current_file_path = applicationContext()->getCurrentFileContext()->getFilePathAndName(); QString current_file_name = applicationContext()->getCurrentFileContext()->getFileName(); current_file_path = current_file_path.left(current_file_path.size() - current_file_name.size()); QString new_file_path = GuiHelper::getFilePathFromSaveAsDialog (current_file_path, extensions, tr("GDF files")); if (new_file_path.size() == 0) return; FileSignalWriter* writer = FileSignalWriterFactory::getInstance()->getHandler (new_file_path); if (writer == 0) { QMessageBox::critical (0, tr("Error"), tr("Export failed!")); return; } QSharedPointer event_mgr = currentVisModel()->getEventManager(); QString error = writer->save (applicationContext()->getCurrentFileContext(), event_mgr->getEventTypes()); if (error.size() == 0) { QMessageBox::StandardButton pressed_button = QMessageBox::question(0, current_file_name, current_file_name + tr(" has been converted into GDF and stored in:\n") + new_file_path + tr("\n\nDo you want to open the GDF file?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (pressed_button == QMessageBox::Yes) OpenFileGuiCommand::openFile (new_file_path); } else QMessageBox::critical (0, current_file_name, tr("Exporting to GDF failed!\n") + error); delete writer; } //------------------------------------------------------------------------- void SaveGuiCommand::exportEvents () { std::set types = GuiHelper::selectEventTypes (currentVisModel()->getShownEventTypes(), currentVisModel()->getEventManager(), applicationContext()->getEventColorManager()); QString current_file_path = applicationContext()->getCurrentFileContext()->getFilePathAndName(); QString extension = ".evt"; QString extenstions = "*.evt"; QString new_file_path = GuiHelper::getFilePathFromSaveAsDialog (current_file_path.left(current_file_path.lastIndexOf('.')) + extension, extenstions, tr("Events files")); if (new_file_path.size() == 0) return; FileSignalWriter* file_signal_writer = FileSignalWriterFactory::getInstance() ->getHandler(new_file_path); qDebug() << new_file_path; file_signal_writer->save (applicationContext()->getCurrentFileContext(), types); delete file_signal_writer; } //------------------------------------------------------------------------- void SaveGuiCommand::evaluateEnabledness () { disableIfNoFileIsOpened (QStringList() << EXPORT_TO_PNG_); disableIfNoSignalIsVisualised (QStringList() << EXPORT_TO_PNG_); bool file_open = getApplicationState () == APP_STATE_FILE_OPEN; bool no_gdf_file_open = false; bool file_changed = false; bool has_events = false; if (file_open) { no_gdf_file_open = !(applicationContext()->getCurrentFileContext()->getFileName().endsWith("gdf")); file_changed = (getFileState () == FILE_STATE_CHANGED); if (!currentVisModel().isNull()) if (!currentVisModel()->getEventManager().isNull()) has_events = currentVisModel()->getEventManager()->getNumberOfEvents() > 0; } getQAction (SAVE_)->setEnabled (file_changed); getQAction (SAVE_AS_)->setEnabled (file_open); getQAction (EXPORT_TO_GDF_)->setEnabled (no_gdf_file_open); getQAction (EXPORT_EVENTS_)->setEnabled (has_events); } } sigviewer-0.5.1+svn556/src/gui_impl/commands/save_gui_command.h000066400000000000000000000032331154433734200244400ustar00rootroot00000000000000#ifndef SAVE_GUI_COMMAND_H #define SAVE_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" namespace SigViewer_ { //----------------------------------------------------------------------------- /// SaveGuiCommand /// /// command for saving a file and converting to other file format class SaveGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- SaveGuiCommand (); //------------------------------------------------------------------------- virtual void init (); public slots: //------------------------------------------------------------------------- void saveAs (); //------------------------------------------------------------------------- void save (); //------------------------------------------------------------------------- void exportToPNG (); //------------------------------------------------------------------------- void exportToGDF (); //------------------------------------------------------------------------- void exportEvents (); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private: //------------------------------------------------------------------------- static QString const SAVE_AS_; static QString const SAVE_; static QString const EXPORT_TO_PNG_; static QString const EXPORT_TO_GDF_; static QString const EXPORT_EVENTS_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } #endif // SAVE_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/signal_processing_gui_command.cpp000066400000000000000000000222671154433734200275560ustar00rootroot00000000000000#include "signal_processing_gui_command.h" #include "gui_impl/gui_helper_functions.h" #include "gui_impl/processed_signal_channel_manager.h" #include "gui/progress_bar.h" #include "base/fixed_data_block.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const SignalProcessingGuiCommand::MEAN_ = "Calculate Mean..."; QString const SignalProcessingGuiCommand::POWER_SPECTRUM_ = "Power Spectrum..."; QStringList const SignalProcessingGuiCommand::ACTIONS_ = QStringList () << SignalProcessingGuiCommand::MEAN_ << SignalProcessingGuiCommand::POWER_SPECTRUM_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator SignalProcessingGuiCommand::registrator_ ("Signal Processing", QSharedPointer(new SignalProcessingGuiCommand)); //----------------------------------------------------------------------------- SignalProcessingGuiCommand::SignalProcessingGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //----------------------------------------------------------------------------- void SignalProcessingGuiCommand::init () { resetActionTriggerSlot (MEAN_, SLOT(calculateMeanAndStandardDeviation())); resetActionTriggerSlot (POWER_SPECTRUM_, SLOT(calculatePowerSpectrum())); } //----------------------------------------------------------------------------- void SignalProcessingGuiCommand::evaluateEnabledness () { disableIfNoFileIsOpened (ACTIONS_); } //----------------------------------------------------------------------------- void SignalProcessingGuiCommand::calculateMeanAndStandardDeviation () { ChannelManager const& channel_manager = currentFileContext()->getChannelManager(); QSharedPointer event_manager = currentFileContext()->getEventManager(); QSharedPointer event_dialog = getFinishedEventTimeSelectionDialog(); if (event_dialog.isNull()) return; unsigned num_samples = channel_manager.getSampleRate() * event_dialog->getLengthInSeconds (); unsigned samples_before = channel_manager.getSampleRate() * event_dialog->getSecondsBeforeEvent (); ProcessedSignalChannelManager* processed_channel_manager (new ProcessedSignalChannelManager(channel_manager.getSampleRate(), num_samples, currentFileContext().data())); processed_channel_manager->setXAxisUnitLabel(channel_manager.getXAxisUnitLabel()); ChannelID new_channel_id = 0; QList events (event_manager->getEvents(event_dialog->getSelectedEventType ())); foreach (ChannelID channel_id, event_dialog->getSelectedChannels ()) { std::list > data; foreach (EventID event_id, events) { QSharedPointer event = event_manager->getEvent (event_id); if (event->getPosition () < samples_before) { QMessageBox::warning (0, "Warning", QString("Event at ").append(QString::number(event->getPositionInSec())).append("s will be ignored! (because no data can be added in front of this event)")); continue; } QSharedPointer data_block = channel_manager.getData (channel_id, event->getPosition() - samples_before, num_samples); if (!data_block.isNull()) data.push_back (data_block); } QSharedPointer mean = FixedDataBlock::calculateMean (data); QSharedPointer standard_deviation = FixedDataBlock::calculateStandardDeviation (data, mean); processed_channel_manager->addExtraChannel (new_channel_id, standard_deviation, tr("Standard Deviation\n") + channel_manager.getChannelLabel(channel_id), channel_manager.getChannelYUnitString(channel_id)); new_channel_id++; processed_channel_manager->addChannel (new_channel_id, mean, channel_manager.getChannelLabel(channel_id), channel_manager.getChannelYUnitString(channel_id)); new_channel_id++; //applicationContext()->getEventColorManager()->setChannelColor(stddev_id, // applicationContext()->getEventColorManager()->getChannelColor(channel_id)); } createVisualisation (tr("Mean"), *processed_channel_manager); } //------------------------------------------------------------------------- void SignalProcessingGuiCommand::calculatePowerSpectrum () { ChannelManager const& channel_manager = currentFileContext()->getChannelManager(); QSharedPointer event_manager = currentFileContext()->getEventManager(); QSharedPointer event_dialog = getFinishedEventTimeSelectionDialog(); if (event_dialog.isNull()) return; unsigned num_samples = channel_manager.getSampleRate() * event_dialog->getLengthInSeconds (); unsigned samples_before = channel_manager.getSampleRate() * event_dialog->getSecondsBeforeEvent (); unsigned fft_samples = 1; while (fft_samples < num_samples) fft_samples *= 2; ProcessedSignalChannelManager* processed_channel_manager (new ProcessedSignalChannelManager(static_cast(fft_samples) / channel_manager.getSampleRate(), fft_samples / 2, currentFileContext().data())); processed_channel_manager->setXAxisUnitLabel ("Hz"); QList events (event_manager->getEvents(event_dialog->getSelectedEventType ())); ProgressBar::instance().initAndShow (event_dialog->getSelectedChannels ().size(), tr("Fourier Transformation"), applicationContext()); foreach (ChannelID channel_id, event_dialog->getSelectedChannels ()) { ProgressBar::instance().increaseValue (1, channel_manager.getChannelLabel(channel_id)); std::list > data; foreach (EventID event_id, events) { QSharedPointer event = event_manager->getEvent (event_id); if (event->getPosition () < samples_before) { QMessageBox::warning (0, "Warning", QString("Event at ").append(QString::number(event->getPositionInSec())).append("s will be ignored! (because no data can be added in front of this event)")); continue; } QSharedPointer data_block = channel_manager.getData (channel_id, event->getPosition() - samples_before, num_samples); if (!data_block.isNull()) data.push_back (FixedDataBlock::createPowerSpectrum(data_block)); } QSharedPointer mean = FixedDataBlock::calculateMean (data); QString unit = QString("log(").append(channel_manager.getChannelYUnitString (channel_id)) .append(QChar(0xb2)) .append("/Hz)"); processed_channel_manager->addChannel (channel_id, mean, channel_manager.getChannelLabel(channel_id), unit); } ProgressBar::instance().close(); createVisualisation (tr("Power Spectrum"), *processed_channel_manager); } //------------------------------------------------------------------------- QSharedPointer SignalProcessingGuiCommand::getFinishedEventTimeSelectionDialog () { QSharedPointer event_dialog ( new EventTimeSelectionDialog (currentFileContext()->getMainVisualisationModel()->getShownEventTypes(), currentFileContext()->getMainVisualisationModel()->getShownChannels(), currentFileContext()->getMainVisualisationModel()->getChannelManager(), currentFileContext()->getMainVisualisationModel()->getEventManager())); if (event_dialog->exec() == QDialog::Accepted) return event_dialog; else return QSharedPointer (0); } //------------------------------------------------------------------------- void SignalProcessingGuiCommand::createVisualisation (QString const& title, ChannelManager const& channel_manager) { QSharedPointer signal_visualisation_model = applicationContext()->getMainWindowModel()->createSignalVisualisation (title, channel_manager); signal_visualisation_model->setShownChannels (channel_manager.getChannels()); signal_visualisation_model->update(); } } sigviewer-0.5.1+svn556/src/gui_impl/commands/signal_processing_gui_command.h000066400000000000000000000027771154433734200272270ustar00rootroot00000000000000#ifndef SIGNAL_PROCESSING_GUI_COMMAND_H #define SIGNAL_PROCESSING_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" #include "gui_impl/dialogs/event_time_selection_dialog.h" namespace SigViewer_ { class SignalProcessingGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- SignalProcessingGuiCommand (); //------------------------------------------------------------------------- virtual void init (); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private slots: //------------------------------------------------------------------------- void calculateMeanAndStandardDeviation (); //------------------------------------------------------------------------- void calculatePowerSpectrum (); private: //------------------------------------------------------------------------- QSharedPointer getFinishedEventTimeSelectionDialog (); //------------------------------------------------------------------------- void createVisualisation (QString const& title, ChannelManager const& channel_manager); static QString const MEAN_; static QString const POWER_SPECTRUM_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } // namespace SigViewer_ #endif // SIGNAL_PROCESSING_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/undo_redo_gui_command.cpp000066400000000000000000000046701154433734200260210ustar00rootroot00000000000000#include "undo_redo_gui_command.h" namespace SigViewer_ { //----------------------------------------------------------------------------- QString const UndoRedoGuiCommand::UNDO_ = "Undo"; QString const UndoRedoGuiCommand::REDO_ = "Redo"; QStringList const UndoRedoGuiCommand::ACTIONS_ = QStringList () << UndoRedoGuiCommand::UNDO_ << UndoRedoGuiCommand::REDO_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator UndoRedoGuiCommand::registrator_ ("UndoRedo", QSharedPointer (new UndoRedoGuiCommand)); //----------------------------------------------------------------------------- UndoRedoGuiCommand::UndoRedoGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //----------------------------------------------------------------------------- void UndoRedoGuiCommand::init () { setShortcut (UNDO_, QKeySequence::Undo); setShortcut (REDO_, QKeySequence::Redo); setIcon (UNDO_, QIcon (":/images/icons/undo.png")); setIcon (REDO_, QIcon (":/images/icons/redo.png")); resetActionTriggerSlot (UNDO_, SLOT(undo())); resetActionTriggerSlot (REDO_, SLOT(redo())); } //----------------------------------------------------------------------------- void UndoRedoGuiCommand::undo () { applicationContext()->getCurrentCommandExecuter()->undo(); } //----------------------------------------------------------------------------- void UndoRedoGuiCommand::redo () { applicationContext()->getCurrentCommandExecuter()->redo(); } //------------------------------------------------------------------------- void UndoRedoGuiCommand::evaluateEnabledness () { bool can_undo = getTabEditState() != TAB_STATE_NO_UNDO && getTabEditState() != TAB_STATE_NO_REDO_NO_UNDO && getTabEditState() != NO_TAB_EDIT_STATE && getApplicationState() == APP_STATE_FILE_OPEN; bool can_redo = getTabEditState() != TAB_STATE_NO_REDO && getTabEditState() != TAB_STATE_NO_REDO_NO_UNDO && getTabEditState() != NO_TAB_EDIT_STATE && getApplicationState() == APP_STATE_FILE_OPEN; getQAction (UNDO_)->setEnabled (can_undo); getQAction (REDO_)->setEnabled (can_redo); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/commands/undo_redo_gui_command.h000066400000000000000000000024161154433734200254620ustar00rootroot00000000000000#ifndef UNDO_REDO_GUI_COMMAND_H #define UNDO_REDO_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" namespace SigViewer_ { //----------------------------------------------------------------------------- class UndoRedoGuiCommand : public GuiActionCommand { Q_OBJECT public: //------------------------------------------------------------------------- UndoRedoGuiCommand (); //------------------------------------------------------------------------- virtual ~UndoRedoGuiCommand () {} //------------------------------------------------------------------------- virtual void init (); public slots: //------------------------------------------------------------------------- void undo (); //------------------------------------------------------------------------- void redo (); protected: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private: //------------------------------------------------------------------------- static QString const UNDO_; static QString const REDO_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } #endif // UNDO_REDO_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/commands/zoom_gui_command.cpp000066400000000000000000000256661154433734200250370ustar00rootroot00000000000000#include "zoom_gui_command.h" #include "gui_impl/gui_helper_functions.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- QString const ZoomGuiCommand::GOTO_ = "Go to..."; QString const ZoomGuiCommand::ZOOM_IN_VERTICAL_ = "Zoom In Vertical"; QString const ZoomGuiCommand::ZOOM_OUT_VERTICAL_ = "Zoom Out Vertical"; QString const ZoomGuiCommand::ZOOM_IN_HORIZONTAL_ = "Zoom In Horizontal"; QString const ZoomGuiCommand::ZOOM_OUT_HORIZONTAL_ = "Zoom Out Horizontal"; QString const ZoomGuiCommand::SCALE_X_AXIS_ = "Scale X Axis"; QString const ZoomGuiCommand::CHANNEL_PER_PAGE_ = "Channels per Page..."; QString const ZoomGuiCommand::AUTO_ZOOM_VERTICAL_ = "Auto Zoom Vertical"; QStringList const ZoomGuiCommand::ACTIONS_ = QStringList() << ZoomGuiCommand::ZOOM_IN_VERTICAL_ << ZoomGuiCommand::ZOOM_OUT_VERTICAL_ << ZoomGuiCommand::ZOOM_IN_HORIZONTAL_ << ZoomGuiCommand::ZOOM_OUT_HORIZONTAL_ << ZoomGuiCommand::GOTO_ << ZoomGuiCommand::SCALE_X_AXIS_ << ZoomGuiCommand::CHANNEL_PER_PAGE_; //----------------------------------------------------------------------------- GuiActionFactoryRegistrator ZoomGuiCommand::registrator_ ("Zooming", QSharedPointer (new ZoomGuiCommand)); //----------------------------------------------------------------------------- ZoomGuiCommand::ZoomGuiCommand () : GuiActionCommand (ACTIONS_) { // nothing to do here } //----------------------------------------------------------------------------- void ZoomGuiCommand::init () { getQAction (GOTO_)->setIcon (QIcon(":/images/icons/goto.png")); getQAction (ZOOM_IN_VERTICAL_)->setIcon (QIcon(":/images/icons/zoom_in_vertical.png")); getQAction (ZOOM_OUT_VERTICAL_)->setIcon (QIcon(":/images/icons/zoom_out_vertical.png")); getQAction (ZOOM_IN_HORIZONTAL_)->setIcon (QIcon(":/images/icons/zoom_in_horizontal.png")); getQAction (ZOOM_OUT_HORIZONTAL_)->setIcon (QIcon(":/images/icons/zoom_out_horizontal.png")); setShortcut (ZOOM_IN_VERTICAL_, QKeySequence::ZoomIn); setShortcut (ZOOM_OUT_VERTICAL_, QKeySequence::ZoomOut); setShortcut (ZOOM_IN_HORIZONTAL_, Qt::ALT + Qt::Key_Plus); setShortcut (ZOOM_OUT_HORIZONTAL_, Qt::ALT + Qt::Key_Minus); resetActionTriggerSlot (GOTO_, SLOT(goTo())); resetActionTriggerSlot (ZOOM_IN_VERTICAL_, SLOT(zoomInVertical())); resetActionTriggerSlot (ZOOM_OUT_VERTICAL_, SLOT(zoomOutVertical())); resetActionTriggerSlot (ZOOM_IN_HORIZONTAL_, SLOT(zoomInHorizontal())); resetActionTriggerSlot (ZOOM_OUT_HORIZONTAL_, SLOT(zoomOutHorizontal())); resetActionTriggerSlot (SCALE_X_AXIS_, SLOT(scaleXAxis())); resetActionTriggerSlot (CHANNEL_PER_PAGE_, SLOT(setChannelsPerPage())); } //------------------------------------------------------------------------- void ZoomGuiCommand::evaluateEnabledness () { if (disableIfNoSignalIsVisualised (ACTIONS_)) return; qDebug () << "blaaahaha"; QSharedPointer vis = currentSignalViewSettings (); QSharedPointer vis_model = currentVisModel(); bool file_open = getApplicationState () == APP_STATE_FILE_OPEN; bool zoom_out_vertical_possible = false; bool zoom_in_vertical_possible = false; bool zoom_out_horizontal_possible = false; bool zoom_in_horizontal_possible = false; if (file_open && !vis.isNull()) { zoom_out_vertical_possible = (vis_model->getSignalViewSettings()->getChannelHeight() * vis_model->getShownChannels().size() > static_cast(vis_model->view()->getViewportHeight())); zoom_in_vertical_possible = (vis_model->getSignalViewSettings()->getChannelHeight() < vis_model->view()->getViewportHeight()); zoom_out_horizontal_possible = vis->getPixelsPerSample() > minPixelPerSample(); zoom_in_horizontal_possible = vis->getPixelsPerSample() < maxPixelPerSample(); } getQAction (ZOOM_OUT_VERTICAL_)->setEnabled (zoom_out_vertical_possible); getQAction (ZOOM_IN_VERTICAL_)->setEnabled (zoom_in_vertical_possible); getQAction (ZOOM_OUT_HORIZONTAL_)->setEnabled (zoom_out_horizontal_possible); getQAction (ZOOM_IN_HORIZONTAL_)->setEnabled (zoom_in_horizontal_possible); disableIfNoFileIsOpened (QStringList() << GOTO_ << SCALE_X_AXIS_ << CHANNEL_PER_PAGE_); } //------------------------------------------------------------------------- void ZoomGuiCommand::goTo () { QSharedPointer vis_model = currentVisModel(); bool ok; double sec = QInputDialog::getDouble (0, tr("Go to..."), tr("Second: "), 0, 0, vis_model->getChannelManager().getDurationInSec(), 1, &ok); if (!ok) return; vis_model->goToSample (sec * vis_model->getChannelManager().getSampleRate ()); } //----------------------------------------------------------------------------- void ZoomGuiCommand::zoomInHorizontal () { float32 pixel_per_sample = currentSignalViewSettings()->getPixelsPerSample(); float32 new_pixel_per_sample = std::min (pixel_per_sample * ZOOM_FACTOR_, maxPixelPerSample() ); GuiHelper::animateProperty (currentSignalViewSettings().data(), "pixelsPerSample", pixel_per_sample, new_pixel_per_sample, this, SLOT(evaluateEnabledness())); } //----------------------------------------------------------------------------- void ZoomGuiCommand::zoomOutHorizontal () { float32 pixel_per_sample = currentSignalViewSettings()->getPixelsPerSample(); float32 new_pixel_per_sample = std::max (pixel_per_sample / ZOOM_FACTOR_, minPixelPerSample ()); GuiHelper::animateProperty (currentSignalViewSettings().data(), "pixelsPerSample", pixel_per_sample, new_pixel_per_sample, this, SLOT(evaluateEnabledness())); } //----------------------------------------------------------------------------- void ZoomGuiCommand::zoomInVertical () { unsigned channel_height = currentVisModel()->getSignalViewSettings()->getChannelHeight(); unsigned channels_per_page = currentVisModel()->view()->getViewportHeight() / channel_height; if (channels_per_page <= 1) return; unsigned new_channel_height = currentVisModel()->view()->getViewportHeight() / (channels_per_page - 1); if (new_channel_height < channel_height + 10) new_channel_height += 10; new_channel_height = std::min (new_channel_height, maxChannelHeight()); GuiHelper::animateProperty (currentVisModel()->getSignalViewSettings().data(), "channelHeight", channel_height, new_channel_height, this, SLOT(evaluateEnabledness())); } //----------------------------------------------------------------------------- void ZoomGuiCommand::zoomOutVertical () { unsigned channel_height = currentSignalViewSettings()->getChannelHeight(); unsigned channels_per_page = currentVisModel()->view()->getViewportHeight() / channel_height; unsigned new_channel_height = currentVisModel()->view()->getViewportHeight() / (channels_per_page + 1); if (new_channel_height == channel_height) new_channel_height -= 25; new_channel_height = std::max (new_channel_height, minChannelHeight()); GuiHelper::animateProperty (currentVisModel()->getSignalViewSettings().data(), "channelHeight", channel_height, new_channel_height, this, SLOT(evaluateEnabledness())); } //----------------------------------------------------------------------------- void ZoomGuiCommand::autoZoomVertical () { } //------------------------------------------------------------------------- void ZoomGuiCommand::scaleXAxis () { float32 sample_rate = currentVisModel()->getChannelManager().getSampleRate(); float32 pixel_per_second = currentSignalViewSettings()->getPixelsPerSample() * sample_rate; float32 width = currentVisModel()->view()->getViewportWidth(); float32 new_secs_per_page = QInputDialog::getDouble (0, tr("Scale X Axis"), tr("Seconds"), width / pixel_per_second, minPixelPerSample() / sample_rate, currentVisModel()->getChannelManager().getDurationInSec()); float32 pixel_per_sample = width / (new_secs_per_page * sample_rate); GuiHelper::animateProperty (currentSignalViewSettings().data(), "pixelsPerSample", currentSignalViewSettings()->getPixelsPerSample(), pixel_per_sample, this, SLOT(evaluateEnabledness())); } //------------------------------------------------------------------------- void ZoomGuiCommand::setChannelsPerPage () { unsigned channel_height = currentVisModel()->getSignalViewSettings()->getChannelHeight(); float viewport_height = currentVisModel()->view()->getViewportHeight(); float channels_per_page = viewport_height / channel_height; bool ok = false; float new_channels_per_page = QInputDialog::getInt (0, tr("Vertical Zooming"), tr("Channels per Page"), channels_per_page, 1, currentVisModel()->getShownChannels().size(), 1, &ok); if (!ok) return; unsigned new_channel_height = viewport_height / new_channels_per_page; if (new_channel_height == channel_height) return; GuiHelper::animateProperty (currentVisModel()->getSignalViewSettings().data(), "channelHeight", channel_height, new_channel_height, this, SLOT(evaluateEnabledness())); } //------------------------------------------------------------------------- unsigned ZoomGuiCommand::maxChannelHeight () { return currentVisModel()->view()->getViewportHeight(); } //------------------------------------------------------------------------- unsigned ZoomGuiCommand::minChannelHeight () { return std::max (20, currentVisModel()->view()->getViewportHeight() / currentVisModel()->getShownChannels().size()); } //------------------------------------------------------------------------- float32 ZoomGuiCommand::maxPixelPerSample () { return static_cast(currentVisModel()->view()->getViewportWidth ()) / 4.0; } //------------------------------------------------------------------------- float32 ZoomGuiCommand::minPixelPerSample () { return static_cast(currentVisModel()->view()->getViewportWidth()) / static_cast(currentVisModel()->getChannelManager().getNumberSamples ()); } } sigviewer-0.5.1+svn556/src/gui_impl/commands/zoom_gui_command.h000066400000000000000000000044521154433734200244720ustar00rootroot00000000000000#ifndef ZOOM_GUI_COMMAND_H #define ZOOM_GUI_COMMAND_H #include "gui/gui_action_command.h" #include "gui/gui_action_factory_registrator.h" namespace SigViewer_ { class ZoomGuiCommand : public GuiActionCommand { Q_OBJECT public: ZoomGuiCommand (); virtual void init (); protected slots: //------------------------------------------------------------------------- virtual void evaluateEnabledness (); private slots: //------------------------------------------------------------------------- void goTo (); //------------------------------------------------------------------------- void zoomInHorizontal (); //------------------------------------------------------------------------- void zoomOutHorizontal (); //------------------------------------------------------------------------- void zoomInVertical (); //------------------------------------------------------------------------- void zoomOutVertical (); //------------------------------------------------------------------------- void autoZoomVertical (); //------------------------------------------------------------------------- void scaleXAxis (); //------------------------------------------------------------------------- void setChannelsPerPage (); private: //------------------------------------------------------------------------- unsigned maxChannelHeight (); //------------------------------------------------------------------------- unsigned minChannelHeight (); //------------------------------------------------------------------------- float32 maxPixelPerSample (); //------------------------------------------------------------------------- float32 minPixelPerSample (); static float const ZOOM_FACTOR_ = 2; static float const MAX_HORIZONTAL_ZOOM_IN_ = 32; static QString const GOTO_; static QString const ZOOM_IN_VERTICAL_; static QString const ZOOM_OUT_VERTICAL_; static QString const ZOOM_IN_HORIZONTAL_; static QString const ZOOM_OUT_HORIZONTAL_; static QString const SCALE_X_AXIS_; static QString const CHANNEL_PER_PAGE_; static QString const AUTO_ZOOM_VERTICAL_; static QStringList const ACTIONS_; static GuiActionFactoryRegistrator registrator_; }; } #endif // ZOOM_GUI_COMMAND_H sigviewer-0.5.1+svn556/src/gui_impl/dialogs/000077500000000000000000000000001154433734200206075ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/gui_impl/dialogs/about_dialog.ui000066400000000000000000000156361154433734200236120ustar00rootroot00000000000000 aboutDialog 0 0 400 290 About SigViewer :/images/sigviewer16.png:/images/sigviewer16.png true :/images/sigviewer128.png Qt::AlignHCenter|Qt::AlignTop <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> <tr> <td style="border: none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:11pt; font-weight:600;">SigViewer [VERSION-NUMBER]</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://sigviewer.sf.net"><span style=" font-family:'Sans Serif'; font-size:8pt; text-decoration: underline; color:#0000ff;">http://sigviewer.sourceforge.net/</span></a></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:8pt; text-decoration: underline; color:#0000ff;"></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Clemens Brunner (Coordinator)</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Christoph Eibel</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Thomas Brunner</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Laboratory of Brain-Computer Interfaces</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Graz University of Technology</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://bci.tugraz.at"><span style=" font-family:'Sans Serif'; font-size:8pt; text-decoration: underline; color:#0000ff;">http://bci.tugraz.at/</span></a></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Thanks to:</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Alois Schlögl (</span><a href="http://biosig.sourceforge.net/"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">BioSig</span></a><span style=" font-family:'Sans Serif'; font-size:8pt;">)</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">Laurent de Soras (</span><a href="http://ldesoras.free.fr/prod.html"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">FFTReal</span></a><span style=" font-family:'Sans Serif'; font-size:8pt;">)</span></p></td></tr></table></body></html> Qt::RichText Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop QDialogButtonBox::Close buttonBox rejected() aboutDialog close() 198 261 198 141 sigviewer-0.5.1+svn556/src/gui_impl/dialogs/basic_header_info_dialog.cpp000066400000000000000000000230221154433734200262350ustar00rootroot00000000000000// basic_header_info_dialog.cpp #include "basic_header_info_dialog.h" #include "file_handling/basic_header.h" #include #include #include #include #include #include #include #include #include namespace SigViewer_ { // constructor BasicHeaderInfoDialog::BasicHeaderInfoDialog(QSharedPointer header, QWidget* parent) : QDialog(parent), basic_header_(header) { setWindowTitle(tr("Basic Header Info")); QVBoxLayout* top_layout = new QVBoxLayout(this); top_layout->setMargin(10); top_layout->setSpacing(10); info_tree_widget_ = new QTreeWidget(this); top_layout->addWidget(info_tree_widget_); QHBoxLayout* button_layout = new QHBoxLayout; button_layout->setMargin(0); top_layout->addLayout(button_layout); button_layout->addStretch(1); close_button_ = new QPushButton(tr("Close"), this); button_layout->addWidget(close_button_); button_layout->addStretch(1); buildTree(); resize(400, 400); top_layout->activate(); connect(close_button_, SIGNAL(clicked()), this, SLOT(accept())); } // load settings void BasicHeaderInfoDialog::loadSettings() { QSettings settings("SigViewer"); settings.beginGroup("BasicHeaderInfoDialog"); resize(settings.value("size", QSize(400, 400)).toSize()); move(settings.value("pos", QPoint(200, 200)).toPoint()); info_tree_widget_->header()->resizeSection(0, settings.value("col0_width", 100).toInt()); info_tree_widget_->header()->resizeSection(1, settings.value("col1_width", 150).toInt()); info_tree_widget_->header()->resizeSection(2, settings.value("col2_width", 100).toInt()); settings.endGroup(); } // save settings void BasicHeaderInfoDialog::saveSettings() { QSettings settings("SigViewer"); settings.beginGroup("BasicHeaderInfoDialog"); settings.setValue("size", size()); settings.setValue("pos", pos()); settings.setValue("col0_width", info_tree_widget_->header()->sectionSize(0)); settings.setValue("col1_width", info_tree_widget_->header()->sectionSize(1)); settings.setValue("col2_width", info_tree_widget_->header()->sectionSize(2)); settings.endGroup(); } // build tree void BasicHeaderInfoDialog::buildTree() { info_tree_widget_->setIconSize(QSize(16, 16)); info_tree_widget_->setRootIsDecorated(true); QStringList header_labels; header_labels << tr("Property") << tr("Value") << tr("Unit"); info_tree_widget_->setHeaderLabels(header_labels); info_tree_widget_->header()->setResizeMode(QHeaderView::Interactive); QTreeWidgetItem* root_item; QTreeWidgetItem* tmp_item; // basic root_item = new QTreeWidgetItem(info_tree_widget_); root_item->setText(0, tr("Basic")); root_item->setIcon(0, QIcon(":/images/info_16x16.png")); info_tree_widget_->setItemExpanded(root_item, true); tmp_item = new QTreeWidgetItem(root_item); tmp_item->setText(0, tr("File Type")); tmp_item->setText(1, basic_header_->getFileTypeString()); QMap recording_info = basic_header_->getRecordingInfo(); foreach (QString key, recording_info.keys()) { tmp_item = new QTreeWidgetItem(root_item); tmp_item->setText(0, key); tmp_item->setText(1, recording_info[key]); } // tmp_item = new QTreeWidgetItem(root_item); // tmp_item->setText(0, tr("Recording Time")); // tmp_item->setText(1, basic_header_->getRecordingTime().toString("dd.MM.yyyy hh:mm:ss")); // tmp_item = new QTreeWidgetItem(root_item); // // tmp_item ->setTextAlignment(1, Qt::AlignRight); // tmp_item->setText(0, tr("Triggered")); // tmp_item->setText(1, basic_header_->isTriggered() ? tr("yes") : tr("no")); // tmp_item = new QTreeWidgetItem(root_item); // // tmp_item ->setTextAlignment(1, Qt::AlignRight); // tmp_item->setText(0, tr("Recording")); // tmp_item->setText(1, QString::number(basic_header_->getRecordDuration() * // basic_header_->getNumberRecords())); // tmp_item->setText(2, tr("seconds")); // file root_item = new QTreeWidgetItem(info_tree_widget_); root_item->setText(0, tr("File")); root_item->setIcon(0, QIcon(":/images/file_16x16.png")); info_tree_widget_->setItemExpanded(root_item, true); tmp_item = new QTreeWidgetItem(root_item); tmp_item->setText(0, tr("Size")); QFileInfo file_info (basic_header_->getFilePath()); tmp_item->setText(1, QString::number(file_info.size() / 1024)); tmp_item->setText(0, tr("kByte")); // patient root_item = new QTreeWidgetItem(info_tree_widget_); root_item->setText(0, tr("Patient")); root_item->setIcon(0, QIcon(":/images/patient_16x16.png")); info_tree_widget_->setItemExpanded(root_item, true); QMap patient_info = basic_header_->getPatientInfo(); foreach (QString key, patient_info.keys()) { tmp_item = new QTreeWidgetItem(root_item); tmp_item->setText(0, key); tmp_item->setText(1, patient_info[key]); } // events root_item = new QTreeWidgetItem(info_tree_widget_); root_item->setText(0, tr("Events")); root_item->setIcon(0, QIcon(":/images/events_22x22.png")); info_tree_widget_->setItemExpanded(root_item, true); tmp_item = new QTreeWidgetItem(root_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Number")); tmp_item->setText(1, QString::number(basic_header_->getNumberEvents())); tmp_item = new QTreeWidgetItem(root_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Sample Rate")); tmp_item->setText(1, QString::number(basic_header_->getEventSamplerate())); tmp_item->setText(2, tr("Hz")); // channels root_item = new QTreeWidgetItem(info_tree_widget_); root_item->setText(0, tr("Channels")); root_item->setIcon(0, QIcon(":/images/channels_22x22.png")); info_tree_widget_->setItemExpanded(root_item, true); for (uint32 channel_nr = 0; channel_nr < basic_header_->getNumberChannels(); channel_nr++) { QTreeWidgetItem* channel_item; QSharedPointer channel = basic_header_->getChannel (channel_nr); channel_item = new QTreeWidgetItem(root_item); channel_item->setText(0, QString("(%1) %2").arg(channel_nr + 1) .arg(channel->getLabel())); // channel basic tmp_item = new QTreeWidgetItem(channel_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Label")); tmp_item->setText(1, channel->getLabel()); tmp_item = new QTreeWidgetItem(channel_item); tmp_item->setText(0, tr("Sample Rate")); tmp_item->setText(1, QString::number(basic_header_->getSampleRate())); tmp_item->setText(2, tr("Hz")); tmp_item = new QTreeWidgetItem(channel_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Physical Dimension")); tmp_item->setText(1, channel->getPhysicalDim()); tmp_item = new QTreeWidgetItem(channel_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Physical Maximum")); tmp_item->setText(1, QString::number(channel->getPhysicalMaximum())); tmp_item = new QTreeWidgetItem(channel_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Physical Minimum")); tmp_item->setText(1, QString::number(channel->getPhysicalMinimum())); tmp_item = new QTreeWidgetItem(channel_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Digital Maximum")); tmp_item->setText(1, QString::number(channel->getDigitalMaximum())); tmp_item = new QTreeWidgetItem(channel_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Digital Minimum")); tmp_item->setText(1, QString::number(channel->getDigitalMinimum())); tmp_item = new QTreeWidgetItem(channel_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Data Type")); tmp_item->setText(1, channel->typeString()); // filter QTreeWidgetItem* filter_item; filter_item = new QTreeWidgetItem(channel_item); filter_item->setText(0, tr("Filter")); tmp_item = new QTreeWidgetItem(filter_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Highpass")); //tmp_item->setText(1, isnan(channel->getHighpass()) ? tr("unknown") : // (channel->getHighpass() < 0 ? "" : // QString::number(channel->getHighpass()))); tmp_item->setText(2, tr("Hz")); tmp_item = new QTreeWidgetItem(filter_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Lowpass")); // tmp_item->setText(1, channel->getLowpass() ? tr("unknown") : // (channel->getLowpass() < 0 ? "" : // QString::number(channel->getLowpass()))); tmp_item->setText(2, tr("Hz")); tmp_item = new QTreeWidgetItem(filter_item); // tmp_item ->setTextAlignment(1, Qt::AlignRight); tmp_item->setText(0, tr("Notch")); //tmp_item->setText(1, isnan(channel->getNotch()) ? tr("unknown") : (channel->getNotch() ? tr("yes") : tr("no"))); } } } //namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/dialogs/basic_header_info_dialog.h000066400000000000000000000015211154433734200257020ustar00rootroot00000000000000// basic_header_info_dialog.h #ifndef BASIC_HEADER_INFO_DIALOG_H #define BASIC_HEADER_INFO_DIALOG_H #include "file_handling/basic_header.h" #include #include class QTreeWidget; class QPushButton; namespace SigViewer_ { // basic header info dialog class BasicHeaderInfoDialog : public QDialog { Q_OBJECT public: BasicHeaderInfoDialog(QSharedPointer header, QWidget* parent = 0); void loadSettings(); void saveSettings(); private: // not allowed BasicHeaderInfoDialog(); BasicHeaderInfoDialog(const BasicHeaderInfoDialog&); const BasicHeaderInfoDialog& operator=(const BasicHeaderInfoDialog&); void buildTree(); QSharedPointer basic_header_; QTreeWidget* info_tree_widget_; QPushButton* close_button_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/gui_impl/dialogs/channel_dialog.ui000066400000000000000000000233001154433734200240730ustar00rootroot00000000000000 ChannelDialog 0 0 343 431 Channels false true true 0 Channels QFrame::StyledPanel 0 QAbstractItemView::NoEditTriggers QAbstractItemView::NoSelection QAbstractItemView::ScrollPerPixel false false 110 true false 18 0 Channel Color ID 0 Select All Unselect All 162 99 Color Settings true false Reset All Colors Set Default Color false Filters QAbstractItemView::NoEditTriggers QAbstractItemView::MultiSelection Add Notch :/images/icons/add.png:/images/icons/add.png Qt::Vertical 20 40 false Remove Filter :/images/icons/editdelete.png:/images/icons/editdelete.png true Downsampling Original Samplingrate true Factor Loading Samplingrate true QFrame::NoFrame 100 Hz 1 100 Hz Qt::Vertical 20 40 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok button_box_ accepted() ChannelDialog accept() 248 254 157 274 button_box_ rejected() ChannelDialog reject() 316 260 286 274 sigviewer-0.5.1+svn556/src/gui_impl/dialogs/channel_selection_dialog.cpp000066400000000000000000000234521154433734200263150ustar00rootroot00000000000000#include "channel_selection_dialog.h" //#include "signal_processing/notch_filter8.h" #include #include #include namespace SigViewer_ { QColor const ChannelSelectionDialog::NOT_VISIBLE_COLOR_ (Qt::gray); QColor const ChannelSelectionDialog::VISIBLE_COLOR_ (Qt::black); //----------------------------------------------------------------------------- ChannelSelectionDialog::ChannelSelectionDialog (ChannelManager const& channel_manager, QSharedPointer header, QSharedPointer color_manager, QWidget* parent) : QDialog (parent), channel_manager_ (channel_manager), color_manager_ (color_manager), header_ (header), self_setting_ (false) { ui_.setupUi (this); QString window_title (tr("Channels")); // if (header.isNull()) // { while (ui_.tabs->count() > 1) ui_.tabs->removeTab (1); // } // else // { // window_title.prepend (header->getFilePath() + " - "); // ui_.tabs->removeTab (1); // ui_.sr_file_label_->setText (QString::number (header_->getDownSamplingFactor() * header_->getSampleRate()).append(" Hz")); // ui_.sr_load_label_->setText (QString::number (header_->getSampleRate()).append(" Hz")); // ui_.downsample_factor_spinbox_->setValue (header_->getDownSamplingFactor()); // } setWindowTitle (window_title); ui_.channel_table_->setRowCount (channel_manager_.getNumberChannels()); int row = 0; foreach (ChannelID id, channel_manager_.getChannels()) { QTableWidgetItem* label_item = new QTableWidgetItem ( channel_manager_.getChannelLabel (id)); QColor color = color_manager_->getChannelColor (id); QTableWidgetItem* color_item = new QTableWidgetItem ( color.name()); color_item->setBackground (color); color_item->setFlags (Qt::ItemIsEnabled); if (ColorManager::isDark (color)) color_item->setForeground (Qt::white); QTableWidgetItem* id_item = new QTableWidgetItem ( QString::number (id)); label_item->setFlags (label_item->flags() | Qt::ItemIsUserCheckable); label_item->setCheckState (Qt::Unchecked); ui_.channel_table_->setItem (row, LABEL_INDEX_, label_item); ui_.channel_table_->setItem (row, COLOR_INDEX_, color_item); ui_.channel_table_->setItem (row, ID_INDEX_, id_item); row++; } ui_.channel_table_->hideColumn (ID_INDEX_); on_show_colors_box__toggled (false); ui_.tabs->setCurrentIndex (0); } //----------------------------------------------------------------------------- bool ChannelSelectionDialog::isSelected (ChannelID channel_id) { foreach (QTableWidgetItem* id_item, ui_.channel_table_->findItems (QString::number(channel_id), Qt::MatchExactly)) if (id_item->column() == ID_INDEX_) return ui_.channel_table_->item (id_item->row (), VISIBLE_INDEX_)->checkState() == Qt::Checked; return false; } //----------------------------------------------------------------------------- void ChannelSelectionDialog::setSelected (ChannelID channel_id, bool selected) { Qt::CheckState state = selected ? Qt::Checked : Qt::Unchecked; for (int row = 0; row < ui_.channel_table_->rowCount(); row++) if (QString::number(channel_id) == ui_.channel_table_->item(row, ID_INDEX_)->text()) ui_.channel_table_->item(row, VISIBLE_INDEX_)->setCheckState(state); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_unselect_all_button__clicked () { self_setting_ = true; for (int row = 0; row < ui_.channel_table_->rowCount(); ++row) ui_.channel_table_->item (row, VISIBLE_INDEX_)->setCheckState (Qt::Unchecked); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_select_all_button__clicked () { for (int row = 0; row < ui_.channel_table_->rowCount(); ++row) ui_.channel_table_->item (row, VISIBLE_INDEX_)->setCheckState(Qt::Checked); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_reset_colors_button__clicked () { for (int row = 0; row < ui_.channel_table_->rowCount(); ++row) updateColor (row, color_manager_->getDefaultChannelColor()); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_channel_table__cellClicked (int row, int column) { QTableWidgetItem* item = ui_.channel_table_->item (row, column); if (column == LABEL_INDEX_) { self_setting_ = true; if (item->checkState() == Qt::Checked) item->setCheckState (Qt::Unchecked); else item->setCheckState (Qt::Checked); } else if (column == COLOR_INDEX_) { QColorDialog color_dialog (item->backgroundColor (), this); if (color_dialog.exec () == QDialog::Accepted) updateColor (row, color_dialog.selectedColor ()); } self_setting_ = false; } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_channel_table__cellChanged (int row, int column) { if (column == VISIBLE_INDEX_) { if (!self_setting_) { self_setting_ = true; QTableWidgetItem* item = ui_.channel_table_->item (row, column); if (item->checkState() == Qt::Checked) item->setCheckState (Qt::Unchecked); else item->setCheckState (Qt::Checked); } bool all_visible = true; bool all_hidden = true; for (int row_index = 0; row_index < ui_.channel_table_->rowCount(); ++row_index) { QTableWidgetItem* item = ui_.channel_table_->item (row_index, VISIBLE_INDEX_); if (!item) return; if (item->checkState() == Qt::Checked) { all_hidden = false; item->setForeground (VISIBLE_COLOR_); } else { all_visible = false; item->setForeground (NOT_VISIBLE_COLOR_); } } ui_.select_all_button_->setDisabled (all_visible); ui_.unselect_all_button_->setDisabled (all_hidden); ui_.button_box_->button (QDialogButtonBox::Ok)->setDisabled (all_hidden); } } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_button_box__accepted () { for (int row = 0; row < ui_.channel_table_->rowCount(); ++row) { color_manager_->setChannelColor (ui_.channel_table_->item (row, ID_INDEX_)->text().toUInt(), ui_.channel_table_->item (row, COLOR_INDEX_)->backgroundColor()); } color_manager_->saveSettings (); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_show_colors_box__toggled (bool on) { ui_.channel_table_->setColumnHidden (COLOR_INDEX_, !on); ui_.reset_colors_button_->setVisible (on); ui_.set_default_color_button_->setVisible (on); if (on) ui_.channel_table_->horizontalHeader()->setDefaultSectionSize ((ui_.channel_table_->width() - 10) / 2); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_set_default_color_button__clicked () { QColor new_default_color = QColorDialog::getColor (color_manager_->getDefaultChannelColor()); if (new_default_color.isValid()) color_manager_->setDefaultChannelColor (new_default_color); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_downsample_factor_spinbox__valueChanged (int /*value*/) { // header_->setDownSamplingFactor (value); // ui_.sr_load_label_->setText (QString::number (header_->getSampleRate() ).append(" Hz")); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_add_filter_button__clicked () { // bool ok = false; // double frequency = QInputDialog::getDouble (0, "Notch", "Frequency", 0, 0, header_->getSampleRate(), 1, &ok); // if (!ok) // return; // QSharedPointer notch_filter (new NotchFilter8 (header_->getSampleRate() * header_->getDownSamplingFactor(), frequency)); // int header_filter_index = header_->addFilter (notch_filter); // ui_.chosen_filter_list_->addItem (QString ("Notch ").append(QString::number(frequency)).append("Hz")); // ui_.chosen_filter_list_->item (ui_.chosen_filter_list_->count() - 1)->setData (Qt::UserRole, header_filter_index); } //----------------------------------------------------------------------------- void ChannelSelectionDialog::on_remove_filter_button__clicked () { // foreach (QListWidgetItem* item, ui_.chosen_filter_list_->selectedItems()) // { // header_->removeFilter (item->data(Qt::UserRole).toInt()); // ui_.chosen_filter_list_->takeItem (ui_.chosen_filter_list_->row (item)); // delete item; // } } //----------------------------------------------------------------------------- void ChannelSelectionDialog::updateColor (int row, QColor const& color) { ui_.channel_table_->item (row, COLOR_INDEX_)->setBackgroundColor (color); ui_.channel_table_->item (row, COLOR_INDEX_)->setText (color.name ()); if (ColorManager::isDark (color)) ui_.channel_table_->item (row, COLOR_INDEX_)->setForeground (Qt::white); else ui_.channel_table_->item (row, COLOR_INDEX_)->setForeground (Qt::black); } } //namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/dialogs/channel_selection_dialog.h000066400000000000000000000043101154433734200257520ustar00rootroot00000000000000// channel_selection_dialog.h #ifndef CHANNEL_SELECTION_DIALOG_H #define CHANNEL_SELECTION_DIALOG_H #include "base/sigviewer_user_types.h" #include "file_handling/channel_manager.h" #include "file_handling/basic_header.h" #include "gui/color_manager.h" #include "ui_channel_dialog.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- class ChannelSelectionDialog : public QDialog { Q_OBJECT friend class FileOpenTest; public: ChannelSelectionDialog (ChannelManager const& channel_manager, QSharedPointer header, QSharedPointer color_manager, QWidget* parent = 0); bool isSelected (ChannelID channel_id); void setSelected (ChannelID channel_id, bool selected); private slots: void on_unselect_all_button__clicked (); void on_select_all_button__clicked (); void on_reset_colors_button__clicked (); void on_channel_table__cellClicked (int row, int column); void on_channel_table__cellChanged (int row, int column); void on_button_box__accepted (); void on_show_colors_box__toggled (bool on); void on_set_default_color_button__clicked (); void on_downsample_factor_spinbox__valueChanged (int value); void on_add_filter_button__clicked (); void on_remove_filter_button__clicked (); private: void updateColor (int row, QColor const& color); //------------------------------------------------------------------------- /// disabled ChannelSelectionDialog(); ChannelSelectionDialog(const ChannelSelectionDialog&); const ChannelSelectionDialog& operator=(const ChannelSelectionDialog&); ChannelManager const& channel_manager_; QSharedPointer color_manager_; QSharedPointer header_; public: Ui::ChannelDialog ui_; private: static int const VISIBLE_INDEX_ = 0; static int const LABEL_INDEX_ = 0; static int const COLOR_INDEX_ = 1; static int const ID_INDEX_ = 2; static QColor const NOT_VISIBLE_COLOR_; static QColor const VISIBLE_COLOR_; bool self_setting_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/gui_impl/dialogs/dialogs.pri000066400000000000000000000013741154433734200227520ustar00rootroot00000000000000HEADERS += gui_impl/dialogs/basic_header_info_dialog.h \ gui_impl/dialogs/channel_selection_dialog.h \ gui_impl/dialogs/event_time_selection_dialog.h \ gui_impl/dialogs/event_types_selection_dialog.h \ gui_impl/dialogs/scale_channel_dialog.h SOURCES += gui_impl/dialogs/basic_header_info_dialog.cpp \ gui_impl/dialogs/channel_selection_dialog.cpp \ gui_impl/dialogs/event_time_selection_dialog.cpp \ gui_impl/dialogs/event_types_selection_dialog.cpp \ gui_impl/dialogs/scale_channel_dialog.cpp FORMS += gui_impl/dialogs/channel_dialog.ui \ gui_impl/dialogs/event_time_selection_dialog.ui \ gui_impl/dialogs/event_type_selection_dialog.ui \ gui_impl/dialogs/scale_channel_dialog.ui \ gui_impl/dialogs/about_dialog.ui sigviewer-0.5.1+svn556/src/gui_impl/dialogs/event_time_selection_dialog.cpp000066400000000000000000000134321154433734200270410ustar00rootroot00000000000000#include "event_time_selection_dialog.h" #include "file_handling/event_manager.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- EventTimeSelectionDialog::EventTimeSelectionDialog (std::set const& shown_event_types, std::set const& shown_channels, ChannelManager const& channel_manager, QSharedPointer event_manager) : shown_event_types_ (shown_event_types), shown_channels_ (shown_channels), event_manager_ (event_manager), start_before_value_ (0) { ui_.setupUi (this); foreach (ChannelID channel_id, shown_channels) { QListWidgetItem* item = new QListWidgetItem (channel_manager.getChannelLabel(channel_id), ui_.list_widget_); item->setData (Qt::UserRole, channel_id); } foreach (EventType event_type, shown_event_types_) { if (event_manager_->getEvents (event_type).count ()) ui_.event_combo_box_->addItem (event_manager_->getNameOfEventType(event_type), QVariant(event_type)); } ui_.button_box_->button(QDialogButtonBox::Ok)->setEnabled (false); updateOkEnabled (); } //----------------------------------------------------------------------------- std::set EventTimeSelectionDialog::getSelectedChannels () const { std::set channels; foreach (QListWidgetItem* list_item, ui_.list_widget_->selectedItems()) channels.insert (list_item->data(Qt::UserRole).toInt()); return channels; } //----------------------------------------------------------------------------- EventType EventTimeSelectionDialog::getSelectedEventType () const { return ui_.event_combo_box_->itemData(ui_.event_combo_box_->currentIndex()).toUInt(); } //----------------------------------------------------------------------------- float EventTimeSelectionDialog::getSecondsBeforeEvent () const { return ui_.add_before_spinbox_->value(); } //----------------------------------------------------------------------------- float EventTimeSelectionDialog::getLengthInSeconds () const { return ui_.length_spinbox_->value(); } //----------------------------------------------------------------------------- void EventTimeSelectionDialog::on_unselect_all_button__clicked () { for (int row = 0; row < ui_.list_widget_->count(); ++row) ui_.list_widget_->item (row)->setSelected (false); } //----------------------------------------------------------------------------- void EventTimeSelectionDialog::on_select_all_button__clicked () { for (int row = 0; row < ui_.list_widget_->count(); ++row) ui_.list_widget_->item (row)->setSelected (true); } //----------------------------------------------------------------------------- void EventTimeSelectionDialog::on_event_combo_box__currentIndexChanged (int combo_box_index) { QList event_ids = event_manager_->getEvents (ui_.event_combo_box_->itemData(combo_box_index).toUInt()); float32 shortest_duration = std::numeric_limits::max(); float32 longest_duration = 0; float32 average_duration = 0; for (QList::ConstIterator id_iter = event_ids.begin(); id_iter != event_ids.end(); ++id_iter) { float32 dur = event_manager_->getEvent(*id_iter)->getDurationInSec(); if (dur > longest_duration) longest_duration = dur; if (dur < shortest_duration) shortest_duration = dur; average_duration += dur; } average_duration /= event_ids.size(); ui_.number_of_events_label_->setText (QString::number(event_ids.size())); QString text_for_time_statistic = QString::number(average_duration) + QString("s"); if (average_duration != longest_duration || average_duration != shortest_duration) { text_for_time_statistic += QString (" (max: ") + QString::number(longest_duration) + QString ("s; min: ") + QString::number(shortest_duration)+ QString ("s)"); } //event_type_average_time_label_->setText (text_for_time_statistic); ui_.length_spinbox_->setValue (average_duration + start_before_value_); } //----------------------------------------------------------------------------- void EventTimeSelectionDialog::on_add_before_spinbox__valueChanged (double value) { ui_.length_spinbox_->setValue (ui_.length_spinbox_->value() - start_before_value_ + value); start_before_value_ = value; } //----------------------------------------------------------------------------- void EventTimeSelectionDialog::on_list_widget__itemSelectionChanged () { updateOkEnabled (); } //------------------------------------------------------------------------- void EventTimeSelectionDialog::on_length_spinbox__valueChanged (double) { updateOkEnabled (); } //------------------------------------------------------------------------- void EventTimeSelectionDialog::updateOkEnabled () { int num_selected_items = ui_.list_widget_->selectedItems().count(); bool nothing_selected = (num_selected_items == 0); bool all_selected = (num_selected_items == ui_.list_widget_->count()); bool length_is_zero = (ui_.length_spinbox_->value() == 0); bool no_event_selected = (ui_.event_combo_box_->currentIndex() == -1); ui_.button_box_->button(QDialogButtonBox::Ok)->setDisabled (nothing_selected || length_is_zero || no_event_selected); ui_.unselect_all_button_->setDisabled (nothing_selected); ui_.select_all_button_->setDisabled (all_selected); } } sigviewer-0.5.1+svn556/src/gui_impl/dialogs/event_time_selection_dialog.h000066400000000000000000000047171154433734200265140ustar00rootroot00000000000000#ifndef EVENT_TIME_SELECTION_DIALOG_H #define EVENT_TIME_SELECTION_DIALOG_H #include "base/sigviewer_user_types.h" #include "file_handling/event_manager.h" #include "file_handling/channel_manager.h" #include "ui_event_time_selection_dialog.h" #include #include #include #include namespace SigViewer_ { class EventTimeSelectionDialog : public QDialog { Q_OBJECT public: //------------------------------------------------------------------------- EventTimeSelectionDialog (std::set const& shown_event_types, std::set const& shown_channels, ChannelManager const& channel_manager, QSharedPointer event_manager); //------------------------------------------------------------------------- std::set getSelectedChannels () const; //------------------------------------------------------------------------- EventType getSelectedEventType () const; //------------------------------------------------------------------------- float getSecondsBeforeEvent () const; //------------------------------------------------------------------------- float getLengthInSeconds () const; private slots: //------------------------------------------------------------------------- void on_unselect_all_button__clicked (); //------------------------------------------------------------------------- void on_select_all_button__clicked (); //------------------------------------------------------------------------- void on_event_combo_box__currentIndexChanged (int combo_box_index); //------------------------------------------------------------------------- void on_add_before_spinbox__valueChanged (double value); //------------------------------------------------------------------------- void on_list_widget__itemSelectionChanged (); //------------------------------------------------------------------------- void on_length_spinbox__valueChanged (double value); private: //------------------------------------------------------------------------- void updateOkEnabled (); std::set shown_event_types_; std::set shown_channels_; QSharedPointer event_manager_; double start_before_value_; Ui::EventTimeSelectionDialog ui_; }; } #endif // EVENT_TIME_SELECTION_DIALOG_H sigviewer-0.5.1+svn556/src/gui_impl/dialogs/event_time_selection_dialog.ui000066400000000000000000000066321154433734200267000ustar00rootroot00000000000000 EventTimeSelectionDialog 0 0 287 377 Event Time Channel QAbstractItemView::MultiSelection Select All Unselect All Number of Events Length s Start before s Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok button_box_ accepted() EventTimeSelectionDialog accept() 248 254 157 274 button_box_ rejected() EventTimeSelectionDialog reject() 316 260 286 274 sigviewer-0.5.1+svn556/src/gui_impl/dialogs/event_type_selection_dialog.ui000066400000000000000000000105161154433734200267170ustar00rootroot00000000000000 EventTypeSelectionDialog 0 0 470 494 Dialog 10 true 4 75 0 1 2 3 4 Select All Unselect All View All Events Existing Events true Color Settings true true Reset All Colors Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok buttonBox rejected() EventTypeSelectionDialog reject() 316 260 286 274 buttonBox accepted() EventTypeSelectionDialog accept() 248 254 157 274 sigviewer-0.5.1+svn556/src/gui_impl/dialogs/event_types_selection_dialog.cpp000066400000000000000000000271621154433734200272540ustar00rootroot00000000000000#include "event_types_selection_dialog.h" #include #include #include #include #include #include #include #include #define max(a,b) ((a) > (b) ? (a) : (b)) namespace SigViewer_ { //----------------------------------------------------------------------------- EventTypesSelectionDialog::EventTypesSelectionDialog (QString const& caption, QSharedPointer event_manager, std::set const& preselected_types, QSharedPointer color_manager, bool show_colors, QWidget* parent) : QDialog(parent), show_colors_ (show_colors), event_manager_ (event_manager), selected_types_ (preselected_types), color_manager_ (color_manager) { ui_.setupUi (this); setWindowTitle (caption); buildTree (true); } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::buildTree (bool only_existing_events) { ui_.tree_widget_->setRootIsDecorated(true); QStringList header_labels; header_labels << tr("Event Type") << tr("Color") << tr("Alpha") << tr("Type Id"); ui_.tree_widget_->setHeaderLabels (header_labels); ui_.tree_widget_->setColumnWidth(ID_COLUMN_INDEX_, 0); ui_.tree_widget_->header()->setResizeMode (QHeaderView::Interactive); ui_.tree_widget_->header()->resizeSection (NAME_COLUMN_INDEX_, 300); ui_.tree_widget_->header()->resizeSection (ID_COLUMN_INDEX_, 0); if (!show_colors_) { ui_.tree_widget_->setColumnHidden (COLOR_COLUMN_INDEX_, true); ui_.tree_widget_->setColumnHidden (ALPHA_COLUMN_INDEX_, true); ui_.show_colors_box_->setVisible (false); } ui_.tree_widget_->setColumnHidden (ID_COLUMN_INDEX_, true); std::set existing_types; foreach (EventID event_id, event_manager_->getAllEvents ()) existing_types.insert (event_manager_->getEvent (event_id)->getType ()); QMap group_id2list_item; foreach (QString group_id, event_manager_->getEventTypeGroupIDs()) { QString group_name = group_id; // TODO: event_table_file_reader.getEventGroupName(*group_it); bool show_group = !only_existing_events; foreach (EventType group_type, event_manager_->getEventTypes (group_id)) if (existing_types.count(group_type) && only_existing_events) show_group = true; if (show_group) { QTreeWidgetItem * group_item = new QTreeWidgetItem(ui_.tree_widget_); group_item->setFlags (Qt::ItemIsUserCheckable | Qt::ItemIsTristate | Qt::ItemIsEnabled); group_item->setText (NAME_COLUMN_INDEX_, group_name); group_item->setExpanded (true); group_id2list_item[group_id] = group_item; foreach (EventType event_type, event_manager_->getEventTypes (group_id)) { if (only_existing_events && !existing_types.count(event_type)) continue; QString event_name = event_manager_->getNameOfEventType (event_type); QTreeWidgetItem* event_item = new QTreeWidgetItem (group_item); event_item->setFlags (Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); QColor color = color_manager_->getEventColor(event_type); if (selected_types_.count(event_type)) event_item->setCheckState (CHECKBOX_COLUMN_INDEX_, Qt::Checked); else event_item->setCheckState (CHECKBOX_COLUMN_INDEX_, Qt::Unchecked); event_item->setText (NAME_COLUMN_INDEX_, event_name); color.setAlpha (255); event_item->setBackgroundColor (COLOR_COLUMN_INDEX_, color); event_item->setTextColor (COLOR_COLUMN_INDEX_, ColorManager::isDark(color) ? Qt::white : Qt::black); event_item->setTextAlignment (COLOR_COLUMN_INDEX_, Qt::AlignHCenter); event_item->setText (COLOR_COLUMN_INDEX_, color.name()); color = color_manager_->getEventColor(event_type); event_item->setBackgroundColor (ALPHA_COLUMN_INDEX_, color); event_item->setTextColor(ALPHA_COLUMN_INDEX_, ColorManager::isDark(color) ? Qt::white : Qt::black); event_item->setTextAlignment(ALPHA_COLUMN_INDEX_, Qt::AlignHCenter); event_item->setText(ALPHA_COLUMN_INDEX_, QString("%1").arg(color.alpha())); event_item->setText (ID_COLUMN_INDEX_, QString::number(event_type)); } } } } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_tree_widget__itemClicked(QTreeWidgetItem* item, int column) { switch (column) { case COLOR_COLUMN_INDEX_: handleColor (item); break; case ALPHA_COLUMN_INDEX_: handleAlpha (item); break; } } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::storeColors() { for (int group_nr = 0; group_nr < ui_.tree_widget_->topLevelItemCount(); group_nr++) { QTreeWidgetItem* group_item = ui_.tree_widget_->topLevelItem (group_nr); for (int nr = 0; nr < group_item->childCount(); nr++) { QTreeWidgetItem* event_item = group_item->child(nr); EventType type = event_item->text(ID_COLUMN_INDEX_).toUInt(); color_manager_->setEventColor (type, event_item->backgroundColor(ALPHA_COLUMN_INDEX_)); } } color_manager_->saveSettings(); } //----------------------------------------------------------------------------- std::set EventTypesSelectionDialog::getSelectedTypes () const { return selected_types_; } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_tree_widget__itemChanged (QTreeWidgetItem* item, int column) { if (item->childCount()) return; if (column == CHECKBOX_COLUMN_INDEX_) handleSelected (item); } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_all_events_button__toggled (bool checked) { if (!checked) return; ui_.tree_widget_->clear(); buildTree (); } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_existing_events_button__toggled (bool checked) { if (!checked) return; ui_.tree_widget_->clear(); buildTree (true); } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_select_all_button__clicked () { for (int index = 0; index < ui_.tree_widget_->topLevelItemCount(); index++) ui_.tree_widget_->topLevelItem(index)->setCheckState(CHECKBOX_COLUMN_INDEX_, Qt::Checked); selected_types_ = event_manager_->getEventTypes (); } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_unselect_all_button__clicked () { for (int index = 0; index < ui_.tree_widget_->topLevelItemCount(); index++) ui_.tree_widget_->topLevelItem(index)->setCheckState(CHECKBOX_COLUMN_INDEX_, Qt::Unchecked); selected_types_.clear (); } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_show_colors_box__toggled (bool on) { ui_.tree_widget_->setColumnHidden (COLOR_COLUMN_INDEX_, !on); ui_.tree_widget_->setColumnHidden (ALPHA_COLUMN_INDEX_, !on); ui_.reset_colors_button_->setVisible (on); if (on) { int width = ui_.tree_widget_->width (); ui_.tree_widget_->setColumnWidth (NAME_COLUMN_INDEX_, width / 2); ui_.tree_widget_->setColumnWidth (COLOR_COLUMN_INDEX_, width / 4); ui_.tree_widget_->setColumnWidth (ALPHA_COLUMN_INDEX_, width / 4 - 20); } } //----------------------------------------------------------------------------- void EventTypesSelectionDialog::on_reset_colors_button__clicked () { QTreeWidgetItemIterator color_iterator (ui_.tree_widget_, QTreeWidgetItemIterator::NoChildren); while (*color_iterator) { QColor color = color_manager_->getDefaultEventColor((*color_iterator)->text (ID_COLUMN_INDEX_).toUInt ()); color.setAlpha (255); (*color_iterator)->setBackgroundColor (COLOR_COLUMN_INDEX_, color); (*color_iterator)->setTextColor (COLOR_COLUMN_INDEX_, ColorManager::isDark(color) ? Qt::white : Qt::black); (*color_iterator)->setText (COLOR_COLUMN_INDEX_, color.name()); ++color_iterator; } QTreeWidgetItemIterator alpha_iterator (ui_.tree_widget_, QTreeWidgetItemIterator::NoChildren); while (*alpha_iterator) { QColor color = color_manager_->getDefaultEventColor((*alpha_iterator)->text (ID_COLUMN_INDEX_).toUInt ()); (*alpha_iterator)->setBackgroundColor (ALPHA_COLUMN_INDEX_, color); (*alpha_iterator)->setTextColor(ALPHA_COLUMN_INDEX_, ColorManager::isDark(color) ? Qt::white : Qt::black); (*alpha_iterator)->setTextAlignment(ALPHA_COLUMN_INDEX_, Qt::AlignHCenter); (*alpha_iterator)->setText(ALPHA_COLUMN_INDEX_, QString("%1").arg(color.alpha())); ++alpha_iterator; } } //------------------------------------------------------------------------- void EventTypesSelectionDialog::handleSelected (QTreeWidgetItem* item) { if (item->checkState (CHECKBOX_COLUMN_INDEX_) == Qt::Checked) selected_types_.insert (item->text (ID_COLUMN_INDEX_).toUInt()); else selected_types_.erase (item->text (ID_COLUMN_INDEX_).toUInt()); } //------------------------------------------------------------------------- void EventTypesSelectionDialog::handleColor (QTreeWidgetItem* item) { if (item->text(ID_COLUMN_INDEX_).size() == 0) return; QColor color = item->backgroundColor (COLOR_COLUMN_INDEX_); color = QColorDialog::getColor (color, this); if (!color.isValid()) return; item->setBackgroundColor (COLOR_COLUMN_INDEX_, color); item->setTextColor (COLOR_COLUMN_INDEX_, ColorManager::isDark(color) ? Qt::white : Qt::black); item->setText (COLOR_COLUMN_INDEX_, QString("%1").arg(color.name())); color.setAlpha (item->text(ALPHA_COLUMN_INDEX_).toInt()); item->setBackgroundColor (ALPHA_COLUMN_INDEX_, color); item->setTextColor (ALPHA_COLUMN_INDEX_, ColorManager::isDark(color) ? Qt::white : Qt::black); item->setText (ALPHA_COLUMN_INDEX_, QString::number (color.alpha())); } //------------------------------------------------------------------------- void EventTypesSelectionDialog::handleAlpha (QTreeWidgetItem* item) { if (item->text(ID_COLUMN_INDEX_).size() == 0) return; QColor color = item->backgroundColor (ALPHA_COLUMN_INDEX_); color.setAlpha (QInputDialog::getInteger(this, tr("Alpha"), tr("Enter new Value"), color.alpha(), 0, 255, 25)); item->setBackgroundColor (ALPHA_COLUMN_INDEX_, color); item->setTextColor (ALPHA_COLUMN_INDEX_, ColorManager::isDark(color) ? Qt::white : Qt::black); item->setText (ALPHA_COLUMN_INDEX_, QString::number (color.alpha())); } } //namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/dialogs/event_types_selection_dialog.h000066400000000000000000000055021154433734200267130ustar00rootroot00000000000000#ifndef EVENT_TYPES_SELECTION_DIALOG_H #define EVENT_TYPES_SELECTION_DIALOG_H #include "base/sigviewer_user_types.h" #include "file_handling/event_manager.h" #include "gui/color_manager.h" #include "ui_event_type_selection_dialog.h" #include #include class QTreeWidget; class QPushButton; class QTreeWidgetItem; namespace SigViewer_ { //----------------------------------------------------------------------------- /// EventTypesSelectionDialog class EventTypesSelectionDialog : public QDialog { Q_OBJECT public: //------------------------------------------------------------------------- EventTypesSelectionDialog (QString const& caption, QSharedPointer event_manager, std::set const& preselected_types, QSharedPointer color_manager, bool show_colors = false, QWidget* parent = 0); void storeColors(); std::set getSelectedTypes () const; private slots: void on_tree_widget__itemClicked (QTreeWidgetItem* item, int column); void on_tree_widget__itemChanged (QTreeWidgetItem* item ,int column); void on_all_events_button__toggled (bool checked); void on_existing_events_button__toggled (bool checked); void on_select_all_button__clicked (); void on_unselect_all_button__clicked (); void on_show_colors_box__toggled (bool on); void on_reset_colors_button__clicked (); private: //------------------------------------------------------------------------- // not allowed EventTypesSelectionDialog(); EventTypesSelectionDialog(const EventTypesSelectionDialog&); const EventTypesSelectionDialog& operator=(const EventTypesSelectionDialog&); //------------------------------------------------------------------------- void buildTree (bool only_existing_events = false); //------------------------------------------------------------------------- void handleSelected (QTreeWidgetItem* item); //------------------------------------------------------------------------- void handleColor (QTreeWidgetItem* item); //------------------------------------------------------------------------- void handleAlpha (QTreeWidgetItem* item); static int const CHECKBOX_COLUMN_INDEX_ = 0; static int const NAME_COLUMN_INDEX_ = 0; static int const COLOR_COLUMN_INDEX_ = 1; static int const ALPHA_COLUMN_INDEX_ = 2; static int const ID_COLUMN_INDEX_ = 3; bool const show_colors_; QSharedPointer event_manager_; std::set selected_types_; QSharedPointer color_manager_; Ui::EventTypeSelectionDialog ui_; }; } // namespace SigViewer_ #endif // EVENT_TYPES_SELECTION_DIALOG_H sigviewer-0.5.1+svn556/src/gui_impl/dialogs/scale_channel_dialog.cpp000066400000000000000000000071231154433734200254140ustar00rootroot00000000000000#include "scale_channel_dialog.h" #include #include namespace SigViewer_ { double ScaleChannelDialog::last_min_ = 0; double ScaleChannelDialog::last_max_ = 0; //----------------------------------------------------------------------------- ScaleChannelDialog::ScaleChannelDialog (ChannelID preselected_channel, std::set const& shown_channels, ChannelManager const& channel_manager, QWidget *parent) : QDialog(parent), selected_channel_ (preselected_channel), shown_channels_ (shown_channels), channel_manager_ (channel_manager) { ui_.setupUi (this); if (selected_channel_ == UNDEFINED_CHANNEL) setWindowTitle (tr("Scale All Channels")); else setWindowTitle (tr("Scale Channel ").append(channel_manager_.getChannelLabel(preselected_channel))); ui_.upper_spinbox_->setMaximum (std::numeric_limits::max()); ui_.upper_spinbox_->setMinimum (-std::numeric_limits::max()); ui_.lower_spinbox_->setMaximum (std::numeric_limits::max()); ui_.lower_spinbox_->setMinimum (-std::numeric_limits::max()); QString unit_string = channel_manager_.getChannelYUnitString (selected_channel_); if (unit_string.size()) ui_.unitLabelLower->setText (QString ("(").append (unit_string).append (")")); ui_.unitLabelUpper->setText (ui_.unitLabelLower->text()); if (selected_channel_ != UNDEFINED_CHANNEL) { ui_.upper_spinbox_->setValue (channel_manager_.getMaxValue (selected_channel_)); ui_.lower_spinbox_->setValue (channel_manager_.getMinValue (selected_channel_)); } connect (this, SIGNAL(accepted()), SLOT(storeAccepted())); } //----------------------------------------------------------------------------- bool ScaleChannelDialog::autoScaling () const { return ui_.autoButton->isChecked (); } //----------------------------------------------------------------------------- bool ScaleChannelDialog::physAutoScaling () const { return false;//ui_.physButton->isChecked(); } //----------------------------------------------------------------------------- float ScaleChannelDialog::upperValue () const { return ui_.upper_spinbox_->value(); } //----------------------------------------------------------------------------- float ScaleChannelDialog::lowerValue () const { return ui_.lower_spinbox_->value(); } //----------------------------------------------------------------------------- void ScaleChannelDialog::on_fixedButton_toggled (bool checked) { if (!checked) return; double upper_value = last_max_; double lower_value = last_min_; ui_.upper_spinbox_->setValue (upper_value); ui_.lower_spinbox_->setValue (lower_value); } //----------------------------------------------------------------------------- void ScaleChannelDialog::on_autoButton_toggled (bool checked) { if (!checked) return; double upper_value = 0; double lower_value = 0; if (selected_channel_ != UNDEFINED_CHANNEL) { upper_value = channel_manager_.getMaxValue (selected_channel_); lower_value = channel_manager_.getMinValue (selected_channel_); } ui_.upper_spinbox_->setValue (upper_value); ui_.lower_spinbox_->setValue (lower_value); } //----------------------------------------------------------------------------- void ScaleChannelDialog::storeAccepted () { if (ui_.fixedButton->isChecked()) { last_max_ = ui_.upper_spinbox_->value(); last_min_ = ui_.lower_spinbox_->value(); } } } sigviewer-0.5.1+svn556/src/gui_impl/dialogs/scale_channel_dialog.h000066400000000000000000000021071154433734200250560ustar00rootroot00000000000000#ifndef SCALEC_HANNEL_DIALOG_H #define SCALEC_HANNEL_DIALOG_H #include "base/sigviewer_user_types.h" #include "file_handling/channel_manager.h" #include "ui_scale_channel_dialog.h" #include namespace SigViewer_ { class ScaleChannelDialog : public QDialog { Q_OBJECT public: explicit ScaleChannelDialog (ChannelID preselected_channel, std::set const& shown_channels, ChannelManager const& channel_manager, QWidget *parent = 0); bool autoScaling () const; bool physAutoScaling () const; float upperValue () const; float lowerValue () const; signals: private slots: void on_fixedButton_toggled (bool checked); void on_autoButton_toggled (bool checked); void storeAccepted (); private: ChannelID selected_channel_; std::set const shown_channels_; ChannelManager const& channel_manager_; Ui::ScaleChannelDialog ui_; static double last_min_; static double last_max_; }; } #endif // SCALEC_HANNEL_DIALOG_H sigviewer-0.5.1+svn556/src/gui_impl/dialogs/scale_channel_dialog.ui000066400000000000000000000074221154433734200252510ustar00rootroot00000000000000 ScaleChannelDialog 0 0 339 170 Scale Channel Auto Scaling true Fixed Scaling Upper Value false Lower Value false -23.000000000000000 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok buttonBox accepted() ScaleChannelDialog accept() 248 254 157 274 buttonBox rejected() ScaleChannelDialog reject() 316 260 286 274 fixedButton toggled(bool) lower_spinbox_ setEnabled(bool) 135 39 201 98 fixedButton toggled(bool) upper_spinbox_ setEnabled(bool) 135 39 201 67 sigviewer-0.5.1+svn556/src/gui_impl/event_table/000077500000000000000000000000001154433734200214555ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/gui_impl/event_table/event_table.pri000066400000000000000000000004361154433734200244640ustar00rootroot00000000000000HEADERS += \ gui_impl/event_table/event_table_widget.h \ gui_impl/event_table/event_table_view_model.h SOURCES += \ gui_impl/event_table/event_table_widget.cpp \ gui_impl/event_table/event_table_view_model.cpp FORMS += \ gui_impl/event_table/event_table_widget.ui sigviewer-0.5.1+svn556/src/gui_impl/event_table/event_table_view_model.cpp000066400000000000000000000017071154433734200266700ustar00rootroot00000000000000#include "event_table_view_model.h" #include "event_table_widget.h" namespace SigViewer_ { //----------------------------------------------------------------------------- EventTableViewModel::EventTableViewModel (EventTableWidget& event_table_widget) : EventView (false, false), event_table_widget_ (event_table_widget) { } //----------------------------------------------------------------------------- QSharedPointer EventTableViewModel::getEventManager () const { return event_table_widget_.getEventManager (); } //----------------------------------------------------------------------------- QSharedPointer EventTableViewModel::getEventManager () { return event_table_widget_.getEventManager (); } //----------------------------------------------------------------------------- QList EventTableViewModel::getSelectedEvents () const { return event_table_widget_.getSelectedEvents (); } } sigviewer-0.5.1+svn556/src/gui_impl/event_table/event_table_view_model.h000066400000000000000000000024121154433734200263270ustar00rootroot00000000000000#ifndef EVENT_TABLE_VIEW_MODEL_H #define EVENT_TABLE_VIEW_MODEL_H #include "gui/event_view.h" namespace SigViewer_ { class EventTableWidget; //----------------------------------------------------------------------------- class EventTableViewModel : public EventView { public: //------------------------------------------------------------------------- EventTableViewModel (EventTableWidget& event_table_widget); //------------------------------------------------------------------------- virtual void setShownEventTypes (std::set const& /*event_types*/) {} //------------------------------------------------------------------------- virtual std::set getShownEventTypes () const {return std::set ();} //------------------------------------------------------------------------- virtual QSharedPointer getEventManager () const; //------------------------------------------------------------------------- virtual QSharedPointer getEventManager (); //------------------------------------------------------------------------- virtual QList getSelectedEvents () const; private: EventTableWidget& event_table_widget_; }; } #endif // EVENT_TABLE_VIEW_MODEL_H sigviewer-0.5.1+svn556/src/gui_impl/event_table/event_table_widget.cpp000066400000000000000000000151761154433734200260260ustar00rootroot00000000000000#include "event_table_widget.h" #include "base/math_utils.h" #include "gui/gui_action_factory.h" #include #include #include namespace SigViewer_ { class EventTableItem : public QTableWidgetItem { public: EventTableItem (float32 number, int precision = 0) : QTableWidgetItem (QString::number(number, 'f', precision)) {} virtual bool operator< (QTableWidgetItem const& other) const { return other.text().toFloat() < text().toFloat(); } }; //------------------------------------------------------------------------- EventTableWidget::EventTableWidget (QSharedPointer tab_context, QSharedPointer event_manager, ChannelManager const& channel_manager, QWidget *parent) : QWidget(parent), precision_ (MathUtils_::sampleRateToDecimalPrecision(event_manager->getSampleRate())), tab_context_ (tab_context), event_manager_ (event_manager), channel_manager_ (channel_manager) { ui_.setupUi(this); connect (event_manager_.data(), SIGNAL(eventCreated(QSharedPointer)), SLOT(addToTable(QSharedPointer))); connect (event_manager_.data(), SIGNAL(eventRemoved(EventID)), SLOT(removeFromTable(EventID))); connect (event_manager_.data(), SIGNAL(eventChanged(EventID)), SLOT(updateEventEntry(EventID))); buildTable(); ui_.event_table_->sortByColumn (POSITION_INDEX_); ui_.event_table_->hideColumn (ID_INDEX_); QToolBar* toolbar = new QToolBar (this); toolbar->setToolButtonStyle (Qt::ToolButtonTextBesideIcon); toolbar->setOrientation (Qt::Vertical); toolbar->addAction (GuiActionFactory::getInstance()->getQAction ("Delete")); ui_.horizontalLayout->addWidget (toolbar); } //------------------------------------------------------------------------- EventTableWidget::~EventTableWidget() { qDebug () << "EventTableWidget::~EventTableWidget"; } //------------------------------------------------------------------------- QList EventTableWidget::getSelectedEvents () const { QSet selected_events; foreach (QTableWidgetItem* item, ui_.event_table_->selectedItems ()) selected_events.insert (item->data(Qt::UserRole).toInt()); return selected_events.values(); } //------------------------------------------------------------------------- QSharedPointer EventTableWidget::getEventView () { if (event_table_view_model_.isNull()) event_table_view_model_ = QSharedPointer (new EventTableViewModel(*this)); return event_table_view_model_; } //------------------------------------------------------------------------- void EventTableWidget::addToTable (QSharedPointer event) { int row = ui_.event_table_->rowCount (); ui_.event_table_->insertRow (row); QTableWidgetItem* position_item = new EventTableItem (event->getPositionInSec(), precision_); QTableWidgetItem* duration_item = new EventTableItem (event->getDurationInSec(), precision_); QTableWidgetItem* channel_item = new QTableWidgetItem (channel_manager_.getChannelLabel(event->getChannel())); QTableWidgetItem* type_item = new QTableWidgetItem (event_manager_->getNameOfEvent(event->getId())); QTableWidgetItem* id_item = new EventTableItem (event->getId()); position_item->setData (Qt::UserRole, event->getId()); duration_item->setData (Qt::UserRole, event->getId()); channel_item->setData (Qt::UserRole, event->getId()); type_item->setData (Qt::UserRole, event->getId()); id_item->setData (Qt::UserRole, event->getId()); ui_.event_table_->setItem (row, POSITION_INDEX_, position_item); row = ui_.event_table_->row (position_item); ui_.event_table_->setItem (row, DURATION_INDEX_, duration_item); row = ui_.event_table_->row (duration_item); ui_.event_table_->setItem (row, CHANNEL_INDEX_, channel_item); row = ui_.event_table_->row (channel_item); ui_.event_table_->setItem (row, TYPE_INDEX_, type_item); row = ui_.event_table_->row (type_item); ui_.event_table_->setItem (row, ID_INDEX_, id_item); } //------------------------------------------------------------------------- void EventTableWidget::removeFromTable (EventID event) { qDebug () << "EventTableWidget::removeFromTable " << event; QList rows_to_remove; for (int row = 0; row < ui_.event_table_->rowCount(); row++) if (ui_.event_table_->item(row, ID_INDEX_)->text().toInt() == event) rows_to_remove.prepend (row); foreach (int row, rows_to_remove) ui_.event_table_->removeRow (row); } //------------------------------------------------------------------------- void EventTableWidget::updateEventEntry (EventID event_id) { QSharedPointer event = event_manager_->getEvent (event_id); bool updated = false; for (int row = 0; (row < ui_.event_table_->rowCount()) && (!updated); row++) { QTableWidgetItem* id_item = ui_.event_table_->item (row, ID_INDEX_); if (id_item->text().toInt() == event_id) { ui_.event_table_->item (row, CHANNEL_INDEX_)->setText (channel_manager_.getChannelLabel (event->getChannel())); ui_.event_table_->item (row, POSITION_INDEX_)->setText (QString::number (event->getPositionInSec(), 'f', precision_)); ui_.event_table_->item (row, DURATION_INDEX_)->setText (QString::number (event->getDurationInSec(), 'f', precision_)); ui_.event_table_->item (row, TYPE_INDEX_)->setText (event_manager_->getNameOfEvent (event_id)); updated = true; } } } //------------------------------------------------------------------------- void EventTableWidget::on_event_table__itemSelectionChanged () { if (ui_.event_table_->selectedItems().size()) { qDebug () << "EventTableWidget::on_event_table__itemSelectionChanged"; tab_context_->setSelectionState (TAB_STATE_EVENT_SELECTED_ALL_CHANNELS); } else tab_context_->setSelectionState (TAB_STATE_NO_EVENT_SELECTED); } //------------------------------------------------------------------------- void EventTableWidget::showEvent (QShowEvent* /*event*/) { on_event_table__itemSelectionChanged (); } //------------------------------------------------------------------------- void EventTableWidget::buildTable () { foreach (EventID event_id, event_manager_->getAllEvents ()) addToTable (event_manager_->getEvent (event_id)); } } sigviewer-0.5.1+svn556/src/gui_impl/event_table/event_table_widget.h000066400000000000000000000045051154433734200254650ustar00rootroot00000000000000#ifndef EVENT_TABLE_WIDGET_H #define EVENT_TABLE_WIDGET_H #include "ui_event_table_widget.h" #include "file_handling/event_manager.h" #include "gui/event_view.h" #include "file_handling/channel_manager.h" #include "event_table_view_model.h" #include "tab_context.h" #include namespace SigViewer_ { namespace Tests_ { class EventTableWidgetTests;} //----------------------------------------------------------------------------- class EventTableWidget : public QWidget { friend class SigViewer_::Tests_::EventTableWidgetTests; Q_OBJECT public: //------------------------------------------------------------------------- EventTableWidget (QSharedPointer tab_context, QSharedPointer event_manager, ChannelManager const& channel_manager, QWidget *parent = 0); //------------------------------------------------------------------------- virtual ~EventTableWidget (); //------------------------------------------------------------------------- virtual QList getSelectedEvents () const; //------------------------------------------------------------------------- QSharedPointer getEventManager () const {return event_manager_;} //------------------------------------------------------------------------- QSharedPointer getEventManager () {return event_manager_;} //------------------------------------------------------------------------- QSharedPointer getEventView (); private slots: void addToTable (QSharedPointer event); void removeFromTable (EventID event); void updateEventEntry (EventID event_id); void on_event_table__itemSelectionChanged (); private: void showEvent (QShowEvent* event); void buildTable (); static int const ID_INDEX_ = 0; static int const POSITION_INDEX_ = 1; static int const DURATION_INDEX_ = 2; static int const CHANNEL_INDEX_ = 3; static int const TYPE_INDEX_ = 4; int precision_; Ui::EventTableWidget ui_; QSharedPointer tab_context_; QSharedPointer event_manager_; QSharedPointer event_table_view_model_; ChannelManager const& channel_manager_; }; } #endif // EVENT_TABLE_WIDGET_H sigviewer-0.5.1+svn556/src/gui_impl/event_table/event_table_widget.ui000066400000000000000000000036261154433734200256560ustar00rootroot00000000000000 EventTableWidget 0 0 653 450 Form 400 0 QAbstractItemView::NoEditTriggers QAbstractItemView::MultiSelection QAbstractItemView::SelectRows QAbstractItemView::ScrollPerPixel QAbstractItemView::ScrollPerPixel true true ID Position Duration Channel Type sigviewer-0.5.1+svn556/src/gui_impl/gui_helper_functions.cpp000066400000000000000000000225161154433734200241120ustar00rootroot00000000000000#include "gui_impl/gui_helper_functions.h" #include "dialogs/channel_selection_dialog.h" #include "select_shown_channels_dialog.h" #include "dialogs/event_types_selection_dialog.h" #include #include #include #if QT_VERSION >= 0x040600 #include #endif #include #include namespace SigViewer_ { namespace GuiHelper { //----------------------------------------------------------------------------- void animateProperty (QObject* target, QByteArray const& property_name, QVariant const& start_value, QVariant const& end_value, QObject* call_back_object, char const* call_back_slot) { QSettings settings ("SigViewer"); settings.beginGroup("Animations"); bool animations_activated = settings.value("activated", false).toBool(); int animation_duration = settings.value("duration", 200).toInt(); settings.endGroup(); #if QT_VERSION < 0x040600 animations_activated = false; #endif if (animations_activated) { #if QT_VERSION >= 0x040600 QPropertyAnimation* animation = new QPropertyAnimation (target, property_name); animation->setDuration (animation_duration); animation->setStartValue (start_value); animation->setEasingCurve(QEasingCurve::InOutCubic); animation->setEndValue (end_value); if (call_back_object && call_back_slot) { call_back_object->connect (animation, SIGNAL(finished()), call_back_slot); } animation->start (animation->DeleteWhenStopped); #endif } else { target->setProperty (property_name, end_value); if (call_back_object && call_back_slot) { QAction dummy_action (call_back_object); call_back_object->connect(&dummy_action, SIGNAL(triggered()), call_back_slot); dummy_action.trigger(); } } } //----------------------------------------------------------------------------- QList > getSelectedEvents (QSharedPointer event_view) { qDebug () << "getSelectedEvents: " << event_view.isNull(); QList ids = getSelectedEventIDs (event_view); QList > events; if (ids.size() == 0) return events; QSharedPointer event_manager = event_view->getEventManager(); foreach (EventID id, ids) events.append (event_manager->getEvent (id)); return events; } //----------------------------------------------------------------------------- QList getSelectedEventIDs (QSharedPointer event_view) { QList event_ids; qDebug () << "getSelectedEventIDs: " << event_view.isNull(); if (event_view.isNull()) return event_ids; return event_view->getSelectedEvents (); } //----------------------------------------------------------------------------- EventType selectEventType (EventType preselected_type, QSharedPointer signal_visualisation_model) { EventType new_type = UNDEFINED_EVENT_TYPE; QSharedPointer event_manager = signal_visualisation_model->getEventManager(); std::set types = signal_visualisation_model->getShownEventTypes (); QStringList event_type_list; int32 current_item = 0; for (std::set::const_iterator it = types.begin(); it != types.end(); it++) { if (preselected_type == *it) current_item = event_type_list.size(); QString event_name = event_manager->getNameOfEventType (*it); event_type_list.append (event_name + " " + QString("(%1)") .arg(*it,4, 16) .replace(' ', '0')); } bool ok = false; QString res = QInputDialog::getItem(0, QObject::tr("Change Type"), QObject::tr("Select new Type:"), event_type_list, current_item, false, &ok); if (ok) new_type = res.right(5).left(4).toUShort(0, 16); return new_type; } //----------------------------------------------------------------------------- std::set selectEventTypes (std::set const& preselected_type, QSharedPointer event_manager, QSharedPointer color_manager, bool enable_color_editing) { std::set selected_types; if (event_manager.isNull()) return selected_types; EventTypesSelectionDialog dialog (QObject::tr("Select Event Types"), event_manager, preselected_type, color_manager, enable_color_editing, 0); int result = dialog.exec(); selected_types = dialog.getSelectedTypes (); if (enable_color_editing && result == QDialog::Accepted) dialog.storeColors (); return selected_types; } //----------------------------------------------------------------------------- ChannelID selectChannel (ChannelID preselected_channel_id, QSharedPointer signal_visualisation_model) { int32 current_item = 0; QStringList channel_list; channel_list.append (QObject::tr("All Channels")); ChannelManager const& channel_manager = signal_visualisation_model->getChannelManager(); std::set shown_channels = signal_visualisation_model->getShownChannels (); for (std::set::iterator channel_iter = shown_channels.begin(); channel_iter != shown_channels.end(); ++channel_iter) { if (*channel_iter == preselected_channel_id) current_item = channel_list.size(); channel_list.append( QString("(%1) ").arg(*channel_iter + 1) + channel_manager.getChannelLabel (*channel_iter)); } bool ok = false; QString res = QInputDialog::getItem(0, QObject::tr("Change Channel"), QObject::tr("Select New Channel:"), channel_list, current_item, false, &ok); ChannelID new_channel = res.replace(')', '(').section('(', 1, 1).toInt() - 1; if (ok) return new_channel; else return preselected_channel_id; } //----------------------------------------------------------------------------- std::set selectShownChannels (ChannelID hide_channel, QSharedPointer vis_model) { std::set channels = vis_model->getShownChannels (); channels.erase (hide_channel); SelectShownChannelsDialog dialog (QObject::tr("Copy Event to Channels"), channels, vis_model->getChannelManager()); dialog.exec (); return dialog.getSelectedChannels (); } //----------------------------------------------------------------------------- std::set selectChannels (ChannelManager const& channel_manager, QSharedPointer color_manager, QSharedPointer header, QSharedPointer vis_model) { ChannelSelectionDialog channel_dialog (channel_manager, header, color_manager); std::set pre_selected_channels; if (!vis_model.isNull()) pre_selected_channels = vis_model->getShownChannels (); bool empty_selection = (pre_selected_channels.size () == 0); foreach (ChannelID channel_id, channel_manager.getChannels()) { bool show_channel = (empty_selection || (pre_selected_channels.count(channel_id) > 0)); channel_dialog.setSelected (channel_id, show_channel); } channel_dialog.exec(); if (channel_dialog.result() == QDialog::Rejected) return pre_selected_channels; std::set selected_channels; foreach (ChannelID channel_id, channel_manager.getChannels()) { if (channel_dialog.isSelected (channel_id)) selected_channels.insert (channel_id); } return selected_channels; } //----------------------------------------------------------------------------- QString getFilePathFromSaveAsDialog (QString const& path, QString const& extensions, QString const& file_type_description) { QString extension_selection = file_type_description + QObject::tr(" (%1)").arg(extensions); QStringList ext_list = extensions.split (" "); for (QStringList::iterator it = ext_list.begin(); it != ext_list.end(); it++) { extension_selection += ";; " + *it +" (" + *it + ")"; } extension_selection += ";; *.* (*.*)"; return QFileDialog::getSaveFileName (0, QObject::tr("Save"), path, extension_selection); } } } sigviewer-0.5.1+svn556/src/gui_impl/gui_helper_functions.h000066400000000000000000000056521154433734200235610ustar00rootroot00000000000000#ifndef GUI_HELPER_FUNCTIONS_H #define GUI_HELPER_FUNCTIONS_H #include "base/sigviewer_user_types.h" #include "file_handling/channel_manager.h" #include "file_handling/basic_header.h" #include "gui/signal_visualisation_model.h" #include "gui/color_manager.h" #include namespace SigViewer_ { namespace GuiHelper { //----------------------------------------------------------------------------- void animateProperty (QObject* target, QByteArray const& property_name, QVariant const& start_value, QVariant const& end_value, QObject* call_back_object = 0, char const* call_back_slot = 0); //----------------------------------------------------------------------------- QList > getSelectedEvents (QSharedPointer event_view); //----------------------------------------------------------------------------- QList getSelectedEventIDs (QSharedPointer event_view); //----------------------------------------------------------------------------- EventType selectEventType (EventType preselected_type, QSharedPointer signal_visualisation_model); //----------------------------------------------------------------------------- std::set selectEventTypes (std::set const& preselected_type, QSharedPointer event_manager, QSharedPointer color_manager, bool enable_color_editing = false); //----------------------------------------------------------------------------- ChannelID selectChannel (ChannelID preselected_channel, QSharedPointer signal_visualisation_model); //----------------------------------------------------------------------------- std::set selectShownChannels (ChannelID hide_channel, QSharedPointer vis_model); //----------------------------------------------------------------------------- std::set selectChannels (ChannelManager const& channel_manager, QSharedPointer color_manager, QSharedPointer header, QSharedPointer vis_model = QSharedPointer(0)); //----------------------------------------------------------------------------- QString getFilePathFromSaveAsDialog (QString const& path, QString const& extensions, QString const& file_type_description); } } #endif // GUI_HELPER_FUNCTIONS_H sigviewer-0.5.1+svn556/src/gui_impl/gui_impl.pri000066400000000000000000000013231154433734200215050ustar00rootroot00000000000000HEADERS += gui_impl/gui_helper_functions.h \ gui_impl/processed_signal_channel_manager.h \ gui_impl/select_shown_channels_dialog.h \ gui_impl/main_window.h \ gui_impl/main_window_model_impl.h \ gui_impl/signal_browser_mouse_handling.h SOURCES += gui_impl/processed_signal_channel_manager.cpp \ gui_impl/select_shown_channels_dialog.cpp \ gui_impl/gui_helper_functions.cpp \ gui_impl/main_window.cpp \ gui_impl/main_window_model_impl.cpp \ gui_impl/signal_browser_mouse_handling.cpp FORMS += gui_impl/info_widgets/power_spectrum_info_widget.ui include(dialogs/dialogs.pri) include(signal_browser/signal_browser.pri) include(commands/commands.pri) include(event_table/event_table.pri) sigviewer-0.5.1+svn556/src/gui_impl/info_widgets/000077500000000000000000000000001154433734200216465ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/gui_impl/info_widgets/power_spectrum_info_widget.ui000066400000000000000000000005641154433734200276460ustar00rootroot00000000000000 Form 0 0 323 68 Form sigviewer-0.5.1+svn556/src/gui_impl/main_window.cpp000066400000000000000000000331631154433734200222120ustar00rootroot00000000000000/* main_window.cpp Copyright (C) Thomas Brunner Clemens Brunner Christoph Eibel Alois Schloegl Oliver Terbu This file is part of the "SigViewer" repository at http://biosig.sf.net/ 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 3 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, see . */ // main_window.cpp #include "main_window.h" #include "gui/gui_action_factory.h" #include "gui/background_processes.h" #include "gui_impl/commands/open_file_gui_command.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace SigViewer_ { //---------------------------------------------------------------------------- MainWindow::MainWindow (QSharedPointer application_context) : QMainWindow(0) { setWindowTitle (tr("SigViewer")); setAcceptDrops (true); setWindowIcon(QIcon(":images/sigviewer16.png")); initStatusBar(); initToolBars(); initMenus (application_context); setUnifiedTitleAndToolBarOnMac (true); QSettings settings ("SigViewer"); resize (settings.value("MainWindow/size", QSize(800, 600)).toSize()); } //----------------------------------------------------------------------------- void MainWindow::initStatusBar() { connect (&BackgroundProcesses::instance(), SIGNAL(newProcess(QString,int)), SLOT(addBackgroundProcessToStatusBar(QString,int))); connect (&BackgroundProcesses::instance(), SIGNAL(processChangedState(QString,int)), SLOT(updateBackgroundProcessonStatusBar(QString,int))); connect (&BackgroundProcesses::instance(), SIGNAL(processRemoved(QString)), SLOT(removeBackgroundProcessFromStatusBar(QString))); QStatusBar* status_bar = statusBar(); status_bar->showMessage(tr("Ready")); status_bar_signal_length_label_ = new QLabel (this); status_bar_nr_channels_label_ = new QLabel (this); status_bar_signal_length_label_->setAlignment(Qt::AlignHCenter); status_bar_nr_channels_label_->setAlignment(Qt::AlignHCenter); status_bar->addPermanentWidget(status_bar_signal_length_label_); status_bar->addPermanentWidget(status_bar_nr_channels_label_); QSettings settings ("SigViewer"); status_bar->setVisible (settings.value ("MainWindow/statusbar", true).toBool()); } //----------------------------------------------------------------------------- void MainWindow::initToolBars() { view_toolbar_views_menu_ = new QMenu (tr("Toolbars"), this); file_toolbar_ = addToolBar(tr("File")); view_toolbar_views_menu_->addAction (file_toolbar_->toggleViewAction()); file_toolbar_->addAction (action("Open...")); file_toolbar_->addAction (action("Save")); file_toolbar_->addAction (action("Info...")); file_toolbar_->addAction (action("Undo")); file_toolbar_->addAction (action("Redo")); file_toolbar_->addAction (action("Close")); mouse_mode_toolbar_ = addToolBar(tr("Mode")); view_toolbar_views_menu_->addAction (mouse_mode_toolbar_->toggleViewAction()); mouse_mode_toolbar_->addAction (action("New Event")); mouse_mode_toolbar_->addAction (action("Edit Event")); mouse_mode_toolbar_->addAction (action("Scroll")); mouse_mode_toolbar_->addAction (action("View Options")); view_toolbar_ = addToolBar(tr("View")); view_toolbar_views_menu_->addAction (view_toolbar_->toggleViewAction()); view_toolbar_->addAction(action("Events...")); view_toolbar_->addAction(action("Channels...")); view_toolbar_->addAction(action("Scale All...")); view_toolbar_->addAction(action("Zoom In Vertical")); view_toolbar_->addAction(action("Zoom Out Vertical")); view_toolbar_->addAction(action("Zoom In Horizontal")); view_toolbar_->addAction(action("Zoom Out Horizontal")); view_toolbar_views_menu_->addSeparator (); toggle_all_toolbars_ = new QAction (tr("Hide all Toolbars"), this); connect (toggle_all_toolbars_, SIGNAL(triggered()), SLOT(toggleAllToolbars())); toggle_all_toolbars_->setData (true); view_toolbar_views_menu_->addAction (toggle_all_toolbars_); } //------------------------------------------------------------------- void MainWindow::toggleStatusBar (bool visible) { statusBar()->setVisible (visible); QSettings settings ("SigViewer"); settings.setValue("MainWindow/statusbar", statusBar()->isVisible()); } //------------------------------------------------------------------- void MainWindow::toggleAllToolbars () { if (toggle_all_toolbars_->data().toBool()) { toggle_all_toolbars_->setData (false); toggle_all_toolbars_->setText(tr("Show all Toolbars")); foreach (QAction* toggle_action, view_toolbar_views_menu_->actions()) if (toggle_action->isCheckable() && toggle_action->isChecked()) toggle_action->trigger (); } else { toggle_all_toolbars_->setData (true); toggle_all_toolbars_->setText(tr("Hide all Toolbars")); foreach (QAction* toggle_action, view_toolbar_views_menu_->actions()) if (toggle_action->isCheckable() && !toggle_action->isChecked()) toggle_action->trigger (); } } //----------------------------------------------------------------------------- void MainWindow::addBackgroundProcessToStatusBar (QString name, int max) { QProgressBar* progress_bar = new QProgressBar (this); progress_bar->setMinimum (0); progress_bar->setMaximum (max); progress_bar->setValue (0); background_processes_progressbars_[name] = progress_bar; background_processes_labels_[name] = new QLabel (name, this); statusBar()->insertPermanentWidget (0, progress_bar); statusBar()->insertPermanentWidget (0, background_processes_labels_[name]); } //----------------------------------------------------------------------------- void MainWindow::updateBackgroundProcessonStatusBar (QString name, int value) { if (!background_processes_progressbars_.contains (name)) return; background_processes_progressbars_[name]->setValue (value); } //----------------------------------------------------------------------------- void MainWindow::removeBackgroundProcessFromStatusBar (QString name) { if (!background_processes_progressbars_.contains (name)) return; statusBar()->removeWidget (background_processes_progressbars_[name]); delete background_processes_progressbars_[name]; background_processes_progressbars_.remove (name); statusBar()->removeWidget (background_processes_labels_[name]); delete background_processes_labels_[name]; background_processes_labels_.remove (name); } //----------------------------------------------------------------------------- void MainWindow::initMenus (QSharedPointer application_context) { file_recent_files_menu_ = new QMenu(tr("Open &Recent"), this); connect(file_recent_files_menu_, SIGNAL(aboutToShow()), SIGNAL(recentFileMenuAboutToShow())); connect(file_recent_files_menu_, SIGNAL(triggered(QAction*)), SIGNAL(recentFileActivated(QAction*))); file_menu_ = menuBar()->addMenu(tr("&File")); file_menu_->addAction(action("Open...")); file_menu_->addMenu (file_recent_files_menu_); file_menu_->addAction (action("Save")); file_menu_->addAction (action("Save as...")); file_menu_->addSeparator (); file_menu_->addAction (action("Export to PNG...")); file_menu_->addAction (action("Export to GDF...")); file_menu_->addAction (action("Export Events...")); file_menu_->addAction (action("Import Events...")); file_menu_->addSeparator (); file_menu_->addAction (action("Info...")); file_menu_->addSeparator (); file_menu_->addAction (action("Close")); file_menu_->addSeparator (); file_menu_->addAction (action("Exit")); edit_menu_ = menuBar()->addMenu(tr("&Edit")); edit_menu_->addAction (action("Undo")); edit_menu_->addAction (action("Redo")); edit_menu_->addSeparator (); edit_menu_->addAction (action("To all Channels")); edit_menu_->addAction (action("Copy to Channels...")); edit_menu_->addAction (action("Delete")); edit_menu_->addAction (action("Change Channel...")); edit_menu_->addAction (action("Change Type...")); edit_menu_->addSeparator (); edit_menu_->addAction (action("Insert Over")); mouse_mode_menu_ = menuBar()->addMenu(tr("&Mode")); mouse_mode_menu_->addAction (action("New Event")); mouse_mode_menu_->addAction (action("Edit Event")); mouse_mode_menu_->addAction (action("Scroll")); mouse_mode_menu_->addAction (action("View Options")); QAction* toggle_status_bar = new QAction (tr("Statusbar"), this); toggle_status_bar->setCheckable (true); toggle_status_bar->setChecked (statusBar()->isVisible()); connect (toggle_status_bar, SIGNAL(toggled(bool)), this, SLOT(toggleStatusBar(bool))); view_menu_ = menuBar()->addMenu(tr("&View")); view_menu_->addMenu (view_toolbar_views_menu_); view_menu_->addAction(toggle_status_bar); QMenu* animations_menu = view_menu_->addMenu(tr("Animations")); animations_menu->addAction(action("Animations")); animations_menu->addAction(action("Set Animation Duration")); view_menu_->addSeparator(); view_menu_->addAction(action("Events...")); view_menu_->addAction(action("Channels...")); view_menu_->addAction(action("Scale All...")); view_menu_->addSeparator(); view_menu_->addAction(action("Zoom In Vertical")); view_menu_->addAction(action("Zoom Out Vertical")); view_menu_->addAction(action("Zoom In Horizontal")); view_menu_->addAction(action("Zoom Out Horizontal")); view_menu_->addSeparator(); view_menu_->addAction(action("Go to...")); view_menu_->addSeparator(); view_menu_->addAction(action("Goto and Select Next Event")); view_menu_->addAction(action("Goto and Select Previous Event")); view_menu_->addSeparator(); view_menu_->addAction(action("Fit View to Selected Event")); view_menu_->addAction(action("Hide Events of other Type")); view_menu_->addAction(action("Show all Events")); tools_menu_ = menuBar()->addMenu(tr("&Tools")); tools_menu_->addActions(GuiActionFactory::getInstance()->getQActions("Signal Processing")); help_menu_ = menuBar()->addMenu(tr("&Help")); if (application_context->modeActivated (APPLICATION_TEST_MODE)) { help_menu_->addAction (action("Run Tests...")); help_menu_->addSeparator(); } help_menu_->addAction (action("About")); } //----------------------------------------------------------------------------- void MainWindow::closeEvent (QCloseEvent* event) { GuiActionFactory::getInstance()->getQAction("Exit")->trigger(); event->ignore (); } //----------------------------------------------------------------------------- void MainWindow::dropEvent (QDropEvent* event) { if (event->mimeData()->hasUrls()) { QString localPath(event->mimeData()->urls().first().toLocalFile()); event->acceptProposedAction(); OpenFileGuiCommand::openFile (localPath); } else if (event->mimeData()->hasText()) { QString localPath(event->mimeData()->text()); event->acceptProposedAction(); OpenFileGuiCommand::openFile (localPath); } } //----------------------------------------------------------------------------- void MainWindow::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasText() || event->mimeData()->hasUrls()) { event->acceptProposedAction(); } } //----------------------------------------------------------------------------- void MainWindow::resizeEvent (QResizeEvent* event) { QSettings settings ("SigViewer"); settings.setValue("MainWindow/size", event->size()); } //----------------------------------------------------------------------------- void MainWindow::setRecentFiles(const QStringList& recent_file_list) { file_recent_files_menu_->clear(); for (QStringList::const_iterator it = recent_file_list.begin(); it != recent_file_list.end(); it++) { file_recent_files_menu_->addAction(*it); } } //----------------------------------------------------------------------------- void MainWindow::setStatusBarSignalLength(float64 length) { if (length > 0) status_bar_signal_length_label_->setText (tr("Length: ") + QString::number(length, 'f', 1) + "s"); status_bar_signal_length_label_->setVisible (length > 0); } //----------------------------------------------------------------------------- void MainWindow::setStatusBarNrChannels(int32 nr_channels) { if (nr_channels > 0) status_bar_nr_channels_label_->setText (tr("Channels: ") + QString::number(nr_channels)); status_bar_nr_channels_label_->setVisible (nr_channels > 0); } //----------------------------------------------------------------------------- QAction* MainWindow::action (QString const& action_id) { return GuiActionFactory::getInstance()->getQAction (action_id); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/main_window.h000066400000000000000000000041641154433734200216560ustar00rootroot00000000000000#ifndef MAIN_WINDOW_H #define MAIN_WINDOW_H #include "base/sigviewer_user_types.h" #include "gui/application_context.h" #include #include #include #include class QAction; class QComboBox; class QMenu; class QLabel; namespace SigViewer_ { // main window class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow (QSharedPointer application_context); virtual ~MainWindow () {} void setStatusBarSignalLength(float64 length); void setStatusBarNrChannels(int32 nr_channels); void setRecentFiles(const QStringList& recent_file_list); signals: void recentFileActivated(QAction* recent_file_action); void recentFileMenuAboutToShow(); protected: virtual void closeEvent(QCloseEvent* close_event); virtual void dropEvent (QDropEvent* event); virtual void dragEnterEvent(QDragEnterEvent *event); virtual void resizeEvent (QResizeEvent* event); private slots: void toggleStatusBar (bool visible); void toggleAllToolbars (); void addBackgroundProcessToStatusBar (QString name, int max); void updateBackgroundProcessonStatusBar (QString name, int value); void removeBackgroundProcessFromStatusBar (QString name); private: QAction* action (QString const& action_id); MainWindow(const MainWindow&); const MainWindow& operator=(const MainWindow&); void initActions(); void initToolBars(); void initMenus (QSharedPointer application_context); void initStatusBar(); QMenu* file_menu_; QMenu* file_recent_files_menu_; QMenu* edit_menu_; QMenu* mouse_mode_menu_; QMenu* view_menu_; QMenu* view_toolbar_views_menu_; QMenu* tools_menu_; QMenu* help_menu_; QToolBar* file_toolbar_; QToolBar* mouse_mode_toolbar_; QToolBar* view_toolbar_; QLabel* status_bar_signal_length_label_; QLabel* status_bar_nr_channels_label_; QAction* toggle_all_toolbars_; QMap background_processes_progressbars_; QMap background_processes_labels_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/gui_impl/main_window_model_impl.cpp000066400000000000000000000243151154433734200244120ustar00rootroot00000000000000#include "main_window_model_impl.h" #include "main_window.h" #include "tab_context.h" #include "file_context.h" #include "base/exception.h" #include "gui_impl/commands/open_file_gui_command.h" #include "gui_impl/signal_browser/signal_browser_model_4.h" #include "gui_impl/signal_browser/signal_browser_view.h" #include "gui_impl/event_table/event_table_widget.h" #include #include namespace SigViewer_ { int const MainWindowModelImpl::NUMBER_RECENT_FILES_ = 8; //----------------------------------------------------------------------------- MainWindowModelImpl::MainWindowModelImpl (QSharedPointer application_context) : application_context_ (application_context), main_window_ (new MainWindow (application_context)), tab_widget_ (0) { connect (main_window_, SIGNAL(recentFileActivated(QAction*)), SLOT(recentFileActivated(QAction*))); connect (main_window_, SIGNAL(recentFileMenuAboutToShow()), SLOT(recentFileMenuAboutToShow())); main_window_->show(); loadSettings(); } //----------------------------------------------------------------------------- MainWindowModelImpl::~MainWindowModelImpl () { qDebug () << "deleting MainWindowModelImpl"; } //----------------------------------------------------------------------------- void MainWindowModelImpl::loadSettings() { QSettings settings("SigViewer"); settings.beginGroup("MainWindowModelImpl"); int size = settings.beginReadArray("recent_file"); for (int i = 0; i < size; i++) { settings.setArrayIndex(i); recent_file_list_.append(settings.value("name").toString()); } settings.endArray(); settings.endGroup(); } //----------------------------------------------------------------------------- void MainWindowModelImpl::saveSettings() { QSettings settings("SigViewer"); settings.beginGroup("MainWindowModelImpl"); settings.beginWriteArray("recent_file"); for (int i = 0; i < recent_file_list_.size(); i++) { settings.setArrayIndex(i); settings.setValue("name", recent_file_list_.at(i)); } settings.endArray(); settings.endGroup(); } //----------------------------------------------------------------------------- void MainWindowModelImpl::tabChanged (int tab_index) { if (tab_contexts_.find(tab_index) != tab_contexts_.end ()) { application_context_->setCurrentTabContext (tab_contexts_[tab_index]); tab_contexts_[tab_index]->gotActive (); } } //----------------------------------------------------------------------------- void MainWindowModelImpl::closeTab (int tab_index) { if (tab_index == 0) { if (!(application_context_->getCurrentFileContext().isNull())) GuiActionFactory::getInstance()->getQAction("Close")->trigger(); return; } else if (tab_index == 1) return; QWidget* widget = tab_widget_->widget (tab_index); browser_models_.erase (tab_index); tab_widget_->removeTab (tab_index); delete widget; int models_count = browser_models_.size(); if (models_count >= tab_index) { for (int index = tab_index + 1; index < models_count; index++) browser_models_[index - 1] = browser_models_[index]; } int event_views_count = event_views_.size(); if (event_views_count >= tab_index) { for (int index = tab_index + 1; index < event_views_count; index++) if (event_views_.contains (index)) event_views_[index - 1] = event_views_[index]; } } //----------------------------------------------------------------------------- void MainWindowModelImpl::recentFileMenuAboutToShow() { main_window_->setRecentFiles(recent_file_list_); } //----------------------------------------------------------------------------- void MainWindowModelImpl::recentFileActivated(QAction* recent_file_action) { OpenFileGuiCommand::openFile (recent_file_action->text()); } //----------------------------------------------------------------------------- void MainWindowModelImpl::storeAndInitTabContext (QSharedPointer context, int tab_index) { tab_contexts_[tab_index] = context; application_context_->setCurrentTabContext (context); context->setSelectionState (TAB_STATE_NO_EVENT_SELECTED); context->setEditState (TAB_STATE_NO_REDO_NO_UNDO); } //------------------------------------------------------------------------- QSharedPointer MainWindowModelImpl::createSignalVisualisation (QString const& title, ChannelManager const& channel_manager) { int tab_index = createSignalVisualisationImpl (channel_manager, QSharedPointer(0)); tab_widget_->setTabText(tab_index, title); tab_widget_->setCurrentIndex(tab_index); return browser_models_[tab_index]; } //----------------------------------------------------------------------------- QSharedPointer MainWindowModelImpl::createSignalVisualisationOfFile (QSharedPointer file_ctx) { // waldesel: // --begin // to be replaced as soon as multi file support is implemented if (!(application_context_->getCurrentFileContext().isNull())) GuiActionFactory::getInstance()->getQAction("Close")->trigger(); // --end if (!tab_widget_) { tab_widget_ = new QTabWidget (main_window_); if (!connect (tab_widget_, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)))) throw (Exception ("MainWindowModelImpl::createSignalVisualisationOfFile failed: connect (tab_widget_, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)))")); connect (tab_widget_, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int))); tab_widget_->setTabsClosable (true); } recent_file_list_.removeAll (file_ctx->getFilePathAndName()); if (recent_file_list_.size() == NUMBER_RECENT_FILES_) recent_file_list_.pop_back(); recent_file_list_.push_front (file_ctx->getFilePathAndName()); saveSettings(); // waldesel: // --begin // to be replaced as soon as new zooming is implemented main_window_->setStatusBarSignalLength (file_ctx->getChannelManager().getDurationInSec()); // --end main_window_->setStatusBarNrChannels (file_ctx->getChannelManager().getNumberChannels()); resetCurrentFileName (file_ctx->getFileName()); connect (file_ctx.data(), SIGNAL(fileNameChanged(QString const&)), SLOT(resetCurrentFileName(QString const&))); int tab_index = createSignalVisualisationImpl (file_ctx->getChannelManager(), file_ctx->getEventManager()); QString tab_title ("Signal Data"); main_window_->setCentralWidget(tab_widget_); tab_widget_->show(); tab_widget_->setTabText(tab_index, tab_title); file_ctx->setMainVisualisationModel (browser_models_[tab_index]); return browser_models_[tab_index]; } //----------------------------------------------------------------------------- void MainWindowModelImpl::closeCurrentFileTabs () { // waldesel: // --begin // to be refactored as soon as multi file support is implemented main_window_->setCentralWidget (0); tab_widget_ = 0; tab_contexts_.clear (); // --end main_window_->setStatusBarSignalLength(-1); main_window_->setStatusBarNrChannels(-1); resetCurrentFileName (""); } //----------------------------------------------------------------------------- QSharedPointer MainWindowModelImpl::getCurrentSignalVisualisationModel () { if (!tab_widget_) return QSharedPointer(0); return browser_models_[tab_widget_->currentIndex()]; } //------------------------------------------------------------------------- QSharedPointer MainWindowModelImpl::getCurrentEventView () { if (!tab_widget_) return QSharedPointer(0); if (!event_views_.contains (tab_widget_->currentIndex())) return QSharedPointer(0); return event_views_[tab_widget_->currentIndex()]; } //------------------------------------------------------------------------- void MainWindowModelImpl::resetCurrentFileName (QString const& file_name) { if (file_name.size() == 0) main_window_->setWindowTitle (tr("SigViewer")); else main_window_->setWindowTitle (file_name + tr(" - SigViewer")); } //------------------------------------------------------------------------- int MainWindowModelImpl::createSignalVisualisationImpl (ChannelManager const& channel_manager, QSharedPointer event_manager) { QSharedPointer tab_context (new TabContext); QSharedPointer model (new SignalBrowserModel (event_manager, channel_manager, tab_context, application_context_->getEventColorManager())); SignalBrowserView* view = new SignalBrowserView (model, event_manager, tab_context, main_window_->rect(), tab_widget_); int tab_index = tab_widget_->addTab (view, tr("Signal")); model->setSignalBrowserView (view); browser_models_[tab_index] = model; event_views_[tab_index] = model; if (!event_manager.isNull()) { EventTableWidget* event_table_widget = new EventTableWidget (tab_context, event_manager, channel_manager); int event_tab_index = tab_widget_->addTab (event_table_widget, tr("Events")); browser_models_[event_tab_index] = QSharedPointer(0); event_views_[event_tab_index] = event_table_widget->getEventView(); tab_contexts_[event_tab_index] = tab_context; model->connect (event_manager.data(), SIGNAL(eventCreated(QSharedPointer)), SLOT(addEventItem(QSharedPointer))); model->connect (event_manager.data(), SIGNAL(eventRemoved(EventID)), SLOT(removeEventItem(EventID))); model->connect (event_manager.data(), SIGNAL(eventChanged(EventID)), SLOT(updateEvent(EventID))); } storeAndInitTabContext (tab_context, tab_index); return tab_index; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/main_window_model_impl.h000066400000000000000000000075041154433734200240600ustar00rootroot00000000000000#ifndef MAIN_WINDOW_MODEL_IMPL_H #define MAIN_WINDOW_MODEL_IMPL_H #include "base/sigviewer_user_types.h" #include "file_context.h" #include "tab_context.h" #include "file_handling/event_manager.h" #include "file_handling/channel_manager.h" #include "gui/signal_visualisation_model.h" #include "gui/main_window_model.h" #include "gui/application_context.h" #include #include #include #include #include #include #include class QAction; namespace SigViewer_ { class MainWindow; //------------------------------------------------------------------------- class MainWindowModelImpl : public QObject, public MainWindowModel { Q_OBJECT public: //------------------------------------------------------------------------- MainWindowModelImpl (QSharedPointer application_context); //------------------------------------------------------------------------- virtual ~MainWindowModelImpl (); //------------------------------------------------------------------------- virtual QSharedPointer createSignalVisualisation (QString const& title, ChannelManager const& channel_manager); //------------------------------------------------------------------------- virtual QSharedPointer createSignalVisualisationOfFile (QSharedPointer file_ctx); //------------------------------------------------------------------------- virtual void closeCurrentFileTabs (); //------------------------------------------------------------------------- virtual QSharedPointer getCurrentSignalVisualisationModel (); //------------------------------------------------------------------------- virtual QSharedPointer getCurrentEventView (); public slots: //------------------------------------------------------------------------- void tabChanged (int tab_index); //------------------------------------------------------------------------- void closeTab (int tab_index); private slots: //------------------------------------------------------------------------- void recentFileActivated(QAction* recent_file_action); //------------------------------------------------------------------------- void recentFileMenuAboutToShow(); //------------------------------------------------------------------------- void resetCurrentFileName (QString const& file_name); private: //------------------------------------------------------------------------- void loadSettings(); //------------------------------------------------------------------------- void saveSettings(); //------------------------------------------------------------------------- int createSignalVisualisationImpl (ChannelManager const& channel_manager, QSharedPointer event_manager); //------------------------------------------------------------------------- void storeAndInitTabContext (QSharedPointer context, int tab_index); static int const NUMBER_RECENT_FILES_; QSharedPointer application_context_; MainWindow* main_window_; QTabWidget* tab_widget_; QStringList recent_file_list_; std::map > browser_models_; QMap > event_views_; std::map > tab_contexts_; //------------------------------------------------------------------------- // not allowed MainWindowModelImpl(const MainWindowModelImpl&); const MainWindowModelImpl& operator=(const MainWindowModelImpl&); }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/gui_impl/processed_signal_channel_manager.cpp000066400000000000000000000055611154433734200264060ustar00rootroot00000000000000#include "processed_signal_channel_manager.h" namespace SigViewer_ { //------------------------------------------------------------------------- ProcessedSignalChannelManager::ProcessedSignalChannelManager (float32 sample_rate, unsigned length, QObject* parent) : QObject (parent), sample_rate_ (sample_rate), length_ (length) { // nothing to do here } //------------------------------------------------------------------------- void ProcessedSignalChannelManager::addChannel (ChannelID id, QSharedPointer data_block, QString const& label, QString const& y_unit_string) { channels_[id] = data_block; channel_labels_[id] = label; y_unit_strings_[id] = y_unit_string; } //------------------------------------------------------------------------- ChannelID ProcessedSignalChannelManager::addExtraChannel (ChannelID id, QSharedPointer data_block, QString const& label, QString const& y_unit_string) { id += 0.1f; channels_[id] = data_block; channel_labels_[id] = label; y_unit_strings_[id] = y_unit_string; return id; } //------------------------------------------------------------------------- std::set ProcessedSignalChannelManager::getChannels () const { std::set channels; foreach (ChannelID id, channels_.keys()) channels.insert(id); return channels; } //------------------------------------------------------------------------- uint32 ProcessedSignalChannelManager::getNumberChannels () const { return channels_.size (); } //------------------------------------------------------------------------- QString ProcessedSignalChannelManager::getChannelLabel (ChannelID id) const { return channel_labels_[id]; } //------------------------------------------------------------------------- QString ProcessedSignalChannelManager::getChannelYUnitString (ChannelID id) const { return y_unit_strings_[id]; } //------------------------------------------------------------------------- QSharedPointer ProcessedSignalChannelManager::getData (ChannelID id, unsigned start_pos, unsigned length) const { return channels_[id]->createSubBlock (start_pos, length); } //------------------------------------------------------------------------- float32 ProcessedSignalChannelManager::getDurationInSec () const { return static_cast(length_) / sample_rate_; } //------------------------------------------------------------------------- uint32 ProcessedSignalChannelManager::getNumberSamples () const { return length_; } //------------------------------------------------------------------------- float32 ProcessedSignalChannelManager::getSampleRate () const { return sample_rate_; } } sigviewer-0.5.1+svn556/src/gui_impl/processed_signal_channel_manager.h000066400000000000000000000047711154433734200260550ustar00rootroot00000000000000#ifndef PROCESSED_SIGNAL_CHANNEL_MANAGER_H #define PROCESSED_SIGNAL_CHANNEL_MANAGER_H #include "file_handling/channel_manager.h" #include #include namespace SigViewer_ { class ProcessedSignalChannelManager : public ChannelManager, public QObject { public: //------------------------------------------------------------------------- ProcessedSignalChannelManager (float32 sample_rate, unsigned length, QObject* parent); //------------------------------------------------------------------------- void addChannel (ChannelID id, QSharedPointer data_block, QString const& label, QString const& y_unit_string); //------------------------------------------------------------------------- ChannelID addExtraChannel (ChannelID id, QSharedPointer data_block, QString const& label, QString const& y_unit_string); //------------------------------------------------------------------------- virtual ~ProcessedSignalChannelManager () {} //------------------------------------------------------------------------- virtual std::set getChannels () const; //------------------------------------------------------------------------- virtual uint32 getNumberChannels () const; //------------------------------------------------------------------------- virtual QString getChannelLabel (ChannelID id) const; //------------------------------------------------------------------------- virtual QString getChannelYUnitString (ChannelID id) const; //------------------------------------------------------------------------- virtual QSharedPointer getData (ChannelID id, unsigned start_pos, unsigned length) const; //------------------------------------------------------------------------- virtual float32 getDurationInSec () const; //------------------------------------------------------------------------- virtual uint32 getNumberSamples () const; //------------------------------------------------------------------------- virtual float32 getSampleRate () const; private: float32 sample_rate_; unsigned length_; QMap > channels_; QMap channel_labels_; QMap y_unit_strings_; }; } #endif // PROCESSED_SIGNAL_CHANNEL_MANAGER_H sigviewer-0.5.1+svn556/src/gui_impl/select_shown_channels_dialog.cpp000066400000000000000000000050401154433734200255570ustar00rootroot00000000000000#include "select_shown_channels_dialog.h" #include #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- SelectShownChannelsDialog::SelectShownChannelsDialog (QString const& dialog_title, std::set const& channels, ChannelManager const& channel_manager) : channels_ (channels) { setWindowTitle (dialog_title); QVBoxLayout* top_layout = new QVBoxLayout(this); top_layout->setMargin(10); top_layout->setSpacing(10); channel_list_widget_ = new QListWidget(this); channel_list_widget_->setSelectionMode(QAbstractItemView::ExtendedSelection); for (std::set::const_iterator channel_iter = channels_.begin(); channel_iter != channels_.end (); ++channel_iter) { QString label = channel_manager.getChannelLabel(*channel_iter); channel_list_widget_->addItem(QString("(%1) %2").arg (*channel_iter + 1) .arg(label)); } top_layout->addWidget (channel_list_widget_); QHBoxLayout* button_layout = new QHBoxLayout(this); button_layout->setMargin(10); button_layout->addStretch(1); ok_button_ = new QPushButton(tr("OK"), this); button_layout->addWidget(ok_button_); cancel_button_ = new QPushButton(tr("Cancel"), this); button_layout->addWidget(cancel_button_); button_layout->addStretch(1); top_layout->addLayout(button_layout); top_layout->activate(); connect(ok_button_, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel_button_, SIGNAL(clicked()), this, SLOT(reject())); } //----------------------------------------------------------------------------- std::set SelectShownChannelsDialog::getSelectedChannels () const { QList find_list; std::set selected_channels; for (std::set::const_iterator channel_iter = channels_.begin(); channel_iter != channels_.end (); ++channel_iter) { find_list = channel_list_widget_ ->findItems(QString("(%1)").arg(*channel_iter + 1), Qt::MatchStartsWith); if (find_list.size() > 0 && channel_list_widget_->isItemSelected(find_list[0])) selected_channels.insert (*channel_iter); } return selected_channels; } } //namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/select_shown_channels_dialog.h000066400000000000000000000017351154433734200252330ustar00rootroot00000000000000#ifndef SELECT_SHOWN_CHANNELS_DIALOG_H #define SELECT_SHOWN_CHANNELS_DIALOG_H #include "base/sigviewer_user_types.h" #include "file_handling/channel_manager.h" #include #include class QListWidget; class QPushButton; namespace SigViewer_ { class SelectShownChannelsDialog : public QDialog { Q_OBJECT public: SelectShownChannelsDialog (QString const& dialog_title, std::set const& channels, ChannelManager const& channel_manager); std::set getSelectedChannels () const; private: SelectShownChannelsDialog (); SelectShownChannelsDialog (const SelectShownChannelsDialog&); const SelectShownChannelsDialog& operator= (const SelectShownChannelsDialog&); std::set channels_; QListWidget* channel_list_widget_; QPushButton* ok_button_; QPushButton* cancel_button_; }; } // namespace SigViewer_ #endif // SELECT_SHOWN_CHANNELS_DIALOG_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/000077500000000000000000000000001154433734200222055ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/adapt_browser_view_widget.cpp000066400000000000000000000122351154433734200301450ustar00rootroot00000000000000#include "adapt_browser_view_widget.h" #include "gui/gui_action_factory.h" #include "base/exception.h" #include "base/math_utils.h" #include "gui_impl/gui_helper_functions.h" #include #include #include #include namespace SigViewer_ { //------------------------------------------------------------------------- AdaptBrowserViewWidget::AdaptBrowserViewWidget (SignalVisualisationView const* signal_visualisation_view, QSharedPointer settings, QWidget *parent) : QWidget (parent), signal_visualisation_view_ (signal_visualisation_view), settings_ (settings), self_updating_ (false), updating_values_ (false) { ui_.setupUi (this); if (!connect (ui_.x_axis_checkbox_, SIGNAL(toggled(bool)), SIGNAL(xAxisVisibilityChanged(bool)))) throw (Exception ("connect failed: x_axis_checkbox_")); if (!connect (ui_.y_axis_checkbox_, SIGNAL(toggled(bool)), SIGNAL(yAxisVisibilityChanged(bool)))) throw (Exception ("connect failed: y_axis_checkbox_")); if (!connect (ui_.labels_checkbox_, SIGNAL(toggled(bool)), SIGNAL(labelsVisibilityChanged(bool)))) throw (Exception ("connect failed: labels_checkbox_")); ui_.xGridCheckbox->setVisible(false); ui_.xGridSlider->setVisible(false); ui_.xGridFragmentationLabel->setVisible(false); ui_.yGridCheckbox->setVisible(false); ui_.zero_centered_->setDefaultAction (GuiActionFactory::getInstance()->getQAction("Zero Line Centered")); ui_.zero_fitted_->setDefaultAction (GuiActionFactory::getInstance()->getQAction("Zero Line Fitted")); ui_.channelsPerPageSpinbox->setMaximum (settings->getChannelManager().getNumberChannels()); ui_.secsPerPageSpinbox->setMaximum (settings_->getChannelManager().getDurationInSec()); ui_.xUnitsPerPageLabel->setText (settings_->getChannelManager().getXAxisUnitLabel() + ui_.xUnitsPerPageLabel->text()); connect (settings_.data(), SIGNAL(channelHeightChanged()), SLOT(updateValues())); connect (settings_.data(), SIGNAL(gridFragmentationChanged()), SLOT(updateValues())); connect (settings_.data(), SIGNAL(pixelsPerSampleChanged()), SLOT(updateValues())); } //------------------------------------------------------------------------- void AdaptBrowserViewWidget::showEvent (QShowEvent*) { updateValues (); } //------------------------------------------------------------------------- void AdaptBrowserViewWidget::on_channelOverlappingSlider_valueChanged (int value) { if (updating_values_) return; settings_->setChannelOverlapping (static_cast(value) / 100.0); } //------------------------------------------------------------------------- void AdaptBrowserViewWidget::on_yGridSlider_valueChanged (int value) { if (updating_values_) return; settings_->setGridFragmentation (Qt::Vertical, value); } //------------------------------------------------------------------------- void AdaptBrowserViewWidget::on_channelsPerPageSpinbox_valueChanged (int value) { if (updating_values_) return; self_updating_ = true; int new_channel_height = signal_visualisation_view_->getViewportHeight() / value; GuiHelper::animateProperty (settings_.data(), "channelHeight", settings_->getChannelHeight(), new_channel_height, this, SLOT(selfUpdatingFinished())); } //------------------------------------------------------------------------- void AdaptBrowserViewWidget::on_secsPerPageSpinbox_valueChanged (double value) { if (updating_values_) return; self_updating_ = true; float new_pixels_per_sample = signal_visualisation_view_->getViewportWidth() / (value * settings_->getChannelManager().getSampleRate()); GuiHelper::animateProperty (settings_.data(), "pixelsPerSample", settings_->getPixelsPerSample(), new_pixels_per_sample, this, SLOT(selfUpdatingFinished())); } //------------------------------------------------------------------------- void AdaptBrowserViewWidget::updateValues () { if ((!isVisible()) || self_updating_) return; updating_values_ = true; ui_.x_axis_checkbox_->setChecked (signal_visualisation_view_->getXAxisVisibility ()); ui_.y_axis_checkbox_->setChecked (signal_visualisation_view_->getYAxisVisibility ()); ui_.labels_checkbox_->setChecked (signal_visualisation_view_->getLabelsVisibility ()); ui_.yGridSlider->setValue (settings_->getGridFragmentation(Qt::Vertical)); ui_.channelsPerPageSpinbox->setValue (signal_visualisation_view_->getViewportHeight() / settings_->getChannelHeight()); ui_.secsPerPageSpinbox->setValue ((signal_visualisation_view_->getViewportWidth() / settings_->getPixelsPerSample()) / settings_->getChannelManager().getSampleRate()); updating_values_ = false; } //------------------------------------------------------------------------- void AdaptBrowserViewWidget::selfUpdatingFinished () { self_updating_ = false; } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/adapt_browser_view_widget.h000066400000000000000000000043731154433734200276160ustar00rootroot00000000000000#ifndef ADAPT_BROWSER_VIEW_WIDGET_H #define ADAPT_BROWSER_VIEW_WIDGET_H #include "gui/signal_visualisation_view.h" #include "gui/signal_view_settings.h" #include "ui_adapt_browser_view_widget.h" #include #include namespace SigViewer_ { //------------------------------------------------------------------------- class AdaptBrowserViewWidget : public QWidget { Q_OBJECT public: //------------------------------------------------------------------------- explicit AdaptBrowserViewWidget (SignalVisualisationView const* signal_visualisation_view, QSharedPointer settings_, QWidget *parent = 0); signals: //------------------------------------------------------------------------- void xAxisVisibilityChanged (bool visible); //------------------------------------------------------------------------- void yAxisVisibilityChanged (bool visible); //------------------------------------------------------------------------- void labelsVisibilityChanged (bool visible); private slots: //------------------------------------------------------------------------- void on_channelOverlappingSlider_valueChanged (int value); //------------------------------------------------------------------------- void on_yGridSlider_valueChanged (int value); //------------------------------------------------------------------------- void on_channelsPerPageSpinbox_valueChanged (int value); //------------------------------------------------------------------------- void on_secsPerPageSpinbox_valueChanged (double value); //------------------------------------------------------------------------- void updateValues (); //------------------------------------------------------------------------- void selfUpdatingFinished (); private: //------------------------------------------------------------------------- virtual void showEvent (QShowEvent* event); SignalVisualisationView const* signal_visualisation_view_; QSharedPointer settings_; Ui::AdaptBrowserViewWidget ui_; bool self_updating_; bool updating_values_; }; } #endif // ADAPT_BROWSER_VIEW_WIDGET_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/adapt_browser_view_widget.ui000066400000000000000000000151251154433734200300010ustar00rootroot00000000000000 AdaptBrowserViewWidget 0 0 916 73 0 0 Form Labels true false 0 0 Y-Grid true Qt::Horizontal 40 20 Y-Grid Fragmentation Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 30 1 Qt::Horizontal false QSlider::NoTicks Qt::Horizontal 40 20 false X-Grid true X-Axis true Y-Axis true 0-Line Fitted 0-Line Centered false X-Grid Fragmentation: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter false Qt::Horizontal 1 Qt::Horizontal 40 20 Channels / Page: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter / Page: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 1 0.100000000000000 100 Qt::Vertical Qt::Horizontal 40 20 sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_context_menu.cpp000066400000000000000000000126211154433734200266240ustar00rootroot00000000000000#include "event_context_menu.h" #include "signal_browser_model_4.h" #include "gui/gui_action_factory.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- EventContextMenu::EventContextMenu (SignalVisualisationModel& browser_model, QSharedPointer event_manager) : browser_model_ (browser_model), event_manager_ (event_manager) { // nothing to do here } //----------------------------------------------------------------------------- EventContextMenu::~EventContextMenu () { } //------------------------------------------------------------------------- void EventContextMenu::addEvent (EventID event) { QVector::iterator it = sub_menus_.begin(); while (it != sub_menus_.end()) { (*it)->clear(); delete (*it); ++it; } sub_menus_.clear(); clear(); QObject::disconnect(this, 0); event_ids_.append (event); } //------------------------------------------------------------------------- unsigned EventContextMenu::getNumberOfEvents () const { return event_ids_.size(); } //------------------------------------------------------------------------- void EventContextMenu::finaliseAndShowContextMenu (QGraphicsSceneContextMenuEvent* context_event, QMenu* channel_menu) { QVector::iterator it = event_ids_.begin(); if (event_ids_.size() > 1) { while (it != event_ids_.end()) { QString text (event_manager_->getNameOfEvent(*it)); QMenu* submenu = new QMenu (text); sub_menus_.append(submenu); // context-menu actions addActionsToMenu (*submenu, *it); QAction* action = addMenu (submenu); action->activate(QAction::Hover); action->setData(*it); addAction(action); ++it; } } else if (event_ids_.size() == 1) { QAction* title = addAction (event_manager_->getNameOfEvent(*it)); title->setEnabled (false); addActionsToMenu (*this, *(event_ids_.begin ())); browser_model_.selectEvent (*it); } event_ids_.clear(); QObject::connect(this, SIGNAL(hovered(QAction*)), this, SLOT(selectEvent(QAction*))); if (channel_menu) { addSeparator (); addMenu (channel_menu); } exec (context_event->screenPos()); } //------------------------------------------------------------------------- void EventContextMenu::finaliseAndShowSelectionMenu (QGraphicsSceneMouseEvent* event) { QVector::iterator it = event_ids_.begin(); if (event_ids_.size() > 1) { while (it != event_ids_.end()) { QString text (event_manager_->getNameOfEvent (*it)); QAction* action = addAction(text); //action->activate(QAction::Hover); action->setData(*it); //addAction(action); ++it; } QObject::connect(this, SIGNAL(triggered(QAction*)), this, SLOT(selectEvent(QAction*))); exec (event->screenPos()); } else if (event_ids_.size() == 1) { browser_model_.selectEvent (*it); } event_ids_.clear(); } //------------------------------------------------------------------------- void EventContextMenu::selectEvent (QAction* q) { bool ok = false; int32 event_id = q->data().toInt(&ok); if (q->data().isValid()) browser_model_.selectEvent (event_id); } //------------------------------------------------------------------------- void EventContextMenu::addActionsToMenu (QMenu& menu, EventID event) { QList actions; if (event_manager_->getEvent(event)->getChannel() != UNDEFINED_CHANNEL) { actions.append (GuiActionFactory::getInstance()->getQAction("To all Channels")); actions.append (GuiActionFactory::getInstance()->getQAction("Copy to Channels...")); } actions.append (GuiActionFactory::getInstance()->getQAction("Delete")); actions.append (GuiActionFactory::getInstance()->getQAction("Change Channel...")); actions.append (GuiActionFactory::getInstance()->getQAction("Change Type...")); actions.append (new QAction (this)); actions.last()->setSeparator(true); actions.append (GuiActionFactory::getInstance()->getQAction("Insert Over")); actions.append (new QAction (this)); actions.last()->setSeparator(true); if (event_manager_->getNextEventOfSameType (event) != UNDEFINED_EVENT_ID) actions.append (GuiActionFactory::getInstance()->getQAction("Goto and Select Next Event")); if (event_manager_->getPreviousEventOfSameType (event) != UNDEFINED_EVENT_ID) actions.append (GuiActionFactory::getInstance()->getQAction("Goto and Select Previous Event")); if (!actions.last()->isSeparator()) { actions.append (new QAction (this)); actions.last()->setSeparator(true); } if (browser_model_.getShownEventTypes().size() > 1) actions.append (GuiActionFactory::getInstance()->getQAction("Hide Events of other Type")); else actions.append (GuiActionFactory::getInstance()->getQAction("Show all Events")); actions.append (GuiActionFactory::getInstance()->getQAction("Fit View to Selected Event")); foreach (QAction* action, actions) menu.addAction (action); } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_context_menu.h000066400000000000000000000043361154433734200262750ustar00rootroot00000000000000#ifndef EVENT_CONTEXT_MENU_H #define EVENT_CONTEXT_MENU_H #include "event_graphics_item.h" #include "file_handling/event_manager.h" #include "gui/signal_visualisation_model.h" #include #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// /// EventContextMenu /// /// enables editing of events... allows selection of events class EventContextMenu : public QMenu { Q_OBJECT public: //------------------------------------------------------------------------- EventContextMenu (SignalVisualisationModel& browser_model, QSharedPointer event_manager); //------------------------------------------------------------------------- virtual ~EventContextMenu (); //------------------------------------------------------------------------- void addEvent (EventID event); //------------------------------------------------------------------------- unsigned getNumberOfEvents () const; //------------------------------------------------------------------------- void finaliseAndShowContextMenu (QGraphicsSceneContextMenuEvent* context_event, QMenu* channel_menu = 0); //------------------------------------------------------------------------- void finaliseAndShowSelectionMenu (QGraphicsSceneMouseEvent* context_event); private: //------------------------------------------------------------------------- void addActionsToMenu (QMenu& menu, EventID event); QVector event_ids_; QVector sub_menus_; SignalVisualisationModel& browser_model_; QSharedPointer event_manager_; //------------------------------------------------------------------------- /// copy-constructor disabled EventContextMenu (EventContextMenu const &); //------------------------------------------------------------------------- /// assignment-operator disabled EventContextMenu& operator= (EventContextMenu const &); //signals: // void hovered (QAction* q); public slots: void selectEvent (QAction* q); }; } #endif // EVENT_CONTEXT_MENU_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_creation_widget.cpp000066400000000000000000000040461154433734200272650ustar00rootroot00000000000000#include "event_creation_widget.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- EventCreationWidget::EventCreationWidget (QSharedPointer signal_visualisation_model, QSharedPointer event_manager, QWidget* parent) : QWidget(parent), signal_visualisation_model_ (signal_visualisation_model), event_manager_ (event_manager), self_updating_ (false) { ui_.setupUi (this); } //----------------------------------------------------------------------------- void EventCreationWidget::updateShownEventTypes (std::set const& shown_event_types) { setSelfUpdating (true); ui_.type_combobox_->clear (); int current_index = 0; foreach (EventType type, shown_event_types) { ui_.type_combobox_->addItem (event_manager_->getNameOfEventType (type), QVariant (type)); if (type == signal_visualisation_model_->getActualEventCreationType()) current_index = ui_.type_combobox_->count() - 1; } ui_.type_combobox_->setCurrentIndex (current_index); setSelfUpdating (false); } //----------------------------------------------------------------------------- void EventCreationWidget::on_type_combobox__currentIndexChanged (int combo_box_index) { if (isSelfUpdating ()) return; EventType event_type = ui_.type_combobox_->itemData(combo_box_index).toUInt(); signal_visualisation_model_->setActualEventCreationType (event_type); } //------------------------------------------------------------------- void EventCreationWidget::setSelfUpdating (bool self_updating) { QMutexLocker locker (&self_updating_mutex_); self_updating_ = self_updating; } //------------------------------------------------------------------- bool EventCreationWidget::isSelfUpdating () { QMutexLocker locker (&self_updating_mutex_); return self_updating_; } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_creation_widget.h000066400000000000000000000021621154433734200267270ustar00rootroot00000000000000#ifndef EVENT_CREATION_WIDGET_H #define EVENT_CREATION_WIDGET_H #include "base/sigviewer_user_types.h" #include "ui_event_creation_widget.h" #include "gui/signal_visualisation_model.h" #include "file_handling/event_manager.h" #include #include #include namespace SigViewer_ { class EventCreationWidget : public QWidget { Q_OBJECT public: explicit EventCreationWidget (QSharedPointer signal_visualisation_model, QSharedPointer event_manager, QWidget* parent = 0); signals: public slots: void updateShownEventTypes (std::set const& shown_event_types); private slots: void on_type_combobox__currentIndexChanged (int combo_box_index); private: void setSelfUpdating (bool self_updating); bool isSelfUpdating (); QSharedPointer signal_visualisation_model_; QSharedPointer event_manager_; QMutex self_updating_mutex_; bool self_updating_; Ui::EventCreationWidget ui_; }; } #endif // EVENT_CREATION_WIDGET_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_creation_widget.ui000066400000000000000000000006271154433734200271210ustar00rootroot00000000000000 EventCreationWidget Form sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_editing_widget.cpp000066400000000000000000000133441154433734200271050ustar00rootroot00000000000000#include "event_editing_widget.h" #include "gui/gui_action_factory.h" #include "editing_commands/change_type_undo_command.h" #include "editing_commands/resize_event_undo_command.h" #include "base/math_utils.h" #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- EventEditingWidget::EventEditingWidget (QSharedPointer event_manager, QSharedPointer command_executer, QWidget *parent) : QWidget(parent), event_manager_ (event_manager), command_executer_ (command_executer), self_updating_ (false) { ui_.setupUi (this); ui_.previous_button_->setDefaultAction (GuiActionFactory::getInstance()->getQAction("Goto and Select Previous Event")); ui_.next_button_->setDefaultAction (GuiActionFactory::getInstance()->getQAction("Goto and Select Next Event")); ui_.fit_button_->setDefaultAction (GuiActionFactory::getInstance()->getQAction("Fit View to Selected Event")); unsigned precision = MathUtils_::sampleRateToDecimalPrecision(event_manager_->getSampleRate()); ui_.begin_spinbox_->setDecimals (precision); ui_.begin_spinbox_->setMaximum (static_cast(event_manager_->getMaxEventPosition()) / event_manager_->getSampleRate ()); ui_.duration_spinbox_->setDecimals (precision); } //----------------------------------------------------------------------------- void EventEditingWidget::updateShownEventTypes (std::set const& shown_event_types) { setSelfUpdating (true); ui_.type_combobox_->clear (); foreach (EventType type, shown_event_types) ui_.type_combobox_->addItem (event_manager_->getNameOfEventType (type), QVariant (type)); setSelfUpdating (false); } //----------------------------------------------------------------------------- void EventEditingWidget::updateSelectedEventInfo (QSharedPointer selected_signal_event) { setSelfUpdating (true); selected_signal_event_ = selected_signal_event; if (selected_signal_event_.isNull()) ui_.selection_frame_->setDisabled (true); else { ui_.selection_frame_->setEnabled (true); ui_.type_combobox_->setCurrentIndex (ui_.type_combobox_->findData (QVariant(selected_signal_event_->getType()))); ui_.duration_spinbox_->setValue (selected_signal_event_->getDurationInSec ()); ui_.duration_spinbox_->setMaximum (static_cast(event_manager_->getMaxEventPosition () - selected_signal_event->getPosition()) / event_manager_->getSampleRate ()); ui_.begin_spinbox_->setValue (selected_signal_event_->getPositionInSec ()); bool has_no_previous_event = event_manager_->getPreviousEventOfSameType (selected_signal_event->getId ()) == UNDEFINED_EVENT_ID; bool has_no_next_event = event_manager_->getNextEventOfSameType (selected_signal_event->getId ()) == UNDEFINED_EVENT_ID; ui_.next_button_->setDisabled (has_no_next_event); ui_.previous_button_->setDisabled (has_no_previous_event); } setSelfUpdating (false); } //------------------------------------------------------------------- void EventEditingWidget::on_type_combobox__currentIndexChanged (int combo_box_index) { if (isSelfUpdating() || selected_signal_event_.isNull ()) return; EventType event_type = ui_.type_combobox_->itemData(combo_box_index).toUInt(); if (event_type != selected_signal_event_->getType()) { ChangeTypeUndoCommand* change_type_command = new ChangeTypeUndoCommand (event_manager_, selected_signal_event_->getId(), event_type); command_executer_->executeCommand (change_type_command); } } //------------------------------------------------------------------- void EventEditingWidget::on_begin_spinbox__editingFinished () { if (isSelfUpdating () || selected_signal_event_.isNull()) return; unsigned new_begin = ui_.begin_spinbox_->value() * event_manager_->getSampleRate (); ResizeEventUndoCommand* resize_command = new ResizeEventUndoCommand (event_manager_, selected_signal_event_->getId(), new_begin, selected_signal_event_->getDuration()); command_executer_->executeCommand (resize_command); } //------------------------------------------------------------------- void EventEditingWidget::on_duration_spinbox__editingFinished () { if (isSelfUpdating () || selected_signal_event_.isNull()) return; unsigned new_duration = ui_.duration_spinbox_->value() * event_manager_->getSampleRate (); ResizeEventUndoCommand* resize_command = new ResizeEventUndoCommand (event_manager_, selected_signal_event_->getId(), selected_signal_event_->getPosition(), new_duration); command_executer_->executeCommand (resize_command); } //------------------------------------------------------------------- void EventEditingWidget::setSelfUpdating (bool self_updating) { QMutexLocker locker (&self_updating_mutex_); self_updating_ = self_updating; } //------------------------------------------------------------------- bool EventEditingWidget::isSelfUpdating () { QMutexLocker locker (&self_updating_mutex_); return self_updating_; } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_editing_widget.h000066400000000000000000000025241154433734200265500ustar00rootroot00000000000000#ifndef EVENT_EDITING_WIDGET_H #define EVENT_EDITING_WIDGET_H #include "base/sigviewer_user_types.h" #include "file_handling/event_manager.h" #include "command_executer.h" #include "ui_event_editing_widget.h" #include #include #include namespace SigViewer_ { class EventEditingWidget : public QWidget { Q_OBJECT public: explicit EventEditingWidget (QSharedPointer event_manager, QSharedPointer command_executer, QWidget *parent = 0); signals: public slots: void updateShownEventTypes (std::set const& shown_event_types); void updateSelectedEventInfo (QSharedPointer selected_signal_event); private slots: void on_type_combobox__currentIndexChanged (int combo_box_index); void on_begin_spinbox__editingFinished (); void on_duration_spinbox__editingFinished (); private: void setSelfUpdating (bool self_updating); bool isSelfUpdating (); QSharedPointer event_manager_; QSharedPointer command_executer_; QSharedPointer selected_signal_event_; QMutex self_updating_mutex_; bool self_updating_; Ui::EventEditingWidget ui_; }; } #endif // EVENT_EDITING_WIDGET_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_editing_widget.ui000066400000000000000000000060061154433734200267350ustar00rootroot00000000000000 EventEditingWidget true 0 0 423 29 Form false QFrame::NoFrame 0 0 Begin Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter s Duration Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter s 22 22 false 22 22 false 22 22 sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_graphics_item.cpp000066400000000000000000000307621154433734200267400ustar00rootroot00000000000000#include "event_graphics_item.h" #include "signal_browser_model_4.h" #include "editing_commands/resize_event_undo_command.h" #include "event_context_menu.h" #include "base/signal_event.h" #include "gui_impl/signal_browser_mouse_handling.h" #include #include #include #include #include #include #include #include #include #include namespace SigViewer_ { // move mouse range int EventGraphicsItem::move_mouse_range_ = 5; QMutex EventGraphicsItem::event_handling_mutex_; QMutex EventGraphicsItem::context_menu_mutex_; EventContextMenu* EventGraphicsItem::context_menu_ = 0; //----------------------------------------------------------------------------- EventGraphicsItem::EventGraphicsItem (SignalBrowserModel& model, QSharedPointer signal_view_settings, QSharedPointer signal_event, QSharedPointer event_manager, QSharedPointer command_executer, QSharedPointer color_manager) : signal_browser_model_ (model), signal_view_settings_ (signal_view_settings), event_manager_ (event_manager), command_executer_ (command_executer), state_ (STATE_NONE), is_selected_ (false), signal_event_ (signal_event), color_manager_ (color_manager) { // nothing to do here } //----------------------------------------------------------------------------- EventGraphicsItem::~EventGraphicsItem () { // nothing to do here } //----------------------------------------------------------------------------- int32 EventGraphicsItem ::getId() const { return signal_event_->getId(); } //----------------------------------------------------------------------------- void EventGraphicsItem::setSelected (bool selected) { state_ = STATE_NONE; is_selected_ = selected; if (scene ()) scene()->update(pos().x() - 5, pos().y() - 5, width_ + 10, height_ + 10); } //----------------------------------------------------------------------------- QSharedPointer EventGraphicsItem::getSignalEvent () const { return signal_event_; } //----------------------------------------------------------------------------- bool EventGraphicsItem::displayContextMenu (QGraphicsSceneContextMenuEvent* event, QMenu* channel_menu) { context_menu_mutex_.lock(); bool menu_shown = false; if (!context_menu_) menu_shown = false; else if (context_menu_->getNumberOfEvents()) { context_menu_->finaliseAndShowContextMenu (event, channel_menu); menu_shown = true; } context_menu_mutex_.unlock(); return menu_shown; } //----------------------------------------------------------------------------- bool EventGraphicsItem::displaySelectionMenu (QGraphicsSceneMouseEvent* event) { context_menu_mutex_.lock(); bool menu_shown = false; if (!context_menu_) { menu_shown = false; } else if (context_menu_->getNumberOfEvents()) { context_menu_->finaliseAndShowSelectionMenu(event); menu_shown = true; } context_menu_mutex_.unlock(); return menu_shown; } //----------------------------------------------------------------------------- void EventGraphicsItem::updateToSignalEvent () { float64 pixel_per_sample = signal_view_settings_->getPixelsPerSample(); QRectF old_rect; if (scene ()) old_rect = this->sceneBoundingRect(); width_ = pixel_per_sample * signal_event_->getDuration() + 0.5; if (width_ < 2) width_ = 2; int32 x_pos = pixel_per_sample * signal_event_->getPosition(); int32 y_pos = 0; if (signal_event_->getChannel() == UNDEFINED_CHANNEL) height_ = (signal_view_settings_->getChannelHeight()) * signal_browser_model_.getShownChannels().size(); else { height_ = signal_view_settings_->getChannelHeight(); y_pos = signal_browser_model_.getYPosOfChannel(signal_event_->getChannel()); } color_ = color_manager_->getEventColor(signal_event_->getType()); /// FIXXME: REMOVE MAGIC NUMBER setZValue (5 + signal_event_->getType() / 100000.0); setPos (x_pos, y_pos); if (scene()) scene()->update(old_rect); update (); } //----------------------------------------------------------------------------- QRectF EventGraphicsItem::boundingRect () const { return QRectF (0, 0, width_, height_); } //----------------------------------------------------------------------------- void EventGraphicsItem::paint (QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget*) { QRect clip (option->exposedRect.toRect()); if (is_selected_) { painter->drawRect(boundingRect()); } painter->fillRect(clip, color_); } //----------------------------------------------------------------------------- void EventGraphicsItem::mousePressEvent (QGraphicsSceneMouseEvent * event) { event_handling_mutex_.lock(); if (state_ != STATE_NONE) { event_handling_mutex_.unlock(); return; } switch(getMousePressAction(event)) { case ACTION_NONE: event->ignore(); state_ = STATE_NONE; break; case ACTION_MOVE_BEGIN: state_ = STATE_MOVE_BEGIN; setCursor(QCursor(Qt::SizeHorCursor)); emit mouseMoving (true); break; case ACTION_MOVE_END: state_ = STATE_MOVE_END; setCursor(QCursor(Qt::SizeHorCursor)); emit mouseMoving (true); break; case ACTION_SELECT: { addContextMenuEntry (); event->ignore(); } break; default: break; } event_handling_mutex_.unlock(); } //----------------------------------------------------------------------------- void EventGraphicsItem::mouseMoveEvent (QGraphicsSceneMouseEvent* mouse_event) { float32 pixel_per_sample = signal_view_settings_->getPixelsPerSample(); int32 mouse_pos_rounded = 0.5 + (mouse_event->scenePos().x() / pixel_per_sample); mouse_pos_rounded *= pixel_per_sample; switch(state_) { case STATE_NONE: break; case STATE_MOVE_BEGIN: { int32 old_pos = pos().x(); int32 new_pos = mouse_pos_rounded; width_ = width_ - (new_pos - old_pos); if (width_ < 0) width_ = 0; setPos (new_pos, pos().y()); emit mouseAtSecond (static_cast(pos().x()) / (pixel_per_sample * event_manager_->getSampleRate())); } break; case STATE_MOVE_END: { int32 old_pos_end = pos().x() + width_; int32 diff = mouse_pos_rounded - old_pos_end; width_ = width_ + diff; if (width_ < 0) width_ = 0; if (diff > 0) scene()->update (pos().x() + width_ - diff - 10, pos().y(), diff + 20, height_); else scene()->update (pos().x() + width_ - 10, pos().y(), 20 - diff, height_); emit mouseAtSecond (static_cast(pos().x() + width_) / (pixel_per_sample * event_manager_->getSampleRate())); } break; default: break; } } //----------------------------------------------------------------------------- void EventGraphicsItem::mouseReleaseEvent (QGraphicsSceneMouseEvent*) { float32 pixel_per_sample = signal_view_settings_->getPixelsPerSample(); switch(state_) { case STATE_MOVE_BEGIN: { int32 sample_pos = (static_cast(pos().x()) / pixel_per_sample) + 0.5; int32 dur = (static_cast(width_) / pixel_per_sample) + 0.5; ResizeEventUndoCommand* command = new ResizeEventUndoCommand (event_manager_, signal_event_->getId(), sample_pos, dur); command_executer_->executeCommand (command); } break; case STATE_MOVE_END: { int32 dur = (static_cast(width_) / pixel_per_sample) + 0.5; ResizeEventUndoCommand* command = new ResizeEventUndoCommand (event_manager_, signal_event_->getId(), signal_event_->getPosition(), dur); command_executer_->executeCommand (command); } break; default: break; } setCursor(QCursor(Qt::ArrowCursor)); state_ = STATE_NONE; emit mouseMoving (false); } //----------------------------------------------------------------------------- void EventGraphicsItem::contextMenuEvent (QGraphicsSceneContextMenuEvent * event) { if (signal_browser_model_.getMode() != MODE_VIEW_OPTIONS) addContextMenuEntry (); event->ignore(); } //----------------------------------------------------------------------------- EventGraphicsItem::Action EventGraphicsItem::getMousePressAction(QGraphicsSceneMouseEvent* e) { EventGraphicsItem* old_selected_item = signal_browser_model_.getSelectedEventItem(); QPoint mouse_pos (e->scenePos().x(), e->scenePos().y()); SignalVisualisationMode mode = signal_browser_model_.getMode(); switch (SignalBrowserMouseHandling::getAction(e, mode)) { case SignalBrowserMouseHandling::SELECT_RESIZE_EVENT_ACTION: { // select event if (!old_selected_item) { return ACTION_SELECT; } QRectF old_rect = old_selected_item->sceneBoundingRect(); int32 tmp = std::min(static_cast(old_rect.width() / 2), move_mouse_range_); // move event end QRect move_end_rect(old_rect.right() - tmp, old_rect.top(), tmp + move_mouse_range_, old_rect.height()); if (signal_event_->getId() == old_selected_item->signal_event_->getId() && move_end_rect.contains(mouse_pos)) { return ACTION_MOVE_END; } // move event begin QRect move_begin_rect(old_rect.left() - move_mouse_range_, old_rect.top(), tmp + move_mouse_range_, old_rect.height()); if (signal_event_->getId() == old_selected_item->signal_event_->getId() && move_begin_rect.contains(mouse_pos)) { return ACTION_MOVE_BEGIN; } return ACTION_SELECT; } break; case SignalBrowserMouseHandling::SHIFT_EVENT_TO_CHANNEL_ACTION: if (this == old_selected_item && old_selected_item->boundingRect().contains(mouse_pos) && signal_event_->getChannel() != UNDEFINED_CHANNEL) { return ACTION_SHIFT_TO_CHANNEL; } break; case SignalBrowserMouseHandling::COPY_EVENT_TO_CHANNEL_ACTION: if (this == old_selected_item && old_selected_item->boundingRect().contains(mouse_pos) && signal_event_->getChannel() != UNDEFINED_CHANNEL) { return ACTION_COPY_SHIFT_TO_CHANNEL; } break; default: break; } return ACTION_NONE; } //----------------------------------------------------------------------------- void EventGraphicsItem::addContextMenuEntry () { context_menu_mutex_.lock(); if (!context_menu_) context_menu_ = new EventContextMenu (signal_browser_model_, event_manager_); else { if (context_menu_->getNumberOfEvents() == 0) { delete context_menu_; context_menu_ = new EventContextMenu (signal_browser_model_, event_manager_); } } context_menu_->addEvent(signal_event_->getId()); context_menu_mutex_.unlock(); } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/event_graphics_item.h000066400000000000000000000064521154433734200264040ustar00rootroot00000000000000#ifndef EVENT_GRAPHICS_ITEM_H #define EVENT_GRAPHICS_ITEM_H #include "base/sigviewer_user_types.h" #include "base/signal_event.h" #include "command_executer.h" #include "file_handling/event_manager.h" #include "gui/color_manager.h" #include "gui/signal_view_settings.h" #include #include #include #include #include #include class QMutex; namespace SigViewer_ { class SignalBrowserModel; class EventContextMenu; class EventGraphicsItem : public QGraphicsObject { Q_OBJECT Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity) #if QT_VERSION >= 0x040600 Q_INTERFACES(QGraphicsItem) #endif public: EventGraphicsItem(SignalBrowserModel& model, QSharedPointer signal_view_settings, QSharedPointer signal_event, QSharedPointer event_manager, QSharedPointer command_executer, QSharedPointer color_manager); virtual ~EventGraphicsItem (); int32 getId() const; void setSelected (bool selected); QSharedPointer getSignalEvent () const; static bool displayContextMenu (QGraphicsSceneContextMenuEvent* event, QMenu* channel_menu); static bool displaySelectionMenu (QGraphicsSceneMouseEvent* event); public slots: void updateToSignalEvent (); signals: void mouseAtSecond (float64 sec); void mouseMoving (bool mouse_is_moving); private: virtual QRectF boundingRect () const; virtual void mouseMoveEvent (QGraphicsSceneMouseEvent * mouse_event); virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent * event); enum Action { ACTION_NONE, ACTION_MOVE_BEGIN, ACTION_MOVE_END, ACTION_SHIFT_TO_CHANNEL, ACTION_COPY_SHIFT_TO_CHANNEL, ACTION_SELECT }; enum State { STATE_NONE, STATE_MOVE_BEGIN, STATE_MOVE_END, STATE_SHIFT_TO_CHANNEL }; //----------------------------------------------------------------------------- virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ); virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent * event); //----------------------------------------------------------------------------- Action getMousePressAction(QGraphicsSceneMouseEvent* e); //----------------------------------------------------------------------------- void addContextMenuEntry (); SignalBrowserModel& signal_browser_model_; QSharedPointer signal_view_settings_; QSharedPointer event_manager_; QSharedPointer command_executer_; QColor color_; State state_; int32 height_; int32 width_; bool is_selected_; QSharedPointer signal_event_; QSharedPointer color_manager_; static int move_mouse_range_; static QMutex event_handling_mutex_; static QMutex context_menu_mutex_; static EventContextMenu* context_menu_; }; } #endif // EVENT_GRAPHICS_ITEM_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/label_widget.cpp000066400000000000000000000100631154433734200253330ustar00rootroot00000000000000#include "label_widget.h" #include "gui/gui_action_factory.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- LabelWidget::LabelWidget (QSharedPointer signal_view_settings) : signal_view_settings_ (signal_view_settings), y_start_ (0) { // nothing to do here } //----------------------------------------------------------------------------- void LabelWidget::changeYStart (int32 y_start) { y_start_ = y_start; update (); } //----------------------------------------------------------------------------- void LabelWidget::paintEvent(QPaintEvent*) { bool channel_overlapping = signal_view_settings_->getChannelOverlapping(); float64 signal_height = signal_view_settings_->getChannelHeight(); if (channel_overlapping) signal_height = (signal_height + (signal_height * (channel_nr2label_.size() - 1) * (1.0 - signal_view_settings_->getChannelOverlapping()))) / channel_nr2label_.size(); //signal_height += signal_view_settings_->getChannelHeight() / (channel_nr2label_.size() + 1); int32 y_end = y_start_ + height(); if (signal_height < 1) return; QPainter p(this); p.translate(0, -y_start_); p.drawLine(0, y_start_, 0, y_end); // labels float64 float_y_start = y_start_;//floor(static_cast(y_start) / intervall) * intervall; float64 float_y_end = y_end;//ceil(y_end / intervall) * intervall; QMap::iterator iter = channel_nr2label_.begin(); for (float32 float_y = signal_height / 2; float_y < float_y_end && iter != channel_nr2label_.end(); float_y += signal_height, iter++) { if (float_y > float_y_start) { int32 y = (int32)(float_y + 0.5); p.drawText(5, (int32)(y - signal_height /2) , width() - 10, (int32)signal_height, Qt::AlignHCenter | Qt::AlignVCenter, iter.value()); } } if (channel_overlapping) return; for (float32 float_y = 0; float_y <= signal_height * channel_nr2label_.size(); float_y += signal_height) { p.drawLine(0, float_y, width() - 1, float_y); } } //----------------------------------------------------------------------------- void LabelWidget::contextMenuEvent (QContextMenuEvent* event) { QMenu menu; menu.addAction(GuiActionFactory::getInstance()->getQAction("Channels per Page...")); menu.addSeparator(); QAction* visibility_action = menu.addAction("Labels"); visibility_action->setCheckable (true); visibility_action->setChecked (true); connect (visibility_action, SIGNAL(triggered(bool)), SLOT(setVisible(bool))); menu.exec (event->globalPos()); } //----------------------------------------------------------------------------- void LabelWidget::addChannel(ChannelID channel_nr, const QString& label) { channel_nr2label_[channel_nr] = label; QPixmap dummy(1,1); QPainter p(&dummy); QRect bounding = p.boundingRect(0, 0, 500, 500, Qt::AlignHCenter | Qt::AlignVCenter, label); int32 max_width = minimumWidth() - 10; max_width = bounding.width() > max_width ? bounding.width() : max_width; setMinimumWidth(10 + max_width); } //----------------------------------------------------------------------------- void LabelWidget::removeChannel(ChannelID channel_nr) { channel_nr2label_.erase(channel_nr2label_.find(channel_nr)); int32 max_width = -1; QPixmap dummy(1,1); QPainter p(&dummy); for (QMap::iterator iter = channel_nr2label_.begin(); iter != channel_nr2label_.end(); iter++) { QRect bounding = p.boundingRect(0, 0, 200, p.font().pixelSize(), Qt::AlignHCenter | Qt::AlignVCenter, iter.value()); max_width = max_width < bounding.width() ? bounding.width() : max_width; } setMinimumWidth(10 + max_width); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/label_widget.h000066400000000000000000000015751154433734200250100ustar00rootroot00000000000000#ifndef LABEL_WIDGET_H #define LABEL_WIDGET_H #include "base/sigviewer_user_types.h" #include "gui/signal_view_settings.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- class LabelWidget : public QWidget { Q_OBJECT public: LabelWidget (QSharedPointer signal_view_settings); void addChannel(ChannelID channel_nr, const QString& label); void removeChannel(ChannelID channel_nr); public slots: void changeYStart (int32 y_start); protected: void paintEvent(QPaintEvent* pe); virtual void contextMenuEvent (QContextMenuEvent* event); private: QSharedPointer signal_view_settings_; QMap channel_nr2label_; int32 y_start_; }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_browser.pri000066400000000000000000000027611154433734200257470ustar00rootroot00000000000000HEADERS += gui_impl/signal_browser/signal_browser_view.h \ gui_impl/signal_browser/signal_browser_model_4.h \ gui_impl/signal_browser/signal_graphics_item.h \ gui_impl/signal_browser/label_widget.h \ gui_impl/signal_browser/y_axis_widget_4.h \ gui_impl/signal_browser/x_axis_widget_4.h \ gui_impl/signal_browser/event_graphics_item.h \ gui_impl/signal_browser/event_context_menu.h \ gui_impl/signal_browser/signal_grid_graphics_item.h \ gui_impl/signal_browser/signal_browser_graphics_view.h \ gui_impl/signal_browser/event_creation_widget.h \ gui_impl/signal_browser/event_editing_widget.h \ gui_impl/signal_browser/adapt_browser_view_widget.h SOURCES += gui_impl/signal_browser/signal_browser_view.cpp \ gui_impl/signal_browser/signal_browser_model_4.cpp \ gui_impl/signal_browser/signal_graphics_item.cpp \ gui_impl/signal_browser/label_widget.cpp \ gui_impl/signal_browser/y_axis_widget_4.cpp \ gui_impl/signal_browser/x_axis_widget_4.cpp \ gui_impl/signal_browser/event_graphics_item.cpp \ gui_impl/signal_browser/event_context_menu.cpp \ gui_impl/signal_browser/signal_grid_graphics_item.cpp \ gui_impl/signal_browser/event_creation_widget.cpp \ gui_impl/signal_browser/event_editing_widget.cpp \ gui_impl/signal_browser/adapt_browser_view_widget.cpp FORMS += gui_impl/signal_browser/event_creation_widget.ui \ gui_impl/signal_browser/event_editing_widget.ui \ gui_impl/signal_browser/adapt_browser_view_widget.ui sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_browser_graphics_view.h000066400000000000000000000013501154433734200303070ustar00rootroot00000000000000#ifndef SIGNAL_BROWSER_GRAPHICS_VIEW_H #define SIGNAL_BROWSER_GRAPHICS_VIEW_H #include #include #include namespace SigViewer_ { class SignalBrowserGraphicsView : public QGraphicsView { Q_OBJECT public: SignalBrowserGraphicsView (QGraphicsScene* scene, QWidget* parent = 0) : QGraphicsView (scene, parent) {} protected: virtual void resizeEvent (QResizeEvent* event) {emit resized (event);} //virtual void mouseMoveEvent (QMouseEvent* event) {this->moveEvent(event);}//event->ignore();}//emit sceneMouseMoved (mapToScene (event->pos()));} signals: void resized (QResizeEvent*); void sceneMouseMoved (QPointF scene_pos); }; } #endif // SIGNAL_BROWSER_GRAPHICS_VIEW_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_browser_model_4.cpp000066400000000000000000000444721154433734200273470ustar00rootroot00000000000000// signal_browser_model.cpp #include "signal_browser_model_4.h" #include "file_handling/event_manager.h" #include "file_handling/channel_manager.h" #include "signal_browser_view.h" #include "signal_graphics_item.h" #include "gui/color_manager.h" #include "gui/progress_bar.h" #include "base/signal_event.h" #include "base/math_utils.h" #include "gui_impl/gui_helper_functions.h" #include #include #include #include #include #include #include #include namespace SigViewer_ { namespace LayoutFunctions_ { unsigned getSceneHeight (unsigned num_channels, unsigned channel_height, float channel_overlapping) { if (num_channels == 0) return 0; return channel_height + (channel_height * (num_channels - 1) * (1.0 - channel_overlapping)); } } //----------------------------------------------------------------------------- SignalBrowserModel::SignalBrowserModel(QSharedPointer event_manager, ChannelManager const& channel_manager, QSharedPointer tab_context, QSharedPointer color_manager) : SignalVisualisationModel (std::set (), channel_manager), channel_manager_ (channel_manager), event_manager_ (event_manager), tab_context_ (tab_context), color_manager_ (color_manager), signal_browser_view_ (0), selected_event_item_ (0), x_grid_pixel_intervall_(0), show_y_grid_(true), initialized_ (false) { if (!event_manager_.isNull ()) { QList event_ids = event_manager_->getAllEvents(); if (id2event_item_.size() == 0) { for (QList::const_iterator event_id_iter = event_ids.begin (); event_id_iter != event_ids.end (); ++event_id_iter) { id2event_item_[*event_id_iter] = new EventGraphicsItem ( *this, getSignalViewSettings(), event_manager_->getEvent (*event_id_iter), event_manager_, tab_context_, color_manager_); } } } connect (getSignalViewSettings().data(), SIGNAL(pixelsPerSampleChanged()), SLOT(update())); connect (getSignalViewSettings().data(), SIGNAL(channelHeightChanged()), SLOT(update())); connect (getSignalViewSettings().data(), SIGNAL(channelOverlappingChanged()), SLOT(update())); } //----------------------------------------------------------------------------- SignalVisualisationView const* SignalBrowserModel::view () const { return signal_browser_view_; } //----------------------------------------------------------------------------- // set signal browser view void SignalBrowserModel::setSignalBrowserView (SignalBrowserView* signal_browser_view) { signal_browser_view_ = signal_browser_view; if (!event_manager_.isNull()) setShownEventTypes (event_manager_->getEventTypes()); } //----------------------------------------------------------------------------- // load settings void SignalBrowserModel::loadSettings() { QSettings settings("SigViewer"); settings.beginGroup("SignalBrowserModel"); show_x_grid_ = settings.value("show_x_grid", show_x_grid_).toBool(); show_y_grid_ = settings.value("show_y_grid", show_y_grid_).toBool(); settings.endGroup(); } //----------------------------------------------------------------------------- // save settings void SignalBrowserModel::saveSettings() { QSettings settings("SigViewer"); settings.beginGroup("SignalBrowserModel"); settings.setValue("show_x_grid", show_x_grid_); settings.setValue("show_y_grid", show_y_grid_); settings.endGroup(); } //----------------------------------------------------------------------------- void SignalBrowserModel::setShownChannels (std::set const& new_shown_channels) { unsigned new_channel_height = getSignalViewSettings()->getChannelHeight(); if (!initialized_) new_channel_height = signal_browser_view_->getViewportHeight() / new_shown_channels.size(); else new_channel_height *= static_cast(getShownChannels().size()) / new_shown_channels.size(); foreach (ChannelID channel, channel2signal_item_.keys()) if (new_shown_channels.count (channel) == 0) removeChannel (channel); getSignalViewSettings()->setChannelHeight (std::max(20, new_channel_height)); foreach (ChannelID channel, new_shown_channels) { ProgressBar::instance().increaseValue (1, tr("Creating view...")); if (channel2signal_item_.count (channel) == 0) addChannel (channel); } foreach (SignalGraphicsItem* channel, channel2signal_item_.values()) channel->autoScale (getAutoScaleMode()); if (!initialized_) goToSample (0); initialized_ = true; } //----------------------------------------------------------------------------- void SignalBrowserModel::addChannel (ChannelID channel_id) { SignalGraphicsItem* signal_item = new SignalGraphicsItem (getSignalViewSettings(), event_manager_, tab_context_, channel_manager_, color_manager_, channel_id, *this); signal_item->connect (getSignalViewSettings().data(), SIGNAL(channelHeightChanged(uint)), SLOT(setHeight(uint))); channel2signal_item_[channel_id] = signal_item; signal_browser_view_->addSignalGraphicsItem (channel_id, signal_item, channel_manager_.getChannelLabel(channel_id)); } //----------------------------------------------------------------------------- void SignalBrowserModel::removeChannel (ChannelID channel_id) { SignalGraphicsItemMap::iterator sig_iter; sig_iter = channel2signal_item_.find (channel_id); if (sig_iter == channel2signal_item_.end()) return; disconnect (sig_iter.value()); signal_browser_view_->removeSignalGraphicsItem (channel_id, sig_iter.value()); delete sig_iter.value(); channel2signal_item_.erase (sig_iter); } //----------------------------------------------------------------------------- std::set SignalBrowserModel::getShownChannels () const { std::set shown_channels; for (SignalGraphicsItemMap::const_iterator sig_iter = channel2signal_item_.begin(); sig_iter != channel2signal_item_.end(); ++sig_iter) { shown_channels.insert(sig_iter.key()); } return shown_channels; } //----------------------------------------------------------------------------- int32 SignalBrowserModel::getYPosOfChannel (uint32 channel_nr) const { Int2IntMap::const_iterator y_iter = channel2y_pos_.find(channel_nr); if (y_iter != channel2y_pos_.end()) return y_iter->second; else return 0; } //----------------------------------------------------------------------------- // zoom in all void SignalBrowserModel::zoomInAll() { SignalGraphicsItemMap::iterator iter; for (iter = channel2signal_item_.begin(); iter != channel2signal_item_.end(); iter++) { iter.value()->zoomIn(); } signal_browser_view_->updateWidgets(); } //----------------------------------------------------------------------------- // zoom out all void SignalBrowserModel::zoomOutAll() { SignalGraphicsItemMap::iterator iter; for (iter = channel2signal_item_.begin(); iter != channel2signal_item_.end(); iter++) { iter.value()->zoomOut(); } signal_browser_view_->updateWidgets(); } //----------------------------------------------------------------------------- void SignalBrowserModel::update() { int32 width = channel_manager_.getNumberSamples() * getSignalViewSettings()->getPixelsPerSample(); int32 height = LayoutFunctions_::getSceneHeight (channel2signal_item_.size(), getSignalViewSettings()->getChannelHeight(), getSignalViewSettings()->getChannelOverlapping()); signal_browser_view_->resizeScene (width, height); double pixel_per_sec = getSignalViewSettings()->getPixelsPerSample() * channel_manager_.getSampleRate(); x_grid_pixel_intervall_ = pixel_per_sec * MathUtils_::round125 (100.0 / pixel_per_sec); channel2y_pos_.clear(); channel2y_pos_[UNDEFINED_CHANNEL] = 0; int32 y_pos = 0; SignalGraphicsItemMap::iterator signal_iter; for (signal_iter = channel2signal_item_.begin(); signal_iter != channel2signal_item_.end(); signal_iter++, y_pos += getSignalViewSettings()->getChannelHeight() * (1.0 - getSignalViewSettings()->getChannelOverlapping())) { channel2y_pos_[signal_iter.key()] = y_pos; signal_iter.value()->setHeight (getSignalViewSettings()->getChannelHeight()); signal_iter.value()->setPos (0, y_pos); signal_iter.value()->setZValue(SIGNAL_Z); signal_iter.value()->updateYGridIntervall(); signal_iter.value()->enableYGrid(show_y_grid_); signal_iter.value()->enableXGrid(show_x_grid_); signal_iter.value()->setXGridInterval (x_grid_pixel_intervall_); signal_iter.value()->show(); } updateEventItemsImpl (); signal_browser_view_->update(); signal_browser_view_->updateWidgets(); } //------------------------------------------------------------------------- void SignalBrowserModel::scaleChannel (ChannelID id, float32 lower_value, float32 upper_value) { if (id == UNDEFINED_CHANNEL) { QProgressDialog progress; progress.setMaximum (channel2signal_item_.size()); progress.setMinimum (0); progress.setModal (true); progress.setLabelText (tr("Scaling...")); progress.show (); for (SignalGraphicsItemMap::iterator it = channel2signal_item_.begin(); it != channel2signal_item_.end(); ++it) { it.value()->scale (lower_value, upper_value); progress.setValue (progress.value() + 1); } progress.setValue (progress.maximum ()); } else channel2signal_item_[id]->scale (lower_value, upper_value); } //------------------------------------------------------------------------- void SignalBrowserModel::scaleChannel (ChannelID id) { if (id == UNDEFINED_CHANNEL) { QProgressDialog progress; progress.setMaximum (channel2signal_item_.size()); progress.setMinimum (0); progress.setModal (true); progress.setLabelText (tr("Scaling...")); progress.show (); for (SignalGraphicsItemMap::iterator it = channel2signal_item_.begin(); it != channel2signal_item_.end(); ++it) { it.value()->autoScale (getAutoScaleMode()); progress.setValue (progress.value() + 1); } progress.setValue (progress.maximum ()); } else channel2signal_item_[id]->autoScale (getAutoScaleMode()); signal_browser_view_->updateWidgets(); } //------------------------------------------------------------------------- ChannelManager const& SignalBrowserModel::getChannelManager () const { return channel_manager_; } //------------------------------------------------------------------------- QSharedPointer SignalBrowserModel::getEventManager () const { return event_manager_; } //------------------------------------------------------------------------- QSharedPointer SignalBrowserModel::getEventManager () { return event_manager_; } //------------------------------------------------------------------------- unsigned SignalBrowserModel::getShownPosition () const { return signal_browser_view_->getVisibleX () / getSignalViewSettings()->getPixelsPerSample(); } //------------------------------------------------------------------------- void SignalBrowserModel::goToSample (unsigned sample) { float32 position = 0; while (position < getSignalViewSettings()->getPixelsPerSample() * sample) position += getSignalViewSettings()->getPixelsPerSample(); position -= getSignalViewSettings()->getPixelsPerSample(); signal_browser_view_->goTo (position); } //------------------------------------------------------------------------- QList SignalBrowserModel::getSelectedEvents () const { if (selected_event_item_) return QList () << selected_event_item_->getId (); else return QList (); } //------------------------------------------------------------------- void SignalBrowserModel::updateEventItems () { updateEventItemsImpl (); signal_browser_view_->update (); } //------------------------------------------------------------------- void SignalBrowserModel::selectEvent (EventID id) { Int2EventGraphicsItemPtrMap::iterator event_iter = id2event_item_.find (id); if (event_iter == id2event_item_.end()) { selected_event_item_ = 0; emit eventSelected (QSharedPointer(0)); tab_context_->setSelectionState(TAB_STATE_NO_EVENT_SELECTED); return; } EventGraphicsItem* item = event_iter->second; if (selected_event_item_) selected_event_item_->setSelected (false); selected_event_item_ = item; selected_event_item_->setSelected (true); emit eventSelected(item->getSignalEvent()); if (event_manager_->getEvent(id)->getChannel() == UNDEFINED_CHANNEL) tab_context_->setSelectionState(TAB_STATE_EVENT_SELECTED_ALL_CHANNELS); else tab_context_->setSelectionState (TAB_STATE_EVENT_SELECTED_ONE_CHANNEL); } //------------------------------------------------------------------- void SignalBrowserModel::unselectEvent () { tab_context_->setSelectionState (TAB_STATE_NO_EVENT_SELECTED); if (selected_event_item_) selected_event_item_->setSelected (false); selected_event_item_ = 0; emit eventSelected (QSharedPointer(0)); } //------------------------------------------------------------------- void SignalBrowserModel::shownEventTypesChangedImpl () { updateEventItemsImpl (); } //------------------------------------------------------------------- void SignalBrowserModel::modeChangedImpl (SignalVisualisationMode mode) { bool tooltips = (mode == MODE_INFO || mode == MODE_POINTER); foreach (SignalGraphicsItem* signal_item, channel2signal_item_.values()) signal_item->setAcceptHoverEvents (tooltips); } //----------------------------------------------------------------------------- void SignalBrowserModel::updateEventItemsImpl () { Int2EventGraphicsItemPtrMap::iterator event_iter; for (event_iter = id2event_item_.begin(); event_iter != id2event_item_.end(); event_iter++) { QSharedPointer event = event_manager_->getEvent(event_iter->first); if (!event) { continue; } Int2IntMap::iterator y_pos_iter; y_pos_iter = channel2y_pos_.find(event->getChannel()); std::set shown_event_types = getShownEventTypes (); if (!shown_event_types.count(event->getType()) || y_pos_iter == channel2y_pos_.end()) { event_iter->second->hide(); if (event_iter->second == selected_event_item_) { selected_event_item_->setSelected(false); selected_event_item_ = 0; tab_context_->setSelectionState (TAB_STATE_NO_EVENT_SELECTED); } } else { event_iter->second->updateToSignalEvent (); if (!(event_iter->second->scene())) signal_browser_view_->addEventGraphicsItem(event_iter->second); event_iter->second->show(); } } } //----------------------------------------------------------------------------- void SignalBrowserModel::addEventItem (QSharedPointer event) { EventGraphicsItem* event_item = new EventGraphicsItem( *this, getSignalViewSettings(), event, event_manager_, tab_context_, color_manager_); id2event_item_[event->getId()] = event_item; signal_browser_view_->addEventGraphicsItem(event_item); event_item->updateToSignalEvent(); event_item->show(); } //----------------------------------------------------------------------------- void SignalBrowserModel::removeEventItem (EventID id) { if (id2event_item_.find (id) == id2event_item_.end()) return; EventGraphicsItem* event_item = id2event_item_[id]; if (selected_event_item_ == event_item) unselectEvent (); id2event_item_.erase (id); items_to_delete_.push_back (event_item); GuiHelper::animateProperty (event_item, "opacity", 1.0, 0.0, this, SLOT(removeEventItemImpl())); } //----------------------------------------------------------------------------- void SignalBrowserModel::removeEventItemImpl () { EventGraphicsItem* event_item = items_to_delete_.front(); items_to_delete_.pop_front(); signal_browser_view_->removeEventGraphicsItem (event_item); delete event_item; } //----------------------------------------------------------------------------- // set event changed void SignalBrowserModel::updateEvent (EventID id) { if (id2event_item_.find (id) == id2event_item_.end()) return; EventGraphicsItem* event_item = id2event_item_[id]; event_item->updateToSignalEvent (); if (selected_event_item_) if (selected_event_item_->getId() == id) { if (selected_event_item_->getSignalEvent()->getChannel() == UNDEFINED_CHANNEL) tab_context_->setSelectionState (TAB_STATE_EVENT_SELECTED_ALL_CHANNELS); else tab_context_->setSelectionState (TAB_STATE_EVENT_SELECTED_ONE_CHANNEL); emit eventSelected (event_item->getSignalEvent()); } } //----------------------------------------------------------------------------- // get selected event item EventGraphicsItem* SignalBrowserModel::getSelectedEventItem() { return selected_event_item_; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_browser_model_4.h000066400000000000000000000122341154433734200270030ustar00rootroot00000000000000// signal_browser_model.h #ifndef SIGNAL_BROWSER_MODEL_H_q4 #define SIGNAL_BROWSER_MODEL_H_q4 #include "tab_context.h" #include "file_handling/channel_manager.h" #include "file_handling/event_manager.h" #include "gui/signal_visualisation_modes.h" #include "gui/signal_visualisation_model.h" #include "gui/color_manager.h" #include "event_graphics_item.h" #include #include #include #include #include #include #include namespace SigViewer_ { class SignalBrowserView; class SignalGraphicsItem; //----------------------------------------------------------------------------- /// SignalBrowserModel class SignalBrowserModel : public SignalVisualisationModel { Q_OBJECT public: //------------------------------------------------------------------------- SignalBrowserModel(QSharedPointer event_manager, ChannelManager const& channel_manager, QSharedPointer tab_context, QSharedPointer color_manager); //------------------------------------------------------------------------- virtual ~SignalBrowserModel() {} //------------------------------------------------------------------------- virtual void scaleChannel (ChannelID id, float32 lower_value, float32 upper_value); //------------------------------------------------------------------------- virtual void scaleChannel (ChannelID id); //------------------------------------------------------------------------- virtual ChannelManager const& getChannelManager () const; //------------------------------------------------------------------------- virtual QSharedPointer getEventManager () const; //------------------------------------------------------------------------- virtual QSharedPointer getEventManager (); //------------------------------------------------------------------------- /// see base class virtual unsigned getShownPosition () const; //------------------------------------------------------------------------- /// see base class virtual void goToSample (unsigned sample); //------------------------------------------------------------------------- /// see base class virtual QList getSelectedEvents () const; //------------------------------------------------------------------------- virtual SignalVisualisationView const* view () const; void setSignalBrowserView(SignalBrowserView* signal_browser_view); void loadSettings(); void saveSettings(); virtual void setShownChannels (std::set const& shown_channels); virtual std::set getShownChannels () const; int32 getYPosOfChannel (uint32 channel_nr) const; void zoomInAll(); void zoomOutAll(); EventGraphicsItem* getSelectedEventItem(); void updateEventItems (); public slots: //------------------------------------------------------------------------- virtual void update (); //------------------------------------------------------------------------- /// adds the given event virtual void addEventItem (QSharedPointer event); //------------------------------------------------------------------------- /// removes the given event virtual void removeEventItem (EventID id); void updateEvent (EventID id); virtual void selectEvent (EventID id); void unselectEvent (); signals: void eventSelected (QSharedPointer selected_event); protected: virtual void shownEventTypesChangedImpl (); virtual void modeChangedImpl (SignalVisualisationMode mode); private slots: //------------------------------------------------------------------------- /// implementation of removeEventItem which really deletes the item void removeEventItemImpl (); private: //------------------------------------------------------------------------- void addChannel (ChannelID channel_nr); //------------------------------------------------------------------------- void removeChannel (ChannelID channel_nr); //------------------------------------------------------------------------- void updateEventItemsImpl (); //------------------------------------------------------------------------- static uint8 const SIGNAL_Z = 4; ChannelManager const& channel_manager_; QSharedPointer event_manager_; QSharedPointer tab_context_; QSharedPointer color_manager_; SignalBrowserView* signal_browser_view_; typedef QMap SignalGraphicsItemMap; typedef std::map Int2EventGraphicsItemPtrMap; typedef std::map Int2IntMap; SignalGraphicsItemMap channel2signal_item_; Int2EventGraphicsItemPtrMap id2event_item_; Int2IntMap channel2y_pos_; EventGraphicsItem* selected_event_item_; float64 x_grid_pixel_intervall_; bool show_y_grid_; bool show_x_grid_; bool initialized_; QList items_to_delete_; }; } // namespace PortingToQT4_ #endif sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_browser_view.cpp000066400000000000000000000363551154433734200267770ustar00rootroot00000000000000#include "signal_browser_view.h" #include "signal_graphics_item.h" #include "event_graphics_item.h" #include "y_axis_widget_4.h" #include "x_axis_widget_4.h" #include "label_widget.h" #include "event_creation_widget.h" #include "event_editing_widget.h" #include "adapt_browser_view_widget.h" #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_MACX #include #endif namespace SigViewer_ { //----------------------------------------------------------------------------- // constructor SignalBrowserView::SignalBrowserView (QSharedPointer signal_browser_model, QSharedPointer event_manager, QSharedPointer command_executer, QRect const& initial_size, QWidget* parent) : QFrame (parent), model_ (signal_browser_model), empty_widget_ (new QWidget) { resize (initial_size.width(), initial_size.height()); graphics_scene_ = new QGraphicsScene (0,0,initial_size.width(), initial_size.height(), this); graphics_view_ = new SignalBrowserGraphicsView (graphics_scene_); #ifdef Q_OS_MACX graphics_view_->setViewport(new QGLWidget); #endif graphics_view_->setAcceptDrops (false); graphics_view_->scroll(0,0); graphics_view_->horizontalScrollBar()->hide(); graphics_view_->verticalScrollBar()->hide(); graphics_view_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); graphics_view_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); graphics_view_->setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); graphics_view_->setDragMode(QGraphicsView::ScrollHandDrag); initWidgets (event_manager, command_executer); graphics_view_->setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); createLayout(); connect (graphics_view_, SIGNAL(resized(QResizeEvent*)), SLOT(graphicsViewResized(QResizeEvent*))); horizontal_scrollbar_->setValue(0); } //----------------------------------------------------------------------------- void SignalBrowserView::resizeScene (int32 width, int32 height) { QPointF left_upper_corner = graphics_view_->mapToScene (0, 0); left_upper_corner.setY (left_upper_corner.y() * height / graphics_scene_->height()); left_upper_corner.setX (left_upper_corner.x() * width / graphics_scene_->width()); graphics_scene_->setSceneRect (0, 0, width, height); QPointF center = left_upper_corner; center.setX (center.x () + static_cast(graphics_view_->width()) / 2.0); center.setY (center.y () + static_cast(graphics_view_->height()) / 2.0); graphics_view_->centerOn (center); // y_axis_widget_->changeYStart (left_upper_corner.y()); emit visibleXChanged (graphics_view_->mapToScene (0, 0).x()); emit visibleYChanged (graphics_view_->mapToScene(0, 0).y()); } //----------------------------------------------------------------------------- void SignalBrowserView::addSignalGraphicsItem (ChannelID channel_nr, SignalGraphicsItem* graphics_item, QString const& label) { graphics_scene_->addItem (graphics_item); y_axis_widget_->addChannel (channel_nr, graphics_item); label_widget_->addChannel (channel_nr, label); connect (graphics_item, SIGNAL(updatedYGrid(ChannelID)), y_axis_widget_, SLOT(updateChannel(ChannelID))); connect (graphics_item, SIGNAL(shifting(ChannelID)), y_axis_widget_, SLOT(updateChannel(ChannelID))); connect (graphics_item, SIGNAL(mouseAtSecond(float64)), x_axis_widget_, SLOT(changeHighlightTime(float64))); connect (graphics_item, SIGNAL(mouseMoving(bool)), x_axis_widget_, SLOT(enableHighlightTime(bool))); } //----------------------------------------------------------------------------- void SignalBrowserView::removeSignalGraphicsItem (ChannelID channel_nr, SignalGraphicsItem* graphics_item) { disconnect (graphics_item, 0, x_axis_widget_, 0); disconnect (graphics_item, 0, y_axis_widget_, 0); y_axis_widget_->removeChannel(channel_nr); label_widget_->removeChannel(channel_nr); graphics_scene_->removeItem (graphics_item); graphics_view_->update (); } //----------------------------------------------------------------------------- void SignalBrowserView::addEventGraphicsItem (EventGraphicsItem* event_graphics_item) { graphics_scene_->addItem(event_graphics_item); graphics_view_->update(); connect (event_graphics_item, SIGNAL(mouseAtSecond(float64)), x_axis_widget_, SLOT(changeHighlightTime(float64))); connect (event_graphics_item, SIGNAL(mouseMoving(bool)), x_axis_widget_, SLOT(enableHighlightTime(bool))); } //----------------------------------------------------------------------------- void SignalBrowserView::removeEventGraphicsItem (EventGraphicsItem* event_graphics_item) { qDebug () << "SignalBrowserView::removeEventGraphicsItem " << event_graphics_item->getId(); graphics_view_->update(); qDebug () << "SignalBrowserView::removeEventGraphicsItem " << event_graphics_item->getId() << " finished"; } //----------------------------------------------------------------------------- int32 SignalBrowserView::getVisibleX () const { return graphics_view_->mapToScene(0,0).x(); } //----------------------------------------------------------------------------- void SignalBrowserView::goTo (float32 x) { double y = graphics_view_->mapToScene(0, 0).y(); x += graphics_view_->width() / 2; y += static_cast(graphics_view_->height()) / 2.0; graphics_view_->centerOn(x, y); graphics_scene_->update(0, 0, graphics_scene_->width(), graphics_scene_->height()); } //----------------------------------------------------------------------------- void SignalBrowserView::updateWidgets (bool update_view) { if (update_view) graphics_view_->viewport()->update(); x_axis_widget_->update(); label_widget_->update(); emit visibleYChanged (graphics_view_->mapToScene(0,0).y()); } //----------------------------------------------------------------------------- QSharedPointer SignalBrowserView::renderVisibleScene () const { QSharedPointer image (new QImage(graphics_view_->viewport()->width(), graphics_view_->viewport()->height(), QImage::Format_ARGB32)); image->fill (0); QPainter painter (image.data()); graphics_view_->render (&painter, graphics_view_->viewport()->rect(), graphics_view_->viewport()->rect()); return image; } //----------------------------------------------------------------------------- bool SignalBrowserView::getXAxisVisibility () const { return x_axis_widget_->isVisible (); } //----------------------------------------------------------------------------- bool SignalBrowserView::getYAxisVisibility () const { return y_axis_widget_->isVisible (); } //----------------------------------------------------------------------------- bool SignalBrowserView::getLabelsVisibility () const { return label_widget_->isVisible (); } //----------------------------------------------------------------------------- int SignalBrowserView::getViewportHeight () const { return graphics_view_->viewport()->height(); } //----------------------------------------------------------------------------- int SignalBrowserView::getViewportWidth () const { return graphics_view_->viewport()->width(); } //----------------------------------------------------------------------------- void SignalBrowserView::setMode (SignalVisualisationMode mode) { if (current_info_widget_) { layout_->removeWidget (current_info_widget_); current_info_widget_->hide(); } switch (mode) { case MODE_NEW: current_info_widget_ = event_creation_widget_; graphics_view_->setDragMode(QGraphicsView::NoDrag); break; case MODE_POINTER: current_info_widget_ = event_editing_widget_; graphics_view_->setDragMode(QGraphicsView::NoDrag); break; case MODE_HAND: graphics_view_->setDragMode(QGraphicsView::ScrollHandDrag); current_info_widget_ = empty_widget_; break; case MODE_VIEW_OPTIONS: current_info_widget_ = adapt_browser_view_widget_; graphics_view_->setDragMode(QGraphicsView::NoDrag); break; case MODE_INFO: current_info_widget_ = model_->infoWidget (); graphics_view_->setDragMode(QGraphicsView::NoDrag); break; default: current_info_widget_ = empty_widget_; break; } if (current_info_widget_) { layout_->addWidget (current_info_widget_, 1, 2); current_info_widget_->show(); } } //----------------------------------------------------------------------------- void SignalBrowserView::graphicsViewResized (QResizeEvent* event) { unsigned channel_height = model_->getSignalViewSettings()->getChannelHeight(); if (!channel_height) return; if (event->size().height() < 1 || event->oldSize().height() < 1) return; channel_height *= static_cast(event->size().height()) / event->oldSize().height(); if (channel_height < 10) return; model_->getSignalViewSettings()->setChannelHeight (channel_height); } //----------------------------------------------------------------------------- void SignalBrowserView::verticalSrollbarMoved(int) { label_widget_->update(); qreal y = graphics_view_->mapToScene(0,0).y(); if (y < 0) y = 0; emit visibleYChanged (y); } //----------------------------------------------------------------------------- void SignalBrowserView::horizontalSrollbarMoved(int) { emit visibleXChanged (graphics_view_->mapToScene(0,0).x()); } //----------------------------------------------------------------------------- void SignalBrowserView::horizontalScrollBarRangeChaned (int min, int max) { horizontal_scrollbar_->setRange(min, max); horizontal_scrollbar_->setPageStep(graphics_view_->horizontalScrollBar()->pageStep()); emit visibleXChanged (graphics_view_->mapToScene(0,0).x()); } //----------------------------------------------------------------------------- void SignalBrowserView::verticalScrollBarRangeChaned (int min, int max) { label_widget_->update (); vertical_scrollbar_->setRange(min, max); vertical_scrollbar_->setPageStep(graphics_view_->verticalScrollBar()->pageStep()); qreal y = graphics_view_->mapToScene(0,0).y(); if (y < 0) y = 0; emit visibleYChanged (y); } //----------------------------------------------------------------------------- void SignalBrowserView::dropEvent (QDropEvent* event) { event->ignore(); } //----------------------------------------------------------------------------- void SignalBrowserView::dragEnterEvent(QDragEnterEvent *event) { event->ignore(); } //----------------------------------------------------------------------------- void SignalBrowserView::initWidgets (QSharedPointer event_manager, QSharedPointer command_executer) { y_axis_widget_ = new YAxisWidget (this); y_axis_widget_->resize(70, height()); y_axis_widget_->setMinimumSize(70, 0); x_axis_widget_ = new XAxisWidget (model_->getSignalViewSettings(), this); x_axis_widget_->resize(width()-300, 30); x_axis_widget_->setMinimumSize(0, 30); horizontal_scrollbar_ = new QScrollBar (Qt::Horizontal, this); vertical_scrollbar_ = new QScrollBar (Qt::Vertical, this); label_widget_ = new LabelWidget (model_->getSignalViewSettings()); current_info_widget_ = empty_widget_; if (event_manager.isNull()) { event_creation_widget_ = 0; event_editing_widget_ = 0; } else { event_creation_widget_ = new EventCreationWidget (model_, event_manager); event_editing_widget_ = new EventEditingWidget (event_manager, command_executer); event_creation_widget_->connect (model_.data(), SIGNAL(shownEventTypesChanged(std::set const&)), SLOT(updateShownEventTypes (std::set const&))); event_editing_widget_->connect (model_.data(), SIGNAL(shownEventTypesChanged(std::set const&)), SLOT(updateShownEventTypes (std::set const&))); event_editing_widget_->connect (model_.data(), SIGNAL(eventSelected(QSharedPointer)), SLOT(updateSelectedEventInfo(QSharedPointer))); } adapt_browser_view_widget_ = new AdaptBrowserViewWidget (this, model_->getSignalViewSettings()); x_axis_widget_->connect (adapt_browser_view_widget_, SIGNAL(xAxisVisibilityChanged(bool)), SLOT(setVisible(bool))); y_axis_widget_->connect (adapt_browser_view_widget_, SIGNAL(yAxisVisibilityChanged(bool)), SLOT(setVisible(bool))); label_widget_->connect (adapt_browser_view_widget_, SIGNAL(labelsVisibilityChanged(bool)), SLOT(setVisible(bool))); connect(horizontal_scrollbar_, SIGNAL(valueChanged(int)), graphics_view_->horizontalScrollBar(), SLOT(setValue(int))); connect(graphics_view_->horizontalScrollBar(), SIGNAL(valueChanged(int)), horizontal_scrollbar_, SLOT(setValue(int))); connect(graphics_view_->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(horizontalScrollBarRangeChaned(int,int))); connect(horizontal_scrollbar_, SIGNAL(valueChanged(int)), this, SLOT(horizontalSrollbarMoved(int))); connect(vertical_scrollbar_, SIGNAL(valueChanged(int)), graphics_view_->verticalScrollBar(), SLOT(setValue(int))); connect(graphics_view_->verticalScrollBar(), SIGNAL(valueChanged(int)), vertical_scrollbar_, SLOT(setValue(int))); connect(graphics_view_->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(verticalScrollBarRangeChaned(int,int))); connect(vertical_scrollbar_, SIGNAL(valueChanged(int)), this, SLOT(verticalSrollbarMoved(int))); connect(this, SIGNAL(visibleXChanged(int32)), x_axis_widget_, SLOT(changeXStart(int32))); connect(model_->getSignalViewSettings().data(), SIGNAL(pixelsPerSampleChanged()), x_axis_widget_, SLOT(update())); label_widget_->connect (this, SIGNAL(visibleYChanged(int32)), SLOT(changeYStart (int32))); connect(this, SIGNAL(visibleYChanged(int32)), y_axis_widget_, SLOT(changeYStart(int32))); connect(model_->getSignalViewSettings().data(), SIGNAL(channelHeightChanged(uint)), y_axis_widget_, SLOT(changeSignalHeight(uint))); connect(model_.data(), SIGNAL(modeChanged(SignalVisualisationMode)), SLOT(setMode(SignalVisualisationMode))); } //----------------------------------------------------------------------------- void SignalBrowserView::createLayout() { layout_ = new QGridLayout(this); layout_->setMargin(0); layout_->setSpacing(0); layout_->setVerticalSpacing(0); layout_->setHorizontalSpacing(0); layout_->addWidget(current_info_widget_, 1, 1, 1, 3); layout_->addWidget(y_axis_widget_, 2, 1); layout_->addWidget(graphics_view_, 2, 2); layout_->addWidget(x_axis_widget_, 3, 2); layout_->addWidget(horizontal_scrollbar_, 4, 2); layout_->addWidget(label_widget_, 2, 3); layout_->addWidget(vertical_scrollbar_, 2, 4); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_browser_view.h000066400000000000000000000063341154433734200264360ustar00rootroot00000000000000// signal_browser_view.h #ifndef SIGNAL_BROWSER_VIEW_H #define SIGNAL_BROWSER_VIEW_H #include "base/sigviewer_user_types.h" #include "command_executer.h" #include "gui/signal_visualisation_model.h" #include "gui/signal_visualisation_view.h" #include "file_handling/event_manager.h" #include "signal_browser_graphics_view.h" #include #include #include #include #include #include class QGridLayout; class QScrollBar; class QCursor; namespace SigViewer_ { class LabelWidget; class YAxisWidget; class XAxisWidget; class SignalGraphicsItem; class EventGraphicsItem; class EventEditingWidget; class EventCreationWidget; class AdaptBrowserViewWidget; // signal browser view class SignalBrowserView : public QFrame, public SignalVisualisationView { Q_OBJECT public: SignalBrowserView (QSharedPointer signal_browser_model, QSharedPointer event_manager, QSharedPointer command_executer, QRect const& initial_size, QWidget* parent = 0); virtual ~SignalBrowserView () {} void addSignalGraphicsItem (ChannelID channel_nr, SignalGraphicsItem* graphics_item, QString const& label); void removeSignalGraphicsItem (ChannelID channel_nr, SignalGraphicsItem* graphics_item); void addEventGraphicsItem (EventGraphicsItem* event_graphics_item); void removeEventGraphicsItem (EventGraphicsItem* event_graphics_item); void resizeScene (int32 width, int32 height); int32 getVisibleX () const; void goTo (float32 x); void updateWidgets (bool update_view = true); virtual QSharedPointer renderVisibleScene () const; virtual bool getXAxisVisibility () const; virtual bool getYAxisVisibility () const; virtual bool getLabelsVisibility () const; virtual int getViewportHeight () const; virtual int getViewportWidth () const; public slots: void setMode (SignalVisualisationMode mode); signals: void visibleXChanged (int32 new_x); void visibleYChanged (int32 new_y); private slots: void verticalSrollbarMoved(int); void horizontalSrollbarMoved(int); void horizontalScrollBarRangeChaned (int min, int max); void verticalScrollBarRangeChaned (int min, int max); virtual void dropEvent (QDropEvent* event); virtual void dragEnterEvent(QDragEnterEvent *event); void graphicsViewResized (QResizeEvent* event); private: void initWidgets (QSharedPointer event_manager, QSharedPointer command_executer); void createLayout (); QSharedPointer model_; QGraphicsScene* graphics_scene_; SignalBrowserGraphicsView* graphics_view_; YAxisWidget* y_axis_widget_; XAxisWidget* x_axis_widget_; QScrollBar* horizontal_scrollbar_; QScrollBar* vertical_scrollbar_; LabelWidget* label_widget_; EventEditingWidget* event_editing_widget_; EventCreationWidget* event_creation_widget_; AdaptBrowserViewWidget* adapt_browser_view_widget_; QWidget* current_info_widget_; QWidget* empty_widget_; QGridLayout* layout_; }; } // namespace SigViewer_ #endif // SIGNAL_BROWSER_VIEW_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_graphics_item.cpp000066400000000000000000000420121154433734200270630ustar00rootroot00000000000000#include "signal_graphics_item.h" #include "event_graphics_item.h" #include "signal_browser_model_4.h" #include "editing_commands/new_event_undo_command.h" #include "y_axis_widget_4.h" #include "file_handling/channel_manager.h" #include "command_executer.h" #include "base/signal_event.h" #include "base/signal_channel.h" #include "base/math_utils.h" #include "gui_impl/signal_browser_mouse_handling.h" #include "gui/color_manager.h" #include "gui/gui_action_factory.h" #include #include #include #include #include #include #include #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- SignalGraphicsItem::SignalGraphicsItem (QSharedPointer signal_view_settings, QSharedPointer event_manager, QSharedPointer command_executor, ChannelManager const& channel_manager, QSharedPointer color_manager, ChannelID id, SignalBrowserModel& model) : signal_view_settings_ (signal_view_settings), event_manager_ (event_manager), command_executor_ (command_executor), channel_manager_ (channel_manager), color_manager_ (color_manager), id_ (id), signal_browser_model_(model), minimum_ (channel_manager_.getMinValue (id_)), maximum_ (channel_manager_.getMaxValue (id_)), y_zoom_ (1), draw_y_grid_ (true), draw_x_grid_ (true), y_offset_ (0), height_ (signal_view_settings->getChannelHeight()), width_ (0), shifting_ (false), new_event_ (false), created_event_item_ (0), hand_tool_on_ (false) { #if QT_VERSION >= 0x040600 setFlag (QGraphicsItem::ItemUsesExtendedStyleOption, true); #endif setAcceptHoverEvents(false); connect (signal_view_settings.data(), SIGNAL(gridFragmentationChanged()), SLOT(updateYGridIntervall())); } //----------------------------------------------------------------------------- SignalGraphicsItem::~SignalGraphicsItem () { } //----------------------------------------------------------------------------- void SignalGraphicsItem::setHeight (unsigned height) { this->prepareGeometryChange(); y_zoom_ = y_zoom_ * height / height_; y_offset_ = y_offset_* height / height_; height_ = height; width_ = channel_manager_.getNumberSamples() * signal_view_settings_->getPixelsPerSample(); updateYGridIntervall (); } //----------------------------------------------------------------------------- void SignalGraphicsItem::setXGridInterval (unsigned interval) { x_grid_interval_ = interval; } //----------------------------------------------------------------------------- QRectF SignalGraphicsItem::boundingRect () const { return QRectF (0, 0, width_, height_); } //----------------------------------------------------------------------------- float64 SignalGraphicsItem::getYZoom() const { return y_zoom_; } //----------------------------------------------------------------------------- float64 SignalGraphicsItem::getYOffset() const { return y_offset_; } //----------------------------------------------------------------------------- float64 SignalGraphicsItem::getYGridPixelIntervall() const { return y_grid_pixel_intervall_; } //----------------------------------------------------------------------------- double SignalGraphicsItem::getValueRangeFragment() const { return value_range_fragment_; } //----------------------------------------------------------------------------- QString SignalGraphicsItem::getPhysicalDimensionString () const { return channel_manager_.getChannelYUnitString (id_); } //----------------------------------------------------------------------------- void SignalGraphicsItem::zoomIn() { double mid_line_value = (maximum_ + minimum_) / 2; scaleImpl ((mid_line_value + minimum_) / 2.0, (maximum_ + mid_line_value) / 2.0); } //----------------------------------------------------------------------------- void SignalGraphicsItem::zoomOut() { double mid_line_value = (maximum_ + minimum_) / 2; scaleImpl ((2 * minimum_) - mid_line_value, (2 * maximum_) - mid_line_value); } //----------------------------------------------------------------------------- void SignalGraphicsItem::scale (double lower_value, double upper_value) { scaleImpl (lower_value, upper_value); } //----------------------------------------------------------------------------- void SignalGraphicsItem::autoScale (ScaleMode auto_zoom_type) { minimum_ = channel_manager_.getMinValue (id_); maximum_ = channel_manager_.getMaxValue (id_); double max = maximum_; double min = minimum_; if (auto_zoom_type == MAX_TO_MAX) { if (fabs(max) >= fabs (min)) min = max; else max = min; if (min > 0) min *= -1; if (max < 0) max *= -1; } scaleImpl (min, max); } //----------------------------------------------------------------------------- void SignalGraphicsItem::scaleImpl (double min, double max) { minimum_ = min; maximum_ = max; float64 new_y_zoom = height_ / (max - min); float64 new_y_offset = ((max + min) / 2) * new_y_zoom; if (y_zoom_ != new_y_zoom || y_offset_ != new_y_offset) { y_zoom_ = new_y_zoom; y_offset_ = new_y_offset; updateYGridIntervall (); } update (); } //----------------------------------------------------------------------------- void SignalGraphicsItem::paint (QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*) { if (option->exposedRect.width() < 1) return; bool channel_overlapping = signal_view_settings_->getChannelOverlapping(); if (!channel_overlapping) painter->drawRect(boundingRect()); if (new_event_) painter->fillRect(new_signal_event_->getPosition(), 0, new_signal_event_->getDuration(), height_, new_event_color_); QRectF clip (option->exposedRect); if (!channel_overlapping) { painter->setClipping(true); painter->setClipRect(clip); } double pixel_per_sample = signal_view_settings_->getPixelsPerSample(); double last_x = clip.x () - 10; if (last_x < 0) last_x = 0; unsigned start_sample = last_x / pixel_per_sample; if (start_sample > 0) start_sample--; unsigned length = ((clip.x() - start_sample * pixel_per_sample) + clip.width() + 20); if (last_x + length > width_) length = width_ - last_x; length /= pixel_per_sample; if (length < channel_manager_.getNumberSamples() - start_sample) length++; QSharedPointer data_block = channel_manager_.getData (id_, start_sample, length); last_x = start_sample * pixel_per_sample; float32 last_y = (*data_block)[0]; float32 new_y = 0; if (draw_x_grid_) drawXGrid (painter, option); painter->translate (0, height_ / 2.0f); if (draw_y_grid_) drawYGrid (painter, option); painter->setPen (color_manager_->getChannelColor (id_)); for (int index = 0; index < static_cast(data_block->size()) - 1; index++) { new_y = (*data_block)[index+1]; painter->drawLine(last_x, y_offset_ - (y_zoom_ * last_y), last_x + pixel_per_sample, y_offset_ - (y_zoom_ * new_y)); last_x += pixel_per_sample; last_y = new_y; } return; } //----------------------------------------------------------------------------- void SignalGraphicsItem::updateYGridIntervall () { double value_range = (maximum_ - minimum_) ;/// y_zoom_; value_range_fragment_ = MathUtils_::round125 (value_range / signal_view_settings_->getGridFragmentation (Qt::Vertical)); // qDebug () << "y_zoom_ = " << y_zoom_ << "; value_range_fragment_ = " << value_range_fragment_; y_grid_pixel_intervall_ = static_cast(height_) * value_range_fragment_ / value_range; emit updatedYGrid (id_); update (); } //----------------------------------------------------------------------------- void SignalGraphicsItem::enableYGrid(bool enabled) { draw_y_grid_ = enabled; } //----------------------------------------------------------------------------- void SignalGraphicsItem::enableXGrid(bool enabled) { draw_x_grid_ = enabled; } //----------------------------------------------------------------------------- void SignalGraphicsItem::mouseMoveEvent (QGraphicsSceneMouseEvent* event) { QPoint p = event->screenPos(); if (shifting_) { int32 dy = p.y() - move_start_point_.y(); move_start_point_ = p; move_start_point_ = p; y_offset_ = y_offset_ + dy; update(); emit shifting (id_); } else if (new_event_) { float32 pixel_per_sample = signal_view_settings_->getPixelsPerSample (); int32 sample_cleaned_pos = event->scenePos().x() / pixel_per_sample + 0.5; sample_cleaned_pos *= pixel_per_sample; int32 new_event_width = new_signal_event_->getDuration (); uint32 old_pos = new_signal_event_->getPosition (); uint32 old_width = new_signal_event_->getDuration (); if (sample_cleaned_pos < new_signal_event_reference_x_) { new_event_width = new_signal_event_reference_x_ - sample_cleaned_pos; new_signal_event_->setPosition (sample_cleaned_pos); } else { new_signal_event_->setPosition (new_signal_event_reference_x_); new_event_width = sample_cleaned_pos - new_signal_event_->getPosition(); } if (new_event_width < 0) new_event_width = 0; new_signal_event_->setDuration (new_event_width); int32 update_start = std::min(old_pos, new_signal_event_->getPosition()); int32 update_end = std::max(old_pos + old_width, new_event_width + new_signal_event_->getPosition ()); update (update_start, 0, update_end - update_start, height_); emit mouseAtSecond (sample_cleaned_pos / pixel_per_sample * channel_manager_.getSampleRate()); } else event->ignore(); } //----------------------------------------------------------------------------- void SignalGraphicsItem::hoverMoveEvent (QGraphicsSceneHoverEvent* event) { unsigned sample_pos = event->scenePos().x() / signal_view_settings_->getPixelsPerSample (); emit mouseMoving (true); emit mouseAtSecond (sample_pos / channel_manager_.getSampleRate()); if (event_manager_.isNull()) return; std::set events = event_manager_->getEventsAt (sample_pos, id_); std::set shown_types = signal_browser_model_.getShownEventTypes(); QString event_string; foreach (EventID event, events) { QSharedPointer signal_event = event_manager_->getEvent(event); if (shown_types.count(signal_event->getType())) { if (event_string.size()) event_string += "

"; event_string += "" + event_manager_->getNameOfEvent (event) + "
"; event_string += "Start: " + QString::number(signal_event->getPositionInSec()) + "s; "; event_string += "Duration: " + QString::number(signal_event->getDurationInSec()) + "s"; } } if (event_string.size()) { QToolTip::showText (event->screenPos(), event_string); setToolTip (event_string); } else { setToolTip (""); QToolTip::hideText(); } } //----------------------------------------------------------------------------- void SignalGraphicsItem::mousePressEvent (QGraphicsSceneMouseEvent * event ) { SignalVisualisationMode mode = signal_browser_model_.getMode(); switch (SignalBrowserMouseHandling::getAction(event, mode)) { case SignalBrowserMouseHandling::HAND_SCROLL_ACTION: hand_tool_on_ = true; event->ignore(); break; case SignalBrowserMouseHandling::SHIFT_CHANNEL_ACTION: shifting_ = true; setCursor(QCursor(Qt::SizeVerCursor)); move_start_point_ = event->screenPos(); break; case SignalBrowserMouseHandling::NEW_EVENT_ACTION: { if (signal_browser_model_.getShownEventTypes ().size() == 0) break; float32 pixel_per_sample = signal_view_settings_->getPixelsPerSample (); int32 sample_cleaned_pos = event->scenePos().x() / pixel_per_sample + 0.5; sample_cleaned_pos *= pixel_per_sample; new_event_ = true; new_signal_event_ = QSharedPointer(new SignalEvent(sample_cleaned_pos, signal_browser_model_.getActualEventCreationType(), event_manager_->getSampleRate(), id_)); new_event_color_ = color_manager_->getEventColor(signal_browser_model_.getActualEventCreationType()); new_signal_event_reference_x_ = sample_cleaned_pos; emit mouseMoving (true); break; } break; default: event->accept(); if (!EventGraphicsItem::displaySelectionMenu (event)) signal_browser_model_.unselectEvent (); } } //----------------------------------------------------------------------------- void SignalGraphicsItem::mouseReleaseEvent (QGraphicsSceneMouseEvent* event) { if (hand_tool_on_) event->ignore(); if (new_event_) { emit mouseMoving (false); NewEventUndoCommand* new_event_command = new NewEventUndoCommand (event_manager_, new_signal_event_, 1.0 / signal_view_settings_->getPixelsPerSample()); command_executor_->executeCommand (new_event_command); signal_browser_model_.selectEvent (new_event_command->getIDOfNewlyCreatedEvent()); } shifting_ = false; hand_tool_on_ = false; new_event_ = false; setCursor(QCursor()); } //----------------------------------------------------------------------------- void SignalGraphicsItem::contextMenuEvent (QGraphicsSceneContextMenuEvent * event) { signal_browser_model_.selectChannel (id_); QMenu* context_menu = new QMenu (channel_manager_.getChannelLabel(id_)); context_menu->addAction(GuiActionFactory::getInstance()->getQAction("Change Color...")); context_menu->addAction(GuiActionFactory::getInstance()->getQAction("Scale...")); if (signal_browser_model_.getShownChannels().size() > 1) { context_menu->addSeparator (); context_menu->addAction(GuiActionFactory::getInstance()->getQAction("Hide Channel")); } if (!EventGraphicsItem::displayContextMenu (event, context_menu)) context_menu->exec(event->screenPos()); else event->accept(); } //----------------------------------------------------------------------------- void SignalGraphicsItem::wheelEvent (QGraphicsSceneWheelEvent* event) { if (event->modifiers().testFlag(Qt::ControlModifier)) { if (event->delta() > 0) zoomIn(); else if (event->delta() < 0) zoomOut(); } else if (event->modifiers().testFlag(Qt::ShiftModifier)) { if (event->delta() > 0) signal_browser_model_.zoomInAll (); else if (event->delta() < 0) signal_browser_model_.zoomOutAll (); } else event->ignore(); } //----------------------------------------------------------------------------- void SignalGraphicsItem::drawYGrid (QPainter* painter, QStyleOptionGraphicsItem const* option) { if (y_grid_pixel_intervall_ < 1) return; QRectF clip (option->exposedRect); painter->setPen (Qt::lightGray); for (float64 y = y_offset_; y < height_ / 2; y += y_grid_pixel_intervall_) { if (y > -static_cast(height_ / 2)) { painter->drawLine (clip.x(), y, clip.x() + clip.width(), y); } } for (float64 y = y_offset_; y > -static_cast(height_ / 2); y -= y_grid_pixel_intervall_) { if (y < height_ / 2) { painter->drawLine (clip.x(), y, clip.x() + clip.width(), y); } } } //----------------------------------------------------------------------------- void SignalGraphicsItem::drawXGrid (QPainter* painter, QStyleOptionGraphicsItem const* option) { if (x_grid_interval_ < 1) return; QRectF clip (option->exposedRect); painter->setPen (Qt::lightGray); if (clip.width() < 1) return; for (int x = clip.x() - (static_cast(clip.x()) % x_grid_interval_); x < clip.x() + clip.width(); x += x_grid_interval_) painter->drawLine (x, 0, x, height_); } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_graphics_item.h000066400000000000000000000067071154433734200265430ustar00rootroot00000000000000#ifndef SIGNALGRAPHICSITEM_H #define SIGNALGRAPHICSITEM_H #include "base/sigviewer_user_types.h" #include "command_executer.h" #include "file_handling/event_manager.h" #include "file_handling/channel_manager.h" #include "gui/color_manager.h" #include "gui/signal_view_settings.h" #include #include #include class QPoint; namespace SigViewer_ { class SignalEvent; class SignalBrowserModel; class EventGraphicsItem; class SignalGraphicsItem : public QGraphicsObject { Q_OBJECT #if QT_VERSION >= 0x040600 Q_INTERFACES(QGraphicsItem) #endif public: SignalGraphicsItem(QSharedPointer signal_view_settings, QSharedPointer event_manager, QSharedPointer command_executor, ChannelManager const& channel_manager, QSharedPointer color_manager, ChannelID id, SignalBrowserModel& model); virtual ~SignalGraphicsItem (); virtual QRectF boundingRect () const; void enableYGrid(bool enabled); void enableXGrid(bool enabled); float64 getYZoom() const; float64 getYOffset() const; float64 getYGridPixelIntervall() const; double getValueRangeFragment () const; QString getPhysicalDimensionString () const; void zoomIn(); void zoomOut(); void scale (double lower_value, double upper_value); void autoScale (ScaleMode auto_zoom_type); public slots: void updateYGridIntervall(); void setHeight (unsigned height); void setXGridInterval (unsigned interval); signals: void mouseAtSecond (float64 sec); void mouseMoving (bool mouse_is_moving); void shifting (ChannelID channel_id); void updatedYGrid (ChannelID channel_id); private: void scaleImpl (double min, double max); virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent * event); virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent * event); virtual void wheelEvent (QGraphicsSceneWheelEvent * event); void drawYGrid (QPainter* painter, QStyleOptionGraphicsItem const* option); void drawXGrid (QPainter* painter, QStyleOptionGraphicsItem const* option); QSharedPointer signal_view_settings_; QSharedPointer event_manager_; QSharedPointer command_executor_; ChannelManager const& channel_manager_; QSharedPointer color_manager_; ChannelID id_; SignalBrowserModel& signal_browser_model_; float64 minimum_; float64 maximum_; float64 y_zoom_; float64 y_grid_pixel_intervall_; double value_range_fragment_; bool draw_y_grid_; bool draw_x_grid_; float64 y_offset_; int32 height_; uint32 width_; unsigned x_grid_interval_; bool shifting_; bool new_event_; EventGraphicsItem* created_event_item_; bool hand_tool_on_; QPointF move_start_point_; QSharedPointer new_signal_event_; int32 new_signal_event_reference_x_; QColor new_event_color_; }; } #endif // SIGNALGRAPHICSITEM_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_grid_graphics_item.cpp000066400000000000000000000001701154433734200300670ustar00rootroot00000000000000#include "signal_grid_graphics_item.h" namespace SigViewer_ { SignalGridGraphicsItem::SignalGridGraphicsItem() { } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/signal_grid_graphics_item.h000066400000000000000000000003231154433734200275340ustar00rootroot00000000000000#ifndef SIGNAL_GRID_GRAPHICS_ITEM_H #define SIGNAL_GRID_GRAPHICS_ITEM_H namespace SigViewer_ { class SignalGridGraphicsItem { public: SignalGridGraphicsItem(); }; } #endif // SIGNAL_GRID_GRAPHICS_ITEM_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/x_axis_widget_4.cpp000066400000000000000000000105111154433734200257700ustar00rootroot00000000000000#include "x_axis_widget_4.h" #include "gui/gui_action_factory.h" #include "base/math_utils.h" #include #include #include #include #include #include #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- XAxisWidget::XAxisWidget (QSharedPointer signal_view_settings, QWidget* parent) : QWidget (parent), signal_view_settings_ (signal_view_settings), intervall_ (10), x_start_ (0), pixel_per_sec_ (2), length_in_sec_ (0), highlighting_enabled_ (false), time_to_highlight_ (0) { } //----------------------------------------------------------------------------- XAxisWidget::~XAxisWidget() { // nothing to do here } //----------------------------------------------------------------------------- QSize XAxisWidget::sizeHint () const { return QSize (100, 30); } //----------------------------------------------------------------------------- void XAxisWidget::changeXStart(int32 x_start) { x_start_ = x_start; update (); } //----------------------------------------------------------------------------- void XAxisWidget::changeHighlightTime (float64 time_to_highlight) { highlighting_enabled_ = true; time_to_highlight_ = time_to_highlight; update (); highlight_timer_ = startTimer (5000); } //----------------------------------------------------------------------------- void XAxisWidget::enableHighlightTime (bool highlighting_enabled) { highlighting_enabled_ = highlighting_enabled; update (); } //----------------------------------------------------------------------------- void XAxisWidget::paintEvent(QPaintEvent*) { pixel_per_sec_ = signal_view_settings_->getPixelsPerSample() * signal_view_settings_->getSampleRate(); intervall_ = pixel_per_sec_ * MathUtils_::round125 (100.0 / pixel_per_sec_); if (intervall_ < 1 ) { return; // invalid intervall } int32 x_end = x_start_ + width(); int32 font_height = height() - 5; QPainter p (this); p.setPen (Qt::black); p.translate(-x_start_, 0); p.drawLine(x_start_, 0, x_end, 0); float64 float_x_start = floor((x_start_ + intervall_ / 2) / intervall_) * intervall_; float64 float_x_end = ceil((x_end - intervall_ / 2) / intervall_) * intervall_ + intervall_ / 2; for (float32 float_x = float_x_start; float_x < float_x_end; float_x += intervall_) { int32 x = (int32)(float_x + 0.5); p.drawLine(x, 0, x, 5); p.drawText((int32)(x - intervall_ / 2), 5, (int32)intervall_, font_height, Qt::AlignHCenter | Qt::AlignVCenter, QString::number(float_x / pixel_per_sec_)); } if (highlighting_enabled_) { QFont font; font.setPointSizeF (font.pointSizeF() * 1.5); font.setBold (true); p.setFont (font); QRect bounding_rect = p.boundingRect (0, 0, 0, font.pixelSize(), Qt::AlignHCenter | Qt::AlignVCenter, QString::number(time_to_highlight_, 'f', 3)); bounding_rect.moveTo (time_to_highlight_ * pixel_per_sec_, 5); p.fillRect (bounding_rect, Qt::white); p.setPen (Qt::black); p.drawText (bounding_rect, Qt::AlignLeft | Qt::AlignTop, QString::number(time_to_highlight_, 'f', 2)); last_highlight_rect_ = bounding_rect; } } //----------------------------------------------------------------------------- void XAxisWidget::contextMenuEvent (QContextMenuEvent* event) { QMenu menu; menu.addAction(GuiActionFactory::getInstance()->getQAction("Scale X Axis")); menu.addSeparator(); QAction* visibility_action = menu.addAction("X Axis"); visibility_action->setCheckable (true); visibility_action->setChecked (true); connect (visibility_action, SIGNAL(triggered(bool)), SLOT(setVisible(bool))); menu.exec (event->globalPos()); } //----------------------------------------------------------------------------- void XAxisWidget::timerEvent (QTimerEvent* event) { if (event->timerId() == highlight_timer_) { highlighting_enabled_ = false; killTimer (highlight_timer_); highlight_timer_ = -1; } } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/x_axis_widget_4.h000066400000000000000000000021071154433734200254370ustar00rootroot00000000000000#ifndef X_AXIS_WIDGET_H #define X_AXIS_WIDGET_H #include "base/sigviewer_user_types.h" #include "gui/signal_view_settings.h" #include #include namespace SigViewer_ { class XAxisWidget : public QWidget { Q_OBJECT public: XAxisWidget (QSharedPointer signal_view_settings, QWidget* parent); virtual ~XAxisWidget(); virtual QSize sizeHint () const; public slots: void changeXStart (int32 x_start); void changeHighlightTime (float64 time_to_highlight); void enableHighlightTime (bool highlighting_enabled); private: virtual void paintEvent(QPaintEvent*); virtual void contextMenuEvent (QContextMenuEvent* event); virtual void timerEvent (QTimerEvent* event); QSharedPointer signal_view_settings_; float64 intervall_; int32 x_start_; float64 pixel_per_sec_; float64 length_in_sec_; bool highlighting_enabled_; float64 time_to_highlight_; QRect last_highlight_rect_; int highlight_timer_; }; } #endif // X_AXIS_WIDGET_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/y_axis_widget_4.cpp000066400000000000000000000132311154433734200257730ustar00rootroot00000000000000#include "y_axis_widget_4.h" #include "signal_graphics_item.h" #include "gui/gui_action_factory.h" #include "base/math_utils.h" #include #include #include #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- YAxisWidget::YAxisWidget (QWidget* parent) : QWidget (parent), channel_height_ (0), y_start_ (0) { // nothing to do here } //----------------------------------------------------------------------------- void YAxisWidget::addChannel(ChannelID channel_nr, SignalGraphicsItem const* const signal_item) { if (signal_item) channel_nr2signal_graphics_item_[channel_nr] = signal_item; } //----------------------------------------------------------------------------- void YAxisWidget::removeChannel(ChannelID channel_nr) { QMap::iterator it = channel_nr2signal_graphics_item_.find(channel_nr); if (it != channel_nr2signal_graphics_item_.end()) { channel_nr2signal_graphics_item_.erase(it); update (); } } //----------------------------------------------------------------------------- void YAxisWidget::changeSignalHeight (unsigned signal_height) { channel_height_ = signal_height; update (); } //----------------------------------------------------------------------------- void YAxisWidget::changeYStart (int y_start) { y_start_ = y_start; update (); } //----------------------------------------------------------------------------- void YAxisWidget::updateChannel (ChannelID) { update (); } //----------------------------------------------------------------------------- void YAxisWidget::paintEvent(QPaintEvent*) { QPainter painter (this); float64 intervall = channel_height_; painter.translate (0, ((static_cast(channel_height_) / 2)) - y_start_); int32 current_y_start = 0; foreach (SignalGraphicsItem const* signal, channel_nr2signal_graphics_item_.values()) { if (current_y_start >= y_start_ - intervall && current_y_start <= y_start_ + height ()) paintYAxisLabels (&painter, signal->getYOffset(),signal->getYGridPixelIntervall(), signal->getValueRangeFragment(), signal->getPhysicalDimensionString()); painter.translate (0, intervall); current_y_start += intervall; } } //----------------------------------------------------------------------------- void YAxisWidget::contextMenuEvent (QContextMenuEvent* event) { QMenu menu; menu.addAction(GuiActionFactory::getInstance()->getQAction("Channels per Page...")); menu.addSeparator(); QAction* visibility_action = menu.addAction("Y Axis"); visibility_action->setCheckable (true); visibility_action->setChecked (true); connect (visibility_action, SIGNAL(triggered(bool)), SLOT(setVisible(bool))); menu.exec (event->globalPos()); } //------------------------------------------------------------------- void YAxisWidget::paintYAxisLabels (QPainter* painter, float64 offset, float64 y_grid_pixel_intervall, double value_range_fragment, QString const& unit_string) { int upper_border = channel_height_ / 2; int lower_border = -static_cast(channel_height_ / 2); painter->setClipping (true); painter->setClipRect (0, lower_border - 1, width(), upper_border - lower_border + 2); painter->drawLine (0, upper_border, width() - 1, upper_border); painter->drawLine (width () - 5, offset, width () - 1, offset); paintYUnits (painter, unit_string); painter->drawText (0, offset - 20, width () - 10, 40, Qt::AlignRight | Qt::AlignVCenter, QString::number (0)); if (y_grid_pixel_intervall < 1) return; while (y_grid_pixel_intervall < 11) { y_grid_pixel_intervall *= 2; value_range_fragment *= 2; } double value = 0; for (float64 value_y = offset; value_y < upper_border; value_y += y_grid_pixel_intervall) { if (value_y > -static_cast(channel_height_ / 2)) { painter->drawLine (width () - 5, value_y, width () - 1, value_y); painter->drawText(0, value_y - 20, width () - 10, 40, Qt::AlignRight | Qt::AlignVCenter, QString::number (value)); } value -= value_range_fragment; } value = 0; for (float64 value_y = offset - y_grid_pixel_intervall; value_y > lower_border; value_y -= y_grid_pixel_intervall) { value += value_range_fragment; if (value_y < channel_height_ / 2) { painter->drawLine (width () - 5, value_y, width () - 1, value_y); painter->drawText(0, value_y - 20, width () - 10, 40, Qt::AlignRight | Qt::AlignVCenter, QString::number (value)); } } } //------------------------------------------------------------------- void YAxisWidget::paintYUnits (QPainter* painter, QString const& unit_string) { if (unit_string.size() > 4) { painter->rotate(-90); painter->drawText (0, 5, width(), 60, Qt::AlignLeft | Qt::AlignTop, unit_string); painter->rotate(90); } else painter->drawText (5, 0, width() - 10, 40, Qt::AlignLeft | Qt::AlignTop, unit_string); } } sigviewer-0.5.1+svn556/src/gui_impl/signal_browser/y_axis_widget_4.h000066400000000000000000000022671154433734200254470ustar00rootroot00000000000000#ifndef Y_AXIS_GRAPHICS_ITEM_H #define Y_AXIS_GRAPHICS_ITEM_H #include "base/sigviewer_user_types.h" #include #include namespace SigViewer_ { class SignalGraphicsItem; class YAxisWidget : public QWidget { Q_OBJECT public: YAxisWidget(QWidget* parent); virtual ~YAxisWidget () {} void addChannel(ChannelID channel_nr, SignalGraphicsItem const* const signal_item); void removeChannel(ChannelID channel_nr); public slots: void changeSignalHeight (unsigned signal_height); void changeYStart (int32 y_start); void updateChannel (ChannelID channel_id); private: virtual void paintEvent (QPaintEvent* event = 0); virtual void contextMenuEvent (QContextMenuEvent* event); void paintYAxisLabels (QPainter* painter, float64 offset, float64 y_grid_pixel_intervall, double value_range_fragment, QString const& unit_string); void paintYUnits (QPainter* painter, QString const& unit_string); unsigned channel_height_; int32 y_start_; QMap channel_nr2signal_graphics_item_; }; } #endif // Y_AXIS_GRAPHICS_ITEM_H sigviewer-0.5.1+svn556/src/gui_impl/signal_browser_mouse_handling.cpp000066400000000000000000000027221154433734200257700ustar00rootroot00000000000000#include "signal_browser_mouse_handling.h" #include #include #include namespace SigViewer_ { SignalBrowserMouseHandling::Action SignalBrowserMouseHandling::getAction(QGraphicsSceneMouseEvent* e, SignalVisualisationMode mode) { // hand scroll if ((e->button() == Qt::MidButton && e->modifiers() == Qt::NoModifier) || (mode == MODE_HAND && e->button() == Qt::LeftButton)) { return HAND_SCROLL_ACTION; } // shift channel if ((e->button() == Qt::MidButton && e->modifiers().testFlag(Qt::ShiftModifier)) || (mode == MODE_VIEW_OPTIONS && e->button() == Qt::LeftButton)) { return SHIFT_CHANNEL_ACTION; } // new event if (e->button() == Qt::LeftButton && mode == MODE_NEW) { return NEW_EVENT_ACTION; } // select or resize event if (e->button() == Qt::LeftButton && e->modifiers() == Qt::NoModifier && mode == MODE_POINTER) { return SELECT_RESIZE_EVENT_ACTION; } // shift event to channel if (e->button() == Qt::LeftButton && e->modifiers() == Qt::ShiftModifier && mode == MODE_POINTER) { return SHIFT_EVENT_TO_CHANNEL_ACTION; } // copy event to channel if (e->button() == Qt::LeftButton && e->modifiers() == Qt::ControlModifier && mode == MODE_POINTER) { return COPY_EVENT_TO_CHANNEL_ACTION; } return NO_ACTION; } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/gui_impl/signal_browser_mouse_handling.h000066400000000000000000000015071154433734200254350ustar00rootroot00000000000000// signal_browser_mouse_handling.h #ifndef SIGNAL_BROWSER_MOUSE_HANDLING_H #define SIGNAL_BROWSER_MOUSE_HANDLING_H class QMouseEvent; class QWheelEvent; #include "gui/signal_visualisation_modes.h" class QGraphicsSceneMouseEvent; namespace SigViewer_ { // signal browser mouse action class SignalBrowserMouseHandling { public: enum Action { NO_ACTION, HAND_SCROLL_ACTION, ZOOM_WINDOW_ACTION, WHEEL_SCROLL_ACTION, ZOOM_ALL_CHANNELS_ACTION, ZOOM_CHANNEL_ACTION, SHIFT_CHANNEL_ACTION, NEW_EVENT_ACTION, SELECT_RESIZE_EVENT_ACTION, SHIFT_EVENT_TO_CHANNEL_ACTION, COPY_EVENT_TO_CHANNEL_ACTION }; static Action getAction(QGraphicsSceneMouseEvent* e, SignalVisualisationMode mode); }; } // namespace SigViewer_ #endif sigviewer-0.5.1+svn556/src/images/000077500000000000000000000000001154433734200166255ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/images/auto_scale_22x22.png000066400000000000000000000021121154433734200223050ustar00rootroot00000000000000PNG  IHDRĴl;IDATxKlTU=׼z;mӪi41bh #QnXݹ2 5$ yh Hm4AQT)-P[wy{] Ykv>u?@i"p4< X-fi79H,m!h6T]rTUXvm[ZGD_{x~ `iS_)ͩT ,!Mϧ\FDJI[{+R>`I,-+ň&zJA@T]Ş ,|}ǩy{hTHbp*j;>reNK;$Bfw^8>)==EǪ? "]7g/9wtsHZJ 9=:h;.|PG\I/ę*py6_ϥ.ZP9fpG:UDA t?10xIO|2y>wov1"qq1(ezۓ鯇}Yr22'aWB-F/=IDyUtZGu-lcН-t 1:1seK.ڌItw,ӢiI61` K ] p[H6>[ShvǪIu@*~+p\hf?{+dy3U ȭQ˅v3;sBy!à IENDB`sigviewer-0.5.1+svn556/src/images/change_channel_22x22.png000066400000000000000000000014701154433734200231110ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYsLL{qptIME  80>IDAT8˭MHTa{gQ4( FB*Ù0jW"#Md?.͸R EբVq$!H*(3w" mƼQg9xyĽ /9BhJ55pV1=5oEtzIv]ZZ) Xl`VcM?]]K!U{8O3X1wJtUBb!XZaPQXuV7`~1enp~HP$v>$a^4X`]=נ՘>,\D˓y3F!5Ga6EZ\fƳ{'n{bs?* ]g0Ĥ@ܿ? |$nvh~ʀ( #\N9g9^NwHU42  /4Ѧmx+fNv#5M̺b^Ƣ7#zhu/'*|% 6;ccѩ TiS?DIMi63@>,EcDeP ́!_#̬ 54f)Ӑo•c}c\)>.ԳZұy屵KzԆpc}-r{V 'U8py},Yn{P6CGN;$Vbe!  wJm6~,C->O7\'\IENDB`sigviewer-0.5.1+svn556/src/images/change_type_22x22.png000066400000000000000000000030461154433734200224630ustar00rootroot00000000000000PNG  IHDRw=sRGBbKGD pHYsLL{qptIME  8\݆IDATHǵil\W{g,cn=ƉIJ&uYڢWTVe?*T!U"Z"@E ԍk xgzxlˏ[ ~ҧ|GyϏ.ogT6p]Τ :un5=);@ ub6ko, p,HkחoM{0S@dHJey€w/g./3d;o (( pL>L4ʆ[6H P#&j8ae/lA2ҕ ޣRa"7Aq,N]E5@aYN)qެXE,8ԁ>A<'UU:66o l wH2J vu8 vbGZC906:@62(MVmS[o :c\w7į񊒫 X x>/*ʄ(㛩, %JEUB+y͋p}a}``v!P"X|UBQ+M]'|;O~%xe]V4 g2ٙݒG8XfT KEr5"4N"Q\ZkY^ߚP3Ul$᷎0m'eQ_*3mWب.{ st ?ʿ{Muښ`,fJދY6ϗ8EkHyk,t*Q-JG^%S4ߎZHs(kmHO91=5ȩ9N+7Fytѓ {2m}~^ԩ'HF%UuiS/z'  A/rxGDJA<0N422K-E`I\fW<3 hk7+==QSxf V7Iw4gm P,4TCs8ϫ"44B&W ;?$CkǁIENDB`sigviewer-0.5.1+svn556/src/images/channels_22x22.png000066400000000000000000000007241154433734200217700ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  tIME6t/aIDATԿNUAFrn'ƛHPiigKNh7|[+ &&$dFC4{v;SK,}1_ӵ-PpظlUS|Q|شLmW}{1b]׹IU ؏b$e&E5pF2Ş$nm{(!Sp ^ 73n$f/xO^[[08 +|ÇP<5M$r8n){[k?=Gq 9lh5b]a+7ځT(.E|1avӭ>+͌)>cYǤmsxFiaW,IENDB`sigviewer-0.5.1+svn556/src/images/copy_to_channels_22x22.png000066400000000000000000000007731154433734200235300ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  tIME 0gIDATxڥJ@lA< =]{"l{ Dư=nDo'B3i`Lfd{u手IbaI"HOC kWBD$Iӊ,zOUEYn #,\,ˑE5r,BO*T숢5Q !,GQxtzgṴ\x(1 EQ$&O %ιԸnf]X5-aJT e^55ޗpNᜋSa@ Hk.q5gg!رpBD:[E Yk i,y>uRSW KBNNXtQSQc鸦-jbU_!5[1jl>jb,U!hIENDB`sigviewer-0.5.1+svn556/src/images/delete_22x22.png000066400000000000000000000016671154433734200214460ustar00rootroot00000000000000PNG  IHDRĴl;gAMA7tEXtSoftwareAdobe ImageReadyqe<IIDATxb?ùK3112`~a7߿>~ 0Ǯ  j!h鏟Ə`eؼB!,ff(egce05O@5h 3 3@ "àp"b`D4;3")IA.  }GSy1(a@ J9`IW[f >b"dfwp?3v#g ~ dзo?9'6`x3p16@A@g23gh8(s Gq~?.^?f`=3~}t/ƣ2|~ l4ʊ`4Б> wkq בM ;fV.e36@LY0?p?|ײpC?0pefpabn0@~ 7%W0 B&L` B1 2=9_ؗ-``T9@X||'یfχo ̧2y20}NɈ=( H,`6u5F.o@˗=?~ěm+*dWSۚ !h8۱x  WLb'"𫴓O\>çÿLĂx  4\W@&̉=`6VDҁʲ#&0X-` HPZ@M`0O IENDB`sigviewer-0.5.1+svn556/src/images/events_22x22.png000066400000000000000000000017441154433734200215040ustar00rootroot00000000000000PNG  IHDRĴl;gAMA7tEXtSoftwareAdobe ImageReadyqe<vIDATxb` (ga>E3_AI  &"P!1 2?x6{G@ RǠ|Q4(FAg紱'W  *V G@Ea󠰴APN=-PWiS>~ A4?20H]r<;/U| L ?X:gß;ݺ'?3|ûA0v`-a`tqh$e~0\7DſF`g``@33fD w 0p`T p`Nd@1Yy~7H'snoc? 0i(+2.h4@{?_d`ÿ @acdPBƃKE7Gn3`eE # Ŀ!j@A4 j(OIK ُ!pbZV@)   iY1!`F@9b`gS{@>p?G- F 8>xp 0~~ g#Hnc ɨQclaxЊzYexqAY  ߁IXJ(21L7 =8?UIENDB`sigviewer-0.5.1+svn556/src/images/exit_22x22.png000066400000000000000000000025661154433734200211540ustar00rootroot00000000000000PNG  IHDRĴl;gAMA abKGDC pHYs @SIDATxڭ]heWk}ι~&5&LofL; Z+_*Zh)> P>0S*0R VAAQ:X)X0餵L27L27sdZa9"{`DtM{<A=z@QU46^\?]ifexa4 G)>OWvEg1f \\!* $z׼ڣjg~Vo_hEibҝ-Ss&2Ik81O&8g6לry&֥˸rYM\&MsE*%84VY'5ydž y*dQ01d0[K?"MBgge:YJT7ΒHwb$z'u6G7ؽ 6.Ϩ[&g{\~g܃"f(Sf~4W@_~)~嗔'XYwWYn_)核X8cs|s$] {j'm^@DсUA9YJiq{c@i]&OMQMCu?bUTE~ާkA 5kL>'K`z`G} "f0Ÿ006@X} #[n{OQ=z  b}sYf~O"zUUj mmvnoGFEQ|m nl[~w<>xЙpaVZTePmx8\G]m\nΙ7w_>yhᑙȽEA] em:T BdZvnsf~amOGIENDB`sigviewer-0.5.1+svn556/src/images/file_16x16.png000066400000000000000000000013601154433734200211170ustar00rootroot00000000000000PNG  IHDRa pHYs  gAMA|Q cHRMz%u0`:o_FfIDATxb@ QPPoO0|@;f g2L0 X`&)2523? < nl gg'ß. &CA7 od`f)Oy16E V``3wf~~ff0#'?./<?߿pk׮ &&_2|`y82 |||@26؂ lll @1 n>}й @c` `@`d߿ @ n0X޾}C?ii~ Ë/J,311mȿ $r U @p.]Ġ  6d:Ö-[Ճ@A`~qϟ?g(,,  E߿06^| 2fN @eR / 6ȚA !&H,j$=IENDB`sigviewer-0.5.1+svn556/src/images/file_info_22x22.png000066400000000000000000000025471154433734200221340ustar00rootroot00000000000000PNG  IHDRĴl; pHYs  gAMA|Q cHRMz%u0`:o_FIDATxb?Ì33Pddd0 c'ço ߀??o2'/÷e/û/lE6j d'&-Y␏ ƾ@:V49"saH8C15\ٴO 6e`#?Vf ې,_ſXXbg/X0g<bAF( /|pc~~TTS@(@,~s20[j22m: aph7Cc-@  _34> ++hOYY1\_ݷP?Ћnn.YT|cd,g/6vNdC@  Lbdacp1Wd0p>-0  Ú5' 52ZqqqiqN^qqQU(@ r/!-VUV U2k ' R-5;IENDB`sigviewer-0.5.1+svn556/src/images/fileclose_22x22.png000066400000000000000000000021371154433734200221420ustar00rootroot00000000000000PNG  IHDRĴl;gAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?-@FFF  8.= 5& Rgdd`eea`cckï_?f"Plk? @ 5R󙘘 LM45j_̰kq͛3Ќ3g]@6 P _HHH0A]]o8>~a@\x 0n0 $%̄P?1ܺuds> d] y1pp] *g+mm`0!&Ɵh`0bB˿|eA >}e*dg'%%)vv60ˇ@,$}eeyFx=2'-%% L .\` go6m: A,J޽غ(0Eȃ ` dW;0 @LXdeee pr.+`D6CAf0}Ðӧ1=xP+ pz=BKKcT? däIPĿ}w$@(`lffC.0Y y *P@yecCaMM3O_pe]]mXXX| .?] 6 3#,?-| Cob`aod8y:XD9sW`3` R1^6PSS}!Pn VsO/ů\ @YzL @B&&Al_ZZV@KKPt*0BׯBQl e̶K;w2\x? K 3 DXóg޼y L=P  y\5,qUMH `IENDB`sigviewer-0.5.1+svn556/src/images/fileopen_22x22.png000066400000000000000000000025141154433734200217750ustar00rootroot00000000000000PNG  IHDRĴl;gAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?-@1`b$UCyIgec2.IdA焋oJǥ @A @m)Sx_ϻ?9P6sQ>1~e`ï? k?}`CzW'y~^V?3Lsp03ԴOťQ mWh0 bre01/`><҆W .9< @,PSOx`g=Ϡ&`k(ۅ{/1  x >. rx#? 7d:n[34)P X]'+SI~,,u _ab^IZjs  0l@[Ocg``8l0;y hB {^3(2I0p1|} ~gÏ j ?YYN݃wWeE @+[Kt޾/g7@9×@O ݇ o^d ><c޿ L˟?C` +[Dn=a`^ w |+o X-|d-@Wbcq`1?k1L@@?`|pp`a`xdx/@~  h·^𗅝50g˰ ps3?Ë/ <@H*$Y>A?x1( 03߷ 7`'W >7ACnaDox8^`.CBKa@xIENDB`sigviewer-0.5.1+svn556/src/images/help_22x22.png000066400000000000000000000022421154433734200211220ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  #utIME 0% /IDATxڕMlTU)SH)iR@D DՄ& *1n`+bc T7&kS5A)!"R[;BiL3yxm%9=9Q9zZ|:ưϫqqQg4zH iq1]P!yRڌSfԎ|P*[ܚRg%=%jDѫGp֜i2Ǟ)j1FRwK&/pvcUyx%}`}MfL>a#+3ca "4s.![s>q_yF!,#]z\|WPvEx~oG7&'DZ%ӫÅm&{x++{*SҾ>nh%*d=j{&nDZн5O FX/e=V&gY'p3BM=rJ:l 'Bw KAӫXI/U !j DҐ l.2QL''pޝ)3|>%"5++߶Vc~_^_{ottT> ~sοeb0عLX%(s,#X ~,*5{ЧaOa4e)ea0epX|K +f0Xe寖?9} )'RxJ8ED=\ enwfJ <Զ/S;[li⼫ҷ6?p ;7XO{,=A$D +ZI2z)- n(P՚mqa nw6]Cb2+̍ .e-nʭɈܳ-X1}fB}|[[ݙmw<pP^ʼnzU'?F8.ggQ<=W'kk˚D"DELflBp=Տh4y䛛?*6En'itfb3|Fqa6d 5ztZPT\nڥ3Ȇ<|Kq#+ZqNaHc< 4(*X(QBS8tXJdC3NV;;'>۶lGٟ:L($ <ܕIENDB`sigviewer-0.5.1+svn556/src/images/icons/autoscale.png000066400000000000000000000005331154433734200224270ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME ESIDAT8˵ m=0Dgl:C"b)ga c 1)K,,O$PT"«`4` |)BY4S~ GNU7aC 󊕍^(8[PMt??1jgQ>q+}|n=6tx= c)v{d/rJa^ dN9AnLTfdSIENDB`sigviewer-0.5.1+svn556/src/images/icons/configure.png000066400000000000000000000072011154433734200224270ustar00rootroot00000000000000PNG  IHDRĴl; OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3-bKGD pHYsLL{qptIME 28rBIDAT8˥]lTEs~t?{[nK6B܈F v &ZC}G/6PƐPI ʚER\F[[-{w;ÖJk.d97sΜ!X+W baEsd6;.T.WGD*u 8cA=udC3g.'|~Q>}i"@_ɓ_k:Ji2s.wQ]+\NBH&XH ^'uk#,ˆeٰm(e bm !$ӯ@OO2ȲLP@)!TbʺR!}Btu}Y)$R`cff@)[\Np?w+ d,֦Ȳ , wPHAU--M$ m0JM<@]] &'_y?^7Қ7fNs.l0==B!{iTu//BG|zU{Ue۶gp8 4-8o~/oQqGoO@/> !zkkp~"p0 C)GH6Fs#Yh#p6ǚ4@ 7%ӊb aR#"Gct]]m1>lms Ƽƭ91"/(#sW6\B @9fesDJ7rw_;$JSq _7P$7/JNwztÒO% %`syp:췥N릅%m"9s% (rw .C~9U6W cZU >k2 _e+#BjKud#'Α HƒG.ҧ.s6"X4IENDB`sigviewer-0.5.1+svn556/src/images/icons/editdelete.png000066400000000000000000000014761154433734200225660ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYsLL{qptIME  37IDAT8˭IhAzճ8$ND/T4. xQw=]An=( 9K@(H"AwqI:z:N\f"/]W.BNQU*AP=fd3Fd27 "2)bD#:Mgo˻qFbT!cr%BLUO/NHRug·r}\(P)liBD[N7r4nz_"whox"b\ 9mh\R 6!\I5gmm%ӧ!p̹:ԑN]q:HT<(iZ}1IG:sluv 8q59vw_S,2r wlf4OE{L }hy:~{=eo긑k >yS<)xZ3z>(Dn]mp:59tps!FQLd Vؽw?~0O9IENDB`sigviewer-0.5.1+svn556/src/images/icons/exit.png000066400000000000000000000023051154433734200214170ustar00rootroot00000000000000PNG  IHDRĴl;sBIT|dtEXtSoftwarewww.inkscape.org<WIDAT8OTW;w`fbCC,,(X56qa⊅ѥ WKW$…[dƄQ:RT|̽3tq6&'My~%Ե]3d)eVTJ++#U+Ե+'O^.a)RJ`?ZWgObu8F.$z{?՟@!2RUωt8ΐeIi. r3юMMD 6>~dciܫWa pR*%mf6gۉ4Kǘsω T*E1 %XD,c(e2b;aK {ϞQYZ"c57}`wi,DA$}9 r {Zb1_bׯyN<4Df36hc_B(N?c7n>;Kc<:yu(L<{z̽{t9»F\J)NXh?+i,)1ZY!RlܺDyML`yCB 9v oa۷>Cñ9I$=B/>:ҝ;BJ!`ym''tj\[EMMQa6eelVBl6T.Ykb&sA 9{437zivyBa\M-._]B|0Ɣ҈6D,XUIENDB`sigviewer-0.5.1+svn556/src/images/icons/fileclose.png000066400000000000000000000021371154433734200224160ustar00rootroot00000000000000PNG  IHDRĴl;gAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?-@FFF  8.= 5& Rgdd`eea`cckï_?f"Plk? @ 5R󙘘 LM45j_̰kq͛3Ќ3g]@6 P _HHH0A]]o8>~a@\x 0n0 $%̄P?1ܺuds> d] y1pp] *g+mm`0!&Ɵh`0bB˿|eA >}e*dg'%%)vv60ˇ@,$}eeyFx=2'-%% L .\` go6m: A,J޽غ(0Eȃ ` dW;0 @LXdeee pr.+`D6CAf0}Ðӧ1=xP+ pz=BKKcT? däIPĿ}w$@(`lffC.0Y y *P@yecCaMM3O_pe]]mXXX| .?] 6 3#,?-| Cob`aod8y:XD9sW`3` R1^6PSS}!Pn VsO/ů\ @YzL @B&&Al_ZZV@KKPt*0BׯBQl e̶K;w2\x? K 3 DXóg޼y L=P  y\5,qUMH `IENDB`sigviewer-0.5.1+svn556/src/images/icons/fileopen.png000066400000000000000000000021621154433734200222500ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYsLL{qptIME  şIDAT8˵[U;c2c0y )L !{zL B-rhfPL-N88ۜ3/k0.X{^_{'s\ F^z'-[U￳3~[S}[o߰+rઋsWUwuuZ͹lV1>؟qO>+_ eAARٻ>+}cmcZ[qRI^yT~i%Ivٹe CdұW5(^;cNt~{2'6 \Q0;Lx̬k\FG֯n,RV.KgC @Gȱaopg)aUsg3>:Νk+T6q ܴH/_PFe[4Ov,XX+qu럊|%K>?4R+%h\oސ5Qyueƙ9ќ!\ryCP K5J#c8 o}?ˤٲ^KD RBQ,s:0k!Zp+%h SsEbE(WX;"PJehgfLK4c1QTRu(9u_NI+2?1"uEbH@ A!sB2ddɾw3U3;k;vK O[6?Q]OT3zBvĤd)f,jnq9wb7>_ẞʵKPq>~ &p]>}޺_ᔔ. հryzm/#&a{U _•O1)8w*,1z·x_dҳu/,,?,͔b4:Jq;x͌t!bfۈ{+;e2}Ƚ1bH4˖:p|ҤI{9g~8HL &koq>d< js}=u飹Ǐ8ܝ~q7vՑW5ogN;Nց>~H\'x$#M*Xk1b׎׸)Q] vʋ? /wi5}wĕcys<0k/ d_^'1@ӳxu҃77MPRN&4kd[?JudZ v/1;tF,Fa02yh7 # ;좹Ph ]HDrs:>̆ޕfq .nzc4 u F,{/>AmpWT{`v^rm/KC忁-"VVr::uXxv4A Ը8-|-yRkUiq:<6vo\BpRk`6\ba}UŦ˝jmG6m `zMKhmpR &Z0"tGpS5l64 mFpȖ93q|1B!b*'XV?"K\#E@7!n5"Tih2@k-8BS/07FR @!lS=13Ac ;>1b)CDIP݅2۱"OƄ#_;^'Z Zɲf@ұ4O64@TD\>S̃,%La#Mch@=LD)M+| bq# w$Pݛb#Y|R ei{7r Ww3!ՑBG[k婢$[ja$XXڑxwvg'D,$2.߼}o )"pXDccL=7"ZP?xXhrrW84J)IcmрSJgY@o0c8;@{"IU۶Wr]{{{RTDt4M9L$zw4 CDiZVeY4 yaSJ=#|?4K?cs>`D,n }-~[^ᤒyuc ile\P(~!DCi+0 I\5TcH)ד$9y^u]9n'B[OeU$Yi۾a, No6_qثj8B߄Ap/B; Q5.o08߮iZHdžE,,:R((J0E/ X:YIENDB`sigviewer-0.5.1+svn556/src/images/icons/next.png000066400000000000000000000024571154433734200214340ustar00rootroot00000000000000PNG  IHDRĴl;gAMA a pHYs B(xIDAT8}kh\UuMwh7ƄJQ֢TEAA|Њ"BE'ڂEDmk۴&ݽw??sΌ`>+[:0>PP>U8axxDd;,]XБq #hk7h}ibمܽz>F mۍ!aKKƧ}r[vp cqz/h1C.frHէB݋vCʍ /3d`HǹbofV<\ l~` C%ѪG.)Z'ij!8~G4ӑ7'=0'w e26߆݌.7 %+z31S:*}Rp={`n'άr0(~&ŝJe\J޷$ZkEn|l9# Jr2\8Z(,[ԊŢea<[Ǐ d֖L|wnē+dI!͓+ <RVK"Ye2|_84_ yEh%9;  e2FvQx$-9/y͏Nc;BPq(cB-3\.;}1\FҢ%J)Y^Y}6IDZi>]*4~8M ABhˌieݗ4(NjfovY޸?ҟ>BJJ._Е;GkBKGQLkc^Pʱ2qVMyWIOhKgR$VЖnhTsj5B?^^߷i;]9`5w :!n1 _ozGbIENDB`sigviewer-0.5.1+svn556/src/images/icons/previous.png000066400000000000000000000024361154433734200223270ustar00rootroot00000000000000PNG  IHDRĴl;gAMA a pHYs B(xIDAT8}Yh\ev$N1Ium]qu!J BEnmA ⃂ jښK&Lf{>8o8sxѿa Xy80|lebܱ@xx``NajYrNBQ^^fbSp|p~`Z>1J eex:*_x?2 y`W}%>vF -ZKRi%ӕ?~&6M#5=' >̭ a0R 6a+EWJϡ#vpݹyu0KyEX~hړ -64"E'7 :(cfj-gCn8+/Awn:̅.9C֝\ /m!ɶ-jH!폇C;@ޞ%XjYG+N XA;6ociT=^hWP3VEKoLrn~_cYGݜ/@_:H"wS53}ѵZ{ޕKJ""<rwC{ 0>Lyˡ=sV8Vc0uu-@Öw1TtPieZ1QH{j`LhX((N(5bJ!+g5iJÅ7bdQzkꡣܴ1Z̡ʼCʁE /,3SRyfWmJH|-I)I5p\n+b&4-DQBymS噝RMUkL#}o$D6wFmou#gr)酚#3+RZk51_H噭ʹOMpj'E?}GWqZV,fZ;sԢg2sKu20I[J h9KhK)Z6Y(#W`8iZW>t6ә:S-) Va[<ُ~ ɝ^H@ g(KIn33IENDB`sigviewer-0.5.1+svn556/src/images/icons/redo.png000066400000000000000000000013401154433734200213750ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  ~tIME 48vD)mIDATxKa?tf+Kkݬ @rEbEDA/@wUT uMDo7܂tν}Д%"s8yLd;LfKB5u>nJ3Y3Ȝ}wg{},1xdwƩWPUa+$av&DdQjE(wnPy~E5ovaxtoJ\hBc?ʞ}+z:gBwUC{Mt.(HrPHGQuJqN2ԙMn/!ɭHrH]L#P[.\%+ o'^pٓ#n.m^>*H*rоRz4b=yw,W=:Xl`Y4tf)_\;l h.Xb$u5 dr~k$J%4L]t:7"S?pS,h-*.@=(D'nR"%a!])}0uubdZݖ^5$A$ȦtIENDB`sigviewer-0.5.1+svn556/src/images/icons/undo.png000066400000000000000000000012531154433734200214140ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  ~tIME 7"8IDATx=hawIsicZ$"MѡAD.{GRqs9(%.nP\[cl.܇CJҦZy}^<#D)= .`J%TˉrbP'Og |WJc\85l;Fs ĘS*s`#w\ aqL'ĽKGu$lN'ήmUB8W%sU-8pq1}O n|+c%_|+ -R.* P6dff?ñ={HbD@(MZyHvQ71W2l2BO8$w}OIEo3’efd(pi£4m'Zw"P^96h Vd #7;Fi9n%E.A{w+khUr_+`0"{㙦KHf0Lv)Vm+EȮɭSO1̾KhXxl/^5t0A"S!/IENDB`sigviewer-0.5.1+svn556/src/images/icons/zoom_fit_event_horizontal.png000066400000000000000000000024141154433734200257470ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME ."}IDAT8ˍ[lTEs9{tۥ@r-B 00oUHxny1 &1`xZ%DT@4D)ZB/ -kp %%}g柌ع|f&,0h%0.U5.ʦT L6UTVc`DZRIgX%rC9ɮS`˖˭9_A>F);#R}LƬvbÆN=dA߇Nף#8\Юy80C  q6J-m~ػLX:yӚ2"4$V## !4Yh-:~gmzD "$fY[>R !tHQJ b)5RJyT'" :́іF`mLZDJ1N#O2m5"^;tOQJa)eYƧ5 b黽[ݩ^ m[tGeC{bbֱ#I2m&EG^٪j zZGoo/0a~ aryfxɆp +Mh9==·s"%V3nt_`ZvN6W/DJTpE,)xzÕ]#$e]^H__+V(OvW=[yDU#@n5p'էnƪ;^0wRdMřdٚs8Wsgq""07VFNj^Mt:lEKBR$Kawv*CJkQ4qdO֏IENDB`sigviewer-0.5.1+svn556/src/images/icons/zoom_in_horizontal.png000066400000000000000000000021741154433734200243750ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME / >eIDAT8˕]lU3;3;(Tb&`@CpѪ$$"xA xh#Q Dk- RY1 --hwۙEҒꛜL9o9h߾#K-+Y@Ą4 Z OUOo.@pMb}d ÞC8umސ+S0ۄ)g {[apbyѨG(QJ<P=0d: 6mJ,uǩSM%8N)%~@:eqv USy.Ep%]ݔN,/d= +oH<.s~4>aRJPPZ>|RXEHkBZ%z{F5jyB ۶`` ecj+Gr6b%.8JE}jظL߽K= | `0A@|O1XXR-g=g=uJ'OBkV>}EU**Pj_[ڬsPsϡ;{ѢWPҲK•J @rB=w#-\.W32*UGNzM.uy]#8ʂ/ww6o0ͦ7ea=389vȤ=yvI^3d66#Q[0;x9|s۰'L" SqEhEFeoGS]%Z:]|T)d/ys0MP D%, e$'('_aRmD RL!2 t!Zk-q |rVi)R!5#+p3d `*o50@<9mpB6i X$kJ% )%Zk*A@>_,^y}OR.Q|J)L0M0 +#dz:7FǏ\>qwR, 4MA@!Kbn$kbțg7x+V$d[T} >IJeI[CWÞ3-,_(ΥВ)ty1_wK7|P\{ r7)v/mgvQq8=ɗ\QW*^IȔbã#|IENDB`sigviewer-0.5.1+svn556/src/images/icons/zoom_out_horizontal.png000066400000000000000000000021361154433734200245740ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME &b]IDAT8˭}hU?umeRj1m&?bF!H.̌_Z6!(e&r[޻۵v3 s999`vڿ0X1WH_|.z9M/įljBI% c! \o#uf!Bl߾(k*BLSpyܝ@gFv;ͱE uh"  :ض #pΚܪv]7-Rzp8c[(!l&| M=mt OˬVaضc[ajK }%[3kQp YR2 HRT˶LǶ| QYB)ˣ)qm PC)\R22 ydkc)dqH  ,s9h)R>G:=^H)4F>Gi빤s9RJa֘Z8wd2/ J\2p=\o9P 0Zu1ݢdR,=a?OES=GU]犂?>8|=_msy>>>yyĩ~Áb`;>XdF. )TGv?55󨪺re/ם|%;w-/^1Ps̒j 9}Lw>o|x,F"XmzO!F]p:ra5U=W9r~=#*c]ſՒ`z{? IH#GזV*@LWt6<mz]i+zwWRٴ5jC+|D_h:p1z~EKcC4[dg:^bkf=1Ǒ-{q({MIENDB`sigviewer-0.5.1+svn556/src/images/icons/zoom_out_vertical.png000066400000000000000000000022071154433734200242130ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME 1aZcIDAT8˭MlTU{ιR`  bXCQRӘ($27$!"5@@\,%h e*4m3(G{=Ow ĉ`tB{% Ϡ͛7.r/f۫L8 ;^(umTUlvTkC\=5pȧ)3$-q0RW}LDJI>gtD;^]Spb߾t*-qK ,KoYFS{8 0 ~(NoIi8cu]a RP!rqT$KPLo:a[&J RJcc[&B`Zk-qB.ش$RJ `*'/2HiF0WRilvul@,!leR(!B ź`166~}LLNS)WJ>r)%Rd~%+.1mkq+3yڕlۤ==SSJlD)E~csw\WT8& |y}@kkX, I<|.5{7:I4ݴ[ATUJqL?g`͚$r0+8S{hϲ*{ƣM k*K?ҭSǒQ&FmFU2q⛺0Yq?|%oO뼿IDl%Q1Ȏ&[g/>0B i-MoMi|¥\:?DOwti^L<L=ZS8/S]ڰ>~nJܺx}Gom7[_o%|v]Rk0)˵>txIENDB`sigviewer-0.5.1+svn556/src/images/info_16x16.png000066400000000000000000000016501154433734200211350ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  d_tIME %9tEXtCommentCreated with The GIMPd%n IDATxeMh\eΝ;3ɤI̤FMZSVP'J PӅ.EnE•l "]KR`6`(EZCM:!3M&sHZ=r8G|12~ܖ@-J+կݱ7}{^l7n}׏va.j$8e& _>nZ?;28"a4[[SXa=F+xgLng>4(GG_z᩽M)rJHY)p*1G=];_:IW > Cp"{i(UPJst\=.^~'=݃\ODbpQk-RJ(DJHP~\S`yR"{z[ٿ+GkKuԣɃ=]o*V dbGl\V"r FKtR !@RHၵ8kY)d-sn4TRaA͢O=0a4Rk\VqA6{R|`̓ʟ B5$^/e`a,a%tygϾ@+7PO(hxDO~Bq"ly'Njp4\*@D`Sx8 2vʨ1`:qpr = x14]k0λ0@Db "SEX]B`.v R5 "(UmpJ+ϐBT4]ⱉc(!Nb=N;QrwQ1 4Fev:QDZӎz?VpVFi!7gw\.$[[nplI:>C"33Bz8""ͫVcr@'Ouvhu]nSּfC*"=Fr_>VyG;sk͆asҳ@?Ծ(}'Deh(68D'1yozF7}纋 IﮰJ`1?8و3ۿIENDB`sigviewer-0.5.1+svn556/src/images/patient_16x16.png000066400000000000000000000016241154433734200216470ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME 6/k8!IDATxKoggL=v\l(uȎZ**,ZDiE+XX!T-K6͆ JU*(8$4IC'd=2nR[,_}t!xɜ??AtVWWk.wE.}G&n7˶f z.ʕa ;;EQ! W r=TG.øNܨ 64M$!;T`Y`?44A.`PE=pUin5eP(lBU,N<ϢTRp}+Eø> _n7 AaHBA`iHd, ضן gSa6VA&,Bax6>iڒ,Vih6ph&kEBdд4Hd}AG]o>25iǏϢpZF>_FRT4X[X.ggGǨW_?.qo[0]M\4M^wXZ:w 66žG5'~l4 M˳!|(ꘟT.%Ǐ1Uoܸw C>7p8CXYx,eJ V/v|yјimd2j"q/}O?R3ϯ确7x29{se׻Pǎ} f޿=f,vW <IENDB`sigviewer-0.5.1+svn556/src/images/pointer_22x22.png000066400000000000000000000007071154433734200216560ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYsLL{qptIME  .ɛGIDAT8˭jA]V">a;hm/9i=5pWz)5WjqV>v(x)e``aٙ@[VJ$VJ=%dTt:y^BVIpi=4.\f\f]{S`kF7A\Ul6v6LÐRyTU c6U8CEmrvh\x EXuK;3fwX,(T*Ux2?1"uEbH@ A!sB2ddɾw3U3;k;vK O[6?Q]OT3zBvĤd)f,jnq9wb7>_ẞʵKPq>~ &p]>}޺_ᔔ. հryzm/#&a{U _•O1)8w*,1z·x_dҳu/,,?,͔b4:Jq;x͌t!bfۈ{+;e2}Ƚ1bH4˖:p|ҤI{9g~8HL &koq>d< js}=u飹Ǐ8ܝ~q7vՑW5ogN;Nց>~H\'x$#M*Xk1b׎׸)Q] vʋ? /wi5}wĕcys<0k/ d_^'1@ӳxu҃77MPRN&4kd[?JudZ v/1;tF,Fa02yh7 # ;좹Ph ]HDrs:>̆ޕfq .nzc4 u F,{/>AmpWT{`v^rm/KC忁-"VVr::uXxv4A Ը8-|-yRkUiq:<6vo\BpRk`6\ba}UŦ˝jmG6m `zMKhmpR &Z0"tGpS5l64 mFpȖ93q|1B!b*'XV?"K\#E@7!n5"Tih2@k-8BS/07FR @!lS=13Ac ;>1b)CDIP݅2۱"OƄ#_;^'Z Zɲf@ұ4O64@TD\>S̃,%La#Mch@=LD)M+| bq# w$Pݛb#Y|R ei{7r Ww3!ՑBG[k婢$[jan͋+m[ڶ薵 4 a!M8W * zE!p#XA&8zr`e8jA>\|\<IS^gnuz|vqi`VL@6,# #0=KYfqz666555___\\\|||||||||瘘{{{|||ddd]]]III444|si\OA3&  !0@P`o{@@@]]]|||扉󖖖{{{bbbIII'''~seUD3% &9M`q~KKKjjjن󔔔qqqQQQ'''udR>, ';RhzRRR~~~쒒```'''oZD/#9RjIII}}}쐐XXXs\B* /JfZZZLJfff111oT8 7X~ZZZņrrr}bC& ;_@@@[[[ lJ);kmmm؈|||$$$pJ& 3fwww熆AAAkB $Y{{{@@@^17vvv⃃$$$uGcccoooY) (((2{{{AAAe1 ```y}}}bbbi3 mmmuuue1sssǘyyyY) nnnsssHlllg}}}ccc2UUUrrr|||PPPllllll& ccclllћnnn>>>QPPPkkk𑑑lllUUUxaaa"hhh}}}gggXXXsZZZggghhhrrreeeHHHC cccRfffpppyyyfff]]]444ZZZbbbcccdddxxxddd___OOO=ZZZ```bbbcccvvvcccccc^^^RRRJ ---"TTTm]]]aaaaaattt|||aaaaaa]]]VVV5559 $-3677777777777777777777%%%RHHHbbb{{{qqq___\\\ZZZPPP<<<=977777777777777777777750' -@R_imooooooooooooooooooooorRRRyyyfff+++wpoooooooooooooooooooooomkcWF3 $>ZoXXXxxxddd uaH-)Ii...hhh}}}昘lll???sU5(L###☘???|Z4 !FVVVlll|U,8ZZZqF $WWWlll_0$$$?555rAvvv~P#,,,Z* ZZZL^^^_- vvvvzzz`. }}}zzz`. }}}пϿϾννͼ̼˻˺ʹɹȸȷǷƶŵŴijó²ӿҾҽѼмкϺιθͷ̶˵˴ʳʳɲȱǰǯƮŭĬzzz`. }}}yyy`. }}}xxx`. }}}d$e&g(j*k,m.o/q1s3u5w7y8{:|<~=Ҁ?ӂAԃBՅDևF׈G؊IٌJڍLۏMܐNݒPݓQޔRߖTUVWXXYZZ[[[\\\\[[[ZYYXWVUߖTߕSޔRݒQܑOېNڎLڍKًJ؊H׈GֆEՅDԃBӁ@>}=|;z9x8v6t4r2p0o/l-k+i)g'e%c$a"_ ][YW۪xxx`. |||b#e%f'h)j+l-n.p0r2t3v5w7y9{;}<>Ҁ?ӂAԄCՅDևF׈G؊IٌJڍKۏMېNܑOݒQޔRޕSߖTUVVWXXYYYZZZZYYYXWWVUTߖTޔSޓRݒPܑOۏMڎLٌKًJ؊H׈GֆEՅDԃBӁ@Ҁ?~=|ҁ@ӂAԄCՅDևF׈G؊IًJڍKڎLۏMܑOݒPݓQޔRޕSߖTߖTUVVWWWXXXXWWWVVUߖTߕSޔSޓRݒQܑOܐNۏMڍLٌK؋I؉H׈GֆEՅDԃBӁ@Ҁ?~=|<{:y9w7v5t3r2p0n.l-j+i)f'e%c#a"_ ][YWU۩vvv`. zzz`!b#d%f'h)j*l,n.p0q1s3u5w7x8z:|;}=>ҁ@ӂAԄCՅDևF׈G؊H؋IٌKڍLۏMېNܑOݒPݓQޓRޔSߕSߖTߖTUUUVVVUUUUߖTߖTޕSޔRޓRݒQܑOܐNۏMڎLڍKٌJ؋I׉HևFֆEՅDԃBӂAҀ?>}<{;y9x8v6t4r2q1o/m-k,i*g(e&d$a"`!^\ZXVT۩vvv`. zzz_ a"c$e&g'i)k+l-n.p0r2s3u5w7x8z:|;}=>ҁ@ӂAԃBՅDֆE׈G׉H؊IٌJڍKڎLۏMېNܑOܑPݒPݓQޓRޔRޔSߕSߕSߕSߖTߖTߕSߕSޕSޔSޔRޓRݒQݒPܑOܐNېNێMڍLٌKًJ؊I׈GևFՆEە^崌䲋ؒZ>}<{;z9x8v6u4s3q1o/m.l,j*h)f'd%b#`!_ ][YWUSڨvvv`. xxx^`!b#d$f&g(i*k,m-o/p0r2t3u5w7y8z:|;}=>Ҁ?ӂAԃBՅDՆEևF׈G؊H؋IٌJڍKڎLۏMۏMܐNܑOܑOݒPݒPݒQݓQݓQޓQݓQݓQݓQݒQݒPֽߜbۏMڎLڍLٌKًJ؊I׉H׈GևFՆEԄC}<{;z9x8v6u5s3q1p0n.l-j+i)g'e&c$a"_ ]\ZXVTRڨuuu`. xxx]_ a"b#d%f'h)j*k,m-o/q1r2t4v5w7Ǭȭ}=>Ҁ?Ӂ@ԃBԄCՅDֆEׇF׉G؊H؋IٌJٌKڍLڎLۏMۏMېNܐNܐNܑOܑOܑOܑOܑOܑOܐNġ龙ڍKٌKًJ؊I؉H׈GևFֆEՅDԃBӂA罝z9x8v6u5s3r2p0n.l-k+i*g(f&d$b#`!^\ZYWUSQڧuuu`. xxx\]`!a"c$e%f'h)j+l,m.o/q1r2t4۞q଄}<~>Ҁ?ҁ@ӂAԃBՅDՆEևF׈G׈G؊H؊IًJٌJ䯀ێMێMێMێMێMێMޚ`؋I؊I׉H׈GևFֆEՅDԄCԃBӂAߦxx8v6u5t3r2p0o/m-k,j*h(f&d%b#a"_ ][YWUTRP٧ttt`. vvv[\^`!b#c$e&g'i)j+l,n.o/q1r2{;|<~=>Ҁ?Ӂ@ӂAԃBՅDՆEֆEևF׈G׉H}ֿٌKٌKٌKٌKٌKٌJ齘׉G׈GևFֆEՅDՄCԃBӂAӁ@Ҁ?v6u5t3r2p0o/m-k,j*h)f'e%c$a"_ ]\ZXVTRPO٦sss`. vvvY[]ܪݫެ٠xj+l,n.o/q1Ǭ溘~>Ҁ?ҁ@ӂAӂAԃBՄCՅDՆEևF浌؊I؊H{ՆEՅDؑXxߥw؏UҀ?>ɮЄKⴓӎ[m-k,j*h)f'ޭܩ\ZYWUSQON٦qqq`. vvvXZ[ɱzzևFĦԾ~=}<Ƭͷg'v>ϋ^ҔmTRPNLإqqq`. vvvVXZһՅD̲ȭȭv6v>伡˄YQOMK ؤqqq`. uuuUWY䱈ؐVåƫu4ç伡ONLJ פqqq`. uuuTUWḝ~E˰嶑Ҁ?ژcԊPt4s3ρHNLJ I ףqqq`. sssRTVj3_ a"b#d%l-¨ЂIлѼ۞q廛ܟrՋSՌSԾ}<ՋR帖y8廛r2q1p0zB}LλɁUMK I G עppp`. sssQSTVWΉ\ܬϋ_^_ a"b#Ґck+l,֗iⶖטkp0q1ЂIԏ[ЃKu5v6w7ⱌܡs{;{;|;ӽӾݢt{:{:帖w7w7v6ؚlp0o/n.౏㸚g(f&v=ҏbYWƱŰPOMK J H F֢ooo`. qqqOQSTVWY[\^_ `!b#i)j*k,l-m.n/p0p0q1r2s3t4u4ЄKx8y9y9y9ӉOה`ӉPz:y8x8x8۞q庚ڝpu5u4t3ʳo/n.m-l,k+j*h)g'f&d%c$a"WUg/sBc,OMKJ H F E֡nnn`. qqqNPQSTVWYZ\]_ `!㻠g'h)i*j+k,l-m.n/o/p0q1r2s2s3ڜnv6w7w7w7w7w7x8x8ⱍv6v6v5u5u4t3s3r2q1㷗ⶖm-l,k+j*i)g(f'e&d$b#a"`!ů{IUTRQONLJ H F ECՠnnn`. qqqLNPQSTVWYZ\]^ r:e%f&g(h)i*j+k,l-m.n.o/p0p0q1r2r2s3s3t4t4u4u5u5u5v5v5хKt4t3s3s3r2q1q1p0p0טk֖ik,j+i*h)g'f&d%c$b#a"_ ^ϋ_vDTRQONLJ I G EDBՠmmm`. oooK LNPQSTVWYZ[\^㼢佣c$d%e&f'g(h)i*j+k,l,m-m.n.o/p0p0q1q1r2r2r2s2s3s3s3s3s3ĩr2q1q1q1p0o/o/n.m.l-l,k+j+i*h)g'f&e%d$b#a"`!_ ]\[g/RPONLJ I G EDB@՟lll`. oooI K LNPQRTUWXZ[\]_ `!a"b#c$d%e&f'g(h)i*j*k+k,l-m-m.n.n/o/p0p0p0p0q1q1q1q1q1¦p0p0o/o/n/n.m.l-l,k,j+j*i)h)g'f&e&d%c$b#a"_ ^]\ZY٦̺RPONLJ I G EDB@?ԟlll`. oooH I K LNOQRTUVXYZ[]^_ `!a"b#c$d%e&f'g'h(i)i*j+k+k,l,l-m-m.m.n.n.n/n/n/n/n/~FȰn.m.m-l-l-l,k,j+j*i*h)g(g'f&e%d%c$b#a"`!_ ]\[ZXWVh0tBd-POMLJ I G EDCA?>ԟkkk`. oooFH I K LNOPRSUVWXZ[\]^_ `!a"b#c$d%e%f&f'g(h(h)i*j*j+k+k+k,l,l,l-l-l-l-l-l-l-l,l,k,k,k+j+j+j*i*h)h(g'f'e&e%d$c$xB؟yמxv@^\[ZYXWUTSQPOMKJ I G EDCA?>>ԟkkk`. oooEFG I J LMOPQSTUVXYZ[\]^_ `!a"b#c#d$d%e&f&f'g'g(h(h)i)i*j*j*j*j+j+j+j+j+j+j*j*ǯyAh(g(g'f'e&e%d%c$b#a"a"\[ZXWVUSRQPNMKJ I G EDCA?>>>ԟkkk`. nnnCDFG I J KMNPQRSUVWṟ⺠[\]^_ `!a"a"b#c$c$d%e%e&f&f'f'g'g(g(g(h(h(h(h(h(h(g(߮ܨf&e&e%d%c$b#b#a"`!`!_ ܬYXVUTSRPONLK J H G EDBA?>>>>ԟjjj`. lllACDEG H J K LNOPQSṪZӖoZ[\]^^ _ `!a"a"b#b#c$c$d%ӑeӒee&f&f&f&f&e&v>c$c$b#b#a"`!`!_ ^]ϋ`WVUSRQPOMLK I H F EDBA?>>>>>ԟhhh`. lll?ABDEF H I K LMNPQRμXYZ[[\]^^ _ `!`!a"a"Ӑdʳj*j+l,l,l,l,ޫh)h)e&e&b#a"^]\[UTRQPONMKJ I G FECB@?>>>>>>ԟhhh`. lll>?AӚzԜ{ԝ|΍fK LNOPḞڧZZ[\]`"d%g(i)k,᱐ۤ{n.n.ѽ֗jl-l,{CՕgՔgzBh)e&佣f.أпtDMLK J H ԝ|Ӛz@?>>>>>>>ԟhhh`. jjj>>?⽥ޯϽ֗jטk᳑p0亝θk,k+徤޴޳H [$wLɅ_>>>>>ԟggg`. jjj~~~>>>̵r2ū¨j*[$ܯvK>>>>ԟfff`. jjj~~~>>>ިЃK潟l,濤ۯລ>>>>ԟfff`. hhh~~~>>>ڬi2Ǭᰋv6֐]ЂJo/n.}D຤>>>>ԟeee`. hhh}}}>>>S?@BCi*~EϹкٚm丘ڜn҇N҇NҼx8҇N䶔v5乙q1p0o/zBg7ƴvJ>>>>ԟeee`. hhh}}}>>>>>vJӞvJ>?@AxMk,l-חjⶖטkp0q1ςIԎ[ЃJu4u5v6᱌ܟrz:z:{:ӽӽܡs{:{:帖x8x8w7ٜns2r2q1᳑亜l,k+zBԓf>>⾪⾪>>>>>>>ԟddd`. hhh}}}>>>>>>>>>>>F ]m-n.o/p0q1r2s3t4u5v6w7w7x8ӈO|;|<|<}<ՋRٖcՋS~=}<}<|<ܢs漜ܡs{:z9y9̴v5u4t3s3r2q1p0o/m.l-k,j+ëI >Sc2S>>>>>>>ԟddd`. gggvvv>>>>>>>>>>Rg(i)濤o/p0q1r2s3t4u5v6w7x8y8z9z:{:ܢs~=~>>>Ҁ?Ҁ?Ҁ?Ҁ?嶑>>~>~=~=}<|<|;{;漜廛w7w7v6u4t3s2r2q1p0n.m-l,ʳ΅Tc$V@>>>>>>>>>ԟccc`. gggvvv>>>>>>>>A\h(i*j+|Cq1r2s3t4u5v6w7x8y9z:{:|;|<}<~=~>>Ҁ?Ҁ?ҁ@ҁ@Ӂ@ӂAӂAӂAӂAؐVӁ@Ӂ@ҁ@Ҁ?Ҁ?>>~=}=ݢtܠsz9x8w7w7v6u4t3r2q1p0o/n.֖ḯPd%c$_ G >>>>>>>>ԟccc`. eeeuuu>>>>>>>Fa"h)j*k+l,m.èér2t3u5v6w7x8y9z:{;|;}<~=~>>Ҁ?ҁ@Ӂ@ӂAӂAԃBԃBԃBԄCԄCԄCՄCՄC˰ԄCԃBԃBӂAӂAӁ@ҁ@Ҁ?Ҁ?>~=}=|<|;{:z9x8w7v6u5t4s3r2q1p0n.x@f&e%c$a"K >>>>>>>ԟbbb`. eeettt>>>>>>Fd%h)j*k+l-n.o/p0r2s3t4u5w7x8y9z:{;|;}<~=>Ҁ?ҁ@Ӂ@ӂAӂAԃBԄCՄCՅDՅDՆEֆEֆEևFևFևF˯ֆEՆEՆEՅDՅDԄCԄCԃBӂAӂAҁ@Ҁ?>>}=|<|;{:z9x8w7v6u5t3r2q1p0Აi*g(f'e%c$a"O>>>>>>ԟaaa`. cccsss>>>>>Fd%h)j*k,l-n.o/q1r2s3u4v6w7x8z9{:|;}<~=>Ҁ?ҁ@ӂAӂAԃBԄCՅDՆEֆEևFևFևF׈G׈G׈G׉H׉H׉Hۖ\ҹ׈G׈G׈GևFևFֆEՆEՅDՄCԄCԃBӂAӁ@Ҁ?Ҁ?>}=|<{;z:y9x8w7u5t4s3q1p0FщV|Ck+i*h(f'e%c$a"M>>>>>ԟ___`. cccsss>>>>Cd%h)j*k,l-n.p0q1r2t3u5v6x8y9z:{;|<~=>Ҁ?ҁ@ӂAԃBԄCՅDՅDֆEևFևF׈G׉H؉H؊H؊I؋I؋IًJًJًJًJًJًJًI؋I؊I؊I؉H׉H׈G׈GևFևFՆEՅDԄCԃBӂAӁ@Ҁ?Ҁ?~>}=|;{:z9x8w7v6u4s3r2p0o/m.l,k+i*g(f&e%c$a"K >>>>ԟ___`. cccrrr>>>>_ h)j*k,l-n.p0q1r2t4u5w7x8y9{:|;}=~>Ҁ?ҁ@ӂAԃBԄCՅDՆEևFևF׈G׉H؊H؊I؋IًJٌJٌKڍKڍKڍLڍLڍLڍLڍLڍLڍLڍKڍKٌKٌJًJ؋I؊I؉H׉G׈GևFֆEՅDՄCԃBٔ\䲋㲋בZ~=}<{;z:y9w7v6u4t3r2p0o/m.l,k+i*g(f&d%c#a"D>>>ԟ___`. aaaqqq>>>Rh)j*k+l-n.p0q1s2t4v5w7x8z9{;|<~=>Ҁ?Ӂ@ӂAԄCՅDՆEևF׈G׉G؊H؊IًJٌJٌKڍKڎLڎLێMۏMۏMېNېNېNېNېNېNېNռޚ`ڍLڍKٌKًJ؋I؊I׉H׈GևFֆEՅDҀ?~>}<|;{:y9x8v6u5t3r2p0o/m.l,j+i)g(f&d%b#Z>>>ԟ___`. aaappp>>Cg(i*k+l-n.p0q1s2t4v6w7x8z:ȭɮҀ?ҁ@ӂAԃBՄCՆEևF׈G׉G؊H؋IٌJٌKڍLڎLۏMۏMېNܐNܑOܑOܑPݒPݒPݒPݒPݒPݒPŢ뿚ېNۏMێMڎLڍKٌKًJ؊I؉H׈GևFҀ?>}=|<{:y9x8v6u5t3r2p0o/m.l,j+i)g'e&d$b#O>>ԟ^^^`. aaappp>>Xi*k+l,n.o/q1r2t4v6w7x8z:ݡt㯇ӂAԄCՅDֆEևF׈G؊H؋IٌJڍKڍLۏMۏMܐNܑO求粄ޔRޔRޔRޔRޔSޔReݒPܑOܐNېNۏMڎLڍLٌKًJ؊I}ӂAҁ@>~=|<{:z9x8v6u5t3r2p0o/m-k,j*h)f'e%c$_ @>ԟ^^^`. ```nnn>Ci)j+l,m.o/q1r2t4u5w7x8z:|;ԄCՅDևF׈G׉H؊IًJڌKڎLۏMېNܑOܑOݒP粄ߖTߖTߖTUUTÝޔRޓRݒQݒPܑOܐNۏMێLڍLٌKԃBӂAҁ@>~=|<{:z9x8v6u4s3q1p0n.m-k,i*h(f&d%b#M>ԟ\\\`. ^^^mmm>Qj*ఏᲐ᳑ިw7x8z:{;}<ً̱IٌKڍLۏMېNܑOݑPݒQޓRޔRȥ쿕WW贆ߕSޕSe求求ߝcܐNۏMдْY轛ښg~=|<{:y9w7䶔᳑n.l-k+i*g(e&d$[>ԟ[[[`. ^^^mmm>_ k+Ϸɪ贅贆ʧYίݒPܑOϴԽɮȭ{:ӈOؙlڡyh)f'e%c$Cԟ[[[`. ^^^lll>j+l,[ֻҷҶڎLԊQƪՕhg(f&d%I ԟZZZ`. \\\kkkDk,m-™mбѵېNβǬʴi)g'e&QԟZZZ`. \\\jjjI l,n.ڔ[׼Ȣ^|jݒQܑOߜbʳj*h(f&QԟYYY`. \\\jjjI m-o/ρHz9{;}<>׉Gγߜb赆˪귈pq`q˨ZͫޔRݓQܑOܗ\Ͳؕb֖ik+i)g'RԟYYY`. ZZZiiiDn.p0q1s3ڝo庚ܟq{:|<~=Ҁ?ߥw؊IٌJƥ氁ݒPޓRfuiWXYƠ`ab￐baΫ]\[赆ߖTޔRݓQġȪ؋I׉Hڔ[zz9x8Ѽкq1o/m-k,j*h(RԟXXX`. ZZZiii>o/q1r2t4v6x8z9|;}=>ҁ@ӂAًJڍKۏMܐNݒPޓRޕSߖTVWXZ[nabccuvedccѯ_^]VUߖTޔRݒQܑOېNڎLٌK؋I׉HևF͵{:y9҆MՐ\ЃJr2p0n.l-j+i)MԟXXX`. ZZZhhh>g'q1s3u5w7y9{:|<~>Ҁ?ӂAԃBʯٌKڎLېNܑOݓQޕSߖTVWXZ[\^cdeefgggΧfeddcba`_ϭͫXVUߖTޔRݒQܑOۏMڍLٌJ؊I׈GӼڙf|;z:x8v6u4r2q1o/m-k,i*FԟVVV`. YYYggg>[r2t4v6x8z9|;}=>Ӂ@ԃBՅDړZڍLۏMܑOݒQޔRߖTUWXZ[]^`abcdefgghiiizhgfeedba`빊YXVUߕSޓRݒPܐNۏMڍKًJ׉H{ڗc|<{:y9w7u5s3q1p0n.l,e%>ԟVVV`. YYYfff>H s3u5w7x8{:|<~=Ҁ?ӂAԃBՆEևFͲϴۏMܐNݒPޔRߖTUWXZ[]^`abcefghhijkklljihgfedcb`_^\ZYWVߖTޕSݓQܑOېNڎLٌJ؊I׈G֍S}={;z9x8v6t4r2p0n/l-W>ԟUUU`. YYYfff>>f'v5w7y9{;}<>ҁ@ӂAՅDֆE׈G؊IٌJڎLېNܑOݓQߕSUVXY[\^`abdefghikllmmnnmlkjihgfdcb`_]\ZYWUߖTޔRݒQܑOۏMڍKًJ؉H鿝Ҁ?~=|ԟUUU`. WWWeee>>Lv6x8z:|;~=Ҁ?Ӂ@ԃBՅDևF׉H؋IڍKۏMܑOݒPޔRߖTVWYZ\^_abdefhijlmmnoopponmlkjhgfdcb`_][ZXVUߕSޓRܑOېNڎLٌJ؊I׈GړZݜgؐVҁ@>}<{;y9w7u5s3q1p0Y>>ԟUUU`. WWWddd>>>b#x8{:|<~>Ҁ?ӂAԄCՆE׈G؊HٌJڍLېNܑOݓQߕSUVXZ[]_`bcefhiklmnopqqrrrrrqpponmljigfdca`^\[YWVߖTޔRݒQܑOۏMڍK؋I׉HևFՅDԃBӁ@Ҁ?}=|;z9x8v6t4r2m-A>>ԟTTT`. WWWddd>>>Br2{;}<>ҁ@ԃBՅDևF׈G؊IٌKڎLܐNݒPޔRߖTVWY[\^`acefhiklnopqrsstttttsrrqonmljhgedba_][ZXVUߕSݓQܑOۏMڍLًJ؊H׈GՆEԄCӂAҀ?~=|>>ԟTTT`. UUUccc>>>>I x7}=Ҁ?Ӂ@ԃBՅDևF׉HًJڍKۏMܑOݒQޕSߖTVXZ[]_abdfgiklnoprstuuvvvvvutsrqpnmljhgecb`^\[YWUߖTޔRݒPܐNڎLٌK؊I׈GֆEՄCӂAҁ@>}<{:y9w7u5\>>>>ԟSSS`. UUUbbb>>>>>U~=Ҁ?ӂAԄCՆE׈G؊HٌJڍLېNܑOޓRߕSUWXZ\^`bceghjlmoprstuvwxxxxxwvutrqpnmkigfdca_][YXVߖTޔSݒQܑOۏMڍK؋I׉HևFՅDԃBӁ@>}<{;y9w7a">>>>>ԟRRR`.SSSaaaiKiKiKiKiKiK|X…TÇVĈWŊYƋZǍ[Ȏ]ɏ^ʑ_ʒa˔b̕d͗eΘfϚhЛiќkўlҟmӡoԢpդq֥rצtبu٩v٪xڬyۭzܮ{ܯ|ݰ}ޱ~޲߳߳ߴߴߴ߳޳޲ݱ~ݰ}ܯ|ۮ{ۭzګx٪wبvקu֦s֥rգqԢoӠnҟmѝkМjϚhΙgΘf͖d̕c˓bʒ`ɐ_ȏ^Ǎ\nj[ƊZʼnXćWÆU…TRQPWiKiKiKiKiKiKϴQQQ`.TTTaaaQQQ_- UUUaaaQQQZ* WWWaaaRRRP#VVVjaaaSSSASSS7aaaoooEEE0___└aaa+++j\\\hhh[[[.PPP```𔔔aaa@@@v\\\SaaahhhWWW^^^aaahhh\\\'''' ]]]saaa}}}aaa[[[...![[[2___aaavvvhhh___WWW{ ^^^A___```aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa```]]]YYYgBBB????????(@    "0=JV^fiiiiig`WL?2%  5O m(((:::MMM___kkkuuu}}}|||||||||||||||wwwlll```OOO999&&& hR9!,T$$$JJJjjj~~~튊~~~kkkKKK&&&xV4 ) `FFFqqqߊrrrGGG`2DHHHxxxꡡJJJ K RjjjңoooR"""ӂAՅDևF؊HڌJێLܐNݑPݓQޔRޔRޕSޔRޔRݓQ鼕tڎLًJ؉HևFՄCݟnڙhx8u5q1n.j*f'b#_ [Ua(/yyyr?^d%g(k,o/r2u5ЂF罜Ӂ@ԃBֆD׈G؊HٌJڍKܗZ꽗寀ېNېNۏM踐؉HׇFօDԃBҁ@Ǭu5r2n.k+h(d%`!\XS_&/wwwo=[s<Օj؝tטko/r2ஈⰉ᫁ӂAԄCՆEևF׉G泉䮀؋I؎QՆGْZӂC֏XІOުs7h(d%՘pڥl5UP]$~~~/wwwm;Xݭ㱇ũϹɰˀNҖq[!~~~/uuuj9UՙrԽä˴шSX~~~/sssh6R\ ݯůb#e%ⶖᲐ̵ԏ[Ĩٛl֓_҄Fȭ幘଄çцNטjl-~J|K㾧yKV}}}/rrre4OUX\^a"מvᴔk,m.o/q1s3u4۠sⱍx8{=уHݣw㴑v5Տ[|Aq1k+i)f'd$a"^ͻR["OES{{{/pppc1L RUX[^d'ڡ{g(i*k,m.n/p0q1r3s3t3t4t4w9ީq1p0n/m-ԓdӑcg'e%b#`!]ZߴߵOK H BPyyy/ppp`.H ORUXZ]_ a"c$e&g(i)k+l,m-n/n/o/o0o0o0Ǯm.m.l,j+i)g'e&c$a"_ \ZWh1ߴr@KH E?Nxxx/ppp]*ELNQTVY[]_ a"c$e%f'g(h)i*j+k+k,k,k,k+j+ۤ~ЉWg(f'd%b#a"ͅVλɀPXVSQNK H EB<Mwww/nnnY(BH K NPSUc)ܫ]_ `"b#b#d$d%q6ۦԒdg'g'f'٠xc$a"_ ^]ḝTRPMJ H EB><Mvvv/nnnV%>Z$ȁWˉaɂVOQԚvԚtђi\`!c$f'h)ڠwיlm-t8j,yBd'r=i4җsUI G Ɇ]ЕtT><Mttt/jjjU#;Ԟ㶖ܣz徣ʳh7ˌiMsss/jjjT#;Ɇ`Ϻ澟ҾɲτOMrrr/jjjT";CԠ຤?H ⵖᲐ˴ӌYçؙj֐]ЁCǬ幖ૃçцNؘkn.΂Nj;߸pEMqqq/gggS";>=>Oe&ۣ{㷗q1s3u5w7y9z:ݣw䴏=҂CՉMz帕}<ٕa҃Gy9t4r2p0n.k,i*̺?LC<Mooo/cccR!;=@Wj*l-q3ުu5w7y9{;}<~>Ҁ?Ӂ@ӂAԃAԃBԃBՆG䳌Ӂ@Ҁ?>}=ܟp۝nx8v6t3q1o/l-弟佢XA=<Mnnn/bbbR!;@Zk+l-o/r2t4w7y9{;}<>Ӂ@ԃBԄCֆEֆEֈF׈F׈G׈GзևFՅDՄCԃBӁ@Ҁ?~=|;z9w7u5r2p0~E濤υSf&ZB;Mmmm/bbbR ;Wk,l-o0s2u5x8z:|<>Ӂ@ԃBՅDևF׈G؊HًIٌJٍJڍKڍKڍKٌJًJ؊H؉GևFՅDԃBӂ@ӄEږc@x8v6s3q0m.j+g(f&X=Mlll/```PI j*m-o0s2v5x8{;㱉ؒ[ԂAՅDׇF؉HًIڍKڎLۏMܐOܑOܑOܑOܑOcϳڍKًK؉IׇFօD绗ǫ|;y9w6t3p0m.j+g(d&MLjjj/^^^R ]m-o/r2u5x8|;ܟoևE׈HًJڎKۏMܑPݒP꼔ߖTߖTߕSֽܑOۏNڍLًJ؊H>|ԃBևF؊I軒iߖTWZ]`cehjkmnnhfda^[XߖTݓQېNٌJ׈G⮃嶓x8u5r2d$Paaa/SSSKI w7}=Ҁ@ԄC׈GٌKېNޔRUY\_behkmoqrrŐѨnlifc`]ZVޕSܑOڎL׊HՅE֋OҁBz:v6t3NKaaa/RRRJ7W}:Ձ>ׅBډF܍JޑMQUY\_dgjmprtuutrqnkgd`]YVRߓOݏKڋG؆Cւ?~;z8w5]8J___/PPPgL_=bA|UY[^`b’eĔgŗjǙlɜoʞq̡sΣvϥxЧzѩ{ӫ}Ӭ~Ӭ~Ӭ}Ѫ}ШzϦxΤv̡t˟qɜpǚmƗjĕhÒfda_\YWTzSdB^=mN]]]/QQQ___*SSSzXXXNNNAAAAqqqvvv,MMM+zzzEEEUCCC"jjj𰰰oooDDD?III&NNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNANNNARRRARRRARRRAIII-??(0` )4=BBBBA90$  "Gi!!!---999AAAGGGJJJJJJJJJJJJGGG>>>666))) pR1F}CCCzzz푑mmm555X$ B:::rrr棣___!!!^XqqqܻVVVy@mmmb ggg333UUUBBB7773 aaaD %333^^^quuu(((F3ABBBB>8Znnnooo,,,L6@BBBBB>) 8999^^^cccbbbbbbbbbbbbaaa```^^^\\\’VVVZZZ___aaaaaaaaaaaaaaaaaaaaaYYY,,,X 2cccX uuu@@@$*;999PC666TȲȰʲ̵ζиѹһԼֽ׿׾սԼҺѹϷͶ˳ɲȰƮĭ俧C666Te)d#k*p/u4z9=ԃAׇEٌIۏLݒOߕRTUVWWUTRޒOܐLڌI؈FքBӀ>{:v5q0l,h'c"^QЈZC333Td)c"j*n.s2w7{;>ՃBׇEيHڎKܐNݑOޓQޔRޕRޔRߙ[氀ܑPڍKًH׈Ft䱊|;x7t3n/j*e&`!\O ΆYC333Tb'` f(k,p0t4ݣwՉNԃBֆE׈GًIܔWǧ沅ۏMۏMѶߟi׈GֆEԃB֓_u5q1l,g(c$^ZM ͅXC333T_$j/ᱎѻ巒繕淑ǩx˯Ŧ缙ߦyθު|Eͺՙri2J ̃VC333T[!i0¢ѽගFʀTC000TWUϋ_ՙqc$ᵕՓe㴔Ր]ݤyӉR֍U¤͵ؕaަ|潞цQ֖i͸υSѿأߴi5C}QC000TTQW[^ xByBk,m.p0r2Տ\ૄv6w8}@фKx;s4Ւa˴k,i)f&c#юaڥUQK ?{OC000TOM RVZ]}If(f'h)k*l-n.o0p0p1p1廝q4n/m-k+i)f'd%a"^b'㽥xFOKG :xLC---TKH NQUX`$xD`!b#d%f'h)i)j*j+j+j+͂Mⵖm0f'd%c$ڣª`#XUQNK G C6wKC---TF DV]%US֝y{Ie,^`!b#{Fಒw=j+ѾψWe'c&a%Pa(PMZ!TB?5wKC---TC R˹κҾʳϺߪл߰îvH޷j;5wKC***TB Jͼѿ̴ߩ߭§٪5wKC***TB<V a2H ڣ~шT֕e}C҉R}@҃Gߧ|㳍֐YħؖeⲎC҉T߫w<彡ůrE~WG 6wKC***TA<>Lf'x=ρHv6x8{:}<ԈMڗcҁ@ӂAӄD֍SҀ?~=בZ㳎x8w6t3q1ҍ\ݩ\F>5wKC'''TA9Ql-o/q1t4x8{;}<Ҁ?ӂAՄBֆDևFׇF׈G䱆âևFֆEՄCԂAҀ@~=|;y8v5u6ۣz{Ci)c$G 3wJC'''T@Pj+n/r2v5{<ӆL?ӂAՅDևF؉HًJڌKڍKڎLڎLޚ`蹑ٍN؊H׈GօD⭂@z:w6s3o/k,h(`!>uIC'''THg'o/r2v6z:᭄ّW׈F؋IڍKۏNߜ`׿꽕ޔRޔRrېNڎLًJܛh>{:w7s3o/j+h(TxLC$$$TŽS{@ɮͰдֽ̭켑ҷ꽖ŧؔ`㷘σO]ʁTC$$$TûZ |@ȣǥսa̅XC$$$T\!t2ד`ݠqр?辜t鹏kgp̧յ}컌̩hwˮޚaӻߩⳑ}Dd!͆XC!!!TVv5z9~>ԃBړYߜcߕSWZ^tᅬfglveb~ѱXTݒPێLv巔{;v6q1e#ʂUC!!!TIu4|<Ҁ?ՅD؊Iݙ]ݓRVZ^behkmnӭlifc_[VޕSܐNڏPڕ_}׆CیHݐLQV[_cgknqrrqolhd`\WSߒN܍I؇DՁ>}:y6m+?oEC!!!TR)P$p@ȅOɈŘVϐZѕ^ԙb֝fסiۥmީqtwz{{zxuީrܦn٢j֞fԙbі_ϑ[͍WʉSȅOƁK~Hd6IeD"""R>-rrr!nnn444~$~~~aaaPPPfff񍍍򀀀JJJ??( @ 6JVXXXO<$ /oEEEfffӄꚚ~~~```<<<x:)AAA껻uuu---B&hhhA^^^999xxxLLL777.:::#^^^ 0WYXPRvYYY:::mMRXXY> ///g򹹹} .?HHHf'''bJJJmܪ߫ⱌ䵐渓軖꿙ğƠơơŠĞœ꿙軖巒㳎ொݫܧנ{ݯ(((dIIIl^`j&q-w3}9׃>ډCݍGސJߒLߒL[ޔRۉDׅ?ޝhҀ?q-j&c \O l5&&&cFFFlc'u;ЄNr3Ȯ嶒׍RׇF؊HͰ踏ܖY،MՈJ滛ЃKl,τRd'Sp<&&&cFFFl]#оɯ˄Xl9&&&cDDDlXm6yDӐcזhԍZ҆Mޤx⯉ᭆ֐[y=ީ͂Oۨ՛vTg5$$$cBBBlRPY_!Ԕif'j+n-p0q1r2ު¦p0m.~Gg(c$^൚tCNBc0$$$cBBBlKJ RW˂Rq:a"d$g'zCs8i)ުҎ^e&b"ë͆XVQMG ;`-$$$cBBBlD Ԝ|עഗޮڠxީ亜כqߵzMƴїvL`-!!!c???lB ҙzἧdzѽȯ̳ȮחhκnF`-!!!c???lA;Tz@u5x8|;ߨ|֍SԄEʮԆHр@x8t4p0ԔiQ7`-c===l@Vo/s3w7|;Ӏ?ՄCֆE؈G؊Iݛdq׉HևEՃBԇJ|laRP XXXIJЅTԽϴռսһ¨ǰ] VVVO h(§}AրB孄ۏVŧ꾝ۑZ繗D҄Ps=K TTTݽ=J[h)]bn,r1ޡvbbԎ_P _#=?SSSظhC忬Ű绞涖龠迣彤٣ܪHRRRֶ;d2ʴ؋TېX꼙hεäoǫ؎WۙjyTAPPPԲ;ex4y1ڀ8݄<߇?Vo݅<ہ<یOr+ևN[EOOO|||Ӳt:䬁鷑가z﹈췋ߜhܙh_MMMzzzӳ~C趐›ɤѮյ1̮Ħq3LLLxxx˨V {/^EP\`ÄǏZ`H?~p$WLLLyyyҿyQԞqإyܬ᳆溍•漍ⵇޭإyԟrΕj}XMMMWWW222pooo <| @ @ @ (   0000nNNNXXXYYYKKK---q4 gggWWW:::N$$$L sss "dddloohhjyz{YY[bbbUUU +cccӒeؖeޡpx}沂xߧyזeЉXΎdxxxʁP㶖轛˯ɫ渓߬߰m7uxx`'n5ךpz?ٚkૅᮉ؛ozB٢~~P^(uxxb/}PܫЊ[ٟv؛oχVĭtCuIX$uvx[)Џf徣۠u缜ɯƪٛmĭפ^,uvxZ q1ؒ\ֆEݕYݘ[屄؉H|}?i)c-uvxҒcζҵԺ΂Ouvxe+ҁAݜdZllݕRܞiAn7x{{˽suu<<abKGDC pHYs  tIME l IDATx}ixו[ի[ݒՒZ+]X`;v2&$LMY2&3;dIkl6$ 8b֬YFɛ-}tfϞtdggߐU>˲u秧C#-- ,h.++[ j E|4MΙ37$:ʆ'X(BZZ, n7v;<2N[ntǹǏFZBN\$:<fH̿), OƵieYo, aT׋H$rWzqv=Ȍ<,K7 #@`Y ߏj*//FEEbYE xP' J ^m.ҝ9Aq'ES)r>ű>Η~!ns+T= ,XV?+>窏_a3,LݚYbD5 XUh&:jp80-;tҠX~["(XiH ϡAS2@@%k Fβ,c ǀA# )[ƎM X\aHɄ@K:(ՄlQD#7`)cǂeYn~Ca1YBX*sS'vD'4eC,@kK)`@IiLd$+A8 @j\%RpY`Xf>Arpmy5BjZCUfAuE@ G2q_v}!  % 7L_`>2AT\Ѩz))z7/\ԍo \)|30,aAp>LH^N ].nV.`|Na$̘F:t{t՛ ,Ra$P=z4x fe~S.aavNv0%A3I`a3,X(ee#=M@ ݃Q05u:\:S$_`T>t$ GPiYPwY\0iT_{rlS#0,FӒ&0_YƶL×We4*k|I8& {L|ɋcqΪGQƽ2I၊,\/l+]/4z6H2N֡0崩욠I' e3 2kezllMY㴇S  叾b;ϲl6'ψď׸07$=/ma$ 2,5hdXf7_  wHfR97g%N<4ǫzP@y _YSmjߠj_| kP=CPB Јr%N=&8.$/tHX5ˡο!oP^ِj@8ߘ*qV5cA ˰HȂt<ߤ f $XlR=AGp\-`vArYu`cRGvX@gf In(0 ): (iyeVk p_,bâ -kFCw'ZB N; G!P)sr 8YȌc-a|FNN Y_nÉa1&0 |38-`DR<G,S NWGc щYHݻ3zd |ҚFF=- 0*Y EkMIͲ,_Vi4U*ըyȲ@ :y`^ I[J*f?ڜGhF,oN F}Z9quh>4 RoT3 3'gRh96Yf?`e g|qfP~\Ųi6jWwS*`&A Fpl\?Huy` <en4N e38})OTVuGŹߎ5 %,|i61B8O0 Rc4{}ٹxa/˫fѸ]al9]1 !yT/cW/-!Ջ:/#D$p$+cY}aX&VܱOrW{vblj>c4LkFq%fa`(-H?G 64tE0%G>ԺCX;ώ=þAя(qrjfʡ~|r)Wɴ%oD 1E.݅Ʈ0ɉ0~Qζ6qVuɕ9Yc <؅}:ӧ5s5#KJ $:L:6/w /j/$g|= aQ4vF;;;eF|̟LGwPЛ ?i bryHr`Y׮nLuU+g5Ə{n5X_ӁԮ("%w/4*4 t,X,*(Pda=k#[Y M?϶w5(d$ aT_ "' 23yXFW((?RfQq?`Fڸ%z{p8,hEږh3 ^<ą-GyD =,A( TdG8$ <Ez|ql9>7gϱG,_<P c>A9Fi)+b x{vsp{B`x({mmmOʆ^Os<% ڀ( D|T/g!TMVMW6&.{#u 1y~OQ 20HcʗX,-(,rj {9Qdf RHJ㻟`ی}>hIˀ@kae) J) ?N惋0.suJ hiEH˲x2_F>|4} |q~==D"qaɿUo>?bC2nh bNJyDA"[5.K|x~(;_>d!(IK0a) 2 +`䣆7Ȁa9=ݾNhGɕ'pQ$åf/ l.<,GnIW 0pt*.geW_GpE /|q ^X2&<Ѽ[f8n%2lzMq)j 0 -pNEs!b%AmIOy6|"d 8X66Cotb`r30Ku_&=%5< ,fLچp_f0R^b9nМb&w KsT\<Ђ`04dg3AkOh\@0\7JrMX<# GS<6cn 6yeXe`v-A|\7i@̀`ݾ(g/iy.)MG8F]Tl?ދBzZn|LX7ɒzYSmYh9ixbe.BX='SFdJ S,䳐iF#MYB 4-ۏyvbanV9oFSMt[ Wem(p[P`mIp@s0ZE$ 1 İh^HUd1f҉Ho?l0hyNjcC OhO(ǿ}h,&tq;"sL{Mh o6U3'zP4/1l5%JB'/C+־vP/޼v*jw/A&5:8XۇY^_/l_om2|yz:= +)\ `v|e}?ދo{0Ԏ,v YaXg?9BkJ ЎThp@}?کa)E6 2(JעA;d/j< \ٖ vr2s`r3 9xxY($V*+OqQP4Y Ã`ЄdTy /Hڅe_j- >*W.⇯4t0M+(a |گbtXEu'|?&ڈXÓgh@$h t |FO0luOJ @~I z #)Q`'{񣍍\B)~6EPh I K1X !Yfd O~6 |j0(@]Sjd@8Ep) OZm/H!ke^o@$CY: Fbɫyp)wƇtcO?~/cZ|\pڍ2FPè) (5g;/.RKqef~h l87@J2L}VF%M6biSbÁsDA`ih (nZ;]oATC?>O TyϹF(ar۝DIFݔJQ?r(/8 dye3; 1cXDy3/87Os`fg/s Nv^XjMӄ֌PmZēD h6i3{ 6oo -j&#r.`JMQV/R;N7|ZʹY*r ))A&d1A<VdꖙT rv `>̚ !Pd:ynX^gD~qgb ߉4 Y09W=3Krj'gྛs<'% Xu3w`Sz]3[ξX?1RZ+X1}P1CWpnFDc zsL`J/ eJs3z.w0"4$VRO2d>I"9I6L7AOWb# lQ4G`a`K㇏OC DLǙoLJt%z4&;.Sn_A:IDAT<4]&L3FVQGUA&j&AF@(“y)3ׁZ<1v,yF+NnRp^gZ·]:ۮlk2b,v "H/K#(|؋͇%:C7ASULz[ .$#hU"  _0 9U*@@TvP(Dz9~чmǼ)xK08òcAl:'iFZ3x4MsPj앳ba0ެE(Ȁvގ緵oBuOmCx}y]1A*2E%?/jW6GS. Յ`~N3,vcDZP/](^[xUC[ggʦjq)oF0?=Pa!# .`cwxdIzql:҇j}u4c(4E:Qw{zpSMl3_ ""f /xf9c?vcW梮u2N7Ol Z]QV|BD "QnS}+9fCϮkhy I=yE~afXk’id΁( .  z?GU$ꭣxh~YgZCX1UXsPtz a#@ɀ*G+H$(` ު7eca/?5%`ip%${SY2FP͟cR'Q$!,"~ "QoUfNB*#D¹Ў2qPˀhG u(x4WȦ5+s[[67*@VP8Ar܇,nbŞ7vbǀ/L0mv})PEbI$ŌM\q(8@,LőځJ;H Z+@yBHz!0?w{yv`Eb Ŀs-`'^$n+,&{H[Osa_rKK\iMCLa NMZ.- (’鸱|K*S4  dsȁEє5N^UVv7aY]( ue0yq~FlW/V/\l3SlR3 ,) >)9$qI|.g>_4e`#H+9:iO?d2hmm=KQ~o`6zڢilܸt$骫o>"ubGJ$Dw!9p8GkjjZ Vk͛7 >c1w~Cחu:Ԅ&l޼#<vH#jٖvn>u |Պr|>ܹ555~.hJjkk{.Ḩ( iD Qzbԩzضm~m x8@@@ƍ_h4`ssiҥx<'wo•\'}fNPG}}=jkk/Uhӌ @)6lx*770==%%%x<07b׋f|m۪op@ TJ̝;wҥKggghkg|3g4WUU Mo"\< dk jzn+))'ÕIc[ss3Ξ=]vmonnn{#O;o._csw?C8?t =F-EMðX, rop4Mj|F˯bZjϥy`nH 0uJdz6///޼y6mڸ | {A__:z8p`7ߙ xG~%UR|Vx9sdL>}MZZڗz}8Nh4{G7Q&;{Aee%qIpx{$7Gm$Cd<§[.h4~oPp:?>nҥKxWpw"77w}L&_^744'Nĉ8y$  #t fnݺL-AQcҥPX[o=5-޽O?4rrr4qAx^bC}w|@T3jbҤIa09jX ;v+V뵇BN9vZ<;cƌo~Ic* (//ǁ [nԩSq_Q ,\Ɔ;}gϞ== p<3YNsϼy򕯌| Dg*;;v >رc8~8Ν ˅~B! 1?#ͳp:hnnd2tR}iiiə㏏Y܋YٺpBEaѢEx<n뛚pbDQD"bhɲ%K ׾}V@2וxᇳ^Yvh܄/fSLjEMM Ο?p8`4ǭ|'F4̙3t:W$Aoo/233Ӎq1[VVV4VcҫGa D䲳rڊ-[ ++ .kTDގvtuu\..\(w"Hz_,"# A[L&,ZxDizmXZJKK1ydDQ@$ɤ.>zFAQV+O.V> ٽL+z ddd ^O r ! BN ߆ dbЅBn+hf3FcW@4|7]I#^00(Mh`p v88_s Gs! ~yߏf ^q"@,`pb`llfS9㱜9s8r 4555qz@h|j9EAA]Q0fD/^۳g'X>aU$Pĉ w 8X"5F,æMkGlQ/\py^ڹ 3gPUUX,]v?~ 4c L4XsΝ-++[DlMMMZ7ϲ裏PWWp8ݳgϡ{GnG0| x霷nݺO9;x/@Oŋ_}WCCE^4wOH.jB(p b'"SV\ymh4@ff&O? wwwSN{w@y|Maͼ&0)##c=sٳ1`@~~SZގ .  ۻ^{N>1I #pnpYrΜ9 L&?5 ˃3x.^W78(AU]]ţG?qD#o߻y< #\mR(Ńk7 `ҥ -Zt:'Z,8Nvvdee]SB|?6TUUutt3tO|ə~~󮚪/a"̐f& T6_ :0x&>ďمma韺Яhi=a*ȃDOD9 B1Gj1BkIz+ Ph6s O#&MB0Z Wa.>Cs].ʇ;OÏIENDB`sigviewer-0.5.1+svn556/src/images/sigviewer16.png000066400000000000000000000016521154433734200215120ustar00rootroot00000000000000PNG  IHDRabKGDC pHYs  tIME  uv7IDAT8]O\U?f< mP1XĪAj05څ4mܘԍ ظuL4ĤˮL?):0Sf`y3w]LIl=XW2tD`0`hcH Jz~W׮ѳ=w6](%QB)c auBZLMq[(uݭǍWHp(Nu%8ݩaڢXӓ08wȏ}b,KmXoO1ĩq[EWwIH'5 (%%M~ $>N.:tsO:,Gyj5h4()RVF;st" xx,}n}Ø%B bqvA|e"P~Kg*1 !!H!#^}Q.n@ow/ Lx")t%d; )^`B\:M=ƝL)5}%gN&c'a BXdKUv|j&c'mCZjmf\Wj~z5QҚ0BaY6&VDR9RSӟtt8'CCC_~򈐒""vvvznn7˦T*c< qǢP(r_2|ڶm8RJlq|gqq9;;7ѣ]MYeylvAk' 1FIENDB`sigviewer-0.5.1+svn556/src/images/sigviewer_32x32.bmp000066400000000000000000000060661154433734200222020ustar00rootroot00000000000000BM6 6(    666ZZZ|||\\\999iiiηqqq222@@@ aaattt888AAA***$$$oooſxxxddduuuÿöǵޫᰌ㴐渔輗ÝŠǢȣȣȢơĞ龙纕䶑Ⲏ߭ݩڥĮŹɚ{g'n/u5|;ԂA׈GڍLݑPޔRߖTUeߙ[ۏN؊IߢpԆIx8q1j*b#[ҕmȺǘxs;΂Lp0ǭ嶓׌QՆE׉Hα蹐ݖZ،NֈJ滛ЃJk,΄Qb%VВkʹƕvоȯ̆[Ϗh̸Œsl6wBюa֕gӌXхLޤxᯈᭆՐ[y=ݨ͂OۨԙuX͋eηoPV]ӓie&i*l-o/q1r2߫§p0m.~Gg(b#]൚sALFˈbжjI OT˂Rq:a"d$f'{Ct9i*ެҎ_e%b#ĭ·YVQKF@ɇ`ҵeԝ}أೖݪٞwު㹜ךq൛|OǴїvRɇ`ԳbҚ{ἧıҾȯ̴ɰחhмsFɇ`ֳ`>Fr9s3w7z:|׍SԄE˯ԆHр@¤x7t3o/ґgK>ɇ`ر}^F g(p0u5z:>ԃBՆD׈G؊Hޜer׈GֆEԃBԆJ|>>***vvvwww222sigviewer-0.5.1+svn556/src/images/sigviewer_32x32.png000066400000000000000000000035601154433734200222040ustar00rootroot00000000000000PNG  IHDR  pHYs  "IDATxVmlS>|{m_4!䋤!]A-ZF[ :жj4 uPUTZ)E4G,6 ]B41I8cu c#=~=~]v޽n,)a\rqm?@Jа"RQn~\K, \0 TE@ .9``p9u5Z_ B`\emOӈ/UE#,j4iRNY.Og1#B({1\囘3=)ru+=+ϔh ƺVMcp&,cN  l/~v*z9k8fbBDz)IWwWO 9;X{w'q7:I-˙O)u@Jt2QP~ !9*U/^Kܚ !9Ne252C3Md^x/0]'_l4Mj-{W=7i=uλI#oU![Nɟ^nMdh*wm( &76SsY_/ﻕx`Ӎt޹VE;} DALgc HDz${Z ;l獟 ؝__N8zk,ej!b!aUEObI+6oAT9@0|bZRʃqrj1>*4jXw*p]'5PY$ISg^Ikyu֔j*&* \`jJJ\j]gw(S{{}>ڳ̰Vܚ̜:Դ^zϬ[?sp!hh!KkI yLN/УYwϣJ'>CEu)Nٿz!Ϣs((@;9M 3@hg`y-P' ?lz7v_Xy>x;15p!02T5r꣨bUEF0F|PQtows&IT6DEѼ &"(]J`s>>sLc0D! Xl@)B.81Ι`S&J90l'֔mjR !BHåB,B(V0 ˲P.]}8U ChHhHXXX:t.p:`ٳ.СC.=}I}ϟ>}ejii9yduub:0Ν;7>>^0KEQ6o|;vWUUO$Ix^zĉ^i===Lb022200`iƑ#GZyf}}=5M1J(!aR)xK(SSSUUUWucL)x0ty9Z$ Z2g y^cPb !ڗ Z ; "E6}:;;+ @Jfff._|…H$ϲe pݭMMM555~_UU[e"Fp8 RG+/ݺIENDB`sigviewer-0.5.1+svn556/src/images/sigviewer_installer.bmp000066400000000000000000000623321154433734200234140ustar00rootroot00000000000000BMd6(9d  ȮŞ}}}ʗij{{{󱱱Գzzzީ|||矟𾾾޻ݱ߭岲Ŝ޽鿿jjjyyy쫫ڤݔȿƿľ̮¨ĪǬɮʰ̱γеѶӷԹպֻ׻׼׼׻׻ֺչԸҷѶϴͳ̱ʯȭƫ΍侤㼢Į̮Ț{f&k+p0t4y9}=ӂAՆE؊HڍLܑOޔRߖTVWXYXWUߕSݓQېNٌK׉GՄCҀ?|;w7s3n.i*e%`![o9˭ǘyc$h(l-q1u5z9~=ӂAՅD׉HٌJۏMܑOݓQޔRߕSߕSޕSmpܐNڎL؋JֈGz㯆}Rh3ɭĔu͆Y޹Z e0ȬÒt^"⺠߰Lʴܥ}ީȯިѻȭᬄ᫂ݢvӌX߬ڣ}ڧ֞|Qb.ǬqQUY]̈́SφRj+m.o0r2чPՏ[x8Bૄw7҈Qu6Ⲑӿl-j*f'c$ͅUVYLH _+ŬnMRUY]ۧo4e&h)j+l-n.p0q1r2r2чP潠q1o0n.t8v[&d\(ئ޴͋d|O㽥ɵᷛ}K·Xэ`́Mǯ఍֗iԐb؝tψWґd۫޳zKXԛz޵i9V!>[&cuJкĪİѮI[&ԿaJὨۮtHǵܧⴒӿⲏ̴ⲍᭅާ~Ԏ[ఌ౐צ֤F [&ս~`>@AI Њ\ҋXu7t4x8y8ג]ڙfр@֍T嵏ҀAڙf@溙w7w8y=n/ՓdʵRT>>[&ּ|^>>Oh(n/潠πFv6y9{;~=>Ӂ@ӃBԃBԄCۘa̰ԃBӂAҁ@ՊO֎V{:x8u5r2s5e%W@>[&ػ{]>Pi)m-q1t4w7{:~=Ҁ?ӃBՅDևF׈G؉H؊IٌL寂ܗ]؉H׈GֆEՄCӂAӄE҂Ez:w7t4y=t8i)e&W@[&ٹz\F g(m-q1u4~Aݡs>ӂAՅDֈF؊HٌJڍLۏMېNܐNܐNţŤڍLٌJ؉HևFɭӅG{;x8t4p0l-i)d%P[&ڸy[`#~FчQzԄC׉HڎLݒQUY^bfjnqsttrpmieb]YUݒPڍK׈GԃB~>z9s3L[&򯯯{fY/d:ÄRljUɌY̐]Δ`ИdҜg՟kףnڧrܪuޭx߰{}~}߰{ݭx۪u٦qףnԟkқgЗcΓ`ː\ɌYLjUĄQ€NnBY0rN󮮮🟟ܓ֖sigviewer-0.5.1+svn556/src/images/to_all_channels_22x22.png000066400000000000000000000021451154433734200233210ustar00rootroot00000000000000PNG  IHDRĴl;gAMA7bKGD pHYsHHFk>IDAT8˕;L[Wl -`\T7"%C(U3QƦ:vСVUڥC3 l$Ə{m_{}{Na[_O{0 y22r덁^'[5`^:>DfjR155qcbln߾utΝ.W$(9hnQf0󗻻NI8Xp'kp 8 -b ;6{[r+5\~jg[{.v:5jX-%@Mf_,-}1awxy^{]&H`jý2y1z6c"er!a fbi4x01Y" {E-iӠmGlJ0 lZѫU#_sx4xlqw;;[%Bxp/|PLUBgRKGOX4I>4}T |!#aɘ8`0MPOObh+k;^F'c'Z 'Ff 5]+c~.TX[{a T O#]+C?i'xO33*yp($BOe+`mlm-Vj;5[UY.J?sLy$Xck3d k1ct]QJ$0+iIGu] nNL=eJ!Xjlv5{(THeȲM@)E:G")Ky޽kP "i|פ`BQq'@X,JHh`]ƳɒbU=.Qʲ8^\V:,zOEQZ^^Vff_lދFtEXtSoftwareAdobe ImageReadyqe<IENDB`sigviewer-0.5.1+svn556/src/images/zoom_22x22.png000066400000000000000000000021271154433734200211600ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  tIME1IDATxڕ[h\U};י3CӐ^^ ΀%RjI^jREBDR/!J'mJ&̜gR/aR I  @ U.gJbBI5oa"e4uPJZ bʼnL&ĆNM fqȚc(KMk;z{_3H&Ėfu96q i@5p810S](0tmp\6a&':'7Ilje4w}T$" B04iζ!4aYl˄iG% Xz. )UI]1ŒСk A)!J)x  1BK(ʸi` | aRY XZ{`:X \sN)(PJr$޼,%3P¯V` BhCk3(LsWs]2\YSt!9(dͯǿ-T*LC$t?LLyk!<>q!|3T C[ٸPAA! Ca@JN)8_gOd]vma_ɗsQ~mRP S {O^'v~մ&/Po%#(~WA vMT*ץ׳prg*&0z WJ9ݓq'UsC g5:Fu(Bt]=*2^9?)zVShۛ;O6e׊̣fGyC*9ۯVsRc#^v}kpDJf-5wvŸz~/mwyg:6Op7cCE/|'J_g>:|5gԳ C 6eMy~sqZ8(IENDB`sigviewer-0.5.1+svn556/src/images/zoom_in_22x22.png000066400000000000000000000021711154433734200216450ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  tIME8+RIDATxڍ]U9wfuլ!ESFi-Do,If(ֻ‹ dS2*ҙ%(!h5#M #5,Yb0WE]wgz?;y?evڗme Z0&2k>w(:/)'xa,]4M山Z\.o,kD~ZGD"qRJfH)) 2\~Si1gIڒDa64MR$ql.](f:(*' d2N[2A5#OB,8 T ڧn~%ջ©ض9Ki 8Jy1sqlEznFcV`%IRarsqm4B,C#EZiY˲2VTrs"cKI@kMv+Xy"\@2'p]:J)!0ԚJ,Ο|*"Ө7JJ[JlQ G))-,.Gw>94#M R[J\F)E~ǣv+aVk{.RX-8tr̞}hKϖr_}Ek 5(Om̟! 2w+Vuݕn˯~|ehbSξ#`0{m_Meif?f7KTA- ?F3q߂1p[63KbT~l\f^yxnm ,v+X8c1=4vv|AI[f.M}_dբu cn IENDB`sigviewer-0.5.1+svn556/src/images/zoom_in_vertical_22x22.png000066400000000000000000000023161154433734200235370ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME1uh&NIDAT8˅]lUNK-!$hmLb!"FmHĢR #ŠćQ)+-_3ׇۅO&{2w9?Ghc vmBjO1@ h_l̠̇pV-1Q|CtݐDp)%JB6Knbb'N??p7l֚HainXR cZ&J)r#oUVo߾B=Cݻw5^C^hŴL* sYh'T)SK6m> SqEhEFeoGS]%Z:]|T)d/ys0MP D%, e$'('_aRmD RL!2 t!Zk-q |rVi)R!5#+p3d `*o50@<9mpB6i X$kJ% )%Zk*A@>_,^y}OR.Q|J)L0M0 +#dz:7FǏ\>qwR, 4MA@!Kbn$kbțg7x+V$d[T} >IJeI[CWÞ3-,_(ΥВ)ty1_wK7|P\{ r7)v/mgvQq8=ɗ\QW*^IȔbã#|IENDB`sigviewer-0.5.1+svn556/src/images/zoom_out_22x22.png000066400000000000000000000020701154433734200220440ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  tIMEg̨ IDATxڭ]Us^יMbP2,"Ij4(6H( BJ˜]F1 ؛ݛqt]ueݙqyӅ/$dõڳ@^dK&0(iabFLl֭{3nk`1V֧~~*9!hZ+#QR-v}[Ծ(eIl[! nh[#Z21~btkƍNc0ww:2鴏hVRL&v\wd@;Xq3Gxd2):2it`<|Ŷ\'nFoxG'Zk\sҞGG$ RK{xEy͹WJwlRaj uplMbX1l.K^k;ҶDJeY\Rֹ:HiIR+uH(6jnzsV J8FJch% Z-,Νx2cLl4J'1F)%ZJJa+ *F,əN8V'W:GkR bn.nJ#3Qsq8#ctw;>thJM\׾$ IЌc~8;w|2pKե޻<.] ױ*8x`C?dIlN̥szˍ;ϔn Zzh- y~^J ۩M=ӳr$0ˋkG iǏ3v_č1?/ ojc=7˗rFU/wlpμ,z~-?~naUxG1} jFd\_Gtѽc%;5>Gma +ʯ|G45AmtÇ?[L p'[~ckic 7v"[|leoT?Uyn`|O. */ // sigviewer.cpp #include "base/sigviewer_user_types.h" #include "base/exception.h" #include "gui_impl/main_window.h" #include "gui_impl/main_window_model_impl.h" #include "application_context_impl.h" #include "file_handling_impl/event_table_file_reader.h" #include "gui/gui_action_factory.h" #include "gui_impl/commands/open_file_gui_command.h" #include "commands/convert_file_command.h" #include #include #include #include #include #include #include #include #include #include #include #include using namespace SigViewer_; namespace SigViewer_ { //------------------------------------------------------------------------- /// readCommandlineParameters /// @return a map which may contain the following parameter values: /// "input-file" -> and std::string containing the input file name /// "test" -> if test mode is activated /// "convert-to-gdf" -> QMap readCommandlineParameters (QStringList const& parameters); } //----------------------------------------------------------------------------- // main int main (int argc, char* argv[]) { qDebug () << "Starting SigViewer... (compiled with " << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__ << ")"; QApplication application (argc,argv); QApplication::setOrganizationName ("BCI Lab"); QApplication::setOrganizationDomain("http://bci.tugraz.at/"); QApplication::setApplicationName ("SigViewer"); try { QMap parameter_map = readCommandlineParameters (application.arguments()); QString input_file_name; std::set app_modes; if (parameter_map.count ("help")) return 1; if (parameter_map.contains ("input-file")) input_file_name = parameter_map["input-file"]; if (parameter_map.contains ("test")) app_modes.insert (APPLICATION_TEST_MODE); if (parameter_map.contains ("convert-to-gdf")) app_modes.insert (APPLICATION_NON_GUI_MODE); if (parameter_map.contains ("event-codes")) { QSettings settings; if (parameter_map["event-codes"].size ()) settings.setValue ("eventcodes_file", parameter_map["event-codes"]); else settings.remove ("eventcodes_file"); } GuiActionFactory::getInstance()->initAllCommands (); ApplicationContextImpl::init (app_modes); if (app_modes.count (APPLICATION_TEST_MODE)) GuiActionFactory::getInstance()->getQAction("Run Tests...")->trigger (); else if (parameter_map.contains ("convert-to-gdf")) { std::cout << "Attention: Converting to GDF is in testing phase. Meta-data will not be converted." << std::endl; ConvertFileCommand convert_command (ApplicationContextImpl::getInstance(), input_file_name, parameter_map["output-file"]); QString error = convert_command.execute (); if (error.size ()) std::cout << error.toStdString() << std::endl; return 0; } else if (input_file_name.size()) OpenFileGuiCommand::openFile (input_file_name); int result = application.exec(); ApplicationContextImpl::cleanup(); return result; } catch (std::exception& e) { std::cerr << "exception caught: " << e.what() << std::endl; } return 0; } namespace SigViewer_ { //----------------------------------------------------------------------------- QMap readCommandlineParameters (QStringList const& parameters) { QMap map; int start_index = 0; if (QDir::toNativeSeparators(QApplication::applicationFilePath()).contains (QDir::toNativeSeparators(parameters[0].mid (2, parameters[0].size() - 2)))) start_index = 1; std::cout << QApplication::applicationFilePath().toStdString() << " - " << parameters[0].toStdString() << " - " << start_index << std::endl; for (int i = start_index; i < parameters.size(); i++) { if (parameters[i] == "--test" || parameters[i] == "-t") map.insert ("test", ""); else if (parameters[i] == "--output-file" || parameters[i] == "-o") { i++; if (i < parameters.size()) map.insert ("output-file", parameters[i]); } else if (parameters[i] == "--event-codes" || parameters[i] == "-e") { i++; if (i < parameters.size()) map.insert ("event-codes", parameters[i]); else throw Exception ("event-codes parameter missing!"); } else if (parameters[i] == "--convert-to-gdf" || parameters[i] == "-c") map.insert ("convert-to-gdf", ""); else { if (map.contains("input-file")) throw Exception (map["input-file"].toStdString() + "Only 1 file can be opened!"); map.insert ("input-file", parameters[i]); } } return map; } } sigviewer-0.5.1+svn556/src/signal_processing/000077500000000000000000000000001154433734200210715ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/signal_processing/FFTReal.cpp000066400000000000000000000430111154433734200230170ustar00rootroot00000000000000/***************************************************************************** * * * DIGITAL SIGNAL PROCESSING TOOLS * * Version 1.03, 2001/06/15 * * (c) 1999 - Laurent de Soras * * * * FFTReal.cpp * * Fourier transformation of real number arrays. * * Portable ISO C++ * * * * Tab = 3 * *****************************************************************************/ /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "FFTReal.h" #include #include #if defined (_MSC_VER) #pragma pack (push, 8) #endif // _MSC_VER /*\\\ PUBLIC MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ /*==========================================================================*/ /* Name: Constructor */ /* Input parameters: */ /* - length: length of the array on which we want to do a FFT. */ /* Range: power of 2 only, > 0. */ /* Throws: std::bad_alloc, anything */ /*==========================================================================*/ FFTReal::FFTReal (const long length) : _bit_rev_lut (int (floor (log (length) / log (2) + 0.5))) , _trigo_lut (int (floor (log (length) / log (2) + 0.5))) , _sqrt2_2 (flt_t (sqrt (2) * 0.5)) , _length (length) , _nbr_bits (int (floor (log (length) / log (2) + 0.5))) { assert ((1L << _nbr_bits) == length); _buffer_ptr = 0; if (_nbr_bits > 2) { _buffer_ptr = new flt_t [_length]; } } /*==========================================================================*/ /* Name: Destructor */ /*==========================================================================*/ FFTReal::~FFTReal (void) { delete [] _buffer_ptr; _buffer_ptr = 0; } /*==========================================================================*/ /* Name: do_fft */ /* Description: Compute the FFT of the array. */ /* Input parameters: */ /* - x: pointer on the source array (time). */ /* Output parameters: */ /* - f: pointer on the destination array (frequencies). */ /* f [0...length(x)/2] = real values, */ /* f [length(x)/2+1...length(x)-1] = imaginary values of */ /* coefficents 1...length(x)/2-1. */ /* Throws: Nothing */ /*==========================================================================*/ void FFTReal::do_fft (flt_t f [], const flt_t x []) const { /*______________________________________________ * * General case *______________________________________________ */ if (_nbr_bits > 2) { flt_t * sf; flt_t * df; if (_nbr_bits & 1) { df = _buffer_ptr; sf = f; } else { df = f; sf = _buffer_ptr; } /* Do the transformation in several pass */ { int pass; long nbr_coef; long h_nbr_coef; long d_nbr_coef; long coef_index; /* First and second pass at once */ { const long * const bit_rev_lut_ptr = _bit_rev_lut.get_ptr (); coef_index = 0; do { const long rev_index_0 = bit_rev_lut_ptr [coef_index]; const long rev_index_1 = bit_rev_lut_ptr [coef_index + 1]; const long rev_index_2 = bit_rev_lut_ptr [coef_index + 2]; const long rev_index_3 = bit_rev_lut_ptr [coef_index + 3]; flt_t * const df2 = df + coef_index; df2 [1] = x [rev_index_0] - x [rev_index_1]; df2 [3] = x [rev_index_2] - x [rev_index_3]; const flt_t sf_0 = x [rev_index_0] + x [rev_index_1]; const flt_t sf_2 = x [rev_index_2] + x [rev_index_3]; df2 [0] = sf_0 + sf_2; df2 [2] = sf_0 - sf_2; coef_index += 4; } while (coef_index < _length); } /* Third pass */ { coef_index = 0; const flt_t sqrt2_2 = _sqrt2_2; do { flt_t v; sf [coef_index] = df [coef_index] + df [coef_index + 4]; sf [coef_index + 4] = df [coef_index] - df [coef_index + 4]; sf [coef_index + 2] = df [coef_index + 2]; sf [coef_index + 6] = df [coef_index + 6]; v = (df [coef_index + 5] - df [coef_index + 7]) * sqrt2_2; sf [coef_index + 1] = df [coef_index + 1] + v; sf [coef_index + 3] = df [coef_index + 1] - v; v = (df [coef_index + 5] + df [coef_index + 7]) * sqrt2_2; sf [coef_index + 5] = v + df [coef_index + 3]; sf [coef_index + 7] = v - df [coef_index + 3]; coef_index += 8; } while (coef_index < _length); } /* Next pass */ for (pass = 3; pass < _nbr_bits; ++pass) { coef_index = 0; nbr_coef = 1 << pass; h_nbr_coef = nbr_coef >> 1; d_nbr_coef = nbr_coef << 1; const flt_t * const cos_ptr = _trigo_lut.get_ptr (pass); do { long i; const flt_t * const sf1r = sf + coef_index; const flt_t * const sf2r = sf1r + nbr_coef; flt_t * const dfr = df + coef_index; flt_t * const dfi = dfr + nbr_coef; /* Extreme coefficients are always real */ dfr [0] = sf1r [0] + sf2r [0]; dfi [0] = sf1r [0] - sf2r [0]; // dfr [nbr_coef] = dfr [h_nbr_coef] = sf1r [h_nbr_coef]; dfi [h_nbr_coef] = sf2r [h_nbr_coef]; /* Others are conjugate complex numbers */ const flt_t * const sf1i = sf1r + h_nbr_coef; const flt_t * const sf2i = sf1i + nbr_coef; for (i = 1; i < h_nbr_coef; ++ i) { const flt_t c = cos_ptr [i]; // cos (i*PI/nbr_coef); const flt_t s = cos_ptr [h_nbr_coef - i]; // sin (i*PI/nbr_coef); flt_t v; v = sf2r [i] * c - sf2i [i] * s; dfr [i] = sf1r [i] + v; dfi [-i] = sf1r [i] - v; // dfr [nbr_coef - i] = v = sf2r [i] * s + sf2i [i] * c; dfi [i] = v + sf1i [i]; dfi [nbr_coef - i] = v - sf1i [i]; } coef_index += d_nbr_coef; } while (coef_index < _length); /* Prepare to the next pass */ { flt_t * const temp_ptr = df; df = sf; sf = temp_ptr; } } } } /*______________________________________________ * * Special cases *______________________________________________ */ /* 4-point FFT */ else if (_nbr_bits == 2) { f [1] = x [0] - x [2]; f [3] = x [1] - x [3]; const flt_t b_0 = x [0] + x [2]; const flt_t b_2 = x [1] + x [3]; f [0] = b_0 + b_2; f [2] = b_0 - b_2; } /* 2-point FFT */ else if (_nbr_bits == 1) { f [0] = x [0] + x [1]; f [1] = x [0] - x [1]; } /* 1-point FFT */ else { f [0] = x [0]; } } /*==========================================================================*/ /* Name: do_ifft */ /* Description: Compute the inverse FFT of the array. Notice that */ /* IFFT (FFT (x)) = x * length (x). Data must be */ /* post-scaled. */ /* Input parameters: */ /* - f: pointer on the source array (frequencies). */ /* f [0...length(x)/2] = real values, */ /* f [length(x)/2+1...length(x)] = imaginary values of */ /* coefficents 1...length(x)-1. */ /* Output parameters: */ /* - x: pointer on the destination array (time). */ /* Throws: Nothing */ /*==========================================================================*/ void FFTReal::do_ifft (const flt_t f [], flt_t x []) const { /*______________________________________________ * * General case *______________________________________________ */ if (_nbr_bits > 2) { flt_t * sf = const_cast (f); flt_t * df; flt_t * df_temp; if (_nbr_bits & 1) { df = _buffer_ptr; df_temp = x; } else { df = x; df_temp = _buffer_ptr; } /* Do the transformation in several pass */ { int pass; long nbr_coef; long h_nbr_coef; long d_nbr_coef; long coef_index; /* First pass */ for (pass = _nbr_bits - 1; pass >= 3; --pass) { coef_index = 0; nbr_coef = 1 << pass; h_nbr_coef = nbr_coef >> 1; d_nbr_coef = nbr_coef << 1; const flt_t *const cos_ptr = _trigo_lut.get_ptr (pass); do { long i; const flt_t * const sfr = sf + coef_index; const flt_t * const sfi = sfr + nbr_coef; flt_t * const df1r = df + coef_index; flt_t * const df2r = df1r + nbr_coef; /* Extreme coefficients are always real */ df1r [0] = sfr [0] + sfi [0]; // + sfr [nbr_coef] df2r [0] = sfr [0] - sfi [0]; // - sfr [nbr_coef] df1r [h_nbr_coef] = sfr [h_nbr_coef] * 2; df2r [h_nbr_coef] = sfi [h_nbr_coef] * 2; /* Others are conjugate complex numbers */ flt_t * const df1i = df1r + h_nbr_coef; flt_t * const df2i = df1i + nbr_coef; for (i = 1; i < h_nbr_coef; ++ i) { df1r [i] = sfr [i] + sfi [-i]; // + sfr [nbr_coef - i] df1i [i] = sfi [i] - sfi [nbr_coef - i]; const flt_t c = cos_ptr [i]; // cos (i*PI/nbr_coef); const flt_t s = cos_ptr [h_nbr_coef - i]; // sin (i*PI/nbr_coef); const flt_t vr = sfr [i] - sfi [-i]; // - sfr [nbr_coef - i] const flt_t vi = sfi [i] + sfi [nbr_coef - i]; df2r [i] = vr * c + vi * s; df2i [i] = vi * c - vr * s; } coef_index += d_nbr_coef; } while (coef_index < _length); /* Prepare to the next pass */ if (pass < _nbr_bits - 1) { flt_t * const temp_ptr = df; df = sf; sf = temp_ptr; } else { sf = df; df = df_temp; } } /* Antepenultimate pass */ { const flt_t sqrt2_2 = _sqrt2_2; coef_index = 0; do { df [coef_index] = sf [coef_index] + sf [coef_index + 4]; df [coef_index + 4] = sf [coef_index] - sf [coef_index + 4]; df [coef_index + 2] = sf [coef_index + 2] * 2; df [coef_index + 6] = sf [coef_index + 6] * 2; df [coef_index + 1] = sf [coef_index + 1] + sf [coef_index + 3]; df [coef_index + 3] = sf [coef_index + 5] - sf [coef_index + 7]; const flt_t vr = sf [coef_index + 1] - sf [coef_index + 3]; const flt_t vi = sf [coef_index + 5] + sf [coef_index + 7]; df [coef_index + 5] = (vr + vi) * sqrt2_2; df [coef_index + 7] = (vi - vr) * sqrt2_2; coef_index += 8; } while (coef_index < _length); } /* Penultimate and last pass at once */ { coef_index = 0; const long * bit_rev_lut_ptr = _bit_rev_lut.get_ptr (); const flt_t * sf2 = df; do { { const flt_t b_0 = sf2 [0] + sf2 [2]; const flt_t b_2 = sf2 [0] - sf2 [2]; const flt_t b_1 = sf2 [1] * 2; const flt_t b_3 = sf2 [3] * 2; x [bit_rev_lut_ptr [0]] = b_0 + b_1; x [bit_rev_lut_ptr [1]] = b_0 - b_1; x [bit_rev_lut_ptr [2]] = b_2 + b_3; x [bit_rev_lut_ptr [3]] = b_2 - b_3; } { const flt_t b_0 = sf2 [4] + sf2 [6]; const flt_t b_2 = sf2 [4] - sf2 [6]; const flt_t b_1 = sf2 [5] * 2; const flt_t b_3 = sf2 [7] * 2; x [bit_rev_lut_ptr [4]] = b_0 + b_1; x [bit_rev_lut_ptr [5]] = b_0 - b_1; x [bit_rev_lut_ptr [6]] = b_2 + b_3; x [bit_rev_lut_ptr [7]] = b_2 - b_3; } sf2 += 8; coef_index += 8; bit_rev_lut_ptr += 8; } while (coef_index < _length); } } } /*______________________________________________ * * Special cases *______________________________________________ */ /* 4-point IFFT */ else if (_nbr_bits == 2) { const flt_t b_0 = f [0] + f [2]; const flt_t b_2 = f [0] - f [2]; x [0] = b_0 + f [1] * 2; x [2] = b_0 - f [1] * 2; x [1] = b_2 + f [3] * 2; x [3] = b_2 - f [3] * 2; } /* 2-point IFFT */ else if (_nbr_bits == 1) { x [0] = f [0] + f [1]; x [1] = f [0] - f [1]; } /* 1-point IFFT */ else { x [0] = f [0]; } } /*==========================================================================*/ /* Name: rescale */ /* Description: Scale an array by divide each element by its length. */ /* This function should be called after FFT + IFFT. */ /* Input/Output parameters: */ /* - x: pointer on array to rescale (time or frequency). */ /* Throws: Nothing */ /*==========================================================================*/ void FFTReal::rescale (flt_t x []) const { const flt_t mul = flt_t (1.0 / _length); long i = _length - 1; do { x [i] *= mul; --i; } while (i >= 0); } /*\\\ NESTED CLASS MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ /*==========================================================================*/ /* Name: Constructor */ /* Input parameters: */ /* - nbr_bits: number of bits of the array on which we want to do a */ /* FFT. Range: > 0 */ /* Throws: std::bad_alloc */ /*==========================================================================*/ FFTReal::BitReversedLUT::BitReversedLUT (const int nbr_bits) { long length; long cnt; long br_index; long bit; length = 1L << nbr_bits; _ptr = new long [length]; br_index = 0; _ptr [0] = 0; for (cnt = 1; cnt < length; ++cnt) { /* ++br_index (bit reversed) */ bit = length >> 1; while (((br_index ^= bit) & bit) == 0) { bit >>= 1; } _ptr [cnt] = br_index; } } /*==========================================================================*/ /* Name: Destructor */ /*==========================================================================*/ FFTReal::BitReversedLUT::~BitReversedLUT (void) { delete [] _ptr; _ptr = 0; } /*==========================================================================*/ /* Name: Constructor */ /* Input parameters: */ /* - nbr_bits: number of bits of the array on which we want to do a */ /* FFT. Range: > 0 */ /* Throws: std::bad_alloc, anything */ /*==========================================================================*/ FFTReal::TrigoLUT::TrigoLUT (const int nbr_bits) { long total_len; _ptr = 0; if (nbr_bits > 3) { total_len = (1L << (nbr_bits - 1)) - 4; _ptr = new flt_t [total_len]; const double PI = atan (1) * 4; for (int level = 3; level < nbr_bits; ++level) { const long level_len = 1L << (level - 1); flt_t * const level_ptr = const_cast (get_ptr (level)); const double mul = PI / (level_len << 1); for (long i = 0; i < level_len; ++ i) { level_ptr [i] = (flt_t) cos (i * mul); } } } } /*==========================================================================*/ /* Name: Destructor */ /*==========================================================================*/ FFTReal::TrigoLUT::~TrigoLUT (void) { delete [] _ptr; _ptr = 0; } #if defined (_MSC_VER) #pragma pack (pop) #endif // _MSC_VER /***************************************************************************** LEGAL Source code may be freely used for any purpose, including commercial applications. Programs must display in their "About" dialog-box (or documentation) a text telling they use these routines by Laurent de Soras. Modified source code can be distributed, but modifications must be clearly indicated. CONTACT Laurent de Soras 92 avenue Albert 1er 92500 Rueil-Malmaison France ldesoras@club-internet.fr *****************************************************************************/ /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ sigviewer-0.5.1+svn556/src/signal_processing/FFTReal.h000066400000000000000000000071121154433734200224660ustar00rootroot00000000000000/***************************************************************************** * * * DIGITAL SIGNAL PROCESSING TOOLS * * Version 1.03, 2001/06/15 * * (c) 1999 - Laurent de Soras * * * * FFTReal.h * * Fourier transformation of real number arrays. * * Portable ISO C++ * * * * Tab = 3 * *****************************************************************************/ #if defined (FFTReal_CURRENT_HEADER) #error Recursive inclusion of FFTReal header file. #endif #define FFTReal_CURRENT_HEADER #if ! defined (FFTReal_HEADER_INCLUDED) #define FFTReal_HEADER_INCLUDED #if defined (_MSC_VER) #pragma pack (push, 8) #endif // _MSC_VER class FFTReal { /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ public: /* Change this typedef to use a different floating point type in your FFTs (i.e. float, double or long double). */ typedef float flt_t; explicit FFTReal (const long length); ~FFTReal (); void do_fft (flt_t f [], const flt_t x []) const; void do_ifft (const flt_t f [], flt_t x []) const; void rescale (flt_t x []) const; /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ private: /* Bit-reversed look-up table nested class */ class BitReversedLUT { public: explicit BitReversedLUT (const int nbr_bits); ~BitReversedLUT (); const long * get_ptr () const { return (_ptr); } private: long * _ptr; }; /* Trigonometric look-up table nested class */ class TrigoLUT { public: explicit TrigoLUT (const int nbr_bits); ~TrigoLUT (); const flt_t * get_ptr (const int level) const { return (_ptr + (1L << (level - 1)) - 4); }; private: flt_t * _ptr; }; const BitReversedLUT _bit_rev_lut; const TrigoLUT _trigo_lut; const flt_t _sqrt2_2; const long _length; const int _nbr_bits; flt_t * _buffer_ptr; /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ private: FFTReal (const FFTReal &other); const FFTReal& operator = (const FFTReal &other); int operator == (const FFTReal &other); int operator != (const FFTReal &other); }; #if defined (_MSC_VER) #pragma pack (pop) #endif // _MSC_VER #endif // FFTReal_HEADER_INCLUDED #undef FFTReal_CURRENT_HEADER /***************************************************************************** LEGAL Source code may be freely used for any purpose, including commercial applications. Programs must display in their "About" dialog-box (or documentation) a text telling they use these routines by Laurent de Soras. Modified source code can be distributed, but modifications must be clearly indicated. CONTACT Laurent de Soras 92 avenue Albert 1er 92500 Rueil-Malmaison France ldesoras@club-internet.fr *****************************************************************************/ /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ sigviewer-0.5.1+svn556/src/signal_processing/SPUC/000077500000000000000000000000001154433734200216435ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/signal_processing/SPUC/butterworth.h000066400000000000000000000071421154433734200244110ustar00rootroot00000000000000// // author="Tony Kirke" // Copyright(c) 1993-1998 Tony Kirke /* * SPUC - Signal processing using C++ - A DSP library * * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "spuc.h" #include "complex.h" #include "iir_1st.h" #include "iir_2nd.h" namespace SPUC { /*! \addtogroup iir IIR filters */ /*! \brief Template Class for Butterworth iir filter \ingroup iir */ //! Butterworth low pass filter. //! Specify cut-off, order and Attenuation at cut-off on construction //! Filter is bilinear transformation of analog butterworth template class butterworth { private: long order; long odd; long n2; complex* roots; iir_2nd< Numeric>* iir; iir_1st< Numeric>* iir_1; double gain; double* coeff; public: //! Constructor, fcd = cut-off (1=sampling rate) //! ord = Filter order //! amax = attenuation at cut-off butterworth(double fcd, long ord=1, double amax=3.0) { // amax - attenuation at cutoff gain = 1; order = ord; double epi = pow( (pow(10.0,(amax/10.)) - 1.0) ,(1./(2.0*ord))); // fcd - desired cutoff frequency (normalized) double wca = 2.0*tan(PI*fcd)/epi; // wca - pre-warped angular frequency n2 = (order+1)/2; odd = (order%2); roots = new complex[n2]; if (odd) iir_1 = new iir_1st< Numeric >; get_roots(wca,order,n2); bilinear(n2); iir = new iir_2nd< Numeric >[order/2]; get_coeff(n2); } //! Destructor ~butterworth() { delete [] roots; if (odd) delete iir_1; delete [] iir; } //! Reset history void reset() { for (int j=odd;jreset(); } } //! print coefficients void print() { for (int j=odd;jclock(tmp); return(gain*tmp); } private: //! Calculate roots void get_roots(double wp, long n, long n2) { long l = 0; if (n%2 == 0) l = 1; double arg; for (int j=0;jset_coeff(-tmp); gain *= 0.5*(1+tmp); } for (j=odd;j((a*a - magsq(roots[j])), 2.0*a*roots[j].imag())/td; } } //! Get 2nd order IIR coefficients void get_coeff(long n2) { for (int j=odd;j class chebyshev { private: long order; long odd; long n2; complex* roots; iir_2nd< Numeric>* iir; iir_1st< Numeric>* iir_1; double gain; double* coeff; double epi; public: //! Constructor, fcd = cut-off (1=sampling rate) //! ord = Filter order //! ripple = passband ripple in dB chebyshev(double fcd, long ord=1, double ripple=3.0) { gain = 1; order = ord; epi = pow(10.0,(ripple/10.)) - 1.0; epi = pow(epi,(1./(1.0*ord))); double wca = tan(0.5*PI*fcd); //! wca - pre-warped angular frequency n2 = (order+1)/2; odd = (order%2); roots = new complex[n2]; if (odd) iir_1 = new iir_1st< Numeric >; get_roots(wca,order,n2); bilinear(n2); iir = new iir_2nd< Numeric >[order/2]; get_coeff(n2); } //! Destructor ~chebyshev() { delete [] roots; if (odd) delete iir_1; delete [] iir; } //! Reset history void reset() { for (int j=odd;jreset(); } } //! print coefficients void print() { int j; for (j=odd;jprint(); } //! Clock in sample and get output. Numeric clock(Numeric in) { Numeric tmp = in; for (int i=odd;iclock(tmp); return(gain*tmp); } private: //! Calculate roots (chebyshev) void get_roots(double wp, long n, long n2) { long l = 0; if (n%2 == 0) l = 1; double arg; double x = 1/epi; double asinh = log(x + sqrt(1.0+x*x)); double v0 = asinh/(double(n)); double sm = sinh(v0); double cm = cosh(v0); for (int j=0;j(-sm*cos(arg),cm*sin(arg)); l += 2; } } //! Do bilinear transformation void bilinear(long n2) { double td; int j; const double a = 1.; if (odd) { // For s-domain zero (or pole) at infinity we // get z-domain zero (or pole) at z = -1 double tmp = (roots[0].real()-a)/(a+roots[0].real()); iir_1->set_coeff(-tmp); gain *= 0.5*(1+tmp); } for (j=odd;j((a*a - magsq(roots[j])), 2.0*a*roots[j].imag())/td; } } //! Get 2nd order IIR coefficients void get_coeff(long n2) { for (int j=odd;j #include "spuc.h" #include namespace SPUC { //! \brief Spuc template complex class. //! Basically the same as STL complex class but allows easier customization. template class complex { public: T re; T im; complex() { re = 0; im = 0; } void* operator new (size_t) { T* re = new T; T* im = new T; } complex(T r, T i) :re(r), im(i) {} complex(T r) : re(r), im(0) {} // template <> complex(const complex& y) : re(y.re), im(y.im) {;} inline T real() { return(re);}; inline T imag() { return(im);}; friend T real( complex y ) { return(y.re);} friend T imag( complex y ) { return(y.im);} inline T operator=(T r) { re = r; im = 0; return r; } inline complex operator =(const complex& y) { re = (T)y.re; im = (T)y.im; return *this; } inline complex operator *=(const complex& y) { T r = re*y.re - im*y.im; im = re*y.im + im*y.re; re = r; return *this; } inline complex operator +=(const complex& y) { re += y.re; im += y.im; return *this; } inline complex operator -=(const complex& y) { re -= y.re; im -= y.im; return *this; } #ifndef DOXYGEN_SHOULD_SKIP_THIS operator const complex () const { return(complex((long)re,(long)im)); } #endif }; #ifndef DOXYGEN_SHOULD_SKIP_THIS template inline complex operator *(complex r, complex l) { complex x; x.re = ((r.re*l.re) - (r.im*l.im)); x.im = (r.re*l.im + r.im*l.re); return x; }; //! template inline complex operator +(complex r, complex l) { complex x; x.re = r.re + l.re; x.im = r.im + l.im; return x; }; //! template inline complex operator +(complex r, T l) { complex x; x.re = r.re + l; x.im = r.im; return x; }; //! template inline complex operator +(T r, complex l) { complex x; x.re = r + l.re; x.im = l.im; return x; }; //! template inline complex operator -(complex r, complex l) { complex x; x.re = r.re - l.re; x.im = r.im - l.im; return x; }; //! template inline complex operator -(complex r, T l) { complex x; x.re = r.re - l; x.im = r.im; return x; }; //! template inline complex operator -(T r, complex l) { complex x; x.re = r - l.re; x.im = -l.im; return x; }; //! template inline complex operator &(complex r, T l) { complex x; x.re = r.re & l; x.im = r.im & l; return x; }; //! template inline complex operator &(T r, complex l) { complex x; x.re = r & l.re; x.im = r & l.im; return x; }; template inline complex operator %(complex r, T l) { complex x; x.re = r.re % l; x.im = r.im % l; return x; }; //! template inline complex operator ^(complex r, T l) { complex x; x.re = r.re ^ l; x.im = r.im ^ l; return x; }; //! template inline complex operator ^(T r, complex l) { complex x; x.re = r ^ l.re; x.im = r ^ l.im; return x; }; template inline complex operator |(complex r, T l) { complex x; x.re = r.re | l; x.im = r.im | l; return x; }; //! template inline complex operator |(T r, complex l) { complex x; x.re = r | l.re; x.im = r | l.im; return x; }; //! Left shift template inline complex operator <<(complex r, const long shift) { complex res = complex(r.re << shift, r.im << shift); return(res); } //! Right shift template inline complex operator >>(complex r, const long shift) { complex res = complex(r.re >> shift, r.im >> shift); return(res); } //! template inline complex operator -(complex r) { complex x; x.re = -r.re; x.im = -r.im; return x; }; //! inline complex operator *( double r, complex l) { return(complex((long)floor((double)(r*l.re+0.5)), (long)floor((double)(r*l.im+0.5)))); }; //! inline complex operator *( long r, complex l) { complex x; x.re = (r*l.re); x.im = (r*l.im); return x; }; //! inline complex operator *( double r, complex l) { complex x; x.re = (r*l.re); x.im = (r*l.im); return x; }; //! template inline complex operator *(complex r, T l) { complex x; x.re = r.re*l; x.im = r.im*l; return x; }; //! template complex operator /(complex l, T r) { complex x(0,0); if (r != 0) { x.re = l.re/r; x.im = l.im/r; } //! else is an error condition! return x; }; //! template complex operator /(complex r, complex l) { complex x; T2 den; den = magsq(l); x = (r * conj(l))/den; return x; }; //! template inline bool operator ==(complex r, complex l) { return ((r.re == l.re) && (r.im == l.im)); }; //! template inline bool operator !=(complex r, complex l) { return ((r.re != l.re) || (r.im != l.im)); }; //! Unit magnitude polar to rectangular conversion inline complex expj(double x) { complex y; y.re = cos(x); y.im = sin(x); return y; } //! Polar to rectangular conversion inline complex polar(double amp,double arg) { complex y; y.re = amp*cos(arg); y.im = amp*sin(arg); return y; } //! Complex value (0,1) template inline complex complexj(void) { return(complex(0,1)); } template inline T re(complex x) { T y; y = x.re; return y; }; template inline T im(complex x) { T y; y = x.im; return y; }; //! Conjugate template inline complex conj(complex x) { complex y; y.re = x.re; y.im = -x.im; return y; } //! Magnitude Squared of complex vector template inline T magsq(complex x) { T y; y = (x.re*x.re + x.im*x.im); return y; }; //! Normalized vector (magnitude = 1) template inline complex norm(complex x) { T y; y = ::sqrt(x.re*x.re + x.im*x.im); return (complex(x.re/y,x.im/y)); }; template inline T approx_mag(complex x) { return(MAX(abs(x.re),abs(x.im)) + MIN(abs(x.re),abs(x.im))/4); }; template inline complex maxvalue(complex x1) { return(complex(MAX(x1.re,x1.im))); }; template inline complex minimum(complex x1, complex x2) { return(complex(MIN(x1.re,x2.re),MIN(x1.im,x2.im))); } template inline complex maximum(complex x1, complex x2) { return(complex(MAX(x1.re,x2.re),MAX(x1.im,x2.im))); }; //! Return phase angle (radians) of complex number template inline double arg(const complex x) { double TMPANG; if (real(x) == 0) { if (imag(x) < 0) return(3.0*PI/2.0); else return(PI/2.0); } else { TMPANG=atan((double)imag(x)/(double)real(x)); if (real(x) < 0) TMPANG -= PI; if (TMPANG < 0) TMPANG += TWOPI; } return(TMPANG); } //! Convert to complex template inline complex rational(complex l) { return(complex((double)l.re,(double)l.im)); } //! Round by bits, to near integer - return(complex) inline complex round(complex in, long bits) { double scale = 1.0/(double)(1 << bits); return(complex((long)floor((double)(scale*in.re)+0.5), (long)floor((double)(scale*in.im)+0.5))); } //! Saturate to specific number of bits (signed) inline complex saturate(complex in, long bits) { complex out; long low_mask = ((1<<(bits-1)) - 1); if (labs(in.re) > low_mask) out.re = (in.re>0) ? low_mask : ~low_mask; else out.re = in.re; if (labs(in.im) > low_mask) out.im = (in.im>0) ? low_mask : ~low_mask; else out.im = in.im; return(out); } template complex signbit(complex in) { return(complex(SGN(in.re),SGN(in.im))); } //template T real(complex& y) { return(y.re);} //template T imag(complex& y) { return(y.im);} template inline complex reciprocal(complex x) { T y; y = (x.re*x.re + x.im*x.im); return (complex(x.re/y,-x.im/y)); }; //! squaring function template inline complex sqr(complex x) { return (x*x); }; //! square root function (same as sqrt in spuc_math.h) template inline complex csqrt(complex x) { double mag = sqrt(sqrt(magsq(x))); double ang = 0.5*arg(x); // ambiguity return(polar(mag,ang)); }; //! complex exponential inline complex exp(complex x) { return (::exp(x.real()) * expj(x.imag())); } //! same name as math library inline double hypot(complex z) { double _hypot(double x, double y); return _hypot(z.imag(), z.real()); } #endif } // namespace SPUC #endif sigviewer-0.5.1+svn556/src/signal_processing/SPUC/iir_1st.h000066400000000000000000000045121154433734200233700ustar00rootroot00000000000000// // Copyright(c) 1993-1996 Tony Kirke // author="Tony Kirke" * /* * SPUC - Signal processing using C++ - A DSP library * * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef IIR_1ST #define IIR_1ST #include using namespace std; namespace SPUC { //! \brief Template Class for 1st Order iir filter //! //! \ingroup iir //! Template for 1st Order IIR filter

//! The filter is assumed the first order low pass digital filter //! generated by the bilinear transform of a first order analog //! filter. //! \f$ G(z) = \frac{1+z^-1}{1-a*z^-1} \f$

where a is real and |a| < 1 //! Note: Not normalized template class iir_1st { protected: double gain; Numeric out; Numeric previous_out; Numeric previous_in; public: iir_1st(double A=0) : gain(A) { previous_in = previous_out = out = 0 ; } void set_coeff(double A) { gain=A;} //! Constructor reading coefficient from a file. iir_1st(const char* file) { FILE *iirf = fopen(file,"r"); fscanf(iirf,"%lf",&gain); fclose(iirf); previous_in = previous_out = out = 0; } //! Print out coefficients void print() { cout << "IIR Coefficient gain = " << gain << "\n"; } //! Input new sample and calculate output Numeric clock(Numeric input) { // Shift previous outputs and calculate new output */ // out = gain*previous_out + (1-gain)*input; out = gain*previous_out + (input+previous_in); previous_out = out; previous_in = input; return(out); } //! Reset void reset() { previous_in = previous_out = out = 0; } }; } // namespace SPUC #endif sigviewer-0.5.1+svn556/src/signal_processing/SPUC/iir_2nd.h000066400000000000000000000054551154433734200233530ustar00rootroot00000000000000// // Copyright(c) 1993-1996 Tony Kirke // author="Tony Kirke" * /* * SPUC - Signal processing using C++ - A DSP library * * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef IIR_2ND #define IIR_2ND namespace SPUC { /*! \addtogroup iir IIR filters */ //! \brief Template for 2nd Order IIR filter

//! \ingroup iir //! //! Template for 2nd Order IIR filter

//! The filter is assumed to be a low pass 2nd order digital filter //! of the form \f$ G(z) = \frac{b0*z^2 + b1*z+b2}{(z^2+a1*z+a2)} \f$ //! \image html iir_2nd.gif //! \image latex iir_2nd.eps template class iir_2nd { protected: Numeric b0,b1,b2; Numeric a1,a2; Numeric in[3]; Numeric out[3]; public: iir_2nd(Numeric B0, Numeric B1, Numeric B2, Numeric A1, Numeric A2) : b0(B0), b1(B1), b2(B2), a1(A1), a2(A2) { in[0] = in[1] = in[2] = out[2] = out[1] = out[0] = 0 ; } iir_2nd(Numeric A1=0, Numeric A2=0) : b0(1), b1(2), b2(1), a1(A1), a2(A2) { in[0] = in[1] = in[2] = out[2] = out[1] = out[0] = 0 ; } void reset() { in[0] = in[1] = in[2] = out[2] = out[1] = out[0] = 0 ; } void set_a(Numeric A1, Numeric A2) { a1=A1; a2=A2;} void set_b(Numeric A1, Numeric A2) { b1=A1; b2=A2;} void set_coeff(Numeric A1, Numeric A2) { a1=A1; a2=A2;} //! Constructor reading coefficients from a file. iir_2nd(const char* file) { FILE *iirf = fopen(file,"r"); fscanf(iirf,"%lf %lf %lf %lf %lf",&b0,&b1,&b2,&a1,&a2); fclose(iirf); in[0] = in[1] = in[2] = out[2] = out[1] = out[0] = 0; } //! Print out coefficients void print() { printf("IIR Coefficients B0 = %lf, B1 = %lf, B2 = %lf",b0,b1,b2); printf(" A0 = 1, A1 = %lf, A2 = %lf\n",a1,a2); } //! Input new sample and calculate output Numeric clock(Numeric input) { // Shift inputs by one time sample and place new sample into array in[0] = in[1]; in[1] = in[2]; in[2] = input; // Shift previous outputs and calculate new output */ out[0] = out[1]; out[1] = out[2]; out[2] = b0*in[2] + b1*in[1] + b2*in[0] - a1*out[1] - a2*out[0]; return(out[2]); } }; } // namespace SPUC #endif sigviewer-0.5.1+svn556/src/signal_processing/SPUC/spuc.h000066400000000000000000000224521154433734200227730ustar00rootroot00000000000000/*! \mainpage * SPUC - Signal processing using C++ - A DSP library *

Copyright (C) 1993-2005 Tony Kirke. * * 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, 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

Signal Processing using C++ (SPUC)

Motivation:Why use C++ for DSP Simulation/Modeling?

Todays IC and system designers typically use either C or costly 2nd party tools to simulate/model Digital Signal Processing algorithms. While the latter are well suited for modeling "hardwired" DSP blocks with rather simplistic dataflows, they are very inefficient for modeling the control logic that is often required in todays DSP applications (such as ADSL or V.34 modems). while C is well suited to control logic type structures (if,else, case, etc.), it is not highly desireable for manipulation of complex or user defined data types (such as fixed width integers).

C++ bridges this gap and is the underlying language of choice for the cumbersome GUI based tools.


Objective

The objective of SPUC is to provide the Communications Systems Designer or DSP Algorithm designer with simple, efficient and reusable DSP building block objects. Thus allowing a transition from System design to implementation in either programmable DSP chips or hardwired DSP logic. While Matlab is perhaps the most useful available tool for this purpose, it can be quite slow for simulation and it favors a matrix/block based approach rather than the sample by sample simulations that are often most useful for communications systems design. Also Matlab is generally awkward or inefficient when dealing with several interactive feedback loops where C/C++ is perhaps the most useful environment. For bit-accurate simulations (for VLSI design) C/C++ generally outperforms and is easier to manipulate than Matlab or other GUI-based tools.

This Class Library

  • 1) basic building blocks such as complex data types, Fixed-bit width integer classes, pure-delay blocks, etc.
  • 2) Basic DSP building blocks such as FIR, IIR, Allpass, Running Average, Lagrange interpolation filters, NCO, Cordic rotator.
  • 3) Several communications functions such as timing, phase and frequency discriminators for BPSK/QPSK signals.
  • 4) Other miscellaneous DSP/Communications related functions/classes.
  • 5) Ability to design several types of FIR and IIR filters
  • 6) Various adaptive equalizer classes
  • 7) This library now includes code from IT 3.7.0. Code was modified to work together with SPUC and replace Vector and Matrix classes from TNT.
  • 8) Capitalized and uppercase class names are classes not originally in SPUC
The classes are designed so that they can be used in a simple straight forward manner. For example, a FIR would be initialized with its tap weights and then simply a member function would be called every time a sample is input or an output is required.

For downloading files go to

Project Page at Sourceforge

Before discussing why C++ is better than C for DSP programming. Let's look at some of the pros and cons for C++ vs. the alternatives.

Pros

  • The common alternatives are very costly (Alta's SPW, Synopsys Cossap etc.)
  • Long learning times/training not required for C++ programmers.
  • For complex simulations, C++ is more efficient and yields shorter run times.
  • Ideal for modeling a combination of control logic and hardwired DSP blocks.
  • Code entry can be faster than GUI based tools.
  • Looks closer to Verilog/VHDL than alternative tools.
  • C/C++ has a large user base.
  • Lots of freely available C/C++ code.
  • Infinitely customizable.
  • Portable to different platforms.
  • Can take advantage of Windows GUIs if desired.

Cons

  • No standardization!
  • Lack of documentation.
  • Not user friendly/ No GUI.
  • Potential portability problems.
  • No technical support.

Please see links such as those below for why to use C++ over C in general.
Nathan Myers C++ Articles
C++ Programming for Scientists Course (PDF) from NIST
Various C++ Math classes from Roldan Pozo at NIST

Advantages of C++ over C

  • Object Oriented Language
  • Abstract Data typing
  • Inheritance
  • Polymorphism
  • Comments do not extend over more than one line
  • Variables can be declared anywhere.
  • Dynamic memory allocation is simpler.
  • Function Overloading

C++ allows templates and operator overloading.
For example, we can define a complex data type based on templates. Then this class can be used whether we need floating point (double), integer, or user defined fixed bit width data types.This not only requires less code to document/debug, but also through operator overloading we can make the code much easier to read and potentially make the look and feel very close to a Hardware Description Language (HDL)such as Verilog or VHDL. Also this style makes it much easier to change your programs data types (from floating point -> integer -> fixed bit width for example), without having to change every line of code.

C++ allows for much better interfaces between classes or DSP blocks.
Because C++ supports initialization through constructors and there can be a variety of member functions, data can be handled in a much smoother manner than C. With data hiding, the code becomes much simpler to read, allowing a high level look at the code.

Inheritance
Inheritance helps you to re-use code.You can derive new types or classes from an old one and make changes only where you need them. This promotes code re-use.

Classes

  • Hide complexity.
  • Create a more convenient object oriented interfaces
  • Can create more than one instance of a structure.
  • Similar to C structure but can include functions.
  • Data abstraction and hiding allows changes to be localized to one section.
  • Private, Protected, Public members

For Hardware Modeling
C++ can be made to replicate hardware much easier than C. Functions and variables can be localised to each block (hiding complexity) in the same way that Verilog /VHDL does. Easier to have a hierarchical structure. Classes can be instantiated in same manner as in a HDL (C makes this difficult). New chip designs can inherit subblocks or a large section from an old design. Only the new or changed blocks need to be coded. Also the interfaces to the chip can remain the same if desired. When classes are designed in this manner it is quite easy to see the difference between objects. */ //! SPUC - Signal processing using C++ - A DSP library //! includes code from other sources including IT++ 3.7.0 //! \namespace SPUC namespace SPUC { //! \file //! \brief Various Defined Constants and Macros //! \author Tony Kirke, Copyright(c) 2001 #ifndef MYINCLUDE #define MYINCLUDE #define MAXINT 32767 #define MXLONG 4294967295 #define BIG 72057594037927936. // Maximum precision of DOUBLE */ #define HUGED 1.701411733192644270e38 // Largest DOUBLE */ #define LOGHUGE 39 // 10^39 --> Largest power */ #define LN2 0.69314718055994530941 #define ILN2 1.4426950408889634 // 1/LN2 #define LN10 2.30258509299404568401 #define E 2.7182818284590452353602874 #define SQRT2 1.41421356237309504880 #define HALFSQRT2 .70710678118654752440 #ifndef PI #define PI 3.141592653589793238462643 #endif //#define pi PI #define QUARTPI 0.78539816339744830962 #define HALFPI 1.57079632679489661923 #define TWOPI 6.28318530717958647692 #define RADPDEG 0.01745329251994329576 #define RTD 57.295781 // radian to decimal conversion factor // macros #define SQR(x) ((x) * (x)) #define SGN(x) ((x) < 0 ? -1 : 1) #define XSWAP(a,b) a ^= b, b ^= a, a ^= b #define SWAP(a,b,c) c = a, a = b, b = c #ifndef MAX #define MAX(x,y) ((x) >= (y) ? (x) : (y)) #endif #ifndef MIN #define MIN(x,y) ((x) <= (y) ? (x) : (y)) #endif #ifndef ABS #define ABS(x) ( (x < 0) ? (-x) : (x)) #endif //#define abs(x) ((x)<0? -(x):(x)) // Integer Absolute value */ //#define fabs(x) ((x)<0.? -(x):(x)) // Floating absolute value */ #define MODULO(x,y) ((x)%(y)) // Integer modulo */ #define LOGE(x) (log(x)) // Natural log */ #define LN(x) (log(x)) // Natural log */ #define MASK_LOW(n) ((1<B) ? B : ((A #include #include #include namespace SigViewer_ { //--------------------------------------------------------------------------------------- using std::vector; const unsigned int NotchFilter8::FILTER_ORDER = 8; const double NotchFilter8::POLE_DISTANCE = 0.995; //--------------------------------------------------------------------------------------- NotchFilter8::NotchFilter8(double fs, double freq) :a_(FILTER_ORDER +1,0), b_(FILTER_ORDER+1,0), d_(POLE_DISTANCE), fs_(fs), freq_(freq) { if(freq >= fs/2) throw(std::invalid_argument("Filter freq must be lower than fs/2!")); if(!freq) throw(std::invalid_argument("Filter freq must not be 0!")); if(!fs) throw(std::invalid_argument("Fs must not be 0!")); double w = (2 * M_PI * freq)/fs; std::complex e1(0,w); std::complex e2(0,-w); std::complex v_comp = std::exp(e1) + std::exp(e2); if(v_comp.imag()) throw(std::runtime_error("Coefficient factor has imaginary part -- something went wrong!")); double v( v_comp.real() ); b_[0] = 1; b_[1] = -4* v; b_[2] = 4 + 6 * pow(v,2); b_[3] = -12 * v -4 * pow(v,3); b_[4] = 6 + 12 * pow(v,2) + pow(v,4); b_[5] = b_[3]; b_[6] = b_[2]; b_[7] = b_[1]; b_[8] = b_[0]; a_[0] = b_[0]; a_[1] = b_[1] * d_; a_[2] = b_[2] * pow(d_, 2); a_[3] = b_[3] * pow(d_, 3); a_[4] = b_[4] * pow(d_, 4); a_[5] = b_[5] * pow(d_, 5); a_[6] = b_[6] * pow(d_, 6); a_[7] = b_[7] * pow(d_, 7); a_[8] = b_[8] * pow(d_, 8); } //--------------------------------------------------------------------------------------- //template //void NotchFilter8::filter (T& in, T& out, int in_out_size) //{ //} //--------------------------------------------------------------------------------------- } sigviewer-0.5.1+svn556/src/signal_processing/notch_filter8.h000066400000000000000000000033101154433734200240070ustar00rootroot00000000000000#ifndef NOTCH_FILTER8_H #define NOTCH_FILTER8_H //--------------------------------------------------------------------------------------- #include "base/filter.h" #include #include namespace SigViewer_ { //--------------------------------------------------------------------------------------- class NotchFilter8 : public Filter { public: NotchFilter8(double fs, double freq); virtual void filter (double* in, double* out, int in_out_length) const { filterImpl (in, out, in_out_length); } private: template void filterImpl (T const& in, T& out, int in_out_size) const { double temp = 0; double sum = 0; boost::circular_buffer buffer(8); for(unsigned int m = 0; m < 8; m++) buffer.push_front(0); for(int n = 0; n < in_out_size; n++) { sum = 0; for(unsigned int m = 0; m < buffer.size(); m++) sum += buffer[m] * -a_[m +1]; temp = in[n] + sum; sum = temp * b_[0]; for(unsigned int m = 0; m < buffer.size(); m++) sum += buffer[m] * b_[m +1]; out[n] = sum; buffer.push_front(temp); } } static const unsigned int FILTER_ORDER; static const double POLE_DISTANCE; std::vector a_; std::vector b_; double d_; double fs_; double freq_; }; } //--------------------------------------------------------------------------------------- #endif // NOTCH_FILTER8_H sigviewer-0.5.1+svn556/src/signal_processing/signal_processing.pri000066400000000000000000000004761154433734200253250ustar00rootroot00000000000000HEADERS += \#signal_processing/fftw++.h \ signal_processing/FFTReal.h #\ #signal_processing/notch_filter8.h \ # FIXXME: deactivated for 0.4.3 release #signal_processing/SPUC/*.h SOURCES += \# signal_processing/fftw++.cc \ signal_processing/FFTReal.cpp# \ #signal_processing/notch_filter8.cpp sigviewer-0.5.1+svn556/src/sigviewer.icns000066400000000000000000001422411154433734200202460ustar00rootroot00000000000000icnsġis32UTSQ3_aluri^_3ZΥIaqJ^$'5y3G/8|̬յ])]cVr|f|a/b Ŀеuӷ\WͯNu\K<jdUTSSQjg⿎κ݁ɺȺ}º>|Dɽƾ|:sdgsp}il7ɠㇵ hnb^ ƻԴuϴ\WΰOu\K<jdUTQնʹߴګۮܵ״ز Ա bխ ڳvͻ˯\XϱOu\K<jds8mk*rnoooooooooop$#%"%vs}OYil32 "20//0nO2N)L6B@LV\chopkli_ZUPA7?$(O:KQRQbfkkjsjblh\RYSMH;J;iLѾ?C!c-GDFE<7S9>GFEH%1 ۼ{ y}Ol.  ( ̓,g]!$160! "20//0nO2 N΀)L8rx|`K(OU~鲦op`)Pf筟٪ؾ㗆k+Rf-Td꥜򡄑k`.V;blnz|qrigZP0X4=Z}lrwukaI4N1ZLl멥ۜس}J2\{I4^E^Mwd]ZdeU\FNS2P5^ELUb^^igaapxedntOozABQ6`KZPчggpvh]WMU8bǁU9c{ǮĴs_:dUY^xs|wcg^SL`;evs};iTѾ?C!c-GDFE<7S9>GFEH%1 ۼ{ y}Ol.  ( ̓,g]!$160! "20//0nO2 N׀ـ8)Lšɷ(OȷԀ?˽)Pʾ+R-T̻ż.VѦĻ0Xӡ紥1Zӭ˾İ2\ׯ4^٫忽º󺰳5^ܭǶƮ6`ްþ8b9cĽ:d޸Ŀ;e;iTҾ?C!c-GDFE<7S9>GFEH%1 ۼ{ y}Ol.  ( ̓,g]!$160! l8mkFc_`````````````````````_c;WF{}~~~~~~~~~~~~~~}ak $М/cTh}y2ԘF?glG it32q^_`a`]YB[_avh_W]a} Șa[.^a һh\'\aռhWP`ֵa@\hҋ[_۽a+SaoEVaօSWaٛRUaنٛQTaچڔڜQSaچK$XTVWYZ[]^_abdefhiklmopqrtuvxyz{|}~'~}|{zxwvusrqonmkjhgfdcb`_^\[ZXWUTRQPWKڜQUbۆ$=?ACEGHJLNORSUWXZ\^`bceghjlmoprstuvwx'wvutrqpnmkigfdca_][YXVTSQOMKIHFDB@><;97"۝RUc܆% 7=?@BDFHJKMOQSTVXZ[]_abdfgiklnoprstuuv(utsrqpnmljhgecb`^\[YWUTRPNLKIGECA@><:975۞SWd݆&2;<>@BDFGIKLNPRTVWY[\^`acefhiklnopqrsst)srrqonmljhgedba_][ZXVUSQOMLJHGECA?=<:8642ܞTWd݆:<>?ACEGHJLNOQSUVXZ[]_`bcefhiklmnopqqr1qpponmljigfdca`^\[YWVTRQOMKIHFDB@?=;98642-ܟTWeކ`68:;=?@BDFHIKMOPRTVWYZ\^_abdefhijlmmnoopponmlkjhgfdcb`_][ZXVUSRONLJIGZgV@><;975310ݠUYf߆a'579;<>@ADEGIJLNOQSUVXY[\^`abdefghikllmmnnmlkjihgfdcb`_]\ZYWUTRQOMKJH?=<:86431/-ݠUYf߆. 3578:<=?ABEFMNPRTUWXZ[]^`abcefghhijkkll.jihgfedcb`_^\ZYWVTSQONLJIGS=;986420/-ݡUYg24689;=>@BDZLMOQRTUWXZ[]^`abcdefgghizhgfeedba`݊YXVUSRPNMKJH{c<:975310.,%ޢVZh'13579:<>?ABKLNOQSTVWXZ[\^cdeefgfeddcba`_XVUTRQOMLJIGf;:86421/-,*ޣVZi/124689;=>@AJKMNPRSTVWXZ[nabccuvedcc_^]VUTRQONLKIHFہ:9M\J20.-+)ޣXZi.013oq:<=?w IJPRfuiWXY`abː ba]\[ TRQIH[z981/-,*(ߤX\j -/H9;<>΁ GbƆpq`qZ RQO\bi+)'ߥY\j ,.[ր^|jQObσ*(&Y\k,-؈ڃmN)'&Z^l+, [LQh(&% Z^m +ѷ 񅆂YPOۮ:Oly)'%$[^m*Ր݀78:;<IKLMNOPQRRہߥWWɂ SSecNM%Yg=<:97.-+*(&$[`n)+,./124578:;ˀCDFGHIJKLMNOOP€TUUT RRQPONMLLKف&BA@>=<:9864310.-,*(&%#\ap*+,./124678:tACDEFGHIJKLMMNO儁RSRe PONNMLLKJI}&A@>=<:9865320/-,*)'%$ ^ap)®(*+-.0124678:?@ABCEFGGHIJKLLMMNNOOPNMMLKKJIHGF'?>=<:9865320/.,+)'&$#^aqï")*+-.01245789;<=>?@ACDEFGGHIJJKKLLMN(`LKKJIIHGFED?><;:9865320/.,+)(&%# _crİ! )*,-.01245789:;=>?@ABCDEFFGHHIIJJKLK%JJIIHGGFEDCB\Z=<;:9764320/.,+*(&%#" _csű%)*,-.01235689:;<=>?@ABCDDEFFGHIJI$HHGGFFEDCBA@??>=;:98764320/.,+*(&%$"  _csŲ%)*,-./12346789:;<=>?@AABCDEEFGH\G#FFEEDCCBA@??>=<;:98754310FVC+*('%$" _etƳ%)*+-./02345789:;;<=>?@@AABCCDDEFE"DDCCBAA@?>>=<;:987653210*('%$" aeuǴ")*+,.2356789:;;<=>>?@@AABC$CBBAA@@??>==<;:9876543210.@&%$"  bgvȶ(*+C123456789::;<<=>>??@AV@??>>==ts9877643210/.iP%$  cgvȶ()/01234567889::s=>?>==<<;;776432210.-,T$ ch}ʸ -./0123456778O݀;<RcS=ށ<ss:995433210/.-,+ց 2 dh}˹JJM ,-jk01I[J456r:s ::887 n221,+Bf dh}˺  *EmnNN8N5 10/B 7J eh~̻2̀6]J/.Dà ej~ͽ͈уK, fj~ξ 2*$K fjϿƥ jk0۝,+њ $L_ glz{|f ؞"%(),Ӂא{.. j-,CggB)&.D |z hl  !!""d*+, ))&&#"ρ  hl Zo !""##$$%ee&> $$##"!! `  hn#  !""#$$%%&&'(&&%%$##"!!   jo%  !"##$%&&''(())*+***A((''&%%$#""  ko"  !"#$%%&'(()**+,-,+4**)(''&%$$Byx@ ko$  !"#$%&''()*++,,--./F..-4,,+**)('&%%$#"! 0B- ko$  !"#$%&'()**+,--..//0100/4..-,,+*))'&&%$#"  lo$ $%&'()*+,,-../0011232140//..-,++*)'&%$#"! / lq :%&()*+,-../001223345K4321100ki,+*)'&%$#" _D mq !')*+,-.//01223n6788665543321-,+*)('&$#"!I nq !#)*,-./0012344K݀89O`P:݁8qp543/.-,+*)'&%$"Ձ/B, ns\_ "#c +,ik01I[K567s;t ::776 l0/.(&=b os3 "#%ȁ -IqrSSY qvͱ zzFߦ=<ק'>^mqvӊx+,./1ެ>?@AABCDEF؁ܞIHł {EDXxwU?>%K[-,*)'qv!#$&')+,./12Ȁ;<=>?@ABDEEFGH}KJ GGFEDCBA@?ց&65320/-,*)'%$" sx!"$%')+,./124q<>?@ABDEFGGHIJJ倃M` IIHGFEDCBAx&865320/-,*(&%#" tx) "#%')*,-/12457=>?@BCDEFGHIJKLLMMNONKKJIHGFEDBA'9865320.-+*(&$#!ux,!#$&(*,-/023578:;=>?ABDEFGHIJKLMMNOOPPQ:PbMLLKJIHGFEC<;9865310.-+)'&$" uz, "$&')+-.023578:;=>@ABDEGHIJKLMNOPPQRRSTTS9RRQPONNMLKJIGFE^Z><;986431/.,*)'%#! vz-!#%')*,.013578:;=>@ACDFGHIKLMNOPQRSSTTUVU9TTSRRQONMLKJIHFEDBA?><;986421/-,*(&$"!vz."$&(*,-/124689;<>@ACDFGIJKLMOPQRSTTUVVWXW9VVUTSSRQONMLKIHGEDB@?=<:975320.-+)'%#" v3|#%')+-.023579;<>?ACDFGIJKMNOQRSTUVVWXXYZY9XWWVUTTSRPOMLKJHGEDB@?=<:87531/.,*(&$#!w3}$&(*,./13578:<=?ABDFGIJLMNPQRTUVWXXYZZ[\[9ZYYXWVUTSRQONLKJHGEDB@>=;986420/-+)'%$" x}̀ЀрӁԁՃւׄցՀԀӀЀ̀x } y }ЅÎŇĂ:zw}zwvzwZ^v,uvu$ޕ5sWlqZ坂 Vހہ؀׀ՀӀl#̸?.h}l?0Xxd 0Ryf+5%Hb{q_\ZP<-T]aat܂ۃڂك؂ׂփ |aa]V5 Z`bcv˦ēcc^RZbcdȆxd_OcfpÇyf]4Zghǡ朶reHah}ڊğ鞷gXPkڔlUclÝݙn>l ⪫ߕ ҜlUrʊٰ|Pl}ťĭcn̽łss.ym*u`}Ր#b({Acڇov؉${@wɿ۟Amλ٫|$@·̬[ ZƱּrZԪʱf1I}ɡıXR~̓ö`'KjqQ'@]|{bI'65_\|{|d]I4^_`a`]YB[_avh_W]a} Șa[.^a һh\'\aռhWP`ֵa@\hҋ[_۽a+SaoEVaօSWaٛRUaنٛQTaچڔڜQSaچi$|'iڜQUbۆ>%U~(}{ywa>۝RUc܆>%Ix}(}{ywu\>۞SWd݆>&Br{})~|zxvurN>ܞTWd݆>&bx{|~1}|zxvtrmA>>ܟTWeކ`>>Lvxz|~ⲱ}{ywusqpY>>ݠUYf߆a>>fvwy{}ڀ~|zxvusqomD>ݠUYf߆*>Hsuwx{|~Ϗ.ݭ}{zxvtrpnlW>ݡUYg>[rtvxz|}빜|{ywusqpnle>ޢVZh>gqsuwy{|~ʀ䦧΁͚Ӂ|zxvurqomkiFޣVZi>oqrtvxz|}ѽ䙗{yrpnljiMޣXZiDnpqs{|~ ưƁ ȋzxqomkjhRߤX\jImoz{}߁ ܵ˷˝́ ́kigRߥY\jIlnȁ߃jhfQY\kDkm€ѐ·igeQZ^l>jl ҀƁgfdIZ^m>_k ʛے{hfecC[^m>Qjⲳwxz{}ނ Ѓ%ݚ~|{ywnlkiged[>[`n>Cijlmoqrtuwxz|܀ۄـ &~|{zxvusqpnmkihfdbM>\ap>>Xiklnoqrtvwxzﲃ ꒑&~|{zxvutrpomkjhfec_@>^ap'®>>Cgiklnpqstvwxzɀ'}|{yxvutrpomljigedbO>>^aqï> Rhjklnpqstvwxz{|~(䚍~}|{yxvutrpomljigfdbZ> _crİ>"_hjklnpqrtuwxy{|}~&~}{zywvutrpomlkigfdcaD> _csű>"Cdhjklnpqrtuvxyz{|~&~}|{zxwvusrpomlkigfecaK> _csŲ>Fdhjklnoqrsuvwxz{|}~Ҁ#}|{zyxwutsqp|kihfecaM> _etƳ>Fdhjklnoprstuwxyz{|}~"}||{zxwvutrqpigfecaO> aeuǴ>Fahjklmrtuvwxyz{|}~~$˄~}||{zxwvutsrqpnxfecaK> bgvȶ>A\hij|qrstuvwxyz{||}~~~}zxwwvutrqpondc_G> cgvȶ>Rgiopqrstuvwxyzz{~~~}||{wwvutsrqpnmlʁcV@> ch}ʸ>F]mnopqrstuvwwx|}~}}|{zyvutsrqpomlkjI>ScS> dh}˹>vv>?@Ax klpquuvzz{ӡ {{xxw srqlkz>>> dh}˺> S?@BCЁ i~К臇xv qpoz gv> eh~̻>iǰ܀von}у> ej~ͽ>ڈ߃l> fj~ξ> rj[v> fjϿ>>?ս 󗘂pkkݴH[wޅ> gl>?AڜKLNOPZZ[\]`dgiknnт ll{zheftMLKJH@?> hl?ABDEFHIKLMNPQRрXYZ[[\]^^_``aajjl hheeba^]\[܁UTRQPONMKJIGFECB@?> hlACDEGHJKLNOPQSTZ[\]^^_`aabbccdefev ccbba``_^]WVUSRQPOMLKIHFEDBA?> hn"CDFGIJKMNPQRSUVW[\]^_`aabccdeefghgfeedcbba``_YXVUTSRPONLKJHGEDBA?> jo&EFGIJLMOPQSTUVXYZ[\]^_`abcddeffgghhiij(yhggfeedcbaa\[ZXWVUSRQPNMKJIGEDCA?> ko#FHIKLNOPRSUVWXZ[\]^_`abcdeffghhijjklkj3ihhgfeedcxv^\[ZYXWUTSQPOMKJIGEDCA?>>ko#HIKLNOQRTUVXYZ[]^_`abcdefghiijkkllmn~nmml3kjjihggfedcba`_]\[ZXWVhtdPOMLJIGEDCA?>ko$IKLNPQRTUWXZ[\]_`abcdefghijkklmmnnopq=ppoonnmllkjjihgfedcba_^]\ZYRPONLJIGEDB@?lo$KLNPQSTVWYZ[\^cdefghijklmmnoppqqrsrq4poonmllkjihgfedba`_]\[gRPONLJIGEDB@lqLNPQSTVWYZ\]^refghijklmnoppqrrssttuvvttssrqqppkjihgfdcba_^vTRQONLJIGEDBmqNPQSTVWYZ\]_`ghijklmnopqrssvwxxvuutsrqmlkjigfedba`Ł{UTRQONLJHFECnqOQSTVWY[\^_`bijklmnppqrstuxyzyxxuutonmlkjhgfdcaWUgscOMKJHFEnsQSTVW^_ab klpquvw{{|Ӣ {{wwv pongfvYWPOMKJHFosRTVj_abd؁ lў鋌}y rqpz}ځMKIGpuTUW~˶ހts؃NLJIquUWYuÇONLJqvVXZ ȀvvQOMKqvXZ[ ~}gvTRPNLqvY[]߫jlnoq~뵊ق Ƀ%؎mkjhf\ZYWUSQONqv[\^`bcegijlnoqrـ{|~փ &vutrpomkjhfeca_]\ZXVTRPOsx\]`acefhjlmoqrt}~ 鋊&xvutrpomkjhfdba_][YWUTRPtx)]_abdfhjkmoqrtvw}'zxvusrpnlkigfdb`^\ZYWUSQux*^`bdfgikmoprtuwyz|};圏}{zxvusqpnljigeca_]\ZXVTRuz-_acegiklnprsuwxz|}:}{zxvusqomljhfdb`_][YWUSvz-`bdfhjlnpqsuwxz|}9}{yxvtrqomkigeda`^\ZXVTvz0acegikmoqrtvxz{}9~|{ywvtrpnljifeca_][YWUv4|befhjlnprtvwy{}:~|zxwusqomkjhfdb`^\ZXVw4}degjkmoqsuwy{|~:}|zxvtrpolkigeca_][YWx}ހހx } y }܅ӆԊՂԁ?zw}zwvzwZ^v,uvu$ޕ5sWlqZ坂 Vހہ؀׀ՀӀl#̸?.h}l?0Xxd 0Ryf+5%Hb{q_\ZP<-T]aat܂ۃڂك؂ׂփ |aa]V5 Z`bcv˦ēcc^RZbcdȆxd_OcfpÇyf]4Zghǡ朶reHah}ڊğ鞷gXPkڔlUclÝݙn>l ⪫ߕ ҜlUrʊٰ|Pl}ťĭcn̽łss.ym*u`}Ր#b({Acڇov؉${@wɿ۟Amλ٫|$@·̬[ ZƱּrZԪʱf1I}ɡıXR~̓ö`'KjqQ'@]|{bI'65_\|{|d]I4^_`a`]YB[_avh_W]a} Șa[.^a һh\'\aռhWP`ֵa@\hҋ[_۽a+SaoEVaօSWaٛRUaنٛQTaچڔڜQSaچ"ރ&ڜQUbۆ$%Ϳ۝RUc܆#)˼۞SWd݆%(ʳܞTWd݆#1ƫܟTWeކ)3ȺݠUYf߆'3ƭݠUYf߆(.ƹݡUYgڀޢVZhĮޣVZiijޣXZi߁  öߤX\j  õߥY\jڀµY\kµZ^lƀ Z^m ܀[^m %[`n߀ &\ap݀ &^ap#®ڀہ܃ր'^aqï؀ـڇ( _crİ׀؀وڀـ _csűՀׂ؄ف؀ _csŲՁփ׀ր _etƳҀԁՂցՀ aeuǴҀӃԀӀ bgvȶ̀ Ѐс҂؂ӀҀց cgvȶср ch}ʸπ氩 dh}˹ā  ℩ dh}˺  eh~̻ځց ej~ͽހ fj~ξ ܁ fjϿ ׂŀޯɂ glβں ijӫ hl깺Łނ  hlì̀ ӻӃρ hnĭ⻼ˆܺ joـÃăɀ!𼻺 koƮÀāʼnƁĀ/ǽkoȯĀŀƆǁŀ.ĽkoɰĀƀǂȂȀ2鶵loʱǀȁɄȀ/lq˲ŀ ǀɀʃтˁρŷmq̳̂ˀȸnqʹ̀幸Ľns͵Ͻҁ ܀ 浴osͶ  ɲpuͷ̀ځ䳲qu͸䴳qv͸ ˵qv͹ Ѐҷqvͺ Ԁ %ܼqvͻ &sxͼۀ ߁&tx'ͼڀۆӀ'ux'ͽۀ܂ނ9uz*;݀ބ߁7vz*;ހ߇߀4vz-Ϳ8v1|5w0}9x }x } y }?zw}zwvzwZ^v,uvu$ޕ5sWlqZ坂 Vހہ؀׀ՀӀl#̸?.h}l?0Xxd 0Ryf+5%Hb{q_\ZP<-T]aat܂ۃڂك؂ׂփ |aa]V5 Z`bcv˦ēcc^RZbcdȆxd_OcfpÇyf]4Zghǡ朶reHah}ڊğ鞷gXPkڔlUclÝݙn>l ⪫ߕ ҜlUrʊٰ|Pl}ťĭcn̽łss.ym*u`}Ր#b({Acڇov؉${@wɿ۟Amλ٫|$@·̬[ ZƱּrZԪʱf1I}ɡıXR~̓ö`'KjqQ'@]|{bI'65_\|{|d]I4t8mk@Ag2{ s!' Sv.j70jAP#Z* _- `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `. `.v`.L_- Z* ~P#?rA $ڇ_08qF !Fܝ|U,(L|Z4)IiܼsU5$>ZouaH- -@R_imooooooooooooooooooooorwpoooooooooooooooooooooomkcWF3 $-3677777777777777777777R=977777777777777777777750' "m9 J=RC "sxQ& g2HY) e1 yi3 2e1Y) 7uG $Y…^13fÍkB;kpJ&  ;_֞lJ) 7X~詑}bC&/JfܶoT8#9RjШs\B*  ';Rhz֯oZD/ &9M`q~ɮudR>, !0@P`o{í~seUD3%#0=KYfqz|si\OA3& )3>IS^gnuz|vqi`VL@6,#  %,39AHOV\`eimoooooooooomkhb]XRKD<5.'   #&+.1467777777777752/,($   icnV Bsigviewer-0.5.1+svn556/src/src.pro000066400000000000000000000034131154433734200166720ustar00rootroot00000000000000TEMPLATE = app DESTDIR = $$_PRO_FILE_PWD_/../bin TARGET = sigviewer QT += core gui xml CONFIG(debug, debug|release) { message(DEBUG) DESTDIR = $$_PRO_FILE_PWD_/../bin/debug DEFINES -= QT_NO_DEBUG_OUTPUT OBJECTS_DIR = $$_PRO_FILE_PWD_/../tmp/debug MOC_DIR = $$_PRO_FILE_PWD_/../tmp/debug RCC_DIR = $$_PRO_FILE_PWD_/../tmp/debug UI_DIR = $$_PRO_FILE_PWD_/../tmp/debug } CONFIG(release, debug|release) { message(RELEASE) DESTDIR = $$_PRO_FILE_PWD_/../bin/release DEFINES += QT_NO_DEBUG_OUTPUT OBJECTS_DIR = $$_PRO_FILE_PWD_/../tmp/release MOC_DIR = $$_PRO_FILE_PWD_/../tmp/release RCC_DIR = $$_PRO_FILE_PWD_/../tmp/release UI_DIR = $$_PRO_FILE_PWD_/../tmp/release } CONFIG += warn_on \ link_prl \ qt \ thread macx:QT += opengl INCLUDEPATH += $$_PRO_FILE_PWD_/../extern/include \ $$_PRO_FILE_PWD_/. LIBS += -L$$_PRO_FILE_PWD_/../extern/lib \ -lbiosig# \ #-lGDF RESOURCES = src.qrc win32:RC_FILE = src.rc ICON = sigviewer.icns TRANSLATIONS += translations\sigviewer_de.ts \ translations\sigviewer_en.ts \ translations\sigviewer_es.ts \ translations\sigviewer_fr.ts #include(../extern/extern.pri) include(base/base.pri) include(signal_processing/signal_processing.pri) include(file_handling_impl/file_handling_impl.pri) include(file_handling/file_handling.pri) include(gui/gui.pri) include(gui_impl/gui_impl.pri) include(editing_commands/editing_commands.pri) #include(console/console.pri) #include(console_impl/console_impl.pri) include(commands/commands.pri) include(tests/tests.pri) HEADERS += application_context_impl.h \ file_context.h \ tab_context.h \ command_executer.h SOURCES += main/sigviewer.cpp \ application_context_impl.cpp \ file_context.cpp \ tab_context.cpp sigviewer-0.5.1+svn556/src/src.qrc000066400000000000000000000045461154433734200166670ustar00rootroot00000000000000 images/auto_scale_22x22.png images/channels_22x22.png images/exit_22x22.png images/fileclose_22x22.png images/file_info_22x22.png images/fileopen_22x22.png images/hand_22x22.png images/help_22x22.png images/pointer_22x22.png images/shift_signal_22x22.png images/sigviewer16.png images/sigviewer128.png images/zoom_22x22.png images/zoom_in_22x22.png images/zoom_out_22x22.png images/events_22x22.png images/new_22x22.png images/delete_22x22.png images/copy_to_channels_22x22.png images/change_channel_22x22.png images/to_all_channels_22x22.png images/change_type_22x22.png images/save_22x22.png images/save_as_22x22.png images/file_16x16.png images/info_16x16.png images/patient_16x16.png eventcodes.txt images/zoom_in_vertical_22x22.png images/icons/fileclose.png images/icons/fileopen.png images/icons/filesaveas.png images/icons/filesave.png images/icons/exit.png images/icons/next.png images/icons/previous.png images/icons/redo.png images/icons/undo.png images/icons/editdelete.png images/icons/add.png images/icons/configure.png images/icons/zoom_in_vertical.png images/icons/zoom_out_vertical.png images/icons/zoom_in_horizontal.png images/icons/zoom_out_horizontal.png images/icons/goto.png images/icons/autoscale.png images/icons/zoom_fit_event_horizontal.png color_settings.xml version.txt sigviewer-0.5.1+svn556/src/src.rc000066400000000000000000000001121154433734200164670ustar00rootroot00000000000000IDI_ICON1 ICON DISCARDABLE "images/sigviewer.ico" sigviewer-0.5.1+svn556/src/tab_context.cpp000066400000000000000000000042371154433734200204040ustar00rootroot00000000000000#include "tab_context.h" #include namespace SigViewer_ { //----------------------------------------------------------------------------- TabContext::TabContext () : selection_state_ (TAB_STATE_NO_EVENT_SELECTED), edit_state_ (TAB_STATE_NO_REDO_NO_UNDO) { // nothing to do here } //----------------------------------------------------------------------------- TabContext::~TabContext () { emit selectionStateChanged (NO_TAB_SELECTION_STATE); emit editStateChanged (NO_TAB_EDIT_STATE); } //----------------------------------------------------------------------------- void TabContext::gotActive () { emit selectionStateChanged (selection_state_); emit editStateChanged (edit_state_); } //----------------------------------------------------------------------------- void TabContext::executeCommand (QUndoCommand* command) { edit_undo_stack_.push (command); updateUndoRedoEditState (); } //------------------------------------------------------------------------- void TabContext::undo () { edit_undo_stack_.undo (); updateUndoRedoEditState (); } //------------------------------------------------------------------------- void TabContext::redo () { edit_undo_stack_.redo (); updateUndoRedoEditState (); } //----------------------------------------------------------------------------- void TabContext::updateUndoRedoEditState () { if (!edit_undo_stack_.canUndo () && !edit_undo_stack_.canRedo()) setEditState (TAB_STATE_NO_REDO_NO_UNDO); else if (!edit_undo_stack_.canUndo ()) setEditState (TAB_STATE_NO_UNDO); else if (!edit_undo_stack_.canRedo()) setEditState (TAB_STATE_NO_REDO); else setEditState (TAB_STATE_CAN_REDO_UNDO); } //----------------------------------------------------------------------------- void TabContext::setSelectionState (TabSelectionState state) { selection_state_ = state; emit selectionStateChanged (selection_state_); } //----------------------------------------------------------------------------- void TabContext::setEditState (TabEditState state) { edit_state_ = state; emit editStateChanged (edit_state_); } } // namespace SigViewer_ sigviewer-0.5.1+svn556/src/tab_context.h000066400000000000000000000036071154433734200200510ustar00rootroot00000000000000#ifndef TAB_CONTEXT_H #define TAB_CONTEXT_H #include "base/tab_states.h" #include "command_executer.h" #include #include #include namespace SigViewer_ { class TabContext : public QObject, public CommandExecuter { Q_OBJECT public: //------------------------------------------------------------------------- TabContext (); //------------------------------------------------------------------------- ~TabContext (); //------------------------------------------------------------------------- void gotActive (); //------------------------------------------------------------------------- virtual void executeCommand (QUndoCommand* command); //------------------------------------------------------------------------- virtual void undo (); //------------------------------------------------------------------------- virtual void redo (); signals: //------------------------------------------------------------------------- void selectionStateChanged (TabSelectionState state); //------------------------------------------------------------------------- void editStateChanged (TabEditState state); public slots: //------------------------------------------------------------------------- void setSelectionState (TabSelectionState state); //------------------------------------------------------------------------- void setEditState (TabEditState state); private: //------------------------------------------------------------------------- // disabled TabContext (TabContext const&); TabContext& operator= (TabContext const&); //------------------------------------------------------------------------- void updateUndoRedoEditState (); TabSelectionState selection_state_; TabEditState edit_state_; QUndoStack edit_undo_stack_; }; } #endif // TAB_CONTEXT_H sigviewer-0.5.1+svn556/src/tests/000077500000000000000000000000001154433734200165225ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/tests/color_manager_tests.cpp000066400000000000000000000014451154433734200232640ustar00rootroot00000000000000#include "color_manager_tests.h" #include "gui/color_manager.h" namespace SigViewer_ { namespace Tests_ { //----------------------------------------------------------------------------- ColorManagerTests::ColorManagerTests () : Test (tr("ColorManager Tests")) { // nothing to do here } //----------------------------------------------------------------------------- QString ColorManagerTests::run () { QSharedPointer color_manager = applicationContext ()->getEventColorManager(); VERIFY (color_manager.isNull() == false, "initialized"); VERIFY (color_manager->getDefaultEventColor() == QColor (200, 0, 0, 30), "default color"); VERIFY (color_manager->getDefaultEventColor(0x0300) == QColor (0, 0, 200, 30), "Start of Trial color"); return ""; } } } sigviewer-0.5.1+svn556/src/tests/color_manager_tests.h000066400000000000000000000004071154433734200227260ustar00rootroot00000000000000#ifndef COLOR_MANAGER_TESTS_H #define COLOR_MANAGER_TESTS_H #include "test.h" namespace SigViewer_ { namespace Tests_ { class ColorManagerTests : public Test { public: ColorManagerTests(); virtual QString run (); }; } } #endif // COLOR_MANAGER_TESTS_H sigviewer-0.5.1+svn556/src/tests/data_block_tests.cpp000066400000000000000000000060171154433734200225370ustar00rootroot00000000000000#include "data_block_tests.h" #include "base/fixed_data_block.h" #include namespace SigViewer_ { namespace Tests_ { //----------------------------------------------------------------------------- DataBlockTests::DataBlockTests () : Test (tr("DataBlock")) { // nothing to do here } //----------------------------------------------------------------------------- QString DataBlockTests::run () { QSharedPointer > ten_data (new QVector); for (unsigned i = 1; i <= 10; i++) ten_data->push_back (i); FixedDataBlock ten_block (ten_data, 10); VERIFY (ten_block.size() == static_cast(ten_data->size()), "created with 10 elements"); VERIFY (ten_block.getMax() == 10, "get max"); VERIFY (ten_block.getMin() == 1, "get min"); for (unsigned i = 1; i <= 10; i++) VERIFY (ten_block[i-1] == i, "check content"); QString error = testMean (); if (error.size() > 0) return error; return ""; } //----------------------------------------------------------------------------- QString DataBlockTests::testMean () { QSharedPointer > ten_data (new QVector); QSharedPointer > ten_reverse_data (new QVector); for (unsigned i = 1; i <= 10; i++) { ten_data->push_back (i); ten_reverse_data->push_back (11-i); } QSharedPointer ten_block1 (new FixedDataBlock (ten_data, 10)); QSharedPointer ten_block2 (new FixedDataBlock (ten_data, 10)); QSharedPointer ten_block_revers (new FixedDataBlock (ten_reverse_data, 10)); std::list > blocks; blocks.push_back (ten_block1); blocks.push_back (ten_block2); // Test 1 QSharedPointer mean = FixedDataBlock::calculateMean (blocks); VERIFY (mean->size() == 10, "mean number of elements") for (unsigned x = 0; x < 10; x++) VERIFY (mean->operator [](x) == (x + 1), "mean checking elements") QSharedPointer std_dev = FixedDataBlock::calculateStandardDeviation (blocks); VERIFY (std_dev->size() == 10, "std-dev number of elements") for (unsigned x = 0; x < 10; x++) VERIFY ((*std_dev)[x] == 0, "std-dev checking elements") // Test 2 blocks.pop_back (); blocks.push_back (ten_block_revers); QSharedPointer mean_revers = FixedDataBlock::calculateMean (blocks); VERIFY (mean_revers->size() == 10, "mean 2 number of elements") for (unsigned x = 0; x < 10; x++) VERIFY ((mean_revers->operator [](x) == 5.5f), "mean 2 checking elements") QSharedPointer std_dev_revers = FixedDataBlock::calculateStandardDeviation (blocks); VERIFY (std_dev_revers->size() == 10, "std-dev 2 number of elements") for (unsigned x = 0; x < 10; x++) VERIFY (((*std_dev_revers)[x]) == sqrt((pow((*ten_block1)[x] - 5.5f, 2) + pow((*ten_block_revers)[x] - 5.5f, 2)) / blocks.size()), "std-dev 2 checking elements") return ""; } } } sigviewer-0.5.1+svn556/src/tests/data_block_tests.h000066400000000000000000000006461154433734200222060ustar00rootroot00000000000000#ifndef DATA_BLOCK_TESTS_H #define DATA_BLOCK_TESTS_H #include "test.h" namespace SigViewer_ { namespace Tests_ { //----------------------------------------------------------------------------- /// DataBlockTests /// runs tests on the DataBlock class class DataBlockTests : public Test { public: DataBlockTests (); virtual QString run (); private: QString testMean (); }; } } #endif // DATA_BLOCK_TESTS_H sigviewer-0.5.1+svn556/src/tests/editing_commands_tests.cpp000066400000000000000000000060571154433734200237640ustar00rootroot00000000000000#include "editing_commands_tests.h" #include "editing_commands/change_channel_undo_command.h" #include "editing_commands/change_type_undo_command.h" #include "editing_commands/delete_event_undo_command.h" #include "editing_commands/new_event_undo_command.h" #include "editing_commands/resize_event_undo_command.h" #include namespace SigViewer_ { namespace Tests_ { QString EditingCommandsTests::run () { QSharedPointer event_manager = createEventManagerWithDummyData(); QSharedPointer event = event_manager->getEvent (1); EventID id = event->getId(); QUndoStack stack; unsigned const initial_number_of_events = event_manager->getNumberOfEvents(); ChannelID const old_channel = event->getChannel(); EventType const old_type = event->getType(); uint32 const old_position = event->getPosition(); uint32 const old_duration = event->getDuration(); ChannelID const new_channel = 1; EventType const new_type = 4; uint32 const new_position = 0; uint32 const new_duration = 250; QUndoCommand* change_channel = new ChangeChannelUndoCommand (event_manager, id, new_channel); QUndoCommand* change_type = new ChangeTypeUndoCommand (event_manager, id, new_type); QUndoCommand* delete_event = new DeleteEventUndoCommand (event_manager, id); QUndoCommand* new_event = new NewEventUndoCommand (event_manager, QSharedPointer(new SignalEvent (10, 10, 100, 1, 100)), 1); QUndoCommand* resize_event = new ResizeEventUndoCommand (event_manager, id, new_position, new_duration); stack.push (change_channel); VERIFY (event_manager->getEvent(id)->getChannel() == new_channel, "change channel"); stack.undo(); VERIFY (event_manager->getEvent(id)->getChannel() == old_channel, "change channel undo"); stack.push (change_type); VERIFY (event_manager->getEvent(id)->getType() == new_type, "change type"); stack.undo(); VERIFY (event_manager->getEvent(id)->getType() == old_type, "change type undo"); stack.push (delete_event); VERIFY (event_manager->getEvent(id).isNull(), "delete event"); VERIFY (event_manager->getNumberOfEvents() == (initial_number_of_events - 1), "delete event 2"); stack.undo(); VERIFY (!event_manager->getEvent(id).isNull(), "delete event undo"); VERIFY (event_manager->getNumberOfEvents() == initial_number_of_events, "delete event undo 2"); stack.push (new_event); VERIFY (event_manager->getNumberOfEvents() == (initial_number_of_events + 1), "new event"); stack.undo (); VERIFY (event_manager->getNumberOfEvents() == initial_number_of_events, "new event undo"); stack.push (resize_event); VERIFY (event_manager->getEvent(id)->getPosition() == new_position, "resize event"); VERIFY (event_manager->getEvent(id)->getDuration() == new_duration, "resize event 2"); stack.undo (); VERIFY (event_manager->getEvent(id)->getPosition() == old_position, "resize event undo"); VERIFY (event_manager->getEvent(id)->getDuration() == old_duration, "resize event undo 2"); return ""; } } } sigviewer-0.5.1+svn556/src/tests/editing_commands_tests.h000066400000000000000000000004761154433734200234300ustar00rootroot00000000000000#ifndef EDITING_COMMANDS_TESTS_H #define EDITING_COMMANDS_TESTS_H #include "test.h" namespace SigViewer_ { namespace Tests_ { class EditingCommandsTests : public Test { public: EditingCommandsTests () : Test ("Editing Commands Tests") {} virtual QString run (); }; } } #endif // EDITING_COMMANDS_TESTS_H sigviewer-0.5.1+svn556/src/tests/event_manager_tests.cpp000066400000000000000000000021251154433734200232630ustar00rootroot00000000000000#include "event_manager_tests.h" namespace SigViewer_ { namespace Tests_ { QString EventManagerTests::run () { QSharedPointer event_manager = createEventManagerWithDummyData(); VERIFY (event_manager->getAllEvents().size() == 44, "event amount"); foreach (EventID event, event_manager->getAllEvents()) { VERIFY (event_manager->getEvent(event).isNull() == false, "event exists"); } RUN_SUB_TEST(testEventCreation(event_manager)); return ""; } QString EventManagerTests::testEventCreation (QSharedPointer evt_mgr) { QSharedPointer event = evt_mgr->createEvent (1, 10, 100, 1); VERIFY (event.isNull() == false, "event created"); VERIFY (event->getChannel() == 1, "event created channel"); VERIFY (event->getDuration() == 100, "event created duration"); VERIFY (event->getDurationInSec() == 100 / evt_mgr->getSampleRate(), "event created duration in sec"); VERIFY (event->getPosition() == 10, "event created position"); VERIFY (event->getType() == 1, "event created type"); return ""; } } } sigviewer-0.5.1+svn556/src/tests/event_manager_tests.h000066400000000000000000000005731154433734200227350ustar00rootroot00000000000000#ifndef EVENT_MANAGER_TESTS_H #define EVENT_MANAGER_TESTS_H #include "test.h" namespace SigViewer_ { namespace Tests_ { class EventManagerTests : public Test { public: EventManagerTests () : Test(tr("EventManager Tests")) {} virtual QString run (); private: QString testEventCreation (QSharedPointer evt_mgr); }; } } #endif // EVENT_MANAGER_TESTS_H sigviewer-0.5.1+svn556/src/tests/event_table_widget_tests.cpp000066400000000000000000000107151154433734200243070ustar00rootroot00000000000000#include "event_table_widget_tests.h" #include "gui_impl/event_table/event_table_widget.h" namespace SigViewer_ { namespace Tests_ { //----------------------------------------------------------------------------- QString EventTableWidgetTests::run () { QSharedPointer event_manager = createEventManagerWithDummyData(); RUN_SUB_TEST (basicCreation (event_manager)); RUN_SUB_TEST (newEvents (event_manager)); RUN_SUB_TEST (deleteEvents (event_manager)); RUN_SUB_TEST (changedEvents (event_manager)); return ""; } //----------------------------------------------------------------------------- QString EventTableWidgetTests::basicCreation (QSharedPointer event_manager) { EventTableWidget event_table (QSharedPointer(new TabContext()), event_manager, getChannelManagerDummyData()); VERIFY (static_cast(event_table.ui_.event_table_->rowCount()) == event_manager->getNumberOfEvents(), "number events"); return ""; } //----------------------------------------------------------------------------- QString EventTableWidgetTests::newEvents (QSharedPointer event_manager) { ChannelID const CHANNEL = 1; unsigned const POS = 10; unsigned const LENGTH = 12; EventType const TYPE = 0x03; EventTableWidget event_table (QSharedPointer(new TabContext()), event_manager, getChannelManagerDummyData()); QTableWidget* table = event_table.ui_.event_table_; int old_row_count = table->rowCount(); QSharedPointer event = event_manager->createEvent (CHANNEL, POS, LENGTH, TYPE); VERIFY (old_row_count + 1 == table->rowCount(), "one event more"); bool contains_new_event = false; for (int row = 0; row < table->rowCount(); row++) { QTableWidgetItem* table_item = table->item(row, EventTableWidget::ID_INDEX_); if (table_item->text() == QString::number(event->getId())) { contains_new_event = true; VERIFY (table->item(row, EventTableWidget::CHANNEL_INDEX_)->text() == getChannelManagerDummyData().getChannelLabel(CHANNEL), "channel fits"); } } VERIFY (contains_new_event, "contains new event"); return ""; } //----------------------------------------------------------------------------- QString EventTableWidgetTests::deleteEvents (QSharedPointer event_manager) { EventID const EVENT_ID = 2; EventTableWidget event_table (QSharedPointer(new TabContext()), event_manager, getChannelManagerDummyData()); QTableWidget* table = event_table.ui_.event_table_; int old_row_count = table->rowCount(); event_manager->removeEvent (EVENT_ID); VERIFY (old_row_count - 1 == table->rowCount(), "one event less"); bool contains_deleted_event = false; for (int row = 0; row < table->rowCount(); row++) if (table->item(row, EventTableWidget::ID_INDEX_)->text() == QString::number(EVENT_ID)) contains_deleted_event = true; VERIFY (!contains_deleted_event, "not contains deleted event"); return ""; } //----------------------------------------------------------------------------- QString EventTableWidgetTests::changedEvents (QSharedPointer event_manager) { EventID const EVENT_ID = 4; EventType const OLD_TYPE = event_manager->getEvent (EVENT_ID)->getType(); EventType const NEW_TYPE = OLD_TYPE + 1; ChannelID const NEW_CHANNEL = 3; EventTableWidget event_table (QSharedPointer(new TabContext()), event_manager, getChannelManagerDummyData()); QTableWidget* table = event_table.ui_.event_table_; int old_row_count = table->rowCount(); { QSharedPointer event_for_editing = event_manager->getAndLockEventForEditing (EVENT_ID); event_for_editing->setType (NEW_TYPE); event_for_editing->setChannel (NEW_CHANNEL); event_manager->updateAndUnlockEvent (EVENT_ID); } VERIFY (old_row_count == table->rowCount(), "same amount fo events"); for (int row = 0; row < table->rowCount(); row++) { if (table->item(row, EventTableWidget::ID_INDEX_)->text().toInt() == EVENT_ID) { VERIFY (table->item(row, EventTableWidget::TYPE_INDEX_)->text() == event_manager->getNameOfEventType(NEW_TYPE), "types match"); VERIFY (table->item(row, EventTableWidget::CHANNEL_INDEX_)->text() == getChannelManagerDummyData ().getChannelLabel (NEW_CHANNEL), "channels match"); } } return ""; } } } sigviewer-0.5.1+svn556/src/tests/event_table_widget_tests.h000066400000000000000000000011551154433734200237520ustar00rootroot00000000000000#ifndef EVENT_TABLE_WIDGET_TESTS_H #define EVENT_TABLE_WIDGET_TESTS_H #include "test.h" namespace SigViewer_ { namespace Tests_ { class EventTableWidgetTests : public Test { public: EventTableWidgetTests () : Test(tr("Event Table Tests")) {} virtual QString run (); private: QString basicCreation (QSharedPointer event_manager); QString newEvents (QSharedPointer event_manager); QString deleteEvents (QSharedPointer event_manager); QString changedEvents (QSharedPointer event_manager); }; } } #endif // EVENT_TABLE_WIDGET_TESTS_H sigviewer-0.5.1+svn556/src/tests/file_handling_tests.cpp000066400000000000000000000057571154433734200232510ustar00rootroot00000000000000#include "file_handling_tests.h" #include "gui_impl/commands/open_file_gui_command.h" #include "file_handling/file_signal_writer_factory.h" #include "file_handling/file_signal_reader_factory.h" #include namespace SigViewer_ { namespace Tests_ { //----------------------------------------------------------------------------- void FileHandlingTests::init () { OpenFileGuiCommand::openFile ("blub.sinusdummy", true); } //----------------------------------------------------------------------------- QString FileHandlingTests::run () { RUN_SUB_TEST (testEventExportingImporting()) return ""; } //----------------------------------------------------------------------------- void FileHandlingTests::cleanup () { action("Close")->trigger(); } //----------------------------------------------------------------------------- QString FileHandlingTests::testEventExportingImporting () { QTemporaryFile event_file ("XXXXXX.evt"); event_file.open(); event_file.close(); QSharedPointer writer (FileSignalWriterFactory::getInstance()->getHandler(event_file.fileName())); VERIFY (writer.isNull() == false, "EVT writer not created") QString error = writer->save (applicationContext()->getCurrentFileContext()); VERIFY (error.size() == 0, error) QSharedPointer reader (FileSignalReaderFactory::getInstance()->getHandler(event_file.fileName())); VERIFY (reader.isNull() == false, "EVT reader not created") QList > events = reader->getEvents(); QSharedPointer event_manager = applicationContext()->getCurrentFileContext()->getEventManager(); VERIFY (static_cast(events.size()) == event_manager->getNumberOfEvents(), "not all events in file") QTemporaryFile event_file_2 ("XXXXXX.evt"); event_file_2.open(); event_file_2.close(); QSharedPointer writer_2 (FileSignalWriterFactory::getInstance()->getHandler(event_file_2.fileName())); VERIFY (writer_2.isNull() == false, "EVT writer 2 not created") std::set exported_event_types; exported_event_types.insert (event_manager->getEvent(0)->getType()); error = writer_2->save (applicationContext()->getCurrentFileContext(), exported_event_types); VERIFY (error.size() == 0, error) QSharedPointer reader_2 (FileSignalReaderFactory::getInstance()->getHandler(event_file_2.fileName())); events = reader_2->getEvents(); VERIFY (events.size() == event_manager->getEvents(*(exported_event_types.begin())).size(), "EVT writer 2, not all events in file") foreach (EventID event_id, event_manager->getEvents(*(exported_event_types.begin()))) { bool event_exists = false; foreach (QSharedPointer event, events) { if (event->equals(*(event_manager->getEvent(event_id)))) event_exists = true; } VERIFY (event_exists, "loaded events") } return ""; } } } sigviewer-0.5.1+svn556/src/tests/file_handling_tests.h000066400000000000000000000006351154433734200227040ustar00rootroot00000000000000#ifndef FILE_HANDLING_TESTS_H #define FILE_HANDLING_TESTS_H #include "test.h" namespace SigViewer_ { namespace Tests_ { class FileHandlingTests : public Test { public: FileHandlingTests() : Test (tr("File Handling Tests")) {} virtual void init (); virtual QString run (); virtual void cleanup (); private: QString testEventExportingImporting (); }; } } #endif // FILE_HANDLING_TESTS_H sigviewer-0.5.1+svn556/src/tests/gui_tests.cpp000066400000000000000000000075231154433734200212430ustar00rootroot00000000000000#include "gui_tests.h" #include "gui_impl/commands/open_file_gui_command.h" #include "gui/application_context.h" namespace SigViewer_ { namespace Tests_ { //----------------------------------------------------------------------------- void GuiTests::init () { animations_triggered_ = false; if (action("Animations")->isChecked()) { action("Animations")->trigger(); animations_triggered_ = true; } } //----------------------------------------------------------------------------- QString GuiTests::run () { RUN_SUB_TEST (testEnablednessNoOpenFile()) OpenFileGuiCommand::openFile ("blub.sinusdummy", true); VERIFY (applicationContext()->getCurrentFileContext().isNull() != true, "open file") RUN_SUB_TEST (testZooming ()) RUN_SUB_TEST (testEventEditing ()) currentVisModel()->selectChannel(1); action("Hide Channel")->trigger(); VERIFY (currentVisModel()->getShownChannels().count(1) == 0, "hide channel") action("Close")->trigger(); VERIFY (applicationContext()->getCurrentFileContext().isNull() == true, "closed file") RUN_SUB_TEST (testEnablednessNoOpenFile()) return ""; } //----------------------------------------------------------------------------- void GuiTests::cleanup () { if (animations_triggered_) action ("Animations")->trigger(); } //----------------------------------------------------------------------------- QString GuiTests::testZooming () { /* unsigned old_signal_height = currentVisModel()->getSignalHeight(); action("Zoom In Vertical")->trigger(); unsigned new_signal_height = currentVisModel()->getSignalHeight(); VERIFY (new_signal_height > old_signal_height, tr("zoom in vertically, old = ") + QString::number(old_signal_height) + "; new = " + QString::number(new_signal_height)); old_signal_height = new_signal_height; action("Zoom Out Vertical")->trigger(); new_signal_height = currentVisModel()->getSignalHeight(); VERIFY (new_signal_height < old_signal_height, tr("zoom out vertically")); float32 old_pixel_per_sample = currentVisModel()->getPixelPerSample(); action("Zoom In Horizontal")->trigger(); float32 new_pixel_per_sample = currentVisModel()->getPixelPerSample(); VERIFY (new_pixel_per_sample > old_pixel_per_sample, "zoom in horizontally"); old_pixel_per_sample = currentVisModel()->getPixelPerSample(); action("Zoom Out Horizontal")->trigger(); new_pixel_per_sample = currentVisModel()->getPixelPerSample(); VERIFY (new_pixel_per_sample < old_pixel_per_sample, "zoom out horizontally"); */ return ""; } //----------------------------------------------------------------------------- QString GuiTests::testEventEditing () { currentVisModel()->selectEvent(1); action ("Delete")->trigger(); VERIFY (currentVisModel()->getEventManager()->getEvent(1).isNull(), "delete event"); action ("Undo")->trigger(); VERIFY (currentVisModel()->getEventManager()->getEvent(1).isNull() == false, "undo delete event"); applicationContext()->getCurrentFileContext()->setState(FILE_STATE_UNCHANGED); return ""; } //----------------------------------------------------------------------------- QString GuiTests::testEnablednessNoOpenFile () { QStringList enabled_on_startup; enabled_on_startup << "Animations" << "Open..." << "Set Animation Duration" << "About" << "Run Tests..." << "Exit"; QList actions = GuiActionFactory::getInstance()->getQActions(); foreach (QAction* action, actions) { VERIFY (((action->isEnabled() && enabled_on_startup.contains(action->text())) || ((action->isEnabled() == false) && (!enabled_on_startup.contains(action->text())))), QString("Action not disabled: ").append(action->text())) } return ""; } } } sigviewer-0.5.1+svn556/src/tests/gui_tests.h000066400000000000000000000006751154433734200207110ustar00rootroot00000000000000#ifndef GUI_TESTS_H #define GUI_TESTS_H #include "test.h" namespace SigViewer_ { namespace Tests_ { class GuiTests : public Test { public: GuiTests() : Test (tr("GUI Tests")) {} virtual void init (); virtual QString run (); virtual void cleanup (); private: QString testZooming (); QString testEventEditing (); QString testEnablednessNoOpenFile (); bool animations_triggered_; }; } } #endif // GUI_TESTS_H sigviewer-0.5.1+svn556/src/tests/test.cpp000066400000000000000000000033121154433734200202040ustar00rootroot00000000000000#include "test.h" #include "file_handling_impl/event_manager_impl.h" #include "file_handling_impl/channel_manager_impl.h" #include "file_handling/file_signal_reader_factory.h" #include "application_context_impl.h" #include "gui/gui_action_factory.h" namespace SigViewer_ { namespace Tests_ { //------------------------------------------------------------------------- Test::Test (QString const& name) : name_ (name), passed_tests_(0), channel_manager_ (new ChannelManagerImpl (FileSignalReaderFactory::getInstance()->getHandler("blub.sinusdummy"))) { } //------------------------------------------------------------------------- ChannelManager const& Test::getChannelManagerDummyData () { return *channel_manager_; } //------------------------------------------------------------------------- QSharedPointer Test::createEventManagerWithDummyData () { FileSignalReader* reader = FileSignalReaderFactory::getInstance()->getHandler("blub.sinusdummy"); QSharedPointer evt_mgr (new EventManagerImpl(*reader)); delete reader; return evt_mgr; } //------------------------------------------------------------------------- QSharedPointer Test::applicationContext () { return ApplicationContextImpl::getInstance(); } //------------------------------------------------------------------------- QAction* Test::action (QString const& action_name) { return GuiActionFactory::getInstance()->getQAction(action_name); } //------------------------------------------------------------------------- QSharedPointer Test::currentVisModel () { return applicationContext()->getMainWindowModel()->getCurrentSignalVisualisationModel(); } } } sigviewer-0.5.1+svn556/src/tests/test.h000066400000000000000000000034031154433734200176520ustar00rootroot00000000000000#ifndef TEST_H #define TEST_H #include "file_handling/event_manager.h" #include "gui/application_context.h" #include #include #include namespace SigViewer_ { namespace Tests_ { #define VERIFY(condition, message) {if(!(condition)) return QString(message).append("; ").append(__FUNCTION__).append(":").append(QString::number(__LINE__)); else increasePassedTests();} #define RUN_SUB_TEST(subtest) {QString result = subtest; if (result.size()) return result;} //----------------------------------------------------------------------------- /// Test /// base class for all tests class Test : public QObject { Q_OBJECT public: Test (QString const& name); QString getName () {return name_;} unsigned passed () {return passed_tests_;} virtual void init () {}; virtual QString run () = 0; virtual void cleanup () {}; protected: void increasePassedTests () {passed_tests_++;} //------------------------------------------------------------------------- ChannelManager const& getChannelManagerDummyData (); //------------------------------------------------------------------------- QSharedPointer createEventManagerWithDummyData (); //------------------------------------------------------------------------- QSharedPointer applicationContext (); //------------------------------------------------------------------------- QAction* action (QString const& action_name); //------------------------------------------------------------------------- QSharedPointer currentVisModel (); private: QString name_; unsigned passed_tests_; QSharedPointer channel_manager_; }; } } #endif // TEST_H sigviewer-0.5.1+svn556/src/tests/tests.pri000066400000000000000000000012051154433734200203760ustar00rootroot00000000000000FORMS += tests/tests_dialog.ui HEADERS += tests/tests_dialog.h \ tests/data_block_tests.h \ tests/test.h \ tests/tests_factory.h \ tests/event_manager_tests.h \ tests/editing_commands_tests.h \ tests/gui_tests.h \ tests/color_manager_tests.h \ tests/file_handling_tests.h \ tests/event_table_widget_tests.h SOURCES += tests/tests_dialog.cpp \ tests/data_block_tests.cpp \ tests/event_manager_tests.cpp \ tests/test.cpp \ tests/editing_commands_tests.cpp \ tests/gui_tests.cpp \ tests/color_manager_tests.cpp \ tests/file_handling_tests.cpp \ tests/event_table_widget_tests.cpp sigviewer-0.5.1+svn556/src/tests/tests_dialog.cpp000066400000000000000000000035221154433734200217110ustar00rootroot00000000000000#include "tests_dialog.h" #include "tests_factory.h" #include "gui_impl/commands/open_file_gui_command.h" namespace SigViewer_ { using namespace Tests_; //----------------------------------------------------------------------------- TestsDialog::TestsDialog () { ui_.setupUi (this); ui_.progressBar->setValue (0); } //----------------------------------------------------------------------------- void TestsDialog::runTests () { QList > tests = TestsFactory_::allTests (); ui_.progressBar->setMaximum (tests.size ()); ui_.progressBar->setValue (0); unsigned fails = 0; foreach (QSharedPointer test, tests) { QColor color; QString test_name = test->getName(); test->init(); QString result = test->run(); test->cleanup(); if (result.size()) { test_name += tr(" failed: ") + result; color = QColor (255, 0, 0, 50); fails++; } else { test_name += tr(": passed ") + QString::number(test->passed()) + tr(" verifications"); color = QColor (0, 255, 0, 50); } ui_.listWidget->addItem (test_name); ui_.listWidget->item (ui_.listWidget->count() - 1)->setBackgroundColor (color); ui_.progressBar->setValue(ui_.progressBar->value()+1); } if (fails) ui_.listWidget->addItem(QString::number(fails) + " tests failed!"); else ui_.listWidget->addItem("All tests passed!"); } //----------------------------------------------------------------------------- void TestsDialog::on_start_button__clicked () { runTests(); } //----------------------------------------------------------------------------- void TestsDialog::on_open_dummy__clicked () { OpenFileGuiCommand::openFile ("blub.sinusdummy", true); close(); } } sigviewer-0.5.1+svn556/src/tests/tests_dialog.h000066400000000000000000000011001154433734200213440ustar00rootroot00000000000000#ifndef TESTS_DIALOG_H #define TESTS_DIALOG_H #include "ui_tests_dialog.h" #include "test.h" #include #include #include namespace SigViewer_ { //----------------------------------------------------------------------------- /// TestsDialog /// executes tests and displays results class TestsDialog : public QDialog { Q_OBJECT public: TestsDialog (); private slots: void on_start_button__clicked (); void on_open_dummy__clicked (); private: void runTests (); Ui::TestDialog ui_; }; } #endif // TESTS_DIALOG_H sigviewer-0.5.1+svn556/src/tests/tests_dialog.ui000066400000000000000000000040421154433734200215420ustar00rootroot00000000000000 TestDialog 0 0 398 298 Tests 24 Start Open Dummy Data Qt::Horizontal QDialogButtonBox::Close buttonBox accepted() TestDialog accept() 248 254 157 274 buttonBox rejected() TestDialog reject() 316 260 286 274 sigviewer-0.5.1+svn556/src/tests/tests_factory.h000066400000000000000000000022311154433734200215620ustar00rootroot00000000000000#ifndef TESTS_FACTORY_H #define TESTS_FACTORY_H #include "test.h" #include "event_manager_tests.h" #include "data_block_tests.h" #include "editing_commands_tests.h" #include "gui_tests.h" #include "color_manager_tests.h" #include "file_handling_tests.h" #include "event_table_widget_tests.h" #include #include namespace SigViewer_ { namespace TestsFactory_ { //----------------------------------------------------------------------------- QList > allTests () { QList > tests; tests.append (QSharedPointer(new Tests_::DataBlockTests)); tests.append (QSharedPointer(new Tests_::ColorManagerTests)); tests.append (QSharedPointer(new Tests_::EventManagerTests)); tests.append (QSharedPointer(new Tests_::EditingCommandsTests)); tests.append (QSharedPointer(new Tests_::GuiTests)); tests.append (QSharedPointer(new Tests_::FileHandlingTests)); tests.append (QSharedPointer(new Tests_::EventTableWidgetTests)); return tests; } } } #endif // TESTS_FACTORY_H sigviewer-0.5.1+svn556/src/translations/000077500000000000000000000000001154433734200201015ustar00rootroot00000000000000sigviewer-0.5.1+svn556/src/translations/sigviewer_de.ts000066400000000000000000000263601154433734200231340ustar00rootroot00000000000000 BioSig_::BasicHeaderInfoDialog Basic Header Info Basis Header Info Close Schließen Property Eigenschaft Value Wert Unit Einheit Channels Kanäle Filter Filter Notch Notch yes ja no nein Lowpass Tiefpass Hz Hz Highpass Hochpass Label Name Data Type ID Daten Typ ID Digital Minimum Digitales Minimum Digital Maximum Digitales Maximum Physical Minimum Physikalisches Minimum Physical Maximum Physikalisches Maximum Physical Dimension Physikalische Einheit Sample Rate Abtast Rate Events Ereignisse Number Nummer Patient Patient Hospital ID Krankenhaus ID Doctor ID Arzt ID Classification Klassifikation Medication Medikation Handedness Handedness Sex Geschlecht male männlich female weiblich Age Alter years Jahre Name Name File Datei Size Größe kByte kByte Extension Erweiterung Path Pfad Basic Basis Recording Duration Aufnahme Dauer seconds Sekunden Triggered Trigger Recording Time Aufnahme Zeit Version Version Type Typ BioSig_::ChannelSelectionDialog Channel Selection Kanal Auswahl OK OK Cancel Abbrechen BioSig_::GUISignalBuffer Initialize Buffer Initialisiere Puffer Downsampling Progress Fortschritt Downsampling Range Finding Progress Fortschritt Finde Bereich Loading Events Progress Fortschritt Laden der Ereignisse BioSig_::GoToDialog Go To Gehe Zu None Kein Second Sekunde Channel Kanal OK OK Cancel Abbrechen BioSig_::LogDialog Log Log Close Schließen BioSig_::MainWindow &File &Datei &Mouse Mode &Maus Modus &View &Ansicht &Options &Optionen &Help &Hilfe Recent Files Zuletzt geöffnete Dateien whole alles Open Öffnen &Open... Ö&ffnen... Ctrl+O Ctrl+F Close Schließen Info Info Info... Info... Exit Beenden E&xit &Beenden Pointer Zeiger Hand Hand Shift Signal Verschiebe Signal Zoom Zoom Zoom In Vergrößern Zoom Out Verkleinern Auto Scale Auto Skalierung Go To Gehe Zu &Go To... &Gehe Zu... Ctrl+G Ctrl+G Channels Kanäle &Channels... &Kanäle... Log Log Log... Log... About SigViewer Über SigViewer About SigViewer... Über SigViewer... Really close? Wirklich schließen? Changes in '%1' are not saved!! Änderungen wurden nicht gesichert!! Signal files (%1) Signal Dateien (%1) Chose signal file to open Öffne Signal Datei SigViewer Version 0.01 SigViewer Version 0.01 Seconds per Page Sekunden pro Seite Signals per Page Signale pro Seite sigviewer-0.5.1+svn556/src/translations/sigviewer_en.ts000066400000000000000000000277131154433734200231510ustar00rootroot00000000000000 BioSig_::BasicHeaderInfoDialog Basic Header Info Close Property Value Unit Channels Filter Notch yes no Lowpass Hz Highpass Label Data Type ID Digital Minimum Digital Maximum Physical Minimum Physical Maximum Physical Dimension Sample Rate Events Number Patient Hospital ID Doctor ID Classification Medication Handedness Sex male female Age years Name File Size kByte Extension Path Basic Recording Duration seconds Triggered Recording Time Version Type BioSig_::ChannelSelectionDialog Channel Selection OK Cancel BioSig_::GUISignalBuffer Initialize Buffer Downsampling Progress Range Finding Progress Loading Events Progress BioSig_::GoToDialog Go To None Second Channel OK Cancel BioSig_::LogDialog Log Close BioSig_::MainWindow &File &Mouse Mode &View &Options &Help Recent Files whole Open &Open... Ctrl+O Close Info Info... Exit E&xit Pointer Hand Shift Signal Zoom Zoom In Zoom Out Auto Scale Go To &Go To... Ctrl+G Channels &Channels... Log Log... About SigViewer About SigViewer... Really close? Changes in '%1' are not saved!! Signal files (%1) Chose signal file to open SigViewer Version 0.01 Seconds per Page Signals per Page sigviewer-0.5.1+svn556/src/translations/sigviewer_es.ts000066400000000000000000000277131154433734200231560ustar00rootroot00000000000000 BioSig_::BasicHeaderInfoDialog Basic Header Info Close Property Value Unit Channels Filter Notch yes no Lowpass Hz Highpass Label Data Type ID Digital Minimum Digital Maximum Physical Minimum Physical Maximum Physical Dimension Sample Rate Events Number Patient Hospital ID Doctor ID Classification Medication Handedness Sex male female Age years Name File Size kByte Extension Path Basic Recording Duration seconds Triggered Recording Time Version Type BioSig_::ChannelSelectionDialog Channel Selection OK Cancel BioSig_::GUISignalBuffer Initialize Buffer Downsampling Progress Range Finding Progress Loading Events Progress BioSig_::GoToDialog Go To None Second Channel OK Cancel BioSig_::LogDialog Log Close BioSig_::MainWindow &File &Mouse Mode &View &Options &Help Recent Files whole Open &Open... Ctrl+O Close Info Info... Exit E&xit Pointer Hand Shift Signal Zoom Zoom In Zoom Out Auto Scale Go To &Go To... Ctrl+G Channels &Channels... Log Log... About SigViewer About SigViewer... Really close? Changes in '%1' are not saved!! Signal files (%1) Chose signal file to open SigViewer Version 0.01 Seconds per Page Signals per Page sigviewer-0.5.1+svn556/src/translations/sigviewer_fr.ts000066400000000000000000000277131154433734200231560ustar00rootroot00000000000000 BioSig_::BasicHeaderInfoDialog Basic Header Info Close Property Value Unit Channels Filter Notch yes no Lowpass Hz Highpass Label Data Type ID Digital Minimum Digital Maximum Physical Minimum Physical Maximum Physical Dimension Sample Rate Events Number Patient Hospital ID Doctor ID Classification Medication Handedness Sex male female Age years Name File Size kByte Extension Path Basic Recording Duration seconds Triggered Recording Time Version Type BioSig_::ChannelSelectionDialog Channel Selection OK Cancel BioSig_::GUISignalBuffer Initialize Buffer Downsampling Progress Range Finding Progress Loading Events Progress BioSig_::GoToDialog Go To None Second Channel OK Cancel BioSig_::LogDialog Log Close BioSig_::MainWindow &File &Mouse Mode &View &Options &Help Recent Files whole Open &Open... Ctrl+O Close Info Info... Exit E&xit Pointer Hand Shift Signal Zoom Zoom In Zoom Out Auto Scale Go To &Go To... Ctrl+G Channels &Channels... Log Log... About SigViewer About SigViewer... Really close? Changes in '%1' are not saved!! Signal files (%1) Chose signal file to open SigViewer Version 0.01 Seconds per Page Signals per Page sigviewer-0.5.1+svn556/src/version.txt000066400000000000000000000000071154433734200176030ustar00rootroot000000000000000.5.1