Compare commits
2 Commits
d800ecfed7
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| a6847f2661 | |||
| 3431e281c3 |
@ -23,9 +23,12 @@ QList<ModelItemValues> CsvParser::getItemsFromCSVFile(const QString& fileName) {
|
|||||||
|
|
||||||
bool CsvParser::exportToCSVFile(const QList<QStringList>& rows, const QString& filePath) {
|
bool CsvParser::exportToCSVFile(const QList<QStringList>& rows, const QString& filePath) {
|
||||||
Document doc(std::string(), LabelParams(0, -1));
|
Document doc(std::string(), LabelParams(0, -1));
|
||||||
const QList<QString> headerNames = GET_HEADER_NAMES();
|
// const QList<QString> headerNames = GET_HEADER_NAMES();
|
||||||
for (int column = 0; column < headerNames.size(); ++column) {
|
const int columnCount = USER_FACING_ROLES.size();
|
||||||
doc.SetColumnName(column, headerNames.at(column).toStdString());
|
for (int column = 0; column < columnCount; ++column) {
|
||||||
|
const UserRoles role = GET_ROLE_FOR_COLUMN(column);
|
||||||
|
std::string columnName = ROLE_NAMES.value(role).toStdString();
|
||||||
|
doc.SetColumnName(column, columnName);
|
||||||
}
|
}
|
||||||
for (int row = 0; row < rows.size(); ++row) {
|
for (int row = 0; row < rows.size(); ++row) {
|
||||||
QStringList rowValues = rows.at(row);
|
QStringList rowValues = rows.at(row);
|
||||||
@ -129,8 +132,22 @@ ModelItemValues CsvParser::getItemValuesForRow(
|
|||||||
QVariant CsvParser::parseItemValue(const int role, const std::string& valueString) {
|
QVariant CsvParser::parseItemValue(const int role, const std::string& valueString) {
|
||||||
QVariant result;
|
QVariant result;
|
||||||
if (STRING_ROLES.contains(role)) {
|
if (STRING_ROLES.contains(role)) {
|
||||||
/// string values
|
if (role == ShareTypeRole) {
|
||||||
result = QString::fromStdString(valueString);
|
if (valueString == "AGA") {
|
||||||
|
result = "erarbeitet";
|
||||||
|
} else if (valueString == "ja") {
|
||||||
|
result = "bezahlt";
|
||||||
|
|
||||||
|
} else if (valueString == "teils") {
|
||||||
|
result = "teils/teils";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
result = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/// string values
|
||||||
|
result = QString::fromStdString(valueString);
|
||||||
|
}
|
||||||
} else if (INT_ROLES.contains(role)) {
|
} else if (INT_ROLES.contains(role)) {
|
||||||
/// int values
|
/// int values
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user