示例#1
0
void tbrowse::update_file_lists(twindow& window)
{
	files_in_current_dir_.clear();
	dirs_in_current_dir_.clear();

	std::vector<std::string> files, dirs;

	std::string adjust_current_dir;
#ifdef _WIN32
	adjust_current_dir = conv_ansi_utf8_2(current_dir_, false);
#else
	adjust_current_dir = current_dir_;
#endif
	get_files_in_dir(adjust_current_dir, &files, &dirs, FILE_NAME_ONLY);

	// files and dirs of get_files_in_dir returned are unicode16 format
	for (std::vector<std::string>::const_iterator it = files.begin(); it != files.end(); ++ it) {
		const std::string& str = *it;
#ifdef _WIN32
		files_in_current_dir_.insert(tfile(conv_ansi_utf8_2(str, true)));
#else
		files_in_current_dir_.insert(str);
#endif
	}
	for (std::vector<std::string>::const_iterator it = dirs.begin(); it != dirs.end(); ++ it) {
		const std::string& str = *it;
#ifdef _WIN32
		dirs_in_current_dir_.insert(tfile(conv_ansi_utf8_2(str, true)));
#else
		dirs_in_current_dir_.insert(str);
#endif
	}

	reload_file_table(window, 0);
}
示例#2
0
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         const GeglRectangle *result,
         gint                 level)
{
  GeglProperties *o = GEGL_PROPERTIES (operation);
  Priv           *p = (Priv*)o->user_data;
  static gint     inited = 0;

  g_assert (input);

  if (p == NULL)
    init (o);
  p = (Priv*)o->user_data;

  p->width = result->width;
  p->height = result->height;
  p->input = input;

  if (!inited)
    {
      tfile (o);
      inited = 1;
    }

  write_video_frame (o, p->oc, p->video_st);
  if (p->audio_st)
    write_audio_frame (o, p->oc, p->audio_st);

  return  TRUE;
}
示例#3
0
void QWpsDrawer::WpsInit(QString buffer, bool isFile) {
	DEBUGF3("QWpsDrawer::WpsInit");
    if (!mResolved)
        if (!tryResolve())
            return;
    if (isFile) {
        cleanTemp();
        DEBUGF1( tr("Loading %1").arg(buffer));
        QFile file(buffer);
        if (file.open(QIODevice::ReadOnly | QIODevice::Text))
            mWpsString = file.readAll();
        newTempWps();
    } else
        mWpsString = buffer;
    {
        QFile tfile(mTmpWpsString+".wps");
        if (tfile.open(QIODevice::WriteOnly | QIODevice::Text))
            tfile.write(mWpsString.toAscii(),mWpsString.length());
    }
    backdrop.fill(Qt::black);
    DEBUGF3("clear backdrop");
    if (isFile)
        lib_wps_init(buffer.toAscii(), &api, isFile);
    else
        lib_wps_init(QString(mTmpWpsString+".wps").toAscii(), &api, true);
    pix = new QPixmap(api.getwidth(),api.getheight());
    pix->fill(Qt::black);

    drawBackdrop();

    setMinimumWidth(api.getwidth());
    setMinimumHeight(api.getheight());
    update();
}
Battery::Battery()
    : mStatus(STATUS_UNKNOWN)
    , mHealth(HEALTH_UNKNOWN)
    , mPresent(false)
    , mACOnline(false)
    , mUSBOnline(false)
    , mCapacity(0)
    , mVoltage(0)
    , mTemperature(0)
    , mVoltageDivisor(1)
{
    QDirIterator it(QStringLiteral("/sys/class/power_supply"));
    while (it.hasNext()) {
	QString path = it.next();
	QString name = it.fileName();

	if (name != QStringLiteral(".") && name != QStringLiteral("..")) {
	    QDir d(path);
	    QFile tfile(d.filePath(QStringLiteral("type")));

	    if (tfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
		QByteArray data = tfile.readLine().trimmed();
		if (data == "Mains") {
		    mPathACOnline = checkFile(d, QStringLiteral("online"));
		}
		else if (data == "USB") {
		    mPathUSBOnline = checkFile(d, QStringLiteral("online"));
		}
		else if (data == "Battery") {
		    mPathBatteryStatus     = checkFile(d, QStringLiteral("status"));
		    mPathBatteryHealth     = checkFile(d, QStringLiteral("health"));
		    mPathBatteryPresent    = checkFile(d, QStringLiteral("present"));
		    mPathBatteryCapacity   = checkFile(d, QStringLiteral("capacity"));
		    mPathBatteryTechnology = checkFile(d, QStringLiteral("technology"));

		    mPathBatteryVoltage = checkFile(d, QStringLiteral("voltage_now"));
		    if (!mPathBatteryVoltage.isEmpty())
			mVoltageDivisor = 1000;
		    else
			mPathBatteryVoltage = checkFile(d, QStringLiteral("batt_volt"));
		    
		    mPathBatteryTemperature = checkFile(d, QStringLiteral("temp"));
		    if (mPathBatteryTemperature.isEmpty())
			mPathBatteryTemperature = checkFile(d, QStringLiteral("batt_temp"));

		}
	    }
	}
    }
    update();

    // Monitor UEvent
    UEventWatcher *watcher = new UEventWatcher();
    connect(watcher, SIGNAL(activity()), SLOT(update()));
    watcher->start();
}
示例#5
0
YBORM_DECL bool
load_xml_file(const String &name, string &where)
{
    ifstream tfile(NARROW(name).c_str());
    if (!tfile)
        return false;
    while (tfile.good()) {
        char ch;
        tfile.get(ch);
        where.push_back(ch);
    }
    return true;
}
示例#6
0
// Checks if user has a got a highscore and if yes writes it to file
void Question::hscorefile()
{
     ifstream hfile("hs.dat", ios::in|ios::binary);
     int i=0;
     hs_struct h, temp[5];
     h.score = score;
     for(i=0; i<5 && hfile; i++)
     {   hfile.read((char*)&temp[i], sizeof(temp[i]));
     }
     hfile.close();
     for(i=0; i<5; i++)
	if(h.score>=temp[i].score)
		break;
     if(i==5)
	cout<<"Sorry..... you could not make to the highscore\n";
     else
     {
	 ofstream tfile("tmp.dat", ios::binary);
	 cout<<"Great you have got a highscore!!!!!\n";
	 cout<<"Enter your name: ";
	 char x[30];
	 cin.getline(x, 30);
	 strcpy(h.name, x);
	 int j;
	 for(j=4; j>i; j--)
	     temp[j] = temp[j-1];
	 temp[j] = h;
	 for(j=0; j<5; j++)
	     tfile.write((char*)&temp[j], sizeof(temp[j]));
         tfile.close();
         remove("hs.dat");
	 rename("tmp.dat", "hs.dat");
     }
     cout<<endl;
     for(i=0; i<78; i++)
	 cout<<"-";
     cout<<"\n\t\t\t H A L L     O F     F A M E\n";
     for(i=0;i<78; i++)
	cout<<"-";
     for(i=0; i<5; i++)
	 cout<<"\n"<<setw(30)<<temp[i].name<<"-------     "<<temp[i].score;
     cout<<endl;
     for(i=0; i<78; i++)
	cout<<"-";
     cout<<"\n\n";
}
示例#7
0
std::unique_ptr<TH1D> get_histogram(
    const std::string& FILE_NAME,
    const std::string& HISTOGRAM_NAME
) {
    // Open the file
    TFile tfile(FILE_NAME.c_str(), "READ");
    if (tfile.IsZombie()) {
        throw std::runtime_error("Could not open file " + FILE_NAME);
    }

    // Get the histogram
    std::unique_ptr<TH1D> histo(static_cast<TH1D*>(tfile.Get(HISTOGRAM_NAME.c_str())));
    if (histo.get() == nullptr || histo->IsZombie()) {
        throw std::runtime_error("Could not load histogram " + HISTOGRAM_NAME);
    }

    // Set weights
    histo->Sumw2();

    return histo;
}
示例#8
0
void Viewer::startTask1(QString tlist_file){
    QVector<QString> tlist;

    QFile tfile( tlist_file );
    if (tfile.open(QFile::ReadOnly)) {
        QTextStream in(&tfile);
        QString line = in.readLine();
        while (!line.isNull()) {
           tlist.push_back(line);
            line = in.readLine();
        }
        tfile.close();
     }
    else{
        qWarning("Could not open list of files for TASK 1");
        return;
    }

    qWarning("Start TASK 1 with %d files.",tlist.size());
    startTask1(tlist);
}
//	bench version
void cm_system(ofstream* file)
{
	//	one state per process
	states.resize(pars.P);

	//	initialise
	timer.reset();
	for (int p=0; p<pars.P; p++)
		states[p].init(pars, p);
	t_init = timer.elapsed();

	//	run
	vector<STATE_TYPE> buffer;
	buffer.resize(pars.P * 2); // double buffer

	timer.reset();
	if (file)
	{
		for (UINT32 n = 0; n < pars.N; n++)
		{
			//	double buffer
			STATE_TYPE* ibuf;
			STATE_TYPE* obuf;
			if (n % 2)
			{
				obuf = &buffer[pars.P];
				ibuf = &buffer[0];
			}
			else
			{
				obuf = &buffer[0];
				ibuf = &buffer[pars.P];
			}

			for (UINT32 p = pars.P; p != 0; p--)
			{
				//	get output of this process
				UINT32 po = p - 1;

				//	take input from this process
				UINT32 pi = po - 1;
				if (!po) pi = pars.P - 1;

				//	run job
				STATE_TYPE* src = states[po].step(ibuf[pi]);
				file->write((const char*) src, pars.E * sizeof(STATE_TYPE));
				obuf[po] = *src;
			}
		}
	}

	else
	{
		for (UINT32 n = 0; n < pars.N; n++)
		{
			//	double buffer
			STATE_TYPE* ibuf;
			STATE_TYPE* obuf;
			if (n % 2)
			{
				obuf = &buffer[pars.P];
				ibuf = &buffer[0];
			}
			else
			{
				obuf = &buffer[0];
				ibuf = &buffer[pars.P];
			}

			for (UINT32 p = pars.P; p != 0; p--)
			{
				//	get output of this process
				UINT32 po = p - 1;

				//	take input from this process
				UINT32 pi = po - 1;
				if (!po) pi = pars.P - 1;

				//	run job
				obuf[po] = *(states[po].step(ibuf[pi]));
			}

			//	output of process 0
			//cerr << obuf[0] << endl;
		}
	}
	t_run = timer.elapsed();

	//	output timings
	ofstream tfile("timing");
	tfile << t_init << " " << t_run;
	tfile.close();
}
示例#10
0
//-------------------------------------------------------------------------------------------
//      OBJファイルから読み込み処理を行います.
//-------------------------------------------------------------------------------------------
bool MeshOBJ::LoadOBJFile( const char *filename )
{
    std::ifstream   file;
    std::string     materialFile;
    std::string     curMaterial;

    const int BUFFER_LENGTH = 2048;
    char buf[BUFFER_LENGTH] = { 0 };
    std::vector<Vec3>   positions;
    std::vector<Vec3>   normals;
    std::vector<Vec2>   texcoords;
    bool initBox  = false;
    int  prevSize = 0;

    unsigned int total     = 0;
    unsigned int faceIndex = 0;
    unsigned int faceCount = 0;

    // ディレクトリ名を取り出す.
    {
        std::string directoryPath;
        std::string tfile( filename );
        size_t idx = tfile.find_last_of( '\\' );
        if ( idx == std::string::npos )
        { idx = tfile.find_last_of( '/' ); }
        if ( idx != std::string::npos )
        { m_DirectoryPath = tfile.substr( 0, idx + 1 ); }
    }

    // ファイルを開く
    file.open( filename, std::ios::in );

    // チェック
    if ( !file.is_open() )
    {
        std::cerr << "Error : File Open Failed.\n";
        std::cerr << "File Name : " << filename << std::endl;
        return false;
    }

    // ループ
    for( ;; )
    {
        file >> buf;
        if ( !file || file.eof() )
        { break; }

        // コメント
        if ( 0 == strcmp( buf, "#" ) )
        { continue; }

        // 頂点座標
        else if ( 0 == strcmp( buf, "v" ) )
        {
            Vec3 v;
            file >> v.x >> v.y >> v.z;
            positions.push_back( v );

            // バウンディングボックスの初期化
            if ( !initBox )
            {
                m_Box = BoundingBox( v );
                initBox = true;
            }

            // バウンディングボックスの算出
            m_Box.Merge( v );
        }

        // テクスチャ座標
        else if ( 0 == strcmp( buf, "vt" ) )
示例#11
0
void Documents::sOpenDoc(QString mode)
{
  QString ui;
  QString docType = _doc->currentItem()->rawValue("target_type").toString();
  int targetid = _doc->currentItem()->id("target_number");
  ParameterList params;
  if (docType == "Q" && mode == "view")
    params.append("mode", "viewQuote");
  else if (docType == "Q" && mode == "edit")
    params.append("mode", "editQuote");
  else
    params.append("mode", mode);

  // TODO: image -- change to use docass instead of imageass
  if (docType == "IMG")
  {
    XSqlQuery img;
    img.prepare("SELECT imageass_image_id "
                "FROM imageass "
                "WHERE (imageass_id=:imageass_id); ");
    img.bindValue(":imageass_id", _doc->id());
    img.exec();
    img.first();
    if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Getting Image Info"),
                             img, __FILE__, __LINE__))
      return;

    params.append("image_id", img.value("imageass_image_id").toInt());
    imageview newdlg(this, "", TRUE);
    newdlg.set(params);

    if (newdlg.exec() != QDialog::Rejected)
      refresh();
    return;
  }
  // TODO: url -- change to use docass instead of url
  // TODO: separate URL from FILE handling and replace use of url view
  else if (docType == "URL" || docType == "FILE")
  {
    if (mode == "edit")
    {
      ParameterList params;
      params.append("url_id", targetid);

      docAttach newdlg(this, "", TRUE);
      newdlg.set(params);
      newdlg.exec();

      refresh();
      return;
    }

    XSqlQuery qfile;
    qfile.prepare("SELECT url_id, url_source_id, url_source, url_title, url_url, url_stream"
                  " FROM url"
                  " WHERE (url_id=:url_id);");

    qfile.bindValue(":url_id", _doc->id());
    qfile.exec();

    // If file is in the database, copy to a temp. directory in the file system and open it.
    if (qfile.first() && (docType == "FILE"))
    {
      QFileInfo fi( qfile.value("url_url").toString() );
      QDir tdir;
      // TODO: QDesktopServices::openUrl(urldb) on windows does not open files
      // containing spaces. why not?
#ifdef Q_WS_WIN
      QString fileName = fi.fileName().remove(" ");
#else
      QString fileName = fi.fileName();
#endif
      QString filePath = tdir.tempPath() + "/xtTempDoc/" +
	                 qfile.value("url_id").toString() + "/";
      QFile tfile(filePath + fileName);

      // Remove any previous watches
      if (_guiClientInterface)
        _guiClientInterface->removeDocumentWatch(tfile.fileName());

      if (! tdir.exists(filePath))
        tdir.mkpath(filePath);

      if (!tfile.open(QIODevice::WriteOnly))
      {
        QMessageBox::warning( this, tr("File Open Error"),
                             tr("Could Not Create File %1.").arg(tfile.fileName()) );
        return;
      }
      tfile.write(qfile.value("url_stream").toByteArray());
      QUrl urldb;
      urldb.setUrl(tfile.fileName());
#ifndef Q_WS_WIN
      urldb.setScheme("file");
#endif
      tfile.close();
      if (! QDesktopServices::openUrl(urldb))
      {
        QMessageBox::warning(this, tr("File Open Error"),
			     tr("Could not open %1.").arg(urldb.toString()));
	return;
      }

      // Add a watch to the file that will save any changes made to the file back to the database.
      if (_guiClientInterface && !_readOnly) // TODO: only if NOT read-only
        _guiClientInterface->addDocumentWatch(tfile.fileName(),qfile.value("url_id").toInt());
      return;
    }
    else if (ErrorReporter::error(QtCriticalMsg, this,
                                  tr("Error Getting Assignment"),
                                  qfile, __FILE__, __LINE__))
      return;
    else
    {
      QUrl url(_doc->currentItem()->rawValue("description").toString());
      if (url.scheme().isEmpty())
        url.setScheme("file");
      QDesktopServices::openUrl(url);
      return;
    }
  }
  else
  {
    unsigned int i = 0;
    // TODO: find a better data structure than array of structs for _documentMap
    for (  ; i < sizeof(_documentMap) / sizeof(_documentMap[0]); i++)
      if (_documentMap[i].ident == docType)
      {
        params.append(_documentMap[i].keyparam, targetid);
        ui = _documentMap[i].uiname;
        break;
      }
    if (i >= sizeof(_documentMap) / sizeof(_documentMap[0]))
    {
      QMessageBox::critical(this, tr("Error"),
                            tr("Unknown document type %1").arg(docType));
      return;
    }
  }

  QWidget* w = 0;
  if (parentWidget()->window())
  {
    if (parentWidget()->window()->isModal())
      w = _guiClientInterface->openWindow(ui, params, parentWidget()->window(),
                                          Qt::WindowModal, Qt::Dialog);
    else
      w = _guiClientInterface->openWindow(ui, params, parentWidget()->window(),
                                          Qt::NonModal, Qt::Window);
  }

  if (w && w->inherits("QDialog"))
  {
    QDialog* newdlg = qobject_cast<QDialog*>(w);
    newdlg->exec();
  }

  refresh();
}
void CreateTorrentWindow::createFile(QString filename) {
    //Setup progress bar
    ui->progressBar->setVisible(true);
    ui->progressBar->setRange(0, 100);
    ui->progressBar->setValue(0);

    QFile ifile(filename);
    QByteArray read;
    ifile.open(QIODevice::ReadOnly);

    QCryptographicHash *h = new QCryptographicHash(QCryptographicHash::Md5);
    h->addData(ifile.readAll().constData());

    //Setting filename as hash of the file
    QString fname1 = QString(h->result().toHex()) + ".torrent";
    QFile tfile(fname1.toUtf8().constData());
    ifile.seek(0);
    if(!(tfile.open(QIODevice::Append)))
    {
       qDebug("File cannot be opened.");
       exit(0);
    }

    //Writing "name " followed by the source filename
    tfile.write("name ");
    QString name = this->clnt->editName(ifile.fileName());

    tfile.write(name.toUtf8().constData());
    tfile.write(QString(tr("\n")).toUtf8().constData());

    //Writing "piece-length " followed by length og the piece which is 256000
    tfile.write("piece-length ");
    tfile.write("256000");
    tfile.write(QString(tr("\n")).toUtf8().constData());

    //Writing "size " followed by size of file
    tfile.write("size ");
    tfile.write(QString::number(ifile.size()).toUtf8().constData());
    tfile.write(QString(tr("\n")).toUtf8().constData());

    //Writing number of pieces and piece hashes of all the pieces
    tfile.write("piece-hash ");
    qint64 pieces = ifile.size()/256000;
    if (pieces % 256000 != 0 || pieces == 0)
        pieces++;
    tfile.write(QString::number(pieces).toUtf8().constData());
    tfile.write(QString(tr("\n")).toUtf8().constData());

    int i;
    for (i = 0; i < pieces; i++) {
        ui->progressBar->setValue((i+1/pieces)*100);                                    //Updating progress bar
        read = ifile.read(256000);
        QCryptographicHash *ha = new QCryptographicHash(QCryptographicHash::Md5);
        ha->addData(read.constData());
        //ha->reset();
        QString hash = QString(ha->result().toHex());
        tfile.write(hash.toUtf8().constData());
        tfile.write(QString(tr("\n")).toUtf8().constData());
    }
    ui->progressBar->setValue((i/pieces)*100);
    tfile.close();
    QString finish = " F " + getAddress() + " " + fname1 + " ";                         //Notifying central server about creation
    this->clnt->socket->write(finish.toUtf8());
    this->clnt->socket->waitForBytesWritten();
    //qDebug() << finish ;
}
示例#13
0
int main() {

	string line;
	ifstream tfile("color.cfg");
	if (tfile.is_open()) {
		int obj_count = 0;
    	while (tfile.good()) {
    		for (int i = 0; i < 6; i++) {
      			getline(tfile, line);
      			if (line == "") {
      				break;
      			}
      			test_thresh[obj_count*6 + i] = atoi(line.c_str());
      			cout << test_thresh[obj_count*6 + i] << " ";
      		}
      		cout << endl;
      		if (line == "") {
      			break;
      		}
      		obj_count++;
    	}
    	tfile.close();
  	} else {
  		cout << "Unable to open file";
  	}
  	
    init_opencv();
		
	ofstream myfile("color.cfg");
	if (!myfile.is_open()) {
		cout << "failed to open file";
		return -1;
	}
	namedWindow("raw",1);
	namedWindow("blobs",1);
    //namedWindow("scatter",1);
    
    long double tLast;
    long double tAvg = 0;
    int k = 1;
    
    for (int i = 0; i < num_obj; i++) {
    	string s = obj[i];
    	cout << "Calibrating " << s << endl;
    	for (int j = 0; j < 6; j++) {
    		cout << test_thresh[i*6 + j] << " ";
    	}
    	cout << endl;
    	
    	while (1) {
    	
    	    tLast = clock();
    	    
    		int out = step(&raw_display, &hsv_display, &scatter_display,
    		    &(test_thresh[i*6]), 1);
    		    
    		long double tCurr = clock();
		    long double tDiff = tCurr - tLast;
		    tAvg = 0.9*tAvg + 0.1*tDiff;
		    
    		imshow("raw", *raw_display);
    		imshow("blobs", *hsv_display);
            //imshow("scatter", *scatter_display);
        			
		    if (i%100 == 0) {
		        //cout << out << endl;
		        //cout << CLOCKS_PER_SEC/tAvg << endl;
		    }
		    k++;
		    
        	char c = waitKey(10);
        	if (c == -1) {
        		continue;
        	}
        	if (c == ' ') {
        		for (int j = 0; j < 6; j++) {
		    		myfile << test_thresh[i*6 + j] << endl;
		    	}
        		break;
        	}
        	switch (c) {
        		case 'q':
        			test_thresh[i*6 + 0] += 1;
        			break;
        		case 'a':
        			test_thresh[i*6 + 0] -= 1;
        			break;
        		case 'w':
        			test_thresh[i*6 + 1] += 1;
        			break;
        		case 's':
        			test_thresh[i*6 + 1] -= 1;
        			break;
        		case 'e':
        			test_thresh[i*6 + 2] += 1;
        			break;
        		case 'd':
        			test_thresh[i*6 + 2] -= 1;
        			break;
        		case 'r':
        			test_thresh[i*6 + 3] += 1;
        			break;
        		case 'f':
        			test_thresh[i*6 + 3] -= 1;
        			break;
        		case 't':
        			test_thresh[i*6 + 4] += 1;
        			break;
        		case 'g':
        			test_thresh[i*6 + 4] -= 1;
        			break;
        		case 'y':
        			test_thresh[i*6 + 5] += 1;
        			break;
        		case 'h':
        			test_thresh[i*6 + 5] -= 1;
        			break;
        			
        		case 'Q':
        			test_thresh[i*6 + 0] += 10;
        			break;
        		case 'A':
        			test_thresh[i*6 + 0] -= 10;
        			break;
        		case 'W':
        			test_thresh[i*6 + 1] += 10;
        			break;
        		case 'S':
        			test_thresh[i*6 + 1] -= 10;
        			break;
        		case 'E':
        			test_thresh[i*6 + 2] += 10;
        			break;
        		case 'D':
        			test_thresh[i*6 + 2] -= 10;
        			break;
        		case 'R':
        			test_thresh[i*6 + 3] += 10;
        			break;
        		case 'F':
        			test_thresh[i*6 + 3] -= 10;
        			break;
        		case 'T':
        			test_thresh[i*6 + 4] += 10;
        			break;
        		case 'G':
        			test_thresh[i*6 + 4] -= 10;
        			break;
        		case 'Y':
        			test_thresh[i*6 + 5] += 10;
        			break;
        		case 'H':
        			test_thresh[i*6 + 5] -= 10;
        			break;
        	}
        	for (int j = 0; j < 6; j++) {
        		cout << test_thresh[i*6 + j] << " ";
        	}
        	cout << endl;
        	
    	}
    }
    
    myfile.close();
}
示例#14
0
int main(int argc, char** argv){
	QStringList arg;
	for(int i=0; i<argc; ++i){
		arg.append(argv[i]);
	}
	
	if(arg.length() != 4){
		help();
		return -1;
	}
	
	const QString sfile = arg[1];
	QFile ffile(sfile);
	if(!ffile.open(QIODevice::ReadOnly)){
		qerr << "Unable to open input file "<<sfile<<endl;
		help();
		return -1;
	}
	QTextStream tfile(&ffile);
	
	const QString slfile = arg[2];
	QFile flfile(slfile);
	if(!flfile.open(QIODevice::WriteOnly)){
		qerr << "Unable to open input file "<<slfile<<endl;
		help();
		return -1;
	}
	QTextStream lfile(&flfile);
	
	const QString sdfile = arg[3];
	QFile fdfile(sdfile);
	if(!fdfile.open(QIODevice::WriteOnly)){
		qerr << "Unable to open input file "<<sdfile<<endl;
		help();
		return -1;
	}
	QTextStream dfile(&fdfile);
	
	// read in transactions from file
	QList<Transaction> tlist = readTransactionFile(tfile);
	
	// create a map of transactions searchable by name
	QHash<QString,Transaction> tname = mapNameTransaction(tlist);
	
	// create the intermediate transaction states
	QHash<TransactionStateHead,TransactionState> tstate = generateTransactionState(tlist);
	
	// create a map of dependencies
	QHash<TransactionStateHead,QSet<TransactionEdge> > tgraph = generateStateMap(tstate);
	
	// create a reveresed set of dependencies
	QHash<TransactionStateHead,QSet<TransactionEdge> > reverse = reverseStateMap(tgraph);
	
	// create a trimmed set of dependencies
	PeerMap trimLive = trimStateMapLive(tgraph, reverse);
	PeerMap trimDead = trimStateMapDead(tgraph, reverse);
	
//	printTransactions(qout, tlist);
//	printTransactionRoot(qout, tstate);
	printTransactionGraph(lfile, trimLive, true);
	printTransactionGraph(dfile, trimDead, false);
	
	ffile.close();
	flfile.close();
	fdfile.close();
	
	return 0;
}