Beispiel #1
0
/**
 * @brief Dialog::on_btnCariFile_clicked
 *
 * Slot untuk tombol pencari file
 *
 */
void Dialog::on_btnCariFile_clicked()
{
    isiKotakFile = ui->tempatFile->text();
    QString uriFile;
    if (isiKotakFile.isEmpty()) {
        uriFile = QFileDialog::getOpenFileName(this,tr("Pilih satu file Alldeb"),
                                                QDir::homePath(),tr("File AllDeb (*.alldeb)"));
        QFileInfo infoFile(uriFile);
        if (!uriFile.isNull()) {
            namaFile = infoFile.fileName();
            this->bacaFileAlldeb(uriFile);
            this->titleofWindow(namaFile);
        }
    } else {
        //QFile terbuka(isiKotakFile);
        QFileInfo berkas(isiKotakFile); //berkas saat ini
        uriFile = QFileDialog::getOpenFileName(this,tr("Pilih satu file Alldeb"),
                                               berkas.absolutePath(),tr("File AllDeb (*.alldeb)"));
        QFileInfo infoFile(uriFile);
        if (!uriFile.isNull()) {
            namaFile = infoFile.fileName();
            this->bacaFileAlldeb(uriFile);
            this->titleofWindow(namaFile);
            ui->labelJumlahNilai->setText("");
            ui->labelMd5Nilai->setText("");
            ui->labelUkuranNilai->setText("");
        }
    }
    ui->stackedWidget->setCurrentIndex(0);
    ui->btnInstal->setText(tr("Lanjut"));
    ui->btnInstal->setIcon(QIcon::fromTheme("go-next"));
}
Beispiel #2
0
void VideoAsset::readInfoFile() {
    bfs::path info_path = path;
    info_path /= "videoInfo.txt";

    if(!bfs::exists(info_path))
        throw VideoAssetException("Info file doesn't exist");
    
    std::ifstream infoFile(info_path.string());
    if(!infoFile.is_open())
        throw VideoAssetException("Info file can't be opened");
    
    int t;
    infoFile >> t;
    if(t == 0) isExternal = false;
    else if(t == 1) isExternal = true;
    else throw VideoAssetException("Info file has wrong format");

    infoFile.ignore();

    std::string str_video_path;
    getline(infoFile, str_video_path);
    
    if(isExternal) video_path = bfs::path(str_video_path);
    else {
        video_path = path;
        video_path /= str_video_path;
    }
    
    infoFile.close();
}
Beispiel #3
0
void CommandLineThread::writeInfoFile() {
    // Set info file path
    string infoPath = lecturePath + "/INFO";
    // Construct stream to write to info file
    QFile infoFile(QString::fromStdString(infoPath));
    infoFile.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream infoStream(&infoFile);

    // Format course start time
    char formatDateBuffer[80];
    struct tm * localTime;
    localTime = localtime(&startTime);
    //2014,12,04,12,55,01
    strftime(formatDateBuffer,80,"%Y,%m,%d,%H,%M,%S",localTime);

    // Get host name
    char hostname[256];
    gethostname(hostname, 256);

    // Write the file
    infoStream << "[course]" << endl;
    infoStream << "id: " << course.c_str() << endl;
    infoStream << "term: " << semester.c_str() << endl;
    infoStream << endl;
    infoStream << "[pres]" << endl;
    infoStream << "start: " << formatDateBuffer << endl;
    infoStream << "duration: " << lectureDuration << endl;
    infoStream << "source: " << hostname << endl;
    infoStream << "timestamp: " << startTime << endl;
    infoStream << "whiteboardCount: " << whiteboardCount << endl;
    infoStream << "computerCount: " << vgaCount << endl;

    // Close the file
    infoFile.close();
}
Beispiel #4
0
bool QDSDataStore::add( const QUniqueId& id,
                        QFile& data,
                        const QMimeType& type )
{
    // Create info file and copy data file (in an atomic fashion)
    QDSLockedFile infoFile( infoFileName( id ) );
    if ( infoFile.exists() ) {
        qLog(DataSharing) << "QDSDataStore::add - info file already exists";
        return false;
    }

    if ( !infoFile.openLocked( QIODevice::WriteOnly ) ) {
        qLog(DataSharing) << "QDSDataStore::add - "
                          << "info file can't be written to";
        return false;
    }

    if ( !data.copy( dataFileName( id ) ) ) {
        qLog(DataSharing) << "QDSDataStore::add - couldn't copy data file";
        return false;
    }

    QDataStream ds(&infoFile);
    ds << 1;
    ds << 0;
    ds << type.id();

    return true;
}
void NAClusterInfoLinux::determineLinuxSysInfo()
{
  // Set the page size in killobytes and determine how much memory
  // is available on this node (in kilobytes).
  pageSize_ = (size_t)sysconf(_SC_PAGESIZE) / 1024U;
  totalMemoryAvailable_ = pageSize_ * (size_t)sysconf(_SC_PHYS_PAGES);
  numCPUcoresPerNode_ = sysconf(_SC_NPROCESSORS_ONLN);

  frequency_ = 0.0;

  // Read the CPU frequency from the sysfs filesystem.
  ifstream infoFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
  if (infoFile.fail()) {
    // This code should log a warning.

    // use /proc/cpuinfo
    char var[256];
    ifstream cpuInfoFile("/proc/cpuinfo");
    const char* freqToken = "cpu MHz";
    Lng32 freqTokenLen = strlen(freqToken);
    while(cpuInfoFile.good())
    {
      // Read the variable name from the file.
      cpuInfoFile.getline(var, sizeof(var), ':'); // read the token part
      Lng32 len = strlen(var);
      if(len >= freqTokenLen && !strncmp(var, freqToken, freqTokenLen))
      {
        cpuInfoFile >> frequency_;
        break;
      }
      cpuInfoFile.getline(var, sizeof(var)); // read the value part
    }
ExtremeLearningMachinePtr ExtremeLearningMachine::create(std::string folderName){

    // try loading 'info'
    std::string infoFileName = folderName+std::string("/../info");
    const unsigned int maxChars = 128;
    char infoChars[maxChars];
    std::ifstream infoFile( (const char*) infoFileName.c_str() );
    infoFile.getline(infoChars, maxChars-1);
    infoFile.close();
    std::string info = infoChars;

    if(info == "elm")
    {
        RealMatrixPtr wIn = RealMatrix::load(folderName+std::string("/Win.mat"));
        RealVectorPtr a = RealVector::load(folderName+std::string("/a.vec"));
        RealVectorPtr b = RealVector::load(folderName+std::string("/b.vec"));
        RealMatrixPtr wOut = RealMatrix::load(folderName+std::string("/Wout.mat"));

        unsigned int out_dimensionality = wOut->getNumRows();
        unsigned int hid_dimensionality = wIn->getNumRows();
        unsigned int in_dimensionality = wIn->getNumCols();

        std::cout << "Found ELM model (inp-dim:"<< in_dimensionality<<"; hid-dim:"<< hid_dimensionality <<"out-dim:"<< out_dimensionality <<")." << std::endl;
        std::cerr << "ELM model without datascale is not implemented :(" << std::endl;

        return ExtremeLearningMachine::create(wIn, a, b, wOut);

    }
    else if(info == "elm+datascale")
    {
        RealMatrixPtr wIn = RealMatrix::load(folderName+std::string("/Win.mat"));
        RealVectorPtr a = RealVector::load(folderName+std::string("/a.vec"));
        RealVectorPtr b = RealVector::load(folderName+std::string("/b.vec"));
        RealMatrixPtr wOut = RealMatrix::load(folderName+std::string("/Wout.mat"));
        //wIn=wIn->transpose();
        //wOut=wOut->transpose();

        RealVectorPtr bx = RealVector::load(folderName+std::string("/bx.vec"));
        RealMatrixPtr Ax = RealMatrix::load(folderName+std::string("/Ax.mat"));
        RealVectorPtr by = RealVector::load(folderName+std::string("/by.vec"));
        RealMatrixPtr Ay = RealMatrix::load(folderName+std::string("/Ay.mat"));


        unsigned int out_dimensionality = wOut->getNumRows();
        unsigned int hid_dimensionality = wIn->getNumRows();
        unsigned int in_dimensionality = wIn->getNumCols();

        std::cout << "Found ELM model + datascale (inp-dim:"<< in_dimensionality<<"; hid-dim:"<< hid_dimensionality <<"out-dim:"<< out_dimensionality <<")." << std::endl;


        return ExtremeLearningMachine::create(wIn, a, b, wOut, Ax, bx, Ay, by);


    }
    else
    {
        std::cerr << "Model does not exist of is of unknown type." << std::endl;
    }
}
Beispiel #7
0
char *ls(int argc, char **argv, char *output){
    char *c = malloc(20000);
    strcpy(c,".");
    strcat(c, argv[1]);    
    if (argc == 3){
        strcat(c, "/");
        strcat(c, argv[2]);
        struct stat s;
        if(stat(c,&s) != 0){
            sprintf(output,"-fssh: %s/%s: No existe el archivo o directorio\n"
                    ,argv[1],argv[2]);
            free(c);
            return "";
        }
        sprintf(output,"%s%s\n", infoFile(c,output),argv[2]);
    }
    else {
        DIR *directorio = opendir(c);
        if (directorio != NULL) {
            struct dirent *d;
            char *path = malloc(20);
            strcpy(path,c);
            strcat(path,"/");
            
            strcpy(output,"");
            while ((d = readdir(directorio)) != NULL)
            {
                if (d->d_name[0] != '.') {
                    char *b = malloc(100);
                    strcpy(c,path);
                    strcat(c, d->d_name);
                    strcat(output,infoFile(c,b));
                    strcat(output, d->d_name);
                    strcat(output, "\n");
                }
            }
            closedir(directorio);
            
        }
    }
    free(c);
    return output;
}
Beispiel #8
0
bool cProject::generate_infoFile()
{
    QString str;
    str.append("PROJECT-ID:").append(m_id).append("\n");
    str.append("PROJECT-NAME:").append(m_name).append("\n");
    str.append("PROJECT-MAINTAINER:").append(m_maintainer).append("\n");
    QFile infoFile(m_infoFile);
    if(!infoFile.open(QIODevice::WriteOnly)) return false;
    QByteArray data;
    data.append(str);
    if(infoFile.write(data) != data.count()) return false;
    return true;
}
Beispiel #9
0
int main(void)
{
     cgi_init();
     cgi_session_save_path("sessions/");
     cgi_session_start();

     cgi_process_form();

     cgi_init_headers();
     header("sidebar_download");
     menu();
     sidebar();

     //Beta !
     std::cout << "<p class=\"wrn\">Phase de beta !<br />"
                  "Le jeu est en phase de beta, ce qui signifie qu'il "
			   "est fortement possible que des bugs soit présent.<br />"
			   "Le téléchargement d'Okzoniom::Patcher permet de garder le jeu à jour "
			   "par rapport aux dernières modifications mise en ligne."
			   "</p>";

     std::cout << "<p class=\"wrn\">"
			   "En cas de problème, vous pouvez me faire parvenir par e-mail "
			   "le fichier Log_Patcher.txt ou Log.txt dans le cas d'un plantage !</p>";

     std::cout << "<div class=\"body\"><div class=\"main\">"
               "<h1>" << __tr("download") << "</h1>"
               "<div class=\"hr\"></div>"
               << std::endl;

	std::map<std::string, std::string> title_file;
	title_file["Windows"] = "Patcher_Win.exe";
	title_file["Linux"] = "Patcher_Linux.tar";

	for(auto it = title_file.begin(); it != title_file.end(); ++it) {
		std::string file = it->second;
		std::cout << "<h2>" << it->first << "</h2>"
				"<p>"
				"<a href=\"download/" << file << "\">"
				"<strong>&gt; " << file <<" &lt;</strong></a><br />"
				<< infoFile(file) << 
				"</p>"
				<< std::endl;
	}

     std::cout << "</div></div>" << std::endl;

     footer();

     return 0;
}
Beispiel #10
0
void VideoAsset::writeInfoFile() {
    bfs::path info_path = path;
    info_path /= "videoInfo.txt";
    
    std::ofstream infoFile(info_path.string());
    if(!infoFile.is_open())
        throw VideoAssetException("Couldn't create info file!");
    
    time_t t = time(0);  // current time: http://cplusplus.com/reference/clibrary/ctime/time/
    struct tm * now = localtime(&t);  // http://cplusplus.com/reference/clibrary/ctime/localtime/
    // struct tm: http://cplusplus.com/reference/clibrary/ctime/tm/
    
    infoFile << (isExternal?'1':'0') << std::endl <<
    (isExternal?video_path.string():video_path.filename().string()) << std::endl <<
    now->tm_hour << ":" << now->tm_min << ":" << now->tm_sec << " " <<
    now->tm_mday << "/" << (now->tm_mon+1) << "/" << (now->tm_year+1900) << std::endl;
    
    infoFile.close();
}
Beispiel #11
0
void InfosProduitDialog::on_btnAjoutGarantie_clicked()
{
    QString fileName = QFileDialog::getOpenFileName(this, tr("Sélectionnez une fiche garantie"), "", tr("Fichiers supportés")+" (*.pdf *.jpg *.jpeg *.png);;"+tr("Fichiers PDF")+" (*.pdf);;"+tr("Images")+" (*.jpg *.jpeg *.png)");
    if(fileName != "")
    {
        QFile fichier(fileName);
        QFileInfo infoFile(fichier.fileName());
        fichier.open(QFile::ReadOnly);
        if(fichier.isReadable())
        {
            QByteArray contenuFichier = fichier.readAll();
            fichier.close();

            garantiePDF.insert(infoFile.fileName(), contenuFichier);
            ui->listGaranties->addItem(infoFile.fileName());
        }
        else
            QMessageBox::critical(this, tr("Erreur"), tr("Impossible de lire le fichier %1\nVérifiez qu'il est bien accessible en lecture et réessayez.", "%1 represents the file name").arg(fichier.fileName()));
    }
}
Beispiel #12
0
void InfosProduitDialog::on_garantieScanned()
{
    QString fileName = QDir::tempPath()+"/output.pdf";
    QFile::rename(fileName, QDir::tempPath()+"/Garantie.pdf");
    fileName = QDir::tempPath()+"/Garantie.pdf";

    QFile fichier(fileName);
    QFileInfo infoFile(fichier.fileName());
    fichier.open(QFile::ReadOnly);
    if(fichier.isReadable())
    {
        QByteArray contenuFichier = fichier.readAll();
        fichier.close();

        garantiePDF.insert(infoFile.fileName(), contenuFichier);
        ui->listGaranties->addItem(infoFile.fileName());
    }
    else
        QMessageBox::critical(this, tr("Erreur"), tr("Une erreur s'est produite lors de l'ajout de votre document numérisé.\nVous pouvez toujours ajouter le document manuellement, il se trouve ici : %1", "%1 represents the place of the file in the temp directory").arg(fileName));
}
Beispiel #13
0
status_t
AutoConfig::LoadProviderInfo(const BString &provider, provider_info* info)
{
	BPath path;
	status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
	if (status != B_OK)
		return status;
	path.Append(INFO_DIR);
	BDirectory infoDir(path.Path());
	
	BFile infoFile(&infoDir, provider.String(), B_READ_ONLY);
	if (infoFile.InitCheck() != B_OK)
		return B_ENTRY_NOT_FOUND;

	info->provider = provider;
	if (ReadProviderInfo(&infoFile, info) == true)
		return B_OK;
	
	return B_ERROR;
}
Beispiel #14
0
bool cProject::load_infoFile()
{
    QFile infoFile(m_infoFile);
    if(!infoFile.open(QIODevice::ReadOnly)) return false;
    QFileInfo finfo(infoFile);
    m_rootDir = finfo.absoluteDir();
    QString raw_data(infoFile.readAll());
    QStringList data_lines(raw_data.split("\n"));
    if(data_lines.count() < 3) return false;
    QStringList field_id(data_lines[0].split(":"));
    QStringList field_name(data_lines[1].split(":"));
    QStringList field_maintainer(data_lines[2].split(":"));
    if((field_id.count()  != 2) ||
       (field_name.count()!= 2) ||
       (field_maintainer.count() != 2) ) return false;
    if(field_id[0]!="PROJECT-ID") return false;
    m_id = field_id[1];
    m_name = field_name[1];
    m_maintainer = field_maintainer[1];
    return true;
}
Beispiel #15
0
bool QDSDataStore::add( const QUniqueId& id,
                        const QByteArray& data,
                        const QMimeType& type )
{
    // Create info and data files (in an atomic fashion)
    QDSLockedFile infoFile( infoFileName( id ) );
    if ( infoFile.exists() ) {
        qLog(DataSharing) << "QDSDataStore::add - info file already exists";
        return false;
    }

    if ( !infoFile.openLocked( QIODevice::WriteOnly ) ) {
        qLog(DataSharing) << "QDSDataStore::add - "
                          << "info file can't be written to";
        return false;
    }

    QDSLockedFile dataFile( dataFileName( id ) );
    if ( dataFile.exists() ) {
        qLog(DataSharing) << "QDSDataStore::add - data file already exists";
        return false;
    }

    if ( !dataFile.openLocked( QIODevice::WriteOnly ) ) {
        qLog(DataSharing) << "QDSDataStore::add - "
                          << "data file can't be written to";
        return false;
    }

    // Write to files
    QDataStream infoDs( &infoFile );
    infoDs << 1;
    infoDs << 0;
    infoDs << type.id();

    dataFile.write( data );

    return true;
}
Beispiel #16
0
bool QDSDataStore::add( const QUniqueId& id )
{
    // Update info file (in an atomic fashion)
    QDSLockedFile infoFile( infoFileName( id ) );
    if ( !infoFile.exists() ) {
        qLog(DataSharing) << "QDSDataStore::add - info file doesn't exist";
        return false;
    }

    int refCount = 0;
    int transCount = 0;
    QString type;
    if ( infoFile.openLocked( QIODevice::ReadWrite ) ) {
        QDataStream ds(&infoFile);
        ds >> refCount;
        ds >> transCount;
        ds >> type;
        infoFile.seek( 0 );
        ds << refCount + 1;
        ds << transCount;
        ds << type;
        infoFile.close();
    } else {
Beispiel #17
0
std::pair<bool, std::string> Godlike::Init(const std::string & target,
      EncryptionType encryptionType)
{
  if (Filesystem::Exists(target))
  {
    return std::make_pair(false, "Target already exists");
  }

  //idea: create everything in a temp directory then move the top level folder
  //once I've done all that.

  std::pair<bool, std::string> result = Filesystem::MakeDir(target);
  if (!result.first)
  {
    return result;
  }

  result = Filesystem::MakeDir(target + "/archive");
  if (!result.first)
  {
    return result;
  }

  result = Filesystem::MakeDir(target + "/bin");
  if (!result.first)
  {
    return result;
  }

  std::ofstream infoFile(target + "/info");
  if (!infoFile.good())
  {
    std::ostringstream errorStream;
    errorStream << "I/O error occured while opening "
      << target
      << "/info";
    return std::make_pair(false, errorStream.str());
  }
  infoFile << "This is a godlike repository.\n";

  const std::string BLOCKTABLE_PATH(target + "/blocktable");
  std::ostringstream blocktableSQL;
  blocktableSQL << "create table blocktable("
    << "sha512sum TEXT PRIMARY KEY,"
    << "binfile TEXT"
    << ");";
  sqlite3 * blocktable = nullptr;
  int returnCode = sqlite3_open(BLOCKTABLE_PATH.c_str(), &blocktable);
  if (returnCode != SQLITE_OK)
  {
    const std::string ERROR_MESSAGE(sqlite3_errmsg(blocktable));
    sqlite3_close(blocktable);
    return std::make_pair(false, ERROR_MESSAGE);
  }
  char * errorMessage = NULL;
  returnCode = sqlite3_exec(blocktable,
      blocktableSQL.str().c_str(),
      NULL,
      NULL,
      &errorMessage);
  if (returnCode != SQLITE_OK)
  {
    const std::string MSG(errorMessage);
    sqlite3_free(errorMessage);
    return std::make_pair(false, MSG);
  }

  sqlite3_close(blocktable);
  return std::make_pair(true, "");
}
Beispiel #18
0
void Driver::parse_stream_dynamic(std::istream& in, cube::Cube& cubeObj, std::string fileName)
{

  parseContext->dynamicMetricLoading = true;

  in.clear();
  in.seekg(0);

  cube3Lexer = new Cube3Scanner(&in, &errorStream, parseContext);
  cube3Parser = new Cube3Parser(*this, *parseContext, *cube3Lexer, cubeObj);

  cube3Parser->parse();

  delete cube3Lexer;
  delete cube3Parser;

  if (parseContext->cubeVersion!=3){

    info("******** No dynamic loading for cube2 files implemented\n********Loading all data.\n");

    in.clear();
    in.seekg(0);
    
    cube2Lexer = new Cube2Scanner(&in, &errorStream, parseContext);
    cube2Parser = new Cube2Parser(*this, *parseContext, *cube2Lexer, cubeObj);

    cube2Parser->parse();

    delete cube2Parser;
    delete cube2Lexer;
    
  } else {

    int n = cubeObj.get_metv().size();

    in.clear();
    in.seekg (0,std::ios::end);
    long int length = in.tellg();
    in.seekg (0,std::ios::beg);

    std::ifstream infoFile(fileName.c_str());
    
    if (!infoFile) {

      parse_matrix_pos(in);      
      std::ofstream out(fileName.c_str());
      out.precision(30);

      out << length << " ";

      for (int i=0; i<n; i++){
	out << metricPos[i];
	out << " ";
	out << metricSum[i];
	out << " ";
      }
      out.close();      

    } else {

      metricPos.resize(n);
      metricSum.resize(n);
      long int infoLength;
      infoFile >> infoLength;
      if (infoLength!=length)
	error("The length of the cube file is different from\nwhat is stored in the info file!\n\nCould not complete loading.");

      for (int i=0; i<n; i++){
	infoFile >> metricPos[i];
	infoFile >> metricSum[i];
      }
      infoFile.close();
    }

  }

  info("");
}
Beispiel #19
0
void StelLogger::init(const QString& logFilePath)
{
	logFile.setFileName(logFilePath);

	if (logFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text | QIODevice::Unbuffered))
		qInstallMessageHandler(StelLogger::debugLogHandler);

	// write timestamp
	writeLog(QString("%1").arg(QDateTime::currentDateTime().toString(Qt::ISODate)));
	// write info about operating system
	writeLog(StelUtils::getOperatingSystemInfo());

	// write compiler version
#if defined __GNUC__ && !defined __clang__
	#ifdef __MINGW32__
		#define COMPILER "MinGW GCC"
	#else
		#define COMPILER "GCC"
	#endif
	writeLog(QString("Compiled using %1 %2.%3.%4").arg(COMPILER).arg(__GNUC__).arg(__GNUC_MINOR__).arg(__GNUC_PATCHLEVEL__));
#elif defined __clang__
	writeLog(QString("Compiled using %1 %2.%3.%4").arg("Clang").arg(__clang_major__).arg(__clang_minor__).arg(__clang_patchlevel__));
#elif defined _MSC_VER
	writeLog(QString("Compiled using %1").arg(getMsvcVersionString(_MSC_VER)));
#else
	writeLog("Unknown compiler");
#endif

	// write Qt version
	writeLog(QString("Qt runtime version: %1").arg(qVersion()));
	writeLog(QString("Qt compilation version: %1").arg(QT_VERSION_STR));

	// write addressing mode
#if defined(__LP64__) || defined(_WIN64)
	writeLog("Addressing mode: 64-bit");
#else
	writeLog("Addressing mode: 32-bit");
#endif

	// write memory and CPU info
#ifdef Q_OS_LINUX

#ifndef BUILD_FOR_MAEMO
	QFile infoFile("/proc/meminfo");
	if(!infoFile.open(QIODevice::ReadOnly | QIODevice::Text))
		writeLog("Could not get memory info.");
	else
	{
		while(!infoFile.peek(1).isEmpty())
		{
			QString line = infoFile.readLine();
			line.chop(1);
			if (line.startsWith("Mem") || line.startsWith("SwapTotal"))
				writeLog(line);
		}
		infoFile.close();
	}

	infoFile.setFileName("/proc/cpuinfo");
	if (!infoFile.open(QIODevice::ReadOnly | QIODevice::Text))
		writeLog("Could not get CPU info.");
	else
	{
		while(!infoFile.peek(1).isEmpty())
		{
			QString line = infoFile.readLine();
			line.chop(1);
			if(line.startsWith("model name") || line.startsWith("cpu MHz"))
				writeLog(line);
		}
		infoFile.close();
	}

	QProcess lspci;
	lspci.start("lspci -v", QIODevice::ReadOnly);
	lspci.waitForFinished(300);
	const QString pciData(lspci.readAll());
	QStringList pciLines = pciData.split('\n', QString::SkipEmptyParts);
	for (int i = 0; i<pciLines.size(); i++)
	{
		if(pciLines.at(i).contains("VGA compatible controller"))
		{
			writeLog(pciLines.at(i));
			i++;
			while(i < pciLines.size() && pciLines.at(i).startsWith('\t'))
			{
				if(pciLines.at(i).contains("Kernel driver in use"))
					writeLog(pciLines.at(i).trimmed());
				else if(pciLines.at(i).contains("Kernel modules"))
					writeLog(pciLines.at(i).trimmed());
				i++;
			}
		}
	}
#endif

// Aargh Windows API
#elif defined Q_OS_WIN
	// Hopefully doesn't throw a linker error on earlier systems. Not like
	// I'm gonna test it or anything.
	if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP)
	{
		MEMORYSTATUSEX statex;
		statex.dwLength = sizeof (statex);
		GlobalMemoryStatusEx(&statex);
		writeLog(QString("Total physical memory: %1 MB").arg(statex.ullTotalPhys/(1024<<10)));
		writeLog(QString("Available physical memory: %1 MB").arg(statex.ullAvailPhys/(1024<<10)));
		writeLog(QString("Physical memory in use: %1%").arg(statex.dwMemoryLoad));
		#ifndef _WIN64
		// This always reports about 8TB on Win64, not really useful to show.
		writeLog(QString("Total virtual memory: %1 MB").arg(statex.ullTotalVirtual/(1024<<10)));
		writeLog(QString("Available virtual memory: %1 MB").arg(statex.ullAvailVirtual/(1024<<10)));
		#endif
	}
	else
		writeLog("Windows version too old to get memory info.");

	HKEY hKey = NULL;
	DWORD dwType = REG_DWORD;
	DWORD numVal = 0;
	DWORD dwSize = sizeof(numVal);

	// iterate over the processors listed in the registry
	QString procKey = "Hardware\\Description\\System\\CentralProcessor";
	LONG lRet = ERROR_SUCCESS;
	int i;
	for(i = 0; lRet == ERROR_SUCCESS; i++)
	{
		lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
					qPrintable(QString("%1\\%2").arg(procKey).arg(i)),
					0, KEY_QUERY_VALUE, &hKey);

		if(lRet == ERROR_SUCCESS)
		{
			if(RegQueryValueExA(hKey, "~MHz", NULL, &dwType, (LPBYTE)&numVal, &dwSize) == ERROR_SUCCESS)
				writeLog(QString("Processor speed: %1 MHz").arg(numVal));
			else
				writeLog("Could not get processor speed.");
		}

		// can you believe this trash?
		dwType = REG_SZ;
		char nameStr[512];
		DWORD nameSize = sizeof(nameStr);

		if (lRet == ERROR_SUCCESS)
		{
			if (RegQueryValueExA(hKey, "ProcessorNameString", NULL, &dwType, (LPBYTE)&nameStr, &nameSize) == ERROR_SUCCESS)
				writeLog(QString("Processor name: %1").arg(nameStr));
			else
				writeLog("Could not get processor name.");
		}

		RegCloseKey(hKey);
	}
	if(i == 0)
		writeLog("Could not get processor info.");

#elif defined Q_OS_MAC
	QProcess systemProfiler;
	systemProfiler.start("/usr/sbin/system_profiler -detailLevel mini SPHardwareDataType SPDisplaysDataType");
	systemProfiler.waitForStarted();
	systemProfiler.waitForFinished();
	const QString systemData(systemProfiler.readAllStandardOutput());
	QStringList systemLines = systemData.split('\n', QString::SkipEmptyParts);
	for (int i = 0; i<systemLines.size(); i++)
	{
		if(systemLines.at(i).contains("Model"))
		{
			writeLog(systemLines.at(i).trimmed());
		}

		if(systemLines.at(i).contains("Processor"))
		{
			writeLog(systemLines.at(i).trimmed());
		}

		if(systemLines.at(i).contains("Memory"))
		{
			writeLog(systemLines.at(i).trimmed());
		}

		if(systemLines.at(i).contains("VRAM"))
		{
			writeLog(systemLines.at(i).trimmed());
		}

	}

#elif defined Q_OS_BSD4
	QProcess dmesg;
	dmesg.start("/sbin/dmesg", QIODevice::ReadOnly);
	dmesg.waitForStarted();
	dmesg.waitForFinished();
	const QString dmesgData(dmesg.readAll());
	QStringList dmesgLines = dmesgData.split('\n', QString::SkipEmptyParts);
	for (int i = 0; i<dmesgLines.size(); i++)
	{
		if (dmesgLines.at(i).contains("memory"))
		{
			writeLog(dmesgLines.at(i).trimmed());
		}
		if (dmesgLines.at(i).contains("CPU"))
		{
			writeLog(dmesgLines.at(i).trimmed());
		}
		if (dmesgLines.at(i).contains("VGA"))
		{
			writeLog(dmesgLines.at(i).trimmed());
		}
	}

#endif
}