Ejemplo n.º 1
0
HelpBrowser::HelpBrowser(QWidget *parent) : QTextBrowser(parent) {
#ifdef Q_OS_MAC
  const QString &_creatorTrPath = QCoreApplication::applicationDirPath();
  QDir trPath(_creatorTrPath);

  trPath.cdUp();
  const QString &creatorTrPath = trPath.path();
  QString helpFileAndPath = QString(creatorTrPath);

  helpFileAndPath.append(QDir::separator());
  helpFileAndPath.append(QLatin1String("Resources"));
#else
  const QString &creatorTrPath = QCoreApplication::applicationDirPath();
  QString helpFileAndPath = QString(creatorTrPath);
#endif

  QString collectionFile = helpFileAndPath + QLatin1String("/help/help.qch");

  qCDebug(helpSystem, "HelpPath: %s ", collectionFile.toUtf8().constData());

  m_helpEngine = new QHelpEngine(collectionFile, this);
  if (!m_helpEngine->setupData()) {
    delete m_helpEngine;
    m_helpEngine = nullptr;
  }
}
Ejemplo n.º 2
0
QList<QPair<QString, QString> > Translator::loadTranslationFiles()
{
    language = tr("English");
    QTranslator transl;

    QDir trPath(m_loc);
    QStringList fileNames = trPath.entryList(QStringList() << "*.qm", QDir::Files, QDir::Name);

    QList<QPair<QString, QString> > langsList;
    QPair<QString, QString> lang;

    for (int i = 0; i < fileNames.count(); i++) {
        lang.first = fileNames.at(i);

        transl.load(fileNames.at(i), m_loc);
        lang.second = transl.translate("Translator", "English");

        langsList << lang;
    }
    return langsList;
}