void MainWindow::on_escanear_clicked() { if(!ui->archivos->toPlainText().isEmpty()) { ui->salida->clear(); QString origen2 = ui->archivos->toPlainText(); QString prefijo; QSysInfo osname; QString os = osname.productType(); if(os=="windows") { prefijo=""; } else { prefijo="/"; } QStringList archivo = origen2.replace("file:///",prefijo).split(QRegExp("[\n]"),QString::SkipEmptyParts); int final = archivo.count(); Crc32 crc32; for (int i=0;i<final;i++) { QString crc = QString::number(crc32.calculateFromFile(archivo[i]),16).toUpper().rightJustified(8, '0'); ui->salida->append(archivo[i] + " -> " + crc); } createStatusBar(); }
int main (int argc, char *argv[]) { QCoreApplication::setOrganizationName ("BerndStramm"); QCoreApplication::setOrganizationDomain ("bernd-stramm.com"); QCoreApplication::setApplicationName ("loco"); deliberate::ProgramVersion pv ("Loco"); QCoreApplication::setApplicationVersion (pv.Number()); QApplication app (argc, argv); QLocale locale; QSysInfo sysInfo; QSettings settings; deliberate::InitSettings (); deliberate::SetSettings (settings); settings.setValue ("program",pv.MyName()); QStringList configMessages; deliberate::CmdOptions opts ("loco"); opts.AddSoloOption ("debug","D",QObject::tr("show Debug log window")); opts.AddStringOption ("logdebug","L",QObject::tr("write Debug log to file")); deliberate::UseMyOwnMessageHandler (); bool optsOk = opts.Parse (argc, argv); if (!optsOk) { opts.Usage (); exit(1); } if (opts.WantHelp ()) { opts.Usage (); exit (0); } pv.CLIVersion (); configMessages.append (QString ("Portions %1") .arg ("Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)")); configMessages.append (QString("Built on %1 %2") .arg (__DATE__).arg(__TIME__)); configMessages.append (QObject::tr("Build with Qt %1").arg(QT_VERSION_STR)); configMessages.append (QObject::tr("Running with Qt %1").arg(qVersion())); configMessages.append (QObject::tr("Current Country %1") .arg(QLocale::countryToString(locale.country()))); configMessages.append (QObject::tr("Current Language %1") .arg(QLocale::languageToString(locale.language()))); configMessages.append (QObject::tr("build API %1") .arg (sysInfo.buildAbi())); configMessages.append(QObject::tr("Kernel %1") .arg(sysInfo.kernelType() + " "+sysInfo.kernelVersion())); configMessages.append((QObject::tr("Product Name %1") .arg(sysInfo.prettyProductName()))); for (int cm=0; cm<configMessages.size(); cm++) { deliberate::StdOut () << configMessages[cm] << endl; } if (opts.WantVersion ()) { exit (0); } bool showDebug = opts.SeenOpt ("debug"); int result; #if DELIBERATE_DEBUG deliberate::StartDebugLog (showDebug); bool logDebug = opts.SeenOpt ("logdebug"); if (logDebug) { QString logfile ("/dev/null"); opts.SetStringOpt ("logdebug",logfile); deliberate::StartFileLog (logfile); } #endif QStringList args = opts.Arguments(); QString tour; cout << "\n\nargument count" << args.count(); if (args.count() > 0) { tour = args.at(0); } else { tour = QString(":/tour-default"); } cout << "\n\n\n\t\t" << Q_FUNC_INFO << "tour is" << tour.toStdString() << "\n\n\n"; loco::Loco loco (tour); app.setWindowIcon (loco.windowIcon()); loco.Init (app); loco.AddConfigMessages (configMessages); loco.Run (); loco.RunSlippy (); result = app.exec (); qDebug () << " QApplication exec finished " << result; return result; }
void QQMlDom::setCorrectPreBuilt(const QString version) { QSysInfo info; // FIXME need to either let the user pick out the mirror // Or we need to use something to set the mirror // // int utcOffSet; // QDateTime dt1 = QDateTime::currentDateTime(); // QDateTime dt2 = dt1.toUTC(); // dt1.setTimeSpec(Qt::UTC); // int offset = dt2.secsTo(dt1) / 3600; // utcOffSet = offset; // QString defaultPath; // switch (utcOffSet) { // case -8|"-7"|"-6"|"-5": // defaultPath = QString("%1%2/").arg("https://download.qt.io/official_releases/qt-installer-framework/").arg(version); // break; // case "": // break; // } QString defaultPath = QString("%1%2/").arg("https://download.qt.io/official_releases/qt-installer-framework/").arg(version); // = c QString os; QString downloadFullPath; os = info.kernelType().toLatin1(); QString arch = info.buildCpuArchitecture(); if ( os == "linux") { if(arch == "x86_64") { downloadFullPath = QString("%1%2%3%4") .arg(defaultPath) .arg("qt-installer-framework-opensource-") .arg(version) .arg("-x64.run"); if (downloadFullPath == m_correctPrebuiltUrl) return; m_correctPrebuiltUrl = downloadFullPath; qDebug() << downloadFullPath; } //FIXME error check for arm and what not else { downloadFullPath = QString("%1%2%3%4") .arg(defaultPath) .arg("qt-installer-framework-opensource-") .arg(version) .arg("-x86.run"); if (downloadFullPath == m_correctPrebuiltUrl) return; m_correctPrebuiltUrl = downloadFullPath; qDebug() << downloadFullPath; } } else if (os == "wince" || os == "winnt") { downloadFullPath = QString("%1%2%3%4") .arg(defaultPath) .arg("Qt Installer Framework Opensource ") .arg(version) .arg(".exe"); if (downloadFullPath == m_correctPrebuiltUrl) return; m_correctPrebuiltUrl = downloadFullPath; qDebug() << downloadFullPath; } else if (os == "darwin" ) { downloadFullPath = QString("%1%2%3%4") .arg(defaultPath) .arg(" Qt Installer Framework Opensource ") .arg(version) .arg(".dmg"); if (downloadFullPath == m_correctPrebuiltUrl) return; m_correctPrebuiltUrl = downloadFullPath; qDebug() << downloadFullPath; } else { error("Can not set the correct version of Qt IFW Maybe your OS is not supported"); } }