Diffstat (limited to 'libopie2/opiecore/oconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oconfig.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiecore/oconfig.cpp b/libopie2/opiecore/oconfig.cpp index 05d8070..6b57729 100644 --- a/libopie2/opiecore/oconfig.cpp +++ b/libopie2/opiecore/oconfig.cpp @@ -20,186 +20,188 @@ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* QT */ #include <qfont.h> #include <qcolor.h> /* OPIE */ #include <opie2/oconfig.h> using namespace Opie::Core; OConfig::OConfig( const QString &name, Domain domain ) :Config( name, domain ) { qDebug( "OConfig::OConfig()" ); } OConfig::~OConfig() { qDebug( "OConfig::~OConfig()" ); } QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const { QColor aRetColor; int nRed = 0, nGreen = 0, nBlue = 0; QString aValue = readEntry( key ); if( !aValue.isEmpty() ) { if ( aValue.at(0) == '#' ) { aRetColor.setNamedColor(aValue); } else { bool bOK; // find first part (red) int nIndex = aValue.find( ',' ); if( nIndex == -1 ) { // return a sensible default -- Bernd if( pDefault ) aRetColor = *pDefault; return aRetColor; } nRed = aValue.left( nIndex ).toInt( &bOK ); // find second part (green) int nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ) { // return a sensible default -- Bernd if( pDefault ) aRetColor = *pDefault; return aRetColor; } nGreen = aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toInt( &bOK ); // find third part (blue) nBlue = aValue.right( aValue.length()-nIndex-1 ).toInt( &bOK ); aRetColor.setRgb( nRed, nGreen, nBlue ); } } else { if( pDefault ) aRetColor = *pDefault; } return aRetColor; } // FIXME: The whole font handling has to be revised for Opie QFont OConfig::readFontEntry( const QString& key, const QFont* pDefault ) const { + Q_CONST_UNUSED( key ) + Q_CONST_UNUSED( pDefault ) /* QFont aRetFont; QString aValue = readEntry( key ); if( !aValue.isNull() ) { if ( aValue.contains( ',' ) > 5 ) { // KDE3 and upwards entry if ( !aRetFont.fromString( aValue ) && pDefault ) aRetFont = *pDefault; } else { // backward compatibility with older font formats // ### remove KDE 3.1 ? // find first part (font family) int nIndex = aValue.find( ',' ); if( nIndex == -1 ){ if( pDefault ) aRetFont = *pDefault; return aRetFont; } aRetFont.setFamily( aValue.left( nIndex ) ); // find second part (point size) int nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ){ if( pDefault ) aRetFont = *pDefault; return aRetFont; } aRetFont.setPointSize( aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toInt() ); // find third part (style hint) nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ){ if( pDefault ) aRetFont = *pDefault; return aRetFont; } aRetFont.setStyleHint( (QFont::StyleHint)aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() ); // find fourth part (char set) nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ){ if( pDefault ) aRetFont = *pDefault; return aRetFont; } QString chStr=aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ); // find fifth part (weight) nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ){ if( pDefault ) aRetFont = *pDefault; return aRetFont; } aRetFont.setWeight( aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() ); // find sixth part (font bits) uint nFontBits = aValue.right( aValue.length()-nIndex-1 ).toUInt(); aRetFont.setItalic( nFontBits & 0x01 ); aRetFont.setUnderline( nFontBits & 0x02 ); aRetFont.setStrikeOut( nFontBits & 0x04 ); aRetFont.setFixedPitch( nFontBits & 0x08 ); aRetFont.setRawMode( nFontBits & 0x20 ); } } else { if( pDefault ) aRetFont = *pDefault; } return aRetFont; */ return QFont("Helvetica",10); } |