reccnts.h

Go to the documentation of this file.
00001 // OSB library ************************************************ -*- C++ -*-
00006 /*
00007   AUTHOR(S): Stephan Broennimann (vb)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.25 $
00012 
00013   License
00014    OSB rating and billing library for communication networks
00015    Copyright (C) 2004, 2005, 2006  OSB systems
00016 
00017    This file may be distributed and/or modify under the terms of the
00018    GNU General Public License (GPL) as published by the Free Software
00019    Foundation which is provided in the file LICENSE.GPL included in the
00020    packaging of this file.
00021 
00022    The file is distributed in the hope that it will be useful, but WITHOUT
00023    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00024    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00025    for more details.
00026 
00027    Holders of a OSB Commercial License may use this file under the terms
00028    and conditions of this commercial license.
00029  */
00030 #ifndef _RECCNTS_H_
00031 #define _RECCNTS_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <vector>
00037 #include <map>
00038 #include <set>
00039 
00040 // + libraries
00041 #include <qscrollview.h>
00042 
00043 #include <callback.h>
00044 #include <recordstream.h>
00045 
00046 // + local headers
00047 #include "adminwidget.h"
00048 #include "barchart.h"
00049 
00050 // + class declarations
00051 namespace OSB_DB {
00052     class Session;
00053 }
00054 
00055 namespace OSB_LIB {
00056     class CaCounts;
00057     class CaModuleResult;
00058     class CaResults;
00059     class CaStreamResult;
00060     class RecordStreamFilter;
00061     class RecordStreamInfo;
00062     class RecordStreams;
00063 }
00064 
00065 namespace OSB_GUI {
00066     class DateEdit;
00067     class DlgStreamInfo;
00068 }
00069 
00070 // + QT classes
00071 class QCheckBox;
00072 class QHBoxLayout;
00073 class QLabel;
00074 class QPushButton;
00075 class QSpacerItem;
00076 class QVBoxLayout;
00077 
00078 // ************************************************************************
00079 // namespace extensions
00080 namespace OSB_GUI {
00081 
00082 // ************************************************************************
00083 // forward declarations
00084     class RecCountView;
00085     class RecCounts;
00086 
00087 // ************************************************************************
00088 // type definitions
00089 
00090 // ************************************************************************
00091 // class definitions
00092 
00096     class RecCountsAdmin : public AdminWidget {
00097         Q_OBJECT                        // for vim ->;
00098     public:
00103         RecCountsAdmin(
00104                   AdminType type,
00105                   QWidget*  parent,
00106             const char*     name   = 0,
00107                   WFlags    flags  = 0
00108         );
00109 
00110     public slots:
00112         void languageChange();
00113 
00114     public:
00122         void activated(bool minimized);
00123 
00124         // documentation from base class
00125         std::string menuTitle() const;
00126         // documentation from base class
00127         QPopupMenu* menu();
00128         // documentation from base class
00129         void clearMenuAccels();
00130 
00131     private slots:
00133         void readStreams();
00135         void showResult();
00136 
00137     private:
00144         void keyPressEvent(QKeyEvent* event);
00152         void message();
00153 
00154     private:
00156         RecCountView* recCountView_;
00158         QFrame* lineCtl_;
00160         QHBoxLayout* loCtl_;
00162         QLabel* tlFrom_;
00164         DateEdit* from_;
00166         QLabel* tlTo_;
00168         DateEdit* to_;
00170         QCheckBox* cbByStream_;
00172         QSpacerItem* spPb_;
00174         QPushButton* pbGo_;
00175 
00177         QVBoxLayout* layout_;
00178     };                                  // class RecCountsAdmin
00179 
00184     class RecCountView : public QScrollView {
00186         friend class RecCountsAdmin;
00187 
00188     public:
00192         RecCountView(
00193                   QWidget* parent,
00194             const char*    name    = 0,
00195                   WFlags   flags   = 0
00196         );
00197 
00199         ~RecCountView();
00200 
00201     public:
00207         void showInfo(
00208             const OSB_LIB::RecordStreamInfo::Oid& rsId
00209         ) const;
00216         bool showByModule();
00223         bool showByStream();
00229         bool empty() const;
00235         bool noInfo() const;
00236 
00237     private:
00241         void clear();
00248         void readStreams(
00249             const OSB_DB::Session&             session,
00250             const OSB_LIB::RecordStreamFilter& filter
00251         );
00260         void readCa(
00261             const OSB_DB::Session& session
00262         );
00263 
00265         QSize contentsSize() const;
00267         void viewportResizeEvent(QResizeEvent* e);
00268 
00269     private:
00271         OSB_LIB::RecordStreams* rsList_;
00273         OSB_LIB::CaResults* caResults_;
00275         std::set<RecCounts*> recCounts_;
00281         mutable DlgStreamInfo* streamDlg_;
00283         BarChartInfo* chartInfo_;
00284     };                                  // class RecCountView
00285 
00290     class RecCounts : public BarChart {
00291     public:
00295         RecCounts(
00296                   BarChartInfo& chartInfo,
00297             const RecCountView* mgr,
00298                   QWidget*      parent,
00299             const char*         name       = 0,
00300                   WFlags        flags      = 0
00301         );
00302 
00303     public:
00311         void show(
00312             const OSB_LIB::RecordStreamInfo& rsInfo,
00313             const OSB_LIB::CaStreamResult&   caRes
00314         );
00315 
00323         void show(
00324             const OSB_LIB::CaModuleResult& modRes,
00325             const OSB_LIB::RecordStreams&  rsList
00326         );
00327 
00328     private:
00330         void mouseDoubleClickEvent(QMouseEvent* e);
00338         bool buildChart(
00339             const OSB_LIB::CaStreamResult& caRes
00340         );
00341         void buildRanges(
00342                   Ranges&            dest,
00343             const OSB_LIB::CaCounts& Counts,
00344             const double             numRecs
00345         );
00346 
00347     private:
00349         typedef OSB_LIB::Id<OSB_LIB::RecordStreamInfo> RsId;
00350 
00352         const RecCountView* mgr_;
00354         std::map<const QWidget*, RsId> rsMap_;
00355     };                                  // class RecCounts
00356 }                                       // namespace OSB_GUI
00357 
00358 // ************************************************************************
00359 // inline definitions
00360 namespace OSB_GUI {
00361 }                                       // namespace OSB_GUI
00362 #endif                                  // #ifndef _RECCNTS_H_

Generated on Sat Sep 2 14:17:37 2006 for OSB Library by  doxygen 1.4.7