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
f098a08a
Commit
f098a08a
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
refactor
parent
f2e780ac
No related branches found
No related tags found
1 merge request
!304
Add instrument library
Pipeline
#44233
passed
3 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Application/Application.cpp
+11
-0
11 additions, 0 deletions
GUI/Application/Application.cpp
GUI/Application/Application.h
+7
-0
7 additions, 0 deletions
GUI/Application/Application.h
GUI/main/main.cpp
+4
-10
4 additions, 10 deletions
GUI/main/main.cpp
with
22 additions
and
10 deletions
GUI/Application/Application.cpp
+
11
−
0
View file @
f098a08a
...
...
@@ -17,6 +17,7 @@
#include
"GUI/utils/hostosinfo.h"
#include
<QFile>
#include
<QIcon>
#include
<QStandardPaths>
Application
::
Application
(
int
&
argc
,
char
**
argv
)
:
QApplication
(
argc
,
argv
),
m_currentStyle
(
ApplicationSettings
::
Style
::
native
)
...
...
@@ -100,3 +101,13 @@ InstrumentLibrary& Application::instrumentLibrary()
{
return
m_instrumentLibrary
;
}
QString
Application
::
instrumentLibraryFilePath
()
const
{
return
appDataFolder
()
+
"/BornAgainInstrumentLibrary.balib"
;
}
QString
Application
::
appDataFolder
()
const
{
return
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppDataLocation
);
}
This diff is collapsed.
Click to expand it.
GUI/Application/Application.h
+
7
−
0
View file @
f098a08a
...
...
@@ -40,6 +40,13 @@ public:
InstrumentLibrary
&
instrumentLibrary
();
QString
instrumentLibraryFilePath
()
const
;
//! The folder where persistent application data shall be stored. E.g. in Windows this is the
//! AppData/Roaming location.
//! Used e.g. for storing the instrument library.
QString
appDataFolder
()
const
;
private
:
ApplicationSettings
m_settings
;
InstrumentLibrary
m_instrumentLibrary
;
...
...
This diff is collapsed.
Click to expand it.
GUI/main/main.cpp
+
4
−
10
View file @
f098a08a
...
...
@@ -20,7 +20,6 @@
#include
<QDir>
#include
<QLocale>
#include
<QMetaType>
#include
<QStandardPaths>
void
messageHandler
(
QtMsgType
,
const
QMessageLogContext
&
,
const
QString
&
)
{}
...
...
@@ -44,15 +43,10 @@ int main(int argc, char* argv[])
app
.
loadStyle
(
app
.
settings
().
styleToUse
());
const
QString
folderForInstrumentLibrary
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppDataLocation
);
const
QString
filePathForInstrumentLibrary
=
folderForInstrumentLibrary
+
"/BornAgainInstrumentLibrary.balib"
;
if
(
!
QDir
().
exists
(
app
.
appDataFolder
()))
QDir
().
mkpath
(
app
.
appDataFolder
());
if
(
!
QDir
().
exists
(
folderForInstrumentLibrary
))
QDir
().
mkpath
(
folderForInstrumentLibrary
);
app
.
instrumentLibrary
().
load
(
filePathForInstrumentLibrary
);
app
.
instrumentLibrary
().
load
(
app
.
instrumentLibraryFilePath
());
MainWindow
win
;
if
(
options
.
find
(
"geometry"
))
...
...
@@ -62,7 +56,7 @@ int main(int argc, char* argv[])
int
ret
=
QApplication
::
exec
();
app
.
instrumentLibrary
().
saveIfModified
(
filePathForI
nstrumentLibrary
);
app
.
instrumentLibrary
().
saveIfModified
(
app
.
i
nstrumentLibrary
FilePath
()
);
return
ret
;
}
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