Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Education
LabPlot
Commits
bf4e9fbc
Commit
bf4e9fbc
authored
Jul 05, 2020
by
Alexander Semke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ascii import] instead of asking the user to provide the locale, ask
explictely for the decimal separator (point or comma).
parent
708a25d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
18 deletions
+27
-18
src/kdefrontend/datasources/AsciiOptionsWidget.cpp
src/kdefrontend/datasources/AsciiOptionsWidget.cpp
+21
-12
src/kdefrontend/ui/datasources/asciioptionswidget.ui
src/kdefrontend/ui/datasources/asciioptionswidget.ui
+6
-6
No files found.
src/kdefrontend/datasources/AsciiOptionsWidget.cpp
View file @
bf4e9fbc
...
...
@@ -47,20 +47,19 @@ AsciiOptionsWidget::AsciiOptionsWidget(QWidget* parent) : QWidget(parent) {
ui
.
cbSeparatingCharacter
->
addItems
(
AsciiFilter
::
separatorCharacters
());
ui
.
cbCommentCharacter
->
addItems
(
AsciiFilter
::
commentCharacters
());
ui
.
cbNumberFormat
->
addItems
(
AbstractFileFilter
::
numberFormats
());
ui
.
cbDecimalSeparator
->
addItem
(
i18n
(
"Point '.'"
));
ui
.
cbDecimalSeparator
->
addItem
(
i18n
(
"Comma ','"
));
ui
.
cbDateTimeFormat
->
addItems
(
AbstractColumn
::
dateTimeFormats
());
const
QString
textNumberFormatShort
=
i18n
(
"This option determines how the imported strings have to be converted to numbers."
);
const
QString
textNumberFormat
=
textNumberFormatShort
+
"<br><br>"
+
i18n
(
"For 'C Format', a period is used for the decimal point character and comma is used for the thousands group separator. "
"Valid number representations are:"
"When point character is used for the decimal separator, the valid number representations are:"
"<ul>"
"<li>1234.56</li>"
"<li>1,234.56</li>"
"<li>etc.</li>"
"</ul>"
"When using 'System locale', the system settings will be used. "
"E.g., for the German local the valid number representations are:"
"For comma as the decimal separator, the valid number representations are:"
"<ul>"
"<li>1234,56</li>"
"<li>1.234,56</li>"
...
...
@@ -68,10 +67,10 @@ AsciiOptionsWidget::AsciiOptionsWidget(QWidget* parent) : QWidget(parent) {
"</ul>"
);
ui
.
l
NumberFormat
->
setToolTip
(
textNumberFormatShort
);
ui
.
l
NumberFormat
->
setWhatsThis
(
textNumberFormat
);
ui
.
cb
NumberFormat
->
setToolTip
(
textNumberFormatShort
);
ui
.
cb
NumberFormat
->
setWhatsThis
(
textNumberFormat
);
ui
.
l
DecimalSeparator
->
setToolTip
(
textNumberFormatShort
);
ui
.
l
DecimalSeparator
->
setWhatsThis
(
textNumberFormat
);
ui
.
cb
DecimalSeparator
->
setToolTip
(
textNumberFormatShort
);
ui
.
cb
DecimalSeparator
->
setWhatsThis
(
textNumberFormat
);
const
QString
textDateTimeFormatShort
=
i18n
(
"This option determines how the imported strings have to be converted to calendar date, i.e. year, month, and day numbers in the Gregorian calendar and to time."
);
const
QString
textDateTimeFormat
=
textDateTimeFormatShort
+
"<br><br>"
+
i18n
(
...
...
@@ -148,7 +147,13 @@ void AsciiOptionsWidget::applyFilterSettings(AsciiFilter* filter) const {
Q_ASSERT
(
filter
);
filter
->
setCommentCharacter
(
ui
.
cbCommentCharacter
->
currentText
()
);
filter
->
setSeparatingCharacter
(
ui
.
cbSeparatingCharacter
->
currentText
()
);
filter
->
setNumberFormat
(
QLocale
::
Language
(
ui
.
cbNumberFormat
->
currentIndex
())
);
QLocale
::
Language
lang
;
if
(
ui
.
cbDecimalSeparator
->
currentIndex
()
==
0
)
lang
=
QLocale
::
Language
::
C
;
else
lang
=
QLocale
::
Language
::
German
;
filter
->
setNumberFormat
(
lang
);
filter
->
setDateTimeFormat
(
ui
.
cbDateTimeFormat
->
currentText
());
filter
->
setCreateIndexEnabled
(
ui
.
chbCreateIndex
->
isChecked
()
);
filter
->
setCreateTimestampEnabled
(
ui
.
chbCreateTimestamp
->
isChecked
()
);
...
...
@@ -169,7 +174,11 @@ void AsciiOptionsWidget::loadSettings() const {
ui
.
cbCommentCharacter
->
setCurrentText
(
conf
.
readEntry
(
"CommentCharacter"
,
"#"
));
ui
.
cbSeparatingCharacter
->
setCurrentItem
(
conf
.
readEntry
(
"SeparatingCharacter"
,
"auto"
));
ui
.
cbNumberFormat
->
setCurrentIndex
(
conf
.
readEntry
(
"NumberFormat"
,
(
int
)
QLocale
::
AnyLanguage
));
const
QChar
decimalSeparator
=
QLocale
().
decimalPoint
();
int
index
=
(
decimalSeparator
==
'.'
)
?
0
:
1
;
ui
.
cbDecimalSeparator
->
setCurrentIndex
(
conf
.
readEntry
(
"DecimalSeparator"
,
index
));
ui
.
cbDateTimeFormat
->
setCurrentItem
(
conf
.
readEntry
(
"DateTimeFormat"
,
"yyyy-MM-dd hh:mm:ss.zzz"
));
ui
.
chbCreateIndex
->
setChecked
(
conf
.
readEntry
(
"CreateIndex"
,
false
));
ui
.
chbCreateTimestamp
->
setChecked
(
conf
.
readEntry
(
"CreateTimestamp"
,
true
));
...
...
@@ -186,7 +195,7 @@ void AsciiOptionsWidget::saveSettings() {
conf
.
writeEntry
(
"CommentCharacter"
,
ui
.
cbCommentCharacter
->
currentText
());
conf
.
writeEntry
(
"SeparatingCharacter"
,
ui
.
cbSeparatingCharacter
->
currentText
());
conf
.
writeEntry
(
"
NumberFormat"
,
ui
.
cbNumberFormat
->
currentIndex
());
conf
.
writeEntry
(
"
DecimalSeparator"
,
ui
.
cbDecimalSeparator
->
currentIndex
());
conf
.
writeEntry
(
"DateTimeFormat"
,
ui
.
cbDateTimeFormat
->
currentText
());
conf
.
writeEntry
(
"CreateIndex"
,
ui
.
chbCreateIndex
->
isChecked
());
conf
.
writeEntry
(
"CreateTimestamp"
,
ui
.
chbCreateTimestamp
->
isChecked
());
...
...
src/kdefrontend/ui/datasources/asciioptionswidget.ui
View file @
bf4e9fbc
...
...
@@ -20,7 +20,7 @@
<item
row=
"0"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label_7"
>
<property
name=
"text"
>
<string>
Comment
c
haracter:
</string>
<string>
Comment
C
haracter:
</string>
</property>
</widget>
</item>
...
...
@@ -53,7 +53,7 @@
<item
row=
"1"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"lSeparatingCharacter"
>
<property
name=
"text"
>
<string>
Separating string:
</string>
<string>
Column Separator
</string>
</property>
</widget>
</item>
...
...
@@ -65,19 +65,19 @@
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"l
NumberFormat
"
>
<widget
class=
"QLabel"
name=
"l
DecimalSeparator
"
>
<property
name=
"text"
>
<string>
Number format
:
</string>
<string>
Decimal Separator
:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"2"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"cb
NumberFormat
"
/>
<widget
class=
"QComboBox"
name=
"cb
DecimalSeparator
"
/>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"lDateTimeFormat"
>
<property
name=
"text"
>
<string>
DateTime
f
ormat:
</string>
<string>
DateTime
F
ormat:
</string>
</property>
</widget>
</item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment