コード例 #1
0
ファイル: clientmodel.cpp プロジェクト: JacobBruce/Cryptonite
void ClientModel::updateTimer()
{
    // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change.
    // Periodically check and update with a timer.
    int newNumBlocks = getNumBlocks();
    int newNumHeaders = getNumHeaders();
    int totalMissing = getTotalMissing();
    int trieComplete = getTrieComplete();

    //printf("Tick\n");

    // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
    if (cachedNumBlocks != newNumBlocks || cachedNumHeaders != newNumHeaders ||
        cachedReindexing != fReindex || cachedImporting != fImporting || cachedTrieOnline != fTrieOnline ||
	cachedTotalMissing != totalMissing || cachedTrieComplete != trieComplete || cachedValidating != fValidating ||
	cachedProgress != nProgress)
    {
        cachedNumBlocks = newNumBlocks;
        cachedNumHeaders = newNumHeaders;
	cachedTotalMissing = totalMissing;
        cachedReindexing = fReindex;
        cachedImporting = fImporting;
	cachedTrieOnline = fTrieOnline;
	cachedTrieComplete = trieComplete;
	cachedValidating = fValidating;
	cachedProgress = nProgress;

        // ensure we return the maximum of newNumBlocksTotal and newNumBlocks to not create weird displays in the GUI
        emit numBlocksChanged(newNumBlocks, newNumHeaders);
    }

    emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
}
コード例 #2
0
ファイル: SpectraList.cpp プロジェクト: jmchilton/pepnovo
bool SpectraList::checkFilesReadOk() const
{
	cout << "Checking " << getNumHeaders() << " spectra..." << endl;
	size_t numErrors=0;
	for (size_t i=0; i<getNumHeaders(); i++)
	{
		const SingleSpectrumHeader* ssh = getSpectrumHeader(i);
		PeakList pl;
		pl.readPeaksToLocalAllocation(spectraAggregator_, ssh);		
		
		pl.getHeader()->printStats(0, cout, false);
		cout << "\t" << ssh->getOriginalNumPeaks() << " : " << pl.getNumPeaks();
		if (pl.getNumPeaks() == ssh->getOriginalNumPeaks())
		{
			cout << "\t+";
		}
		else
		{
			cout << "\t-";
			numErrors++;
		}

		if (pl.sanityCheck())
		{
			cout << " +";
		}
		else
		{
			cout << " -";
			numErrors++;
		}
		cout << endl;
	}

	cout << "Num errors found: " << numErrors << endl;
	return (numErrors == 0);
}