Esempio n. 1
0
void DirCalcThreadWin::RefreshCounters()
{
	int64_t count = 0;
	int64_t folderCount = 0;
	int64_t size = 0;
	int64_t bad = 0;

	{
		MutexLock lock( &pData->resMutex );
		count = pData->fileCount;
		folderCount = pData->folderCount;
		size  = pData->sumSize;
		bad   = pData->badDirs;
	}

	if ( curFileCount != count )
	{
		SetStaticLineInt64( fileCountNum, count );
		curFileCount = count;
	}

	if ( curFolderCount != folderCount )
	{
		SetStaticLineInt64( folderCountNum, folderCount );
		curFolderCount = folderCount;
	}

	if ( curSumSize != size )
	{
		sumSizeNum.SetTextUtf8( ToStringGrouped( size ) );
		curSumSize = size;
	}

	if ( curBadDirs != bad ) { SetStaticLineInt64( badDirsNum, bad ); curBadDirs = bad; }
}
Esempio n. 2
0
void CopyDialog::EventTimer( int tid )
{
	if ( tid == 1 )
	{
		unsigned ms = 0;
		int64_t bytes = 0;

		{
			MutexLock lock( &threadData.infoMutex );
			ms = threadData.infoMs;
			bytes = threadData.infoBytes;
			threadData.infoBytes = 0;
			lock.Unlock();
		}

		//shift
		int i;

		for ( i = SPEED_NODE_COUNT - 1; i > 0; i-- )
		{
			_speedList[i] = _speedList[i - 1];
		}

		_speedList[0].bytes = bytes;

		if ( bytes > 0 )
		{
			unsigned n = ms - _lastMs;
			_speedList[0].deltaMs = n > 1000000 ? 0 : n;
			_lastMs = ms;
		}
		else
		{
			_speedList[0].deltaMs = 0;
		}

		int64_t sumBytes = 0;
		int64_t sumMs = 0;

		for ( i = 0; i < SPEED_NODE_COUNT; i++ )
		{
			sumMs += _speedList[i].deltaMs;
			sumBytes += _speedList[i].bytes;
		}

		int64_t speed = 0;

		if ( sumMs > 0 && sumBytes > 0 )
		{
			speed = ( sumBytes * 1000 ) / sumMs;
		}

		_speedStr.SetText( utf8str_to_unicode( GetSmallPrintableSpeedStr( speed ) ).data() );

		return;
	}
}
Esempio n. 3
0
void SysOptDialog::SetCurLang(const char *id)
{
	curLangId = new_char_str(id);
	if (id[0] == '-')
		langVal.SetText( utf8_to_unicode( _LT("English") ).ptr() );
	else if (id[0]=='+') 
		langVal.SetText( utf8_to_unicode( _LT("Autodetect") ).ptr() );
	else {
		for (int i = 0; i<list.count(); i++)
		{
			if (!strcmp(list[i].id.ptr(), id)) {
				langVal.SetText( utf8_to_unicode( list[i].name.ptr() ).ptr() );
				return;
			}
		}
		langVal.SetText( utf8_to_unicode( id ).ptr() );
	}
}
Esempio n. 4
0
	CopyDialog(NCDialogParent *parent, bool move = false)
	:	SimpleCFThreadWin(parent, move ? _LT("Move") : _LT("Copy") ),
		_layout(7,2), 
		_text1(0, this, utf8_to_unicode(move ? _LT("Moving the file") : _LT("Copying the file") ).ptr()),
		_text2(0, this, utf8_to_unicode( _LT("to") ).ptr()),
		_text3(0, this, utf8_to_unicode( _LT("Files processed") ).ptr()),
		_from(this),
		_to(this),
		_countWin(this), 
		_progressWin(this)
	{
		_layout.AddWin(&_text1, 0, 0, 0, 1);
		_layout.AddWin(&_from, 1, 0, 1, 1);
		_layout.AddWin(&_text2, 2, 0, 2, 1);
		_layout.AddWin(&_to, 3, 0, 3, 1);
		_layout.AddWin(&_progressWin, 4,0,4,1);
		_layout.AddWin(&_text3, 5, 0);
		_layout.AddWin(&_countWin, 5, 1);
		_text1.Show(); _text1.Enable();
		_text2.Show(); _text2.Enable();
		_text3.Show(); _text3.Enable();
		_from.Show(); _from.Enable();
		_to.Show(); _to.Enable();
		_countWin.Show(); _countWin.Enable();
		_progressWin.Show(); _progressWin.Enable();
		AddLayout(&_layout);
		SetPosition();
	}
Esempio n. 5
0
bool SftpLogonDialog::Command( int id, int subId, Win* win, void* data )
{
	if ( id == 1000 )
	{
		int ret;

		if ( SelectCharset( ( NCDialogParent* )Parent(), &ret, charset ) )
		{
			charset = ret;
			charsetIdText.SetText( utf8_to_unicode( charset_table[ret]->name ).data() );
		}

		return true;
	}

	return NCVertDialog::Command( id, subId, win, data );
}
Esempio n. 6
0
void StyleOptDialog::RefreshFontInfo()
{
	int count = pList->count();
	int cur = fontList.GetCurrent();
	
	const char *s = "";
	if (count>=0 && cur>=0 && cur<count)
	{
		int n = fontList.GetCurrentInt();
		if (pList->get(n).newFont.ptr())
			s = pList->get(n).newFont->printable_name();
		else
		if (pList->get(n).oldFont)
			s = pList->get(n).oldFont->printable_name();
	}
		
	fontNameStatic.SetText(utf8_to_unicode(s).ptr());
}
Esempio n. 7
0
	CopyDialog( NCDialogParent* parent, bool move = false )
		:  SimpleCFThreadWin( parent, move ? _LT( "Move" ) : _LT( "Copy" ) ),
		   _layout( 7, 2 ),
		   _text1( 0, this, utf8_to_unicode( move ? _LT( "Moving the file" ) : _LT( "Copying the file" ) ).data() ),
		   _text2( 0, this, utf8_to_unicode( _LT( "to" ) ).data() ),
		   _text3( 0, this, utf8_to_unicode( _LT( "Files processed" ) ).data() ),
		   _from( this ),
		   _to( this ),
		   _countWin( this ),
		   _progressWin( this ),
		   _speedStr( uiValue, this, 0, 0, StaticLine::LEFT, 10 ),
		   _lastMs( GetTickMiliseconds() )
	{
		_layout.AddWin( &_text1, 0, 0, 0, 1 );
		_layout.AddWin( &_from, 1, 0, 1, 1 );
		_layout.AddWin( &_text2, 2, 0, 2, 1 );
		_layout.AddWin( &_to, 3, 0, 3, 1 );
		_layout.AddWin( &_progressWin, 4, 0, 4, 1 );
		_layout.AddWin( &_text3, 5, 0 );
		_layout.AddWin( &_countWin, 5, 1 );
		_layout.AddWin( &_speedStr, 6, 0 );
		_text1.Show();
		_text1.Enable();
		_text2.Show();
		_text2.Enable();
		_text3.Show();
		_text3.Enable();
		_from.Show();
		_from.Enable();
		_to.Show();
		_to.Enable();
		_countWin.Show();
		_countWin.Enable();
		_progressWin.Show();
		_progressWin.Enable();
		_speedStr.Show();
		_speedStr.Enable();
		AddLayout( &_layout );
		SetTimer( 1, 1000 );
		SetPosition();
	}
Esempio n. 8
0
static void SetStaticLineInt64( StaticLine& a, int64_t n )
{
	a.SetTextUtf8( ToString( n ) );
}
Esempio n. 9
0
	DirCalcThreadWin( NCDialogParent* parent, const char* name, OperDirCalcData* pD, const unicode_t* dirName )
		:  NCDialog( ::createDialogAsChild, 0, parent, utf8_to_unicode( name ).data(), bListOk ),
		   pData( pD ),
		   lo( 12, 10 ),
		   cPathWin( this ),
		   curFileCount( -1 ),
		   curFolderCount( -1 ),
		   curSumSize( -1 ),
		   curBadDirs( -1 ),
		   dirString( 0, this, ScanedDirString( dirName ).data() ),
		   fileCountName( uiVariable, this, utf8_to_unicode( _LT( "Files:" ) ).data() ),
		   fileCountNum( uiValue, this, utf8_to_unicode( "AAAAAAAAAA" ).data() ),
		   folderCountName( uiVariable, this, utf8_to_unicode( _LT( "Folders:" ) ).data() ),
		   folderCountNum( uiValue, this, utf8_to_unicode( "AAAAAAAAAA" ).data() ),
		   sumSizeName( uiVariable, this, utf8_to_unicode( _LT( "Files size:" ) ).data() ),
		   sumSizeNum( uiValue, this, utf8_to_unicode( "AAAAAAAAAAAAAAAAAAAA" ).data() ),
		   badDirsName( uiVariable, this, utf8_to_unicode( _LT( "Not readable folders:" ) ).data() ),
		   badDirsNum( uiValue, this, utf8_to_unicode( "AAAAAAAAAA" ).data() )
	{
		lo.AddWin( &dirString, 0, 0, 0, 3 );
		lo.AddWin( &cPathWin, 9, 0, 9, 3 );
		lo.LineSet( 1, 10 );
		lo.AddWin( &fileCountName, 3, 1 );
		lo.AddWin( &folderCountName, 4, 1 );
		lo.AddWin( &sumSizeName, 5, 1 );
		lo.AddWin( &fileCountNum, 3, 2 );
		lo.AddWin( &folderCountNum, 4, 2 );
		lo.AddWin( &sumSizeNum, 5, 2 );
		lo.LineSet( 6, 7 );
		lo.AddWin( &badDirsName, 7, 1 );
		lo.AddWin( &badDirsNum, 7, 2 );
		lo.LineSet( 8, 10 );

		dirString.Show();
		dirString.Enable();
		cPathWin.Show();
		cPathWin.Enable();
		fileCountName.Show();
		fileCountName.Enable();
		fileCountNum.Show();
		fileCountNum.Enable();

		folderCountName.Show();
		folderCountName.Enable();
		folderCountNum.Show();
		folderCountNum.Enable();

		sumSizeName.Show();
		sumSizeName.Enable();
		sumSizeNum.Show();
		sumSizeNum.Enable();
		badDirsName.Show();
		badDirsName.Enable();
		badDirsNum.Show();
		badDirsNum.Enable();

		lo.SetColGrowth( 3 );
		lo.SetColGrowth( 0 );

		this->AddLayout( &lo );
		this->SetEnterCmd( CMD_OK );
		SetPosition();

		RefreshCounters();
	}