Compare commits
2 Commits
d800ecfed7
...
a6847f2661
| 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) {
|
||||
Document doc(std::string(), LabelParams(0, -1));
|
||||
const QList<QString> headerNames = GET_HEADER_NAMES();
|
||||
for (int column = 0; column < headerNames.size(); ++column) {
|
||||
doc.SetColumnName(column, headerNames.at(column).toStdString());
|
||||
// const QList<QString> headerNames = GET_HEADER_NAMES();
|
||||
const int columnCount = USER_FACING_ROLES.size();
|
||||
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) {
|
||||
QStringList rowValues = rows.at(row);
|
||||
@ -129,8 +132,22 @@ ModelItemValues CsvParser::getItemValuesForRow(
|
||||
QVariant CsvParser::parseItemValue(const int role, const std::string& valueString) {
|
||||
QVariant result;
|
||||
if (STRING_ROLES.contains(role)) {
|
||||
/// string values
|
||||
result = QString::fromStdString(valueString);
|
||||
if (role == ShareTypeRole) {
|
||||
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)) {
|
||||
/// int values
|
||||
|
||||
|
||||
Reference in New Issue
Block a user