serviceutils.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.9 $
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 _SERVICEUTILS_H_
00031 #define _SERVICEUTILS_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <string>
00037 
00038 // + libraries
00039 #include <osbid.h>
00040 #include <service.h>
00041 #include <qlistview.h>
00042 #include <qlineedit.h>
00043 
00044 // + local headers
00045 
00046 // ************************************************************************
00047 // class declarations
00048 namespace OSB_LIB {
00049     class ServiceElement;
00050 }
00051 
00052 // ************************************************************************
00053 // namespace extensions
00054 namespace OSB_GUI {
00055 
00056 // ************************************************************************
00057 // forward declarations
00058 
00059 // ************************************************************************
00060 // type definitions
00061 
00062 // ************************************************************************
00063 // free functions
00065     std::string seToText(
00066         const OSB_LIB::ServiceElement& se
00067     );
00068 
00070     std::string seTypeToText(
00071         OSB_LIB::ServiceElement::ServiceType seType,
00072         bool                                 plural
00073     );
00074 
00075 // ************************************************************************
00076 // class definitions
00080     class LvServiceTree : public QListView {
00082         class Item;
00083     public:
00085         explicit LvServiceTree(
00086                   QWidget* parent,
00087             const char*    name   = "lvServiceTree_",
00088                   WFlags   flags  = 0
00089         );
00097         OSB_LIB::ServiceElement se() const;
00104         void setSeId(
00105             const OSB_LIB::ServiceElement::Oid& seId
00106         );
00108         void populate();
00109     private:
00118         Item* find(
00119             const OSB_LIB::ServiceElement::Oid& seId,
00120                   QListViewItem*                fc
00121         );
00122     };                                  // class LvServiceTree
00123 
00127     class LvServiceTree::Item : public QListViewItem {
00128     public:
00130         Item(
00131                   LvServiceTree*           parent,
00132             const OSB_LIB::ServiceElement& se
00133         );
00135         Item(
00136                   Item*                    parent,
00137             const OSB_LIB::ServiceElement& se
00138         );
00140         const OSB_LIB::ServiceElement::Oid seId() const;
00142         const OSB_LIB::ServiceElement& se() const;
00143     private:
00145         OSB_LIB::ServiceElement se_;
00146     };
00147 
00151     class SelectSe : public QWidget {
00152         Q_OBJECT                        // for vim ->;
00153     public:
00160         explicit SelectSe(
00161                   QWidget* parent,
00162             const char*    name    = "selectCp_",
00163                   WFlags   flags   = Qt::WType_Popup
00164         );
00165     public:
00172         void popup(
00173                   QWidget*                      served,
00174             const OSB_LIB::ServiceElement::Oid& seId
00175         );
00181         bool result() const;
00183         bool keyClosed() const;
00185         QWidget* prevServed() const;
00187         void resetPrevServed();
00189 
00190 
00196         const OSB_LIB::ServiceElement se() const;
00203         void setSeId(
00204             const OSB_LIB::ServiceElement::Oid& seId
00205         );
00207         void populate();
00209     signals:
00216         void sigClosed(bool result);
00217     private:
00219         void closeEvent(QCloseEvent* event);
00226         void keyPressEvent(QKeyEvent* event);
00232         void resizeEvent(QResizeEvent* event);
00233     private:
00235         bool result_;
00237         QWidget* prevServed_;
00246         bool keyClosed_;
00248         LvServiceTree* lv_;
00250         QWidget* served_;
00251     };                                  // class SelectSe
00252 
00256     class LeServiceElement : public QLineEdit {
00257         Q_OBJECT                        // for vim ->;
00258     public:
00260         explicit LeServiceElement(
00261                   QWidget* parent,
00262             const char*    name   = "leSe_"
00263         );
00264     public:
00266         const OSB_LIB::ServiceElement& se() const;
00268         bool haveSe() const;
00274         void setSe(const OSB_LIB::ServiceElement& se);
00281         void setText(const OSB_LIB::ServiceElement& se);
00283         void clear();
00285         void setSelectSe(SelectSe* selectSe);
00286     signals:
00288         void seChanged();
00289     private:
00291         void focusInEvent(QFocusEvent* event);
00293         void keyPressEvent(QKeyEvent* event);
00295         void mousePressEvent(QMouseEvent* event);
00296     private slots:
00298         void selectSe();
00300         void selectSeClosed(bool result);
00301     private:
00303         OSB_LIB::ServiceElement se_;
00305         SelectSe* selectSe_;
00306     };                                  // LeServiceElement
00307 }                                       // namespace OSB_GUI
00308 
00309 // ************************************************************************
00310 // inline definitions
00311 namespace OSB_GUI {
00312 }                                       // namespace OSB_GUI
00313 #endif                                  // #ifndef _SERVICEUTILS_H_

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