From 412a0620820d26294ddbc306b137692c65e8e980 Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Mon, 31 Dec 2018 16:08:47 +0100 Subject: Tweak styling options for downloads tab, port Paper Light theme for reference --- src/downloadlistwidget.cpp | 28 +++++++++++++++-------- src/mainwindow.cpp | 7 +++--- src/stylesheets/Paper Light by 6788.qss | 39 +++++++++++++++++++-------------- 3 files changed, 44 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index e908faf3..ac327f7b 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -32,21 +32,31 @@ void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewIt if (sourceIndex.column() == DownloadList::COL_STATUS && sourceIndex.row() < m_Manager->numTotalDownloads() && m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_DOWNLOADING) { bool pendingDownload = sourceIndex.row() >= m_Manager->numTotalDownloads(); - QProgressBar progressBarOption; - progressBarOption.setProperty("compact", option.widget->property("compact")); - progressBarOption.setMinimum(0); - progressBarOption.setMaximum(100); - progressBarOption.setAlignment(Qt::AlignCenter); - progressBarOption.resize(option.rect.width(), option.rect.height()); - progressBarOption.setValue(m_Manager->getProgress(sourceIndex.row()).first); - progressBarOption.setFormat(m_Manager->getProgress(sourceIndex.row()).second); + QProgressBar progressBar; + progressBar.setProperty("downloadView", option.widget->property("downloadView")); + progressBar.resize(option.rect.width(), option.rect.height()); + progressBar.setTextVisible(false); + progressBar.setMinimum(0); + progressBar.setMaximum(100); + progressBar.setValue(m_Manager->getProgress(sourceIndex.row()).first); + progressBar.setStyle(QApplication::style()); + + QLabel progressText; + progressText.setProperty("downloadView", option.widget->property("downloadView")); + progressText.setProperty("downloadProgress", true); + progressText.resize(option.rect.width(), option.rect.height()); + progressText.setAttribute(Qt::WA_TranslucentBackground); + progressText.setAlignment(Qt::AlignCenter); + progressText.setText(m_Manager->getProgress(sourceIndex.row()).second); + progressText.setStyle(QApplication::style()); // paint the background with default delegate first to preserve table cell styling QStyledItemDelegate::paint(painter, option, index); painter->save(); painter->translate(option.rect.topLeft()); - progressBarOption.render(painter); + progressBar.render(painter); + progressText.render(painter); painter->restore(); } else { QStyledItemDelegate::paint(painter, option, index); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 328c0b2d..b4d77085 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5154,8 +5154,7 @@ void MainWindow::initDownloadView() connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), sortProxy, SLOT(updateFilter(QString))); connect(ui->downloadFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(downloadFilterChanged(QString))); - ui->downloadView->setObjectName("downloadView"); - ui->downloadView->setModel(sortProxy); + ui->downloadView->setModel(sortProxy); ui->downloadView->setManager(m_OrganizerCore.downloadManager()); ui->downloadView->setItemDelegate(new DownloadProgressDelegate(m_OrganizerCore.downloadManager(), sortProxy, ui->downloadView)); ui->downloadView->setUniformRowHeights(true); @@ -5180,9 +5179,9 @@ void MainWindow::initDownloadView() void MainWindow::updateDownloadView() { if (m_OrganizerCore.settings().compactDownloads()) - ui->downloadView->setProperty("compact", true); + ui->downloadView->setProperty("downloadView", "compact"); else - ui->downloadView->setProperty("compact", false); + ui->downloadView->setProperty("downloadView", "standard"); ui->downloadView->style()->unpolish(ui->downloadView); ui->downloadView->style()->polish(ui->downloadView); } diff --git a/src/stylesheets/Paper Light by 6788.qss b/src/stylesheets/Paper Light by 6788.qss index 36585291..3193b817 100644 --- a/src/stylesheets/Paper Light by 6788.qss +++ b/src/stylesheets/Paper Light by 6788.qss @@ -680,10 +680,9 @@ QToolTip { border-radius: 6px; } -/* Progress Bars (Downloads) */ +/* Progress Bars */ QProgressBar { - /* progress bars when downloading */ background: #FFFFFF; text-align: center; border: 0px; @@ -929,29 +928,35 @@ QSlider::handle:hover { background: #EBEBEB; } -DownloadListWidget QFrame, -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ - background: #FFFFFF; +DownloadListWidget[downloadView=standard]::item { + padding: 15px; + border-bottom: 2px solid #BBBBBB; } -DownloadListWidget #frame { - /* outer box of an entry on the Downloads tab */ - border: none; +QProgressBar[downloadView=standard] { + background: transparent; + border: 2px solid gray; + border-radius: 8px; + margin: 4px 0px 6px 0px; } -#installLabel { - /* installed/done label */ - color: none; +QLabel[downloadProgress] { + qproperty-alignment: AlignCenter; + padding-bottom: 3px; } /* Compact Downloads View */ -DownloadListWidgetCompact, -DownloadListWidgetCompact QLabel { - /* an entry on the Downloads tab */ - background: #FFFFFF; +DownloadListWidget[downloadView=compact]::item { + padding: 3px; + border-bottom: 2px solid #BBBBBB; +} + +QProgressBar[downloadView=compact] { + background: transparent; + border: 2px solid gray; + border-radius: 8px; + margin: 1px 0px 3px 0px; } /* Categories Filter */ -- cgit v1.3.1