Exemplo n.º 1
0
void GoogleTranslator::apply(QString* item, QString translatedValue, TranslationType transType)
{
    QString value = *item;
    QString rxString = "";
    switch(transType)
    {
    case ttMonthName:
        rxString = "(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)";
        break;
    case ttDayName:
        rxString = "(Mon(?:day)?|Tue(?:sday)?|Wed(?:nesday)?|Thu(?:rsday)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)";
        break;
    default:
        addToCache(value, translatedValue);
        value = fixCaps(translatedValue.trimmed());
        break;
    }
    if(rxString!="")
    {
        QRegExp rx(rxString);
        if(rx.indexIn(value)!=-1)
        {
            QString translation = translatedValue.trimmed();
            translation = fixCaps(translation);
            addToCache(fullDateName(rx.cap(0)), translation);
            if(transType == ttDayName)
                translation = translation.left(3);
            value = value.replace(rx, translation);
        }
    }

    *item = value;
}
Exemplo n.º 2
0
void
E6Irc::fixCaps (QObject * root)
{
  if (root) {
    objectCount++;
    QVariant suppressVar = root->property ("noInitialCaps");
    if (suppressVar.isValid()) {
      qDebug () << "found property on " << root ;
      qDebug () << suppressVar;
      if (suppressVar.type() == QVariant::Bool) {
        bool suppress = suppressVar.toBool();
        if (suppress) {
          QDeclarativeItem * item = qobject_cast<QDeclarativeItem*> (root);
          if (item) {
            item->setInputMethodHints (Qt::ImhNoAutoUppercase);
          }
        }
      }
    }
    QObjectList children = root->children();
    for (int i=0; i<children.count(); i++) {
      fixCaps (children.at(i));
    }
  }
}
Exemplo n.º 3
0
void
E6Irc::run (const QSize & desktopSize)
{
  CertStore::IF().Init();
  control->fillContext(isProbablyPhone);
  setSource (QUrl ("qrc:///qml/Main.qml"));
  channelGroup->Start();
  control->Run ();
  QObject * qmlRoot = rootObject();
  QDeclarativeItem * qmlItem = qobject_cast<QDeclarativeItem*> (qmlRoot);
  if (qmlItem) {
    qDebug () << __PRETTY_FUNCTION__ << " phone ? " << isProbablyPhone;
    QMetaObject::invokeMethod (qmlItem, "phoneSettings",
      Q_ARG (QVariant, isProbablyPhone));
  }
  if (!isFullScreen()) {
    QSize defaultSize = size();
    QSize newsize = Settings().value ("sizes/e6irc", defaultSize).toSize();
    if (newsize.isEmpty()) {
      showMaximized();
      newsize = desktopSize;
      resize (newsize);
    } else {
      resize (newsize);
    }
    qDebug () << __PRETTY_FUNCTION__ << " resize to " << newsize
              << " result is " << size();
  }
  show ();
  Settings().sync ();
  objectCount = 0;
  fixCaps (qmlRoot);
  qDebug () << objectCount << " objects";
}