00001 00002 // 00003 // YASA statistic window declarations 00004 // 00005 // Project: Yasa 2 00006 // Author : Jan Blumenthal 00007 // Start : 2002/03/18 00008 // $Header: /sources/yasa/yasagui/statistichandler.h,v 1.4 2003/01/24 15:47:43 bj Exp $ 00009 // 00011 // 00012 // This program is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU General Public License as published by 00014 // the Free Software Foundation; either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU General Public License 00023 // along with this program (See the included file COPYING); 00024 // if not, write to the Free Software Foundation, Inc., 00025 // 675 Mass Ave, Cambridge, MA 02139, USA. 00026 // 00028 #ifndef YASAGUI_STATISTIC_HANDLER_INCLUDE 00029 #define YASAGUI_STATISTIC_HANDLER_INCLUDE 00030 00031 00033 #include <qscrollview.h> 00034 #include <qsplitter.h> 00035 #include <qlayout.h> 00036 #include <qframe.h> 00037 #include "timingsettings.h" 00038 #include "settings.h" 00039 #include "resulthandler.h" 00040 00042 class YStatistics; 00043 00044 00047 class YStatisticsInfo 00048 { 00049 YStatistics *statistics; 00050 public: YStatisticsInfo() : statistics(0) { } 00051 ~YStatisticsInfo(); 00052 YStatistics * GetStatistics() { return statistics; } 00053 void SetStatistics(YStatistics *t) { statistics=t; } 00054 }; 00055 00056 00057 00058 00059 00062 class YStatisticHandler : public YResultHandler 00063 { Q_OBJECT 00064 QWidget *parent; 00065 protected: 00066 QList<YStatisticsInfo> list; 00067 public: YStatisticHandler(QWidget *p); 00068 virtual int InsertStatistics(YStatistics *t) =0; 00069 QList<YStatisticsInfo>& GetStatisticsList() { return list; } 00070 virtual void ClearResults() { list.clear(); } 00071 signals: 00072 void NewStatisticsInserted(YStatisticsInfo *si); 00073 }; 00074 00076 class YStatisticTableHandler : public YStatisticHandler 00077 { QScrollView scrollview; 00078 QFrame *scrollframe; 00079 QVBoxLayout *vboxlayout; 00080 public: YStatisticTableHandler(QWidget *p) : YStatisticHandler(p), scrollview(p), scrollframe(0), vboxlayout(0) 00081 { 00082 InitScrollFrame(); 00083 } 00084 void DestroyScrollFrame() 00085 { 00086 if (scrollframe) 00087 { 00088 scrollview.removeChild(scrollframe); 00089 scrollframe->close(); 00090 } 00091 scrollframe=0; 00092 } 00093 int InitScrollFrame() 00094 { 00095 DestroyScrollFrame(); 00096 scrollframe = new QFrame( &scrollview ); 00097 vboxlayout = new QVBoxLayout(scrollframe, MDI_SCROLLVIEW_BORDER ); 00098 scrollview.addChild(scrollframe); 00099 scrollview.setResizePolicy(QScrollView::AutoOneFit); 00100 return 0; 00101 } 00103 virtual int InsertStatistics(YStatistics *t); 00104 virtual int PostCreate(); 00106 virtual int PostUpdate() 00107 { 00108 scrollframe->show(); 00109 return 0; 00110 } 00111 virtual void ClearResults() { DestroyScrollFrame(); 00112 YStatisticHandler::ClearResults(); 00113 InitScrollFrame(); } 00114 }; 00115 00116 00117 00118 00120 #endif // ifndef YASAGUI_TIMING_HANDLER_INCLUDE