コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: golosio/XRayStudio
int MainWindow::LoadProject(QString proj_folder)
{
    QString s = QFileDialog::getOpenFileName(this, tr("Choose a file..."), proj_folder, tr("XRS project files (*.xrs)"));
    if (s=="") return 1;
    QFileInfo fi(s);
    QString path = fi.absolutePath();
    ifstream ifs(s.toStdString().c_str());
    if (!ifs) {
        xrs_error("Can not open project file!");
        return 1;
    }
    tmpProjectFolder = path;
    tmpProjectName = fi.completeBaseName();
    int x, y;
    string name;
    iconDiagram()->clear();
    while (ifs >> name >> x >> y) {
        DeviceInterf *dev_interf = new DeviceInterf(this);
        if (dev_interf->LoadNewDevice(path.toStdString(), name, name)!=0) {
            delete dev_interf;
            ifs.close();
            return 1;
        }
        QPixmap pix(path+"/"+name.c_str()+".png");
        if (iconDiagramWidget->iconDiagram()->addIcon(x,y, dev_interf, QPixmap(pix))!=0) return 1;
        ifstream ilk(QString(path+"/"+name.c_str()+".ilk").toStdString().c_str());
        if (ilk) {
            dev_interf->LoadDevice(ilk);
            ilk.close();
        }
    }
    ifs.close();

    return 0;
}
コード例 #2
0
ファイル: medium.cpp プロジェクト: drubbo/kinoglaz
			void Base::releaseFrame( size_t pos ) throw()
			{
				FrameData::Lock lk( _frame );
				It::Lock ilk( _it );
				// we won't release frames on non-live casts
				// since we may want to seek back
				size_t frameListSz = _frame.list.size();
				if ( _container->isLiveCast()
					&& pos < frameListSz
					&& ! _frame.list.is_null( pos )
					&& ! _it.model->hasType< Medium::Iterator::Loop >() )
				{
					// effectively release when every iterator has released the frame
					if ( _frame.list[ pos ].release() >= _it.instances.size() )
					{
						_frame.list.replace( pos, 0 );
						// update time of first frame
						if ( ++ pos >= frameListSz )
							_frame.timeFirst = _frame.timeLast;
						else
						{
							for( ; pos < frameListSz; ++ pos )
								if ( ! _frame.list.is_null( pos ) )
								{
									_frame.timeFirst = _frame.list[ pos ].getTime();
									break;
								}
						}
						// request more if buffer is low
						if ( this->getStoredDuration() <= Container::SIZE_LOW )
							_container->requestMoreFrames();
					}
						
/*					{
						_frame.list.erase( _frame.list.begin() + pos );
						for_each( _it.instances.begin(), _it.instances.end(), boost::bind( &Iterator::Base::frameRemoved, _1, pos ) );
					}*/
				}
			}