Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
2f7ee5d5
Commit
2f7ee5d5
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
add settings for default unit (angstrom/nanometer)
parent
ae7af93b
No related branches found
No related tags found
1 merge request
!415
Unit handling in layer oriented sample editor
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Application/ApplicationSettings.cpp
+11
-0
11 additions, 0 deletions
GUI/Application/ApplicationSettings.cpp
GUI/Application/ApplicationSettings.h
+3
-0
3 additions, 0 deletions
GUI/Application/ApplicationSettings.h
GUI/mainwindow/actionmanager.cpp
+14
-0
14 additions, 0 deletions
GUI/mainwindow/actionmanager.cpp
with
28 additions
and
0 deletions
GUI/Application/ApplicationSettings.cpp
+
11
−
0
View file @
2f7ee5d5
...
...
@@ -25,6 +25,7 @@ const QString S_POS = "Pos";
const
QString
S_DEFAULT_FUNCTIONALITIES
=
"DefaultFunctionalities"
;
const
QString
S_SINGLE_INSTRUMENT_MODE
=
"SingleInstrumentMode"
;
const
QString
S_SINGLE_SAMPLE_MODE
=
"SingleSampleMode"
;
const
QString
S_DEFAULT_UNIT_IS_ANGSTROM
=
"DefaultUnitIsAngstrom"
;
}
// namespace
bool
ApplicationSettings
::
useNativeFileDialog
()
const
...
...
@@ -86,6 +87,16 @@ void ApplicationSettings::setDefaultIsSingleSampleMode(bool b)
QSettings
().
setValue
(
S_SINGLE_SAMPLE_MODE
,
b
);
}
bool
ApplicationSettings
::
defaultUnitIsAngstrom
()
const
{
return
QSettings
().
value
(
S_DEFAULT_UNIT_IS_ANGSTROM
,
false
).
toBool
();
}
void
ApplicationSettings
::
setDefaultUnitIsAngstrom
(
bool
b
)
const
{
QSettings
().
setValue
(
S_DEFAULT_UNIT_IS_ANGSTROM
,
b
);
}
void
ApplicationSettings
::
saveWindowSizeAndPos
(
const
QWidget
*
w
)
{
ASSERT
(
!
w
->
objectName
().
isEmpty
());
...
...
This diff is collapsed.
Click to expand it.
GUI/Application/ApplicationSettings.h
+
3
−
0
View file @
2f7ee5d5
...
...
@@ -41,6 +41,9 @@ public:
bool
defaultIsSingleSampleMode
()
const
;
void
setDefaultIsSingleSampleMode
(
bool
b
);
bool
defaultUnitIsAngstrom
()
const
;
void
setDefaultUnitIsAngstrom
(
bool
b
)
const
;
void
saveWindowSizeAndPos
(
const
QWidget
*
w
);
void
loadWindowSizeAndPos
(
QWidget
*
w
);
};
...
...
This diff is collapsed.
Click to expand it.
GUI/mainwindow/actionmanager.cpp
+
14
−
0
View file @
2f7ee5d5
...
...
@@ -254,6 +254,20 @@ void ActionManager::onAboutToShowSettingsMenu()
m_settingsMenu
->
addSeparator
();
QActionGroup
*
unitActions
=
new
QActionGroup
(
this
);
const
auto
addUnitAction
=
[
=
](
const
QString
&
text
,
bool
isAngstrom
)
{
auto
action
=
m_settingsMenu
->
addAction
(
text
,
[
=
]()
{
baApp
->
settings
().
setDefaultUnitIsAngstrom
(
isAngstrom
);
});
action
->
setCheckable
(
true
);
action
->
setChecked
(
baApp
->
settings
().
defaultUnitIsAngstrom
()
==
isAngstrom
);
unitActions
->
addAction
(
action
);
};
addUnitAction
(
"Use nanometer as default unit"
,
false
);
addUnitAction
(
"Use
\303\205
ngstrom as default unit"
,
true
);
m_settingsMenu
->
addSeparator
();
QActionGroup
*
styleActions
=
new
QActionGroup
(
this
);
const
auto
addStyleAction
=
[
=
](
const
QString
&
text
,
ApplicationSettings
::
Style
style
)
{
auto
action
=
m_settingsMenu
->
addAction
(
text
,
[
=
]()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment