streamadmin.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.29 $
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 _RSADMIN_H_
00031 #define _RSADMIN_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <set>
00037 
00038 // + libraries
00039 #include <recordstream.h>
00040 #include <qlistview.h>
00041 
00042 // + local headers
00043 #include "adminwidget.h"
00044 
00045 // + class declarations
00046 namespace OSB_LIB {
00047     class RecordStreamFilter;
00048     class RecordStreams;
00049 }
00050 
00051 namespace OSB_GUI {
00052     class StreamStatusPopup;            // streamutils.h
00053     class DlgStreamInfo;                // dlgstreaminfo.h
00054 }
00055 
00056 // Qt
00057 class QButton;
00058 class QLabel;
00059 class QHBoxLayout;
00060 class QPushButton;
00061 class QSpacerItem;
00062 class QSpinBox;
00063 class QVBoxLayout;
00064 
00065 // ************************************************************************
00066 // namespace extensions
00067 namespace OSB_GUI {
00068 
00069 // ************************************************************************
00070 // forward declarations
00071     class LvRecordStream;
00072 
00073 // ************************************************************************
00074 // type definitions
00075 
00076 // ************************************************************************
00077 // class definitions
00081     class RecordStreamAdmin : public AdminWidget
00082     {
00083         Q_OBJECT                        // for vim ->;
00084     public:
00086         static const int afMenuId_ = 10;
00088         enum MenuCmd {
00090             cmdDetail  = 1,
00092             cmdStatus  = 2,
00094             cmdFilter  = 3,
00096             cmdRefresh = 4,
00098             optAllStatus = 5,
00099 
00101             afReady = 11,
00103             afProcessing = 12,
00105             afManual = 13
00106         };
00107 
00108     public:
00113         RecordStreamAdmin(
00114                   AdminType type,
00115                   QWidget*  parent,
00116             const char*     name   = 0,
00117                   WFlags    flags  = 0
00118         );
00119 
00120     public:
00121         // documentation from base class
00122         std::string menuTitle() const;
00123         // documentation from base class
00124         QPopupMenu* menu();
00125         // documentation from base class
00126         void clearMenuAccels();
00127 
00128     public slots:
00130         void languageChange();
00132         void setPushButtons();
00134         void changeStatus(bool fromMenu = false);
00136         void menuEvent(int cmd);
00138         void setRefreshTimer(int value);
00139 
00140     private:
00142         void buildMenues();
00144         void timerEvent(QTimerEvent* event);
00145 
00146     private:
00148         int refreshTimer_;
00150         std::set<OSB_LIB::RecordStream::Status> afStatus_;
00151 
00153         QPopupMenu* menu_;
00155         QPopupMenu* afMenu_;
00157         LvRecordStream* lvRs_;
00159         QFrame* linePb_;
00161         QPushButton* pbDetail_;
00163         QPushButton* pbStatus_;
00165         QSpacerItem* spPb_;
00167         QLabel* tlRefresh_;
00169         QSpinBox* sbRefresh_;
00171         QPushButton* pbFilter_;
00172 
00174         QVBoxLayout* layout_;
00176         QHBoxLayout* loPb_;
00177     };                                  // class RecordStreamAdmin
00178 
00182     class LvRecordStream : public QListView {
00183         Q_OBJECT                        // for vim ->;
00184     public:
00186         LvRecordStream(
00187                   QWidget*  parent,
00188             const char*     name   = 0,
00189                   WFlags    flags  = 0
00190         );
00192         ~LvRecordStream();
00193     public:
00195         void languageChange();
00202         const OSB_LIB::RecordStreamInfo* selectedStream() const;
00210         void selectStatus(const QButton* button);
00212         bool allowAllStatus() const;
00214         void setAllowAllStatus(bool on);
00216         void refresh(const OSB_LIB::RecordStreamInfo& rsInfo);
00218         void read(
00219             const std::set<OSB_LIB::RecordStream::Status>& stats
00220         );
00221 
00222    public slots:
00224         void showDetails();
00226         void filter();
00228         void changeStatus(
00229             OSB_LIB::RecordStream::Status newStatus
00230         );
00232         void refreshAll();
00233 
00234     private slots:
00236         void infoDone(const DlgStreamInfo* dlg);
00238         void readErrorStreams();
00240         void selectStatus(QListViewItem*, const QPoint& pos);
00241 
00242     private:
00244         void polish();
00246         void readStreams();
00248         void populate();
00255         void showInfo(
00256                   DlgStreamInfo*             dlg,
00257             const OSB_LIB::RecordStreamInfo& rsInfo
00258         );
00259     private:
00261         OSB_LIB::RecordStreams* rsList_;
00263         OSB_LIB::RecordStreamFilter* rsFilter_;
00265         std::set<DlgStreamInfo*> dlgs_;
00267         StreamStatusPopup* popup_;
00269         bool allowAllStatus_;
00270     };                                  // class LvRecordStream
00271 
00275     class RecordStreamItem : public QListViewItem {
00276     public:
00282         enum Type {
00283             rsMatched = 2, 
00284             rsParent  = 1, 
00285             rsChild   = 0, 
00286         };
00287     public:
00289         RecordStreamItem(
00290                   Type                       type,
00291                   QListView*                 parent,
00292             const OSB_LIB::RecordStreamInfo& rsInfo,
00293             const OSB_LIB::RecordStreams&    rsList
00294         );
00296         RecordStreamItem(
00297                   Type                       type,
00298                   QListViewItem*             parent,
00299             const OSB_LIB::RecordStreamInfo& rsInfo,
00300             const OSB_LIB::RecordStreams&    rsList
00301         );
00302     public:
00304         const OSB_LIB::RecordStreamInfo& rsInfo() const;
00306         void setRsInfo(
00307             const OSB_LIB::RecordStreamInfo& rsInfo
00308         );
00314         void refresh(
00315             const OSB_LIB::RecordStreamInfo& rsInfo
00316         );
00317     private:
00319         void setup();
00321         void setItem();
00323         bool canOpen() const;
00325         void setOpen(bool open);
00327         void paintCell(
00328                   QPainter*    p,
00329             const QColorGroup& cg,
00330                   int          col,
00331                   int          width,
00332                   int          align
00333         );
00342         int compare(QListViewItem* item, int col, bool asc) const;
00343     private:
00345         Type type_;
00347         OSB_LIB::RecordStreamInfo rsInfo_;
00349         const OSB_LIB::RecordStreams& rsList_;
00350     };                                  // class RecordStreamItem
00351 }                                       // namespace OSB_GUI
00352 
00353 // ************************************************************************
00354 // inline definitions
00355 namespace OSB_GUI {
00356 }                                       // namespace OSB_GUI
00357 #endif                                  // #ifndef _RSADMIN_H_

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