Esempio n. 1
0
void Server :: readLocalIpks( Server *local )
{
    cleanUp();

#ifdef QWS
    // First, get any local IPKGs in the documents area
    // Only applicable to Qtopie/Opie

    DocLnkSet files;
    Global::findDocuments( &files, "application/ipkg" );

    // Now add the items to the list
    QListIterator<DocLnk> it( files.children() );

    for ( ; it.current() ; ++it )
    {
        // OK, we have a local IPK file, I think the standard naming conventions
        // for these are packagename_version_arm.ipk
        QString file = (*it)->file();

        // Changed to display the filename (excluding the path)
        QString packageName = Utils::getPackageNameFromIpkFilename( file );
        QString ver = Utils::getPackageVersionFromIpkFilename( file );
        Package *package = new Package( packageName );
        package->setVersion( ver );
        package->setFilename( file );
        package->setPackageStoredLocally( true );
        packageList.append( package );
    }
#else
	QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" };
	for ( int i = 0 ; i < 4 ; ++i )
	{
		// OK, we have a local IPK file, I think the standard naming conventions
		// for these are packagename_version_arm.ipk
		QString file = names[i];
		int p = file.find( "_" );
		QString tmp = file.mid( 0, p );
		packageList.push_back( Package( tmp ) );
		int p2 = file.find( "_", p+1 );
		tmp = file.mid( p+1, p2-(p+1) );
		packageList.back().setVersion( tmp );
		packageList.back().setPackageStoredLocally( true );
	}
#endif

    // build local packages
    buildLocalPackages( local );
}
Esempio n. 2
0
void GliderEditorNumPad::readPolarData()
{
  // qDebug ("GliderEditorNumPad::readPolarData ");

#warning "location of glider.pol file is CUMULUS_ROOT/etc"

  // try to read more polars from document folder
  // these files are in winpilot format: one file per polar
  DocLnkSet docs;
  Global::findDocuments(&docs, "cumulus/polar");
  QList<DocLnk*> list = docs.children();

  // qDebug ("found %d polars in document folder", list.count());
  for (DocLnk* doc = list.first(); doc; doc = list.next())
    {
      QString path = doc->file();
      // qDebug ("Doc: %s", path.toLatin1().data());
      QFile file (path);
      QTextStream stream(&file);
      if (file.open(IO_ReadOnly))
	{
	  QString glidertype = QFileInfo(file).baseName();
	  while (!stream.eof())
	    {
	      QString line = stream.readLine();
	      // ignore comments
	      if (line[0] == '*')
		continue;
	      QStringList list = QStringList::split(',',line,TRUE);
	      m_openGliderList->addItem (glidertype);

	      // vertical speeds are already negative in these files !
	      Speed v1,w1,v2,w2,v3,w3;
	      double maxgross = list [0].toDouble();
	      int maxwater = list [1].toInt();
	      v1.setKph(list[2].toDouble());
	      w1.setMps(list[3].toDouble());
	      v2.setKph(list[4].toDouble());
	      w2.setMps(list[5].toDouble());
	      v3.setKph(list[6].toDouble());
	      w3.setMps(list[7].toDouble());
	      pol=new Polar(this, glidertype,v1,w1,v2,w2,v3,w3,0.0,0.0,0.0,maxgross);
	      pol->setMaxWater(maxwater);
	      m_polars.append(pol);
	      break;
	    }
	}
    }
}