Example #1
0
PERROR MakeKeyMaterial( FRAME *frame, UBYTE *passphrase, struct PPTBase *PPTBase )
{
    ROWPTR cp, tmprow;
    WORD row;
    struct ExecBase *SysBase = PPTBase->lb_Sys;
    SHA_INFO sha = {0};
    PERROR res = PERR_OK;

    sha_init( &sha );

    InitProgress(frame,"Building key...", 0, frame->pix->height );

    /*
     *  First, use the passphrase for the key.
     */

    if( strlen(passphrase) > 0 ) sha_update( &sha, passphrase, strlen(passphrase) );

    if( tmprow = AllocVec( frame->pix->bytes_per_row, 0L ) ) {
        for( row = 0; row < frame->pix->height; row++ ) {
            WORD col;

            cp = GetPixelRow( frame, row );

            if( Progress( frame, row ) ) {
                res = PERR_BREAK;
                break;
            }

            for( col = 0; col < frame->pix->bytes_per_row; col++ ) {
                /* Use only significant bytes */
                tmprow[col] = cp[col] & 0xFE;
            }

            sha_update( &sha, tmprow, frame->pix->bytes_per_row );
        }

        // Use the passphrase again (why?)

        if( strlen(passphrase) > 0 ) sha_update( &sha, passphrase, strlen(passphrase) );

        FinishProgress( frame );
        sha_final( &sha );

        memcpy( key, &sha.digest[0], SHA_DIGESTSIZE );

        D(sha_print( &sha ) );

        FreeVec( tmprow );
    } else {
        SetErrorCode( frame, PERR_OUTOFMEMORY );
        res = PERR_OUTOFMEMORY;
    }

    return res;
}
Example #2
0
EditTagDialog::EditTagDialog(Application* app, QWidget* parent)
  : QDialog(parent),
    ui_(new Ui_EditTagDialog),
    app_(app),
    album_cover_choice_controller_(new AlbumCoverChoiceController(this)),
    loading_(false),
    ignore_edits_(false),
    tag_fetcher_(new TagFetcher(this)),
    cover_art_id_(0),
    cover_art_is_set_(false),
    results_dialog_(new TrackSelectionDialog(this))
{
  cover_options_.default_output_image_ =
      AlbumCoverLoader::ScaleAndPad(cover_options_, QImage(":nocover.png"));

  connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64,QImage,QImage)),
          SLOT(ArtLoaded(quint64,QImage,QImage)));

  connect(tag_fetcher_, SIGNAL(ResultAvailable(Song, SongList)),
          results_dialog_, SLOT(FetchTagFinished(Song, SongList)),
          Qt::QueuedConnection);
  connect(tag_fetcher_, SIGNAL(Progress(Song,QString)),
          results_dialog_, SLOT(FetchTagProgress(Song,QString)));
  connect(results_dialog_, SIGNAL(SongChosen(Song, Song)),
          SLOT(FetchTagSongChosen(Song, Song)));
  connect(results_dialog_, SIGNAL(finished(int)), tag_fetcher_, SLOT(Cancel()));

  album_cover_choice_controller_->SetApplication(app_);

  ui_->setupUi(this);
  ui_->splitter->setSizes(QList<int>() << 200 << width() - 200);
  ui_->loading_label->hide();

  // An editable field is one that has a label as a buddy.  The label is
  // important because it gets turned bold when the field is changed.
  foreach (QLabel* label, findChildren<QLabel*>()) {
    QWidget* widget = label->buddy();
    if (widget) {
      // Store information about the field
      fields_ << FieldData(label, widget, widget->objectName());

      // Connect the Reset signal
      if (dynamic_cast<ExtendedEditor*>(widget)) {
        connect(widget, SIGNAL(Reset()), SLOT(ResetField()));
      }

      // Connect the edited signal
      if (qobject_cast<QLineEdit*>(widget)) {
        connect(widget, SIGNAL(textChanged(QString)), SLOT(FieldValueEdited()));
      } else if (qobject_cast<QPlainTextEdit*>(widget)) {
        connect(widget, SIGNAL(textChanged()), SLOT(FieldValueEdited()));
      } else if (qobject_cast<QSpinBox*>(widget)) {
        connect(widget, SIGNAL(valueChanged(int)), SLOT(FieldValueEdited()));
      }
    }
  }
Example #3
0
void CGameGraphBuilder::fill_distances		(const float &start, const float &amount)
{
	Progress							(start);

	m_distances.resize					(graph().vertices().size());
	{
		DISTANCES::iterator				I = m_distances.begin();
		DISTANCES::iterator				E = m_distances.end();
		for ( ; I != E; I++) {
			(*I).resize					(level_graph().header().vertex_count());
			xr_vector<u32>::iterator	i = (*I).begin();
			xr_vector<u32>::iterator	e = (*I).end();
			for ( ; i != e; i++)
				*i						= u32(-1);
		}
	}

	Progress							(start + amount);
}
Example #4
0
void Cf3Replay::Record()
{
	(*m_iPointer).pressed[m_nPointer]=(*m_iPointer).pushed[m_nPointer]=0;
	for (int i=0; i<8; i++) {
		if (f3Input.GetKeyPressed(i+1))	(*m_iPointer).pressed	[m_nPointer] |= (1<<i);
		if (f3Input.GetKeyPushed(i+1))	(*m_iPointer).pushed	[m_nPointer] |= (1<<i);
	}
	Progress();
	m_nSize++;
}
Example #5
0
void CGameGraphBuilder::optimize_graph		(const float &start, const float &amount)
{
	Progress					(start);

	Msg							("Optimizing graph");

	Msg							("edges before optimization : %d",graph().edge_count());

	create_tripples				(start + .00f, amount*.50f);

	TRIPPLES::const_iterator	I = m_tripples.begin();
	TRIPPLES::const_iterator	E = m_tripples.end();
	for ( ; I != E; ++I)
		process_tripple			(*I);

	Msg							("edges after optimization : %d",graph().edge_count());

	Progress					(start + amount);
}
Example #6
0
bool OGL_LoadScreen::Start()
{
	// load the image
	FileSpecifier File;
	if (path.size() == 0) return use = false;
	if (!File.SetNameWithPath(path.c_str())) return use = false;
	if (!image.LoadFromFile(File, ImageLoader_Colors, 0)) return use = false;

	if (!blitter.Load(image)) return use = false;

	int screenWidth, screenHeight;
	MainScreenSize(screenWidth, screenHeight);
	bound_screen();
	
	// the true width/height
	int imageWidth = static_cast<int>(image.GetWidth() * image.GetVScale());
	int imageHeight = static_cast<int>(image.GetHeight() * image.GetUScale());

	if (scale)
	{
		if (stretch)
		{
			m_dst.w = screenWidth;
			m_dst.h = screenHeight;
		}
		else if (imageWidth / imageHeight > screenWidth / screenHeight) 
		{
			m_dst.w = screenWidth;
			m_dst.h = imageHeight * screenWidth / imageWidth;
		} 
		else 
		{
			m_dst.w = imageWidth * screenHeight / imageHeight;
			m_dst.h = screenHeight;
		}
	}
	else
	{
		m_dst.w = imageWidth;
		m_dst.h = imageHeight;
	}
	m_dst.x = (screenWidth - m_dst.w) / 2;
	m_dst.y = (screenHeight - m_dst.h) / 2;
	
	x_offset = m_dst.x;
	y_offset = m_dst.y;
	x_scale = m_dst.w / (double) imageWidth;
	y_scale = m_dst.h / (double) imageHeight;
						  
	OGL_ClearScreen();
	
	Progress(0);

	return use = true;
}
Example #7
0
void CBuild::u_Tesselate(tesscb_estimator* cb_E, tesscb_face* cb_F, tesscb_vertex* cb_V)
{
	// main process
	FPU::m64r					();
	Status						("Tesselating...");
	g_bUnregister				= false;

	u32		counter_create		= 0;
	u32		cnt_verts			= lc_global_data()->g_vertices().size();
	//u32		cnt_faces			= g_faces.size();
	
	for (u32 I=0; I<lc_global_data()->g_faces().size(); ++I)
	{
		Face* F					= lc_global_data()->g_faces()[I];
		if (0==F)				
			continue;
		if( !check_and_destroy_splited( I ) )
			continue;

		Progress				(float(I)/float(lc_global_data()->g_faces().size()));
		int max_id = -1;
		if( !do_tesselate_face( *F, cb_E, max_id ) )
			continue;

		xr_vector<Face*>		adjacent_vec;
		Vertex					*V1,*V2;
		CollectProblematicFaces( *F, max_id, adjacent_vec, &V1, &V2 );
		++counter_create;
		if (0==(counter_create%10000))	
		{
			for (u32 I=0; I<lc_global_data()->g_vertices().size(); ++I)	
				if (lc_global_data()->g_vertices()[I]->m_adjacents.empty())	
					lc_global_data()->destroy_vertex	(lc_global_data()->g_vertices()[I]);

			Status				("Working: %d verts created, %d(now) / %d(was) ...",counter_create,lc_global_data()->g_vertices().size(),cnt_verts);
			FlushLog			();
		}

		tessalate_faces( adjacent_vec, V1, V2, cb_F, cb_V  );
	}

		// Cleanup
		for (u32 I=0; I<lc_global_data()->g_faces().size(); ++I)	
			if (0!=lc_global_data()->g_faces()[I] && lc_global_data()->g_faces()[I]->flags.bSplitted)	
				lc_global_data()->destroy_face	(lc_global_data()->g_faces()[I]);

		for (u32 I=0; I<lc_global_data()->g_vertices().size(); ++I)	
			if (lc_global_data()->g_vertices()[I]->m_adjacents.empty())				
				lc_global_data()->destroy_vertex	(lc_global_data()->g_vertices()[I]);

		lc_global_data()->g_faces().erase		(std::remove(lc_global_data()->g_faces().begin(),lc_global_data()->g_faces().end(),(Face*)0),lc_global_data()->g_faces().end());
		lc_global_data()->g_vertices().erase	(std::remove(lc_global_data()->g_vertices().begin(),lc_global_data()->g_vertices().end(),(Vertex*)0),lc_global_data()->g_vertices().end());
		g_bUnregister		= true;
}
Example #8
0
void CBuild::CorrectTJunctions()
{
	Status					("Processing...");
	vecJunctions			= xr_new<xr_vector<record> > (); vecJunctions->reserve	(1024);
	vecEdges				= xr_new<xr_vector<record> > (); vecEdges->reserve		(1024);

	for (u32 I=0; I<g_faces.size(); I++)
	{
		Face* F = g_faces[I];

		// Iterate on edges
		for (u32 e=0; e<3; e++)
		{
			Vertex			*vA,*vB;
			F->EdgeVerts	(e,&vA,&vB);

			// Iterate on 'vA'-adjacent faces
			for (u32 f1=0; f1!=vA->adjacent.size(); f1++)
			{
				Face*	F1	= vA->adjacent[f1];

				// Iterate on it's edges
				for (u32 e1=0; e1<3; e1++)
				{
					Vertex			*v1,*v2;
					F1->EdgeVerts	(e1,&v1,&v2);
					edge						(v1,v2);
					if (v1==vA && v2!=vB)		check(vA,vB,v2);
					else if (v2==vA && v1!=vB)	check(vA,vB,v1);
				}
			}
			// Iterate on 'vB'-adjacent faces
			for (u32 f2=0; f2!=vB->adjacent.size(); f2++)
			{
				Face*	F2	= vB->adjacent[f2];

				// Iterate on it's edges
				for (u32 e1=0; e1<3; e1++)
				{
					Vertex			*v1,*v2;
					F2->EdgeVerts	(e1,&v1,&v2);
					edge						(v1,v2);
					if (v1==vB && v2!=vA)		check(vA,vB,v2);
					else if (v2==vB && v1!=vA)	check(vA,vB,v1);
				}
			}
		}
		Progress(float(I)/float(g_faces.size()));
	}
	clMsg("*** %d junctions and %d long edges found.",vecJunctions->size(),vecEdges->size());

	xr_delete(vecJunctions);
	xr_delete(vecEdges);
}
Example #9
0
SRes MtProgress_Set(CMtProgress *p, unsigned index, UInt64 inSize, UInt64 outSize)
{
  SRes res;
  CriticalSection_Enter(&p->cs);
  UPDATE_PROGRESS(inSize, p->inSizes[index], p->totalInSize)
  UPDATE_PROGRESS(outSize, p->outSizes[index], p->totalOutSize)
  if (p->res == SZ_OK)
    p->res = Progress(p->progress, p->totalInSize, p->totalOutSize);
  res = p->res;
  CriticalSection_Leave(&p->cs);
  return res;
}
ECommandResult::Type FPerforceSourceControlProvider::ExecuteSynchronousCommand(FPerforceSourceControlCommand& InCommand, const FText& Task, bool bSuppressResponseMsg)
{
	ECommandResult::Type Result = ECommandResult::Failed;

	struct Local
	{
		static void CancelCommand(FPerforceSourceControlCommand* InControlCommand)
		{
			InControlCommand->Cancel();
		}
	};

	// Display the progress dialog
	FScopedSourceControlProgress Progress(Task, FSimpleDelegate::CreateStatic(&Local::CancelCommand, &InCommand));

	// Perform the command asynchronously
	IssueCommand( InCommand, false );

	// Wait until the command has been processed
	while (!InCommand.bCancelledWhileTryingToConnect && CommandQueue.Contains(&InCommand))
	{
		// Tick the command queue and update progress.
		Tick();

		Progress.Tick();

		// Sleep for a bit so we don't busy-wait so much.
		FPlatformProcess::Sleep(0.01f);
	}

	if (InCommand.bCancelled)
	{
		Result = ECommandResult::Cancelled;
	}
	else if (InCommand.bCommandSuccessful)
	{
		Result = ECommandResult::Succeeded;
	}

	// If the command failed, inform the user that they need to try again
	if ( !InCommand.bCancelled && Result != ECommandResult::Succeeded && !bSuppressResponseMsg )
	{
		FMessageDialog::Open( EAppMsgType::Ok, LOCTEXT("Perforce_ServerUnresponsive", "Perforce server is unresponsive. Please check your connection and try again.") );
	}

	// Delete the command now if not marked as auto-delete
	if (!InCommand.bAutoDelete)
	{
		delete &InCommand;
	}

	return Result;
}
Example #11
0
void CBuild::SaveTREE	(IWriter &fs)
{
	CMemoryWriter		MFS;

	Status				("Geometry buffers...");
	xr_vector<u32>		remap;
	remap.reserve		(g_tree.size());
	for (u32 rid=0; rid<g_tree.size(); rid++)	{
		OGF*	o		= dynamic_cast<OGF*>	(g_tree[rid]);
		if		(o)		remap.push_back(rid);
	}
	std::stable_sort	(remap.begin(),remap.end(),remap_order);
	clMsg				("remap-size: %d / %d",remap.size(),g_tree.size());
	for (u32 sid=0; sid<remap.size(); sid++)	{
		u32				id	= remap[sid];
		//clMsg			("%3d: subdiv: %d",sid,id);
		g_tree[id]->PreSave	(id);
	}

	Status				("Visuals...");
	fs.open_chunk		(fsL_VISUALS);
	for (xr_vector<OGF_Base*>::iterator it = g_tree.begin(); it!=g_tree.end(); it++)	{
		u32			idx = u32(it-g_tree.begin());
		MFS.open_chunk	(idx);
		(*it)->Save		(MFS);
		MFS.close_chunk	();
		Progress		(float(idx)/float(g_tree.size()));
	}
	fs.w				(MFS.pointer(),MFS.size());
	fs.close_chunk		();
	clMsg				("Average: %d verts/%d faces, 50(%2.1f), 100(%2.1f), 500(%2.1f), 1000(%2.1f), 5000(%2.1f)",
		g_batch_verts/g_batch_count,
		g_batch_faces/g_batch_count,
		100.f * float(g_batch_50)/float(g_batch_count),
		100.f * float(g_batch_100)/float(g_batch_count),
		100.f * float(g_batch_500)/float(g_batch_count),
		100.f * float(g_batch_1000)/float(g_batch_count),
		100.f * float(g_batch_5000)/float(g_batch_count)
		);
	mem_Compact			();

	SaveGEOMs			("level.geom",	g_VB,g_IB,g_SWI);	// Normal
	SaveGEOMs			("level.geomx",	x_VB,x_IB,x_SWI);	// Fast-Path

	Status				("Shader table...");
	fs.open_chunk		(fsL_SHADERS);
	fs.w_u32			(g_Shaders.size());
	for (xr_vector<LPCSTR>::iterator T=g_Shaders.begin(); T!=g_Shaders.end(); T++)
		fs.w_stringZ	(*T);
	fs.close_chunk		();
	//mem_Compact			();
}
Example #12
0
void CGameGraphBuilder::build_cross_table	(const float &start, const float &amount)
{
	Progress				(start);
	
	Msg						("Building cross table");

//	CTimer					timer;
//	timer.Start				();

	fill_marks				(start + 0.000000f*amount,0.018725f*amount);
//	Msg						("CT : %f",timer.GetElapsed_sec());
	fill_distances			(start + 0.018725f*amount,0.183732f*amount);
//	Msg						("CT : %f",timer.GetElapsed_sec());
	iterate_distances		(start + 0.202457f*amount,0.757202f*amount);
//	Msg						("CT : %f",timer.GetElapsed_sec());
	save_cross_table		(start + 0.959659f*amount,0.040327f*amount);
//	Msg						("CT : %f",timer.GetElapsed_sec());
	load_cross_table		(start + 0.999986f*amount,0.000014f*amount);
//	Msg						("CT : %f",timer.GetElapsed_sec());
	
	Progress				(start + amount);
}
Example #13
0
//CALLBACK!
void
Jabber::Authorized()
{
	SetAway(false);
	
	fPerc +=0.3333;
	fAuth=true;
	Progress("Jabber Login", "Jabber: Authorized", fPerc);
	LOG(kProtocolName, liDebug, "Jabber:Login %f - Authorized",fPerc) ;
	CheckLoginStatus();
	
	JabberHandler::Authorized();
}
Example #14
0
void					vfRecurseUpdate(u32 dwStartNodeID, u32 percent, u32 iVertexCount)
{
	xr_vector<u32>			curr_fringe, next_fringe;
	curr_fringe.reserve		(g_tDistances->size());
	next_fringe.reserve		(g_tDistances->size());
	g_tDistances->assign	(g_tDistances->size(),u32(-1));
	curr_fringe.push_back	(dwStartNodeID);
	u32						curr_dist = 0, total_count = 0;
	Progress				(float(percent)/float(iVertexCount));
	for (;!curr_fringe.empty();) {
		xr_vector<u32>::iterator	I = curr_fringe.begin();
		xr_vector<u32>::iterator	E = curr_fringe.end();
		for ( ; I != E; ++I) {
			(*g_tDistances)[*I]				= curr_dist;
			CLevelGraph::const_iterator		i, e;
			CLevelGraph::CVertex			*node = (*g_tMap).vertex(*I);
			(*g_tMap).begin					(*I,i,e);
			for ( ; i != e; ++i) {
				u32							dwNexNodeID = node->link(i);
				if (!(*g_tMap).valid_vertex_id(dwNexNodeID) || (*g_tMarks)[dwNexNodeID])
					continue;
				if ((*g_tDistances)[dwNexNodeID] > curr_dist) {
					next_fringe.push_back(dwNexNodeID);
					(*g_tMarks)[dwNexNodeID] = true;
				}
			}
		}
		I = curr_fringe.begin();
		E = curr_fringe.end();
		for ( ; I != E; ++I)
			(*g_tMarks)[*I] = false;

		total_count		+= curr_fringe.size();
		curr_fringe		= next_fringe;
		next_fringe.clear();
		++curr_dist;
		Progress			(float(percent)/float(iVertexCount) + float(total_count)/(float(iVertexCount)*float(g_tMap->header().vertex_count())));
	}
}
DFUEngine::Result DFUEngineBase::DoRecover(const DFUEngine::Result &failure)
{
	DFUEngine::Result result;
	DFURequests::DFUStatus status;

	// Delay a little before starting the recovery action
	Progress(DFUEngine::recover_clean_up, failure);
	Sleep(recoverDelay);

	// Ensure that the transport has been started
	result = DoConnect(false, false);
	if (!result) return result;

	// Abort any DFU operation
	result = transport->GetStatus(status);
	if (result && transport->CanAbort(status.bState))
	{
		result = transport->Abort();
	}
	if (result && transport->CanClrStatus(status.bState))
	{
		result = transport->ClrStatus();
	}
	if (!result)
	{
		// Disconnect and reconnect the transport if any problem
		Progress(DFUEngine::recover_fail, failure);
		result = transport->Disconnect();
		if (result) result = DoConnect(false, false);
		if (!result) return result;
	}

	// Perform a reset and disconnect the transport
	result = transport->Reset(false);
	if (!result) return result;

	// Assume successful if this point reached
	return DFUEngine::success;
}
Example #16
0
void CGameGraphBuilder::load_cross_table	(const float &start, const float &amount)
{
	Progress				(start);

	Msg						("Loading cross table");

#ifndef PRIQUEL
	string_path				file_name;
	strconcat				(sizeof(file_name), file_name,*m_level_name,CROSS_TABLE_NAME_RAW);
#endif // PRIQUEL

	VERIFY					(!m_cross_table);
	m_cross_table			= xr_new<CGameLevelCrossTable>(
#ifdef PRIQUEL
		m_cross_table_name
#else // PRIQUEL
		file_name
#endif // PRIQUEL
	);

	Progress				(start + amount);
}
ECommandResult::Type FSubversionSourceControlProvider::ExecuteSynchronousCommand(FSubversionSourceControlCommand& InCommand, const FText& Task, bool bSuppressResponseMsg)
{
	ECommandResult::Type Result = ECommandResult::Failed;

	// Display the progress dialog if a string was provided
	{
		FScopedSourceControlProgress Progress(Task);

		// Perform the command asynchronously
		IssueCommand( InCommand, false );

		while(!InCommand.bExecuteProcessed)
		{
			// Tick the command queue and update progress.
			Tick();
			
			Progress.Tick();

			// Sleep for a bit so we don't busy-wait so much.
			FPlatformProcess::Sleep(0.01f);
		}
	
		// always do one more Tick() to make sure the command queue is cleaned up.
		Tick();

		if(InCommand.bCommandSuccessful)
		{
			Result = ECommandResult::Succeeded;
		}
	}
	

	// If the command failed, inform the user that they need to try again
	if ( Result != ECommandResult::Succeeded && !bSuppressResponseMsg )
	{
		FMessageDialog::Open( EAppMsgType::Ok, LOCTEXT("Subversion_ServerUnresponsive", "Subversion repository is unresponsive. Please check your connection and try again.") );
	}

	// Delete the command now
	check(!InCommand.bAutoDelete);

	// ensure commands that are not auto deleted do not end up in the command queue
	if ( CommandQueue.Contains( &InCommand ) ) 
	{
		CommandQueue.Remove( &InCommand );
	}

	delete &InCommand;

	return Result;
}
Example #18
0
    void TestBackTrace ()
    {
        bool rc = true;

        TestHeader("backtrace test");

        Tracker2 t;

        t.doTest(25);
        Progress(rc, "minimal functionality");
        t.doTest(25);
        rc = (t._codepoints[10] != 0);
        Progress(rc, "many levels");
        rc = (t.found() > 10);
        Progress(rc, "many levels retval");
        t.doTest(8);
        rc = (t.found() == 8);
        Progress(rc, "few levels retval");
        rc = (t._codepoints[8] == 0);
        Progress(rc, "few levels");

        PrintSeparator();
    }
void ThreadResult::FileChecked(const QString &file)
{
    QMutexLocker locker(&mutex);

    mProgress += QFile(file).size();
    mFilesChecked ++;

    if (mMaxProgress > 0) {
        const int value = static_cast<int>(PROGRESS_MAX * mProgress / mMaxProgress);
        const QString description = tr("%1 of %2 files checked").arg(mFilesChecked).arg(mTotalFiles);

        emit Progress(value, description);
    }
}
void DFUEngineBase::AccurateSleep(uint32 milliseconds, DFUEngine::SubOperation subOperation)
{
	// Loop until done
	while (0 < milliseconds)
	{
		// Update the progress indicator
		Progress(subOperation, milliseconds / 1000);

		// Sleep for a second (plus any fractional part) of the remaining time
		uint32 sleep = min(milliseconds, 1000 + milliseconds % 1000);
		AccurateSleep(sleep);
		milliseconds -= sleep;
	}
}
Example #21
0
void TagFetcher::PuidFound(int index, const QString& puid) {
  if (index >= songs_.count()) {
    return;
  }

  const Song& song = songs_[index];

  if (puid.isEmpty()) {
    emit ResultAvailable(song, SongList());
    return;
  }

  emit Progress(song, tr("Downloading metadata"));
  musicbrainz_client_->Start(index, puid);
}
Example #22
0
void TagFetcher::StartFetch(const SongList& songs) {
  Cancel();

  songs_ = songs;

  QFuture<QString> future = QtConcurrent::mapped(songs_, GetFingerprint);
  fingerprint_watcher_ = new QFutureWatcher<QString>(this);
  fingerprint_watcher_->setFuture(future);
  connect(fingerprint_watcher_, SIGNAL(resultReadyAt(int)),
          SLOT(FingerprintFound(int)));

  for (const Song& song : songs) {
    emit Progress(song, tr("Fingerprinting song"));
  }
}
Example #23
0
void xrSaveNodes(LPCSTR N, LPCSTR out_name)
{
	Msg				("NS: %d, CNS: %d, ratio: %f%%",sizeof(vertex),sizeof(CLevelGraph::CVertex),100*float(sizeof(CLevelGraph::CVertex))/float(sizeof(vertex)));

	Msg				("Renumbering nodes...");

	string_path		fName; 
	strconcat		(sizeof(fName),fName,N,out_name);

	IWriter			*fs = FS.w_open(fName);

	// Header
	Status			("Saving header...");
	hdrNODES		H;
	H.version		= XRAI_CURRENT_VERSION;
	H.count			= g_nodes.size();
	H.size			= g_params.fPatchSize;
	H.size_y		= CalculateHeight(H.aabb);
	H.guid			= generate_guid();
	fs->w			(&H,sizeof(H));
	
//	fs->w_u32		(g_covers_palette.size());
//	for (u32 j=0; j<g_covers_palette.size(); ++j)
//		fs->w		(&g_covers_palette[j],sizeof(g_covers_palette[j]));

	// All nodes
	Status			("Saving nodes...");
	for (u32 i=0; i<g_nodes.size(); ++i) {
		vertex			&N	= g_nodes[i];
		NodeCompressed	NC;
		Compress		(NC,N,H);
		compressed_nodes.push_back(NC);
	}

	xr_vector<u32>	sorted;
	xr_vector<u32>	renumbering;
	CNodeRenumberer	A(compressed_nodes,sorted,renumbering);

	for (u32 i=0; i<g_nodes.size(); ++i) {
		fs->w			(&compressed_nodes[i],sizeof(NodeCompressed));
		Progress		(float(i)/float(g_nodes.size()));
	}
	// Stats
	u32	SizeTotal	= fs->tell();
	Msg				("%dK saved",SizeTotal/1024);

	FS.w_close		(fs);
}
Example #24
0
void Cf3Replay::Save(Cf3StageFile *stage, int map)
{
	if (CApp::MakeFileName(m_FileName,"f3r",theSetting->m_RecordNumber,true)) {
		Cf3StageFile data;
		DWORD chunk, size;
		BYTE* ptr;
		// キー入力情報をこーんぽたーじゅ(謎)
		ptr = new BYTE[m_nSize*2];
		Seek();
		while(!Finished()) {
			ptr[m_nProgress*2	] = (*m_iPointer).pressed	[m_nPointer];
			ptr[m_nProgress*2+1	] = (*m_iPointer).pushed	[m_nPointer];
			Progress();
		}
		data.SetStageData(CT_RPLY, m_nSize*2, ptr);
		delete[]ptr;
		// 必要なステージ情報をコピーする
		if (ptr=stage->GetStageData(chunk=CT_TITL,&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=CT_HITS,&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_TL00,map),&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_M000,map),&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_M100,map),&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_M200,map),&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=CT_MCD0|(0<<24),&size))
			data.SetStageData(chunk,size,ptr);
		ef (ptr=stage->GetStageData(chunk=CT_MCF0|(0<<24),&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=CT_MCD0|(1<<24),&size))
			data.SetStageData(chunk,size,ptr);
		ef (ptr=stage->GetStageData(chunk=CT_MCF0|(1<<24),&size))
			data.SetStageData(chunk,size,ptr);
		if (ptr=stage->GetStageData(chunk=CT_MCD0|(2<<24),&size))
			data.SetStageData(chunk,size,ptr);
		ef (ptr=stage->GetStageData(chunk=CT_MCF0|(2<<24),&size))
			data.SetStageData(chunk,size,ptr);
		// 追加の情報
		data.SetStageData(CT_STGN, 4, &map);
		data.SetStageData(CT_GRVT, 4, &theSetting->m_Gravity);
		data.SetStageData(CT_HYPR, 4, &theSetting->m_Hyper);
		data.Write(m_FileName);
	}
}
Example #25
0
STDMETHODIMP CTxtFile::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
	CTxtXmlFile file;
	//As Text
	try
	{
		file.txt_LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
		Progress(0, 1000000);
	}
	catch(...)
	{
		return S_FALSE;
	}

	return S_OK;
}
Example #26
0
void CBuild::SaveSectors(IWriter& fs)
{
	CMemoryWriter MFS;
	Status("Processing...");

	// validate & save
	for (u32 I=0; I<g_sectors.size(); I++)
	{
		MFS.open_chunk(I);
		g_sectors[I]->Validate();
		g_sectors[I]->Save(MFS);
		MFS.close_chunk();
		Progress(float(I)/float(g_sectors.size()));
	}

	fs.w_chunk(fsL_SECTORS,MFS.pointer(),MFS.size());
}
Example #27
0
STDMETHODIMP CTxtFile::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
	try
	{
		CTxtXmlFile file;

		file.txt_SaveToFile(sDstFileName, sSrcPath, sXMLOptions);
		
		Progress(0, 1000000);
	}
	catch(...)
	{
		return S_FALSE;
	}

  return S_OK;
}
Example #28
0
VOID CPatch::DrawProgressImage(VOID)
{
	long	lSpace;
	double	dSpace;
	int		Height;
	int		Width;
	RECT	tRect;
	HDC		hdc;
	HDC		MemDC,MemDC2;
	HBITMAP OldBitmap1;
	HBITMAP OldBitmap2;
	BITMAP	bit;
	PAINTSTRUCT PaintStruct;

	BeginPaint(g_xMainWnd.GetSafehWnd(),&PaintStruct);
	GetClientRect(g_xMainWnd.GetSafehWnd(),&tRect);

	hdc		= GetDC(g_xMainWnd.GetSafehWnd());
	MemDC	= CreateCompatibleDC(hdc);
	MemDC2	= CreateCompatibleDC(hdc);

	OldBitmap1	= (HBITMAP)SelectObject(MemDC, m_xBmp[0]);
	OldBitmap2	= (HBITMAP)SelectObject(MemDC2, m_xBmp[1]);

	GetObject(m_xBmp[0],sizeof(BITMAP), &bit);

	Width	= bit.bmWidth;
	Height	= bit.bmHeight;
	dSpace	= (Height / 100.0) * (100 - Progress(m_TheAmount, m_AnAmount % (m_TheAmount + 1)));
	lSpace	= (long)dSpace;

	if(lSpace < 0) lSpace = 0;


	BitBlt(MemDC, 0, lSpace, tRect.right, tRect.bottom, MemDC2, 0, lSpace, SRCCOPY);
	BitBlt(hdc, 0, 0, tRect.right, tRect.bottom, MemDC, 0, 0, SRCCOPY);

	SelectObject(MemDC, OldBitmap1);
	SelectObject(MemDC2, OldBitmap2);

	DeleteDC(MemDC);
	DeleteDC(MemDC2);
	EndPaint(g_xMainWnd.GetSafehWnd(), &PaintStruct);
	InvalidateRect(g_xMainWnd.GetSafehWnd(), &tRect, FALSE);	
}
Example #29
0
void AnnotEdge()
	{
	const char *InputFileName = RequiredValueOpt("annotedge");
	const char *RepeatFileName = RequiredValueOpt("rep");
	const char *OutputFileName = RequiredValueOpt("out");

	ProgressStart("Reading repeat file");
	int RepCount;
	RepData *Reps = ReadReps(RepeatFileName, &RepCount);
	ProgressDone();

	Progress("%d records", RepCount);

	FILE *fInput = OpenStdioFile(InputFileName);
	FILE *fOutput = OpenStdioFile(OutputFileName, FILEIO_MODE_WriteOnly);

	ProgressStart("Transferring annotation");
	GFFRecord Rec;
	while (GetNextGFFRecord(fInput, Rec))
		{
		const bool Rev = (Rec.Strand == '-');
		const char *Annot = MakeAnnotEdge(Rec.SeqName, Rec.Start-1, Rec.End-1, Rev,
		  Reps, RepCount);

		fprintf(fOutput, "%s\t%s\t%s\t%d\t%d\t%.3g\t%c",
		//                0   1   2   3   4   5     6
		  Rec.SeqName,	// 0
		  Rec.Source,	// 1
		  Rec.Feature,	// 2
		  Rec.Start,	// 3
		  Rec.End,		// 4
		  Rec.Score,	// 5
		  Rec.Strand);	// 6

		if (-1 == Rec.Frame)
			fprintf(fOutput, "\t.");
		else
			fprintf(fOutput, "\t%d", Rec.Frame);

		fprintf(fOutput, "\t%s ; Annot \"%s\"\n", Rec.Attrs, Annot);
		}
	fclose(fInput);
	fclose(fOutput);
	ProgressDone();
	}
	void CProgress::RunL()
		{
		TInt err = iStatus.Int();
		// When progres is complete, do
		if(err == KErrNone)
			{
			iLogger.Log(_L("Iap %d on network %d progress %d completed, error %d"),
				iPref.IapId(), iPref.NetId(), iProgress().iStage , iProgress().iError);
			if (iProgress().iStage != KLinkLayerOpen)
				Progress();
			else if(iSavedStatus)
				{
				iLogger.Log(_L("Completing Progress object"));
				User::RequestComplete(iSavedStatus, err);
				iSavedStatus = NULL;
				}
			}
		}