introduce functions for ToBase64 and FromBase64 for cleaner code

This commit is contained in:
Volker Fischer 2013-12-14 22:09:59 +00:00
parent b66e22379a
commit 6034dab1b3
2 changed files with 17 additions and 12 deletions

View file

@ -236,20 +236,20 @@ void CSettings::Load()
}
// window position of the main window
pClient->vecWindowPosMain = QByteArray().fromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposmain" ).toLatin1() );
pClient->vecWindowPosMain = FromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposmain" ) );
// window position of the settings window
pClient->vecWindowPosSettings = QByteArray().fromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposset" ).toLatin1() );
pClient->vecWindowPosSettings = FromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposset" ) );
// window position of the chat window
pClient->vecWindowPosChat = QByteArray().fromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposchat" ).toLatin1() );
pClient->vecWindowPosChat = FromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposchat" ) );
// window position of the connect window
pClient->vecWindowPosConnect = QByteArray().fromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposcon" ).toLatin1() );
pClient->vecWindowPosConnect = FromBase64 (
GetIniSetting ( IniXMLDocument, "client", "winposcon" ) );
// visibility state of the settings window
if ( GetFlagIniSet ( IniXMLDocument, "client", "winvisset", bValue ) )
@ -429,19 +429,19 @@ void CSettings::Save()
// window position of the main window
PutIniSetting ( IniXMLDocument, "client", "winposmain",
QString().fromLatin1 ( pClient->vecWindowPosMain.toBase64() ) );
ToBase64 ( pClient->vecWindowPosMain ) );
// window position of the settings window
PutIniSetting ( IniXMLDocument, "client", "winposset",
QString().fromLatin1 ( pClient->vecWindowPosSettings.toBase64() ) );
ToBase64 ( pClient->vecWindowPosSettings ) );
// window position of the chat window
PutIniSetting ( IniXMLDocument, "client", "winposchat",
QString().fromLatin1 ( pClient->vecWindowPosChat.toBase64() ) );
ToBase64 ( pClient->vecWindowPosChat ) );
// window position of the connect window
PutIniSetting ( IniXMLDocument, "client", "winposcon",
QString().fromLatin1 ( pClient->vecWindowPosConnect.toBase64() ) );
ToBase64 ( pClient->vecWindowPosConnect ) );
// visibility state of the settings window
SetFlagIniSet ( IniXMLDocument, "client", "winvisset",

View file

@ -53,6 +53,11 @@ public:
protected:
void SetFileName ( const QString& sNFiName );
QString ToBase64 ( const QByteArray strIn ) const
{ return QString::fromLatin1 ( strIn.toBase64() ); }
QByteArray FromBase64 ( const QString strIn ) const
{ return QByteArray::fromBase64 ( strIn.toLatin1() ); }
// init file access function for read/write
void SetNumericIniSet ( QDomDocument& xmlFile,
const QString& strSection,