From 5d9314f134ddd3dc4c853e398ac90ba247fb2e4f Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Mon, 13 Jun 2016 18:42:42 -0400 Subject: Imported Upstream version 3.1.0 --- Plugins/CsvImport/CsvImportOptions.ui | 5 +++- Plugins/CsvImport/CsvImport_de.ts | 18 ++++++------ Plugins/CsvImport/CsvImport_es.ts | 18 ++++++------ Plugins/CsvImport/CsvImport_fr.qm | Bin 2173 -> 1988 bytes Plugins/CsvImport/CsvImport_fr.ts | 20 ++++++++------ Plugins/CsvImport/CsvImport_it.qm | Bin 0 -> 23 bytes Plugins/CsvImport/CsvImport_it.ts | 18 ++++++------ Plugins/CsvImport/CsvImport_pl.qm | Bin 2414 -> 2515 bytes Plugins/CsvImport/CsvImport_pl.ts | 16 +++++++---- Plugins/CsvImport/CsvImport_pt_BR.ts | 18 ++++++------ Plugins/CsvImport/CsvImport_ru.qm | Bin 2389 -> 2184 bytes Plugins/CsvImport/CsvImport_ru.ts | 16 +++++++---- Plugins/CsvImport/CsvImport_sk.qm | Bin 2228 -> 2035 bytes Plugins/CsvImport/CsvImport_sk.ts | 16 +++++++---- Plugins/CsvImport/CsvImport_zh_CN.ts | 18 ++++++------ Plugins/CsvImport/csvimport.cpp | 50 ++++++++++++++-------------------- 16 files changed, 112 insertions(+), 101 deletions(-) create mode 100644 Plugins/CsvImport/CsvImport_it.qm (limited to 'Plugins/CsvImport') diff --git a/Plugins/CsvImport/CsvImportOptions.ui b/Plugins/CsvImport/CsvImportOptions.ui index b5e8ceb..f0f2728 100644 --- a/Plugins/CsvImport/CsvImportOptions.ui +++ b/Plugins/CsvImport/CsvImportOptions.ui @@ -7,7 +7,7 @@ 0 0 365 - 90 + 106 @@ -81,6 +81,9 @@ + + If enabled, then text value provided on the right will be interpreted as NULL + NULL values: diff --git a/Plugins/CsvImport/CsvImport_de.ts b/Plugins/CsvImport/CsvImport_de.ts index 4ebea97..6106963 100644 --- a/Plugins/CsvImport/CsvImport_de.ts +++ b/Plugins/CsvImport/CsvImport_de.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,12 @@ - + Enter the custom separator character. - - Enter the value that will be interpreted as a NULL. - - - - + CSV files (*.csv);;Text files (*.txt);;All files (*) @@ -73,11 +68,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: - + If your CSV data contains null values, define how are they represented in the CSV. diff --git a/Plugins/CsvImport/CsvImport_es.ts b/Plugins/CsvImport/CsvImport_es.ts index 14ff9c3..19027fc 100644 --- a/Plugins/CsvImport/CsvImport_es.ts +++ b/Plugins/CsvImport/CsvImport_es.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,12 @@ - + Enter the custom separator character. - - Enter the value that will be interpreted as a NULL. - - - - + CSV files (*.csv);;Text files (*.txt);;All files (*) @@ -73,11 +68,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: - + If your CSV data contains null values, define how are they represented in the CSV. diff --git a/Plugins/CsvImport/CsvImport_fr.qm b/Plugins/CsvImport/CsvImport_fr.qm index fd26433..cd941d9 100644 Binary files a/Plugins/CsvImport/CsvImport_fr.qm and b/Plugins/CsvImport/CsvImport_fr.qm differ diff --git a/Plugins/CsvImport/CsvImport_fr.ts b/Plugins/CsvImport/CsvImport_fr.ts index f8854e0..3d160e1 100644 --- a/Plugins/CsvImport/CsvImport_fr.ts +++ b/Plugins/CsvImport/CsvImport_fr.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,16 @@ Impossible de trouver des données dans le fichier %1. - + Enter the custom separator character. Saisir le caractère séparateur. - Enter the value that will be interpreted as a NULL. - Saisir la valeur qui sera interprétée comme NULL. + Saisir la valeur qui sera interprétée comme NULL. - + CSV files (*.csv);;Text files (*.txt);;All files (*) Fichiers CSV (*.csv);;Fichiers texte (*.txt);;Tous les fichiers (*) @@ -49,7 +48,7 @@ (whitespace) - (Espace) + (Espace) @@ -77,11 +76,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: - Valeurs NULL: + Valeurs NULL: - + If your CSV data contains null values, define how are they represented in the CSV. Si votre CSV de données contient des valeurs nulles, définissez leur représentation dans le CSV. diff --git a/Plugins/CsvImport/CsvImport_it.qm b/Plugins/CsvImport/CsvImport_it.qm new file mode 100644 index 0000000..9dad8df Binary files /dev/null and b/Plugins/CsvImport/CsvImport_it.qm differ diff --git a/Plugins/CsvImport/CsvImport_it.ts b/Plugins/CsvImport/CsvImport_it.ts index bc60d95..46c1948 100644 --- a/Plugins/CsvImport/CsvImport_it.ts +++ b/Plugins/CsvImport/CsvImport_it.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,12 @@ - + Enter the custom separator character. - - Enter the value that will be interpreted as a NULL. - - - - + CSV files (*.csv);;Text files (*.txt);;All files (*) @@ -73,11 +68,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: - + If your CSV data contains null values, define how are they represented in the CSV. diff --git a/Plugins/CsvImport/CsvImport_pl.qm b/Plugins/CsvImport/CsvImport_pl.qm index 7a63ef3..6f56305 100644 Binary files a/Plugins/CsvImport/CsvImport_pl.qm and b/Plugins/CsvImport/CsvImport_pl.qm differ diff --git a/Plugins/CsvImport/CsvImport_pl.ts b/Plugins/CsvImport/CsvImport_pl.ts index 227b16c..376d0d2 100644 --- a/Plugins/CsvImport/CsvImport_pl.ts +++ b/Plugins/CsvImport/CsvImport_pl.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,16 @@ Nie znaleziono danych w pliku %1. - + Enter the custom separator character. Wprowadź własny znak separatora. - Enter the value that will be interpreted as a NULL. - Wprowadź wartość, która będzie interpretowana jako NULL. + Wprowadź wartość, która będzie interpretowana jako NULL. - + CSV files (*.csv);;Text files (*.txt);;All files (*) Pliki CSV (*.csv);;Pliki tekstowe (*.txt);;Wszystkie pliki (*) @@ -81,11 +80,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + Kiedy włączone, to wartość tekstowa podana z prawej strony będzie interpretowana jako NULL + + + NULL values: Wartości NULL: - + If your CSV data contains null values, define how are they represented in the CSV. Jeśli twoje dane CSV zawierają wartości null, zdefiniuj jak są one reprezentowane w CSV. diff --git a/Plugins/CsvImport/CsvImport_pt_BR.ts b/Plugins/CsvImport/CsvImport_pt_BR.ts index 063fc09..32276a3 100644 --- a/Plugins/CsvImport/CsvImport_pt_BR.ts +++ b/Plugins/CsvImport/CsvImport_pt_BR.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,12 @@ - + Enter the custom separator character. - - Enter the value that will be interpreted as a NULL. - - - - + CSV files (*.csv);;Text files (*.txt);;All files (*) @@ -73,11 +68,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: - + If your CSV data contains null values, define how are they represented in the CSV. diff --git a/Plugins/CsvImport/CsvImport_ru.qm b/Plugins/CsvImport/CsvImport_ru.qm index e72533e..8def441 100644 Binary files a/Plugins/CsvImport/CsvImport_ru.qm and b/Plugins/CsvImport/CsvImport_ru.qm differ diff --git a/Plugins/CsvImport/CsvImport_ru.ts b/Plugins/CsvImport/CsvImport_ru.ts index 93ecdba..41ab843 100644 --- a/Plugins/CsvImport/CsvImport_ru.ts +++ b/Plugins/CsvImport/CsvImport_ru.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,16 @@ Невозможно найти данные в файле %1. - + Enter the custom separator character. Введите произвольный символ разделителя. - Enter the value that will be interpreted as a NULL. - Введите значение, которое будет интерпретировано как NULL. + Введите значение, которое будет интерпретировано как NULL. - + CSV files (*.csv);;Text files (*.txt);;All files (*) Файлы CSV (*.csv);;Текстовые файлы (*.txt);;Все файлы (*) @@ -77,11 +76,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: Значения NULL: - + If your CSV data contains null values, define how are they represented in the CSV. Если данные в CSV содержат значения NULL, укажите, как они представлены в файле CSV diff --git a/Plugins/CsvImport/CsvImport_sk.qm b/Plugins/CsvImport/CsvImport_sk.qm index 281fc9a..5e88aaa 100644 Binary files a/Plugins/CsvImport/CsvImport_sk.qm and b/Plugins/CsvImport/CsvImport_sk.qm differ diff --git a/Plugins/CsvImport/CsvImport_sk.ts b/Plugins/CsvImport/CsvImport_sk.ts index 3120bf9..134ed50 100644 --- a/Plugins/CsvImport/CsvImport_sk.ts +++ b/Plugins/CsvImport/CsvImport_sk.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,16 @@ Nemôžem nájsť dáta v súbore %1. - + Enter the custom separator character. Zadajte vlastný oddeľovač. - Enter the value that will be interpreted as a NULL. - Zadajte hodnotu, ktorá bude interpretovaná ako NULL. + Zadajte hodnotu, ktorá bude interpretovaná ako NULL. - + CSV files (*.csv);;Text files (*.txt);;All files (*) CSV súbory (*.csv);;Textové súbory (*.txt);;Všetky súbory (*) @@ -73,11 +72,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: NULL hodnoty: - + If your CSV data contains null values, define how are they represented in the CSV. Ak váš CSV súbor obsahuje null hodnoty, zadajte ako sú reprezentované v CSV. diff --git a/Plugins/CsvImport/CsvImport_zh_CN.ts b/Plugins/CsvImport/CsvImport_zh_CN.ts index c1958e3..7a11e6f 100644 --- a/Plugins/CsvImport/CsvImport_zh_CN.ts +++ b/Plugins/CsvImport/CsvImport_zh_CN.ts @@ -1,6 +1,6 @@ - + CsvImport @@ -14,17 +14,12 @@ - + Enter the custom separator character. - - Enter the value that will be interpreted as a NULL. - - - - + CSV files (*.csv);;Text files (*.txt);;All files (*) @@ -73,11 +68,16 @@ + If enabled, then text value provided on the right will be interpreted as NULL + + + + NULL values: - + If your CSV data contains null values, define how are they represented in the CSV. diff --git a/Plugins/CsvImport/csvimport.cpp b/Plugins/CsvImport/csvimport.cpp index cec81df..b1d52ee 100644 --- a/Plugins/CsvImport/csvimport.cpp +++ b/Plugins/CsvImport/csvimport.cpp @@ -53,26 +53,25 @@ void CsvImport::afterImport() bool CsvImport::extractColumns() { - QString line = stream->readLine(); - while (line.trimmed().isEmpty() && !stream->atEnd()) - line = stream->readLine(); + QStringList deserializedEntry = CsvSerializer::deserializeOneEntry(*stream, csvFormat); + while (deserializedEntry.isEmpty() && !stream->atEnd()) + deserializedEntry = CsvSerializer::deserializeOneEntry(*stream, csvFormat); - if (line.trimmed().isEmpty()) + if (deserializedEntry.isEmpty()) { notifyError(tr("Could not find any data in the file %1.").arg(file->fileName())); return false; } - QStringList deserialized = CsvSerializer::deserialize(line.trimmed(), csvFormat).first(); if (cfg.CsvImport.FirstRowAsColumns.get()) { - columnNames = deserialized; + columnNames = deserializedEntry; } else { static const QString colTmp = QStringLiteral("column%1"); columnNames.clear(); - for (int i = 1, total = deserialized.size(); i <= total; ++i) + for (int i = 1, total = deserializedEntry.size(); i <= total; ++i) columnNames << colTmp.arg(i); stream->seek(0); @@ -117,31 +116,28 @@ QList CsvImport::getColumns() const QList CsvImport::next() { - QString line = stream->readLine(); - if (line.isNull()) - return QList(); + QStringList deserializedEntry = CsvSerializer::deserializeOneEntry(*stream, csvFormat); QList values; - QList deserialized = CsvSerializer::deserialize(line, csvFormat); - if (deserialized.size() > 0) + if (deserializedEntry.isEmpty()) + return values; + + if (cfg.CsvImport.NullValues.get()) { - if (cfg.CsvImport.NullValues.get()) + QString nullVal = cfg.CsvImport.NullValueString.get(); + for (const QString& val : deserializedEntry) { - QString nullVal = cfg.CsvImport.NullValueString.get(); - for (const QString& val : deserialized.first()) - { - if (val == nullVal) - values << QVariant(QVariant::String); - else - values << val; - } - } - else - { - for (const QString& val : deserialized.first()) + if (val == nullVal) + values << QVariant(QVariant::String); + else values << val; } } + else + { + for (const QString& val : deserializedEntry) + values << val; + } return values; } @@ -176,10 +172,6 @@ bool CsvImport::validateOptions() if (cfg.CsvImport.NullValues.get()) { IMPORT_MANAGER->updateVisibilityAndEnabled(cfg.CsvImport.NullValueString, true, true); - - bool valid = !cfg.CsvImport.NullValueString.get().isEmpty(); - IMPORT_MANAGER->handleValidationFromPlugin(valid, cfg.CsvImport.NullValueString, tr("Enter the value that will be interpreted as a NULL.")); - isValid &= valid; } else { -- cgit v1.2.3