Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cuteLib-hsrt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Glaser
cuteLib-hsrt
Commits
6e373dbb
Commit
6e373dbb
authored
2 months ago
by
tobiglaser
Browse files
Options
Downloads
Patches
Plain Diff
changed generate into preview and lock buttons
parent
fbb69029
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/configPanel.cpp
+36
-11
36 additions, 11 deletions
src/configPanel.cpp
src/configPanel.h
+7
-3
7 additions, 3 deletions
src/configPanel.h
src/control.cpp
+25
-12
25 additions, 12 deletions
src/control.cpp
src/control.h
+2
-2
2 additions, 2 deletions
src/control.h
with
70 additions
and
28 deletions
src/configPanel.cpp
+
36
−
11
View file @
6e373dbb
...
@@ -45,9 +45,13 @@ ConfigPanel::ConfigPanel(QWidget* parent) : QDockWidget{parent}
...
@@ -45,9 +45,13 @@ ConfigPanel::ConfigPanel(QWidget* parent) : QDockWidget{parent}
fileLine
=
new
QLineEdit
();
fileLine
=
new
QLineEdit
();
fileLine
->
setPlaceholderText
(
"/path/to/yourFile.csv"
);
fileLine
->
setPlaceholderText
(
"/path/to/yourFile.csv"
);
fileWidget
->
layout
()
->
addWidget
(
fileLine
);
fileWidget
->
layout
()
->
addWidget
(
fileLine
);
fileGenerateButton
=
new
QPushButton
(
"Preview"
);
auto
fileGenerateButton
=
new
QPushButton
(
"Preview"
);
fileLayout
->
addWidget
(
fileGenerateButton
);
fileLayout
->
addWidget
(
fileGenerateButton
);
auto
fileLockButton
=
new
QPushButton
(
"Lock"
);
fileLayout
->
addWidget
(
fileLockButton
);
lockButtons
.
push_back
(
fileLockButton
);
fileLayout
->
addStretch
();
fileLayout
->
addStretch
();
connect
(
fileGenerateButton
,
&
QPushButton
::
clicked
,
this
,
&
ConfigPanel
::
previewButtonClicked
);
connect
(
openButton
,
&
QPushButton
::
clicked
,
this
,
&
ConfigPanel
::
onOpenButton
);
connect
(
openButton
,
&
QPushButton
::
clicked
,
this
,
&
ConfigPanel
::
onOpenButton
);
randomWidget
=
new
QWidget
();
randomWidget
=
new
QWidget
();
...
@@ -58,9 +62,13 @@ ConfigPanel::ConfigPanel(QWidget* parent) : QDockWidget{parent}
...
@@ -58,9 +62,13 @@ ConfigPanel::ConfigPanel(QWidget* parent) : QDockWidget{parent}
randomLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
randomLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
problemSizeBox
=
new
QSpinBox
();
problemSizeBox
=
new
QSpinBox
();
randomLayout
->
addWidget
(
problemSizeBox
);
randomLayout
->
addWidget
(
problemSizeBox
);
randomGenerateButton
=
new
QPushButton
(
"Preview"
);
auto
randomGenerateButton
=
new
QPushButton
(
"Preview"
);
randomLayout
->
addWidget
(
randomGenerateButton
);
randomLayout
->
addWidget
(
randomGenerateButton
);
auto
randomLockButton
=
new
QPushButton
(
"Lock"
);
randomLayout
->
addWidget
(
randomLockButton
);
lockButtons
.
push_back
(
randomLockButton
);
randomLayout
->
addStretch
();
randomLayout
->
addStretch
();
connect
(
randomGenerateButton
,
&
QPushButton
::
clicked
,
this
,
&
ConfigPanel
::
previewButtonClicked
);
problemSizeBox
->
setMinimum
(
1
);
problemSizeBox
->
setMinimum
(
1
);
problemSizeBox
->
setMaximum
(
INT_MAX
);
problemSizeBox
->
setMaximum
(
INT_MAX
);
...
@@ -77,11 +85,20 @@ ConfigPanel::ConfigPanel(QWidget* parent) : QDockWidget{parent}
...
@@ -77,11 +85,20 @@ ConfigPanel::ConfigPanel(QWidget* parent) : QDockWidget{parent}
pasteBox
->
setMinimumHeight
(
25
);
pasteBox
->
setMinimumHeight
(
25
);
pasteBox
->
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Minimum
);
pasteBox
->
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Minimum
);
pasteGenerateButton
=
new
QPushButton
(
"Preview"
);
auto
pasteGenerateButton
=
new
QPushButton
(
"Preview"
);
pasteLayout
->
addWidget
(
pasteGenerateButton
);
pasteLayout
->
addWidget
(
pasteGenerateButton
);
auto
pasteLockButton
=
new
QPushButton
(
"Lock"
);
pasteLayout
->
addWidget
(
pasteLockButton
);
lockButtons
.
push_back
(
pasteLockButton
);
pasteLayout
->
addStretch
();
pasteLayout
->
addStretch
();
connect
(
pasteGenerateButton
,
&
QPushButton
::
clicked
,
this
,
&
ConfigPanel
::
previewButtonClicked
);
stackedWidget
->
setCurrentWidget
(
pasteWidget
);
stackedWidget
->
setCurrentWidget
(
pasteWidget
);
for
(
auto
&&
button
:
lockButtons
)
{
connect
(
button
,
&
QPushButton
::
clicked
,
this
,
lockButtonClicked
);
}
}
}
void
ConfigPanel
::
setRunning
(
bool
running
)
void
ConfigPanel
::
setRunning
(
bool
running
)
...
@@ -100,18 +117,26 @@ void ConfigPanel::setRunning(bool running)
...
@@ -100,18 +117,26 @@ void ConfigPanel::setRunning(bool running)
void
ConfigPanel
::
setGenLocked
()
void
ConfigPanel
::
setGenLocked
()
{
{
randomGenerateButton
->
setEnabled
(
false
);
for
(
auto
&&
button
:
lockButtons
)
randomGenerateButton
->
setText
(
"Generated"
);
{
fileGenerateButton
->
setEnabled
(
false
);
button
->
setText
(
"Unlock"
);
fileGenerateButton
->
setText
(
"Generated"
);
}
problemSizeBox
->
setDisabled
(
true
);
fileLine
->
setDisabled
(
true
);
openButton
->
setDisabled
(
true
);
pasteBox
->
setDisabled
(
true
);
}
}
void
ConfigPanel
::
setGenUnlocked
()
void
ConfigPanel
::
setGenUnlocked
()
{
{
randomGenerateButton
->
setEnabled
(
true
);
for
(
auto
&&
button
:
lockButtons
)
randomGenerateButton
->
setText
(
"Generate"
);
{
fileGenerateButton
->
setEnabled
(
true
);
button
->
setText
(
"Lock"
);
fileGenerateButton
->
setText
(
"Generate"
);
}
problemSizeBox
->
setDisabled
(
false
);
fileLine
->
setDisabled
(
false
);
openButton
->
setDisabled
(
false
);
pasteBox
->
setDisabled
(
false
);
}
}
void
ConfigPanel
::
onOpenButton
()
void
ConfigPanel
::
onOpenButton
()
...
...
This diff is collapsed.
Click to expand it.
src/configPanel.h
+
7
−
3
View file @
6e373dbb
...
@@ -14,12 +14,12 @@ class ConfigPanel : public QDockWidget
...
@@ -14,12 +14,12 @@ class ConfigPanel : public QDockWidget
{
{
Q_OBJECT
Q_OBJECT
private:
std
::
vector
<
QPushButton
*>
lockButtons
;
public:
public:
QPushButton
*
runButton
;
QPushButton
*
runButton
;
QPushButton
*
openButton
;
QPushButton
*
openButton
;
QPushButton
*
randomGenerateButton
;
QPushButton
*
fileGenerateButton
;
QPushButton
*
pasteGenerateButton
;
QLineEdit
*
fileLine
;
QLineEdit
*
fileLine
;
QPlainTextEdit
*
pasteBox
;
QPlainTextEdit
*
pasteBox
;
QComboBox
*
algoBox
;
QComboBox
*
algoBox
;
...
@@ -40,6 +40,10 @@ public slots:
...
@@ -40,6 +40,10 @@ public slots:
void
setRunning
(
bool
running
);
void
setRunning
(
bool
running
);
void
setGenLocked
();
void
setGenLocked
();
void
setGenUnlocked
();
void
setGenUnlocked
();
signals:
void
previewButtonClicked
();
void
lockButtonClicked
();
};
};
#endif // CONFIGPANEL_H
#endif // CONFIGPANEL_H
This diff is collapsed.
Click to expand it.
src/control.cpp
+
25
−
12
View file @
6e373dbb
...
@@ -45,11 +45,8 @@ void Control::makeConnections()
...
@@ -45,11 +45,8 @@ void Control::makeConnections()
connect
(
cc
,
&
CuteControl
::
s_undo
,
this
,
&
Control
::
undo
);
connect
(
cc
,
&
CuteControl
::
s_undo
,
this
,
&
Control
::
undo
);
connect
(
this
,
&
Control
::
endThread
,
cc
,
&
CuteControl
::
end
);
connect
(
this
,
&
Control
::
endThread
,
cc
,
&
CuteControl
::
end
);
connect
(
w
->
configPanel
->
runButton
,
&
QPushButton
::
clicked
,
this
,
&
Control
::
onRunButton
);
connect
(
w
->
configPanel
->
runButton
,
&
QPushButton
::
clicked
,
this
,
&
Control
::
onRunButton
);
connect
(
w
->
configPanel
->
fileGenerateButton
,
&
QPushButton
::
clicked
,
this
,
&
Control
::
onGenerateButton
);
connect
(
w
->
configPanel
,
&
ConfigPanel
::
previewButtonClicked
,
this
,
&
Control
::
onPreviewButton
);
connect
(
w
->
configPanel
->
randomGenerateButton
,
&
QPushButton
::
clicked
,
this
,
&
Control
::
onGenerateButton
);
connect
(
w
->
configPanel
,
&
ConfigPanel
::
lockButtonClicked
,
this
,
&
Control
::
onLockButton
);
connect
(
w
->
configPanel
->
pasteGenerateButton
,
&
QPushButton
::
clicked
,
this
,
&
Control
::
onGenerateButton
);
connect
(
w
->
configPanel
->
fileLine
,
&
QLineEdit
::
textChanged
,
this
,
&
Control
::
onProblemSettingChanged
);
connect
(
w
->
configPanel
->
problemSizeBox
,
&
QSpinBox
::
textChanged
,
this
,
&
Control
::
onProblemSettingChanged
);
connect
(
w
,
&
MainWindow
::
saveProblem
,
this
,
&
Control
::
saveProblem
);
connect
(
w
,
&
MainWindow
::
saveProblem
,
this
,
&
Control
::
saveProblem
);
connect
(
w
->
cm
,
&
ChartMenu
::
s_setPlotScale
,
this
,
&
Control
::
setPlotScale
);
connect
(
w
->
cm
,
&
ChartMenu
::
s_setPlotScale
,
this
,
&
Control
::
setPlotScale
);
connect
(
cc
,
&
CuteControl
::
s_verbosityChanged
,
w
,
&
MainWindow
::
changeVerbosity
);
connect
(
cc
,
&
CuteControl
::
s_verbosityChanged
,
w
,
&
MainWindow
::
changeVerbosity
);
...
@@ -306,17 +303,29 @@ void Control::generateProblem()
...
@@ -306,17 +303,29 @@ void Control::generateProblem()
}
}
}
}
void
Control
::
on
Generate
Button
()
void
Control
::
on
Preview
Button
()
{
{
generateProblem
();
if
(
!
threadRunning
)
problemRetained
=
true
;
{
w
->
configPanel
->
setGenLocked
();
resetPlot
(
0
);
CuteControl
::
get
().
plotPoints
(
getProblem
(),
0
,
{});
}
}
}
void
Control
::
on
ProblemSettingChanged
([[
maybe_unused
]]
const
QString
&
text
)
void
Control
::
on
LockButton
(
)
{
{
problemRetained
=
false
;
if
(
problemRetained
)
w
->
configPanel
->
setGenUnlocked
();
{
problemRetained
=
false
;
w
->
configPanel
->
setGenUnlocked
();
}
else
{
if
(
problem
.
empty
())
generateProblem
();
problemRetained
=
true
;
w
->
configPanel
->
setGenLocked
();
}
}
}
void
Control
::
plotXYSeries
(
QtCharts
::
QXYSeries
*
s
,
int
plot
,
bool
onTop
,
bool
legend
,
QString
tooltip
)
void
Control
::
plotXYSeries
(
QtCharts
::
QXYSeries
*
s
,
int
plot
,
bool
onTop
,
bool
legend
,
QString
tooltip
)
...
@@ -578,6 +587,8 @@ void Control::redrawOnTopSeries(int plot)
...
@@ -578,6 +587,8 @@ void Control::redrawOnTopSeries(int plot)
{
{
for
(
auto
s
:
onTopSeries
[
plot
])
for
(
auto
s
:
onTopSeries
[
plot
])
{
{
QtCharts
::
QLegendMarker
*
legendMarker
=
w
->
charts
[
plot
]
->
legend
()
->
markers
(
s
)[
0
];
bool
legendVisible
=
legendMarker
->
isVisible
();
w
->
charts
[
plot
]
->
removeSeries
(
s
);
w
->
charts
[
plot
]
->
removeSeries
(
s
);
w
->
charts
[
plot
]
->
addSeries
(
s
);
w
->
charts
[
plot
]
->
addSeries
(
s
);
auto
axes
=
w
->
charts
[
plot
]
->
axes
();
auto
axes
=
w
->
charts
[
plot
]
->
axes
();
...
@@ -585,6 +596,8 @@ void Control::redrawOnTopSeries(int plot)
...
@@ -585,6 +596,8 @@ void Control::redrawOnTopSeries(int plot)
{
{
s
->
attachAxis
(
axis
);
s
->
attachAxis
(
axis
);
}
}
legendMarker
=
w
->
charts
[
plot
]
->
legend
()
->
markers
(
s
)[
0
];
legendMarker
->
setVisible
(
legendVisible
);
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
src/control.h
+
2
−
2
View file @
6e373dbb
...
@@ -56,10 +56,10 @@ public slots:
...
@@ -56,10 +56,10 @@ public slots:
void
setAxisTitles
(
int
plot
,
QString
x
,
QString
y
);
void
setAxisTitles
(
int
plot
,
QString
x
,
QString
y
);
void
setAxisVisible
(
int
plot
,
bool
x
,
bool
y
);
void
setAxisVisible
(
int
plot
,
bool
x
,
bool
y
);
void
onRunButton
();
void
onRunButton
();
void
on
Generate
Button
();
void
on
Preview
Button
();
void
setProblemSize
(
int
n
);
void
setProblemSize
(
int
n
);
void
setProblemFile
(
QString
path
);
void
setProblemFile
(
QString
path
);
void
on
ProblemSettingChanged
(
const
QString
&
text
);
void
on
LockButton
(
);
void
plotXYSeries
(
QtCharts
::
QXYSeries
*
s
,
int
plot
,
bool
onTop
,
bool
legend
,
QString
tooltip
=
""
);
void
plotXYSeries
(
QtCharts
::
QXYSeries
*
s
,
int
plot
,
bool
onTop
,
bool
legend
,
QString
tooltip
=
""
);
void
plotBarSeries
(
QtCharts
::
QBarSeries
*
series
,
int
plot
,
bool
onTop
,
bool
legend
);
void
plotBarSeries
(
QtCharts
::
QBarSeries
*
series
,
int
plot
,
bool
onTop
,
bool
legend
);
void
highlightValue
(
float
value
,
int
plot
,
QColor
c
);
void
highlightValue
(
float
value
,
int
plot
,
QColor
c
);
...
...
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