UserLicenceKey::UserLicenceKey( uint32 id, const MC2String& licenceKey, const MC2String& product, const MC2String& keyType ) : UserElement( UserConstants::TYPE_LICENCE_KEY ), m_licenceKey( NULL ), m_licenceLength( 0 ), m_product( product ), m_keyType( keyType ) { m_id = id; setLicence( licenceKey ); //will set some indexes of m_changed to true setOk( true ); for( uint8 i = 0; i < UserConstants::USER_LICENCE_KEY_NBRFIELDS ; ++i){ m_changed[ i ] = false; } }
int FRModel::setLicence(const QString &license) { int result = hw->hw()->ECR_SetMode(0); if (!result) hw->hw()->ECR_SetLicense(4, codec->fromUnicode(license)); result = err->analizeError(result); switch (result) { case 0: updateInformation(); break; case 1: waitForRelease(); result = setLicence(license); break; default: emit signalFail(generateErrorMessage(conv("Ошибка установки лицензии."), result)); } return result; }
void UserLicenceKey::setLicence( const MC2String& licenceKey ) { setLicence( reinterpret_cast<const byte*>( licenceKey.c_str() ), licenceKey.length() ); }
bool UserLicenceKey::readDataChanges( const Packet* p, int& pos ) { if ( p->getLength() - pos - 1 > 0 ) { byte nbrFields; nbrFields = p->incReadByte( pos ); // tmpdata uint32 licenceLength = m_licenceLength; const byte* licenceKey = m_licenceKey; MC2String product = m_product; MC2String keyType = m_keyType; byte field; bool ok = true; for ( uint8 i = 0 ; (i < nbrFields) && ok && (pos < (int32)p->getLength()) ; i ++ ) { field = p->incReadByte( pos ); switch ( field ) { case UserConstants::USER_LICENCE_KEY : m_changed[ UserConstants::USER_LICENCE_KEY ] = true; licenceLength = p->incReadShort( pos ); licenceKey = p->incReadByteArray( pos, licenceLength ); break; case UserConstants::USER_LICENCE_PRODUCT : m_changed[ UserConstants::USER_LICENCE_PRODUCT ] = true; product = p->incReadString( pos ); break; case UserConstants::USER_LICENCE_KEY_TYPE : m_changed[ UserConstants::USER_LICENCE_KEY_TYPE ] = true; keyType = p->incReadString( pos ); break; default: mc2log << error << "UserLicenceKey::readDataChanges unknown " << "fieldType: " << (int)field << endl; ok = false; break; } } uint32 type = p->incReadLong( pos ); if ( type != UserConstants::TYPE_LICENCE_KEY ) { mc2log << error << "UserLicenceKey::readDataChanges Not LicenceKey " << " type after data" << endl; ok = false; } if ( ok ) { // Transfer changes to membervariables if ( m_changed[ UserConstants::USER_LICENCE_KEY] ) { setLicence( licenceKey, licenceLength ); } m_product = product; m_keyType = keyType; return ok; } else { mc2log << error << "UserLicenceKey::readDataChanges failed" << endl; return false; } } else { mc2log << error << "UserLicenceKey::readDataChanges no space for changes" << endl; return false; } }
QgsAbout::QgsAbout( QWidget *parent ) : QDialog( parent, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only #else QgsAbout::QgsAbout( QWidget *parent ) : QDialog( parent ) // Normal dialog in non Mac-OS #endif { setupUi( this ); init(); } QgsAbout::~QgsAbout() { } void QgsAbout::init() { setPluginInfo(); setWindowTitle( QString( "%1 - %2 Bit" ).arg( windowTitle() ).arg( QSysInfo::WordSize ) ); // set the 60x60 icon pixmap QPixmap icon( QgsApplication::iconsPath() + "qgis-icon-60x60.png" ); qgisIcon->setPixmap( icon ); //read the authors file to populate the svn committers list QStringList lines; // // Load the authors (svn committers) list // QFile file( QgsApplication::authorsFilePath() ); if ( file.open( QIODevice::ReadOnly ) ) { QTextStream stream( &file ); // Always use UTF-8 stream.setCodec( "UTF-8" ); QString line; while ( !stream.atEnd() ) { line = stream.readLine(); // line of text excluding '\n' //ignore the line if it starts with a hash.... if ( line.left( 1 ) == "#" ) continue; QStringList myTokens = line.split( "\t", QString::SkipEmptyParts ); lines << myTokens[0]; } file.close(); lstDevelopers->clear(); lstDevelopers->insertItems( 0, lines ); if ( lstDevelopers->count() > 0 ) { lstDevelopers->setCurrentRow( 0 ); } } lines.clear(); // // Now load up the contributors list // QFile file2( QgsApplication::contributorsFilePath() ); printf( "Reading contributors file %s.............................................\n", file2.fileName().toLocal8Bit().constData() ); if ( file2.open( QIODevice::ReadOnly ) ) { QTextStream stream( &file2 ); // Always use UTF-8 stream.setCodec( "UTF-8" ); QString line; while ( !stream.atEnd() ) { line = stream.readLine(); // line of text excluding '\n' //ignore the line if it starts with a hash.... if ( line.left( 1 ) == "#" ) continue; lines += line; } file2.close(); lstContributors->clear(); lstContributors->insertItems( 0, lines ); if ( lstContributors->count() > 0 ) { lstContributors->setCurrentRow( 0 ); } } // read the DONORS file and populate the text widget QFile donorsFile( QgsApplication::donorsFilePath() ); #ifdef QGISDEBUG printf( "Reading donors file %s.............................................\n", donorsFile.fileName().toLocal8Bit().constData() ); #endif if ( donorsFile.open( QIODevice::ReadOnly ) ) { QString donorsHTML = "" + tr( "<p>For a list of individuals and institutions who have contributed " "money to fund QGIS development and other project costs see " "<a href=\"http://qgis.org/en/sponsorship/donors.html\">" "http://qgis.org/en/sponsorship/donors.html</a></p>" ); #if 0 QString website; QTextStream donorsStream( &donorsFile ); // Always use UTF-8 donorsStream.setCodec( "UTF-8" ); QString sline; while ( !donorsStream.atEnd() ) { sline = donorsStream.readLine(); // line of text excluding '\n' //ignore the line if it starts with a hash.... if ( sline.left( 1 ) == "#" ) continue; QStringList myTokens = sline.split( "|", QString::SkipEmptyParts ); if ( myTokens.size() > 1 ) { website = "<a href=\"" + myTokens[1].remove( ' ' ) + "\">" + myTokens[1] + "</a>"; } else { website = " "; } donorsHTML += "<tr>"; donorsHTML += "<td>" + myTokens[0] + "</td><td>" + website + "</td>"; // close the row donorsHTML += "</tr>"; } donorsHTML += "</table>"; #endif QString myStyle = QgsApplication::reportStyleSheet(); txtDonors->clear(); txtDonors->document()->setDefaultStyleSheet( myStyle ); txtDonors->setHtml( donorsHTML ); QgsDebugMsg( QString( "donorsHTML:%1" ).arg( donorsHTML.toAscii().constData() ) ); } // read the TRANSLATORS file and populate the text widget QFile translatorFile( QgsApplication::translatorsFilePath() ); #ifdef QGISDEBUG printf( "Reading translators file %s.............................................\n", translatorFile.fileName().toLocal8Bit().constData() ); #endif if ( translatorFile.open( QIODevice::ReadOnly ) ) { QString translatorHTML = ""; QTextStream translatorStream( &translatorFile ); // Always use UTF-8 translatorStream.setCodec( "UTF-8" ); QString myStyle = QgsApplication::reportStyleSheet(); translatorHTML += "<style>" + myStyle + "</style>"; while ( !translatorStream.atEnd() ) { translatorHTML += translatorStream.readLine(); } txtTranslators->setHtml( translatorHTML ); QgsDebugMsg( QString( "translatorHTML:%1" ).arg( translatorHTML.toAscii().constData() ) ); } setWhatsNew(); setLicence(); }