From e99d15d101283c0690693226e2c064e617324060 Mon Sep 17 00:00:00 2001 From: Matthias Toussaint Date: Sat, 12 Apr 2014 09:56:22 +0100 Subject: [PATCH] Release 0.1 --- AUTHORS | 2 + CHANGELOG | 4 + COPYING | 340 +++++ INSTALL | 27 + README | 19 + configure | 106 ++ qtdmm.pro | 3 + src/Makefile | 287 +++++ src/configdlg.cpp | 316 +++++ src/configdlg.h | 61 + src/dmm.cpp | 292 +++++ src/dmm.h | 62 + src/dmmbar.cpp | 50 + src/dmmbar.h | 43 + src/dmmgraph.cpp | 881 +++++++++++++ src/dmmgraph.h | 129 ++ src/help.xpm | 29 + src/main.cpp | 35 + src/mainwid.cpp | 227 ++++ src/mainwid.h | 59 + src/printdlg.cpp | 176 +++ src/printdlg.h | 49 + src/qtdmm.pro | 36 + src/qtdmm_nouic.pro | 38 + src/readerthread.cpp | 101 ++ src/readerthread.h | 58 + src/readevent.h | 36 + src/simplecfg.cpp | 519 ++++++++ src/simplecfg.h | 413 ++++++ src/src.pro | 38 + src/uiconfigdlg.cpp | 655 ++++++++++ src/uiconfigdlg.h | 121 ++ src/uiconfigdlg.ui | 2054 ++++++++++++++++++++++++++++++ src/uimainwid.cpp | 766 +++++++++++ src/uimainwid.h | 67 + src/uimainwid.ui | 2868 ++++++++++++++++++++++++++++++++++++++++++ src/uiprintdlg.cpp | 185 +++ src/uiprintdlg.h | 50 + src/uiprintdlg.ui | 338 +++++ 39 files changed, 11540 insertions(+) create mode 100644 AUTHORS create mode 100644 CHANGELOG create mode 100644 COPYING create mode 100644 INSTALL create mode 100644 README create mode 100755 configure create mode 100644 qtdmm.pro create mode 100644 src/Makefile create mode 100644 src/configdlg.cpp create mode 100644 src/configdlg.h create mode 100644 src/dmm.cpp create mode 100644 src/dmm.h create mode 100644 src/dmmbar.cpp create mode 100644 src/dmmbar.h create mode 100644 src/dmmgraph.cpp create mode 100644 src/dmmgraph.h create mode 100644 src/help.xpm create mode 100644 src/main.cpp create mode 100644 src/mainwid.cpp create mode 100644 src/mainwid.h create mode 100644 src/printdlg.cpp create mode 100644 src/printdlg.h create mode 100755 src/qtdmm.pro create mode 100644 src/qtdmm_nouic.pro create mode 100644 src/readerthread.cpp create mode 100644 src/readerthread.h create mode 100644 src/readevent.h create mode 100644 src/simplecfg.cpp create mode 100644 src/simplecfg.h create mode 100755 src/src.pro create mode 100644 src/uiconfigdlg.cpp create mode 100644 src/uiconfigdlg.h create mode 100644 src/uiconfigdlg.ui create mode 100644 src/uimainwid.cpp create mode 100644 src/uimainwid.h create mode 100644 src/uimainwid.ui create mode 100644 src/uiprintdlg.cpp create mode 100644 src/uiprintdlg.h create mode 100644 src/uiprintdlg.ui diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..befc4ae --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Matthias Toussaint + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..bf215e5 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,4 @@ +15/04/2001 Initial release version 0.1 + +-- Matthias Toussaint + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + 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. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..8bd7442 --- /dev/null +++ b/INSTALL @@ -0,0 +1,27 @@ +Requirements: +------------- +- Qt library >= 2.1.0 thread version +- tmake (I think version >= 1.5 , but I'm not shure) +- Additionally you may have Qt-Designer installed. If not the configure script + should figure this out (checks for the presence of uic). You may use the + --no-uic option for the configure script to disable uic support. +- A Metex/Voltcraft compatible DMM + +Compilation: +------------ +Make shure QTDIR is set correctly and tmake, moc and eventually uic are installed. + +- untar the tarball you've downloaded +- enter the qtdmm directory +- type ./configure [--help|--no-uic] +- type make + +That's it. You should have the executable qtdmm now. + +If you encounter any problems don't hesitate to contact me + +The build process has been tested until now only with Linux and Qt 2.2.0. It would be +nice to hear if QtDMM compiles and works with different system configurations. + +-- Matthias Toussaint + diff --git a/README b/README new file mode 100644 index 0000000..421d31f --- /dev/null +++ b/README @@ -0,0 +1,19 @@ +QtDMM is a simple DMM readout software including a configurable transient +recorder. A friend of mine asked me for a DMM readout software for Linux +as the DOS software he had sucked a lot. To help him out I wrote this +little piece of software. +The transient recorder features manual start, scheduled start (at a given +time) and triggered automatic start when given thresholds are reached. +It was written for Metex (and compatible like VOLTCRAFT) multimeter. +Until now it has only been tested with a VOLTCRAFT ME-32 but should run +with other DMM's that support the same protocol. Feedback on this is much +appreciated. + +QtDMM is kind of "works for me" software. I'm using it, I like it the way +it is and it seems to be quite stable. It still needs some improvements +but does it's job quite well. + +QtDMM is distributed under the GNU Public License, version 2. + +-- Matthias Toussaint + diff --git a/configure b/configure new file mode 100755 index 0000000..f40702f --- /dev/null +++ b/configure @@ -0,0 +1,106 @@ +#! /bin/sh + +if [ -z "$TMAKEPATH" ] +then + echo "*******************************************************************************" + echo " TMAKEPATH is not set. This package requires a correctly set up" + echo " tmake. To get tmake go to ftp://ftp.troll.no/freebies/tmake" + echo "*******************************************************************************" + exit -1 +fi + +if [ ! -f "$TMAKEPATH/../../bin/tmake" ] +then + echo "*******************************************************************************" + echo " The tmake utility was not found. This package requires a correctly" + echo " set up tmake. To get tmake go to ftp://ftp.troll.no/freebies/tmake" + echo "*******************************************************************************" + exit -1 +fi + +if [ ! -f "$QTDIR/bin/uic" ] +then + echo " uic seems not to be installed (part of Qt-Designer package)" + echo " going to create Makefiles without uic support" + HAS_UIC=no +fi + +for ac_option +do + case "$ac_option" in + --no-uic) + HAS_UIC=no + ;; + --help) + echo "Usage: ./configure [--help|--no-uic]" + echo " --help: Print this message" + echo " --no-uic: Create Makefile without uic usage" + exit 0 + ;; + esac +done + +echo "Creating Makefiles..." + +cd src + +if [ x"$HAS_UIC" = xno ] +then + echo "Creating regular Makefile without uic" + cp qtdmm_nouic.pro src.pro +else + echo "Creating regular Makefile" + cp qtdmm.pro src.pro +fi + +cd .. + +$TMAKEPATH/../../bin/tmake -o Makefile qtdmm.pro + +echo "Testing libraries & tools ..." + +if [ -z "$QTDIR" ] +then + echo "*******************************************************************************" + echo " QTDIR is not set. This package requires a correctly set up" + echo " Qt. To get Qt, see http://www.trolltech.com" + echo "*******************************************************************************" + exit -1 +fi + +echo "#include " > qttest.cpp +echo "#include " >> qttest.cpp +echo "int main(int argc, char **argv) { fprintf( stderr, \"Found QT Version %s: \", QT_VERSION_STR );" >> qttest.cpp +echo "if (QT_VERSION >= 210) return 0; else return -1; }" >> qttest.cpp +gcc -I$QTDIR/include qttest.cpp +if ./a.out +then +echo "OK" +rm qttest.cpp 2>/dev/null +rm a.out 2>/dev/null +else +echo "Please upgrade your Qt installation" +rm qttest.cpp 2>/dev/null +rm a.out 2>/dev/null +exit -1 +fi + +if [ ! -f "$QTDIR/bin/moc" ] +then + echo "*******************************************************************************" + echo " The moc meta object compiler was not found. This package requires a" + echo " correctly set up Qt. To get Qt, see http://www.trolltech.com" + echo "*******************************************************************************" + exit -1 +fi + +echo "" +echo "*******************************************************************************" +echo "Type make to compile QtDMM. After that you'll" +echo "find the binary in the bin directory." +echo "" +echo "Enjoy it! -- Matthias Toussaint " +echo "*******************************************************************************" + + + diff --git a/qtdmm.pro b/qtdmm.pro new file mode 100644 index 0000000..0e56068 --- /dev/null +++ b/qtdmm.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = src +CONFIG += ordered diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..8fc4586 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,287 @@ +############################################################################# +# Makefile for building ../bin/qtdmm +# Generated by tmake at 20:06, 2001/04/15 +# Project: src +# Template: app +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +CFLAGS = -pipe -Wall -W -O2 -D_REENTRANT -DQT_THREAD_SUPPORT -DNO_DEBUG +CXXFLAGS= -pipe -Wall -W -O2 -D_REENTRANT -DQT_THREAD_SUPPORT -DNO_DEBUG +INCPATH = -I. -Imoc -I$(QTDIR)/include +LINK = g++ +LFLAGS = +LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lpthread -lqt-mt -lXext -lX11 -lm +MOC = $(QTDIR)/bin/moc +UIC = $(QTDIR)/bin/uic + +TAR = tar -cf +GZIP = gzip -9f + +####### Files + +HEADERS = configdlg.h \ + dmm.h \ + dmmbar.h \ + dmmgraph.h \ + mainwid.h \ + simplecfg.h \ + printdlg.h \ + readerthread.h \ + readevent.h \ + uiconfigdlg.h \ + uimainwid.h \ + uiprintdlg.h +SOURCES = main.cpp \ + configdlg.cpp \ + dmm.cpp \ + dmmbar.cpp \ + dmmgraph.cpp \ + mainwid.cpp \ + simplecfg.cpp \ + printdlg.cpp \ + readerthread.cpp \ + uiconfigdlg.cpp \ + uimainwid.cpp \ + uiprintdlg.cpp +OBJECTS = tmp/main.o \ + tmp/configdlg.o \ + tmp/dmm.o \ + tmp/dmmbar.o \ + tmp/dmmgraph.o \ + tmp/mainwid.o \ + tmp/simplecfg.o \ + tmp/printdlg.o \ + tmp/readerthread.o \ + tmp/uiconfigdlg.o \ + tmp/uimainwid.o \ + tmp/uiprintdlg.o +INTERFACES = +UICDECLS = +UICIMPLS = +SRCMOC = moc/moc_configdlg.cpp \ + moc/moc_dmm.cpp \ + moc/moc_dmmbar.cpp \ + moc/moc_dmmgraph.cpp \ + moc/moc_mainwid.cpp \ + moc/moc_printdlg.cpp \ + moc/moc_uiconfigdlg.cpp \ + moc/moc_uimainwid.cpp \ + moc/moc_uiprintdlg.cpp +OBJMOC = tmp/moc_configdlg.o \ + tmp/moc_dmm.o \ + tmp/moc_dmmbar.o \ + tmp/moc_dmmgraph.o \ + tmp/moc_mainwid.o \ + tmp/moc_printdlg.o \ + tmp/moc_uiconfigdlg.o \ + tmp/moc_uimainwid.o \ + tmp/moc_uiprintdlg.o +DIST = +TARGET = ../bin/qtdmm +INTERFACE_DECL_PATH = . + +####### Implicit rules + +.SUFFIXES: .cpp .cxx .cc .C .c + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + + +all: $(TARGET) + +$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + +moc: $(SRCMOC) + +tmake: Makefile + +Makefile: src.pro + tmake src.pro -o Makefile + +dist: + $(TAR) src.tar src.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) + $(GZIP) src.tar + +clean: + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) + -rm -f *~ core + +####### Sub-libraries + + +###### Combined headers + + +####### Compile + +tmp/main.o: main.cpp \ + mainwid.h \ + uimainwid.h \ + dmm.h \ + readerthread.h \ + configdlg.h \ + uiconfigdlg.h \ + simplecfg.h \ + dmmgraph.h \ + printdlg.h \ + uiprintdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/main.o main.cpp + +tmp/configdlg.o: configdlg.cpp \ + configdlg.h \ + uiconfigdlg.h \ + simplecfg.h \ + dmmgraph.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/configdlg.o configdlg.cpp + +tmp/dmm.o: dmm.cpp \ + dmm.h \ + readerthread.h \ + readevent.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/dmm.o dmm.cpp + +tmp/dmmbar.o: dmmbar.cpp \ + dmmbar.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/dmmbar.o dmmbar.cpp + +tmp/dmmgraph.o: dmmgraph.cpp \ + dmmgraph.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/dmmgraph.o dmmgraph.cpp + +tmp/mainwid.o: mainwid.cpp \ + mainwid.h \ + uimainwid.h \ + dmm.h \ + readerthread.h \ + configdlg.h \ + uiconfigdlg.h \ + simplecfg.h \ + dmmgraph.h \ + printdlg.h \ + uiprintdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/mainwid.o mainwid.cpp + +tmp/simplecfg.o: simplecfg.cpp \ + simplecfg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/simplecfg.o simplecfg.cpp + +tmp/printdlg.o: printdlg.cpp \ + printdlg.h \ + uiprintdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/printdlg.o printdlg.cpp + +tmp/readerthread.o: readerthread.cpp \ + readerthread.h \ + readevent.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/readerthread.o readerthread.cpp + +tmp/uiconfigdlg.o: uiconfigdlg.cpp \ + uiconfigdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/uiconfigdlg.o uiconfigdlg.cpp + +tmp/uimainwid.o: uimainwid.cpp \ + uimainwid.h \ + dmmgraph.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/uimainwid.o uimainwid.cpp + +tmp/uiprintdlg.o: uiprintdlg.cpp \ + uiprintdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/uiprintdlg.o uiprintdlg.cpp + +tmp/moc_configdlg.o: moc/moc_configdlg.cpp \ + configdlg.h \ + uiconfigdlg.h \ + simplecfg.h \ + dmmgraph.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_configdlg.o moc/moc_configdlg.cpp + +tmp/moc_dmm.o: moc/moc_dmm.cpp \ + dmm.h \ + readerthread.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_dmm.o moc/moc_dmm.cpp + +tmp/moc_dmmbar.o: moc/moc_dmmbar.cpp \ + dmmbar.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_dmmbar.o moc/moc_dmmbar.cpp + +tmp/moc_dmmgraph.o: moc/moc_dmmgraph.cpp \ + dmmgraph.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_dmmgraph.o moc/moc_dmmgraph.cpp + +tmp/moc_mainwid.o: moc/moc_mainwid.cpp \ + mainwid.h \ + uimainwid.h \ + dmm.h \ + readerthread.h \ + configdlg.h \ + uiconfigdlg.h \ + simplecfg.h \ + dmmgraph.h \ + printdlg.h \ + uiprintdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_mainwid.o moc/moc_mainwid.cpp + +tmp/moc_printdlg.o: moc/moc_printdlg.cpp \ + printdlg.h \ + uiprintdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_printdlg.o moc/moc_printdlg.cpp + +tmp/moc_uiconfigdlg.o: moc/moc_uiconfigdlg.cpp \ + uiconfigdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_uiconfigdlg.o moc/moc_uiconfigdlg.cpp + +tmp/moc_uimainwid.o: moc/moc_uimainwid.cpp \ + uimainwid.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_uimainwid.o moc/moc_uimainwid.cpp + +tmp/moc_uiprintdlg.o: moc/moc_uiprintdlg.cpp \ + uiprintdlg.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/moc_uiprintdlg.o moc/moc_uiprintdlg.cpp + +moc/moc_configdlg.cpp: configdlg.h + $(MOC) configdlg.h -o moc/moc_configdlg.cpp + +moc/moc_dmm.cpp: dmm.h + $(MOC) dmm.h -o moc/moc_dmm.cpp + +moc/moc_dmmbar.cpp: dmmbar.h + $(MOC) dmmbar.h -o moc/moc_dmmbar.cpp + +moc/moc_dmmgraph.cpp: dmmgraph.h + $(MOC) dmmgraph.h -o moc/moc_dmmgraph.cpp + +moc/moc_mainwid.cpp: mainwid.h + $(MOC) mainwid.h -o moc/moc_mainwid.cpp + +moc/moc_printdlg.cpp: printdlg.h + $(MOC) printdlg.h -o moc/moc_printdlg.cpp + +moc/moc_uiconfigdlg.cpp: uiconfigdlg.h + $(MOC) uiconfigdlg.h -o moc/moc_uiconfigdlg.cpp + +moc/moc_uimainwid.cpp: uimainwid.h + $(MOC) uimainwid.h -o moc/moc_uimainwid.cpp + +moc/moc_uiprintdlg.cpp: uiprintdlg.h + $(MOC) uiprintdlg.h -o moc/moc_uiprintdlg.cpp + diff --git a/src/configdlg.cpp b/src/configdlg.cpp new file mode 100644 index 0000000..5730c51 --- /dev/null +++ b/src/configdlg.cpp @@ -0,0 +1,316 @@ +//====================================================================== +// File: configdlg.cpp +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:24:08 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include + +ConfigDlg::ConfigDlg( QWidget *parent, const char *name ) : + UIConfigDlg( parent, name, true ) +{ + QString path = QDir::homeDirPath(); + path += "/.qtdmmrc"; + + m_cfg = new SimpleCfg( path ); + cancelSLOT(); + + QDoubleValidator *dval = new QDoubleValidator( -99999.9, 99999.9, 5, this ); + scaleMinEd->setValidator( dval ); + scaleMaxEd->setValidator( dval ); + + QIntValidator *ival = new QIntValidator( 1, 99999, this ); + winSize->setValidator( ival ); + winLength->setValidator( ival ); + sampleEvery->setValidator( ival ); + sampleTime->setValidator( ival ); + + connect( helpBut, SIGNAL( clicked() ), this, SLOT( helpSLOT() )); + connect( okBut, SIGNAL( clicked() ), this, SLOT( applySLOT() )); + connect( cancelBut, SIGNAL( clicked() ), this, SLOT( cancelSLOT() )); +} + +ConfigDlg::~ConfigDlg() +{ +} + +void +ConfigDlg::applySLOT() +{ + m_cfg->clear(); + + m_cfg->setInt( "Sample", "rate", sampleEvery->text().toInt() ); + m_cfg->setInt( "Sample", "rate-unit", sampleUnit->currentItem() ); + m_cfg->setInt( "Sample", "time", sampleTime->text().toInt() ); + m_cfg->setInt( "Sample", "time-unit", timeUnit->currentItem() ); + + m_cfg->setInt( "Start", "mode", sampleMode() ); + m_cfg->setInt( "Start", "hour", hour->value() ); + m_cfg->setInt( "Start", "minute", minute->value() ); + m_cfg->setInt( "Start", "second", second->value() ); + m_cfg->setInt( "Start", "raising-threshold", raisingThreshold() ); + m_cfg->setInt( "Start", "falling-threshold", fallingThreshold() ); + + m_cfg->setBool( "Scale", "automatic", automaticScale() ); + m_cfg->setDouble( "Scale", "minimum", scaleMin() ); + m_cfg->setDouble( "Scale", "maximum", scaleMax() ); + + m_cfg->setInt( "Window", "size", winSize->text().toInt() ); + m_cfg->setInt( "Window", "size-unit", sizeUnit->currentItem() ); + m_cfg->setInt( "Window", "length", winLength->text().toInt() ); + m_cfg->setInt( "Window", "length-unit", lengthUnit->currentItem() ); + + m_cfg->setInt( "Port settings", "device", port->currentItem() ); + m_cfg->setInt( "Port settings", "baud", baudRate->currentItem() ); + m_cfg->save(); +} + +void +ConfigDlg::cancelSLOT() +{ + m_cfg->clear(); + m_cfg->load(); + + sampleEvery->setText( m_cfg->getString( "Sample", "rate", "1" )); + sampleUnit->setCurrentItem( m_cfg->getInt( "Sample", "rate-unit", 0 )); + sampleTime->setText( m_cfg->getString( "Sample", "time", "500" )); + timeUnit->setCurrentItem( m_cfg->getInt( "Sample", "time-unit", 0 )); + + DMMGraph::SampleMode mode = (DMMGraph::SampleMode)m_cfg->getInt( "Start", "mode", 0 ); + if (mode == DMMGraph::Manual) + { + manualBut->setChecked( true ); + } + else if (mode == DMMGraph::Time) + { + predefinedBut->setChecked( true ); + } + if (mode == DMMGraph::Raising) + { + triggerBut->setChecked( true ); + raisingBut->setChecked( true ); + } + if (mode == DMMGraph::Falling) + { + triggerBut->setChecked( true ); + fallingBut->setChecked( true ); + } + + hour->setValue( m_cfg->getInt( "Start", "hour", 0 )); + minute->setValue( m_cfg->getInt( "Start", "minute", 0 )); + second->setValue( m_cfg->getInt( "Start", "second", 0 )); + raisingThresholdEdit->setText( m_cfg->getString( "Start", "raising-threshold", "0.0" )); + fallingThresholdEdit->setText( m_cfg->getString( "Start", "falling-threshold", "0.0" )); + + bool autoScale = m_cfg->getBool( "Scale", "automatic", true ); + if (autoScale) + { + autoScaleBut->setChecked( true ); + } + else + { + manualScaleBut->setChecked( true ); + } + + scaleMinEd->setText( m_cfg->getString( "Scale", "minimum", "-3.999" )); + scaleMaxEd->setText( m_cfg->getString( "Scale", "maximum", "3.999" )); + + winSize->setText( m_cfg->getString( "Window", "size", "3600" )); + sizeUnit->setCurrentItem( m_cfg->getInt( "Window", "size-unit", 0 )); + winLength->setText( m_cfg->getString( "Window", "length", "600" )); + lengthUnit->setCurrentItem( m_cfg->getInt( "Window", "length-unit", 0 )); + + port->setCurrentItem( m_cfg->getInt( "Port settings", "device", 0 ) ); + baudRate->setCurrentItem( m_cfg->getInt( "Port settings", "baud", 0 ) ); +} + +void +ConfigDlg::helpSLOT() +{ + QWhatsThis::enterWhatsThisMode(); +} + +int +ConfigDlg::speed() const +{ + switch (baudRate->currentItem()) + { + case 0: + return 600; + case 1: + return 1200; + case 2: + return 1800; + case 3: + return 2400; + case 4: + return 4800; + case 5: + return 9600; + } + + return 600; +} + +int +ConfigDlg::windowSeconds() const +{ + int sec = winSize->text().toInt(); + + switch (sizeUnit->currentItem()) + { + case 1: + sec *= 60; + break; + case 2: + sec *= 60*60; + break; + case 3: + sec *= 60*60*24; + break; + } + + return sec; +} + +int +ConfigDlg::totalSeconds() const +{ + int sec = winLength->text().toInt(); + + switch (lengthUnit->currentItem()) + { + case 1: + sec *= 60; + break; + case 2: + sec *= 60*60; + break; + case 3: + sec *= 60*60*24; + break; + } + + return sec; +} + +QTime +ConfigDlg::startTime() const +{ + QTime time( hour->value(), minute->value(), second->value() ); + + return time; +} + +DMMGraph::SampleMode +ConfigDlg::sampleMode() const +{ + if (predefinedBut->isChecked()) + { + return DMMGraph::Time; + } + if (triggerBut->isChecked()) + { + if (raisingBut->isChecked()) + { + return DMMGraph::Raising; + } + + return DMMGraph::Falling; + } + + return DMMGraph::Manual; +} + +int +ConfigDlg::sampleStep() const +{ + int sec = sampleEvery->text().toInt(); + + switch (sampleUnit->currentItem()) + { + case 1: + sec *= 60; + break; + case 2: + sec *= 60*60; + break; + case 3: + sec *= 60*60*24; + break; + } + + return sec; +} + +int +ConfigDlg::sampleLength() const +{ + int sec = sampleTime->text().toInt(); + + switch (timeUnit->currentItem()) + { + case 1: + sec *= 60; + break; + case 2: + sec *= 60*60; + break; + case 3: + sec *= 60*60*24; + break; + } + + return sec; +} + +double +ConfigDlg::fallingThreshold() const +{ + return fallingThresholdEdit->text().toDouble(); +} + +double +ConfigDlg::raisingThreshold() const +{ + return raisingThresholdEdit->text().toDouble(); +} + +double +ConfigDlg::scaleMin() const +{ + return scaleMinEd->text().toDouble(); +} + +double +ConfigDlg::scaleMax() const +{ + return scaleMaxEd->text().toDouble(); +} + +bool +ConfigDlg::automaticScale() const +{ + return autoScaleBut->isChecked(); +} diff --git a/src/configdlg.h b/src/configdlg.h new file mode 100644 index 0000000..00a470f --- /dev/null +++ b/src/configdlg.h @@ -0,0 +1,61 @@ +//====================================================================== +// File: configdlg.h +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:22:30 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef CONFIGDLG_HH +#define CONFIGDLG_HH + +#include +#include +#include +#include + +class ConfigDlg : public UIConfigDlg +{ + Q_OBJECT +public: + ConfigDlg( QWidget *parent=0, const char *name=0 ); + virtual ~ConfigDlg(); + + QString device() const { return port->currentText(); } + int speed() const; + int windowSeconds() const; + int totalSeconds() const; + QTime startTime() const; + DMMGraph::SampleMode sampleMode() const; + int sampleStep() const; + int sampleLength() const; + double raisingThreshold() const; + double fallingThreshold() const; + double scaleMin() const; + double scaleMax() const; + bool automaticScale() const; + +protected: + SimpleCfg *m_cfg; + +protected slots: + void applySLOT(); + void cancelSLOT(); + void helpSLOT(); + +}; + +#endif // CONFIGDLG_HH + diff --git a/src/dmm.cpp b/src/dmm.cpp new file mode 100644 index 0000000..dec1310 --- /dev/null +++ b/src/dmm.cpp @@ -0,0 +1,292 @@ +//====================================================================== +// File: dmm.cpp +// Author: Matthias Toussaint +// Created: Tue Apr 10 15:10:29 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +DMM::DMM( QObject *parent, const char *name ) : + QObject( parent, name ), + m_handle( -1 ), + m_speed( 600 ), + m_device( "/dev/ttyS1" ) +{ + m_buffer[14] = '\0'; + + m_readerThread = new ReaderThread( this ); + m_readerThread->start(); +} + +DMM::~DMM() +{ +} + +void +DMM::setSpeed( int speed ) +{ + m_speed = speed; +} + +void +DMM::setDevice( const QString & device ) +{ + m_device = device; +} + +bool +DMM::open() +{ + struct termios attr; + int mdlns; + + m_handle = ::open( m_device.latin1(), O_RDWR | O_NOCTTY ); + + if (-1 == m_handle) + { + switch (errno) + { + case EACCES: + m_error = tr( "Access denied for" ); + m_error += " "; + m_error += m_device; + m_error += ". "; + break; + case ENXIO: + case ENODEV: + case ENOENT: + m_error = tr( "No such device" ); + m_error += " "; + m_error += m_device; + m_error += ". "; + break; + default: + m_error = tr( "Error opening" ); + m_error += " "; + m_error += m_device; + m_error += ". "; + m_error += tr( "DMM connected and switched on?" ); + break; + } + + emit error( m_error ); + + return false; + } + + attr.c_oflag = 0; + attr.c_lflag = 0; + attr.c_iflag = IGNBRK | IGNPAR; + attr.c_cflag = CS7 | CSTOPB | CREAD | CLOCAL; + attr.c_cc[VTIME]= 20; + attr.c_cc[VMIN]= 0; + + if (600 == m_speed) + { + cfsetospeed( &attr, B600 ); + cfsetispeed( &attr, B600 ); + } + else if (1200 == m_speed) + { + cfsetospeed( &attr, B1200 ); + cfsetispeed( &attr, B1200 ); + } + else if (1800 == m_speed) + { + cfsetospeed( &attr, B1800 ); + cfsetispeed( &attr, B1800 ); + } + else if (2400 == m_speed) + { + cfsetospeed( &attr, B2400 ); + cfsetispeed( &attr, B2400 ); + } + else if (4800 == m_speed) + { + cfsetospeed( &attr, B4800 ); + cfsetispeed( &attr, B4800 ); + } + else + { + cfsetospeed( &attr, B9600 ); + cfsetispeed( &attr, B9600 ); + } + + m_error = tr( "Error configuring serial port." ); + m_error += " "; + m_error += m_device; + m_error += ". "; + + if (-1 == tcsetattr( m_handle, TCSANOW, &attr )) + { + ::close(m_handle); + m_handle = -1; + + emit error( m_error ); + + return false; + } + + mdlns = 0; + if (-1 == ioctl( m_handle, TIOCMGET, &mdlns )) + { + ::close(m_handle); + m_handle = -1; + + emit error( m_error ); + + return false; + } + + mdlns &= ~TIOCM_RTS; + if (-1 == ioctl( m_handle, TIOCMSET, &mdlns )) + { + ::close(m_handle); + m_handle = -1; + + emit error( m_error ); + + return false; + } + + m_error = tr( "Connected" ); + emit error( m_error ); + + m_readerThread->setHandle( m_handle ); + + timerEvent( 0 ); + + startTimer( 1000 ); + + return true; +} + +void +DMM::close() +{ + if (-1 != m_handle) + { + ::close( m_handle ); + } + + killTimers(); + + m_error = tr( "Not connected" ); + emit error( m_error ); + + m_handle = -1; + m_readerThread->setHandle( m_handle ); +} + +void +DMM::timerEvent( QTimerEvent * ) +{ + if (-1 == m_handle) + { + emit error( m_error ); + } + else + { + m_readerThread->startRead(); + } +} + +bool +DMM::event( QEvent *ev ) +{ + if (QObject::event(ev)) return true; + + if (QEvent::User == ev->type()) + { + QString val; + QString special; + QString unit; + + if (ReaderThread::Ok == m_readerThread->status()) + { + QString tmp = ((ReadEvent *)ev)->string(); + + val = tmp.mid( 3, 6 ).stripWhiteSpace(); + unit = tmp.mid( 9, 4 ).stripWhiteSpace(); + special = tmp.left( 3 ).stripWhiteSpace(); + + double d_val = val.toDouble(); + + if (unit.left(1) == "n") + { + d_val /= 1.0E9; + } + else if (unit.left(1) == "u") + { + d_val /= 1.0E6; + } + else if (unit.left(1) == "m") + { + d_val /= 1.0E3; + } + else if (unit.left(1) == "k") + { + d_val *= 1.0E3; + } + else if (unit.left(1) == "M") + { + d_val *= 1.0E9; + } + + emit value( d_val, val, unit, special ); + + m_error = tr( "Connected" ); + } + else + { + if (ReaderThread::Error == m_readerThread->status()) + { + m_error = tr( "Read error on device" ); + m_error += " "; + m_error += m_device; + m_error += ". "; + m_error += tr( "DMM connected and switched on?" ); + } + else if (ReaderThread::Timeout == m_readerThread->status()) + { + m_error = tr( "Timeout on device" ); + m_error += " "; + m_error += m_device; + m_error += ". "; + m_error += tr( "DMM connected and switched on?" ); + } + else if (ReaderThread::NotConnected == m_readerThread->status()) + { + m_error = tr( "Not Connected" ); + } + } + emit error( m_error ); + + return false; + } + + return true; +} diff --git a/src/dmm.h b/src/dmm.h new file mode 100644 index 0000000..7ab4ec4 --- /dev/null +++ b/src/dmm.h @@ -0,0 +1,62 @@ +//====================================================================== +// File: dmm.h +// Author: Matthias Toussaint +// Created: Tue Apr 10 15:10:49 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef DMM_HH +#define DMM_HH + +#include +#include + +class DMM : public QObject +{ + Q_OBJECT + +public: + DMM( QObject *parent=0, const char *name=0 ); + virtual ~DMM(); + + void setSpeed( int ); + void setDevice( const QString & ); + bool open(); + void close(); + QString errorString() const { return m_error; } + bool isOpen() const { return m_handle >= 0; } + +signals: + void value( double dval, + const QString & val, + const QString & unit, + const QString & special ); + void error( const QString & ); + +protected: + int m_handle; + int m_speed; + QString m_device; + QString m_error; + char m_buffer[15]; + ReaderThread *m_readerThread; + + void timerEvent( QTimerEvent * ); + bool event( QEvent * ); + +}; + +#endif // DMM_HH diff --git a/src/dmmbar.cpp b/src/dmmbar.cpp new file mode 100644 index 0000000..3ec50fc --- /dev/null +++ b/src/dmmbar.cpp @@ -0,0 +1,50 @@ +//====================================================================== +// File: dmmbar.cpp +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:45:35 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include + +DMMBar::DMMBar( QWidget *parent, const char *name ) : + QWidget( parent, name ), + m_value( 0.0 ) +{ +} + +DMMBar::~DMMBar() +{ +} + +void +DMMBar::setValue( double value ) +{ + while (value > 4) + { + value /= 10.; + } + + m_value = value; + + update(); +} + +void +DMMBar::paintEvent( QPaintEvent * ) +{ + +} diff --git a/src/dmmbar.h b/src/dmmbar.h new file mode 100644 index 0000000..7c7b25b --- /dev/null +++ b/src/dmmbar.h @@ -0,0 +1,43 @@ +//====================================================================== +// File: dmmbar.h +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:42:19 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef DMMBAR_HH +#define DMMBAR_HH + +#include + +class DMMBar : public QWidget +{ + Q_OBJECT +public: + DMMBar( QWidget *parent=0, const char *name=0 ); + virtual ~DMMBar(); + +public slots: + void setValue( double ); + +protected: + double m_value; + + void paintEvent( QPaintEvent * ); + +}; + +#endif // DMMBAR_HH diff --git a/src/dmmgraph.cpp b/src/dmmgraph.cpp new file mode 100644 index 0000000..3f21c25 --- /dev/null +++ b/src/dmmgraph.cpp @@ -0,0 +1,881 @@ +//====================================================================== +// File: dmmgraph.cpp +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:45:35 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DMMGraph::DMMGraph( QWidget *parent, const char *name ) : + QWidget( parent, name ), + m_size( 600 ), + m_length( 3600 ), + m_scaleMin( 0 ), + m_scaleMax( 0 ), + m_autoScale( true ), + m_pointer( 0 ), + m_ystep( 1 ), + m_sampleTime( 2 ), + m_sampleLength( 500 ), + m_running( false ), + m_mode( DMMGraph::Manual ), + m_mouseDown( false ), + m_lastValValid( false ) +{ + m_array = new QArray (m_length); + + scrollbar = new QScrollBar( QScrollBar::Horizontal, this ); + scrollbar->setGeometry( 0, height()-16, width(), 16 ); + scrollbar->setTracking( true ); + scrollbar->setCursor( arrowCursor ); + + connect( scrollbar, SIGNAL( valueChanged(int) ), + this, SLOT( update() )); + + m_remainingLength = m_sampleLength; + emitInfo(); + + m_infoBox = new QLabel( 0, 0, WStyle_Customize | WStyle_NoBorder | + WStyle_Tool ); + m_infoBox->resize( 100, 50 ); + m_infoBox->setFrameStyle( QFrame::Box | QFrame::Plain ); + m_infoBox->setPalette( QToolTip::palette() ); + + setBackgroundMode( QWidget::NoBackground ); +} + +DMMGraph::~DMMGraph() +{ +} + +void +DMMGraph::paintEvent( QPaintEvent * ) +{ + QPixmap pix( width(), height()-16 ); + QPainter p; + p.begin( &pix ); + + paint( &p, width(), height()-16, m_xfactor, m_xstep, m_yfactor, m_ystep, + m_maxUnit, m_hUnitFact, m_hUnit, true, false ); + + p.end(); + p.begin( this ); + p.drawPixmap( 0, 0, pix ); + + if (m_mouseDown) + { + drawCursor( m_mpos ); + fillInfoBox( m_mpos ); + } +} + +void +DMMGraph::print( QPrinter *prt, const QString & title, const QString & comment ) +{ + if (!title.isEmpty()) + { + prt->setDocName( title ); + } + else + { + QString tmpStr; + tmpStr.sprintf( "QtDMM: %s", QDateTime::currentDateTime().toString().latin1() ); + } + + prt->setCreator( "QtDMM: (c) 2001 Matthias Toussaint" ); + prt->setPrintProgram( "QtDMM: (c) 2001 Matthias Toussaint" ); + + QPainter p; + p.begin( prt ); + + QPaintDeviceMetrics pdm( prt ); + + int w = pdm.width(); + int h = pdm.height(); + + p.setFont( QFont( "Helvetica", 20 ) ); + + QRect tRect = p.boundingRect( 0, 0, w, h, Qt::AlignTop | Qt::AlignHCenter | Qt::WordBreak, title ); + + p.drawText( tRect, Qt::AlignTop | Qt::AlignHCenter | Qt::WordBreak, title ); + + p.setFont( QFont( "Helvetica", 12 )); + + QFontMetrics fm = p.fontMetrics(); + int maxWidth = QMAX( fm.width( tr( "Sampling start:" ) ), + fm.width( tr( "Sampling resolution:" ))); + int tHeight = fm.height(); + + p.drawText( 0, tRect.height()+10, maxWidth, tHeight, Qt::AlignLeft | Qt::AlignVCenter, + tr( "Sampling start:" ) ); + p.drawText( maxWidth+10, tRect.height()+10, w-maxWidth-10, tHeight, Qt::AlignLeft | Qt::AlignVCenter, + m_graphStart.toString() ); + + p.drawText( 0, tRect.height()+10+tHeight, maxWidth, tHeight, Qt::AlignLeft | Qt::AlignVCenter, + tr( "Sampling resolution:" ) ); + QString tmpStr; + tmpStr.sprintf( "%d %s", m_sampleTime, tr( "Seconds" ).latin1() ); + p.drawText( maxWidth+10, tRect.height()+10+tHeight, + w-maxWidth-10, tHeight, Qt::AlignLeft | Qt::AlignVCenter, + tmpStr ); + + p.setFont( QFont( "Helvetica", 10 )); + + QRect cRect = p.boundingRect( 0, 0, w, h, Qt::AlignTop | Qt::AlignLeft | Qt::WordBreak, comment ); + + p.drawText( 0, tRect.height()+20+2*tHeight, w, cRect.height(), + Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak, comment ); + + h -= tRect.height()+30+2*tHeight+cRect.height(); + + double yfactor, ystep; + yfactor = createYScale( h, ystep ); + + double xfactor, xstep, hUnitFact, maxUnit; + QString hUnit; + xfactor = createTimeScale( w, xstep, hUnitFact, maxUnit, hUnit ); + + p.setClipRect( 0, tRect.height()+30+2*tHeight+cRect.height(), w, h ); + p.setClipping( true ); + + p.translate( 0, tRect.height()+30+2*tHeight+cRect.height() ); + + paint( &p, w, h, xfactor, xstep, yfactor, ystep, + maxUnit, hUnitFact, hUnit, prt->colorMode() == QPrinter::Color, true ); + + p.end(); +} + +void +DMMGraph::paint( QPainter *p, int w, int h, + double xfactor, double xstep, + double yfactor, double ystep, + double maxUnit, double hUnitFact, const QString & hUnit, + bool color, bool printer ) +{ + p->setBrush( Qt::white ); + p->setPen( Qt::black ); + p->drawRect( 0, 0, w, h ); + + if (m_scaleMin != m_scaleMax) + { + paintHorizontalGrid( p, w, h, yfactor, ystep, color ); + paintVerticalGrid( p, w, h, xfactor, xstep, maxUnit, hUnitFact, hUnit, color ); + paintData( p, w, h, xfactor, yfactor, color, printer ); + } +} + +void +DMMGraph::paintHorizontalGrid( QPainter *p, int w, int h, double yfactor, double ystep, bool color ) +{ + if (color) + { + p->setPen( Qt::gray ); + } + else + { + p->setPen( Qt::black ); + } + int y = (int)qRound( 1+(m_scaleMax)/yfactor ); + p->drawLine( 47, y, w-1, y ); + p->drawLine( 50, 1, 50, h-1-20 ); + p->drawLine( 50, h-1-20, w-1, h-1-20 ); + + if (color) + { + p->setPen( QPen( Qt::gray, 0, Qt::DotLine ) ); + } + else + { + p->setPen( QPen( Qt::black, 0, Qt::DotLine ) ); + } + + QString scaleVal; + double val = 0.0; + while (val < m_scaleMax) + { + y = (int)qRound( 1+(m_scaleMax-val)/yfactor ); + p->drawLine( 47, y, w-1, y ); + if (y>20) + { + scaleVal.sprintf( "%g", val ); + p->drawText( 1, y-10, 44, 20, Qt::AlignRight | Qt::AlignVCenter, scaleVal ); + } + val += ystep; + } + val = -ystep; + while (val > m_scaleMin) + { + y = (int)qRound( 1+(m_scaleMax-val)/yfactor ); + p->drawLine( 47, y, w-1, y ); + scaleVal.sprintf( "%g", val ); + p->drawText( 1, y-10, 44, 20, Qt::AlignRight | Qt::AlignVCenter, scaleVal ); + val -= ystep; + } + + p->drawText( 4, 4, 40, 20, Qt::AlignLeft | Qt::AlignVCenter, m_unit ); +} + +void +DMMGraph::paintVerticalGrid( QPainter *p, int w, int h, double xfactor, double xstep, + double maxUnit, double hUnitFact, const QString & hUnit, bool color ) +{ + if (color) + { + p->setPen( QPen( Qt::gray, 0, Qt::DotLine ) ); + } + else + { + p->setPen( QPen( Qt::black, 0, Qt::DotLine ) ); + } + + QString scaleVal; + double val = xstep; + while (val < maxUnit) + { + int x = 50 + (int)qRound( 1+(val)/hUnitFact - scrollbar->value()/xfactor ); + if (x > 51 && x < w-20) + { + p->drawLine( x, 1, x, h-1-20 ); + if (x < w-45) + { + scaleVal.sprintf( "%g", val ); + p->drawText( x-20, h-1-20, 40, 20, Qt::AlignCenter, scaleVal ); + } + } + val += xstep; + } + p->drawText( w-40, h-1-20, 36, 20, Qt::AlignRight | Qt::AlignVCenter, hUnit ); +} + +void +DMMGraph::paintData( QPainter *p, int w, int h, double xfactor, double yfactor, bool color, bool printer ) +{ + int x = (int)qRound( (m_pointer-scrollbar->value()-1)/xfactor ) + 51; + if (!printer && x>50 && x <= w) + { + p->setPen( Qt::darkRed ); + p->drawLine( x, 1, x, h-1-20 ); + } + + int y = (int)qRound( 1+(m_scaleMax-(*m_array)[scrollbar->value()])/yfactor ); + + if (color) + { + p->setPen( QPen( Qt::blue, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ) ); + } + else + { + p->setPen( QPen( Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ) ); + } + + p->moveTo( 51, y ); + + for (int i=scrollbar->value()+1; ivalue())/xfactor ) + 51; + if (x <= w) + { + int y = (int)qRound( 1+(m_scaleMax-(*m_array)[i])/yfactor ); + + p->lineTo( x, y ); + } + } +} + +void +DMMGraph::resizeEvent( QResizeEvent * ) +{ + scrollbar->setGeometry( 0, height()-16, width(), 16 ); + + m_yfactor = createYScale( height()-16, m_ystep ); + m_xfactor = createTimeScale( width(), m_xstep, m_hUnitFact, + m_maxUnit, m_hUnit ); +} + +void +DMMGraph::setGraphSize( int size, int length ) +{ + m_size = size/m_sampleTime; + m_length = length/m_sampleTime + 1; + + scrollbar->setMaxValue( m_length-m_size ); + scrollbar->setLineStep( m_size/10 ); + scrollbar->setPageStep( m_size ); + + m_array->resize( m_length ); + if (m_pointer >= m_length) + { + m_pointer = m_length-1; + } + + emitInfo(); + + resizeEvent( 0 ); + update(); +} + +void +DMMGraph::startSLOT() +{ + m_sampleCounter = 0; + m_sum = 0; + clearSLOT(); + m_running = true; + m_remainingLength = m_sampleLength; + m_pointer = 0; + + emitInfo(); + emit running( true ); + + m_graphStart = QDateTime::currentDateTime(); +} + +void +DMMGraph::stopSLOT() +{ + m_running = false; + + emitInfo(); + emit running( false ); +} + +void +DMMGraph::addValue( double val ) +{ + if (m_mode == DMMGraph::Time && !m_running) + { + // we may miss the start due to aliasing otherwise + int diff = m_startTime.secsTo( QTime::currentTime() ); + + if (diff >= 0 && diff < 2) + { + qApp->beep(); + startSLOT(); + } + } + + if (m_mode == DMMGraph::Raising && !m_running) + { + if (m_lastValValid) + { + if (m_lastVal < m_raisingThreshold && val >= m_raisingThreshold) + { + qApp->beep(); + startSLOT(); + } + } + } + + if (m_mode == DMMGraph::Falling && !m_running) + { + if (m_lastValValid) + { + if (m_lastVal > m_fallingThreshold && val <= m_fallingThreshold) + { + qApp->beep(); + startSLOT(); + } + } + } + + m_lastValValid = true; + m_lastVal = val; + + if (!m_running) return; + + m_sum += val; + + if (0 == m_sampleCounter) + { + if (!m_first) + { + val = m_sum / (double)m_sampleTime; + } + m_first = false; + m_sum = 0.0; + + if (m_pointer >= m_length) + { + for (int i=1; i m_scaleMax*0.95) { m_scaleMax = val*1.2; resFlag = true; } + if (val < m_scaleMin*0.95) { m_scaleMin = val*1.2; resFlag = true; } + } + + if (resFlag) + resizeEvent( 0 ); + + update(); + } + + emitInfo(); + + m_sampleCounter++; + if (m_sampleCounter == m_sampleTime) m_sampleCounter = 0; + + if (0 == m_remainingLength) + { + qApp->beep(); + stopSLOT(); + return; + } + + m_remainingLength--; +} + +double +DMMGraph::createYScale( int h, double & ystep ) +{ + double yfactor = (m_scaleMax-m_scaleMin) / (double)(h-1-20); + + double idiv = (double)(h-2)/40.; + double ddiv = (m_scaleMax-m_scaleMin)/idiv; + + if (ddiv > 0.001 && ddiv <=0.002 ) + { + ystep = 0.001; + } + else if (ddiv > 0.002 && ddiv <=0.005 ) + { + ystep = 0.002; + } + else if (ddiv > 0.005 && ddiv <=0.01 ) + { + ystep = 0.005; + } + else if (ddiv > 0.01 && ddiv <=0.02 ) + { + ystep = 0.01; + } + else if (ddiv > 0.02 && ddiv <=0.05 ) + { + ystep = 0.02; + } + else if (ddiv > 0.05 && ddiv <=0.1 ) + { + ystep = 0.05; + } + else if (ddiv > 0.1 && ddiv <=0.2 ) + { + ystep = 0.1; + } + else if (ddiv > 0.2 && ddiv <=0.5 ) + { + ystep = 0.2; + } + else if (ddiv > 0.5 && ddiv <=1 ) + { + ystep = 0.5; + } + else if (ddiv > 1 && ddiv <=2 ) + { + ystep = 1; + } + else if (ddiv > 2 && ddiv <=5 ) + { + ystep = 2; + } + else if (ddiv > 5 && ddiv <=10 ) + { + ystep = 5; + } + else if (ddiv > 10 && ddiv <=20 ) + { + ystep = 10; + } + else if (ddiv > 20 && ddiv <=50 ) + { + ystep = 20; + } + else if (ddiv > 50 && ddiv <=100 ) + { + ystep = 50; + } + else if (ddiv > 50 && ddiv <=100 ) + { + ystep = 50; + } + else if (ddiv > 100 && ddiv <=200 ) + { + ystep = 100; + } + else if (ddiv > 200 && ddiv <=500 ) + { + ystep = 200; + } + else if (ddiv > 500 && ddiv <=1000 ) + { + ystep = 500; + } + else if (ddiv > 1000 && ddiv <=2000 ) + { + ystep = 1000; + } + else if (ddiv > 2000 && ddiv <=5000 ) + { + ystep = 2000; + } + else if (ddiv > 5000 && ddiv <=10000 ) + { + ystep = 5000; + } + else + { + ystep = 10000; + } + + return yfactor; +} + +// returns xfactor +double +DMMGraph::createTimeScale( int w, double & xstep, double & hUnitFact, + double & maxUnit, QString & hUnit ) +{ + double xfactor = (double)m_size/(double)(w-52); + + double idiv = (double)(w-2-50)/80.; + double ddiv = m_size*m_sampleTime/idiv; + + hUnit = tr( "[sec]" ); + hUnitFact = xfactor*m_sampleTime; + maxUnit = m_length*m_sampleTime; + + if (ddiv > 60) + { + ddiv /= 60; + hUnit = tr( "[min]" ); + hUnitFact /= 60; + maxUnit /= 60; + + if (ddiv > 60) + { + ddiv /= 60; + hUnitFact /= 60; + maxUnit /= 60; + + hUnit = tr( "[hour]" ); + + if (ddiv > 24) + { + ddiv /= 24; + hUnitFact /= 24; + maxUnit /= 24; + + hUnit = tr( "[day]" ); + } + } + } + + if (ddiv > 1 && ddiv <=2 ) + { + xstep = 1; + } + else if (ddiv > 2 && ddiv <=5 ) + { + xstep = 2; + } + else if (ddiv > 5 && ddiv <=10 ) + { + xstep = 5; + } + else if (ddiv > 10 && ddiv <=15 ) + { + xstep = 10; + } + else if (ddiv > 15 && ddiv <=30 ) + { + xstep = 15; + } + else if (ddiv > 30 && ddiv <=60 ) + { + xstep = 30; + } + else if (ddiv > 60 && ddiv <=120 ) + { + xstep = 60; + } + else if (ddiv > 120 && ddiv <=180 ) + { + xstep = 120; + } + else if (ddiv > 180 && ddiv <=300 ) + { + xstep = 180; + } + else if (ddiv > 300 && ddiv <=600 ) + { + xstep = 300; + } + else if (ddiv > 600 && ddiv <=1000 ) + { + xstep = 600; + } + else if (ddiv > 1000 && ddiv <=2000 ) + { + xstep = 1000; + } + else if (ddiv > 2000 && ddiv <=5000 ) + { + xstep = 2000; + } + else if (ddiv > 5000 && ddiv <=10000 ) + { + xstep = 5000; + } + else if (ddiv > 10000 && ddiv <=20000 ) + { + xstep = 10000; + } + else + { + xstep = 20000; + } + + return xfactor; +} + +void +DMMGraph::setUnit( const QString & unit ) +{ + if (unit.left(1) == "n") + { + m_unit = unit.mid( 1 ); + } + else if (unit.left(1) == "u") + { + m_unit = unit.mid( 1 ); + } + else if (unit.left(1) == "m") + { + m_unit = unit.mid( 1 ); + } + else if (unit.left(1) == "k") + { + m_unit = unit.mid( 1 ); + } + else if (unit.left(1) == "M") + { + m_unit = unit.mid( 1 ); + } + else + { + m_unit = unit; + } + + QString tmp = m_unit; + m_unit = "["; + m_unit += tmp; + m_unit += "]"; +} + +void +DMMGraph::clearSLOT() +{ + m_pointer = 0; + if (m_autoScale) + { + m_scaleMin = m_scaleMax = 0; + } + + m_graphStart = QDateTime::currentDateTime(); + m_first = true; + + update(); +} + +void +DMMGraph::emitInfo() +{ + int h = m_remainingLength / 60 / 60; + int m = (m_remainingLength / 60 ) % 60; + int s = m_remainingLength % 60; + + QString txt; + txt.sprintf( "%d/%d - %02d:%02d:%02d - %s", + m_pointer, m_length, h, m, s, + m_running ? tr( "Sampling" ).latin1() : tr( "Stopped" ).latin1() ); + emit info( txt ); +} + +void +DMMGraph::mousePressEvent( QMouseEvent *ev ) +{ + if (m_scaleMin == m_scaleMax) return; + if (ev->x() < 51) return; + + drawCursor( ev->pos() ); + m_mpos = ev->pos(); + m_mouseDown = true; + + m_infoBox->move( ev->globalPos().x()+4, ev->globalPos().y()+4 ); + fillInfoBox( ev->pos() ); + m_infoBox->show(); +} + +void +DMMGraph::mouseMoveEvent( QMouseEvent *ev ) +{ + if (m_scaleMin == m_scaleMax) return; + if (!m_mouseDown) return; + + drawCursor( m_mpos ); + if (ev->x() < 51) + { + drawCursor( QPoint( 51, ev->y() )); + m_mpos = QPoint( 51, ev->y() ); + } + else + { + drawCursor( ev->pos() ); + m_mpos = ev->pos(); + } + m_infoBox->move( ev->globalPos().x()+4, ev->globalPos().y()+4 ); + fillInfoBox( ev->pos() ); + +} + +void +DMMGraph::mouseReleaseEvent( QMouseEvent * ) +{ + if (m_scaleMin == m_scaleMax) return; + if (!m_mouseDown) return; + + drawCursor( m_mpos ); + m_mouseDown = false; + + m_infoBox->hide(); +} + +void +DMMGraph::drawCursor( const QPoint & pos ) +{ + QPainter p(this); + p.setRasterOp( Qt::XorROP ); + p.setPen( Qt::white ); + p.drawLine( pos.x(), 1, pos.x(), height()-20-17 ); +} + +void +DMMGraph::fillInfoBox( const QPoint & pos ) +{ + int x = (int)qRound( (pos.x()-51)*m_xfactor + scrollbar->value() ); + if (x < 0) x = 0; + int sec = x * m_sampleTime; + + QTime t = m_graphStart.time().addSecs( sec ); + QString tmpStr = t.toString(); + + if (x < m_pointer) + { + tmpStr += "\n"; + + QString tmpVal; + tmpVal.sprintf( "%g %s", (*m_array)[x], m_unit.latin1() ); + + tmpStr += tmpVal; + } + + m_infoBox->setText( tmpStr ); + m_infoBox->adjustSize(); +} + +void +DMMGraph::exportDataSLOT() +{ + QString fn = QFileDialog::getSaveFileName( QString::null, + "All files (*.*)", + this ); + + if (!fn.isNull()) + { + QFile file( fn ); + file.open( IO_WriteOnly ); + + QTextStream ts( &file ); + + for (int i=0; i m_scaleMax*0.95) { m_scaleMax = val*1.2; } + if (val < m_scaleMin*0.95) { m_scaleMin = val*1.2; } + } + } + + resizeEvent( 0 ); +} diff --git a/src/dmmgraph.h b/src/dmmgraph.h new file mode 100644 index 0000000..28b86d7 --- /dev/null +++ b/src/dmmgraph.h @@ -0,0 +1,129 @@ +//====================================================================== +// File: dmmgraph.h +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:43:46 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef DMMGRAPH_HH +#define DMMGRAPH_HH + +#include +#include +#include +#include +#include +#include + +class DMMGraph : public QWidget +{ + Q_OBJECT +public: + enum SampleMode + { + Manual, + Time, + Raising, + Falling + }; + + DMMGraph( QWidget *parent=0, const char *name=0 ); + virtual ~DMMGraph(); + + void setGraphSize( int size, int length ); + void addValue( double ); + void setUnit( const QString & ); + void setSampleTime( int v ) { m_sampleTime = v; } + void setSampleLength( int v ) { m_sampleLength = v; } + void setStartTime( const QTime & time ) { m_startTime = time; } + void setMode( DMMGraph::SampleMode mode ) { m_mode = mode; } + void print( QPrinter *prt, const QString &, const QString & ); + void setThresholds( double falling, double raising ); + void setScale( bool autoScale, double min, double max ); + +signals: + void info( const QString & ); + void running( bool ); + +public slots: + void clearSLOT(); + void startSLOT(); + void stopSLOT(); + void exportDataSLOT(); + +protected: + QScrollBar *scrollbar; + int m_size; + int m_length; + double m_scaleMin; + double m_scaleMax; + bool m_autoScale; + QArray *m_array; + int m_pointer; + double m_yfactor; + double m_xfactor; + double m_ystep; + QString m_unit; + QString m_hUnit; + double m_xstep; + double m_hUnitFact; + double m_maxUnit; + int m_sampleTime; + int m_sampleLength; + bool m_running; + int m_sampleCounter; + int m_remainingLength; + SampleMode m_mode; + QTime m_startTime; + QDateTime m_graphStart; + double m_sum; + bool m_first; + QPoint m_mpos; + QLabel *m_infoBox; + bool m_mouseDown; + double m_raisingThreshold; + double m_fallingThreshold; + double m_lastVal; + bool m_lastValValid; + + void paintEvent( QPaintEvent * ); + void resizeEvent( QResizeEvent * ); + double createYScale( int h, double & ystep ); + double createTimeScale( int w, double & xstep, double & hUnitFact, + double & maxUnit, QString & hUnit ); + void emitInfo(); + void paint( QPainter *p, int w, int h, + double xfactor, double xstep, + double yfactor, double ystep, + double maxUnit, double hUnitFact, + const QString & hUnit, bool color, bool printer ); + void paintHorizontalGrid( QPainter *p, int w, int h, + double yfactor, double ystep, bool color ); + void paintVerticalGrid( QPainter *p, int w, int h, + double xfactor, double xstep, + double maxUnit, double hUnitFact, + const QString & hUnit, bool color ); + void paintData( QPainter *p, int w, int h, double xfactor, + double yfactor, bool color, bool printer ); + void mousePressEvent( QMouseEvent * ); + void mouseMoveEvent( QMouseEvent * ); + void mouseReleaseEvent( QMouseEvent * ); + void drawCursor( const QPoint & ); + void fillInfoBox( const QPoint & ); + +}; + +#endif // DMMGRAPH_HH diff --git a/src/help.xpm b/src/help.xpm new file mode 100644 index 0000000..848710d --- /dev/null +++ b/src/help.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * help_xpm[] = { +"22 22 4 1", +" c None", +". c #000000", +"+ c #000080", +"@ c #484848", +" ", +" ", +" ", +" . +++++ ", +" .. +++@+++ ", +" ... +++@@ +++ ", +" .... ++@@ ++@ ", +" ..... ++@ ++@ ", +" ...... +@ +++@ ", +" ....... @ +++@@ ", +" ........ +++@@ ", +" ......... +++@@ ", +" .....@@@@@+++@ ", +" ..@... @@@ ", +" .@@...@ +++ ", +" @ ... +++@ ", +" ...@ @@@ ", +" ... ", +" ...@ ", +" @@@ ", +" ", +" "}; diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..06c9372 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,35 @@ +//====================================================================== +// File: main.cpp +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:36:39 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include +#include + +int +main( int argc, char **argv ) +{ + QApplication app( argc, argv ); + + MainWid *mainWin = new MainWid( 0 ); + + app.setMainWidget( mainWin ); + mainWin->show(); + + return app.exec(); +} diff --git a/src/mainwid.cpp b/src/mainwid.cpp new file mode 100644 index 0000000..478d6e0 --- /dev/null +++ b/src/mainwid.cpp @@ -0,0 +1,227 @@ +//====================================================================== +// File: mainwid.cpp +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:29:01 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include +#include +#include +#include +#include +#include + +MainWid::MainWid( QWidget *parent, const char *name ) : + UIMainWid( parent, name ) +{ + m_dmm = new DMM( this ); + m_configDlg = new ConfigDlg( this ); + m_configDlg->hide(); + m_printDlg = new PrintDlg( this ); + m_printDlg->hide(); + + connect( m_dmm, SIGNAL( value( double, const QString &, + const QString &, const QString & )), + this, SLOT( valueSLOT( double, const QString &, + const QString &, const QString & ))); + connect( resetBut, SIGNAL( clicked() ), this, SLOT( resetSLOT() )); + connect( m_dmm, SIGNAL( error( const QString & ) ), + statusBar, SLOT( setText( const QString & ))); + connect( connectBut, SIGNAL( toggled( bool )), + this, SLOT( connectSLOT( bool ) )); + connect( quitBut, SIGNAL( clicked() ), + this, SLOT( quitSLOT() )); + connect( helpBut, SIGNAL( clicked() ), + this, SLOT( helpSLOT() )); + connect( configBut, SIGNAL( clicked() ), + this, SLOT( configSLOT() )); + connect( printBut, SIGNAL( clicked() ), + this, SLOT( printSLOT() )); + connect( exportBut, SIGNAL( clicked() ), + graph, SLOT( exportDataSLOT() )); + connect( clearBut, SIGNAL( clicked() ), + graph, SLOT( clearSLOT() )); + connect( startBut, SIGNAL( clicked() ), + graph, SLOT( startSLOT() )); + connect( stopBut, SIGNAL( clicked() ), + graph, SLOT( stopSLOT() )); + connect( graph, SIGNAL( info( const QString & ) ), + infoLabel, SLOT( setText( const QString & ) )); + connect( graph, SIGNAL( running( bool ) ), + this, SLOT( runningSLOT( bool ) )); + + resetSLOT(); + readConfig(); +} + +MainWid::~MainWid() +{ +} + +void +MainWid::valueSLOT( double dval, + const QString & val, const QString & u, const QString & s ) +{ + value->setText( val ); + + if (m_lastUnit != s) + { + resetSLOT(); + graph->setUnit( u ); + } + m_lastUnit = s; + + QString tmpUnit = u; + + if (s == "AC ") + { + tmpUnit += " AC"; + } + + if (dval > m_max) + { + m_max = dval; + maxValue->setText( val ); + maxUnit->setText( u ); + } + + if (dval < m_min) + { + m_min = dval; + minValue->setText( val ); + minUnit->setText( u ); + } + + unit->setText( tmpUnit ); + + graph->addValue( dval ); +} + +void +MainWid::resetSLOT() +{ + m_min = 1.0E9; + m_max = -1.0E9; + + minValue->setText( "" ); + maxValue->setText( "" ); + minUnit->setText( "" ); + maxUnit->setText( "" ); +} + +void +MainWid::connectSLOT( bool on ) +{ + if (on) + { + m_dmm->open(); + graph->clearSLOT(); + startBut->setEnabled( true ); + } + else + { + m_dmm->close(); + graph->stopSLOT(); + startBut->setEnabled( false ); + } +} + +void +MainWid::quitSLOT() +{ + m_dmm->close(); + qApp->quit(); +} + +void +MainWid::helpSLOT() +{ + QWhatsThis::enterWhatsThisMode(); +} + +void +MainWid::configSLOT() +{ + if (m_configDlg->exec()) + { + readConfig(); + } +} + +void +MainWid::printSLOT() +{ + m_printDlg->setPrinter( &m_printer ); + + if (m_printDlg->exec()) + { + graph->print( &m_printer, m_printDlg->title(), m_printDlg->comment() ); + } +} + +void +MainWid::readConfig() +{ + m_dmm->setDevice( m_configDlg->device() ); + m_dmm->setSpeed( m_configDlg->speed() ); + + graph->setGraphSize( m_configDlg->windowSeconds(), + m_configDlg->totalSeconds() ); + graph->setStartTime( m_configDlg->startTime() ); + graph->setMode( m_configDlg->sampleMode() ); + + graph->setSampleTime( m_configDlg->sampleStep() ); + graph->setSampleLength( m_configDlg->sampleLength() ); + + graph->setThresholds( m_configDlg->fallingThreshold(), + m_configDlg->raisingThreshold() ); + + graph->setScale( m_configDlg->automaticScale(), + m_configDlg->scaleMin(), + m_configDlg->scaleMax() ); + + if (m_configDlg->sampleMode() == DMMGraph::Time) + { + QString txt; + txt.sprintf( "%s %s", tr( "Automatic start at" ).latin1(), + m_configDlg->startTime().toString().latin1() ); + infoLabel->setText( txt ); + } + else if (m_configDlg->sampleMode() == DMMGraph::Raising) + { + QString txt; + txt.sprintf( "%s %g", tr( "Raising threshold" ).latin1(), + m_configDlg->raisingThreshold() ); + infoLabel->setText( txt ); + } + else if (m_configDlg->sampleMode() == DMMGraph::Falling) + { + QString txt; + txt.sprintf( "%s %g", tr( "Falling threshold" ).latin1(), + m_configDlg->fallingThreshold() ); + infoLabel->setText( txt ); + } +} + +void +MainWid::runningSLOT( bool on ) +{ + startBut->setEnabled( !on ); + stopBut->setEnabled( on ); + printBut->setEnabled( !on ); + exportBut->setEnabled( !on ); +} diff --git a/src/mainwid.h b/src/mainwid.h new file mode 100644 index 0000000..18c2527 --- /dev/null +++ b/src/mainwid.h @@ -0,0 +1,59 @@ +//====================================================================== +// File: mainwid.h +// Author: Matthias Toussaint +// Created: Tue Apr 10 17:25:07 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef MAINWID_HH +#define MAINWID_HH + +#include +#include +#include +#include +#include + +class MainWid : public UIMainWid +{ + Q_OBJECT +public: + MainWid( QWidget *parent=0, const char *name=0 ); + virtual ~MainWid(); + +protected slots: + void valueSLOT( double, const QString &, const QString &, const QString & ); + void resetSLOT(); + void connectSLOT( bool ); + void quitSLOT(); + void helpSLOT(); + void configSLOT(); + void printSLOT(); + void runningSLOT( bool ); + +protected: + DMM *m_dmm; + double m_min; + double m_max; + QString m_lastUnit; + ConfigDlg *m_configDlg; + PrintDlg *m_printDlg; + QPrinter m_printer; + + void readConfig(); +}; + +#endif // MAINWID_HH diff --git a/src/printdlg.cpp b/src/printdlg.cpp new file mode 100644 index 0000000..7db7f45 --- /dev/null +++ b/src/printdlg.cpp @@ -0,0 +1,176 @@ +//====================================================================== +// File: printdlg.cpp +// Author: Matthias Toussaint +// Created: Wed Apr 11 16:54:59 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include +#include +#include +#include +#include + +PrintDlg::PrintDlg( QWidget *parent, const char *name ) : + UIPrintDlg( parent, name, true ) +{ + connect( configBut, SIGNAL( clicked() ), + this, SLOT( configSLOT() )); + connect( helpBut, SIGNAL( clicked() ), + this, SLOT( helpSLOT() )); +} + +PrintDlg::~PrintDlg() +{ +} + +void +PrintDlg::setPrinter( QPrinter * prt ) +{ + m_printer = prt; +} + +void +PrintDlg::configSLOT() +{ + if (m_printer->setup()) + { + QString txt = m_printer->printerName(); + + if (m_printer->outputToFile()) + { + txt = "File: "; + txt += m_printer->outputFileName(); + } + txt += " "; + + switch (m_printer->pageSize()) + { + case QPrinter::A4: + txt += "A4 "; + break; + case QPrinter::B5: + txt += "B5 "; + break; + case QPrinter::Letter: + txt += "Letter "; + break; + case QPrinter::Legal: + txt += "Legal "; + break; + case QPrinter::Executive: + txt += "Executive "; + break; + case QPrinter::A0: + txt += "A0 "; + break; + case QPrinter::A1: + txt += "A1 "; + break; + case QPrinter::A2: + txt += "A2 "; + break; + case QPrinter::A3: + txt += "A3 "; + break; + case QPrinter::A5: + txt += "A5 "; + break; + case QPrinter::A6: + txt += "A6 "; + break; + case QPrinter::A7: + txt += "A7 "; + break; + case QPrinter::A8: + txt += "A8 "; + break; + case QPrinter::A9: + txt += "A9 "; + break; + case QPrinter::B0: + txt += "B0 "; + break; + case QPrinter::B1: + txt += "B1 "; + break; + case QPrinter::B10: + txt += "B10 "; + break; + case QPrinter::B2: + txt += "B2 "; + break; + case QPrinter::B3: + txt += "B3 "; + break; + case QPrinter::B4: + txt += "B4 "; + break; + case QPrinter::B6: + txt += "B6 "; + break; + case QPrinter::B7: + txt += "B7 "; + break; + case QPrinter::B8: + txt += "B8 "; + break; + case QPrinter::B9: + txt += "B9 "; + break; + case QPrinter::C5E: + txt += "C5E "; + break; + case QPrinter::Comm10E: + txt += "Comm10E "; + break; + case QPrinter::DLE: + txt += "DLE "; + break; + case QPrinter::Folio: + txt += "Folio "; + break; + case QPrinter::Ledger: + txt += "Ledger "; + break; + case QPrinter::Tabloid: + txt += "Tabloid "; + break; + case QPrinter::NPageSize: + txt += "NPageSize "; + break; + } + + if (m_printer->orientation() == QPrinter::Landscape) + { + txt += "Landscape"; + } + else + { + txt += "Portrait"; + } + + printerLabel->setText( txt ); + + printBut->setEnabled( true ); + } +} + +void +PrintDlg::helpSLOT() +{ + QWhatsThis::enterWhatsThisMode(); +} diff --git a/src/printdlg.h b/src/printdlg.h new file mode 100644 index 0000000..ecf7712 --- /dev/null +++ b/src/printdlg.h @@ -0,0 +1,49 @@ +//====================================================================== +// File: printdlg.h +// Author: Matthias Toussaint +// Created: Wed Apr 11 16:53:46 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef PRINTDLG_HH +#define PRINTDLG_HH + +#include +#include +#include + +class PrintDlg : public UIPrintDlg +{ + Q_OBJECT +public: + PrintDlg( QWidget *parent=0, const char *name=0 ); + virtual ~PrintDlg(); + + void setPrinter( QPrinter * prt ); + + QString title() const { return printTitle->text(); } + QString comment() const { return printComment->text(); } + +protected: + QPrinter *m_printer; + +protected slots: + void configSLOT(); + void helpSLOT(); + +}; + +#endif // PRINTDLG_HH diff --git a/src/qtdmm.pro b/src/qtdmm.pro new file mode 100755 index 0000000..6be2352 --- /dev/null +++ b/src/qtdmm.pro @@ -0,0 +1,36 @@ +TEMPLATE = app +CONFIG = qt release warn_on thread +INCLUDEPATH = . moc +MOC_DIR = moc +OBJECTS_DIR = tmp +DEPENDPATH = . + +HEADERS = configdlg.h \ + dmm.h \ + dmmbar.h \ + dmmgraph.h \ + mainwid.h \ + simplecfg.h \ + printdlg.h \ + readerthread.h \ + readevent.h + +INTERFACES = uiconfigdlg.ui \ + uimainwid.ui \ + uiprintdlg.ui + +SOURCES = main.cpp \ + configdlg.cpp \ + dmm.cpp \ + dmmbar.cpp \ + dmmgraph.cpp \ + mainwid.cpp \ + simplecfg.cpp \ + printdlg.cpp \ + readerthread.cpp + +LIBS = +TARGET = qtdmm +VERSION = 0.1 +DESTDIR = ../bin + diff --git a/src/qtdmm_nouic.pro b/src/qtdmm_nouic.pro new file mode 100644 index 0000000..d1df3c8 --- /dev/null +++ b/src/qtdmm_nouic.pro @@ -0,0 +1,38 @@ +TEMPLATE = app +CONFIG = qt release warn_on thread +INCLUDEPATH = . moc +MOC_DIR = moc +OBJECTS_DIR = tmp +DEPENDPATH = . + +HEADERS = configdlg.h \ + dmm.h \ + dmmbar.h \ + dmmgraph.h \ + mainwid.h \ + simplecfg.h \ + printdlg.h \ + readerthread.h \ + readevent.h \ + uiconfigdlg.h \ + uimainwid.h \ + uiprintdlg.h + +SOURCES = main.cpp \ + configdlg.cpp \ + dmm.cpp \ + dmmbar.cpp \ + dmmgraph.cpp \ + mainwid.cpp \ + simplecfg.cpp \ + printdlg.cpp \ + readerthread.cpp \ + uiconfigdlg.cpp \ + uimainwid.cpp \ + uiprintdlg.cpp + +LIBS = +TARGET = qtdmm +VERSION = 0.1 +DESTDIR = ../bin + diff --git a/src/readerthread.cpp b/src/readerthread.cpp new file mode 100644 index 0000000..58e46e7 --- /dev/null +++ b/src/readerthread.cpp @@ -0,0 +1,101 @@ +//====================================================================== +// File: readerthread.cpp +// Author: Matthias Toussaint +// Created: Sat Apr 14 12:44:00 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#include +#include +#include +#include + +ReaderThread::ReaderThread( QObject *receiver ) : + QThread(), + m_receiver( receiver ), + m_readValue( false ) +{ + m_buffer[14] = '\0'; +} + +ReaderThread::~ReaderThread() +{ +} + +void +ReaderThread::run() +{ + while (1) + { + if (m_readValue) + { + readDMM(); + m_readValue = false; + + QThread::postEvent( m_receiver, new ReadEvent( m_buffer ) ); + } + msleep( 10 ); + } +} + +void +ReaderThread::startRead() +{ + m_readValue = true; +} + +void +ReaderThread::readDMM() +{ + memset( m_buffer, ' ', 14 ); + + char byte; + int i = -1; + int retval; + + ::write( m_handle, "d\n", 2 ); + + do + { + if (-1 == m_handle) + { + m_status = ReaderThread::NotConnected; + return; + } + + retval = ::read( m_handle, &byte, 1); + + if (-1 == retval) + { + m_status = ReaderThread::Error; + + return; + } + else if (0 == retval) + { + m_status = ReaderThread::Timeout; + + return; + } + else + { + m_buffer[(++i)%14] = byte; + } + } + while ('\r' != byte); + + m_status = ReaderThread::Ok; +} diff --git a/src/readerthread.h b/src/readerthread.h new file mode 100644 index 0000000..ff85d87 --- /dev/null +++ b/src/readerthread.h @@ -0,0 +1,58 @@ +//====================================================================== +// File: readerthread.h +// Author: Matthias Toussaint +// Created: Sat Apr 14 12:42:06 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef READERTHREAD_HH +#define READERTHREAD_HH + +#include +#include + +class ReaderThread : public QThread +{ +public: + enum ReadStatus + { + Ok, + Timeout, + Error, + NotConnected + }; + + ReaderThread( QObject *receiver ); + virtual ~ReaderThread(); + + void run(); + void startRead(); + void setHandle( int handle ) { m_handle = handle; } + + ReadStatus status() const { return m_status; } + +protected: + QObject *m_receiver; + int m_handle; + ReadStatus m_status; + bool m_readValue; + char m_buffer[15]; + + void readDMM(); + +}; + +#endif // READERTHREAD_HH diff --git a/src/readevent.h b/src/readevent.h new file mode 100644 index 0000000..6434736 --- /dev/null +++ b/src/readevent.h @@ -0,0 +1,36 @@ +//====================================================================== +// File: readevent.h +// Author: Matthias Toussaint +// Created: Sat Apr 14 13:01:28 CEST 2001 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2001 Matthias Toussaint +//====================================================================== + +#ifndef READEVENT_HH +#define READEVENT_HH + +class ReadEvent : public QCustomEvent +{ +public: + ReadEvent( QString str ) : + QCustomEvent( QEvent::User ), + m_str( str ) {} + QString string() const { return m_str; } + +private: + QString m_str; + +}; +#endif // READEVENT_HH diff --git a/src/simplecfg.cpp b/src/simplecfg.cpp new file mode 100644 index 0000000..2bd20c4 --- /dev/null +++ b/src/simplecfg.cpp @@ -0,0 +1,519 @@ +//====================================================================== +// File: simplecfg.cpp +// Author: Matthias Toussaint +// Created: Mon Okt 30 22:06:04 CET 2000 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2000 Matthias Toussaint +//====================================================================== + +#include +#include +#include +#include +#include + +SimpleCfgGroup::SimpleCfgGroup( const QString & name ) : + groupName( name ) +{ +} + +SimpleCfgGroup::~SimpleCfgGroup() +{ +} + +void +SimpleCfgGroup::remove( const QString & key ) +{ + if (map.contains(key)) + { + map.remove( key ); + } +} + +bool +SimpleCfgGroup::contains( const QString & key ) +{ + return map.contains( key ); +} + +void +SimpleCfgGroup::setString( const QString & key, const QString & val ) +{ + map.replace( key, val ); +} + +QString +SimpleCfgGroup::getString( const QString & key, const QString & def ) +{ + if (map.contains( key )) + { + return map[key]; + } + else + { + setString( key, def ); + } + + return def; +} + +void +SimpleCfgGroup::setInt( const QString & key, int val ) +{ + QString tmp; + tmp.setNum( val ); + setString( key, tmp ); +} + +int +SimpleCfgGroup::getInt( const QString & key, int def ) +{ + if (map.contains( key )) + { + return map[key].toInt(); + } + else + { + setInt( key, def ); + } + + return def; +} + +void +SimpleCfgGroup::setDouble( const QString & key, double val ) +{ + QString tmp; + tmp.setNum( val ); + setString( key, tmp ); +} + +double +SimpleCfgGroup::getDouble( const QString & key, double def ) +{ + if (map.contains( key )) + { + return map[key].toDouble(); + } + else + { + setDouble( key, def ); + } + + return def; +} + +void +SimpleCfgGroup::setRGB( const QString & key, QRgb val ) +{ + QString tmp; + + tmp.setNum( val ); + setString( key, tmp ); +} + +QRgb +SimpleCfgGroup::getRGB( const QString & key, QRgb def ) +{ + if (map.contains( key )) + { + return map[key].toULong(); + } + else + { + setRGB( key, def ); + } + + return def; +} + +void +SimpleCfgGroup::setBool( const QString & key, bool val ) +{ + setString( key, val ? "true" : "false" ); +} + +bool +SimpleCfgGroup::getBool( const QString & key, bool def ) +{ + if (map.contains( key )) + { + QString val = map[key].lower(); + + if (val == "true" || val == "1" || val == "yes" || val == "on") return true; + return false; + } + else + { + setBool( key, def ); + } + + return def; +} + +SimpleCfg::SimpleCfg( const QString & name ) : + fname( name ) +{ +} + +SimpleCfg::~SimpleCfg() +{ + clear(); +} + +void +SimpleCfg::remove( const QString & group, const QString & key ) +{ + if (map.contains(group)) + { + map[group]->remove( key ); + } +} + +void +SimpleCfg::remove( const QString & group ) +{ + if (map.contains(group)) + { + delete map[group]; + map.remove( group ); + } +} + +bool +SimpleCfg::load() +{ + QFile file( fname ); + + QString group; + + if (file.open( IO_ReadOnly )) + { + clear(); + + char *buf = new char [1000]; + + while (file.readLine( buf, 999 ) != -1) + { + QString line = QString( buf ).stripWhiteSpace(); + line = line.simplifyWhiteSpace(); + + // Check if comment (good old assembler line comments:) + // + if (line.left(1) != "#" && line.left(1) != ";") + { + // Check for group + // + if (line.left(1) == "[") + { + group = line.mid( 1, line.length()-2 ); + add( group ); + } + else + { + // Search '=' + // + int pos; + + if ((pos = line.find( '=' )) != -1) + { + QString key = line.left( pos-1 ); + QString val; + + if ((int)line.length()-pos-2 > 0) + val = line.right( line.length()-pos-2 ); + else + val = ""; + + setString( group, key, val ); + } + } + } + } + + file.close(); + } + else + { + return false; + } + + return true; +} + +bool +SimpleCfg::save() +{ + QFile file( fname ); + + if (file.open( IO_WriteOnly )) + { + QTextStream s(&file); + + QMap::Iterator it; + + for (it=map.begin(); it != map.end(); ++it) + { + s << "["; + s << it.data()->name(); + s << "]\n"; + + QMap::Iterator itg; + + for (itg=it.data()->begin(); itg != it.data()->end(); ++itg) + { + s << itg.key(); + s << " = "; + s << itg.data(); + s << "\n"; + } + + s << "\n"; + } + file.close(); + } + else + { + return false; + } + + return true; +} + +bool +SimpleCfg::contains( const QString & group ) +{ + return map.contains( group ); +} + +bool +SimpleCfg::contains( const QString & group, const QString & key ) +{ + if (map.contains( group )) + { + return map[group]->contains( key ); + } + + return false; +} + +void +SimpleCfg::add( const QString & group ) +{ + if (map.contains( group )) return; + + SimpleCfgGroup *g = new SimpleCfgGroup( group ); + map.insert( group, g ); +} + +void +SimpleCfg::setString( const QString & group, const QString & key, + const QString & val ) +{ + if (map.contains( group )) + { + map[group]->setString( key, val ); + } + else + { + SimpleCfgGroup *g = new SimpleCfgGroup( group ); + g->setString( key, val ); + + map.insert( group, g ); + } +} + +QString +SimpleCfg::getString( const QString & group, const QString & key, + const QString & def ) +{ + if (map.contains( group )) + { + SimpleCfgGroup *g = map[group]; + + return g->getString( key, def ); + } + else + { + SimpleCfgGroup *g = new SimpleCfgGroup( group ); + g->setString( key, def ); + + map.insert( group, g ); + } + + return def; +} + +void +SimpleCfg::setInt( const QString & group, const QString & key, + int val ) +{ + QString tmp; + tmp.setNum( val ); + setString( group, key, tmp ); +} + +int +SimpleCfg::getInt( const QString & group, const QString & key, + int def ) +{ + if (map.contains( group )) + { + SimpleCfgGroup *g = map[group]; + + return g->getInt( key, def ); + } + else + { + SimpleCfgGroup *g = new SimpleCfgGroup( group ); + g->setInt( key, def ); + + map.insert( group, g ); + } + + return def; +} + +void +SimpleCfg::setDouble( const QString & group, const QString & key, + double val ) +{ + QString tmp; + tmp.setNum( val ); + setString( group, key, tmp ); +} + +double +SimpleCfg::getDouble( const QString & group, const QString & key, + double def ) +{ + if (map.contains( group )) + { + SimpleCfgGroup *g = map[group]; + + return g->getDouble( key, def ); + } + else + { + SimpleCfgGroup *g = new SimpleCfgGroup( group ); + g->setDouble( key, def ); + + map.insert( group, g ); + } + + return def; +} + +void +SimpleCfg::setRGB( const QString & group, const QString & key, + QRgb val ) +{ + QString tmp; + tmp.setNum( val ); + setString( group, key, tmp ); +} + +QRgb +SimpleCfg::getRGB( const QString & group, const QString & key, + QRgb def ) +{ + if (map.contains( group )) + { + SimpleCfgGroup *g = map[group]; + + return g->getRGB( key, def ); + } + else + { + SimpleCfgGroup *g = new SimpleCfgGroup( group ); + g->setRGB( key, def ); + + map.insert( group, g ); + } + + return def; +} + +void +SimpleCfg::setBool( const QString & group, const QString & key, + bool val ) +{ + setString( group, key, val ? "true" : "false" ); +} + +bool +SimpleCfg::getBool( const QString & group, const QString & key, + bool def ) +{ + if (map.contains( group )) + { + SimpleCfgGroup *g = map[group]; + + return g->getBool( key, def ); + } + else + { + SimpleCfgGroup *g = new SimpleCfgGroup( group ); + g->setBool( key, def ); + + map.insert( group, g ); + } + + return def; +} + +void +SimpleCfg::clear() +{ + QMap::Iterator it; + + for (it=map.begin(); it != map.end(); ++it) + { + delete it.data(); + } + + map.clear(); +} + +void +SimpleCfg::removeEmpty() +{ + QMap::Iterator git; + + QStringList list; + + for (git=map.begin(); git != map.end(); ++git) + { + QMap::Iterator kit; + + list.clear(); + + for (kit=git.data()->begin(); kit != git.data()->end(); ++kit) + { + if (kit.data().isEmpty()) + { + // value is empty -> shedule for removal + list.append( kit.key() ); + } + } + + // Now remove empty keys + for (QStringList::Iterator rit=list.begin(); rit != list.end(); ++rit ) + { + git.data()->remove( *rit ); + } + } +} + diff --git a/src/simplecfg.h b/src/simplecfg.h new file mode 100644 index 0000000..b716a09 --- /dev/null +++ b/src/simplecfg.h @@ -0,0 +1,413 @@ +//====================================================================== +// File: simplecfg.h +// Author: Matthias Toussaint +// Created: Mon Okt 30 22:01:05 CET 2000 +//---------------------------------------------------------------------- +// Permission to use, copy, modify, and distribute this software and its +// documentation for any purpose and without fee is hereby granted, +// provided that below copyright notice appear in all copies and that +// both that copyright notice and this permission notice appear in +// supporting documentation. +// +// This file is provided AS IS with no warranties of any kind. The +// author shall have no liability with respect to the infringement of +// copyrights, trade secrets or any patents by this file or any part +// thereof. In no event will the author be liable for any lost revenue +// or profits or other special, indirect and consequential damages. +//---------------------------------------------------------------------- +// (c) 2000 Matthias Toussaint +//====================================================================== + +#ifndef SIMPLECFG_HH +#define SIMPLECFG_HH + +#include +#include +#include +#include + +// I _REALLY_ like writing documentation. Here documentation +// efficiently hides the code ... +// +class SimpleCfg; + +/** Encapsulates a group (section) in the configuration file. + + Groups in the configuration file start with a group name embraced + with rectangular braces ([groupname]). The key/value pairs + following this group name belong to this group. + + Normally you should not use this class but instead SimpleCfg which + gives you full control over the configuration file. + + SimpleCfg is licensed under GPL + + \author Matthias Toussaint, © 2000 Matthias Toussaint +*/ +class SimpleCfgGroup +{ + friend class SimpleCfg; + +public: + /// Destructor + virtual ~SimpleCfgGroup(); + + /// Return group name + QString name() const { return groupName; } + /// Remove given key from group + void remove( const QString & key ); + /** Check if configuration contains key named key. + \param key Name of key to look for + \returns true if found + */ + bool contains( const QString & key ); + /** Set integer value. + If the key does not exist it is created + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setInt( const QString & key, int val ); + /** Retrieve integer value. + If the key does not exist it is created with the default + value. + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + int getInt( const QString & key, int def ); + /** Set double value. + If the key does not exist it is created + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setDouble( const QString & key, double val ); + /** Retrieve double value. + If the key does not exist it is created with the default + value. + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + double getDouble( const QString & key, double def ); + /** Set string value. + If the key does not exist it is created + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setString( const QString & key, const QString & val ); + /** Retrieve string value. + If the key does not exist it is created with the default + value. + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + QString getString( const QString & key, const QString & def ); + /** Set QRgb (unsigned long) value. + If the key does not exist it is created + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setRGB( const QString & key, QRgb val ); + /** Retrieve QRgb value (basically unsigned long). + If the key does not exist it is created with the default + value. + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + QRgb getRGB( const QString & key, QRgb def ); + /** Set bool value. + If the key does not exist it is created + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setBool( const QString & key, bool val ); + /** Retrieve bool value. + If the key does not exist it is created with the default + value. The bool values appear as "true"/"false" in the + configuration file. + \param key Key to be searched for + \param val Default value to be returned if key not found + \returns Value of key or default value + */ + bool getBool( const QString & key, bool def ); + /** Access iterator over keys. + If there are no keys this member returns SimpleCfgGroup::end(). + + If you want to iterate through the keys you'll need code like + the following: + \code + + QMap::Iterator it; + + for (it=group.begin(); it != group.end(); ++it) + { + // it.key() returns the key + // it.data() returns the value as string + } + + \endcode + */ + inline QMap::Iterator begin() { return map.begin(); } + /** Access end value for iterator. + \see SimpleCfgGroup::begin() + */ + inline QMap::Iterator end() { return map.end(); } + +protected: + /// Construct a group with name + SimpleCfgGroup( const QString & name ); + + /// Rename the group + void setName( const QString & name ); + /// Read from QTextStream + void read( QTextStream & ); + /// Write to QTextStream + void write( QTextStream & ); + + QMap map; + QString groupName; + +}; + +/** Encapsulation of an "Windows-ini-style" ASCII configuration file. You + know these + \code + [operating system] + windows=sux + unix=rocks + \endcode + configuration files. + + Usage is quite simple. Just create a SimpleCfg object and retrieve + the needed values in your code. All retrieval member need a default + value. This ensures that first usage of the configuration file + (Means file does not exist on harddisk) will create a file with + hopefully sane (you have to specify them :) default values. Next time + you'll find a complete configuration file on disk. + + You could use the above example as follows: + \code + SimpleCfg cfg( "filename" ); + cfg.load(); // The file is _not_ loaded in the constructor! + + cerr << "Windows " << cfg.getString( "operating system", "windows", "is good" ) + << endl; + cerr << "Unix " << cfg.getString( "operating system", "unix", "is old crap" ) + << endl; + + cfg.save(); // If file did not exist it is created now. + \endcode + If the file could be read you would see the following output: + \code + Windows sux + Unix rocks + \endcode + If the file could not be read: + \code + Windows is good + Unix is old crap + \endcode + So always ensure your configuration files can be read :) + \warning + You can not have two or more groups with the same name. Same applies + to keys within a group. + + SimpleCfg is licensed under GPL + + \author Matthias Toussaint, © 2000 Matthias Toussaint + */ +class SimpleCfg +{ +public: + /// Construct empty configuration with filename + SimpleCfg( const QString & ); + /// Destructor + virtual ~SimpleCfg(); + + /** Retrieve filename + \return filename + */ + QString filename() const { return fname; } + /** Rename file. + Does not load the new file. Next save and load will use this filename. + \param fn filename to be used from now on. + */ + void setFilename( const QString & fn ) { fname = fn; } + /** Load configuration file from disk. + \return true on success + */ + bool load(); + /** Store configuration file to disk. + \return true on success + */ + bool save(); + /// Clear configuration + void clear(); + /** Remove all empty keys. + Calling this member all keys that have an empty value are removed. + This configuration file will look a bit nicer if you call this + before saving. + \warning It might fuck up your configuration if + a value was empty by intention and the default value for reading + is not empty. If you don't know what you are doing + don't call this member! + */ + void removeEmpty(); + /** Remove key key from group group. + \param group Group to be used + \param key Key to be removed + */ + void remove( const QString & group, const QString & key ); + /** Remove group group. + \param group Group to be removed + */ + void remove( const QString & group ); + /** Check if configuration contains group named group. + \param group Name of group to look for + \returns true if found + */ + bool contains( const QString & group ); + /** Check if configuration contains key in group named group. + \param group Name of group to look for + \param key Name of key to look for + \returns true if found + */ + bool contains( const QString & group, const QString & key ); + /** Add empty group. + An empty group is added. This is needed for the load member. If + the group already exists this request is ignored. + \param group Group to be added + */ + void add( const QString & group ); + /** Set integer value. + If the key does not exist it is created + \param group Group to be used + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setInt( const QString &group, const QString & key, int val ); + /** Retrieve integer value. + If the key does not exist it is created with the default + value. + \param group Group to be used + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + int getInt( const QString &group, const QString & key, int def ); + /** Set double value. + If the key does not exist it is created + \param group Group to be used + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setDouble( const QString &group, const QString & key, double val ); + /** Retrieve double value. + If the key does not exist it is created with the default + value. + \param group Group to be used + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + double getDouble( const QString &group, const QString & key, double def ); + /** Set string value. + If the key does not exist it is created + \param group Group to be used + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setString( const QString &group, const QString & key, const QString & val ); + /** Retrieve string value. + If the key does not exist it is created with the default + value. + \param group Group to be used + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + QString getString( const QString &group, const QString & key, const QString & def ); + /** Set QRgb (unsigned long) value. + If the key does not exist it is created. + \param group Group to be used + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setRGB( const QString &group, const QString & key, QRgb val ); + /** Retrieve QRgb (unsigned long) value. + If the key does not exist it is created with the default + value. + \param group Group to be used + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + QRgb getRGB( const QString &group, const QString & key, QRgb def ); + /** Set bool value. + If the key does not exist it is created. + \param group Group to be used + \param key Key to be searched for + \param val Value to be assigned to key + */ + void setBool( const QString &group, const QString & key, bool val ); + /** Retrieve bool value. + If the key does not exist it is created with the default + value. + \param group Group to be used + \param key Key to be searched for + \param def Default value to be returned if key not found + \returns Value of key or default value + */ + bool getBool( const QString &group, const QString & key, bool def ); + + /** Access iterator over groups. + If there are no groups this member returns SimpleCfg::end(). + + If you want to iterate through the whole configuration you'll + need code like the following: + \code + + SimpleCfg cfg( "filename" ); + cfg.load(); + + QMap::Iterator group; + + for (group=cfg.begin(); group != cfg.end(); ++group) + { + // group.key() returns the group name as QString + // group.data() returns a pointer to the group + + cerr << "[" << group.key().latin1() << "]" << endl; + + QMap::Iterator key; + + for (key=group.data()->begin(); key != group.data()->end(); ++key) + { + // key.key() returns the key name + // key.data() returns the value as QString + + cerr << key.key().latin1() << " = " << key.data().latin1() << endl; + } + } + + \endcode + The above code will print the content of your configuration file (without + comments and alphabetically sorted) to stderr. + \see SimpleCfg::end() + */ + inline QMap::Iterator begin() { return map.begin(); } + /** Access end value for iterator. + \see SimpleCfg::begin() + */ + inline QMap::Iterator end() { return map.end(); } + +protected: + QMap map; + QString fname; + QString curGroup; + +}; + +#endif diff --git a/src/src.pro b/src/src.pro new file mode 100755 index 0000000..d1df3c8 --- /dev/null +++ b/src/src.pro @@ -0,0 +1,38 @@ +TEMPLATE = app +CONFIG = qt release warn_on thread +INCLUDEPATH = . moc +MOC_DIR = moc +OBJECTS_DIR = tmp +DEPENDPATH = . + +HEADERS = configdlg.h \ + dmm.h \ + dmmbar.h \ + dmmgraph.h \ + mainwid.h \ + simplecfg.h \ + printdlg.h \ + readerthread.h \ + readevent.h \ + uiconfigdlg.h \ + uimainwid.h \ + uiprintdlg.h + +SOURCES = main.cpp \ + configdlg.cpp \ + dmm.cpp \ + dmmbar.cpp \ + dmmgraph.cpp \ + mainwid.cpp \ + simplecfg.cpp \ + printdlg.cpp \ + readerthread.cpp \ + uiconfigdlg.cpp \ + uimainwid.cpp \ + uiprintdlg.cpp + +LIBS = +TARGET = qtdmm +VERSION = 0.1 +DESTDIR = ../bin + diff --git a/src/uiconfigdlg.cpp b/src/uiconfigdlg.cpp new file mode 100644 index 0000000..03b4f48 --- /dev/null +++ b/src/uiconfigdlg.cpp @@ -0,0 +1,655 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'uiconfigdlg.ui' +** +** Created: Sun Apr 15 20:03:05 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "uiconfigdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char* const image0_data[] = { +"22 22 4 1", +". c None", +"# c #000000", +"a c #000083", +"b c #4a484a", +"......................", +"......................", +"......................", +"...#........aaaaa.....", +"...##......aaabaaa....", +"...###....aaabb.aaa...", +"...####...aabb...aab..", +"...#####..aab....aab..", +"...######..ab...aaab..", +"...#######..b..aaabb..", +"...########...aaabb...", +"...#########.aaabb....", +"...#####bbbbbaaab.....", +"...##b###.....bbb.....", +"...#bb###b...aaa......", +"....b..###...aaab.....", +".......###b...bbb.....", +"........###...........", +"........###b..........", +".........bbb..........", +"......................", +"......................"}; + + +/* + * Constructs a UIConfigDlg which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +UIConfigDlg::UIConfigDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + QPixmap image0( ( const char** ) image0_data ); + if ( !name ) + setName( "UIConfigDlg" ); + resize( 339, 407 ); + setCaption( tr( "QtDMM: Configuration" ) ); + setSizeGripEnabled( TRUE ); + UIConfigDlgLayout = new QGridLayout( this ); + UIConfigDlgLayout->setSpacing( 5 ); + UIConfigDlgLayout->setMargin( 10 ); + + Layout15 = new QHBoxLayout; + Layout15->setSpacing( 5 ); + Layout15->setMargin( 0 ); + + helpBut = new QPushButton( this, "helpBut" ); + helpBut->setText( tr( "" ) ); + helpBut->setMinimumSize( QSize( 26, 26 ) ); + helpBut->setPixmap( image0 ); + helpBut->setAutoDefault( FALSE ); + QToolTip::add( helpBut, tr( "Direct help" ) ); + Layout15->addWidget( helpBut ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout15->addItem( spacer ); + + okBut = new QPushButton( this, "okBut" ); + okBut->setText( tr( "&OK" ) ); + okBut->setAutoDefault( TRUE ); + okBut->setDefault( TRUE ); + QWhatsThis::add( okBut, tr( "Apply changes and close dialog." ) ); + Layout15->addWidget( okBut ); + + cancelBut = new QPushButton( this, "cancelBut" ); + cancelBut->setText( tr( "&Cancel" ) ); + cancelBut->setAutoDefault( TRUE ); + QWhatsThis::add( cancelBut, tr( "Discard changes and close dialog." ) ); + Layout15->addWidget( cancelBut ); + + UIConfigDlgLayout->addLayout( Layout15, 1, 0 ); + + tabWidget = new QTabWidget( this, "tabWidget" ); + + samplePage = new QWidget( tabWidget, "samplePage" ); + samplePageLayout = new QVBoxLayout( samplePage ); + samplePageLayout->setSpacing( 5 ); + samplePageLayout->setMargin( 10 ); + + ButtonGroup1 = new QButtonGroup( samplePage, "ButtonGroup1" ); + ButtonGroup1->setTitle( tr( "Sample" ) ); + ButtonGroup1->setExclusive( FALSE ); + ButtonGroup1->setColumnLayout(0, Qt::Vertical ); + ButtonGroup1->layout()->setSpacing( 0 ); + ButtonGroup1->layout()->setMargin( 0 ); + ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() ); + ButtonGroup1Layout->setAlignment( Qt::AlignTop ); + ButtonGroup1Layout->setSpacing( 5 ); + ButtonGroup1Layout->setMargin( 10 ); + + sampLabel = new QLabel( ButtonGroup1, "sampLabel" ); + sampLabel->setText( tr( "Sample every:" ) ); + + ButtonGroup1Layout->addWidget( sampLabel, 0, 0 ); + + sampleEvery = new QLineEdit( ButtonGroup1, "sampleEvery" ); + sampleEvery->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sampleEvery->sizePolicy().hasHeightForWidth() ) ); + sampleEvery->setMaximumSize( QSize( 60, 32767 ) ); + sampleEvery->setText( tr( "1" ) ); + sampleEvery->setMaxLength( 10 ); + QWhatsThis::add( sampleEvery, tr( "Enter a integer value for the sampling period. Choose the unit to the right." ) ); + + ButtonGroup1Layout->addWidget( sampleEvery, 0, 1 ); + + sampleUnit = new QComboBox( FALSE, ButtonGroup1, "sampleUnit" ); + sampleUnit->insertItem( tr( "Seconds" ) ); + sampleUnit->insertItem( tr( "Minutes" ) ); + sampleUnit->insertItem( tr( "Hours" ) ); + sampleUnit->insertItem( tr( "Days" ) ); + + ButtonGroup1Layout->addWidget( sampleUnit, 0, 2 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + ButtonGroup1Layout->addItem( spacer_2, 0, 3 ); + + sampLabel_2 = new QLabel( ButtonGroup1, "sampLabel_2" ); + sampLabel_2->setText( tr( "Sample time:" ) ); + + ButtonGroup1Layout->addWidget( sampLabel_2, 1, 0 ); + + sampleTime = new QLineEdit( ButtonGroup1, "sampleTime" ); + sampleTime->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sampleTime->sizePolicy().hasHeightForWidth() ) ); + sampleTime->setMaximumSize( QSize( 60, 32767 ) ); + sampleTime->setText( tr( "500" ) ); + sampleTime->setMaxLength( 10 ); + QWhatsThis::add( sampleTime, tr( "Enter a integer value for the sampling interval. Choose the unit to the right." ) ); + + ButtonGroup1Layout->addWidget( sampleTime, 1, 1 ); + + timeUnit = new QComboBox( FALSE, ButtonGroup1, "timeUnit" ); + timeUnit->insertItem( tr( "Seconds" ) ); + timeUnit->insertItem( tr( "Minutes" ) ); + timeUnit->insertItem( tr( "Hours" ) ); + timeUnit->insertItem( tr( "Days" ) ); + + ButtonGroup1Layout->addWidget( timeUnit, 1, 2 ); + samplePageLayout->addWidget( ButtonGroup1 ); + + GroupBox1 = new QGroupBox( samplePage, "GroupBox1" ); + GroupBox1->setTitle( tr( "Start" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 0 ); + GroupBox1->layout()->setMargin( 0 ); + GroupBox1Layout = new QVBoxLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + GroupBox1Layout->setSpacing( 5 ); + GroupBox1Layout->setMargin( 10 ); + + ButtonGroup32 = new QButtonGroup( GroupBox1, "ButtonGroup32" ); + ButtonGroup32->setTitle( tr( "" ) ); + ButtonGroup32->setFrameShape( QButtonGroup::NoFrame ); + ButtonGroup32->setExclusive( FALSE ); + ButtonGroup32->setColumnLayout(0, Qt::Vertical ); + ButtonGroup32->layout()->setSpacing( 0 ); + ButtonGroup32->layout()->setMargin( 0 ); + ButtonGroup32Layout = new QVBoxLayout( ButtonGroup32->layout() ); + ButtonGroup32Layout->setAlignment( Qt::AlignTop ); + ButtonGroup32Layout->setSpacing( 5 ); + ButtonGroup32Layout->setMargin( 0 ); + + Layout23 = new QHBoxLayout; + Layout23->setSpacing( 5 ); + Layout23->setMargin( 0 ); + + manualBut = new QRadioButton( ButtonGroup32, "manualBut" ); + manualBut->setText( tr( "Manual" ) ); + manualBut->setChecked( TRUE ); + QWhatsThis::add( manualBut, tr( "Select this entry if you want to manually start the transient recorder. Use the Start and Stop buttons in the main window to start/stop sampling." ) ); + Layout23->addWidget( manualBut ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout23->addItem( spacer_3 ); + ButtonGroup32Layout->addLayout( Layout23 ); + + Layout24 = new QHBoxLayout; + Layout24->setSpacing( 5 ); + Layout24->setMargin( 0 ); + + predefinedBut = new QRadioButton( ButtonGroup32, "predefinedBut" ); + predefinedBut->setText( tr( "Predefined time" ) ); + QWhatsThis::add( predefinedBut, tr( "Select this entry if you want the transient recorder to be started at a predefined time." ) ); + Layout24->addWidget( predefinedBut ); + QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout24->addItem( spacer_4 ); + ButtonGroup32Layout->addLayout( Layout24 ); + + Layout8 = new QHBoxLayout; + Layout8->setSpacing( 5 ); + Layout8->setMargin( 0 ); + + Layout7 = new QHBoxLayout; + Layout7->setSpacing( 6 ); + Layout7->setMargin( 0 ); + + TextLabel5 = new QLabel( ButtonGroup32, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setMinimumSize( QSize( 20, 0 ) ); + Layout7->addWidget( TextLabel5 ); + + Layout6 = new QHBoxLayout; + Layout6->setSpacing( 6 ); + Layout6->setMargin( 0 ); + + hour = new QSpinBox( ButtonGroup32, "hour" ); + hour->setEnabled( FALSE ); + hour->setMaxValue( 23 ); + hour->setWrapping( TRUE ); + QWhatsThis::add( hour, tr( "Hour of start time." ) ); + Layout6->addWidget( hour ); + + TextLabel3 = new QLabel( ButtonGroup32, "TextLabel3" ); + TextLabel3->setEnabled( FALSE ); + QFont TextLabel3_font( TextLabel3->font() ); + TextLabel3_font.setBold( TRUE ); + TextLabel3->setFont( TextLabel3_font ); + TextLabel3->setText( tr( ":" ) ); + TextLabel3->setAlignment( int( QLabel::AlignCenter ) ); + Layout6->addWidget( TextLabel3 ); + + minute = new QSpinBox( ButtonGroup32, "minute" ); + minute->setEnabled( FALSE ); + minute->setMaxValue( 59 ); + minute->setWrapping( TRUE ); + QWhatsThis::add( minute, tr( "Minutes of start time." ) ); + Layout6->addWidget( minute ); + + TextLabel4 = new QLabel( ButtonGroup32, "TextLabel4" ); + TextLabel4->setEnabled( FALSE ); + QFont TextLabel4_font( TextLabel4->font() ); + TextLabel4_font.setBold( TRUE ); + TextLabel4->setFont( TextLabel4_font ); + TextLabel4->setText( tr( ":" ) ); + TextLabel4->setAlignment( int( QLabel::AlignCenter ) ); + Layout6->addWidget( TextLabel4 ); + + second = new QSpinBox( ButtonGroup32, "second" ); + second->setEnabled( FALSE ); + second->setMaxValue( 59 ); + second->setWrapping( TRUE ); + QWhatsThis::add( second, tr( "Seconds of start time." ) ); + Layout6->addWidget( second ); + Layout7->addLayout( Layout6 ); + Layout8->addLayout( Layout7 ); + QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout8->addItem( spacer_5 ); + ButtonGroup32Layout->addLayout( Layout8 ); + + Layout25 = new QHBoxLayout; + Layout25->setSpacing( 5 ); + Layout25->setMargin( 0 ); + + triggerBut = new QRadioButton( ButtonGroup32, "triggerBut" ); + triggerBut->setText( tr( "Trigger" ) ); + QWhatsThis::add( triggerBut, tr( "Select this entry if you want to automatically trigger the sampling.

\nYou have two choices:\n

    \n
  • Raising edge: Sampling is started when the measured value gets bigger than the given threshold.
  • \n
  • Falling edge: Sampling is started when the measured value gets lower than the given threshold.
  • \n
" ) ); + Layout25->addWidget( triggerBut ); + QSpacerItem* spacer_6 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout25->addItem( spacer_6 ); + ButtonGroup32Layout->addLayout( Layout25 ); + GroupBox1Layout->addWidget( ButtonGroup32 ); + + ButtonGroup13 = new QButtonGroup( GroupBox1, "ButtonGroup13" ); + ButtonGroup13->setTitle( tr( "" ) ); + ButtonGroup13->setFrameShape( QButtonGroup::NoFrame ); + ButtonGroup13->setExclusive( FALSE ); + ButtonGroup13->setColumnLayout(0, Qt::Vertical ); + ButtonGroup13->layout()->setSpacing( 0 ); + ButtonGroup13->layout()->setMargin( 0 ); + ButtonGroup13Layout = new QVBoxLayout( ButtonGroup13->layout() ); + ButtonGroup13Layout->setAlignment( Qt::AlignTop ); + ButtonGroup13Layout->setSpacing( 0 ); + ButtonGroup13Layout->setMargin( 0 ); + + Layout14 = new QGridLayout; + Layout14->setSpacing( 5 ); + Layout14->setMargin( 0 ); + QSpacerItem* spacer_7 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout14->addItem( spacer_7, 0, 3 ); + + fallingThresholdEdit = new QLineEdit( ButtonGroup13, "fallingThresholdEdit" ); + fallingThresholdEdit->setEnabled( FALSE ); + fallingThresholdEdit->setMaximumSize( QSize( 80, 32767 ) ); + fallingThresholdEdit->setText( tr( "0.0" ) ); + QWhatsThis::add( fallingThresholdEdit, tr( "Threshold for falling edge." ) ); + + Layout14->addWidget( fallingThresholdEdit, 1, 2 ); + QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout14->addItem( spacer_8, 1, 3 ); + + raisingThresholdEdit = new QLineEdit( ButtonGroup13, "raisingThresholdEdit" ); + raisingThresholdEdit->setEnabled( FALSE ); + raisingThresholdEdit->setMaximumSize( QSize( 80, 32767 ) ); + raisingThresholdEdit->setText( tr( "0.0" ) ); + QWhatsThis::add( raisingThresholdEdit, tr( "Threshold for raising edge." ) ); + + Layout14->addWidget( raisingThresholdEdit, 0, 2 ); + + TextLabel7 = new QLabel( ButtonGroup13, "TextLabel7" ); + TextLabel7->setEnabled( FALSE ); + TextLabel7->setText( tr( "Threshold:" ) ); + + Layout14->addWidget( TextLabel7, 0, 1 ); + + TextLabel8 = new QLabel( ButtonGroup13, "TextLabel8" ); + TextLabel8->setEnabled( FALSE ); + TextLabel8->setText( tr( "Threshold:" ) ); + + Layout14->addWidget( TextLabel8, 1, 1 ); + + Layout9 = new QHBoxLayout; + Layout9->setSpacing( 5 ); + Layout9->setMargin( 0 ); + + TextLabel6 = new QLabel( ButtonGroup13, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setMinimumSize( QSize( 20, 0 ) ); + Layout9->addWidget( TextLabel6 ); + + raisingBut = new QRadioButton( ButtonGroup13, "raisingBut" ); + raisingBut->setText( tr( "Raising edge" ) ); + raisingBut->setEnabled( FALSE ); + raisingBut->setChecked( TRUE ); + QWhatsThis::add( raisingBut, tr( "Trigger sampling on raising edge." ) ); + Layout9->addWidget( raisingBut ); + + Layout14->addLayout( Layout9, 0, 0 ); + + Layout10 = new QHBoxLayout; + Layout10->setSpacing( 5 ); + Layout10->setMargin( 0 ); + + TextLabel6_2 = new QLabel( ButtonGroup13, "TextLabel6_2" ); + TextLabel6_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, TextLabel6_2->sizePolicy().hasHeightForWidth() ) ); + TextLabel6_2->setMinimumSize( QSize( 20, 0 ) ); + Layout10->addWidget( TextLabel6_2 ); + + fallingBut = new QRadioButton( ButtonGroup13, "fallingBut" ); + fallingBut->setText( tr( "Falling edge" ) ); + fallingBut->setEnabled( FALSE ); + QWhatsThis::add( fallingBut, tr( "Trigger sampling on falling edge." ) ); + Layout10->addWidget( fallingBut ); + + Layout14->addLayout( Layout10, 1, 0 ); + ButtonGroup13Layout->addLayout( Layout14 ); + GroupBox1Layout->addWidget( ButtonGroup13 ); + samplePageLayout->addWidget( GroupBox1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + samplePageLayout->addItem( spacer_9 ); + tabWidget->insertTab( samplePage, tr( "Recorder" ) ); + + scalePage = new QWidget( tabWidget, "scalePage" ); + scalePageLayout = new QVBoxLayout( scalePage ); + scalePageLayout->setSpacing( 5 ); + scalePageLayout->setMargin( 10 ); + + ButtonGroup36 = new QButtonGroup( scalePage, "ButtonGroup36" ); + ButtonGroup36->setTitle( tr( "Scale" ) ); + ButtonGroup36->setColumnLayout(0, Qt::Vertical ); + ButtonGroup36->layout()->setSpacing( 0 ); + ButtonGroup36->layout()->setMargin( 0 ); + ButtonGroup36Layout = new QVBoxLayout( ButtonGroup36->layout() ); + ButtonGroup36Layout->setAlignment( Qt::AlignTop ); + ButtonGroup36Layout->setSpacing( 5 ); + ButtonGroup36Layout->setMargin( 10 ); + + autoScaleBut = new QRadioButton( ButtonGroup36, "autoScaleBut" ); + autoScaleBut->setText( tr( "Automatic" ) ); + autoScaleBut->setChecked( TRUE ); + QWhatsThis::add( autoScaleBut, tr( "Select this entry if you want automatic scaling of the vertical scale in the transient recorder." ) ); + ButtonGroup36Layout->addWidget( autoScaleBut ); + + manualScaleBut = new QRadioButton( ButtonGroup36, "manualScaleBut" ); + manualScaleBut->setText( tr( "Manual" ) ); + QWhatsThis::add( manualScaleBut, tr( "Select this entry if you want to set the minimum and maximum value for the scale manually. If selected enter the minimum and maximum values below." ) ); + ButtonGroup36Layout->addWidget( manualScaleBut ); + + Layout15_2 = new QHBoxLayout; + Layout15_2->setSpacing( 5 ); + Layout15_2->setMargin( 0 ); + + TextLabel9 = new QLabel( ButtonGroup36, "TextLabel9" ); + TextLabel9->setMinimumSize( QSize( 20, 0 ) ); + Layout15_2->addWidget( TextLabel9 ); + + TextLabel10 = new QLabel( ButtonGroup36, "TextLabel10" ); + TextLabel10->setEnabled( FALSE ); + TextLabel10->setText( tr( "Minimum:" ) ); + Layout15_2->addWidget( TextLabel10 ); + + scaleMinEd = new QLineEdit( ButtonGroup36, "scaleMinEd" ); + scaleMinEd->setEnabled( FALSE ); + scaleMinEd->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, scaleMinEd->sizePolicy().hasHeightForWidth() ) ); + scaleMinEd->setMinimumSize( QSize( 60, 0 ) ); + scaleMinEd->setMaximumSize( QSize( 60, 32767 ) ); + scaleMinEd->setMaxLength( 9 ); + scaleMinEd->setText( tr( "-3.999" ) ); + QWhatsThis::add( scaleMinEd, tr( "Enter the minimum scale value here." ) ); + Layout15_2->addWidget( scaleMinEd ); + + TextLabel10_2 = new QLabel( ButtonGroup36, "TextLabel10_2" ); + TextLabel10_2->setEnabled( FALSE ); + TextLabel10_2->setText( tr( "Maximum:" ) ); + Layout15_2->addWidget( TextLabel10_2 ); + + scaleMaxEd = new QLineEdit( ButtonGroup36, "scaleMaxEd" ); + scaleMaxEd->setEnabled( FALSE ); + scaleMaxEd->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, scaleMaxEd->sizePolicy().hasHeightForWidth() ) ); + scaleMaxEd->setMinimumSize( QSize( 60, 0 ) ); + scaleMaxEd->setMaximumSize( QSize( 60, 32767 ) ); + scaleMaxEd->setMaxLength( 9 ); + scaleMaxEd->setText( tr( "3.999" ) ); + QWhatsThis::add( scaleMaxEd, tr( "Enter the maximum scale value here." ) ); + Layout15_2->addWidget( scaleMaxEd ); + QSpacerItem* spacer_10 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout15_2->addItem( spacer_10 ); + ButtonGroup36Layout->addLayout( Layout15_2 ); + scalePageLayout->addWidget( ButtonGroup36 ); + + ButtonGroup37 = new QButtonGroup( scalePage, "ButtonGroup37" ); + ButtonGroup37->setTitle( tr( "Window" ) ); + ButtonGroup37->setColumnLayout(0, Qt::Vertical ); + ButtonGroup37->layout()->setSpacing( 0 ); + ButtonGroup37->layout()->setMargin( 0 ); + ButtonGroup37Layout = new QGridLayout( ButtonGroup37->layout() ); + ButtonGroup37Layout->setAlignment( Qt::AlignTop ); + ButtonGroup37Layout->setSpacing( 5 ); + ButtonGroup37Layout->setMargin( 10 ); + + TextLabel11 = new QLabel( ButtonGroup37, "TextLabel11" ); + TextLabel11->setText( tr( "Size:" ) ); + + ButtonGroup37Layout->addWidget( TextLabel11, 0, 0 ); + + TextLabel12 = new QLabel( ButtonGroup37, "TextLabel12" ); + TextLabel12->setText( tr( "Max. length:" ) ); + + ButtonGroup37Layout->addWidget( TextLabel12, 1, 0 ); + QSpacerItem* spacer_11 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + ButtonGroup37Layout->addItem( spacer_11, 0, 3 ); + + sizeUnit = new QComboBox( FALSE, ButtonGroup37, "sizeUnit" ); + sizeUnit->insertItem( tr( "Seconds" ) ); + sizeUnit->insertItem( tr( "Minutes" ) ); + sizeUnit->insertItem( tr( "Hours" ) ); + sizeUnit->insertItem( tr( "Days" ) ); + + ButtonGroup37Layout->addWidget( sizeUnit, 0, 2 ); + + winSize = new QLineEdit( ButtonGroup37, "winSize" ); + winSize->setMinimumSize( QSize( 60, 0 ) ); + winSize->setMaximumSize( QSize( 60, 32767 ) ); + winSize->setText( tr( "600" ) ); + winSize->setMaxLength( 10 ); + QWhatsThis::add( winSize, tr( "Enter the size (length in time) of the visual part of the transient recorder here. Choose the unit to the right." ) ); + + ButtonGroup37Layout->addWidget( winSize, 0, 1 ); + + winLength = new QLineEdit( ButtonGroup37, "winLength" ); + winLength->setMinimumSize( QSize( 60, 0 ) ); + winLength->setMaximumSize( QSize( 60, 32767 ) ); + winLength->setText( tr( "3600" ) ); + winLength->setMaxLength( 10 ); + QWhatsThis::add( winLength, tr( "Maximum time for sampling. If this value is reached sampling is not stopped but the first values are discarded." ) ); + + ButtonGroup37Layout->addWidget( winLength, 1, 1 ); + + lengthUnit = new QComboBox( FALSE, ButtonGroup37, "lengthUnit" ); + lengthUnit->insertItem( tr( "Seconds" ) ); + lengthUnit->insertItem( tr( "Minutes" ) ); + lengthUnit->insertItem( tr( "Hours" ) ); + lengthUnit->insertItem( tr( "Days" ) ); + + ButtonGroup37Layout->addWidget( lengthUnit, 1, 2 ); + scalePageLayout->addWidget( ButtonGroup37 ); + QSpacerItem* spacer_12 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + scalePageLayout->addItem( spacer_12 ); + tabWidget->insertTab( scalePage, tr( "Scale" ) ); + + dmmPage = new QWidget( tabWidget, "dmmPage" ); + dmmPageLayout = new QVBoxLayout( dmmPage ); + dmmPageLayout->setSpacing( 5 ); + dmmPageLayout->setMargin( 10 ); + + ButtonGroup11 = new QButtonGroup( dmmPage, "ButtonGroup11" ); + ButtonGroup11->setTitle( tr( "Port settings" ) ); + ButtonGroup11->setColumnLayout(0, Qt::Vertical ); + ButtonGroup11->layout()->setSpacing( 0 ); + ButtonGroup11->layout()->setMargin( 0 ); + ButtonGroup11Layout = new QGridLayout( ButtonGroup11->layout() ); + ButtonGroup11Layout->setAlignment( Qt::AlignTop ); + ButtonGroup11Layout->setSpacing( 5 ); + ButtonGroup11Layout->setMargin( 10 ); + + TextLabel1 = new QLabel( ButtonGroup11, "TextLabel1" ); + TextLabel1->setText( tr( "Baud rate:" ) ); + + ButtonGroup11Layout->addWidget( TextLabel1, 0, 0 ); + + baudRate = new QComboBox( FALSE, ButtonGroup11, "baudRate" ); + baudRate->insertItem( tr( "600 baud" ) ); + baudRate->insertItem( tr( "1200 baud" ) ); + baudRate->insertItem( tr( "1800 baud" ) ); + baudRate->insertItem( tr( "2400 baud" ) ); + baudRate->insertItem( tr( "4800 baud" ) ); + baudRate->insertItem( tr( "9600 baud" ) ); + baudRate->setCurrentItem( 0 ); + QWhatsThis::add( baudRate, tr( "Select the baud rate for the DMM here. If you encounter problems connecting to your DMM try lowering the baud rate. I had some problems with my Metex ME-32. The Documentation said 1200 baud but it only worked at 600." ) ); + + ButtonGroup11Layout->addWidget( baudRate, 0, 1 ); + + port = new QComboBox( FALSE, ButtonGroup11, "port" ); + port->insertItem( tr( "/dev/ttyS0" ) ); + port->insertItem( tr( "/dev/ttyS1" ) ); + port->insertItem( tr( "/dev/ttyS2" ) ); + port->insertItem( tr( "/dev/ttyS3" ) ); + port->setCurrentItem( 0 ); + QWhatsThis::add( port, tr( "Choose the serial device here. (Hint for DOS people: /dev/ttyS0 corresponds to COM1. /dev/ttyS1 to COM2 ...)" ) ); + + ButtonGroup11Layout->addWidget( port, 1, 1 ); + QSpacerItem* spacer_13 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + ButtonGroup11Layout->addItem( spacer_13, 0, 2 ); + QSpacerItem* spacer_14 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + ButtonGroup11Layout->addItem( spacer_14, 1, 2 ); + + TextLabel2 = new QLabel( ButtonGroup11, "TextLabel2" ); + TextLabel2->setText( tr( "Port:" ) ); + + ButtonGroup11Layout->addWidget( TextLabel2, 1, 0 ); + dmmPageLayout->addWidget( ButtonGroup11 ); + QSpacerItem* spacer_15 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + dmmPageLayout->addItem( spacer_15 ); + tabWidget->insertTab( dmmPage, tr( "DMM" ) ); + + copyTab = new QWidget( tabWidget, "copyTab" ); + copyTabLayout = new QGridLayout( copyTab ); + copyTabLayout->setSpacing( 5 ); + copyTabLayout->setMargin( 10 ); + + TextView1 = new QTextView( copyTab, "TextView1" ); + TextView1->setText( tr( "

QtDMM

\nA simple display software for Metex and compatible hand held digital multimeter including min/max memory and a configurable transient recorder with export and printing function.

\n© 2001 Matthias Toussaint
<qtdmm@mtoussaint.de>

\nQtDMM uses the platform independent toolkit Qt from Trolltech AS Norway <www.trolltech.com> and is licensed under GPL." ) ); + QWhatsThis::add( TextView1, tr( "Just some blurb." ) ); + + copyTabLayout->addWidget( TextView1, 0, 0 ); + tabWidget->insertTab( copyTab, tr( "Copyright" ) ); + + UIConfigDlgLayout->addWidget( tabWidget, 0, 0 ); + + // signals and slots connections + connect( okBut, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( cancelBut, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( predefinedBut, SIGNAL( toggled(bool) ), hour, SLOT( setEnabled(bool) ) ); + connect( predefinedBut, SIGNAL( toggled(bool) ), TextLabel3, SLOT( setEnabled(bool) ) ); + connect( predefinedBut, SIGNAL( toggled(bool) ), minute, SLOT( setEnabled(bool) ) ); + connect( predefinedBut, SIGNAL( toggled(bool) ), TextLabel4, SLOT( setEnabled(bool) ) ); + connect( predefinedBut, SIGNAL( toggled(bool) ), second, SLOT( setEnabled(bool) ) ); + connect( triggerBut, SIGNAL( toggled(bool) ), raisingBut, SLOT( setEnabled(bool) ) ); + connect( triggerBut, SIGNAL( toggled(bool) ), fallingBut, SLOT( setEnabled(bool) ) ); + connect( triggerBut, SIGNAL( toggled(bool) ), TextLabel7, SLOT( setEnabled(bool) ) ); + connect( triggerBut, SIGNAL( toggled(bool) ), TextLabel8, SLOT( setEnabled(bool) ) ); + connect( triggerBut, SIGNAL( toggled(bool) ), raisingThresholdEdit, SLOT( setEnabled(bool) ) ); + connect( triggerBut, SIGNAL( toggled(bool) ), fallingThresholdEdit, SLOT( setEnabled(bool) ) ); + connect( manualScaleBut, SIGNAL( toggled(bool) ), scaleMinEd, SLOT( setEnabled(bool) ) ); + connect( manualScaleBut, SIGNAL( toggled(bool) ), TextLabel10, SLOT( setEnabled(bool) ) ); + connect( manualScaleBut, SIGNAL( toggled(bool) ), TextLabel10_2, SLOT( setEnabled(bool) ) ); + connect( manualScaleBut, SIGNAL( toggled(bool) ), scaleMaxEd, SLOT( setEnabled(bool) ) ); + + // tab order + setTabOrder( sampleEvery, sampleUnit ); + setTabOrder( sampleUnit, sampleTime ); + setTabOrder( sampleTime, timeUnit ); + setTabOrder( timeUnit, manualBut ); + setTabOrder( manualBut, predefinedBut ); + setTabOrder( predefinedBut, hour ); + setTabOrder( hour, minute ); + setTabOrder( minute, second ); + setTabOrder( second, triggerBut ); + setTabOrder( triggerBut, raisingBut ); + setTabOrder( raisingBut, raisingThresholdEdit ); + setTabOrder( raisingThresholdEdit, fallingBut ); + setTabOrder( fallingBut, fallingThresholdEdit ); + setTabOrder( fallingThresholdEdit, autoScaleBut ); + setTabOrder( autoScaleBut, manualScaleBut ); + setTabOrder( manualScaleBut, scaleMinEd ); + setTabOrder( scaleMinEd, scaleMaxEd ); + setTabOrder( scaleMaxEd, winSize ); + setTabOrder( winSize, sizeUnit ); + setTabOrder( sizeUnit, winLength ); + setTabOrder( winLength, lengthUnit ); + setTabOrder( lengthUnit, baudRate ); + setTabOrder( baudRate, port ); + setTabOrder( port, helpBut ); + setTabOrder( helpBut, okBut ); + setTabOrder( okBut, cancelBut ); + setTabOrder( cancelBut, tabWidget ); + setTabOrder( tabWidget, TextView1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +UIConfigDlg::~UIConfigDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Main event handler. Reimplemented to handle application + * font changes + */ +bool UIConfigDlg::event( QEvent* ev ) +{ + bool ret = QDialog::event( ev ); + if ( ev->type() == QEvent::ApplicationFontChange ) { + QFont TextLabel3_font( TextLabel3->font() ); + TextLabel3_font.setBold( TRUE ); + TextLabel3->setFont( TextLabel3_font ); + QFont TextLabel4_font( TextLabel4->font() ); + TextLabel4_font.setBold( TRUE ); + TextLabel4->setFont( TextLabel4_font ); + } + return ret; +} + diff --git a/src/uiconfigdlg.h b/src/uiconfigdlg.h new file mode 100644 index 0000000..1e6680c --- /dev/null +++ b/src/uiconfigdlg.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'uiconfigdlg.ui' +** +** Created: Sun Apr 15 20:02:38 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef UICONFIGDLG_H +#define UICONFIGDLG_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; +class QTabWidget; +class QTextView; +class QWidget; + +class UIConfigDlg : public QDialog +{ + Q_OBJECT + +public: + UIConfigDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~UIConfigDlg(); + + QPushButton* helpBut; + QPushButton* okBut; + QPushButton* cancelBut; + QTabWidget* tabWidget; + QWidget* samplePage; + QButtonGroup* ButtonGroup1; + QLabel* sampLabel; + QLineEdit* sampleEvery; + QComboBox* sampleUnit; + QLabel* sampLabel_2; + QLineEdit* sampleTime; + QComboBox* timeUnit; + QGroupBox* GroupBox1; + QButtonGroup* ButtonGroup32; + QRadioButton* manualBut; + QRadioButton* predefinedBut; + QLabel* TextLabel5; + QSpinBox* hour; + QLabel* TextLabel3; + QSpinBox* minute; + QLabel* TextLabel4; + QSpinBox* second; + QRadioButton* triggerBut; + QButtonGroup* ButtonGroup13; + QLineEdit* fallingThresholdEdit; + QLineEdit* raisingThresholdEdit; + QLabel* TextLabel7; + QLabel* TextLabel8; + QLabel* TextLabel6; + QRadioButton* raisingBut; + QLabel* TextLabel6_2; + QRadioButton* fallingBut; + QWidget* scalePage; + QButtonGroup* ButtonGroup36; + QRadioButton* autoScaleBut; + QRadioButton* manualScaleBut; + QLabel* TextLabel9; + QLabel* TextLabel10; + QLineEdit* scaleMinEd; + QLabel* TextLabel10_2; + QLineEdit* scaleMaxEd; + QButtonGroup* ButtonGroup37; + QLabel* TextLabel11; + QLabel* TextLabel12; + QComboBox* sizeUnit; + QLineEdit* winSize; + QLineEdit* winLength; + QComboBox* lengthUnit; + QWidget* dmmPage; + QButtonGroup* ButtonGroup11; + QLabel* TextLabel1; + QComboBox* baudRate; + QComboBox* port; + QLabel* TextLabel2; + QWidget* copyTab; + QTextView* TextView1; + +protected: + QGridLayout* UIConfigDlgLayout; + QHBoxLayout* Layout15; + QVBoxLayout* samplePageLayout; + QGridLayout* ButtonGroup1Layout; + QVBoxLayout* GroupBox1Layout; + QVBoxLayout* ButtonGroup32Layout; + QHBoxLayout* Layout23; + QHBoxLayout* Layout24; + QHBoxLayout* Layout8; + QHBoxLayout* Layout7; + QHBoxLayout* Layout6; + QHBoxLayout* Layout25; + QVBoxLayout* ButtonGroup13Layout; + QGridLayout* Layout14; + QHBoxLayout* Layout9; + QHBoxLayout* Layout10; + QVBoxLayout* scalePageLayout; + QVBoxLayout* ButtonGroup36Layout; + QHBoxLayout* Layout15_2; + QGridLayout* ButtonGroup37Layout; + QVBoxLayout* dmmPageLayout; + QGridLayout* ButtonGroup11Layout; + QGridLayout* copyTabLayout; + bool event( QEvent* ); +}; + +#endif // UICONFIGDLG_H diff --git a/src/uiconfigdlg.ui b/src/uiconfigdlg.ui new file mode 100644 index 0000000..db9c118 --- /dev/null +++ b/src/uiconfigdlg.ui @@ -0,0 +1,2054 @@ + +UIConfigDlg +Matthias Toussaint + + QDialog + + name + UIConfigDlg + + + geometry + + 0 + 0 + 339 + 407 + + + + caption + QtDMM: Configuration + + + sizeGripEnabled + true + + + layoutMargin + + + layoutSpacing + + + + margin + 10 + + + spacing + 5 + + + QLayoutWidget + + name + Layout15 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QPushButton + + name + helpBut + + + text + + + + minimumSize + + 26 + 26 + + + + pixmap + image0 + + + autoDefault + false + + + toolTip + Direct help + + + + + name + Horizontal Spacing2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + okBut + + + text + &OK + + + autoDefault + true + + + default + true + + + whatsThis + Apply changes and close dialog. + + + + QPushButton + + name + cancelBut + + + text + &Cancel + + + autoDefault + true + + + whatsThis + Discard changes and close dialog. + + + + + + QTabWidget + + name + tabWidget + + + layoutMargin + + + layoutSpacing + + + QWidget + + name + samplePage + + + title + Recorder + + + + margin + 10 + + + spacing + 5 + + + QButtonGroup + + name + ButtonGroup1 + + + title + Sample + + + exclusive + false + + + layoutMargin + + + layoutSpacing + + + + margin + 10 + + + spacing + 5 + + + QLabel + + name + sampLabel + + + text + Sample every: + + + + QLineEdit + + name + sampleEvery + + + sizePolicy + + 0 + 0 + + + + maximumSize + + 60 + 32767 + + + + text + 1 + + + maxLength + 10 + + + whatsThis + Enter a integer value for the sampling period. Choose the unit to the right. + + + + QComboBox + + + text + Seconds + + + + + text + Minutes + + + + + text + Hours + + + + + text + Days + + + + name + sampleUnit + + + + + name + Spacer9 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + sampLabel_2 + + + text + Sample time: + + + + QLineEdit + + name + sampleTime + + + sizePolicy + + 0 + 0 + + + + maximumSize + + 60 + 32767 + + + + text + 500 + + + maxLength + 10 + + + whatsThis + Enter a integer value for the sampling interval. Choose the unit to the right. + + + + QComboBox + + + text + Seconds + + + + + text + Minutes + + + + + text + Hours + + + + + text + Days + + + + name + timeUnit + + + + + + QGroupBox + + name + GroupBox1 + + + title + Start + + + layoutMargin + + + layoutSpacing + + + + margin + 10 + + + spacing + 5 + + + QButtonGroup + + name + ButtonGroup32 + + + title + + + + frameShape + NoFrame + + + exclusive + false + + + layoutMargin + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QLayoutWidget + + name + Layout23 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QRadioButton + + name + manualBut + + + text + Manual + + + checked + true + + + whatsThis + Select this entry if you want to manually start the transient recorder. Use the <b>Start</b> and <b>Stop</b> buttons in the main window to start/stop sampling. + + + + + name + Spacer7_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QLayoutWidget + + name + Layout24 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QRadioButton + + name + predefinedBut + + + text + Predefined time + + + whatsThis + Select this entry if you want the transient recorder to be started at a predefined time. + + + + + name + Spacer8_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QLayoutWidget + + name + Layout8 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QLayoutWidget + + name + Layout7 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel5 + + + sizePolicy + + 0 + 1 + + + + minimumSize + + 20 + 0 + + + + + QLayoutWidget + + name + Layout6 + + + + margin + 0 + + + spacing + 6 + + + QSpinBox + + name + hour + + + enabled + false + + + maxValue + 23 + + + wrapping + true + + + whatsThis + Hour of start time. + + + + QLabel + + name + TextLabel3 + + + enabled + false + + + font + + 1 + + + + text + : + + + alignment + AlignCenter + + + hAlign + + + + QSpinBox + + name + minute + + + enabled + false + + + maxValue + 59 + + + wrapping + true + + + whatsThis + Minutes of start time. + + + + QLabel + + name + TextLabel4 + + + enabled + false + + + font + + 1 + + + + text + : + + + alignment + AlignCenter + + + hAlign + + + + QSpinBox + + name + second + + + enabled + false + + + maxValue + 59 + + + wrapping + true + + + whatsThis + Seconds of start time. + + + + + + + + + name + Spacer2_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QLayoutWidget + + name + Layout25 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QRadioButton + + name + triggerBut + + + text + Trigger + + + whatsThis + Select this entry if you want to automatically trigger the sampling. <p> +You have two choices: +<ul> +<li><b>Raising edge:</b> Sampling is started when the measured value gets bigger than the given threshold.</li> +<li><b>Falling edge:</b> Sampling is started when the measured value gets lower than the given threshold.</li> +</ul> + + + + + name + Spacer9_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + + QButtonGroup + + name + ButtonGroup13 + + + title + + + + frameShape + NoFrame + + + exclusive + false + + + layoutMargin + + + layoutSpacing + + + + margin + 0 + + + spacing + 0 + + + QLayoutWidget + + name + Layout14 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + + name + Spacer3 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLineEdit + + name + fallingThresholdEdit + + + enabled + false + + + maximumSize + + 80 + 32767 + + + + text + 0.0 + + + whatsThis + Threshold for falling edge. + + + + + name + Spacer4_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLineEdit + + name + raisingThresholdEdit + + + enabled + false + + + maximumSize + + 80 + 32767 + + + + text + 0.0 + + + whatsThis + Threshold for raising edge. + + + + QLabel + + name + TextLabel7 + + + enabled + false + + + text + Threshold: + + + + QLabel + + name + TextLabel8 + + + enabled + false + + + text + Threshold: + + + + QLayoutWidget + + name + Layout9 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QLabel + + name + TextLabel6 + + + sizePolicy + + 0 + 1 + + + + minimumSize + + 20 + 0 + + + + + QRadioButton + + name + raisingBut + + + text + Raising edge + + + enabled + false + + + checked + true + + + whatsThis + Trigger sampling on raising edge. + + + + + + QLayoutWidget + + name + Layout10 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QLabel + + name + TextLabel6_2 + + + sizePolicy + + 0 + 1 + + + + minimumSize + + 20 + 0 + + + + + QRadioButton + + name + fallingBut + + + text + Falling edge + + + enabled + false + + + whatsThis + Trigger sampling on falling edge. + + + + + + + + + + + + + name + Spacer1_2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QWidget + + name + scalePage + + + title + Scale + + + + margin + 10 + + + spacing + 5 + + + QButtonGroup + + name + ButtonGroup36 + + + title + Scale + + + layoutMargin + + + layoutSpacing + + + + margin + 10 + + + spacing + 5 + + + QRadioButton + + name + autoScaleBut + + + text + Automatic + + + checked + true + + + whatsThis + Select this entry if you want automatic scaling of the vertical scale in the transient recorder. + + + + QRadioButton + + name + manualScaleBut + + + text + Manual + + + whatsThis + Select this entry if you want to set the minimum and maximum value for the scale manually. If selected enter the minimum and maximum values below. + + + + QLayoutWidget + + name + Layout15_2 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + QLabel + + name + TextLabel9 + + + minimumSize + + 20 + 0 + + + + + QLabel + + name + TextLabel10 + + + enabled + false + + + text + Minimum: + + + + QLineEdit + + name + scaleMinEd + + + enabled + false + + + sizePolicy + + 0 + 0 + + + + minimumSize + + 60 + 0 + + + + maximumSize + + 60 + 32767 + + + + maxLength + 9 + + + text + -3.999 + + + whatsThis + Enter the minimum scale value here. + + + + QLabel + + name + TextLabel10_2 + + + enabled + false + + + text + Maximum: + + + + QLineEdit + + name + scaleMaxEd + + + enabled + false + + + sizePolicy + + 0 + 0 + + + + minimumSize + + 60 + 0 + + + + maximumSize + + 60 + 32767 + + + + maxLength + 9 + + + text + 3.999 + + + whatsThis + Enter the maximum scale value here. + + + + + name + Spacer7 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + + QButtonGroup + + name + ButtonGroup37 + + + title + Window + + + layoutMargin + + + layoutSpacing + + + + margin + 10 + + + spacing + 5 + + + QLabel + + name + TextLabel11 + + + text + Size: + + + + QLabel + + name + TextLabel12 + + + text + Max. length: + + + + + name + Spacer8 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QComboBox + + + text + Seconds + + + + + text + Minutes + + + + + text + Hours + + + + + text + Days + + + + name + sizeUnit + + + + QLineEdit + + name + winSize + + + minimumSize + + 60 + 0 + + + + maximumSize + + 60 + 32767 + + + + text + 600 + + + maxLength + 10 + + + whatsThis + Enter the size (length in time) of the visual part of the transient recorder here. Choose the unit to the right. + + + + QLineEdit + + name + winLength + + + minimumSize + + 60 + 0 + + + + maximumSize + + 60 + 32767 + + + + text + 3600 + + + maxLength + 10 + + + whatsThis + Maximum time for sampling. If this value is reached sampling is not stopped but the first values are discarded. + + + + QComboBox + + + text + Seconds + + + + + text + Minutes + + + + + text + Hours + + + + + text + Days + + + + name + lengthUnit + + + + + + + name + Spacer5 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QWidget + + name + dmmPage + + + title + DMM + + + + margin + 10 + + + spacing + 5 + + + QButtonGroup + + name + ButtonGroup11 + + + title + Port settings + + + layoutMargin + + + layoutSpacing + + + + margin + 10 + + + spacing + 5 + + + QLabel + + name + TextLabel1 + + + text + Baud rate: + + + + QComboBox + + + text + 600 baud + + + + + text + 1200 baud + + + + + text + 1800 baud + + + + + text + 2400 baud + + + + + text + 4800 baud + + + + + text + 9600 baud + + + + name + baudRate + + + currentItem + 0 + + + whatsThis + Select the baud rate for the DMM here. If you encounter problems connecting to your DMM try lowering the baud rate. I had some problems with my <b>Metex ME-32</b>. The Documentation said 1200 baud but it only worked at 600. + + + + QComboBox + + + text + /dev/ttyS0 + + + + + text + /dev/ttyS1 + + + + + text + /dev/ttyS2 + + + + + text + /dev/ttyS3 + + + + name + port + + + currentItem + 0 + + + whatsThis + Choose the serial device here. <i>(Hint for DOS people: /dev/ttyS0 corresponds to COM1. /dev/ttyS1 to COM2 ...)</i> + + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + name + Spacer2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + TextLabel2 + + + text + Port: + + + + + + + name + Spacer4 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QWidget + + name + copyTab + + + title + Copyright + + + + margin + 10 + + + spacing + 5 + + + QTextView + + name + TextView1 + + + text + <center><h1>QtDMM</h1> +A simple display software for <b>Metex</b> and compatible hand held digital multimeter including min/max memory and a configurable transient recorder with export and printing function.<p> +&copy; 2001 Matthias Toussaint<br><font color=blue>&lt;qtdmm@mtoussaint.de&gt;</font><p> +<b>QtDMM</b> uses the platform independent toolkit <b>Qt</b> from Trolltech AS Norway <font color=blue>&lt;www.trolltech.com&gt;</font> and is licensed under <b>GPL</b>. + + + whatsThis + Just some blurb. + + + + + + + + + + image0 + 789ca5d1c10ac2300c00d07bbf222cb7229dce1e06e227281e05f1d04c410f53d07910f1df6dbab6a3dbf46228acd9a369dae612b69b15c85cdc1bd39c2ba84ee606f2f0a8ebe76ebf7c89ac28c00e0db36c22320515acaf9723cfd1ce71ea825313d272ce2971aa8d2eb5710b47e30fc1901b8e443002798a820148b5d4093ab1e03e89a0ff35224ce46bf6c41285cd7a82b18b8160844488c3f82e3a217f2445940ab1f8c6d21ba5700ffd6aaadd8b86d5027d791fbf68ece542a1a124f143de0bf1014a2f8801 + + + + + okBut + clicked() + UIConfigDlg + accept() + + + cancelBut + clicked() + UIConfigDlg + reject() + + + predefinedBut + toggled(bool) + hour + setEnabled(bool) + + + predefinedBut + toggled(bool) + TextLabel3 + setEnabled(bool) + + + predefinedBut + toggled(bool) + minute + setEnabled(bool) + + + predefinedBut + toggled(bool) + TextLabel4 + setEnabled(bool) + + + predefinedBut + toggled(bool) + second + setEnabled(bool) + + + triggerBut + toggled(bool) + raisingBut + setEnabled(bool) + + + triggerBut + toggled(bool) + fallingBut + setEnabled(bool) + + + triggerBut + toggled(bool) + TextLabel7 + setEnabled(bool) + + + triggerBut + toggled(bool) + TextLabel8 + setEnabled(bool) + + + triggerBut + toggled(bool) + raisingThresholdEdit + setEnabled(bool) + + + triggerBut + toggled(bool) + fallingThresholdEdit + setEnabled(bool) + + + manualScaleBut + toggled(bool) + scaleMinEd + setEnabled(bool) + + + manualScaleBut + toggled(bool) + TextLabel10 + setEnabled(bool) + + + manualScaleBut + toggled(bool) + TextLabel10_2 + setEnabled(bool) + + + manualScaleBut + toggled(bool) + scaleMaxEd + setEnabled(bool) + + + + sampleEvery + sampleUnit + sampleTime + timeUnit + manualBut + predefinedBut + hour + minute + second + triggerBut + raisingBut + raisingThresholdEdit + fallingBut + fallingThresholdEdit + autoScaleBut + manualScaleBut + scaleMinEd + scaleMaxEd + winSize + sizeUnit + winLength + lengthUnit + baudRate + port + helpBut + okBut + cancelBut + tabWidget + TextView1 + + diff --git a/src/uimainwid.cpp b/src/uimainwid.cpp new file mode 100644 index 0000000..a577bde --- /dev/null +++ b/src/uimainwid.cpp @@ -0,0 +1,766 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'uimainwid.ui' +** +** Created: Sun Apr 15 20:03:11 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "uimainwid.h" + +#include +#include +#include +#include "dmmgraph.h" +#include +#include +#include +#include +#include +#include + +static const char* const image0_data[] = { +"22 22 4 1", +". c None", +"# c #000000", +"a c #000083", +"b c #4a484a", +"......................", +"......................", +"......................", +"...#........aaaaa.....", +"...##......aaabaaa....", +"...###....aaabb.aaa...", +"...####...aabb...aab..", +"...#####..aab....aab..", +"...######..ab...aaab..", +"...#######..b..aaabb..", +"...########...aaabb...", +"...#########.aaabb....", +"...#####bbbbbaaab.....", +"...##b###.....bbb.....", +"...#bb###b...aaa......", +"....b..###...aaab.....", +".......###b...bbb.....", +"........###...........", +"........###b..........", +".........bbb..........", +"......................", +"......................"}; + + +/* + * Constructs a UIMainWid which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +UIMainWid::UIMainWid( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + QPixmap image0( ( const char** ) image0_data ); + if ( !name ) + setName( "UIMainWid" ); + resize( 570, 360 ); + setCaption( tr( "QtDMM: (c) 2001 M. Toussaint" ) ); + UIMainWidLayout = new QGridLayout( this ); + UIMainWidLayout->setSpacing( 4 ); + UIMainWidLayout->setMargin( 8 ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + UIMainWidLayout->addMultiCellWidget( Line1, 4, 4, 0, 3 ); + + connectBut = new QPushButton( this, "connectBut" ); + connectBut->setText( tr( "Connect" ) ); + connectBut->setAutoDefault( FALSE ); + connectBut->setToggleButton( TRUE ); + QWhatsThis::add( connectBut, tr( "Click here to connect to your multi meter." ) ); + + UIMainWidLayout->addWidget( connectBut, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + UIMainWidLayout->addItem( spacer, 0, 2 ); + + TextLabel7 = new QLabel( this, "TextLabel7" ); + TextLabel7->setText( tr( "

QtDMM
© 2001
M.Toussaint
" ) ); + TextLabel7->setTextFormat( QLabel::RichText ); + TextLabel7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, TextLabel7->sizePolicy().hasHeightForWidth() ) ); + TextLabel7->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); + + UIMainWidLayout->addMultiCellWidget( TextLabel7, 0, 1, 3, 3 ); + + resetBut = new QPushButton( this, "resetBut" ); + resetBut->setText( tr( "Reset" ) ); + resetBut->setToggleButton( FALSE ); + resetBut->setAutoDefault( FALSE ); + QWhatsThis::add( resetBut, tr( "Click this button to reset the memory for the min/max values to the left of the main display." ) ); + + UIMainWidLayout->addWidget( resetBut, 1, 1 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShadow( QFrame::Sunken ); + Frame3->setFrameShape( QFrame::StyledPanel ); + QPalette pal; + QColorGroup cg; + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + Frame3->setPalette( pal ); + Frame3Layout = new QGridLayout( Frame3 ); + Frame3Layout->setSpacing( 2 ); + Frame3Layout->setMargin( 4 ); + + minValue = new QLabel( Frame3, "minValue" ); + minValue->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, minValue->sizePolicy().hasHeightForWidth() ) ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + minValue->setPalette( pal ); + QFont minValue_font( minValue->font() ); + minValue_font.setFamily( "adobe-courier" ); + minValue_font.setPointSize( 18 ); + minValue_font.setBold( TRUE ); + minValue->setFont( minValue_font ); + minValue->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); + minValue->setMinimumSize( QSize( 70, 0 ) ); + QWhatsThis::add( minValue, tr( "Here you see the smallest measured value. You can clear this memory by clicking the Reset button to the right." ) ); + + Frame3Layout->addWidget( minValue, 0, 1 ); + + minUnit = new QLabel( Frame3, "minUnit" ); + minUnit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, minUnit->sizePolicy().hasHeightForWidth() ) ); + minUnit->setMinimumSize( QSize( 40, 0 ) ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + minUnit->setPalette( pal ); + QFont minUnit_font( minUnit->font() ); + minUnit_font.setBold( TRUE ); + minUnit->setFont( minUnit_font ); + minUnit->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignLeft ) ); + + Frame3Layout->addWidget( minUnit, 0, 2 ); + + maxUnit = new QLabel( Frame3, "maxUnit" ); + maxUnit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, maxUnit->sizePolicy().hasHeightForWidth() ) ); + maxUnit->setMinimumSize( QSize( 40, 0 ) ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + maxUnit->setPalette( pal ); + QFont maxUnit_font( maxUnit->font() ); + maxUnit_font.setBold( TRUE ); + maxUnit->setFont( maxUnit_font ); + maxUnit->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignLeft ) ); + + Frame3Layout->addWidget( maxUnit, 1, 2 ); + + TextLabel2 = new QLabel( Frame3, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + TextLabel2->setPalette( pal ); + TextLabel2->setText( tr( "Max:" ) ); + + Frame3Layout->addWidget( TextLabel2, 1, 0 ); + + maxValue = new QLabel( Frame3, "maxValue" ); + maxValue->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, maxValue->sizePolicy().hasHeightForWidth() ) ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + maxValue->setPalette( pal ); + QFont maxValue_font( maxValue->font() ); + maxValue_font.setFamily( "adobe-courier" ); + maxValue_font.setPointSize( 18 ); + maxValue_font.setBold( TRUE ); + maxValue->setFont( maxValue_font ); + maxValue->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); + maxValue->setMinimumSize( QSize( 70, 0 ) ); + QWhatsThis::add( maxValue, tr( "Here you see the largest measured value. You can clear this memory by clicking the Reset button to the right." ) ); + + Frame3Layout->addWidget( maxValue, 1, 1 ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + TextLabel1->setPalette( pal ); + TextLabel1->setText( tr( "Min:" ) ); + + Frame3Layout->addWidget( TextLabel1, 0, 0 ); + + Layout17 = new QGridLayout; + Layout17->setSpacing( 6 ); + Layout17->setMargin( 0 ); + + value = new QLabel( Frame3, "value" ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + value->setPalette( pal ); + QFont value_font( value->font() ); + value_font.setFamily( "adobe-courier" ); + value_font.setPointSize( 28 ); + value_font.setBold( TRUE ); + value->setFont( value_font ); + value->setText( tr( "0.000" ) ); + value->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, value->sizePolicy().hasHeightForWidth() ) ); + value->setMinimumSize( QSize( 120, 0 ) ); + value->setAlignment( int( QLabel::AlignCenter ) ); + QWhatsThis::add( value, tr( "Here you see the current measured value. The display is updated once per second." ) ); + + Layout17->addWidget( value, 0, 0 ); + + unit = new QLabel( Frame3, "unit" ); + unit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, unit->sizePolicy().hasHeightForWidth() ) ); + unit->setMinimumSize( QSize( 50, 0 ) ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 237, 237, 237) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setActive( cg ); + cg.setColor( QColorGroup::Foreground, black ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, black ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setInactive( cg ); + cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Button, QColor( 220, 220, 220) ); + cg.setColor( QColorGroup::Light, white ); + cg.setColor( QColorGroup::Midlight, QColor( 253, 253, 253) ); + cg.setColor( QColorGroup::Dark, QColor( 110, 110, 110) ); + cg.setColor( QColorGroup::Mid, QColor( 146, 146, 146) ); + cg.setColor( QColorGroup::Text, black ); + cg.setColor( QColorGroup::BrightText, white ); + cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); + cg.setColor( QColorGroup::Base, white ); + cg.setColor( QColorGroup::Background, QColor( 214, 220, 201) ); + cg.setColor( QColorGroup::Shadow, black ); + cg.setColor( QColorGroup::Highlight, QColor( 100, 100, 145) ); + cg.setColor( QColorGroup::HighlightedText, white ); + pal.setDisabled( cg ); + unit->setPalette( pal ); + QFont unit_font( unit->font() ); + unit_font.setPointSize( 12 ); + unit_font.setBold( TRUE ); + unit->setFont( unit_font ); + QWhatsThis::add( unit, tr( "Here you see the unit of the measured value." ) ); + + Layout17->addWidget( unit, 0, 1 ); + + Frame3Layout->addMultiCellLayout( Layout17, 0, 1, 3, 3 ); + + UIMainWidLayout->addMultiCellWidget( Frame3, 0, 1, 0, 0 ); + + Line3 = new QFrame( this, "Line3" ); + Line3->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + UIMainWidLayout->addMultiCellWidget( Line3, 2, 2, 0, 3 ); + + Layout5 = new QHBoxLayout; + Layout5->setSpacing( 5 ); + Layout5->setMargin( 0 ); + + graph = new DMMGraph( this, "graph" ); + graph->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, graph->sizePolicy().hasHeightForWidth() ) ); + graph->setCursor( QCursor( 2 ) ); + QWhatsThis::add( graph, tr( "This is the plotting area for the transient recorder. It is widely configurable by clicking the config ... button to the right. Data aquisition may be started by hand, at a specific time or automatically triggered by the measured value itself (See configuration dialog)

\nThe maximum resolution for data aquisition is one second, but may also be configured to sample once a week or what ever you want.\n

\nNote: Connecting to the DMM as well as a change of the measuring unit automatically clears the graph." ) ); + Layout5->addWidget( graph ); + + Layout4 = new QVBoxLayout; + Layout4->setSpacing( 4 ); + Layout4->setMargin( 0 ); + + startBut = new QPushButton( this, "startBut" ); + startBut->setText( tr( "&Start" ) ); + startBut->setAutoDefault( FALSE ); + startBut->setEnabled( FALSE ); + QWhatsThis::add( startBut, tr( "Click here to start the transient recorder (Only in manual mode. See configuration dialog)" ) ); + Layout4->addWidget( startBut ); + + stopBut = new QPushButton( this, "stopBut" ); + stopBut->setText( tr( "Sto&p" ) ); + stopBut->setAutoDefault( FALSE ); + stopBut->setEnabled( FALSE ); + QWhatsThis::add( stopBut, tr( "Click here to stop the transient recorder." ) ); + Layout4->addWidget( stopBut ); + + clearBut = new QPushButton( this, "clearBut" ); + clearBut->setText( tr( "&Clear" ) ); + clearBut->setAutoDefault( FALSE ); + QWhatsThis::add( clearBut, tr( "Click here to clear the graph (Warning: You can't undo that)" ) ); + Layout4->addWidget( clearBut ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout4->addItem( spacer_2 ); + + configBut = new QPushButton( this, "configBut" ); + configBut->setText( tr( "Config ..." ) ); + configBut->setAutoDefault( FALSE ); + QWhatsThis::add( configBut, tr( "Click here to call the configuration dialog. In this dialog you can configure the sampling rate, scaling of the graph, port settings etc. (Note: You have to be disconnected in order to be able to call the configuration dialog)" ) ); + Layout4->addWidget( configBut ); + Layout5->addLayout( Layout4 ); + + UIMainWidLayout->addMultiCellLayout( Layout5, 3, 3, 0, 3 ); + + Layout27 = new QHBoxLayout; + Layout27->setSpacing( 4 ); + Layout27->setMargin( 0 ); + + helpBut = new QPushButton( this, "helpBut" ); + helpBut->setText( tr( "" ) ); + helpBut->setPixmap( image0 ); + helpBut->setMinimumSize( QSize( 26, 26 ) ); + helpBut->setAutoDefault( FALSE ); + QToolTip::add( helpBut, tr( "Direct help" ) ); + Layout27->addWidget( helpBut ); + + quitBut = new QPushButton( this, "quitBut" ); + quitBut->setText( tr( "&Quit" ) ); + quitBut->setAutoDefault( FALSE ); + QWhatsThis::add( quitBut, tr( "You guessed it :) Click here to quit the program. All settings are saved in the file \".qtdmmrc\"" ) ); + Layout27->addWidget( quitBut ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout27->addItem( spacer_3 ); + + printBut = new QPushButton( this, "printBut" ); + printBut->setText( tr( "&Print ..." ) ); + printBut->setAutoDefault( FALSE ); + QWhatsThis::add( printBut, tr( "Click here to print the graph. (Note: This will always print the visible portion of your window)" ) ); + Layout27->addWidget( printBut ); + + exportBut = new QPushButton( this, "exportBut" ); + exportBut->setText( tr( "&Export ..." ) ); + exportBut->setAutoDefault( FALSE ); + QWhatsThis::add( exportBut, tr( "Click here to export the sampled data as tab separated list. The data format is:
\nDD.MM.YYYY TAB HH:MM:SS TAB value TAB unit

\n(Note: This will always export all your data. Depending the way you configured the recorder this may result in huge files!)" ) ); + Layout27->addWidget( exportBut ); + + UIMainWidLayout->addMultiCellLayout( Layout27, 5, 5, 0, 3 ); + + Layout27_2 = new QHBoxLayout; + Layout27_2->setSpacing( 1 ); + Layout27_2->setMargin( 0 ); + + statusBar = new QLabel( this, "statusBar" ); + statusBar->setFrameShape( QLabel::Panel ); + statusBar->setFrameShadow( QLabel::Sunken ); + statusBar->setText( tr( "Not connected" ) ); + statusBar->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, statusBar->sizePolicy().hasHeightForWidth() ) ); + QWhatsThis::add( statusBar, tr( "Here you find some status information and error messages that may occur, when you have problems connecting to your DMM." ) ); + Layout27_2->addWidget( statusBar ); + + infoLabel = new QLabel( this, "infoLabel" ); + infoLabel->setText( tr( "1/10000" ) ); + infoLabel->setFrameShape( QLabel::Panel ); + infoLabel->setFrameShadow( QLabel::Sunken ); + infoLabel->setMinimumSize( QSize( 200, 0 ) ); + Layout27_2->addWidget( infoLabel ); + + UIMainWidLayout->addMultiCellLayout( Layout27_2, 6, 6, 0, 3 ); + + // signals and slots connections + connect( connectBut, SIGNAL( toggled(bool) ), configBut, SLOT( setDisabled(bool) ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +UIMainWid::~UIMainWid() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Main event handler. Reimplemented to handle application + * font changes + */ +bool UIMainWid::event( QEvent* ev ) +{ + bool ret = QWidget::event( ev ); + if ( ev->type() == QEvent::ApplicationFontChange ) { + QFont minValue_font( minValue->font() ); + minValue_font.setFamily( "adobe-courier" ); + minValue_font.setPointSize( 18 ); + minValue_font.setBold( TRUE ); + minValue->setFont( minValue_font ); + QFont minUnit_font( minUnit->font() ); + minUnit_font.setBold( TRUE ); + minUnit->setFont( minUnit_font ); + QFont maxUnit_font( maxUnit->font() ); + maxUnit_font.setBold( TRUE ); + maxUnit->setFont( maxUnit_font ); + QFont maxValue_font( maxValue->font() ); + maxValue_font.setFamily( "adobe-courier" ); + maxValue_font.setPointSize( 18 ); + maxValue_font.setBold( TRUE ); + maxValue->setFont( maxValue_font ); + QFont value_font( value->font() ); + value_font.setFamily( "adobe-courier" ); + value_font.setPointSize( 28 ); + value_font.setBold( TRUE ); + value->setFont( value_font ); + QFont unit_font( unit->font() ); + unit_font.setPointSize( 12 ); + unit_font.setBold( TRUE ); + unit->setFont( unit_font ); + } + return ret; +} + diff --git a/src/uimainwid.h b/src/uimainwid.h new file mode 100644 index 0000000..1646feb --- /dev/null +++ b/src/uimainwid.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'uimainwid.ui' +** +** Created: Sun Apr 15 20:02:39 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef UIMAINWID_H +#define UIMAINWID_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class DMMGraph; +class QFrame; +class QLabel; +class QPushButton; + +class UIMainWid : public QWidget +{ + Q_OBJECT + +public: + UIMainWid( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~UIMainWid(); + + QFrame* Line1; + QPushButton* connectBut; + QLabel* TextLabel7; + QPushButton* resetBut; + QFrame* Frame3; + QLabel* minValue; + QLabel* minUnit; + QLabel* maxUnit; + QLabel* TextLabel2; + QLabel* maxValue; + QLabel* TextLabel1; + QLabel* value; + QLabel* unit; + QFrame* Line3; + DMMGraph* graph; + QPushButton* startBut; + QPushButton* stopBut; + QPushButton* clearBut; + QPushButton* configBut; + QPushButton* helpBut; + QPushButton* quitBut; + QPushButton* printBut; + QPushButton* exportBut; + QLabel* statusBar; + QLabel* infoLabel; + +protected: + QGridLayout* UIMainWidLayout; + QGridLayout* Frame3Layout; + QGridLayout* Layout17; + QHBoxLayout* Layout5; + QVBoxLayout* Layout4; + QHBoxLayout* Layout27; + QHBoxLayout* Layout27_2; + bool event( QEvent* ); +}; + +#endif // UIMAINWID_H diff --git a/src/uimainwid.ui b/src/uimainwid.ui new file mode 100644 index 0000000..63e2019 --- /dev/null +++ b/src/uimainwid.ui @@ -0,0 +1,2868 @@ + +UIMainWid +Matthias Toussaint + + QWidget + + name + UIMainWid + + + geometry + + 0 + 0 + 570 + 360 + + + + caption + QtDMM: (c) 2001 M. Toussaint + + + layoutMargin + + + layoutSpacing + + + + margin + 8 + + + spacing + 4 + + + Line + + name + Line1 + + + orientation + Horizontal + + + + QPushButton + + name + connectBut + + + text + Connect + + + autoDefault + false + + + toggleButton + true + + + whatsThis + Click here to connect to your multi meter. + + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + TextLabel7 + + + text + <center><b>QtDMM</b><br>&copy; 2001<br>M.Toussaint</center> + + + textFormat + RichText + + + sizePolicy + + 1 + 5 + + + + alignment + WordBreak|AlignVCenter|AlignLeft + + + hAlign + + + wordwrap + + + + QPushButton + + name + resetBut + + + text + Reset + + + toggleButton + false + + + autoDefault + false + + + whatsThis + Click this button to reset the memory for the min/max values to the left of the main display. + + + + QFrame + + name + Frame3 + + + frameShadow + Sunken + + + frameShape + StyledPanel + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + layoutMargin + + + layoutSpacing + + + + margin + 4 + + + spacing + 2 + + + QLabel + + name + minValue + + + sizePolicy + + 0 + 1 + + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + font + + adobe-courier + 18 + 1 + + + + alignment + AlignVCenter|AlignRight + + + minimumSize + + 70 + 0 + + + + hAlign + + + whatsThis + Here you see the smallest measured value. You can clear this memory by clicking the <b>Reset</b> button to the right. + + + + QLabel + + name + minUnit + + + sizePolicy + + 0 + 1 + + + + minimumSize + + 40 + 0 + + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + font + + 1 + + + + alignment + AlignVCenter|AlignLeft + + + hAlign + + + + QLabel + + name + maxUnit + + + sizePolicy + + 0 + 1 + + + + minimumSize + + 40 + 0 + + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + font + + 1 + + + + alignment + AlignVCenter|AlignLeft + + + hAlign + + + + QLabel + + name + TextLabel2 + + + sizePolicy + + 0 + 1 + + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + text + Max: + + + + QLabel + + name + maxValue + + + sizePolicy + + 0 + 1 + + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + font + + adobe-courier + 18 + 1 + + + + alignment + AlignVCenter|AlignRight + + + minimumSize + + 70 + 0 + + + + hAlign + + + whatsThis + Here you see the largest measured value. You can clear this memory by clicking the <b>Reset</b> button to the right. + + + + QLabel + + name + TextLabel1 + + + sizePolicy + + 0 + 1 + + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + text + Min: + + + + QLayoutWidget + + name + Layout17 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + value + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + font + + adobe-courier + 28 + 1 + + + + text + 0.000 + + + sizePolicy + + 0 + 1 + + + + minimumSize + + 120 + 0 + + + + alignment + AlignCenter + + + hAlign + + + whatsThis + Here you see the current measured value. The display is updated once per second. + + + + QLabel + + name + unit + + + sizePolicy + + 0 + 1 + + + + minimumSize + + 50 + 0 + + + + palette + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 237 + 237 + 237 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 220 + 220 + 220 + + + 255 + 255 + 255 + + + 253 + 253 + 253 + + + 110 + 110 + 110 + + + 146 + 146 + 146 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 214 + 220 + 201 + + + 0 + 0 + 0 + + + 100 + 100 + 145 + + + 255 + 255 + 255 + + + + + + font + + 12 + 1 + + + + whatsThis + Here you see the unit of the measured value. + + + + + + + + Line + + name + Line3 + + + orientation + Horizontal + + + + QLayoutWidget + + name + Layout5 + + + layoutSpacing + + + + margin + 0 + + + spacing + 5 + + + DMMGraph + + name + graph + + + sizePolicy + + 7 + 7 + + + + cursor + 2 + + + whatsThis + This is the plotting area for the transient recorder. It is widely configurable by clicking the <b>config ...</b> button to the right. Data aquisition may be started by hand, at a specific time or automatically triggered by the measured value itself <i>(See configuration dialog)</i><p> +The maximum resolution for data aquisition is one second, but may also be configured to sample once a week or what ever you want. +<p> +<b>Note:</b> Connecting to the DMM as well as a change of the measuring unit automatically clears the graph. + + + + QLayoutWidget + + name + Layout4 + + + layoutSpacing + + + + margin + 0 + + + spacing + 4 + + + QPushButton + + name + startBut + + + text + &Start + + + autoDefault + false + + + enabled + false + + + whatsThis + Click here to start the transient recorder <i>(Only in manual mode. See configuration dialog)</i> + + + + QPushButton + + name + stopBut + + + text + Sto&p + + + autoDefault + false + + + enabled + false + + + whatsThis + Click here to stop the transient recorder. + + + + QPushButton + + name + clearBut + + + text + &Clear + + + autoDefault + false + + + whatsThis + Click here to clear the graph <i>(Warning: You can't undo that)</i> + + + + + name + Spacer1_2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + configBut + + + text + Config ... + + + autoDefault + false + + + whatsThis + Click here to call the configuration dialog. In this dialog you can configure the sampling rate, scaling of the graph, port settings etc. <i>(Note: You have to be disconnected in order to be able to call the configuration dialog)</i> + + + + + + + + QLayoutWidget + + name + Layout27 + + + layoutSpacing + + + + margin + 0 + + + spacing + 4 + + + QPushButton + + name + helpBut + + + text + + + + pixmap + image0 + + + minimumSize + + 26 + 26 + + + + autoDefault + false + + + toolTip + Direct help + + + + QPushButton + + name + quitBut + + + text + &Quit + + + autoDefault + false + + + whatsThis + You guessed it :) Click here to quit the program. All settings are saved in the file <tt>".qtdmmrc"</tt> + + + + + name + Spacer2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + printBut + + + text + &Print ... + + + autoDefault + false + + + whatsThis + Click here to print the graph. <i>(Note: This will always print the visible portion of your window)</i> + + + + QPushButton + + name + exportBut + + + text + &Export ... + + + autoDefault + false + + + whatsThis + Click here to export the sampled data as tab separated list. The data format is:<br> +<b>DD.MM.YYYY</b> TAB <b>HH:MM:SS</b> TAB <b>value</b> TAB <b>unit</b><p> +<i>(Note: This will always export all your data. Depending the way you configured the recorder this may result in huge files!)</i> + + + + + + QLayoutWidget + + name + Layout27 + + + layoutSpacing + + + + margin + 0 + + + spacing + 1 + + + QLabel + + name + statusBar + + + frameShape + Panel + + + frameShadow + Sunken + + + text + Not connected + + + sizePolicy + + 7 + 1 + + + + whatsThis + Here you find some status information and error messages that may occur, when you have problems connecting to your DMM. + + + + QLabel + + name + infoLabel + + + text + 1/10000 + + + frameShape + Panel + + + frameShadow + Sunken + + + minimumSize + + 200 + 0 + + + + + + + + + + DMMGraph +

dmmgraph.h
+ + -1 + -1 + + 0 + + 5 + 5 + + image1 + + + + + image0 + 789ca5d1c10ac2300c00d07bbf222cb7229dce1e06e227281e05f1d04c410f53d07910f1df6dbab6a3dbf46228acd9a369dae612b69b15c85cdc1bd39c2ba84ee606f2f0a8ebe76ebf7c89ac28c00e0db36c22320515acaf9723cfd1ce71ea825313d272ce2971aa8d2eb5710b47e30fc1901b8e443002798a820148b5d4093ab1e03e89a0ff35224ce46bf6c41285cd7a82b18b8160844488c3f82e3a217f2445940ab1f8c6d21ba5700ffd6aaadd8b86d5027d791fbf68ece542a1a124f143de0bf1014a2f8801 + + + image1 + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + + + connectBut + toggled(bool) + configBut + setDisabled(bool) + + + diff --git a/src/uiprintdlg.cpp b/src/uiprintdlg.cpp new file mode 100644 index 0000000..1cde188 --- /dev/null +++ b/src/uiprintdlg.cpp @@ -0,0 +1,185 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'uiprintdlg.ui' +** +** Created: Sun Apr 15 20:03:16 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "uiprintdlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char* const image0_data[] = { +"22 22 4 1", +". c None", +"# c #000000", +"a c #000083", +"b c #4a484a", +"......................", +"......................", +"......................", +"...#........aaaaa.....", +"...##......aaabaaa....", +"...###....aaabb.aaa...", +"...####...aabb...aab..", +"...#####..aab....aab..", +"...######..ab...aaab..", +"...#######..b..aaabb..", +"...########...aaabb...", +"...#########.aaabb....", +"...#####bbbbbaaab.....", +"...##b###.....bbb.....", +"...#bb###b...aaa......", +"....b..###...aaab.....", +".......###b...bbb.....", +"........###...........", +"........###b..........", +".........bbb..........", +"......................", +"......................"}; + + +/* + * Constructs a UIPrintDlg which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +UIPrintDlg::UIPrintDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + QPixmap image0( ( const char** ) image0_data ); + if ( !name ) + setName( "UIPrintDlg" ); + resize( 592, 362 ); + setCaption( tr( "QtDMM: Print graph ..." ) ); + UIPrintDlgLayout = new QGridLayout( this ); + UIPrintDlgLayout->setSpacing( 4 ); + UIPrintDlgLayout->setMargin( 8 ); + + Line4 = new QFrame( this, "Line4" ); + Line4->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + UIPrintDlgLayout->addMultiCellWidget( Line4, 1, 1, 0, 2 ); + + configBut = new QPushButton( this, "configBut" ); + configBut->setText( tr( "Configure ..." ) ); + configBut->setAutoDefault( FALSE ); + QWhatsThis::add( configBut, tr( "Click here to configure the printer." ) ); + + UIPrintDlgLayout->addWidget( configBut, 0, 2 ); + + TextLabel2 = new QLabel( this, "TextLabel2" ); + TextLabel2->setText( tr( "Comment:" ) ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + + UIPrintDlgLayout->addWidget( TextLabel2, 3, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + UIPrintDlgLayout->addItem( spacer, 4, 0 ); + + TextLabel1 = new QLabel( this, "TextLabel1" ); + TextLabel1->setText( tr( "Title:" ) ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + + UIPrintDlgLayout->addWidget( TextLabel1, 2, 0 ); + + TextLabel3 = new QLabel( this, "TextLabel3" ); + TextLabel3->setText( tr( "Printer:" ) ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + + UIPrintDlgLayout->addWidget( TextLabel3, 0, 0 ); + + printerLabel = new QLabel( this, "printerLabel" ); + printerLabel->setText( tr( "Please select printer ->" ) ); + printerLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, printerLabel->sizePolicy().hasHeightForWidth() ) ); + QFont printerLabel_font( printerLabel->font() ); + printerLabel_font.setBold( TRUE ); + printerLabel->setFont( printerLabel_font ); + QWhatsThis::add( printerLabel, tr( "This label shows the currently selected printer. Click the button to the right to configure the printer. (You have to select a printer in order to be able to print)" ) ); + + UIPrintDlgLayout->addWidget( printerLabel, 0, 1 ); + + printTitle = new QLineEdit( this, "printTitle" ); + QWhatsThis::add( printTitle, tr( "Enter a title for the document (Optional)" ) ); + + UIPrintDlgLayout->addMultiCellWidget( printTitle, 2, 2, 1, 2 ); + + printComment = new QMultiLineEdit( this, "printComment" ); + printComment->setWordWrap( QMultiLineEdit::WidgetWidth ); + QWhatsThis::add( printComment, tr( "Here you may enter an comment which will be printed on top of the page (Optional)" ) ); + + UIPrintDlgLayout->addMultiCellWidget( printComment, 3, 4, 1, 2 ); + + Line3 = new QFrame( this, "Line3" ); + Line3->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + UIPrintDlgLayout->addMultiCellWidget( Line3, 5, 5, 0, 2 ); + + Layout28 = new QHBoxLayout; + Layout28->setSpacing( 4 ); + Layout28->setMargin( 0 ); + + helpBut = new QPushButton( this, "helpBut" ); + helpBut->setText( tr( "" ) ); + helpBut->setPixmap( image0 ); + helpBut->setAutoDefault( FALSE ); + helpBut->setMinimumSize( QSize( 26, 26 ) ); + QToolTip::add( helpBut, tr( "Direct help" ) ); + Layout28->addWidget( helpBut ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout28->addItem( spacer_2 ); + + printBut = new QPushButton( this, "printBut" ); + printBut->setText( tr( "&Print" ) ); + printBut->setDefault( TRUE ); + printBut->setEnabled( FALSE ); + QWhatsThis::add( printBut, tr( "Click here to print." ) ); + Layout28->addWidget( printBut ); + + cancelBut = new QPushButton( this, "cancelBut" ); + cancelBut->setText( tr( "&Cancel" ) ); + QWhatsThis::add( cancelBut, tr( "Click here to abort printing." ) ); + Layout28->addWidget( cancelBut ); + + UIPrintDlgLayout->addMultiCellLayout( Layout28, 6, 6, 0, 2 ); + + // signals and slots connections + connect( printBut, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( cancelBut, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +UIPrintDlg::~UIPrintDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Main event handler. Reimplemented to handle application + * font changes + */ +bool UIPrintDlg::event( QEvent* ev ) +{ + bool ret = QDialog::event( ev ); + if ( ev->type() == QEvent::ApplicationFontChange ) { + QFont printerLabel_font( printerLabel->font() ); + printerLabel_font.setBold( TRUE ); + printerLabel->setFont( printerLabel_font ); + } + return ret; +} + diff --git a/src/uiprintdlg.h b/src/uiprintdlg.h new file mode 100644 index 0000000..d5a2469 --- /dev/null +++ b/src/uiprintdlg.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'uiprintdlg.ui' +** +** Created: Sun Apr 15 20:02:39 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef UIPRINTDLG_H +#define UIPRINTDLG_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QFrame; +class QLabel; +class QLineEdit; +class QMultiLineEdit; +class QPushButton; + +class UIPrintDlg : public QDialog +{ + Q_OBJECT + +public: + UIPrintDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~UIPrintDlg(); + + QFrame* Line4; + QPushButton* configBut; + QLabel* TextLabel2; + QLabel* TextLabel1; + QLabel* TextLabel3; + QLabel* printerLabel; + QLineEdit* printTitle; + QMultiLineEdit* printComment; + QFrame* Line3; + QPushButton* helpBut; + QPushButton* printBut; + QPushButton* cancelBut; + +protected: + QGridLayout* UIPrintDlgLayout; + QHBoxLayout* Layout28; + bool event( QEvent* ); +}; + +#endif // UIPRINTDLG_H diff --git a/src/uiprintdlg.ui b/src/uiprintdlg.ui new file mode 100644 index 0000000..228771d --- /dev/null +++ b/src/uiprintdlg.ui @@ -0,0 +1,338 @@ + +UIPrintDlg + + QDialog + + name + UIPrintDlg + + + geometry + + 0 + 0 + 592 + 362 + + + + caption + QtDMM: Print graph ... + + + layoutMargin + + + layoutSpacing + + + + margin + 8 + + + spacing + 4 + + + Line + + name + Line4 + + + orientation + Horizontal + + + + QPushButton + + name + configBut + + + text + Configure ... + + + autoDefault + false + + + whatsThis + Click here to configure the printer. + + + + QLabel + + name + TextLabel2 + + + text + Comment: + + + sizePolicy + + 1 + 0 + + + + + + name + Spacer3 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + TextLabel1 + + + text + Title: + + + sizePolicy + + 1 + 0 + + + + + QLabel + + name + TextLabel3 + + + text + Printer: + + + sizePolicy + + 1 + 0 + + + + + QLabel + + name + printerLabel + + + text + Please select printer -> + + + sizePolicy + + 7 + 0 + + + + font + + 1 + + + + whatsThis + This label shows the currently selected printer. Click the button to the right to configure the printer. <i>(You have to select a printer in order to be able to print)</i> + + + + QLineEdit + + name + printTitle + + + whatsThis + Enter a title for the document <i>(Optional)</i> + + + + QMultiLineEdit + + name + printComment + + + wordWrap + WidgetWidth + + + whatsThis + Here you may enter an comment which will be printed on top of the page <i>(Optional)</i> + + + + Line + + name + Line3 + + + orientation + Horizontal + + + + QLayoutWidget + + name + Layout28 + + + layoutSpacing + + + + margin + 0 + + + spacing + 4 + + + QPushButton + + name + helpBut + + + text + + + + pixmap + image0 + + + autoDefault + false + + + minimumSize + + 26 + 26 + + + + toolTip + Direct help + + + + + name + Spacer2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + printBut + + + text + &Print + + + default + true + + + enabled + false + + + whatsThis + Click here to print. + + + + QPushButton + + name + cancelBut + + + text + &Cancel + + + whatsThis + Click here to abort printing. + + + + + + + + + image0 + 789ca5d1c10ac2300c00d07bbf222cb7229dce1e06e227281e05f1d04c410f53d07910f1df6dbab6a3dbf46228acd9a369dae612b69b15c85cdc1bd39c2ba84ee606f2f0a8ebe76ebf7c89ac28c00e0db36c22320515acaf9723cfd1ce71ea825313d272ce2971aa8d2eb5710b47e30fc1901b8e443002798a820148b5d4093ab1e03e89a0ff35224ce46bf6c41285cd7a82b18b8160844488c3f82e3a217f2445940ab1f8c6d21ba5700ffd6aaadd8b86d5027d791fbf68ece542a1a124f143de0bf1014a2f8801 + + + + + printBut + clicked() + UIPrintDlg + accept() + + + cancelBut + clicked() + UIPrintDlg + reject() + + +