|
26 | 26 | #include <QElapsedTimer> |
27 | 27 | #endif |
28 | 28 |
|
| 29 | +QChar ImportCsvDialog::getSettingsChar(const std::string& group, const std::string& name) |
| 30 | +{ |
| 31 | + QVariant value = Settings::getValue(group, name); |
| 32 | + // QVariant is not able to return the character as a QChar when QString is stored. |
| 33 | + // We do it manually, since it is versatile, when the option is passed from the command line, |
| 34 | + // for example. |
| 35 | + if(value.userType() == QMetaType::QString) |
| 36 | + return value.toString().at(0); |
| 37 | + else |
| 38 | + return value.toChar(); |
| 39 | +} |
| 40 | + |
29 | 41 | ImportCsvDialog::ImportCsvDialog(const std::vector<QString>& filenames, DBBrowserDB* db, QWidget* parent) |
30 | 42 | : QDialog(parent), |
31 | 43 | ui(new Ui::ImportCsvDialog), |
@@ -60,8 +72,8 @@ ImportCsvDialog::ImportCsvDialog(const std::vector<QString>& filenames, DBBrowse |
60 | 72 | ui->checkBoxTrimFields->setChecked(Settings::getValue("importcsv", "trimfields").toBool()); |
61 | 73 | ui->checkBoxSeparateTables->setChecked(Settings::getValue("importcsv", "separatetables").toBool()); |
62 | 74 | ui->checkLocalConventions->setChecked(Settings::getValue("importcsv", "localconventions").toBool()); |
63 | | - setSeparatorChar(Settings::getValue("importcsv", "separator").toChar()); |
64 | | - setQuoteChar(Settings::getValue("importcsv", "quotecharacter").toChar()); |
| 75 | + setSeparatorChar(getSettingsChar("importcsv", "separator")); |
| 76 | + setQuoteChar(getSettingsChar("importcsv", "quotecharacter")); |
65 | 77 | setEncoding(Settings::getValue("importcsv", "encoding").toString()); |
66 | 78 |
|
67 | 79 | ui->checkboxHeader->blockSignals(false); |
|
0 commit comments