WSL/SLF GitLab Repository
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
inishell
Commits
116d1f77
Commit
116d1f77
authored
Dec 08, 2021
by
Mathias Bavay
Browse files
Fixing some warnings revealed by the new debug compilation flags
parent
8a8bc565
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/gui/PreviewWindow.cc
View file @
116d1f77
...
...
@@ -353,140 +353,140 @@ void PreviewWindow::createMenu()
/* TRANSFORM menu */
QMenu
*
menu_transform
=
this
->
menuBar
()
->
addMenu
(
tr
(
"&Transform"
));
/* Whitespaces menu */
auto
*
trans
form
_whitespaces
=
new
QMenu
(
tr
(
"Whitespaces"
),
menu_transform
);
trans
form
_whitespaces
->
setIcon
(
getIcon
(
"markasblank"
)
);
menu_transform
->
addMenu
(
trans
form
_whitespaces
);
auto
*
transform_transform_singlews
=
new
QAction
(
getIcon
(
"unmarkasblank"
),
tr
(
"To single spaces"
),
trans
form
_whitespaces
);
auto
*
trans_whitespaces
=
new
QMenu
(
tr
(
"Whitespaces"
),
menu_transform
);
trans_whitespaces
->
setIcon
(
getIcon
(
"markasblank"
)
);
menu_transform
->
addMenu
(
trans_whitespaces
);
auto
*
transform_transform_singlews
=
new
QAction
(
getIcon
(
"unmarkasblank"
),
tr
(
"To single spaces"
),
trans_whitespaces
);
connect
(
transform_transform_singlews
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_whitespace_singlews"
);
}
);
trans
form
_whitespaces
->
addAction
(
transform_transform_singlews
);
trans_whitespaces
->
addAction
(
transform_transform_singlews
);
auto
*
transform_transform_longestws
=
new
QAction
(
tr
(
"Adapt to longest keys"
),
trans
form
_whitespaces
);
trans_whitespaces
);
connect
(
transform_transform_longestws
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_whitespace_longestws"
);
}
);
trans
form
_whitespaces
->
addAction
(
transform_transform_longestws
);
trans_whitespaces
->
addAction
(
transform_transform_longestws
);
/* Sort */
auto
*
trans
form
_sort
=
new
QMenu
(
tr
(
"Sort"
),
menu_transform
);
trans
form
_sort
->
setIcon
(
getIcon
(
"view-sort"
)
);
menu_transform
->
addMenu
(
trans
form
_sort
);
auto
*
transform_sort_alphabetically
=
new
QAction
(
tr
(
"Alphabetically"
),
trans
form
_sort
);
auto
*
trans_sort
=
new
QMenu
(
tr
(
"Sort"
),
menu_transform
);
trans_sort
->
setIcon
(
getIcon
(
"view-sort"
)
);
menu_transform
->
addMenu
(
trans_sort
);
auto
*
transform_sort_alphabetically
=
new
QAction
(
tr
(
"Alphabetically"
),
trans_sort
);
connect
(
transform_sort_alphabetically
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_sort_alphabetically"
);
}
);
trans
form
_sort
->
addAction
(
transform_sort_alphabetically
);
auto
*
transform_sort_order
=
new
QAction
(
tr
(
"In order of INI file"
),
trans
form
_sort
);
trans_sort
->
addAction
(
transform_sort_alphabetically
);
auto
*
transform_sort_order
=
new
QAction
(
tr
(
"In order of INI file"
),
trans_sort
);
connect
(
transform_sort_order
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_sort_order"
);
}
);
trans
form
_sort
->
addAction
(
transform_sort_order
);
trans_sort
->
addAction
(
transform_sort_order
);
/* Capitalization menu */
auto
*
trans
form
_capitalization
=
new
QMenu
(
tr
(
"Capitalization"
),
menu_transform
);
menu_transform
->
addMenu
(
trans
form
_capitalization
);
auto
*
trans_capitalization
=
new
QMenu
(
tr
(
"Capitalization"
),
menu_transform
);
menu_transform
->
addMenu
(
trans_capitalization
);
auto
*
transform_capitalization_sections_upper
=
new
QAction
(
tr
(
"Sections to upper case"
),
trans
form
_capitalization
);
tr
(
"Sections to upper case"
),
trans_capitalization
);
connect
(
transform_capitalization_sections_upper
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_sections_upper"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_sections_upper
);
trans_capitalization
->
addAction
(
transform_capitalization_sections_upper
);
auto
*
transform_capitalization_sections_lower
=
new
QAction
(
tr
(
"Sections to lower case"
),
trans
form
_capitalization
);
tr
(
"Sections to lower case"
),
trans_capitalization
);
connect
(
transform_capitalization_sections_lower
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_sections_lower"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_sections_lower
);
trans_capitalization
->
addAction
(
transform_capitalization_sections_lower
);
auto
*
transform_capitalization_keys_upper
=
new
QAction
(
tr
(
"Keys to upper case"
),
trans
form
_capitalization
);
tr
(
"Keys to upper case"
),
trans_capitalization
);
connect
(
transform_capitalization_keys_upper
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_keys_upper"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_keys_upper
);
trans_capitalization
->
addAction
(
transform_capitalization_keys_upper
);
auto
*
transform_capitalization_keys_lower
=
new
QAction
(
tr
(
"Keys to lower case"
),
trans
form
_capitalization
);
tr
(
"Keys to lower case"
),
trans_capitalization
);
connect
(
transform_capitalization_keys_lower
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_keys_lower"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_keys_lower
);
trans_capitalization
->
addAction
(
transform_capitalization_keys_lower
);
auto
*
transform_capitalization_values_upper
=
new
QAction
(
tr
(
"Values to upper case"
),
trans
form
_capitalization
);
tr
(
"Values to upper case"
),
trans_capitalization
);
connect
(
transform_capitalization_values_upper
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_values_upper"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_values_upper
);
trans_capitalization
->
addAction
(
transform_capitalization_values_upper
);
auto
*
transform_capitalization_values_lower
=
new
QAction
(
tr
(
"Values to lower case"
),
trans
form
_capitalization
);
tr
(
"Values to lower case"
),
trans_capitalization
);
connect
(
transform_capitalization_values_lower
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_values_lower"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_values_lower
);
trans
form
_capitalization
->
addSeparator
();
trans_capitalization
->
addAction
(
transform_capitalization_values_lower
);
trans_capitalization
->
addSeparator
();
auto
*
transform_capitalization_upper
=
new
QAction
(
getIcon
(
"format-text-uppercase"
),
tr
(
"All to upper case"
),
trans
form
_capitalization
);
tr
(
"All to upper case"
),
trans_capitalization
);
connect
(
transform_capitalization_upper
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_upper"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_upper
);
trans_capitalization
->
addAction
(
transform_capitalization_upper
);
auto
*
transform_capitalization_lower
=
new
QAction
(
getIcon
(
"format-text-lowercase"
),
tr
(
"All to lower case"
),
trans
form
_capitalization
);
tr
(
"All to lower case"
),
trans_capitalization
);
connect
(
transform_capitalization_lower
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_capitalization_lower"
);
}
);
trans
form
_capitalization
->
addAction
(
transform_capitalization_lower
);
trans_capitalization
->
addAction
(
transform_capitalization_lower
);
/* Comments menu */
auto
*
trans
form
_comments
=
new
QMenu
(
tr
(
"Comments"
),
menu_transform
);
trans
form
_comments
->
setIcon
(
getIcon
(
"code-context"
)
);
menu_transform
->
addMenu
(
trans
form
_comments
);
auto
*
trans
form
_comment_block
=
new
QAction
(
tr
(
"Comment selection"
));
trans
form
_comments
->
addAction
(
trans
form
_comment_block
);
trans
form
_comment_block
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
Key_NumberSign
);
connect
(
trans
form
_comment_block
,
&
QAction
::
triggered
,
this
,
auto
*
trans_comments
=
new
QMenu
(
tr
(
"Comments"
),
menu_transform
);
trans_comments
->
setIcon
(
getIcon
(
"code-context"
)
);
menu_transform
->
addMenu
(
trans_comments
);
auto
*
trans_comment_block
=
new
QAction
(
tr
(
"Comment selection"
));
trans_comments
->
addAction
(
trans_comment_block
);
trans_comment_block
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
Key_NumberSign
);
connect
(
trans_comment_block
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comment_block"
);
});
auto
*
trans
form
_uncomment_block
=
new
QAction
(
tr
(
"Uncomment selection"
));
trans
form
_comments
->
addAction
(
trans
form
_uncomment_block
);
trans
form
_uncomment_block
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
SHIFT
+
Qt
::
Key_NumberSign
);
connect
(
trans
form
_uncomment_block
,
&
QAction
::
triggered
,
this
,
auto
*
trans_uncomment_block
=
new
QAction
(
tr
(
"Uncomment selection"
));
trans_comments
->
addAction
(
trans_uncomment_block
);
trans_uncomment_block
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
SHIFT
+
Qt
::
Key_NumberSign
);
connect
(
trans_uncomment_block
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_uncomment_block"
);
});
trans
form
_comments
->
addSeparator
();
auto
*
trans
form
_comments_content
=
new
QAction
(
tr
(
"Comment all content"
),
trans
form
_comments
);
connect
(
trans
form
_comments_content
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addSeparator
();
auto
*
trans_comments_content
=
new
QAction
(
tr
(
"Comment all content"
),
trans_comments
);
connect
(
trans_comments_content
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_content"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_content
);
auto
*
trans
form
_comments_duplicate
=
new
QAction
(
tr
(
"Duplicate all to comment"
),
trans
form
_comments
);
trans
form
_comments_duplicate
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
SHIFT
+
Qt
::
Key_B
);
connect
(
trans
form
_comments_duplicate
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addAction
(
trans_comments_content
);
auto
*
trans_comments_duplicate
=
new
QAction
(
tr
(
"Duplicate all to comment"
),
trans_comments
);
trans_comments_duplicate
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
SHIFT
+
Qt
::
Key_B
);
connect
(
trans_comments_duplicate
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_duplicate"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_duplicate
);
auto
*
trans
form
_comments_move_values
=
new
QAction
(
tr
(
"Move next to values"
),
trans
form
_comments
);
connect
(
trans
form
_comments_move_values
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addAction
(
trans_comments_duplicate
);
auto
*
trans_comments_move_values
=
new
QAction
(
tr
(
"Move next to values"
),
trans_comments
);
connect
(
trans_comments_move_values
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_move_value"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_move_values
);
auto
*
trans
form
_comments_move_end
=
new
QAction
(
tr
(
"Collect at bottom"
),
trans
form
_comments
);
connect
(
trans
form
_comments_move_end
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addAction
(
trans_comments_move_values
);
auto
*
trans_comments_move_end
=
new
QAction
(
tr
(
"Collect at bottom"
),
trans_comments
);
connect
(
trans_comments_move_end
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_move_end"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_move_end
);
auto
*
trans
form
_comments_trim
=
new
QAction
(
getIcon
(
"edit-clear-all"
),
tr
(
"Trim"
),
trans
form
_comments
);
connect
(
trans
form
_comments_trim
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addAction
(
trans_comments_move_end
);
auto
*
trans_comments_trim
=
new
QAction
(
getIcon
(
"edit-clear-all"
),
tr
(
"Trim"
),
trans_comments
);
connect
(
trans_comments_trim
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_trim"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_trim
);
auto
*
trans
form
_comments_delete
=
new
QAction
(
tr
(
"Delete all"
),
trans
form
_comments
);
connect
(
trans
form
_comments_delete
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addAction
(
trans_comments_trim
);
auto
*
trans_comments_delete
=
new
QAction
(
tr
(
"Delete all"
),
trans_comments
);
connect
(
trans_comments_delete
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_delete"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_delete
);
trans
form
_comments
->
addSeparator
();
auto
*
trans
form
_comments_numbersign
=
new
QAction
(
tr
(
"Switch to #"
),
trans
form
_comments
);
connect
(
trans
form
_comments_numbersign
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addAction
(
trans_comments_delete
);
trans_comments
->
addSeparator
();
auto
*
trans_comments_numbersign
=
new
QAction
(
tr
(
"Switch to #"
),
trans_comments
);
connect
(
trans_comments_numbersign
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_numbersign"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_numbersign
);
auto
*
trans
form
_comments_semicolon
=
new
QAction
(
tr
(
"Switch to ;"
),
trans
form
_comments
);
connect
(
trans
form
_comments_semicolon
,
&
QAction
::
triggered
,
this
,
trans_comments
->
addAction
(
trans_comments_numbersign
);
auto
*
trans_comments_semicolon
=
new
QAction
(
tr
(
"Switch to ;"
),
trans_comments
);
connect
(
trans_comments_semicolon
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_comments_semicolon"
);
}
);
trans
form
_comments
->
addAction
(
trans
form
_comments_semicolon
);
trans_comments
->
addAction
(
trans_comments_semicolon
);
/* Reset menu */
auto
*
trans
form
_reset
=
new
QMenu
(
tr
(
"Reset"
),
menu_transform
);
trans
form
_reset
->
setIcon
(
getIcon
(
"view-refresh"
)
);
menu_transform
->
addMenu
(
trans
form
_reset
);
auto
*
trans_reset
=
new
QMenu
(
tr
(
"Reset"
),
menu_transform
);
trans_reset
->
setIcon
(
getIcon
(
"view-refresh"
)
);
menu_transform
->
addMenu
(
trans_reset
);
auto
*
transform_reset_original
=
new
QAction
(
tr
(
"To original INI on file system"
),
trans
form
_reset
);
trans_reset
);
connect
(
transform_reset_original
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_reset_original"
);
}
);
trans
form
_reset
->
addAction
(
transform_reset_original
);
transform_reset_full_
=
new
QAction
(
tr
(
"To full INI with GUI keys"
),
trans
form
_reset
);
trans_reset
->
addAction
(
transform_reset_original
);
transform_reset_full_
=
new
QAction
(
tr
(
"To full INI with GUI keys"
),
trans_reset
);
connect
(
transform_reset_full_
,
&
QAction
::
triggered
,
this
,
[
=
]{
onTransformMenuClick
(
"transform_reset_full"
);
}
);
trans
form
_reset
->
addAction
(
transform_reset_full_
);
trans_reset
->
addAction
(
transform_reset_full_
);
/* CONVERT menu */
QMenu
*
menu_convert
=
this
->
menuBar
()
->
addMenu
(
tr
(
"&Convert"
));
...
...
src/gui/WorkflowPanel.cc
View file @
116d1f77
...
...
@@ -631,12 +631,12 @@ QString WorkflowPanel::setReferencePath(const QPushButton *button, const QString
*/
QString
WorkflowPanel
::
getWidgetValue
(
QWidget
*
widget
)
const
{
if
(
auto
*
wid
=
qobject_cast
<
QDateTimeEdit
*>
(
widget
))
return
wid
->
dateTime
().
toString
(
Qt
::
DateFormat
::
ISODate
);
else
if
(
auto
*
wid
=
qobject_cast
<
QLineEdit
*>
(
widget
))
return
wid
->
text
();
else
if
(
auto
*
wid
=
qobject_cast
<
QCheckBox
*>
(
widget
))
return
(
wid
->
checkState
()
==
Qt
::
Checked
?
"TRUE"
:
"FALSE"
);
if
(
auto
*
wid
1
=
qobject_cast
<
QDateTimeEdit
*>
(
widget
))
return
wid
1
->
dateTime
().
toString
(
Qt
::
DateFormat
::
ISODate
);
else
if
(
auto
*
wid
2
=
qobject_cast
<
QLineEdit
*>
(
widget
))
return
wid
2
->
text
();
else
if
(
auto
*
wid
3
=
qobject_cast
<
QCheckBox
*>
(
widget
))
return
(
wid
3
->
checkState
()
==
Qt
::
Checked
?
"TRUE"
:
"FALSE"
);
return
QString
();
}
...
...
src/main/INIParser.h
View file @
116d1f77
...
...
@@ -135,9 +135,9 @@ class INIParser {
public:
INIParser
()
=
default
;
//careful: caller must set logger afterwards!
INIParser
(
Logger
*
in_logger
)
:
logger_instance_
(
in_logger
)
{}
INIParser
(
Logger
*
in_logger
)
:
logger_instance_
(
in_logger
)
,
filename_
(),
sections_
(),
block_comment_at_end_
(),
equality_check_msg_
()
{}
INIParser
(
const
QString
&
in_file
,
Logger
*
in_logger
)
:
logger_instance_
(
in_logger
)
{
parseFile
(
in_file
);
}
logger_instance_
(
in_logger
)
,
filename_
(),
sections_
(),
block_comment_at_end_
(),
equality_check_msg_
()
{
parseFile
(
in_file
);
}
bool
operator
==
(
const
INIParser
&
other
);
bool
operator
!=
(
const
INIParser
&
other
){
return
!
(
*
this
==
other
);
}
void
setLogger
(
Logger
*
in_logger
)
{
logger_instance_
=
in_logger
;
}
...
...
@@ -176,7 +176,7 @@ class INIParser {
bool
first_error_message_
=
true
;
//to prepend INI file info if an error occurs
Logger
*
logger_instance_
=
nullptr
;
QString
filename_
=
QString
()
;
QString
filename_
;
SectionList
sections_
;
QString
block_comment_at_end_
;
//a final comment that is not followed by any key or section anymore
QString
equality_check_msg_
;
//when INIParsers are compared this transports a hint as to what's different
...
...
src/main/XMLReader.cc
View file @
116d1f77
...
...
@@ -144,11 +144,11 @@ void XMLReader::parseReferences()
/**
* @brief Parse include files in an XML.
* @details This function scans an XML document for our own simple include system.
* @param[in] xml_ XML document to check for include files.
* @param[in] xml_
input
XML document to check for include files.
* @param[in] parent_file The parent file this file is included in.
* @param[out] xml_error XML operations error string to add to.
*/
void
XMLReader
::
parseIncludes
(
const
QDomDocument
&
xml_
,
const
QString
&
parent_file
,
QString
&
xml_error
)
void
XMLReader
::
parseIncludes
(
const
QDomDocument
&
xml_
input
,
const
QString
&
parent_file
,
QString
&
xml_error
)
{
/*
* XML documents are scanned for the "<include file="..."/>" tag. If found, the file
...
...
@@ -165,7 +165,7 @@ void XMLReader::parseIncludes(const QDomDocument &xml_, const QString &parent_fi
//We use a while loop here and re-search "include" nodes after each insertion, because the
//replacements invalidate XML iterators of a for loop.
while
(
true
)
{
const
auto
include_element
(
xml_
.
firstChildElement
().
firstChildElement
(
"include"
)
);
const
auto
include_element
(
xml_
input
.
firstChildElement
().
firstChildElement
(
"include"
)
);
if
(
include_element
.
isNull
())
break
;
const
QString
include_file_name
(
include_element
.
toElement
().
attribute
(
"file"
)
);
...
...
src/main/XMLReader.h
View file @
116d1f77
...
...
@@ -43,7 +43,7 @@ class XMLReader {
QString
read
(
QFile
&
file
,
QString
&
xml_error
,
const
bool
&
no_references
=
false
);
QString
read
(
const
QString
&
filename
,
QString
&
xml_error
,
const
bool
&
no_references
=
false
);
void
parseReferences
();
void
parseIncludes
(
const
QDomDocument
&
xml_
,
const
QString
&
parent_file
,
QString
&
xml_error
);
void
parseIncludes
(
const
QDomDocument
&
xml_
input
,
const
QString
&
parent_file
,
QString
&
xml_error
);
QString
parseAutoloadIni
()
const
;
QDomDocumentFragment
fragmentFromNodeChildren
(
const
QDomNode
&
node
);
static
QDomNode
prependParent
(
const
QDomNode
&
child
);
...
...
src/main/common.h
View file @
116d1f77
...
...
@@ -61,7 +61,7 @@ struct CaseInsensitiveCompare {
*/
class
MessageHandler
:
public
QAbstractMessageHandler
{
public:
MessageHandler
()
:
QAbstractMessageHandler
(
nullptr
)
{}
MessageHandler
()
:
QAbstractMessageHandler
(
nullptr
)
,
description_
(),
location_
()
{}
QString
status
()
const
{
return
description_
;
}
int
line
()
const
{
return
static_cast
<
int
>
(
location_
.
line
());
}
int
column
()
const
{
return
static_cast
<
int
>
(
location_
.
column
());
}
...
...
src/panels/Number.cc
View file @
116d1f77
...
...
@@ -56,14 +56,14 @@ bool KeyPressFilter::eventFilter(QObject *object, QEvent *event)
* this hidden value contributes. Here, we prevent this.
*/
object
->
setProperty
(
"empty"
,
"false"
);
//necessary if entered number happens to be the hidden value
if
(
auto
*
spinbox
=
qobject_cast
<
QSpinBox
*>
(
object
))
{
//try both types
spinbox
->
parent
()
->
setProperty
(
"ini_value"
,
key_event
->
key
()
-
Qt
::
Key_0
);
spinbox
->
style
()
->
unpolish
(
spinbox
);
spinbox
->
style
()
->
polish
(
spinbox
);
}
else
if
(
auto
*
spinbox
=
qobject_cast
<
QDoubleSpinBox
*>
(
object
))
{
spinbox
->
parent
()
->
setProperty
(
"ini_value"
,
key_event
->
key
()
-
Qt
::
Key_0
);
spinbox
->
style
()
->
unpolish
(
spinbox
);
spinbox
->
style
()
->
polish
(
spinbox
);
if
(
auto
*
spinbox
1
=
qobject_cast
<
QSpinBox
*>
(
object
))
{
//try both types
spinbox
1
->
parent
()
->
setProperty
(
"ini_value"
,
key_event
->
key
()
-
Qt
::
Key_0
);
spinbox
1
->
style
()
->
unpolish
(
spinbox
1
);
spinbox
1
->
style
()
->
polish
(
spinbox
1
);
}
else
if
(
auto
*
spinbox
2
=
qobject_cast
<
QDoubleSpinBox
*>
(
object
))
{
spinbox
2
->
parent
()
->
setProperty
(
"ini_value"
,
key_event
->
key
()
-
Qt
::
Key_0
);
spinbox
2
->
style
()
->
unpolish
(
spinbox
2
);
spinbox
2
->
style
()
->
polish
(
spinbox
2
);
}
return
true
;
//we have already input the value - prevent 2nd time
}
//endif property
...
...
@@ -207,22 +207,22 @@ void Number::setDefaultPanelStyles(const QString &in_value)
void
Number
::
clear
(
const
bool
&
set_default
)
{
QString
def_number_val
;
if
(
auto
*
spinbox
=
qobject_cast
<
QSpinBox
*>
(
number_element_
))
{
if
(
spinbox
->
minimum
()
>
0
)
def_number_val
=
QString
::
number
(
spinbox
->
minimum
());
else
if
(
spinbox
->
maximum
()
<
0
)
def_number_val
=
QString
::
number
(
spinbox
->
maximum
());
if
(
auto
*
spinbox
1
=
qobject_cast
<
QSpinBox
*>
(
number_element_
))
{
if
(
spinbox
1
->
minimum
()
>
0
)
def_number_val
=
QString
::
number
(
spinbox
1
->
minimum
());
else
if
(
spinbox
1
->
maximum
()
<
0
)
def_number_val
=
QString
::
number
(
spinbox
1
->
maximum
());
else
def_number_val
=
"0"
;
spinbox
->
setValue
(
def_number_val
.
toInt
());
}
else
if
(
auto
*
spinbox
=
qobject_cast
<
QDoubleSpinBox
*>
(
number_element_
))
{
if
(
spinbox
->
minimum
()
>
0
)
def_number_val
=
QString
::
number
(
spinbox
->
minimum
());
else
if
(
spinbox
->
maximum
()
<
0
)
def_number_val
=
QString
::
number
(
spinbox
->
maximum
());
spinbox
1
->
setValue
(
def_number_val
.
toInt
());
}
else
if
(
auto
*
spinbox
2
=
qobject_cast
<
QDoubleSpinBox
*>
(
number_element_
))
{
if
(
spinbox
2
->
minimum
()
>
0
)
def_number_val
=
QString
::
number
(
spinbox
2
->
minimum
());
else
if
(
spinbox
2
->
maximum
()
<
0
)
def_number_val
=
QString
::
number
(
spinbox
2
->
maximum
());
else
def_number_val
=
"0"
;
spinbox
->
setValue
(
def_number_val
.
toDouble
());
spinbox
2
->
setValue
(
def_number_val
.
toDouble
());
}
expression_element_
->
setText
(
QString
());
...
...
@@ -464,7 +464,7 @@ void Number::onPropertySet()
return
;
}
if
(
auto
*
spinbox
=
qobject_cast
<
QSpinBox
*>
(
number_element_
))
{
//integer
if
(
auto
*
spinbox
1
=
qobject_cast
<
QSpinBox
*>
(
number_element_
))
{
//integer
bool
convert_success
;
int
ival
=
str_value
.
toInt
(
&
convert_success
);
if
(
!
convert_success
)
{
//could also stem from XML, but let's not clutter the message for users
...
...
@@ -473,17 +473,17 @@ void Number::onPropertySet()
topStatus
(
tr
(
"Invalid numeric INI value"
),
"warning"
);
return
;
}
if
(
ival
<
spinbox
->
minimum
()
||
ival
>
spinbox
->
maximum
())
{
if
(
ival
<
spinbox
1
->
minimum
()
||
ival
>
spinbox
1
->
maximum
())
{
topLog
(
tr
(
R"(Integer INI value out of range for key "%1::%2" - truncated)"
).
arg
(
section_
,
key_
),
"warning"
);
topStatus
(
tr
(
"Truncated numeric INI value"
),
"warning"
);
}
spinbox
->
setValue
(
str_value
.
toInt
());
if
(
ival
==
spinbox
->
minimum
())
{
spinbox
1
->
setValue
(
str_value
.
toInt
());
if
(
ival
==
spinbox
1
->
minimum
())
{
emit
checkValue
(
ival
);
//if the default isn't changed from zero then nothing would be emitted
QTimer
::
singleShot
(
1
,
this
,
[
=
]{
setEmpty
(
false
);
});
//avoid keeping empty style when default val is minimum spinbox val
QTimer
::
singleShot
(
1
,
this
,
[
=
]{
setEmpty
(
false
);
});
//avoid keeping empty style when default val is minimum spinbox
1
val
}
}
else
if
(
auto
*
spinbox
=
qobject_cast
<
QDoubleSpinBox
*>
(
number_element_
))
{
//floating point
}
else
if
(
auto
*
spinbox
2
=
qobject_cast
<
QDoubleSpinBox
*>
(
number_element_
))
{
//floating point
bool
convert_success
;
double
dval
=
str_value
.
toDouble
(
&
convert_success
);
if
(
!
convert_success
)
{
...
...
@@ -492,7 +492,7 @@ void Number::onPropertySet()
topStatus
(
tr
(
"Invalid numeric INI value"
),
"warning"
);
return
;
}
if
(
dval
<
spinbox
->
minimum
()
||
dval
>
spinbox
->
maximum
())
{
if
(
dval
<
spinbox
2
->
minimum
()
||
dval
>
spinbox
2
->
maximum
())
{
topLog
(
tr
(
R"(Double INI value out of range for key "%1::%2" - truncated)"
).
arg
(
section_
,
key_
),
"warning"
);
topStatus
(
tr
(
"Truncated numeric INI value"
),
"warning"
);
...
...
@@ -500,22 +500,22 @@ void Number::onPropertySet()
const
int
ini_precision
=
getPrecisionOfNumber
(
str_value
);
//read number of decimal in INI
//this also enables to overwrite in expression mode; no default in XML --> use smaller ones too:
if
(
ini_precision
>
spinbox
->
decimals
())
{
if
(
ini_precision
>
spinbox
2
->
decimals
())
{
precision_
=
ini_precision
;
spinbox
->
setDecimals
(
precision_
);
spinbox
2
->
setDecimals
(
precision_
);
}
//allow to switch back to a smaller number of digits for new INI files:
if
(
spinbox
->
decimals
()
>
std
::
max
(
ini_precision
,
default_precision_
))
{
if
(
spinbox
2
->
decimals
()
>
std
::
max
(
ini_precision
,
default_precision_
))
{
precision_
=
std
::
max
(
ini_precision
,
default_precision_
);
if
(
precision_
==
0
)
precision_
=
1
;
//force at least 1 digit
spinbox
->
setDecimals
(
precision_
);
spinbox
2
->
setDecimals
(
precision_
);
}
spinbox
->
setValue
(
str_value
.
toDouble
());
spinbox
->
setDecimals
(
precision_
);
//needs to be re-set every time
spinbox
2
->
setValue
(
str_value
.
toDouble
());
spinbox
2
->
setDecimals
(
precision_
);
//needs to be re-set every time
if
(
qFuzzyCompare
(
dval
,
spinbox
->
minimum
()))
{
//fuzzy against warnings
if
(
qFuzzyCompare
(
dval
,
spinbox
2
->
minimum
()))
{
//fuzzy against warnings
emit
checkValue
(
dval
);
//cf. above
QTimer
::
singleShot
(
1
,
this
,
[
=
]{
setEmpty
(
false
);
});
}
...
...
src/panels/Textfield.cc
View file @
116d1f77
...
...
@@ -61,7 +61,7 @@ Textfield::Textfield(const QString §ion, const QString &key, const QDomNode
validity_button_
=
new
QToolButton
;
//a button that can pop up if the text has a certain format
validity_button_
->
setStyleSheet
(
"* {border: none}"
);
QSize
sz_label
;
sz_label
.
setWidth
(
static_cast
<
int
>
(
fontMetrics
().
boundingRect
(
Cst
::
u_globe
).
width
()
)
*
1.2
);
sz_label
.
setWidth
(
static_cast
<
int
>
(
fontMetrics
().
boundingRect
(
Cst
::
u_globe
).
width
()
*
1.2
)
)
;
sz_label
.
setHeight
(
static_cast
<
int
>
(
fontMetrics
().
boundingRect
(
Cst
::
u_globe
).
height
()));
validity_button_
->
setFixedSize
(
sz_label
);
validity_button_
->
setFocusPolicy
(
Qt
::
NoFocus
);
//unexpected tab stops when invisible otherwise
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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