Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

profile.cpp

Go to the documentation of this file.
00001 #include "profile.h"
00002 
00003 Profile::Profile() {
00004 
00005 }
00006 Profile::Profile( const QString& name,
00007                   const QCString& iolayerName,
00008                   const QCString& termName,
00009                   int background,
00010                   int foreground,
00011                   int terminal )
00012     : m_name( name ), m_ioLayer( iolayerName ), m_term( termName), m_autoConnect(0),
00013       m_back( background ), m_fore( foreground ), m_terminal( terminal )
00014 {}
00015 Profile::Profile( const Profile& prof )
00016 {
00017     (*this) = prof;
00018 }
00019 bool Profile::operator==( const Profile& prof ) {
00020     if ( m_name == prof.m_name ) return true;
00021 
00022     return false;
00023 }
00024 Profile &Profile::operator=( const Profile& prof ) {
00025     m_name = prof.m_name;
00026     m_ioLayer = prof.m_ioLayer;
00027     m_autoConnect = prof.m_autoConnect;
00028     m_back = prof.m_back;
00029     m_fore = prof.m_fore;
00030     m_terminal = prof.m_terminal;
00031     m_conf = prof.m_conf;
00032     m_term = prof.m_term;
00033 
00034     return *this;
00035 }
00036 Profile::~Profile() {
00037 }
00038 QMap<QString, QString> Profile::conf()const {
00039     return m_conf;
00040 }
00041 QString Profile::name()const {
00042     return m_name;
00043 }
00044 QCString Profile::ioLayerName()const {
00045     return m_ioLayer;
00046 }
00047 QCString Profile::terminalName( )const {
00048     return m_term;
00049 }
00050 bool Profile::autoConnect()const {
00051 
00052     return m_autoConnect;
00053 }
00054 int Profile::foreground()const {
00055     return m_fore;
00056 }
00057 int Profile::background()const {
00058     return m_back;
00059 }
00060 int Profile::terminal()const {
00061     return m_terminal;
00062 }
00063 void Profile::setName( const QString& str ) {
00064     m_name = str;
00065 }
00066 void Profile::setIOLayer( const QCString& name ) {
00067     m_ioLayer = name;
00068 }
00069 void Profile::setTerminalName( const QCString& str ) {
00070     m_term = str;
00071 }
00072 void Profile::setAutoConnect( const bool c) {
00073 
00074     m_autoConnect = c;
00075 }
00076 void Profile::setBackground( int back ) {
00077     m_back = back;
00078 }
00079 void Profile::setForeground( int fore ) {
00080     m_fore = fore;
00081 }
00082 void Profile::setTerminal( int term ) {
00083     m_terminal =  term;
00084 }
00085 /* config stuff */
00086 void Profile::clearConf() {
00087     m_conf.clear();
00088 }
00089 void Profile::writeEntry( const QString& key,  const QString& value ) {
00090     m_conf.replace( key, value );
00091 }
00092 void Profile::writeEntry( const QString& key, int num ) {
00093     writeEntry( key,  QString::number( num ) );
00094 }
00095 void Profile::writeEntry( const QString& key, bool b ) {
00096     writeEntry( key, QString::number(b) );
00097 }
00098 void Profile::writeEntry( const QString& key, const QStringList& lis, const QChar& sep ) {
00099     writeEntry( key, lis.join(sep) );
00100 }
00101 QString Profile::readEntry( const QString& key,  const QString& deflt )const {
00102     QMap<QString, QString>::ConstIterator it;
00103     it = m_conf.find( key );
00104 
00105     if ( it != m_conf.end() )
00106         return it.data();
00107 
00108     return deflt;
00109 }
00110 int Profile::readNumEntry( const QString& key, int def )const {
00111     QMap<QString, QString>::ConstIterator it;
00112     it = m_conf.find( key );
00113 
00114     if ( it != m_conf.end() ) {
00115         bool ok;
00116         int val = it.data().toInt(&ok);
00117 
00118         if (ok)
00119             return val;
00120     }
00121     return def;
00122 }
00123 bool Profile::readBoolEntry( const QString& key,  bool def )const {
00124     return readNumEntry( key, def );
00125 }
00126 void Profile::setConf( const QMap<QString, QString>& conf ) {
00127     m_conf = conf;
00128 };

Generated on Sat Nov 5 16:16:50 2005 for OPIE by  doxygen 1.4.2