Commit 8286f5e4 authored by Simon Persson's avatar Simon Persson

Make drive selection expand vertically and no text overlap in delegate

Both are just small cosmetic changes.
parent 69f2447e
......@@ -382,7 +382,7 @@ KPageWidgetItem *BackupPlanWidget::createDestinationPage() {
lVLayout->addWidget(lFileSystemRadio);
lVLayout->addWidget(lFileSystemWidget);
lVLayout->addWidget(lDriveRadio);
lVLayout->addWidget(lDriveWidget);
lVLayout->addWidget(lDriveWidget, 1);
lVLayout->addStretch();
lButtonGroup->setLayout(lVLayout);
......
......@@ -70,13 +70,16 @@ void DriveSelectionDelegate::paint(QPainter* pPainter, const QStyleOptionViewIte
KLocale *lLocale = KGlobal::locale();
QString lDisplayLabel, lPartitionLabel, lDisconnectedLabel;
int lTextEnd = pOption.rect.right() - cMargin;
if(lIsDisconnected) {
lDisconnectedLabel = i18nc("@item:inlistbox this text is added if selected drive is disconnected", " (disconnected)");
} else {
lDisconnectedLabel = QString();
QString lFreeSpace = i18nc("@label %1 is amount of free storage space of hard drive","%1 free",
lLocale->formatByteSize(lTotalSize - lUsedSize, 1));
pPainter->drawText(pOption.rect.topRight() + QPoint(-(cMargin+QApplication::fontMetrics().width(lFreeSpace)),
int lTextWidth = QApplication::fontMetrics().width(lFreeSpace);
lTextEnd -= lTextWidth + cMargin;
pPainter->drawText(pOption.rect.topRight() + QPoint(-cMargin - lTextWidth,
cMargin+QApplication::fontMetrics().height()), lFreeSpace);
}
......@@ -102,6 +105,7 @@ void DriveSelectionDelegate::paint(QPainter* pPainter, const QStyleOptionViewIte
lDisplayLabel = i18nc("@item:inlistbox %1 is drive(partition) label, %2 is storage capacity",
"%1: %2 total capacity", lPartitionLabel, lLocale->formatByteSize(lTotalSize, 1));
}
lDisplayLabel = QApplication::fontMetrics().elidedText(lDisplayLabel, Qt::ElideMiddle, lTextEnd - pOption.rect.left() - cMargin);
pPainter->drawText(pOption.rect.topLeft() + QPoint(cMargin, cMargin+QApplication::fontMetrics().height()), lDisplayLabel);
int lIconSize = KIconLoader::SizeLarge;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment