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
229b2c31
Commit
229b2c31
authored
8 months ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
merge init fcts
parent
0bfaf747
No related branches found
No related tags found
1 merge request
!2633
merge fcts, rm unused fcts, etc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/View/Main/CentralWidget.cpp
+34
-49
34 additions, 49 deletions
GUI/View/Main/CentralWidget.cpp
GUI/View/Main/CentralWidget.h
+0
-4
0 additions, 4 deletions
GUI/View/Main/CentralWidget.h
with
34 additions
and
53 deletions
GUI/View/Main/CentralWidget.cpp
+
34
−
49
View file @
229b2c31
...
...
@@ -63,43 +63,12 @@ CentralWidget::CentralWidget()
layout
->
addLayout
(
m_view_selection_buttons_layout
);
layout
->
addLayout
(
vlayout
);
initProgressBar
();
initButtons
();
initViews
();
}
CentralWidget
::~
CentralWidget
()
=
default
;
QWidget
*
CentralWidget
::
currentView
()
const
{
return
m_views_stack
->
currentWidget
();
}
void
CentralWidget
::
setCurrentView
(
int
viewId
)
{
if
(
auto
*
btn
=
m_view_selection_buttons
->
button
(
viewId
);
btn
!=
nullptr
)
btn
->
click
();
}
void
CentralWidget
::
raiseView
(
int
viewId
)
{
if
(
m_views_stack
->
currentIndex
()
!=
viewId
)
{
m_views_stack
->
setCurrentIndex
(
viewId
);
emit
currentViewChanged
(
GUI
::
ID
::
ViewId
(
viewId
));
}
}
void
CentralWidget
::
initProgressBar
()
{
m_progress_bar
->
hide
();
m_progress_bar
->
setTextVisible
(
false
);
m_progress_bar
->
setFixedHeight
(
QApplication
::
fontMetrics
().
boundingRect
(
"M"
).
height
());
m_progress_bar
->
setSizePolicy
(
QSizePolicy
::
Ignored
,
QSizePolicy
::
Fixed
);
m_view_selection_buttons_layout
->
addWidget
(
m_progress_bar
);
}
void
CentralWidget
::
initButtons
()
{
addButton
(
GUI
::
ID
::
ViewId
::
Datafile
,
QIcon
(
":/images/view/data.svg"
),
"Data"
,
"Import intensity data to fit"
);
addButton
(
GUI
::
ID
::
ViewId
::
Instrument
,
QIcon
(
":/images/view/instrument.svg"
),
"Instrument"
,
...
...
@@ -113,24 +82,6 @@ void CentralWidget::initButtons()
for
(
auto
*
button
:
m_view_selection_buttons
->
buttons
())
button
->
setEnabled
(
false
);
}
void
CentralWidget
::
updateViews
(
bool
open
)
{
if
(
!
open
)
return
;
for
(
auto
*
button
:
m_view_selection_buttons
->
buttons
())
button
->
setEnabled
(
true
);
auto
*
filler
=
m_view_selection_buttons_layout
->
itemAt
(
m_view_selection_buttons
->
buttons
().
size
());
if
(
filler
)
if
(
auto
*
fillerBtn
=
dynamic_cast
<
QToolButton
*>
(
filler
->
widget
());
fillerBtn
)
fillerBtn
->
setEnabled
(
true
);
}
void
CentralWidget
::
initViews
()
{
ASSERT
(
gDoc
);
m_instrument_view
=
new
InstrumentView
;
m_sample_view
=
new
SampleView
;
...
...
@@ -150,6 +101,40 @@ void CentralWidget::initViews()
m_job_view
->
onJobSelectionChanged
();
}
CentralWidget
::~
CentralWidget
()
=
default
;
QWidget
*
CentralWidget
::
currentView
()
const
{
return
m_views_stack
->
currentWidget
();
}
void
CentralWidget
::
setCurrentView
(
int
viewId
)
{
if
(
auto
*
btn
=
m_view_selection_buttons
->
button
(
viewId
);
btn
!=
nullptr
)
btn
->
click
();
}
void
CentralWidget
::
raiseView
(
int
viewId
)
{
if
(
m_views_stack
->
currentIndex
()
!=
viewId
)
{
m_views_stack
->
setCurrentIndex
(
viewId
);
emit
currentViewChanged
(
GUI
::
ID
::
ViewId
(
viewId
));
}
}
void
CentralWidget
::
updateViews
(
bool
open
)
{
if
(
!
open
)
return
;
for
(
auto
*
button
:
m_view_selection_buttons
->
buttons
())
button
->
setEnabled
(
true
);
auto
*
filler
=
m_view_selection_buttons_layout
->
itemAt
(
m_view_selection_buttons
->
buttons
().
size
());
if
(
filler
)
if
(
auto
*
fillerBtn
=
dynamic_cast
<
QToolButton
*>
(
filler
->
widget
());
fillerBtn
)
fillerBtn
->
setEnabled
(
true
);
}
void
CentralWidget
::
addButton
(
GUI
::
ID
::
ViewId
id
,
const
QIcon
&
icon
,
const
QString
&
title
,
const
QString
&
tooltip
)
{
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Main/CentralWidget.h
+
0
−
4
View file @
229b2c31
...
...
@@ -49,10 +49,6 @@ signals:
void
currentViewChanged
(
GUI
::
ID
::
ViewId
newView
);
private
:
void
initProgressBar
();
void
initButtons
();
void
initViews
();
void
addButton
(
GUI
::
ID
::
ViewId
id
,
const
QIcon
&
icon
,
const
QString
&
title
,
const
QString
&
tooltip
);
QToolButton
*
createViewSelectionButton
()
const
;
...
...
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