コード例 #1
0
void CSearchManager::UpdateStats() throw()
{
	uint8_t m_totalFile = 0;
	uint8_t m_totalStoreSrc = 0;
	uint8_t m_totalStoreKey = 0;
	uint8_t m_totalSource = 0;
	uint8_t m_totalNotes = 0;
	uint8_t m_totalStoreNotes = 0;
		
	for (SearchMap::const_iterator it = m_searches.begin(); it != m_searches.end(); ++it) {
		switch(it->second->GetSearchTypes()){
			case CSearch::FILE: {
				m_totalFile++;
				break;
			}
			case CSearch::STOREFILE: {
				m_totalStoreSrc++;
				break;
			}
			case CSearch::STOREKEYWORD:	{
				m_totalStoreKey++;
				break;
			}
			case CSearch::FINDSOURCE: {
				m_totalSource++;
				break;
			}
			case CSearch::STORENOTES: {
				m_totalStoreNotes++;
				break;
			}
			case CSearch::NOTES: {
				m_totalNotes++;
				break;
			}
			default:
				break;
		}
	}

	CPrefs *prefs = CKademlia::GetPrefs();
	prefs->SetTotalFile(m_totalFile);
	prefs->SetTotalStoreSrc(m_totalStoreSrc);
	prefs->SetTotalStoreKey(m_totalStoreKey);
	prefs->SetTotalSource(m_totalSource);
	prefs->SetTotalNotes(m_totalNotes);
	prefs->SetTotalStoreNotes(m_totalStoreNotes);
}
コード例 #2
0
ファイル: SearchManager.cpp プロジェクト: tempbottle/TestSet
void CSearchManager::UpdateStats()
{
	// Update stats on the searches, this info can be used to determine if we need can start new searches.
	uint8 uTotalFile = 0;
	uint8 uTotalStoreSrc = 0;
	uint8 uTotalStoreKey = 0;
	uint8 uTotalSource = 0;
	uint8 uTotalNotes = 0;
	uint8 uTotalStoreNotes = 0;
	for (SearchMap::const_iterator itSearchMap = m_mapSearches.begin(); itSearchMap != m_mapSearches.end(); ++itSearchMap)
	{
		switch(itSearchMap->second->GetSearchTypes())
		{
			case CSearch::FILE:
				uTotalFile++;
				break;
			case CSearch::STOREFILE:
				uTotalStoreSrc++;
				break;
			case CSearch::STOREKEYWORD:
				uTotalStoreKey++;
				break;
			case CSearch::FINDSOURCE:
				uTotalSource++;
				break;
			case CSearch::STORENOTES:
				uTotalStoreNotes++;
				break;
			case CSearch::NOTES:
				uTotalNotes++;
				break;
		}
	}
	CPrefs *pPrefs = CKademlia::GetPrefs();
	if(pPrefs)
	{
		pPrefs->SetTotalFile(uTotalFile);
		pPrefs->SetTotalStoreSrc(uTotalStoreSrc);
		pPrefs->SetTotalStoreKey(uTotalStoreKey);
		pPrefs->SetTotalSource(uTotalSource);
		pPrefs->SetTotalNotes(uTotalNotes);
		pPrefs->SetTotalStoreNotes(uTotalStoreNotes);
	}
}
コード例 #3
0
int	OptionsXScreen::handleMessage( unsigned long message, unsigned long who)
{
	if ( aMSG_LEFTMOUSEDOWN == message )
	{
		switch ( who )
		{

		case MSB_TAB0:
		case MSB_TAB1:
		case MSB_TAB2:
		case MSB_TAB3:
		{
			for ( int i = MSB_TAB0; i < MSB_TAB3+1; i++ )
				getButton( i )->press( 0 );
			getButton( who )->press( true );
			curTab = who - MSB_TAB0;
		}
			break;

		case YES:
			{
				int oldRes = prefs.resolution;
				int oldDepth = prefs.bitDepth;
				for ( int i = 0; i < 4; i++ )
					tabAreas[i]->end();

				prefs.save();
				prefs.applyPrefs(0);
				LoadScreenWrapper::changeRes();

				int newRes = prefs.resolution;
				int newDepth = prefs.bitDepth;

				if ( newRes != oldRes || newDepth != oldDepth )
				{
					LogisticsOneButtonDialog::instance()->setText( IDS_SWAP_RESOLUTION_WARNING, IDS_DIALOG_OK, IDS_DIALOG_OK );
					LogisticsOneButtonDialog::instance()->begin();
					bShowWarning = true;
				}
				else
					bDone = true;

				return 1;
			}
			break;
		case NO:
			{
				(dynamic_cast<OptionsGamePlay *>(tabAreas[2]))->resetCamera();
				prefs.load();
				prefs.applyPrefs(0);
				bDone = true;
				return 1;
			}
			break;

		}
	}

	return 0;

}
コード例 #4
0
void OptionsXScreen::init(FitIniFile* file)
{

	LogisticsScreen::init( *file, "Static", "Text", "Rect", "Button", "Edit" );	

	const char* fileNames[4] = 
	{
		"mcl_optionsgraphics",
		"mcl_optionsaudio",
		"mcl_optionsgameplay",
		"mcl_optionshotkeys"
	};

	OptionsGraphics* pGraphics = new OptionsGraphics;
	tabAreas[0] = pGraphics;
	OptionsAudio* pAudio = new OptionsAudio;
	tabAreas[1] = pAudio;
	OptionsGamePlay* pPlay = new OptionsGamePlay;
	tabAreas[2] = pPlay;
	OptionsHotKeys* pKeys = new OptionsHotKeys;
	tabAreas[3] = pKeys;

	FullPathFileName path;
	for ( int i = 0; i < 4;i++ )
	{
		path.init( artPath, fileNames[i], ".fit" );
		FitIniFile tmpFile;
		if ( NO_ERR != tmpFile.open( path ) )
		{
			char error[256];
			sprintf( error, "couldn't open file %s", path );
			Assert( 0, 0, error );
			return;	
		}

		tabAreas[i]->init( tmpFile, "Static", "Text", "Rect", "Button", "Edit" );
		tabAreas[i]->moveTo( rects[2].x(), rects[2].y() );

	}

	// 640: offset x = -80, y = -90
	// 800: offset none
	// 1024: offset x = 113, y = 54
	// 1280: offset x = 240, y = 182
	// 1600: offset x = 400, y = 270

	long xOffset = 0;
	long yOffset = 0;

	switch (Environment.screenWidth)
	{
	case 640:
		xOffset = -80;
		yOffset = -90;
		break;

	case 1024:
		xOffset = 13;
		yOffset = 54;
		break;
	
	case 1280:
		xOffset = 240;
		yOffset = 182;
		break;
	
	case 1600:
		xOffset = 400;
		yOffset = 270;
		break;



	}

	move( xOffset, yOffset );


	pGraphics->init(xOffset, yOffset);
	pAudio->init(xOffset, yOffset);
	pPlay->init(xOffset, yOffset);
	pKeys->init(xOffset, yOffset);

	//Needs to be 8.3 or it won't go on the CD!!
	originalSettings.load( "OrgPrefs" );

	prefs.load();


	for ( i = 0; i < 4; i++ )
		tabAreas[i]->begin();

	if ( mission && strlen( mission->getMissionFileName() ) )
	{
		getButton( MSB_TAB2 )->disable( true );
	}

	for ( i = 0; i < buttonCount; i++ )
	{
		if ( MSB_TAB0 > buttons[i].getID() || MSB_TAB3 < buttons[i].getID() )
			buttons[i].setMessageOnRelease( );
	}

	getButton( MSB_TAB0 )->press( true );

	bShowWarning = 0;
}