QString LoodsmanSpecialFunction::convertString( QString startString, QByteArray startCodec, QByteArray endCodec){ QTextCodec *codec = QTextCodec::codecForName( startCodec ); QTextCodec *codec1 = QTextCodec::codecForName( endCodec ); QByteArray text; text.append(startString); startString = codec->toUnicode( text ); startString = codec1->fromUnicode( startString ); return startString;}QString LoodsmanSpecialFunction::createLinkObjectFromLoodsman(int idVers, QString nameDB){ nameDB = convertString(nameDB, "UTF-8", "Windows-1251"); QString string = "-|" + nameDB +"|0|" + QString().setNum(idVers); QByteArray text; text.append(string); QString link = QString("ask:Loodsman.URL?Action=Navigate,params=" + text.toBase64()); return link;}
C++ (Qt)QByteArray LoodsmanSpecialFunction::convertString( QString startString, // Это строка в UNICODE или должно быть QByteArray QByteArray endCodec){ QTextCodec *codec1 = QTextCodec::codecForName( endCodec ); return codec1->fromUnicode( startString );}
QByteArray LoodsmanSpecialFunction::baConvertString( QString startString, QByteArray startCodec, QByteArray endCodec){ QTextCodec *codec = QTextCodec::codecForName( startCodec ); QTextCodec *codec1 = QTextCodec::codecForName( endCodec ); QByteArray text; text.append(startString); startString = codec->toUnicode( text ); return codec1->fromUnicode( startString );}QString LoodsmanSpecialFunction::createLinkObjectFromLoodsman(int idVers, QString nameDB){ QString string = "-|" + nameDB +"|0|" + QString().setNum(idVers); QByteArray text = baConvertString(string, "UTF-8", "Windows-1251"); QString link = QString("ask:Loodsman.URL?Action=Navigate,params=" + text.toBase64()); return link;}