mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
statistics: add sort mode on mobile UI
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1e5191e33e
commit
db0f8ba045
3 changed files with 43 additions and 6 deletions
|
@ -108,7 +108,7 @@ Kirigami.Page {
|
||||||
TemplateSlimComboBox {
|
TemplateSlimComboBox {
|
||||||
id: var1
|
id: var1
|
||||||
model: statsManager.var1List
|
model: statsManager.var1List
|
||||||
currentIndex: statsManager.var1Index;
|
currentIndex: statsManager.var1Index
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
statsManager.var1Changed(currentIndex)
|
statsManager.var1Changed(currentIndex)
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ Kirigami.Page {
|
||||||
TemplateSlimComboBox {
|
TemplateSlimComboBox {
|
||||||
id: var1Binner
|
id: var1Binner
|
||||||
model: statsManager.binner1List
|
model: statsManager.binner1List
|
||||||
currentIndex: statsManager.binner1Index;
|
currentIndex: statsManager.binner1Index
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
statsManager.var1BinnerChanged(currentIndex)
|
statsManager.var1BinnerChanged(currentIndex)
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ Kirigami.Page {
|
||||||
TemplateSlimComboBox {
|
TemplateSlimComboBox {
|
||||||
id: var2
|
id: var2
|
||||||
model: statsManager.var2List
|
model: statsManager.var2List
|
||||||
currentIndex: statsManager.var2Index;
|
currentIndex: statsManager.var2Index
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
statsManager.var2Changed(currentIndex)
|
statsManager.var2Changed(currentIndex)
|
||||||
|
@ -160,7 +160,7 @@ Kirigami.Page {
|
||||||
TemplateSlimComboBox {
|
TemplateSlimComboBox {
|
||||||
id: var2Binner
|
id: var2Binner
|
||||||
model: statsManager.binner2List
|
model: statsManager.binner2List
|
||||||
currentIndex: statsManager.binner2Index;
|
currentIndex: statsManager.binner2Index
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
statsManager.var2BinnerChanged(currentIndex)
|
statsManager.var2BinnerChanged(currentIndex)
|
||||||
|
@ -178,13 +178,31 @@ Kirigami.Page {
|
||||||
TemplateSlimComboBox {
|
TemplateSlimComboBox {
|
||||||
id: var2Operation
|
id: var2Operation
|
||||||
model: statsManager.operation2List
|
model: statsManager.operation2List
|
||||||
currentIndex: statsManager.operation2Index;
|
currentIndex: statsManager.operation2Index
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
statsManager.var2OperationChanged(currentIndex)
|
statsManager.var2OperationChanged(currentIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ColumnLayout {
|
||||||
|
id: i6
|
||||||
|
Layout.column: wide ? 0 : 0
|
||||||
|
Layout.row: wide ? 6 : 3
|
||||||
|
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||||
|
TemplateLabelSmall {
|
||||||
|
text: qsTr("SortMode")
|
||||||
|
}
|
||||||
|
TemplateSlimComboBox {
|
||||||
|
id: sortMode1
|
||||||
|
model: statsManager.sortMode1List
|
||||||
|
currentIndex: statsManager.sortMode1Index
|
||||||
|
Layout.fillWidth: false
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
statsManager.sortMode1Changed(currentIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Button {
|
Button {
|
||||||
id: chartTypeButton
|
id: chartTypeButton
|
||||||
Layout.column: wide ? 0 : 1
|
Layout.column: wide ? 0 : 1
|
||||||
|
@ -216,7 +234,7 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
StatsView {
|
StatsView {
|
||||||
Layout.column: wide ? 1 : 0
|
Layout.column: wide ? 1 : 0
|
||||||
Layout.row: wide ? 0 : 3
|
Layout.row: wide ? 0 : 4
|
||||||
Layout.columnSpan: wide ? 1 : 3
|
Layout.columnSpan: wide ? 1 : 3
|
||||||
Layout.rowSpan: wide ? 7 : 1
|
Layout.rowSpan: wide ? 7 : 1
|
||||||
id: statsView
|
id: statsView
|
||||||
|
|
|
@ -50,16 +50,19 @@ void StatsManager::updateUi()
|
||||||
setVariableList(uiState.var2, var2List, var2Index);
|
setVariableList(uiState.var2, var2List, var2Index);
|
||||||
setBinnerList(uiState.binners2, binner2List, binner2Index);
|
setBinnerList(uiState.binners2, binner2List, binner2Index);
|
||||||
setVariableList(uiState.operations2, operation2List, operation2Index);
|
setVariableList(uiState.operations2, operation2List, operation2Index);
|
||||||
|
setVariableList(uiState.sortMode1, sortMode1List, sortMode1Index);
|
||||||
var1ListChanged();
|
var1ListChanged();
|
||||||
binner1ListChanged();
|
binner1ListChanged();
|
||||||
var2ListChanged();
|
var2ListChanged();
|
||||||
binner2ListChanged();
|
binner2ListChanged();
|
||||||
operation2ListChanged();
|
operation2ListChanged();
|
||||||
|
sortMode1ListChanged();
|
||||||
var1IndexChanged();
|
var1IndexChanged();
|
||||||
binner1IndexChanged();
|
binner1IndexChanged();
|
||||||
var2IndexChanged();
|
var2IndexChanged();
|
||||||
binner2IndexChanged();
|
binner2IndexChanged();
|
||||||
operation2IndexChanged();
|
operation2IndexChanged();
|
||||||
|
sortMode1IndexChanged();
|
||||||
|
|
||||||
if (charts)
|
if (charts)
|
||||||
charts->update(uiState.charts);
|
charts->update(uiState.charts);
|
||||||
|
@ -106,6 +109,15 @@ void StatsManager::var2OperationChanged(int idx)
|
||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StatsManager::sortMode1Changed(int idx)
|
||||||
|
{
|
||||||
|
if (uiState.sortMode1.variables.empty())
|
||||||
|
return;
|
||||||
|
idx = std::clamp(idx, 0, (int)uiState.sortMode1.variables.size());
|
||||||
|
state.sortMode1Changed(uiState.sortMode1.variables[idx].id);
|
||||||
|
updateUi();
|
||||||
|
}
|
||||||
|
|
||||||
void StatsManager::setChart(int idx)
|
void StatsManager::setChart(int idx)
|
||||||
{
|
{
|
||||||
state.chartChanged(idx);
|
state.chartChanged(idx);
|
||||||
|
|
|
@ -17,11 +17,13 @@ public:
|
||||||
Q_PROPERTY(QStringList var2List MEMBER var2List NOTIFY var2ListChanged)
|
Q_PROPERTY(QStringList var2List MEMBER var2List NOTIFY var2ListChanged)
|
||||||
Q_PROPERTY(QStringList binner2List MEMBER binner2List NOTIFY binner2ListChanged)
|
Q_PROPERTY(QStringList binner2List MEMBER binner2List NOTIFY binner2ListChanged)
|
||||||
Q_PROPERTY(QStringList operation2List MEMBER operation2List NOTIFY operation2ListChanged)
|
Q_PROPERTY(QStringList operation2List MEMBER operation2List NOTIFY operation2ListChanged)
|
||||||
|
Q_PROPERTY(QStringList sortMode1List MEMBER sortMode1List NOTIFY sortMode1ListChanged)
|
||||||
Q_PROPERTY(int var1Index MEMBER var1Index NOTIFY var1IndexChanged)
|
Q_PROPERTY(int var1Index MEMBER var1Index NOTIFY var1IndexChanged)
|
||||||
Q_PROPERTY(int binner1Index MEMBER binner1Index NOTIFY binner1IndexChanged)
|
Q_PROPERTY(int binner1Index MEMBER binner1Index NOTIFY binner1IndexChanged)
|
||||||
Q_PROPERTY(int var2Index MEMBER var2Index NOTIFY var2IndexChanged)
|
Q_PROPERTY(int var2Index MEMBER var2Index NOTIFY var2IndexChanged)
|
||||||
Q_PROPERTY(int binner2Index MEMBER binner2Index NOTIFY binner2IndexChanged)
|
Q_PROPERTY(int binner2Index MEMBER binner2Index NOTIFY binner2IndexChanged)
|
||||||
Q_PROPERTY(int operation2Index MEMBER operation2Index NOTIFY operation2IndexChanged)
|
Q_PROPERTY(int operation2Index MEMBER operation2Index NOTIFY operation2IndexChanged)
|
||||||
|
Q_PROPERTY(int sortMode1Index MEMBER sortMode1Index NOTIFY sortMode1IndexChanged)
|
||||||
|
|
||||||
StatsManager();
|
StatsManager();
|
||||||
~StatsManager();
|
~StatsManager();
|
||||||
|
@ -32,6 +34,7 @@ public:
|
||||||
Q_INVOKABLE void var2Changed(int idx);
|
Q_INVOKABLE void var2Changed(int idx);
|
||||||
Q_INVOKABLE void var2BinnerChanged(int idx);
|
Q_INVOKABLE void var2BinnerChanged(int idx);
|
||||||
Q_INVOKABLE void var2OperationChanged(int idx);
|
Q_INVOKABLE void var2OperationChanged(int idx);
|
||||||
|
Q_INVOKABLE void sortMode1Changed(int idx);
|
||||||
Q_INVOKABLE void setChart(int idx);
|
Q_INVOKABLE void setChart(int idx);
|
||||||
signals:
|
signals:
|
||||||
void var1ListChanged();
|
void var1ListChanged();
|
||||||
|
@ -39,11 +42,13 @@ signals:
|
||||||
void var2ListChanged();
|
void var2ListChanged();
|
||||||
void binner2ListChanged();
|
void binner2ListChanged();
|
||||||
void operation2ListChanged();
|
void operation2ListChanged();
|
||||||
|
void sortMode1ListChanged();
|
||||||
void var1IndexChanged();
|
void var1IndexChanged();
|
||||||
void binner1IndexChanged();
|
void binner1IndexChanged();
|
||||||
void var2IndexChanged();
|
void var2IndexChanged();
|
||||||
void binner2IndexChanged();
|
void binner2IndexChanged();
|
||||||
void operation2IndexChanged();
|
void operation2IndexChanged();
|
||||||
|
void sortMode1IndexChanged();
|
||||||
private:
|
private:
|
||||||
StatsView *view;
|
StatsView *view;
|
||||||
ChartListModel *charts;
|
ChartListModel *charts;
|
||||||
|
@ -53,11 +58,13 @@ private:
|
||||||
QStringList var2List;
|
QStringList var2List;
|
||||||
QStringList binner2List;
|
QStringList binner2List;
|
||||||
QStringList operation2List;
|
QStringList operation2List;
|
||||||
|
QStringList sortMode1List;
|
||||||
int var1Index;
|
int var1Index;
|
||||||
int binner1Index;
|
int binner1Index;
|
||||||
int var2Index;
|
int var2Index;
|
||||||
int binner2Index;
|
int binner2Index;
|
||||||
int operation2Index;
|
int operation2Index;
|
||||||
|
int sortMode1Index;
|
||||||
StatsState::UIState uiState; // Remember UI state so that we can interpret indexes
|
StatsState::UIState uiState; // Remember UI state so that we can interpret indexes
|
||||||
void updateUi();
|
void updateUi();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue