diff --git a/src/stats/chart.cpp b/src/stats/chart.cpp index 817a6e25..d02adb76 100644 --- a/src/stats/chart.cpp +++ b/src/stats/chart.cpp @@ -218,7 +218,7 @@ QBarSet* Chart::createBarSet(const QString& name, QAbstractBarSeries* series) QLineSeries* Chart::createLineSeries(const QString& name) { QLineSeries* series = new QLineSeries(); - series->setName(name); + if (!name.isEmpty()) series->setName(name); return series; } diff --git a/src/stats/chart.h b/src/stats/chart.h index 19c7efb3..8195093d 100644 --- a/src/stats/chart.h +++ b/src/stats/chart.h @@ -131,7 +131,7 @@ class Chart : public QObject // Update helpers public: - static QLineSeries* createLineSeries(const QString& name); + static QLineSeries* createLineSeries(const QString& name = QString()); static QScatterSeries* createScatterSeries(const QString& name, int markerSize = -1, QScatterSeries::MarkerShape markerShape = QScatterSeries::MarkerShape(-1)); protected: static void adjustAxis(QValueAxis* axis, qreal minValue, qreal maxValue, int chartSize, qreal rangeBufferFactor = 0); diff --git a/src/stats/stats_engine.cpp b/src/stats/stats_engine.cpp index 1c1a3a96..406e2752 100644 --- a/src/stats/stats_engine.cpp +++ b/src/stats/stats_engine.cpp @@ -137,9 +137,9 @@ GeneralStatsEngine::~GeneralStatsEngine() */ void GeneralStatsEngine::setupStatsTab() { - elevGainPerYearChart = new YearChart("Elevation gain sum per year", "km", false); - numAscentsPerYearChart = new YearChart("Number of scaled peaks per year", "Number of peaks", false); - heightsScatterChart = new YearChart("All elevation gains and peak heights over time", "m", true); + elevGainPerYearChart = new YearChart(tr("Elevation gain sum per year"), tr("km"), false); + numAscentsPerYearChart = new YearChart(tr("Number of ascents per year"), tr("Number of ascents"), false); + heightsScatterChart = new YearChart(tr("All elevation gains and peak heights over time"), tr("m"), true); // Set layout QHBoxLayout* statisticsTabUpperLayout = new QHBoxLayout(); @@ -180,11 +180,11 @@ void GeneralStatsEngine::updateStatsTab() assert(elevGainPerYearChart); assert(numAscentsPerYearChart); assert(heightsScatterChart); - - QLineSeries* elevGainPerYearSeries = Chart::createLineSeries ("Elevation gain"); - QLineSeries* numAscentsPerYearSeries = Chart::createLineSeries ("Number of ascended peaks"); - QScatterSeries* peakHeightSeries = Chart::createScatterSeries("Peak heights", 6, QScatterSeries::MarkerShapeTriangle); - QScatterSeries* elevGainSeries = Chart::createScatterSeries("Elevation gains", 6, QScatterSeries::MarkerShapeRotatedRectangle); + + QLineSeries* elevGainPerYearSeries = Chart::createLineSeries(); + QLineSeries* numAscentsPerYearSeries = Chart::createLineSeries(); + QScatterSeries* elevGainSeries = Chart::createScatterSeries(tr("Elevation gains"), 6, QScatterSeries::MarkerShapeRotatedRectangle); + QScatterSeries* peakHeightSeries = Chart::createScatterSeries(tr("Peak heights"), 6, QScatterSeries::MarkerShapeTriangle); QMap yearElevGainSums = QMap(); @@ -242,7 +242,7 @@ void GeneralStatsEngine::updateStatsTab() elevGainPerYearChart ->updateData({elevGainPerYearSeries}, minYear, maxYear, 0, elevGainPerYearMaxY); numAscentsPerYearChart ->updateData({numAscentsPerYearSeries}, minYear, maxYear, 0, numAscentsPerYearMaxY); - heightsScatterChart ->updateData({peakHeightSeries, elevGainSeries}, minDate, maxDate, 0, heightsMaxY); + heightsScatterChart ->updateData({elevGainSeries, peakHeightSeries}, minDate, maxDate, 0, heightsMaxY); } @@ -264,7 +264,7 @@ ItemStatsEngine::ItemStatsEngine(Database* db, PALItemType itemType, const Norma statsLayout(statsLayout), peakHeightHistCategoryIncrement(1000), peakHeightHistCategoryMax(8848), - peakHeightHistCategories(getHistCategories(peakHeightHistCategoryIncrement, peakHeightHistCategoryMax, "", "s")), + peakHeightHistCategories(getHistCategories(peakHeightHistCategoryIncrement, peakHeightHistCategoryMax, "", tr("s"))), numPeakHeightHistCategories(peakHeightHistCategories.size()), elevGainHistCategoryIncrement(250), elevGainHistCategoryMax(1500), @@ -297,18 +297,19 @@ ItemStatsEngine::~ItemStatsEngine() */ void ItemStatsEngine::setupStatsPanel() { - peakHeightHistChart = new HistogramChart("Peak height distribution", peakHeightHistCategories); - elevGainHistChart = new HistogramChart("Elevation gain distribution", elevGainHistCategories); + peakHeightHistChart = new HistogramChart(tr("Distribution of peak heights"), peakHeightHistCategories); + elevGainHistChart = new HistogramChart(tr("Distribution of elevation gains"), elevGainHistCategories); - heightsScatterChart = new YearChart("Elevation gains and peak heights over time", QString(), true); + heightsScatterChart = new YearChart(tr("Elevation gains and peak heights over time"), QString(), true); + int n = 10; if (itemType != ItemTypeAscent) { - topTenNumAscentsChart = new TopNChart(10, "Most ascents"); + topTenNumAscentsChart = new TopNChart(n, tr("Top %1: Most ascents").arg(n)); } - topTenMaxPeakHeightChart = new TopNChart(10, "Highest peak"); - topTenMaxElevGainChart = new TopNChart(10, "Highest elevation gain"); + topTenMaxPeakHeightChart = new TopNChart(n, tr("Top %1: Highest peak").arg(n)); + topTenMaxElevGainChart = new TopNChart(n, tr("Top %1: Highest single elevation gain").arg(n)); if (itemType != ItemTypeAscent) { - topTenElevGainSumChart = new TopNChart(10, "Highest elevation gain sum [km]"); + topTenElevGainSumChart = new TopNChart(n, tr("Top %1: Highest elevation gain sum [km]").arg(n)); } heightsScatterChart->getChartView()->setMinimumHeight(250); @@ -414,8 +415,8 @@ void ItemStatsEngine::updateStatsPanel(const QSet& selectedBuffe // Heights scatterplot if (heightsScatterChart) { - QScatterSeries* peakHeightScatterSeries = Chart::createScatterSeries("Peak heights", 5, QScatterSeries::MarkerShapeTriangle); - QScatterSeries* elevGainScatterSeries = Chart::createScatterSeries("Elevation gains", 5, QScatterSeries::MarkerShapeRotatedRectangle); + QScatterSeries* elevGainScatterSeries = Chart::createScatterSeries(tr("Elevation gains"), 5, QScatterSeries::MarkerShapeRotatedRectangle); + QScatterSeries* peakHeightScatterSeries = Chart::createScatterSeries(tr("Peak heights"), 5, QScatterSeries::MarkerShapeTriangle); qreal minDate = 3000; qreal maxDate = 0; int heightsMaxY = 0; @@ -446,7 +447,7 @@ void ItemStatsEngine::updateStatsPanel(const QSet& selectedBuffe } } - heightsScatterChart->updateData({peakHeightScatterSeries, elevGainScatterSeries}, minDate, maxDate, 0, heightsMaxY); + heightsScatterChart->updateData({elevGainScatterSeries, peakHeightScatterSeries}, minDate, maxDate, 0, heightsMaxY); } diff --git a/src/stats/stats_engine.h b/src/stats/stats_engine.h index d5a5e0e7..48a2deed 100644 --- a/src/stats/stats_engine.h +++ b/src/stats/stats_engine.h @@ -25,10 +25,10 @@ #define STATS_ENGINE_H #include "src/db/database.h" - #include "chart.h" #include "src/data/item_types.h" +#include #include @@ -36,8 +36,10 @@ /** * A base class for statistical analysis classes, general and specific to each item type. */ -class StatsEngine +class StatsEngine : protected QObject { + Q_OBJECT + protected: /** The database. */ Database* const db; @@ -58,6 +60,8 @@ class StatsEngine */ class GeneralStatsEngine : public StatsEngine { + Q_OBJECT + /** A double pointer to the layout of the statistics tab. */ QVBoxLayout** const statisticsTabLayoutPtr; @@ -84,6 +88,8 @@ class GeneralStatsEngine : public StatsEngine */ class ItemStatsEngine : public StatsEngine { + Q_OBJECT + /** The item type to compute and show statistics for and/or about. */ const PALItemType itemType; /** The base table for the item type. */ diff --git a/translation/de.ts b/translation/de.ts index 10465ec8..c93b3558 100644 --- a/translation/de.ts +++ b/translation/de.ts @@ -615,14 +615,14 @@ Soll sie trotzdem verwendet werden? Urlaub bearbeiten... - + More details: %1. Mehr Details: "%1." - + This image file cannot be shown: %1 Reason: %2.%3 @@ -635,33 +635,33 @@ Grund: %2.%3 Die Datei kann entfernt oder ersetzt werden. Alternativ können mit einem Werkzeug Pfade von Bilddateien automatisch angepasst werden. - + No photos Keine Fotos - + Photo %1 of %2 Foto %1 von %2 - + Replace %1 %1 is a filepath, so it is best if it remains at the end of the string. Bilddatei ersetzen: %1 - + Ascent filtered Besteigung herausgefiltert - + As a result of these changes, the ascent is now filtered out of the table. Durch die getätigten Änderungen ist die angezeigte Besteigung jetzt aus der Tabelle ausgefiltert. - + Clear or modify the active filters to see it again. Um sie wieder anzuzeigen, können die Filter angepasst oder entfernt werden. @@ -1856,6 +1856,77 @@ Hinweis: Vor dem Bestätigen kann die Datei auch noch manuell gesichert werden.< VII+ (Außergewöhnliche Schwierigkeiten) + + General + + + Default + Standard + + + + Qt Fusion + Qt Fusion + + + + Modern Windows + Windows modern + + + + Classic Windows + Windows klassisch + + + + MacOS + MacOS + + + + GeneralStatsEngine + + + Elevation gain sum per year + Summe Höhenmeter pro Jahr + + + + km + km + + + + Number of ascents per year + Anzahl Besteigungen pro Jahr + + + + Number of ascents + Besteigungen + + + + All elevation gains and peak heights over time + Alle Höhenmeter und Gipfelhöhen über Zeit + + + + m + m + + + + Elevation gains + Höhenmeter + + + + Peak heights + Gipfelhöhen + + HikerDialog @@ -1983,366 +2054,434 @@ Trotzdem speichern? Soll dieser Eintrag wirklich gelöscht werden? + + ItemStatsEngine + + + s + er + + + + Distribution of peak heights + Verteilung von Gipfelhöhen + + + + Distribution of elevation gains + Verteilung von Höhenmetern + + + + Elevation gains and peak heights over time + Höhenmeter und Gipfelhöhen über Zeit + + + + Top %1: Most ascents + Top %1: Meiste Besteigungen + + + + Top %1: Highest peak + Top %1: Höchster Gipfel + + + + Top %1: Highest single elevation gain + Top %1: Meiste Höhenmeter (eine Besteigung) + + + + Top %1: Highest elevation gain sum [km] + Top %1: Höchste Summe Höhenmeter [km] + + + + Elevation gains + Höhenmeter + + + + Peak heights + Gipfelhöhen + + MainWindow - - + + New ascent... Neue Besteigung... - - + + New peak... Neuer Gipfel... - - + + New trip... Neuer Urlaub... - + Logged ascents: Eingetragene Besteigungen: - + Ascents Besteigungen - + Peaks Gipfel - + Trips Urlaube - + Hikers Wanderer - + Regions Regionen - + Mountain ranges Gebirge - + Countries Länder - + Statistics Statistik - + File Datei - + Open recent database Zuletzt geöffnet - + View Ansicht - + + Item statistics panel + Seitlicher Statistik-Bereich + + + New Neu - + Tools Werkzeuge - + Help Hilfe - + New database... Neue Datenbank... - + Open database... Datenbank öffnen... - + Clear list Liste leeren - + Save database as... Datenbank speichern unter... - + Close database Datenbank schließen - + Project settings... Projekteinstellungen... - + Settings... Einstellungen... - + Show filters Filter anzeigen - + Auto-resize columns Spaltenbreiten optimieren - + Export data... Daten exportieren... - + Reset column order Spaltenreihenfolge zurücksetzen - + Restore hidden columns Ausgeblendete Spalten anzeigen - + Show item statistics panel Statistik-Bereiche neben Tabellen anzeigen - - + + Hide on all tabs + In allen Tabs schließen + + + + Show on all tabs + In allen Tabs öffnen + + + + New hiker... Neuer Wanderer... - - + + New region... Neue Region... - - + + New mountain range... Neues Gebirge... - - + + New country... Neues Land... - + Relocate photos... Fotos umziehen... - + About PAL Über PAL - + About Qt Über Qt - + View... Ansehen... - + Edit... Bearbeiten... - + Edit as new duplicate... Als neues Duplikat bearbeiten... - + Opening database Datenbank öffnen - + Preparing tables... Tabellen werden vorbereitet... - + Preparing table %1... Tabelle %1 wird vorbereitet... - + Table is empty Tabelle ist leer - + %2 of %1 entry shown (%3 filtered out) Zeige %2 von %1 Eintrag (%3 ausgefiltert) - + %2 of %1 entries shown (%3 filtered out) Zeige %2 von %1 Einträgen (%3 ausgefiltert) - + %1 entry %1 Eintrag - + %1 entries %1 Einträge - + %1 filter applied %1 Filter aktiv - + %1 filters applied %1 Filter aktiv - + No filters applied Keine Filter aktiv - - + + Saved new %1. %1 gespeichert. - + Saved changes in %1. Änderungen in %1 gespeichert. - + Deleted %1. %1 gelöscht. - + Updating table Tabelle wird aktualisiert - + Updating table... Tabelle wird aktualisiert... - - + + Delete Löschen - + Hide this column Spalte ausblenden - + Restore hidden column Spalte anzeigen - + Save new database as Neue Datenbank speichern unter - + Open database Datenbank öffnen - + Database files Datanbank-Dateien - + All files Alle Dateien - - - + + + Save database as Datenbank speichern unter - + You cannot Save As to the same file. Datenbank kann nicht unter dem selben Namen gsepeichert werden. - + Hint: Hinweis: - + PAL auto-saves every change you make immediately, there is no need to save manually. PAL sichert automatisch alle Änderungen sofort. Manuelles Speichern ist nicht nötig. - + Writing database file failed: Speichern der neuen Datenbank-Datei fehlgeschlagen: - + Reverting to previously opened file: Kehre zurück zu vorher geöffneter Datei: @@ -3071,31 +3210,6 @@ Trotzdem speichern? Changing the language requires a restart. Die Änderung der Sprache erfordert einen Neustart. - - - Default - Standard - - - - Qt Fusion - Qt Fusion - - - - Modern Windows - Windows modern - - - - Classic Windows - Windows klassisch - - - - MacOS - MacOS - TripDialog