Browse Source

- Changed the way progress bars are rendered

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
a9692dbe60
  1. 3
      TODO
  2. 9
      src/DLListDelegate.h
  3. 9
      src/FinishedListDelegate.h
  4. 8
      src/PropListDelegate.h

3
TODO

@ -68,4 +68,5 @@ LANGUAGES UPDATED: @@ -68,4 +68,5 @@ LANGUAGES UPDATED:
beta4->beta5 changelog:
- BUGFIX: Finished torrents were still displayed as checking when paused by libtorrent on full disk (hit an assert)
- I18N: Updated Italian translation
- I18N: Updated Italian translation
- COSMETIC: Changed the way progress bars are rendered

9
src/DLListDelegate.h

@ -79,7 +79,6 @@ class DLListDelegate: public QItemDelegate { @@ -79,7 +79,6 @@ class DLListDelegate: public QItemDelegate {
}
case PROGRESS:{
QStyleOptionProgressBarV2 newopt;
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
float progress;
progress = index.data().toDouble()*100.;
snprintf(tmp, MAX_CHAR_TMP, "%.1f", progress);
@ -89,15 +88,9 @@ class DLListDelegate: public QItemDelegate { @@ -89,15 +88,9 @@ class DLListDelegate: public QItemDelegate {
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = false;
newopt.textVisible = true;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
//We prefer to display text manually to control color/font/boldness
if (option.state & QStyle::State_Selected){
opt.palette.setColor(QPalette::Text, QColor("grey"));
painter->setPen(opt.palette.color(cg, QPalette::Text));
}
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
break;
}
default:

9
src/FinishedListDelegate.h

@ -72,7 +72,6 @@ class FinishedListDelegate: public QItemDelegate { @@ -72,7 +72,6 @@ class FinishedListDelegate: public QItemDelegate {
}
case F_PROGRESS:{
QStyleOptionProgressBarV2 newopt;
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
float progress;
progress = index.data().toDouble()*100.;
snprintf(tmp, MAX_CHAR_TMP, "%.1f", progress);
@ -82,15 +81,9 @@ class FinishedListDelegate: public QItemDelegate { @@ -82,15 +81,9 @@ class FinishedListDelegate: public QItemDelegate {
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = false;
newopt.textVisible = true;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
//We prefer to display text manually to control color/font/boldness
if (option.state & QStyle::State_Selected){
opt.palette.setColor(QPalette::Text, QColor("grey"));
painter->setPen(opt.palette.color(cg, QPalette::Text));
}
painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
break;
}
default:

8
src/PropListDelegate.h

@ -76,15 +76,9 @@ class PropListDelegate: public QItemDelegate { @@ -76,15 +76,9 @@ class PropListDelegate: public QItemDelegate {
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = false;
newopt.textVisible = true;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
//We prefer to display text manually to control color/font/boldness
if (option.state & QStyle::State_Selected){
opt.palette.setColor(QPalette::Text, QColor("grey"));
painter->setPen(opt.palette.color(cg, QPalette::Text));
}
painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
break;
}
case PRIORITY:{

Loading…
Cancel
Save