Commit 7f946e2109a65794d3313ac259329d8c3d36cc19
- Diff rendering mode:
- inline
- side by side
amarok/osd.cpp
(8 / 2)
|   | |||
| 57 | 57 | ||
| 58 | 58 | QFontMetrics *fm = new QFontMetrics( font ); | |
| 59 | 59 | /* AlignAuto = we want to align Arabic to the right, don't we? */ | |
| 60 | QRect fmRect = fm->boundingRect( 0, 0, d->width(), d->height(), AlignAuto | WordBreak, text ); | ||
| 60 | /* Sane width and height limits - don't go over the screen dimensions, | ||
| 61 | and don't cover whole desktop neither. */ | ||
| 62 | QRect fmRect = fm->boundingRect( 0, 0, d->width()-40, d->height()-100, AlignAuto | WordBreak, text ); | ||
| 61 | 63 | ||
| 62 | 64 | QFont titleFont("Arial", 12, QFont::Bold); | |
| 63 | 65 | QFontMetrics *titleFm = new QFontMetrics( titleFont ); | |
| 66 | /* Measure how much title will take, but don't let it take too much vertically. */ | ||
| 67 | QRect titleRect = titleFm->boundingRect( 0, 0, d->width()-40, titleFm->height(), AlignAuto, m_appName ); | ||
| 64 | 68 | ||
| 65 | fmRect.addCoords( 0, 0, 20, titleFm->height() ); | ||
| 69 | if ( fmRect.width() < titleRect.width() ) | ||
| 70 | fmRect.setWidth( titleRect.width() ); | ||
| 71 | fmRect.addCoords( 0, 0, 20, titleRect.height() ); | ||
| 66 | 72 | ||
| 67 | 73 | resize( fmRect.size() ); | |
| 68 | 74 | // QPixmap *buffer = new QPixmap( fmRect.width(), fmRect.height() ); |

