From: Mike Gelfand Date: Sun, 21 Dec 2014 13:57:15 +0000 (+0000) Subject: Rework statistics dialog in Qt client to load from .ui X-Git-Tag: 2.90~301 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=237acf17264261976a4ce57bd836ae17d690a4d0;p=transmission Rework statistics dialog in Qt client to load from .ui Fix "Started %n time(s)" phrase (remove space in "time (s)", add proper English translation for numeric forms). --- diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 54edceff2..2b61d1903 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -103,6 +103,7 @@ set(${PROJECT_NAME}_HEADERS tr_qt_wrap_ui(${PROJECT_NAME}_UI_SOURCES details.ui mainwin.ui + stats-dialog.ui ) tr_qt_add_resources(${PROJECT_NAME}_QRC_SOURCES diff --git a/qt/qtr.pro b/qt/qtr.pro index 043f671b6..84f0f909e 100644 --- a/qt/qtr.pro +++ b/qt/qtr.pro @@ -47,7 +47,8 @@ TRANSLATIONS += translations/transmission_en.ts \ translations/transmission_uk.ts FORMS += details.ui \ - mainwin.ui + mainwin.ui \ + stats-dialog.ui RESOURCES += application.qrc SOURCES += about.cc \ add-data.cc \ diff --git a/qt/stats-dialog.cc b/qt/stats-dialog.cc index 0931e21b8..50f867f81 100644 --- a/qt/stats-dialog.cc +++ b/qt/stats-dialog.cc @@ -7,10 +7,7 @@ * $Id$ */ -#include -#include #include -#include #include "formatter.h" #include "hig.h" @@ -27,30 +24,10 @@ StatsDialog::StatsDialog (Session& session, QWidget * parent): mySession (session), myTimer (new QTimer (this)) { - myTimer->setSingleShot (false); - connect (myTimer, SIGNAL (timeout ()), this, SLOT (onTimer ())); - setWindowTitle (tr ("Statistics")); - - HIG * hig = new HIG (); - hig->addSectionTitle (tr ("Current Session")); - hig->addRow (tr ("Uploaded:"), myCurrentUp = new QLabel ()); - hig->addRow (tr ("Downloaded:"), myCurrentDown = new QLabel ()); - hig->addRow (tr ("Ratio:"), myCurrentRatio = new QLabel ()); - hig->addRow (tr ("Duration:"), myCurrentDuration = new QLabel ()); - hig->addSectionDivider (); - hig->addSectionTitle (tr ("Total")); - hig->addRow (myStartCount = new QLabel (tr ("Started %n time (s)", 0, 1)), 0); - hig->addRow (tr ("Uploaded:"), myTotalUp = new QLabel ()); - hig->addRow (tr ("Downloaded:"), myTotalDown = new QLabel ()); - hig->addRow (tr ("Ratio:"), myTotalRatio = new QLabel ()); - hig->addRow (tr ("Duration:"), myTotalDuration = new QLabel ()); - hig->finish (); + ui.setupUi (this); - QLayout * layout = new QVBoxLayout (this); - layout->addWidget (hig); - QDialogButtonBox * buttons = new QDialogButtonBox (QDialogButtonBox::Close, Qt::Horizontal, this); - connect (buttons, SIGNAL (rejected ()), this, SLOT (hide ())); // "close" triggers rejected - layout->addWidget (buttons); + myTimer->setSingleShot (false); + connect (myTimer, SIGNAL (timeout ()), &mySession, SLOT (refreshSessionStats ())); connect (&mySession, SIGNAL (statsUpdated ()), this, SLOT (updateStats ())); updateStats (); @@ -70,27 +47,21 @@ StatsDialog::setVisible (bool visible) QDialog::setVisible (visible); } -void -StatsDialog::onTimer () -{ - mySession.refreshSessionStats (); -} - void StatsDialog::updateStats () { const tr_session_stats& current (mySession.getStats ()); const tr_session_stats& total (mySession.getCumulativeStats ()); - myCurrentUp->setText (Formatter::sizeToString (current.uploadedBytes)); - myCurrentDown->setText (Formatter::sizeToString (current.downloadedBytes)); - myCurrentRatio->setText (Formatter::ratioToString (current.ratio)); - myCurrentDuration->setText (Formatter::timeToString (current.secondsActive)); + ui.currentUploadedValueLabel->setText (Formatter::sizeToString (current.uploadedBytes)); + ui.currentDownloadedValueLabel->setText (Formatter::sizeToString (current.downloadedBytes)); + ui.currentRatioValueLabel->setText (Formatter::ratioToString (current.ratio)); + ui.currentDurationValueLabel->setText (Formatter::timeToString (current.secondsActive)); - myTotalUp->setText (Formatter::sizeToString (total.uploadedBytes)); - myTotalDown->setText (Formatter::sizeToString (total.downloadedBytes)); - myTotalRatio->setText (Formatter::ratioToString (total.ratio)); - myTotalDuration->setText (Formatter::timeToString (total.secondsActive)); + ui.totalUploadedValueLabel->setText (Formatter::sizeToString (total.uploadedBytes)); + ui.totalDownloadedValueLabel->setText (Formatter::sizeToString (total.downloadedBytes)); + ui.totalRatioValueLabel->setText (Formatter::ratioToString (total.ratio)); + ui.totalDurationValueLabel->setText (Formatter::timeToString (total.secondsActive)); - myStartCount->setText (tr ("Started %n time (s)", 0, total.sessionCount)); + ui.startCountLabel->setText (tr ("Started %n time(s)", 0, total.sessionCount)); } diff --git a/qt/stats-dialog.h b/qt/stats-dialog.h index 727369071..1d23836df 100644 --- a/qt/stats-dialog.h +++ b/qt/stats-dialog.h @@ -12,22 +12,17 @@ #include +#include "ui_stats-dialog.h" + class Session; -class QLabel; class QTimer; class StatsDialog: public QDialog { Q_OBJECT - signals: - void accepted (); - - public slots: - void updateStats (); - private slots: - void onTimer (); + void updateStats (); public: StatsDialog (Session&, QWidget * parent = 0); @@ -37,15 +32,7 @@ class StatsDialog: public QDialog private: Session & mySession; QTimer * myTimer; - QLabel * myCurrentUp; - QLabel * myCurrentDown; - QLabel * myCurrentRatio; - QLabel * myCurrentDuration; - QLabel * myStartCount; - QLabel * myTotalUp; - QLabel * myTotalDown; - QLabel * myTotalRatio; - QLabel * myTotalDuration; + Ui::StatsDialog ui; }; #endif diff --git a/qt/stats-dialog.ui b/qt/stats-dialog.ui new file mode 100644 index 000000000..f627e07ec --- /dev/null +++ b/qt/stats-dialog.ui @@ -0,0 +1,198 @@ + + + StatsDialog + + + + 0 + 0 + 139 + 303 + + + + Statistics + + + [tr-style~="form-section"] +{ + font-weight: bold; + margin-top: 12px; + margin-bottom: 1px; +} +[tr-style~="form-section"][tr-style~="first"] +{ + margin-top: 0; +} +[tr-style~="form-label"] +{ + margin-left: 18px; +} + + + + QLayout::SetFixedSize + + + + + Current Session + + + form-section first + + + + + + + Uploaded: + + + form-label + + + + + + + + + + Downloaded: + + + form-label + + + + + + + + + + Ratio: + + + form-label + + + + + + + + + + Duration: + + + form-label + + + + + + + + + + Total + + + form-section + + + + + + + form-label + + + + + + + Uploaded: + + + form-label + + + + + + + + + + Downloaded: + + + form-label + + + + + + + + + + Ratio: + + + form-label + + + + + + + + + + Duration: + + + form-label + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + dialogButtons + rejected() + StatsDialog + reject() + + + 71 + 282 + + + 71 + 151 + + + + + diff --git a/qt/translations/transmission_en.ts b/qt/translations/transmission_en.ts index b9a69c56a..54b6e8233 100644 --- a/qt/translations/transmission_en.ts +++ b/qt/translations/transmission_en.ts @@ -789,7 +789,7 @@ - + &Torrent @@ -2082,51 +2082,50 @@ To add another primary URL, add it after a blank line. StatsDialog - + Statistics - + Current Session - - + + Uploaded: - - + + Downloaded: - - + + Ratio: - - + + Duration: - + Total - - - Started %n time (s) - - - + + Started %n time(s) + + Started %n time + Started %n times @@ -2297,7 +2296,7 @@ To add another primary URL, add it after a blank line. TrMainWindow - + Limit Download Speed @@ -2310,13 +2309,13 @@ To add another primary URL, add it after a blank line. - + Limited at %1 - + Limit Upload Speed @@ -2332,7 +2331,7 @@ To add another primary URL, add it after a blank line. - + Stop at Ratio (%1) @@ -2374,12 +2373,12 @@ To add another primary URL, add it after a blank line. - + Speed Limits - + Network Error diff --git a/qt/translations/transmission_es.ts b/qt/translations/transmission_es.ts index 3b1a3a7e1..ea77fd32f 100644 --- a/qt/translations/transmission_es.ts +++ b/qt/translations/transmission_es.ts @@ -352,12 +352,12 @@ Uploaded: - + Cargados: Downloaded: - + Descargados: @@ -791,7 +791,7 @@ Transmission - + &Torrent &Torrent @@ -2086,48 +2086,47 @@ Para agregar otro URL primario, agrueguelo después de una línea en blanco. StatsDialog - + Statistics Estadísticas - + Current Session Sesión actual - - + + Uploaded: Cargados: - - + + Downloaded: Descargados: - - + + Ratio: Proporción: - - + + Duration: Duración: - + Total Total - - - Started %n time (s) + + Started %n time(s) @@ -2302,7 +2301,7 @@ Para agregar otro URL primario, agrueguelo después de una línea en blanco. TrMainWindow - + Limit Download Speed Limitar velocidad de descarga @@ -2315,13 +2314,13 @@ Para agregar otro URL primario, agrueguelo después de una línea en blanco. - + Limited at %1 Limitada a %1 - + Limit Upload Speed Limitar velocidad de carga @@ -2338,7 +2337,7 @@ Para agregar otro URL primario, agrueguelo después de una línea en blanco. - + Stop at Ratio (%1) Detener a la proporción (%1) @@ -2400,12 +2399,12 @@ Para agregar otro URL primario, agrueguelo después de una línea en blanco.Archivos de torrent (*.torrent);;Todos los archivos (*.*) - + Speed Limits Límites de velocidad - + Network Error diff --git a/qt/translations/transmission_eu.ts b/qt/translations/transmission_eu.ts index 24e486fc8..600866ac4 100644 --- a/qt/translations/transmission_eu.ts +++ b/qt/translations/transmission_eu.ts @@ -789,7 +789,7 @@ Transmission - + &Torrent &Torrenta @@ -2082,48 +2082,47 @@ Beste lehen URL bat gehitzeko, gehitu hura lerro huts baten ondoren. StatsDialog - + Statistics Estatistikak - + Current Session Oraingo Saioa - - + + Uploaded: Igota: - - + + Downloaded: Jeitsita: - - + + Ratio: Maila: - - + + Duration: Iraupena: - + Total Guztira - - - Started %n time (s) + + Started %n time(s) Hasita %n aldiz Hasita %n aldiz @@ -2297,7 +2296,7 @@ Beste lehen URL bat gehitzeko, gehitu hura lerro huts baten ondoren. TrMainWindow - + Limit Download Speed Mugatu Jeisketa Abiadura @@ -2310,13 +2309,13 @@ Beste lehen URL bat gehitzeko, gehitu hura lerro huts baten ondoren. - + Limited at %1 Muga: %1 - + Limit Upload Speed Mugatu Igoera Abiadura @@ -2332,7 +2331,7 @@ Beste lehen URL bat gehitzeko, gehitu hura lerro huts baten ondoren. - + Stop at Ratio (%1) Gelditu Maila honetan (%1) @@ -2374,12 +2373,12 @@ Beste lehen URL bat gehitzeko, gehitu hura lerro huts baten ondoren.Ireki Torrenta - + Speed Limits Abiadura Mugak - + Network Error diff --git a/qt/translations/transmission_fr.ts b/qt/translations/transmission_fr.ts index ffbf1081c..093895642 100644 --- a/qt/translations/transmission_fr.ts +++ b/qt/translations/transmission_fr.ts @@ -789,7 +789,7 @@ Transmission - + &Torrent &Torrent @@ -2083,48 +2083,47 @@ Pour ajouter une autre URL primaire, placez-la après une ligne vide. StatsDialog - + Statistics Statistiques - + Current Session Session courante - - + + Uploaded: Envoyé: - - + + Downloaded: Téléchargé: - - + + Ratio: Ratio: - - + + Duration: Durée: - + Total Total - - - Started %n time (s) + + Started %n time(s) @@ -2299,12 +2298,12 @@ Pour ajouter une autre URL primaire, placez-la après une ligne vide. TrMainWindow - + Speed Limits Limites de vitesse - + Limit Download Speed Limite de réception @@ -2317,13 +2316,13 @@ Pour ajouter une autre URL primaire, placez-la après une ligne vide. - + Limited at %1 Limité à: %1 - + Limit Upload Speed Limite d'émission @@ -2339,7 +2338,7 @@ Pour ajouter une autre URL primaire, placez-la après une ligne vide. - + Stop at Ratio (%1) Arrêter au ratio (%1) diff --git a/qt/translations/transmission_hu.ts b/qt/translations/transmission_hu.ts index 56cd4d281..c229dc0a0 100644 --- a/qt/translations/transmission_hu.ts +++ b/qt/translations/transmission_hu.ts @@ -458,7 +458,7 @@ Options - + Opciók @@ -782,7 +782,7 @@ Transmission - + &Torrent &Torrent @@ -2071,48 +2071,47 @@ Másik elsődleges URL-t új sorba írva adhatsz hozzá. StatsDialog - + Statistics Statisztika - + Current Session Jelenlegi munkamenet - - + + Uploaded: Feltöltve: - - + + Downloaded: Letöltve: - - + + Ratio: Arány: - - + + Duration: Időtartam: - + Total Összesen - - - Started %n time (s) + + Started %n time(s) @@ -2281,12 +2280,12 @@ Másik elsődleges URL-t új sorba írva adhatsz hozzá. TrMainWindow - + Speed Limits Ideiglenes sebesség korlátok - + Limit Download Speed Letöltési sebességkorlát @@ -2299,13 +2298,13 @@ Másik elsődleges URL-t új sorba írva adhatsz hozzá. - + Limited at %1 Koráltozva %1-re - + Limit Upload Speed Feltöltési sebességkorlát @@ -2321,7 +2320,7 @@ Másik elsődleges URL-t új sorba írva adhatsz hozzá. - + Stop at Ratio (%1) Seedelés befejezése ha elérte a %1 arányt diff --git a/qt/translations/transmission_kk.ts b/qt/translations/transmission_kk.ts index 11174ce82..826ee54df 100644 --- a/qt/translations/transmission_kk.ts +++ b/qt/translations/transmission_kk.ts @@ -789,7 +789,7 @@ Transmission - + &Torrent &Торрент @@ -2083,48 +2083,47 @@ To add another primary URL, add it after a blank line. StatsDialog - + Statistics Статистика - + Current Session Ағымдағы сессия - - + + Uploaded: Таратылған: - - + + Downloaded: Жүктелген: - - + + Ratio: Рейтинг: - - + + Duration: Ұзақтығы: - + Total Жалпы - - - Started %n time (s) + + Started %n time(s) @@ -2298,7 +2297,7 @@ To add another primary URL, add it after a blank line. TrMainWindow - + Limit Download Speed Қабылдау жылдамдығын шектеу @@ -2311,13 +2310,13 @@ To add another primary URL, add it after a blank line. - + Limited at %1 - + Limit Upload Speed Тарату жылдамдығын шектеу @@ -2333,7 +2332,7 @@ To add another primary URL, add it after a blank line. - + Stop at Ratio (%1) Рейтингте тоқтату (%1) @@ -2375,12 +2374,12 @@ To add another primary URL, add it after a blank line. - + Speed Limits Жылдамдықты шектеу - + Network Error diff --git a/qt/translations/transmission_lt.ts b/qt/translations/transmission_lt.ts index c1130c017..3ba20d0a0 100644 --- a/qt/translations/transmission_lt.ts +++ b/qt/translations/transmission_lt.ts @@ -791,7 +791,7 @@ MainWindow - + &About &Apie @@ -1188,12 +1188,12 @@ Visas siuntimas - + Transmission Transmission - + Tray &Icon &Piktograma pranešimų srityje @@ -2093,26 +2093,25 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil StatsDialog - + Current Session Šis seansas - - + + Downloaded: Atsiųsta: - - + + Duration: Naudojimosi trukmė: - - - Started %n time (s) + + Started %n time(s) @@ -2120,24 +2119,24 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil - - + + Ratio: Santykis: - + Statistics Statistika - + Total Bendra - - + + Uploaded: Išsiųsta: @@ -2313,12 +2312,12 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil TrMainWindow - + Idle Pasyvus - + Limit Download Speed Apriboti atsiuntimo greitį @@ -2330,7 +2329,7 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil - + Limited at %1 Ribojama iki %1 @@ -2392,12 +2391,12 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil Šie torentai prisijungę prie siuntėjų. - + Seed Forever Skleisti visada - + Show &options dialog Rodyti &parinkčių langą @@ -2417,12 +2416,12 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil Pašalinti šio torento atsiųstus failus? - + Speed Limits Greičio ribojimai - + Network Error @@ -2460,13 +2459,13 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil Vienas šių torentų dar neatsiųstas. - + Stop Seeding at Ratio Nebeskleisti esant santykiui - + Stop at Ratio (%1) Nebeskleisti esant santykiui (%1) @@ -2481,13 +2480,13 @@ Papildomą pirminį URL adresą galite įvesti, palikę prieš jį tuščią eil Šis torentas dar neatsiųstas. - + Unlimited Be ribojimų - + %1 has not responded yet diff --git a/qt/translations/transmission_pt_BR.ts b/qt/translations/transmission_pt_BR.ts index 63ece02b5..a1879ac2c 100644 --- a/qt/translations/transmission_pt_BR.ts +++ b/qt/translations/transmission_pt_BR.ts @@ -789,7 +789,7 @@ Transmission - + &Torrent Torrent @@ -2083,48 +2083,47 @@ Adicione outra URL primária depois de uma linha em branco. StatsDialog - + Statistics Estatísticas - + Current Session Sessão Atual - - + + Uploaded: Enviado: - - + + Downloaded: Baixado: - - + + Ratio: Proporção: - - + + Duration: Duração: - + Total Total - - - Started %n time (s) + + Started %n time(s) @@ -2298,7 +2297,7 @@ Adicione outra URL primária depois de uma linha em branco. TrMainWindow - + Limit Download Speed Limitar Download @@ -2311,13 +2310,13 @@ Adicione outra URL primária depois de uma linha em branco. - + Limited at %1 Limitar em %1 - + Limit Upload Speed Limitar Upload @@ -2333,7 +2332,7 @@ Adicione outra URL primária depois de uma linha em branco. - + Stop at Ratio (%1) Parar na Proporção (%1) @@ -2375,12 +2374,12 @@ Adicione outra URL primária depois de uma linha em branco. - + Speed Limits Limites de Velocidade - + Network Error diff --git a/qt/translations/transmission_ru.ts b/qt/translations/transmission_ru.ts index 20d9ad1a5..135ec07dd 100644 --- a/qt/translations/transmission_ru.ts +++ b/qt/translations/transmission_ru.ts @@ -797,7 +797,7 @@ Transmission - + &Torrent &Торрент @@ -2094,48 +2094,47 @@ To add another primary URL, add it after a blank line. StatsDialog - + Statistics Статистика - + Current Session Текущий сеанс - - + + Uploaded: Роздано: - - + + Downloaded: Загружено: - - + + Ratio: Рейтинг: - - + + Duration: Длительность: - + Total Всего - - - Started %n time (s) + + Started %n time(s) @@ -2314,7 +2313,7 @@ To add another primary URL, add it after a blank line. TrMainWindow - + Limit Download Speed Ограничить скорость загрузки @@ -2327,13 +2326,13 @@ To add another primary URL, add it after a blank line. - + Limited at %1 Ограничено до %1 - + Limit Upload Speed Ограничить скорость раздачи @@ -2349,7 +2348,7 @@ To add another primary URL, add it after a blank line. - + Stop at Ratio (%1) Остановить при рейтинге (%1) @@ -2381,12 +2380,12 @@ To add another primary URL, add it after a blank line. Открытие файла - + Speed Limits Ограничения скорости - + Network Error diff --git a/qt/translations/transmission_uk.ts b/qt/translations/transmission_uk.ts index 8e241b6c3..40b206686 100644 --- a/qt/translations/transmission_uk.ts +++ b/qt/translations/transmission_uk.ts @@ -796,7 +796,7 @@ Transmission - + &Torrent &Торент @@ -2094,48 +2094,47 @@ To add another primary URL, add it after a blank line. StatsDialog - + Statistics Статистика - + Current Session Поточна сесія - - + + Uploaded: Вивантажено: - - + + Downloaded: Завантажено: - - + + Ratio: Рейтинг: - - + + Duration: Тривалість: - + Total Загалом - - - Started %n time (s) + + Started %n time(s) Запущено %n раз Запущено %n рази @@ -2314,7 +2313,7 @@ To add another primary URL, add it after a blank line. TrMainWindow - + Limit Download Speed Обмежити швидкість завантаження @@ -2327,13 +2326,13 @@ To add another primary URL, add it after a blank line. - + Limited at %1 Обмежено до %1 - + Limit Upload Speed Обмежити швидкість поширення @@ -2349,7 +2348,7 @@ To add another primary URL, add it after a blank line. - + Stop at Ratio (%1) Зупинити за співвідношення (%1) @@ -2391,12 +2390,12 @@ To add another primary URL, add it after a blank line. Відкрити торент - + Speed Limits Обмеження швидкості - + Network Error Помилка мережі