00001 /*************************************************************************** 00002 * SpikeStream Application * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef SPIKESTREAMAPPLICATION_H 00024 #define SPIKESTREAMAPPLICATION_H 00025 00026 //Qt includes 00027 #include <qapplication.h> 00028 00029 //Other includes 00030 #include <sys/time.h> 00031 00032 00033 //--------------------- Spike Stream Application -------------------------- 00034 /*! Inherits from QApplication so that it can filter out XEvents during 00035 slow renders. Is the QApplication for the application. */ 00036 //------------------------------------------------------------------------- 00037 00038 class SpikeStreamApplication : public QApplication { 00039 Q_OBJECT 00040 00041 public: 00042 SpikeStreamApplication(int argc, char ** argv); 00043 ~SpikeStreamApplication(); 00044 bool renderInProgress(); 00045 void startRender(); 00046 void stopRender(); 00047 00048 00049 protected: 00050 //Inherited from QApplication 00051 bool x11EventFilter( XEvent * ); 00052 00053 00054 private: 00055 //============================ VARIABLES ============================== 00056 /*! Records the duration of each render.*/ 00057 unsigned int renderDuration_ms; 00058 00059 /*! Records the time of the last key press at the start of the render.*/ 00060 unsigned int startRenderKeyEventTime; 00061 00062 /*! Records the time of each key press event.*/ 00063 unsigned int keyEventTime; 00064 00065 /*! Time structure to record the start of the render.*/ 00066 timeval startRenderTime; 00067 00068 /*! Time structure to record the end of the render.*/ 00069 timeval stopRenderTime; 00070 00071 /*! Records when rendering is in progress.*/ 00072 bool rendering; 00073 00074 00075 //============================ METHODS ================================ 00076 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00077 SpikeStreamApplication(const SpikeStreamApplication&); 00078 00079 /*! Declare assignment private so it cannot be used inadvertently.*/ 00080 SpikeStreamApplication operator=(const SpikeStreamApplication&); 00081 00082 }; 00083 00084 00085 #endif//SPIKESTREAMAPPLICATION_H 00086 00087
1.4.4