Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Telemetry
KUserFeedback
Commits
edd772f4
Commit
edd772f4
authored
Feb 10, 2017
by
Volker Krause
Browse files
Add chart mode selection actions
parent
97f7cea1
Changes
2
Hide whitespace changes
Inline
Side-by-side
analyzer/analytics/analyticsview.cpp
View file @
edd772f4
...
...
@@ -76,12 +76,21 @@ AnalyticsView::AnalyticsView(QWidget* parent) :
timeAggrMenu
->
addAction
(
ui
->
actionAggregateMonth
);
timeAggrMenu
->
addAction
(
ui
->
actionAggregateYear
);
auto
chartModeGroup
=
new
QActionGroup
(
this
);
chartModeGroup
->
addAction
(
ui
->
actionSingularChart
);
chartModeGroup
->
addAction
(
ui
->
actionTimelineChart
);
auto
chartMode
=
new
QMenu
(
tr
(
"&Char mode"
),
this
);
chartMode
->
addAction
(
ui
->
actionSingularChart
);
chartMode
->
addAction
(
ui
->
actionTimelineChart
);
connect
(
ui
->
actionReload
,
&
QAction
::
triggered
,
m_dataModel
,
&
DataModel
::
reload
);
connect
(
ui
->
actionExportData
,
&
QAction
::
triggered
,
this
,
&
AnalyticsView
::
exportData
);
connect
(
ui
->
actionImportData
,
&
QAction
::
triggered
,
this
,
&
AnalyticsView
::
importData
);
addActions
({
timeAggrMenu
->
menuAction
(),
chartMode
->
menuAction
(),
ui
->
actionReload
,
ui
->
actionExportData
,
ui
->
actionImportData
...
...
@@ -124,7 +133,7 @@ void AnalyticsView::setProduct(const Product& product)
m_aggregationModels
.
clear
();
m_aggregatedDataModel
->
addSourceModel
(
m_timeAggregationModel
);
ui
->
chartType
->
addItem
(
tr
(
"Samples"
)
,
QVariant
::
fromValue
(
m_timeAggregationModel
)
);
ui
->
chartType
->
addItem
(
tr
(
"Samples"
));
qDeleteAll
(
m_aggregators
);
m_aggregators
.
clear
();
...
...
@@ -136,22 +145,28 @@ void AnalyticsView::setProduct(const Product& product)
m_aggregators
.
push_back
(
aggregator
);
if
(
auto
model
=
aggregator
->
timeAggregationModel
())
{
m_aggregatedDataModel
->
addSourceModel
(
model
,
aggregator
->
displayName
());
// ### temporary
ui
->
chartType
->
addItem
(
aggregator
->
displayName
(),
QVariant
::
fromValue
(
model
));
}
//
if (aggregator->chartModes() != Aggregator::None)
//
ui->chartType->addItem(aggregator->displayName(), QVariant::fromValue(aggregator));
if
(
aggregator
->
chartModes
()
!=
Aggregator
::
None
)
ui
->
chartType
->
addItem
(
aggregator
->
displayName
(),
QVariant
::
fromValue
(
aggregator
));
}
}
void
AnalyticsView
::
chartSelected
()
{
const
auto
model
=
ui
->
chartType
->
currentData
().
value
<
QAbstractItemModel
*>
();
m_chart
->
setModel
(
model
);
auto
aggr
=
ui
->
chartType
->
currentData
().
value
<
Aggregator
*>
();
const
auto
chartMode
=
aggr
?
aggr
->
chartModes
()
:
Aggregator
::
Timeline
;
ui
->
actionSingularChart
->
setEnabled
(
chartMode
&
Aggregator
::
Singular
);
ui
->
actionTimelineChart
->
setEnabled
(
chartMode
&
Aggregator
::
Timeline
);
if
(
chartMode
!=
(
Aggregator
::
Timeline
|
Aggregator
::
Singular
))
{
ui
->
actionSingularChart
->
setChecked
(
chartMode
&
Aggregator
::
Singular
);
ui
->
actionTimelineChart
->
setChecked
(
chartMode
&
Aggregator
::
Timeline
);
}
if
(
!
aggr
)
return
;
m_chart
->
setModel
(
m_timeAggregationModel
);
else
m_chart
->
setModel
(
aggr
->
timeAggregationModel
());
// ui->chartView->setChart(aggr->timelineChart());
}
...
...
analyzer/analytics/analyticsview.ui
View file @
edd772f4
...
...
@@ -159,6 +159,28 @@
<string>
Refresh data from the server.
</string>
</property>
</action>
<action
name=
"actionTimelineChart"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
&
Timeline Chart
</string>
</property>
<property
name=
"toolTip"
>
<string>
Show development over time.
</string>
</property>
</action>
<action
name=
"actionSingularChart"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
&
Singular Chart
</string>
</property>
<property
name=
"toolTip"
>
<string>
Show chart for a single time interval.
</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment