From 3ad30d14a824528f7317ffbb03554a23252e375b Mon Sep 17 00:00:00 2001 From: David Sansome Date: Thu, 29 Jul 2010 20:03:24 +0000 Subject: [PATCH] Display device free space information in the device properties dialog --- src/CMakeLists.txt | 2 + src/devices/deviceproperties.cpp | 29 +++++++--- src/devices/deviceproperties.ui | 23 ++++++-- src/translations/ar.po | 10 +++- src/translations/bg.po | 10 +++- src/translations/cs.po | 13 ++++- src/translations/da.po | 10 +++- src/translations/de.po | 13 ++++- src/translations/el.po | 13 ++++- src/translations/en_CA.po | 10 +++- src/translations/en_GB.po | 10 +++- src/translations/es.po | 13 ++++- src/translations/fi.po | 10 +++- src/translations/fr.po | 10 +++- src/translations/gl.po | 10 +++- src/translations/it.po | 10 +++- src/translations/kk.po | 10 +++- src/translations/lt.po | 10 +++- src/translations/nb.po | 10 +++- src/translations/nl.po | 10 +++- src/translations/oc.po | 10 +++- src/translations/pl.po | 10 +++- src/translations/pt.po | 13 ++++- src/translations/pt_BR.po | 10 +++- src/translations/ro.po | 10 +++- src/translations/ru.po | 13 ++++- src/translations/sk.po | 13 ++++- src/translations/sr.po | 10 +++- src/translations/sv.po | 10 +++- src/translations/tr.po | 10 +++- src/translations/translations.pot | 10 +++- src/translations/uk.po | 13 ++++- src/translations/zh_CN.po | 10 +++- src/translations/zh_TW.po | 10 +++- src/widgets/freespacebar.cpp | 96 +++++++++++++++++++++++++++++++ src/widgets/freespacebar.h | 55 ++++++++++++++++++ 36 files changed, 432 insertions(+), 107 deletions(-) create mode 100644 src/widgets/freespacebar.cpp create mode 100644 src/widgets/freespacebar.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c30685086..3c50359a7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -143,6 +143,7 @@ set(SOURCES widgets/errordialog.cpp widgets/fileview.cpp widgets/fileviewlist.cpp + widgets/freespacebar.cpp widgets/lineedit.cpp widgets/linetextedit.cpp widgets/multiloadingindicator.cpp @@ -258,6 +259,7 @@ set(HEADERS widgets/errordialog.h widgets/fileview.h widgets/fileviewlist.h + widgets/freespacebar.h widgets/lineedit.h widgets/linetextedit.h widgets/multiloadingindicator.h diff --git a/src/devices/deviceproperties.cpp b/src/devices/deviceproperties.cpp index 2bf4f54a6..e62e98c0a 100644 --- a/src/devices/deviceproperties.cpp +++ b/src/devices/deviceproperties.cpp @@ -82,15 +82,6 @@ void DeviceProperties::ShowDevice(int row) { // Basic information ui_->name->setText(index_.data(DeviceManager::Role_FriendlyName).toString()); - // Size - QString size_text = Utilities::PrettySize( - index_.data(DeviceManager::Role_Capacity).toLongLong()); - qint64 free_space = index_.data(DeviceManager::Role_FreeSpace).toLongLong(); - if (free_space) - size_text += QString(" (%1 %2)").arg(Utilities::PrettySize(free_space), - tr("available")); - ui_->capacity->setText(size_text); - // Find the right icon QString icon_name = index_.data(DeviceManager::Role_IconName).toString(); for (int i=0 ; iicon->count() ; ++i) { @@ -141,6 +132,26 @@ void DeviceProperties::UpdateHardwareInfo() { } else { ui_->hardware_info_stack->setCurrentWidget(ui_->hardware_info_not_connected_page); } + + // Size + quint64 total = index_.data(DeviceManager::Role_Capacity).toLongLong(); + QString total_text = Utilities::PrettySize(total); + + QVariant free_var = index_.data(DeviceManager::Role_FreeSpace); + if (free_var.isValid()) { + quint64 free = free_var.toLongLong(); + QString free_text = Utilities::PrettySize(free); + + ui_->free_space_label->setText(tr("Available space")); + ui_->free_space_value->setText(tr("%1 of %2").arg(free_text, total_text)); + ui_->free_space_bar->set_total_bytes(total); + ui_->free_space_bar->set_free_bytes(free); + ui_->free_space_bar->show(); + } else { + ui_->free_space_label->setText(tr("Capacity")); + ui_->free_space_value->setText(total_text); + ui_->free_space_bar->hide(); + } } void DeviceProperties::accept() { diff --git a/src/devices/deviceproperties.ui b/src/devices/deviceproperties.ui index ce508b078..db524c0a7 100644 --- a/src/devices/deviceproperties.ui +++ b/src/devices/deviceproperties.ui @@ -14,7 +14,7 @@ Device Properties - + :/icon.png:/icon.png @@ -69,19 +69,22 @@ - + - Capacity + Available space - + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + @@ -172,13 +175,23 @@ + + + FreeSpaceBar + QWidget +
widgets/freespacebar.h
+ 1 +
+
name icon hardware_info buttonBox - + + + buttonBox diff --git a/src/translations/ar.po b/src/translations/ar.po index 8b9f4544c..bdb3ac934 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "" @@ -1717,9 +1724,6 @@ msgstr "" msgid "add %n songs" msgstr "أضِف %n أغاني\\أغنية" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/bg.po b/src/translations/bg.po index 133770860..84815c420 100644 --- a/src/translations/bg.po +++ b/src/translations/bg.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "" @@ -1717,9 +1724,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/cs.po b/src/translations/cs.po index 92aff5d60..9ca051347 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -33,6 +33,10 @@ msgstr "" msgid "%1 days" msgstr "%1 dnů" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -254,6 +258,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "Automaticky otevře jednostlivé kategorie ve stromu knihovny" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1721,9 +1728,6 @@ msgstr "[pro úpravy klikněte]" msgid "add %n songs" msgstr "Přidej %n skladby" -msgid "available" -msgstr "dostupné" - msgid "bpm" msgstr "bpm" @@ -1751,6 +1755,9 @@ msgstr "zastavit" msgid "track %1" msgstr "stopa %1" +#~ msgid "available" +#~ msgstr "dostupné" + #~ msgid "Connected" #~ msgstr "Připojeno" diff --git a/src/translations/da.po b/src/translations/da.po index 507997db7..5b93c91bf 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -33,6 +33,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -254,6 +258,9 @@ msgstr "Automatisk opdatering" msgid "Automatically open single categories in the library tree" msgstr "Åbn automatisk enkelte kategorier i bibliotekstræet" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1724,9 +1731,6 @@ msgstr "[Klik for at redigere]" msgid "add %n songs" msgstr "tilføj %n sange" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/de.po b/src/translations/de.po index 6a1f9baa1..dd0c532f4 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -33,6 +33,10 @@ msgstr "%1 Alben" msgid "%1 days" msgstr "%1 Tage" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 Wiedergabelisten (%2)" @@ -258,6 +262,9 @@ msgstr "Automatisch aktualisieren" msgid "Automatically open single categories in the library tree" msgstr "Kategorien in der Musiksammlung automatisch öffnen" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1747,9 +1754,6 @@ msgstr "[zum Bearbeiten klicken]" msgid "add %n songs" msgstr "%n Stücke hinzufügen" -msgid "available" -msgstr "verfügbar" - msgid "bpm" msgstr "BPM" @@ -1777,6 +1781,9 @@ msgstr "Anhalten" msgid "track %1" msgstr "Stück %1" +#~ msgid "available" +#~ msgstr "verfügbar" + #~ msgid "Disconnect device" #~ msgstr "Gerät trennen" diff --git a/src/translations/el.po b/src/translations/el.po index c0dca0577..833fa5bcd 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -34,6 +34,10 @@ msgstr "%1 άλμπουμ" msgid "%1 days" msgstr "%1 ημέρες" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 λίστες αναπαραγωγής (%2)" @@ -260,6 +264,9 @@ msgstr "Αυτόματη ενημέρωση" msgid "Automatically open single categories in the library tree" msgstr "Άνοιξε αυτόμα τις μόνες κατηγορίες του δέντρου της βιβλιοθήκης" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1752,9 +1759,6 @@ msgstr "[κλικ για τροποποίηση]" msgid "add %n songs" msgstr "προσθήκη %n τραγουδιών" -msgid "available" -msgstr "διαθέσιμο" - msgid "bpm" msgstr "bpm" @@ -1782,6 +1786,9 @@ msgstr "διακοπή" msgid "track %1" msgstr "κομμάτι %1" +#~ msgid "available" +#~ msgstr "διαθέσιμο" + #~ msgid "Disconnect device" #~ msgstr "Αποσύνδεση συσκευής" diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po index 1ba933770..bda014729 100644 --- a/src/translations/en_CA.po +++ b/src/translations/en_CA.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 playlists (%2)" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "Automatically open single categories in the library tree" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1722,9 +1729,6 @@ msgstr "[click to edit]" msgid "add %n songs" msgstr "add %n songs" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index 9f9750e2d..16a7d9430 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "Automatically open single categories in the library tree" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1719,9 +1726,6 @@ msgstr "[click to edit]" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/es.po b/src/translations/es.po index a22eb2a92..19f1c4b21 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -33,6 +33,10 @@ msgstr "%1 álbumes" msgid "%1 days" msgstr "%1 días" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 listas de reproducción (%2)" @@ -261,6 +265,9 @@ msgid "Automatically open single categories in the library tree" msgstr "" "Expandir automáticamente las categorías únicas en el árbol de la colección" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1753,9 +1760,6 @@ msgstr "[click para editar]" msgid "add %n songs" msgstr "agregar %n pistas" -msgid "available" -msgstr "disponible" - msgid "bpm" msgstr "bpm" @@ -1783,6 +1787,9 @@ msgstr "detener" msgid "track %1" msgstr "Pista %1" +#~ msgid "available" +#~ msgstr "disponible" + #~ msgid "Disconnect device" #~ msgstr "Desconectar el dispositivo" diff --git a/src/translations/fi.po b/src/translations/fi.po index 26d7d2f6e..8df931cfb 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -32,6 +32,10 @@ msgstr "%1 levyä" msgid "%1 days" msgstr "%1 päivää" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 soittolistaa (%2)" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1719,9 +1726,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/fr.po b/src/translations/fr.po index 5bb5a4596..e08bef901 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -33,6 +33,10 @@ msgstr "%1 albums" msgid "%1 days" msgstr "%1 jours" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 listes de lecture (%2)" @@ -254,6 +258,9 @@ msgstr "Mise à jour automatique" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1733,9 +1740,6 @@ msgstr "[cliquer pour modifier]" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/gl.po b/src/translations/gl.po index d3f93eaf2..60d90add5 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1719,9 +1726,6 @@ msgstr "[clique para editar]" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/it.po b/src/translations/it.po index 669e0a2f1..4026cfc07 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -33,6 +33,10 @@ msgstr "Copy text \t %1 album" msgid "%1 days" msgstr "%1 giorni" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 scalette (%2)" @@ -260,6 +264,9 @@ msgstr "Aggiornamento automatico" msgid "Automatically open single categories in the library tree" msgstr "Apri automaticamente categorie singole nell'albero della raccolta" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1757,9 +1764,6 @@ msgstr "[clic per modificare]" msgid "add %n songs" msgstr "aggiungi %n brani" -msgid "available" -msgstr "" - msgid "bpm" msgstr "bpm" diff --git a/src/translations/kk.po b/src/translations/kk.po index f2126cc97..70eadc49a 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1719,9 +1726,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/lt.po b/src/translations/lt.po index 5f6a5aac7..f932aacda 100644 --- a/src/translations/lt.po +++ b/src/translations/lt.po @@ -32,6 +32,10 @@ msgstr "%1 albumai" msgid "%1 days" msgstr "%1 dienos" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 grojaraščiai (%2)" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "" @@ -1717,9 +1724,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/nb.po b/src/translations/nb.po index 388ff579d..5456a4472 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "Automatisk åpne enkeltkategorier i bibliotektreet" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1721,9 +1728,6 @@ msgstr "[klikk for å endre]" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/nl.po b/src/translations/nl.po index a6baf78d8..4ce25a733 100644 --- a/src/translations/nl.po +++ b/src/translations/nl.po @@ -32,6 +32,10 @@ msgstr "%1 albums" msgid "%1 days" msgstr "%1 dag(en)" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 afspeellijsten (%2)" @@ -257,6 +261,9 @@ msgstr "Automatisch updaten" msgid "Automatically open single categories in the library tree" msgstr "Automatisch enkelvoudige categorieën in bibliotheekboom openen" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1746,9 +1753,6 @@ msgstr "[klik om te bewerken]" msgid "add %n songs" msgstr "%n nummers toevoegen" -msgid "available" -msgstr "" - msgid "bpm" msgstr "bpm" diff --git a/src/translations/oc.po b/src/translations/oc.po index 3cbe25603..1e0b5d790 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1717,9 +1724,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/pl.po b/src/translations/pl.po index 9fc77947c..98381c819 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -33,6 +33,10 @@ msgstr "%1 albumów" msgid "%1 days" msgstr "%1 dni" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 list odtwarzania (%2)" @@ -254,6 +258,9 @@ msgstr "Automatyczna aktualizacja" msgid "Automatically open single categories in the library tree" msgstr "Automatycznie otwórz pojedyncze kategorie w drzewie biblioteki" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "Uderzenia na minutę" @@ -1728,9 +1735,6 @@ msgstr "[kliknij aby edytować]" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/pt.po b/src/translations/pt.po index 70242126e..40b3835d3 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -32,6 +32,10 @@ msgstr "%1 álbuns" msgid "%1 days" msgstr "%1 dias" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "Listas de reprodução %1 (%2)" @@ -258,6 +262,9 @@ msgid "Automatically open single categories in the library tree" msgstr "" "Na biblioteca em árvore, abrir automaticamente as categorias individuais" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1743,9 +1750,6 @@ msgstr "[clique para editar]" msgid "add %n songs" msgstr "adicionar %n canções" -msgid "available" -msgstr "disponível" - msgid "bpm" msgstr "bpm" @@ -1773,6 +1777,9 @@ msgstr "parar" msgid "track %1" msgstr "faixa %1" +#~ msgid "available" +#~ msgstr "disponível" + #~ msgid "Disconnect device" #~ msgstr "Desligar o dispositivo" diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index a8162ab36..aabb91d83 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -32,6 +32,10 @@ msgstr "%1 albuns" msgid "%1 days" msgstr "%1 dias" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 listas de reprodução (%2)" @@ -256,6 +260,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "Abrir categorias únicas na árvore da biblioteca automaticamente" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1737,9 +1744,6 @@ msgstr "[clique para editar]" msgid "add %n songs" msgstr "Adicionar %n músicas" -msgid "available" -msgstr "" - msgid "bpm" msgstr "bpm" diff --git a/src/translations/ro.po b/src/translations/ro.po index aacb3ca94..c3ad5c0d0 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1718,9 +1725,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/ru.po b/src/translations/ru.po index 8e824b523..e463336d1 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -31,6 +31,10 @@ msgstr "%1 альбом(ов)" msgid "%1 days" msgstr "%1 дней" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 списков воспроизведения (%2)" @@ -256,6 +260,9 @@ msgstr "Автоматическое обновление" msgid "Automatically open single categories in the library tree" msgstr "Автоматически открывать одиночные категории в дереве коллекции" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1743,9 +1750,6 @@ msgstr "[щелкните, чтобы изменить]" msgid "add %n songs" msgstr "добавить %n композиций" -msgid "available" -msgstr "доступно" - msgid "bpm" msgstr "bpm" @@ -1773,6 +1777,9 @@ msgstr "Остановить" msgid "track %1" msgstr "композиция %1" +#~ msgid "available" +#~ msgstr "доступно" + #~ msgid "Disconnect device" #~ msgstr "Отсоединение устройства" diff --git a/src/translations/sk.po b/src/translations/sk.po index ff44457a7..881e853eb 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -33,6 +33,10 @@ msgstr "%1 albumov" msgid "%1 days" msgstr "%1 dní" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 playlistov (%2)" @@ -258,6 +262,9 @@ msgstr "Automatické aktualizovanie" msgid "Automatically open single categories in the library tree" msgstr "Automaticky otvoriť jednotlivé kategórie v strome zbierky" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1741,9 +1748,6 @@ msgstr "[kliknite pre úpravu]" msgid "add %n songs" msgstr "pridať %n piesní" -msgid "available" -msgstr "dostupné" - msgid "bpm" msgstr "bpm" @@ -1771,6 +1775,9 @@ msgstr "zastaviť" msgid "track %1" msgstr "skladba %1" +#~ msgid "available" +#~ msgstr "dostupné" + #~ msgid "Disconnect device" #~ msgstr "Odpojiť zariadenie" diff --git a/src/translations/sr.po b/src/translations/sr.po index 80cf5b86e..9b6cd2a1d 100644 --- a/src/translations/sr.po +++ b/src/translations/sr.po @@ -32,6 +32,10 @@ msgstr "%1 албума" msgid "%1 days" msgstr "%1 дана" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 листа нумера (%2)" @@ -253,6 +257,9 @@ msgstr "Аутоматско ажурирање" msgid "Automatically open single categories in the library tree" msgstr "Аутоматски отвори појединачне категорије у стаблу библиотеке" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "ОПМ" @@ -1724,9 +1731,6 @@ msgstr "" msgid "add %n songs" msgstr "додај %n песама" -msgid "available" -msgstr "" - msgid "bpm" msgstr "опм" diff --git a/src/translations/sv.po b/src/translations/sv.po index dc5476871..0f30f07c5 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "%1 dagar" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 spellistor (%2)" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "Öppna enkla kategorier i biblioteksträdet automatiskt" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1725,9 +1732,6 @@ msgstr "[klicka för att redigera]" msgid "add %n songs" msgstr "Lägg till %n songer" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/tr.po b/src/translations/tr.po index bf958091c..b321eb526 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -32,6 +32,10 @@ msgstr "%1 albüm" msgid "%1 days" msgstr "%1 gün" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 çalma listesi (%2)" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "BPM" @@ -1723,9 +1730,6 @@ msgstr "[düzenlemek için tıklayın]" msgid "add %n songs" msgstr "%n şakıyı ekle" -msgid "available" -msgstr "" - msgid "bpm" msgstr "bpm" diff --git a/src/translations/translations.pot b/src/translations/translations.pot index 91a98c75f..ce387de81 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -22,6 +22,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -243,6 +247,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "" @@ -1707,9 +1714,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/uk.po b/src/translations/uk.po index 63f1bda87..3fe9c9e59 100644 --- a/src/translations/uk.po +++ b/src/translations/uk.po @@ -32,6 +32,10 @@ msgstr "%1 альбом(ів)" msgid "%1 days" msgstr "%1 дн." +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 списків відтворення (%2)" @@ -257,6 +261,9 @@ msgstr "Автоматичне оновлення" msgid "Automatically open single categories in the library tree" msgstr "Автоматично відкривати одиночні категорії в дереві фонотеки" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "Бітів за хвилину" @@ -1742,9 +1749,6 @@ msgstr "[клацніть, щоб змінити]" msgid "add %n songs" msgstr "додати %n композицій" -msgid "available" -msgstr "доступно" - msgid "bpm" msgstr "такт/хв." @@ -1772,6 +1776,9 @@ msgstr "зупинити" msgid "track %1" msgstr "доріжка %1" +#~ msgid "available" +#~ msgstr "доступно" + #~ msgid "Disconnect device" #~ msgstr "Роз'єднати пристрій" diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po index 2e14120c1..94fa6bc29 100644 --- a/src/translations/zh_CN.po +++ b/src/translations/zh_CN.po @@ -32,6 +32,10 @@ msgstr "" msgid "%1 days" msgstr "" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" @@ -253,6 +257,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "" @@ -1717,9 +1724,6 @@ msgstr "" msgid "add %n songs" msgstr "" -msgid "available" -msgstr "" - msgid "bpm" msgstr "" diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index 74ea60570..31b7430c3 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -32,6 +32,10 @@ msgstr "%1 專輯" msgid "%1 days" msgstr "%1 日" +#, qt-format +msgid "%1 of %2" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 播放清單 (%2)" @@ -257,6 +261,9 @@ msgstr "" msgid "Automatically open single categories in the library tree" msgstr "自動開啟音樂庫中的單一類型" +msgid "Available space" +msgstr "" + msgid "BPM" msgstr "" @@ -1724,9 +1731,6 @@ msgstr "[點擊以編輯]" msgid "add %n songs" msgstr "加入 %n 歌" -msgid "available" -msgstr "" - msgid "bpm" msgstr "bpm" diff --git a/src/widgets/freespacebar.cpp b/src/widgets/freespacebar.cpp new file mode 100644 index 000000000..e405c8a88 --- /dev/null +++ b/src/widgets/freespacebar.cpp @@ -0,0 +1,96 @@ +/* This file is part of Clementine. + + Clementine is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Clementine is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Clementine. If not, see . +*/ + +#include "freespacebar.h" + +#include +#include + +const int FreeSpaceBar::kBarHeight = 20; +const int FreeSpaceBar::kBarBorderRadius = 8; +const int FreeSpaceBar::kMarkerSpacing = 32; + +const QRgb FreeSpaceBar::kColorBg1 = qRgb(214, 207, 200); +const QRgb FreeSpaceBar::kColorBg2 = qRgb(234, 226, 218); +const QRgb FreeSpaceBar::kColorBar1 = qRgb(250, 148, 76); +const QRgb FreeSpaceBar::kColorBar2 = qRgb(214, 102, 24); +const QRgb FreeSpaceBar::kColorBorder = qRgb(174, 168, 162); + + +FreeSpaceBar::FreeSpaceBar(QWidget *parent) + : QWidget(parent), + free_(33), + total_(100) +{ + setMinimumHeight(kBarHeight); +} + +void FreeSpaceBar::set_free_bytes(quint64 bytes) { + free_ = bytes; + update(); +} + +void FreeSpaceBar::set_total_bytes(quint64 bytes) { + total_ = bytes; + update(); +} + +QSize FreeSpaceBar::sizeHint() const { + return QSize(150, kBarHeight); +} + +void FreeSpaceBar::paintEvent(QPaintEvent*) { + QPainter p(this); + p.setRenderHint(QPainter::Antialiasing); + p.setRenderHint(QPainter::HighQualityAntialiasing); + + QRect background_rect(rect()); + QRect bar_rect(background_rect); + bar_rect.setWidth(float(bar_rect.width()) * (float(total_ - free_) / total_)); + + QLinearGradient background_gradient(background_rect.topLeft(), background_rect.bottomLeft()); + background_gradient.setColorAt(0, kColorBg1); + background_gradient.setColorAt(1, kColorBg2); + + QLinearGradient bar_gradient(bar_rect.topLeft(), bar_rect.bottomLeft()); + bar_gradient.setColorAt(0, kColorBar1); + bar_gradient.setColorAt(1, kColorBar2); + + // Draw the background + p.setPen(Qt::NoPen); + p.setBrush(background_gradient); + p.drawRoundedRect(background_rect, kBarBorderRadius, kBarBorderRadius); + + // Draw the bar foreground + p.setBrush(bar_gradient); + p.drawRoundedRect(bar_rect, kBarBorderRadius, kBarBorderRadius); + + // Draw marker lines over the top every few pixels + p.setOpacity(0.35); + p.setRenderHint(QPainter::Antialiasing, false); + p.setPen(QPen(palette().color(QPalette::Light), 1.0)); + for (int x = background_rect.left() + kMarkerSpacing ; + x < background_rect.right() ; x += kMarkerSpacing) { + p.drawLine(x, background_rect.top() + 2, x, background_rect.bottom() - 2); + } + + // Draw a border + p.setRenderHint(QPainter::Antialiasing); + p.setOpacity(1.0); + p.setPen(kColorBorder); + p.setBrush(Qt::NoBrush); + p.drawRoundedRect(background_rect, kBarBorderRadius, kBarBorderRadius); +} diff --git a/src/widgets/freespacebar.h b/src/widgets/freespacebar.h new file mode 100644 index 000000000..eae0dcb64 --- /dev/null +++ b/src/widgets/freespacebar.h @@ -0,0 +1,55 @@ +/* This file is part of Clementine. + + Clementine is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Clementine is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Clementine. If not, see . +*/ + +#ifndef FREESPACEBAR_H +#define FREESPACEBAR_H + +#include + +class FreeSpaceBar : public QWidget { + Q_OBJECT + Q_PROPERTY(quint64 free READ free_bytes WRITE set_free_bytes); + Q_PROPERTY(quint64 total READ total_bytes WRITE set_total_bytes); + +public: + FreeSpaceBar(QWidget* parent = 0); + + static const int kBarHeight; + static const int kBarBorderRadius; + static const int kMarkerSpacing; + + static const QRgb kColorBg1; + static const QRgb kColorBg2; + static const QRgb kColorBar1; + static const QRgb kColorBar2; + static const QRgb kColorBorder; + + quint64 free_bytes() const { return free_; } + quint64 total_bytes() const { return total_; } + void set_free_bytes(quint64 bytes); + void set_total_bytes(quint64 bytes); + + QSize sizeHint() const; + +protected: + void paintEvent(QPaintEvent*); + +private: + quint64 free_; + quint64 total_; +}; + +#endif // FREESPACEBAR_H