Beispiel #1
0
String platformDefaultLanguage()
{
    static String computedDefaultLanguage;
    if (!computedDefaultLanguage.isEmpty())
        return computedDefaultLanguage;

    String languageName = localeInfo(LOCALE_SISO639LANGNAME, "en");
    String countryName = localeInfo(LOCALE_SISO3166CTRYNAME, String());

    if (countryName.isEmpty())
        computedDefaultLanguage = languageName;
    else
        computedDefaultLanguage = makeString(languageName, '-', countryName);

    return computedDefaultLanguage;
}
Beispiel #2
0
String defaultLanguage()
{
    static String computedDefaultLanguage;
    if (!computedDefaultLanguage.isEmpty())
        return computedDefaultLanguage;

    String languageName = localeInfo(LOCALE_SISO639LANGNAME, "en");
    String countryName = localeInfo(LOCALE_SISO3166CTRYNAME, String());

    if (countryName.isEmpty())
        computedDefaultLanguage = languageName;
    else
        computedDefaultLanguage = String::format("%s-%s", languageName.latin1().data(), countryName.latin1().data());

    return computedDefaultLanguage;
}
Beispiel #3
0
void MT500::getConfig()
{
    QString line;
    int count = 0;
    QString filename = "/home/administrator/Desktop/MT500/config.dat";
    QFile file(filename);
    if (file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QTextStream in(&file);
        while (!in.atEnd()) {
            line = in.readLine();
            count++;
            if(count == 4) heartbeatInterval = line.trimmed().toInt(); //Get hb interval
            else if(count == 7) { //Get interest list
                if(!line.trimmed().isEmpty()) {
                    getFiles = line.trimmed().split(",");
                }
            }
            else if(count == 13) {
                fipsInterval = line.trimmed().toInt();
            }
            else if(count == 16) { //COM in
                QStringList comIN;
                comIN = line.trimmed().split(":");
                COMin = comIN.at(0);
                inBaud = comIN.at(1).toInt();
            }
            else if(count == 19) { //COM out
                QStringList comOUT;
                comOUT = line.trimmed().split(":");
                COMout = comOUT.at(0);
                outBaud = comOUT.at(1).toInt();
            }
            else if(count == 22) ipConfig = line.trimmed(); //IP Config
            else if(count == 25) fipsDir = line.trimmed(); //Fips Directory
            else if(count == 31) {
                int begin = 0;
                int end = 0;
                QStringList pairs;
                QStringList range;
                QString temp;
                QString filterStr = line.trimmed();
                QStringList filterArr = filterStr.split(",");
                for(int i = 0; i < filterArr.size(); i++) {
                    temp = filterArr.at(i);
                    pairs = temp.trimmed().split(":");
					if(pairs.size() > 1) {
						if(pairs.at(1).contains("-")) {
							range = pairs.at(1).trimmed().split("-");
							begin = range.at(0).trimmed().toInt();
							end = range.at(1).trimmed().toInt();
							for(int i = begin; i <= end; i++) {
								filterList.insertMulti(pairs.at(0).trimmed(), QString::number(i));
							}
						}
						else filterList.insertMulti(pairs.at(0).trimmed(),pairs.at(1).trimmed());
					}
                }
            }
        }
    }
    else if(log) MTLOG(QString("Failed to open file %1").arg(filename));
    ///////////////////////////////
    count = 0;
    QFile localeInfo("/home/administrator/Desktop/netID.dat");
    if (localeInfo.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&localeInfo);
        while (!in.atEnd()) {
            line = in.readLine();
            count++;
            if(count == 1)  boxGID = line.trimmed().toInt();
            else if(count == 2) fipsNo = line.trimmed();
        }
    }
    ////////////////////////////////////
    count = 0;
    QFile mac("/home/administrator/Desktop/mac.dat");
    if (mac.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&mac);
        while (!in.atEnd()) {
            line = in.readLine();
            count++;
            if(count == 1) HWaddr = line.trimmed();
        }
    }
    ui->gidLabel->setText("Network ID: "+QString::number(boxGID));
    ui->inCOMLabel->setText("Incoming COM Port: "+COMin+" @ "+QString::number(inBaud)+"bps (8N1)");
    ui->outCOMLabel->setText("Outgoing COM Port: "+COMout+ " @ "+QString::number(outBaud)+"bps (8N1)");
}