| 681 | |
| 682 | |
| 683 | void AudioFileProcessorView::paintEvent( QPaintEvent * ) |
| 684 | { |
| 685 | QPainter p( this ); |
| 686 | |
| 687 | p.drawPixmap( 0, 0, *s_artwork ); |
| 688 | |
| 689 | audioFileProcessor * a = castModel<audioFileProcessor>(); |
| 690 | |
| 691 | QString file_name = ""; |
| 692 | int idx = a->m_sampleBuffer.audioFile().length(); |
| 693 | |
| 694 | p.setFont( pointSize<8>( font() ) ); |
| 695 | |
| 696 | QFontMetrics fm( p.font() ); |
| 697 | |
| 698 | // simple algorithm for creating a text from the filename that |
| 699 | // matches in the white rectangle |
| 700 | while( idx > 0 && |
| 701 | fm.size( Qt::TextSingleLine, file_name + "..." ).width() < 210 ) |
| 702 | { |
| 703 | file_name = a->m_sampleBuffer.audioFile()[--idx] + file_name; |
| 704 | } |
| 705 | |
| 706 | if( idx > 0 ) |
| 707 | { |
| 708 | file_name = "..." + file_name; |
| 709 | } |
| 710 | |
| 711 | p.setPen( QColor( 255, 255, 255 ) ); |
| 712 | p.drawText( 8, 99, file_name ); |
| 713 | } |
| 714 | |
| 715 | |
| 716 |
nothing calls this directly
no test coverage detected