void BtAboutDialog::init_lic_tab() { selectTab(4); setTabText(tr("License Agreement")); QByteArray text; text += tr("BibleTime is released under the GPL licence."); text += tr("You can download and use (but not distribute) the program for personal, private, public or commercial purposes without restrictions."); text += tr("You can give away or distribute the program if you also distribute the corresponding source code."); text += "<br><br>"; text += tr("The complete legally binding license is below."); QFile licFile(util::filesystem::DirectoryUtil::getLicenseDir().path() + "/license.html"); if (licFile.open(QFile::ReadOnly)) { QByteArray html; while (!licFile.atEnd()) { QByteArray line = licFile.readLine(); html = html + line; } licFile.close(); html.replace("TRANSLATED TEXT", text); setHtml(QString(html)); } }
/*! Reimplement this function to return true if \a licenseKey is a valid license for the class \a key, or if the current machine is licensed. The default implementation returns true if the class \a key is not licensed (ie. no \c Q_CLASSINFO() attribute "LicenseKey"), or if \a licenseKey matches the value of the "LicenseKey" attribute, or if the machine is licensed through a .LIC file with the same filename as this COM server. */ bool QAxFactory::validateLicenseKey(const QString &key, const QString &licenseKey) const { const QMetaObject *mo = metaObject(key); if (!mo) return true; QString classKey = QString::fromLatin1(mo->classInfo(mo->indexOfClassInfo("LicenseKey")).value()); if (classKey.isEmpty()) return true; if (licenseKey.isEmpty()) { QString licFile(QString::fromWCharArray(qAxModuleFilename)); int lastDot = licFile.lastIndexOf(QLatin1Char('.')); licFile = licFile.left(lastDot) + QLatin1String(".lic"); if (QFile::exists(licFile)) return true; return false; } return licenseKey == classKey; }
void BtAboutDialog::retranslateLicenceTab() { m_tabWidget->setTabText(4, tr("&License")); QFile licFile(util::directory::getLicenseDir().path() + "/license.html"); if (licFile.open(QFile::ReadOnly)) { QString text("<p>"); text += tr("BibleTime is released under the GPL license. You can download and use " "the program for personal, private, public or " "commercial purposes without restrictions, but can give away or " "distribute the program only if you also distribute the corresponding source " "code."); text += "</p><p>"; text += tr("The complete legally binding license is below."); text += "</p><hr/>"; QString content(QTextStream(&licFile).readAll().replace("<!-- TR TEXT -->", text)); content.replace("<!-- HEADER -->", MAKE_STYLE(m_licenceTab), Qt::CaseInsensitive); m_licenceTab->setHtml(content); licFile.close(); } }