00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.16 $ 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 _DLGRFSLOT_H_ 00031 #define _DLGRFSLOT_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 00037 // + libraries 00038 00039 // + local headers 00040 #include "ui/rfslotgui.h" 00041 #include "dlgrf.h" 00042 00043 // ************************************************************************ 00044 // class declarations 00045 namespace OSB_GUI { 00046 class LeDecimal; 00047 } 00048 00049 namespace OSB_LIB { 00050 class Currency; 00051 class Unit; 00052 class RfSlot; 00053 } 00054 00055 // ************************************************************************ 00056 // namespace extensions 00057 namespace OSB_GUI { 00058 00059 // ************************************************************************ 00060 // forward declarations 00061 class RfSlotCharges; 00062 00063 // ************************************************************************ 00064 // type definitions 00065 00066 // ************************************************************************ 00067 // class definitions 00071 class DlgRfSlot : public DlgRfBase { 00072 public: 00074 DlgRfSlot( 00075 QWidget* parent, 00076 const char* name = "DlgRfSlot", 00077 bool modal = false, 00078 WFlags fl = 0 00079 ); 00080 public: 00081 // documentation from base class 00082 int showRf( 00083 const OSB_LIB::RatingFn& rf, 00084 const OSB_LIB::ChargeTraits& ct 00085 ); 00086 // documentation from base class 00087 int editRf( 00088 OSB_LIB::RatingFn* rf, 00089 OSB_LIB::ChargeTraits* ct 00090 ); 00091 // documentation from base class 00092 void languageChange(); 00093 private: 00094 // documentation from base class 00095 const OSB_LIB::RatingFn* getRf() const; 00096 00105 void display( 00106 const OSB_LIB::RfSlot& rf, 00107 const OSB_LIB::ChargeTraits& ct, 00108 bool showOnly 00109 ); 00110 private: 00112 const OSB_LIB::RfSlot* rfShown_; 00113 // Widget for the charges of the rating function. 00114 RfSlotCharges* chargeTab_; 00115 }; // class DlgRfSlot 00116 00120 class RfSlotCharges : public RfSlotChargesGui { 00121 Q_OBJECT // for vim ->; 00122 public: 00123 // forward declaration, defined below. 00124 class Charge; 00125 private: 00127 typedef std::list<Charge*> Charges; 00128 public: 00130 RfSlotCharges( 00131 QWidget* parent, 00132 const char* name = "rfSlotCharges_" 00133 ); 00135 ~RfSlotCharges(); 00136 public: 00138 void languageChange(); 00140 void setEnabled(bool on); 00142 void setCharges(const OSB_LIB::RfSlot& rf); 00144 void writeCharges(OSB_LIB::RfSlot* rf); 00145 public slots: 00147 void setCurrency(const OSB_LIB::Currency& c); 00149 void setUnit(const OSB_LIB::Unit& u); 00150 private: 00152 void setCurrencyText(); 00154 void setUnitText(); 00156 void buildChargeLayout(); 00158 void setTabs(); 00159 private slots: 00161 void insertEmpty(); 00168 void cleanCharges(); 00169 private: 00171 std::string currency_; 00173 std::string units_; 00175 Charges charges_; 00177 LeDecimal* leLastAmount_; 00178 }; // class RfSlotCharges 00179 00181 class RfSlotCharges::Charge { 00182 public: 00188 explicit Charge(QWidget* parent); 00190 void destroy() const; 00191 private: 00193 ~Charge(); 00194 public: 00196 void setEnabled(bool on); 00202 bool operator<(const Charge& rhs) const; 00204 bool empty() const; 00205 private: 00207 Charge(const Charge&); 00209 Charge& operator=(const Charge&); 00210 public: 00212 LeDecimal* leUpTo_; 00214 LeDecimal* leCharge_; 00215 }; // class RfSlotCharges 00216 } // namespace OSB_GUI 00217 00218 // ************************************************************************ 00219 // inline definitions 00220 namespace OSB_GUI { 00221 } // namespace OSB_GUI 00222 #endif // #ifndef _DLGRFSLOT_H_