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
ff9c308e
Commit
ff9c308e
authored
3 years ago
by
Wuttke, Joachim
Committed by
Wuttke, Joachim
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
AppOptions: exit after -h or -v
parent
7a37f981
No related branches found
No related tags found
1 merge request
!705
GUI/App/main, file paths: various improvements
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
App/AppOptions.cpp
+7
-11
7 additions, 11 deletions
App/AppOptions.cpp
App/AppOptions.h
+0
-2
0 additions, 2 deletions
App/AppOptions.h
with
7 additions
and
13 deletions
App/AppOptions.cpp
+
7
−
11
View file @
ff9c308e
...
@@ -48,7 +48,8 @@ bool isValid(const QSize& win_size)
...
@@ -48,7 +48,8 @@ bool isValid(const QSize& win_size)
ApplicationOptions
::
ApplicationOptions
(
int
argc
,
char
**
argv
)
ApplicationOptions
::
ApplicationOptions
(
int
argc
,
char
**
argv
)
:
m_options_is_consistent
(
false
)
:
m_options_is_consistent
(
false
)
{
{
m_options
.
add_options
()(
"help,h"
,
"print help message"
);
m_options
.
add_options
()(
"help,h"
,
"print help message and exit"
);
m_options
.
add_options
()(
"version,v"
,
"print version and exit"
);
m_options
.
add_options
()(
"with-debug"
,
"run application with debug printout"
);
m_options
.
add_options
()(
"with-debug"
,
"run application with debug printout"
);
m_options
.
add_options
()(
geometry
,
bpo
::
value
<
std
::
string
>
(),
m_options
.
add_options
()(
geometry
,
bpo
::
value
<
std
::
string
>
(),
"Main window geometry, e.g. 1600x1000"
);
"Main window geometry, e.g. 1600x1000"
);
...
@@ -68,7 +69,7 @@ const bpo::variable_value& ApplicationOptions::operator[](const std::string& s)
...
@@ -68,7 +69,7 @@ const bpo::variable_value& ApplicationOptions::operator[](const std::string& s)
bool
ApplicationOptions
::
find
(
std
::
string
name
)
const
bool
ApplicationOptions
::
find
(
std
::
string
name
)
const
{
{
return
(
m_variables_map
.
count
(
name
)
)
;
return
m_variables_map
.
count
(
name
);
}
}
bool
ApplicationOptions
::
isConsistent
()
const
bool
ApplicationOptions
::
isConsistent
()
const
...
@@ -117,14 +118,15 @@ boost::program_options::options_description& ApplicationOptions::getOptions()
...
@@ -117,14 +118,15 @@ boost::program_options::options_description& ApplicationOptions::getOptions()
void
ApplicationOptions
::
processOptions
()
void
ApplicationOptions
::
processOptions
()
{
{
if
(
m_variables_map
.
count
(
"help"
))
{
if
(
m_variables_map
.
count
(
"help"
))
{
printHelpMessage
();
std
::
cout
<<
"BornAgain Graphical User Interface"
<<
std
::
endl
;
m_options_is_consistent
=
false
;
std
::
cout
<<
m_options
<<
std
::
endl
;
exit
(
0
);
}
}
else
if
(
m_variables_map
.
count
(
"version"
))
{
else
if
(
m_variables_map
.
count
(
"version"
))
{
std
::
cout
<<
"BornAgain-"
<<
GUI
::
Util
::
Path
::
getBornAgainVersionString
().
toStdString
()
std
::
cout
<<
"BornAgain-"
<<
GUI
::
Util
::
Path
::
getBornAgainVersionString
().
toStdString
()
<<
std
::
endl
;
<<
std
::
endl
;
m_options_is_consistent
=
false
;
exit
(
0
)
;
}
}
else
if
(
m_variables_map
.
count
(
geometry
))
{
else
if
(
m_variables_map
.
count
(
geometry
))
{
...
@@ -135,12 +137,6 @@ void ApplicationOptions::processOptions()
...
@@ -135,12 +137,6 @@ void ApplicationOptions::processOptions()
}
}
}
}
void
ApplicationOptions
::
printHelpMessage
()
const
{
std
::
cout
<<
"BornAgain Graphical User Interface"
<<
std
::
endl
;
std
::
cout
<<
m_options
<<
std
::
endl
;
}
QSize
ApplicationOptions
::
mainWindowSize
()
const
QSize
ApplicationOptions
::
mainWindowSize
()
const
{
{
QString
size_str
=
QString
::
fromStdString
(
m_variables_map
[
geometry
].
as
<
std
::
string
>
());
QString
size_str
=
QString
::
fromStdString
(
m_variables_map
[
geometry
].
as
<
std
::
string
>
());
...
...
This diff is collapsed.
Click to expand it.
App/AppOptions.h
+
0
−
2
View file @
ff9c308e
...
@@ -46,8 +46,6 @@ public:
...
@@ -46,8 +46,6 @@ public:
bool
find
(
std
::
string
name
)
const
;
bool
find
(
std
::
string
name
)
const
;
private:
private:
void
printHelpMessage
()
const
;
//! Parses command line arguments
//! Parses command line arguments
void
parseCommandLine
(
int
argc
,
char
**
argv
);
void
parseCommandLine
(
int
argc
,
char
**
argv
);
...
...
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