示例#1
0
QBBSystemLocaleData::QBBSystemLocaleData()
    : languageNotifier(0)
    , regionNotifier(0)
    , measurementNotifier(0)
    , hourNotifier(0)
{
    // Do not use qWarning to log warnings if qt_safe_open fails to open the pps file
    // since the user code may install a message handler that invokes QLocale API again
    // (i.e QDate, QDateTime, ...) which will cause an infinite loop.
    if ((measurementFd = qt_safe_open(ppsUomPath, O_RDONLY)) == -1)
        fprintf(stderr, "Failed to open uom pps, errno=%d\n", errno);

    if ((regionFd = qt_safe_open(ppsRegionLocalePath, O_RDONLY)) == -1)
        fprintf(stderr, "Failed to open region pps, errno=%d\n", errno);

    if ((languageFd = qt_safe_open(ppsLanguageLocalePath, O_RDONLY)) == -1)
        fprintf(stderr, "Failed to open language pps, errno=%d\n", errno);

    if ((hourFd = qt_safe_open(ppsHourFormatPath, O_RDONLY)) == -1)
       fprintf(stderr, "Failed to open hour format pps, errno=%d\n", errno);

    // we cannot call this directly, because by the time this constructor is
    // called, the event dispatcher has not yet been created, causing the
    // subsequent call to QSocketNotifier constructor to fail.
    QMetaObject::invokeMethod(this, "installSocketNotifiers", Qt::QueuedConnection);

    readLangageLocale();
    readRegionLocale();
    readMeasurementSystem();
    readHourFormat();
}
示例#2
0
QBBSystemLocaleData::QBBSystemLocaleData()
    : languageNotifier(0)
    , regionNotifier(0)
    , measurementNotifier(0)
    , hourNotifier(0)
{
    if ((measurementFd = qt_safe_open(ppsUomPath, O_RDONLY)) == -1)
        qWarning("Failed to open uom pps, errno=%d", errno);

    if ((regionFd = qt_safe_open(ppsRegionLocalePath, O_RDONLY)) == -1)
        qWarning("Failed to open region pps, errno=%d", errno);

    if ((languageFd = qt_safe_open(ppsLanguageLocalePath, O_RDONLY)) == -1)
        qWarning("Failed to open language pps, errno=%d", errno);

    if ((hourFd = qt_safe_open(ppsHourFormatPath, O_RDONLY)) == -1)
        qWarning("Failed to open hour format pps, errno=%d", errno);

    // we cannot call this directly, because by the time this constructor is
    // called, the event dispatcher has not yet been created, causing the
    // subsequent call to QSocketNotifier constructor to fail.
    QMetaObject::invokeMethod(this, "installSocketNotifiers", Qt::QueuedConnection);

    readLangageLocale();
    readRegionLocale();
    readMeasurementSystem();
    readHourFormat();
}