Desktop: show filter panel with maximized dive list

This way we can filter both in the default layout and in the dive list layout.

Fixes #1951

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-02-09 16:01:50 -08:00
parent 7b61cd7452
commit 2ae33376f7
2 changed files with 14 additions and 1 deletions

View file

@ -1033,7 +1033,7 @@ void MainWindow::on_actionViewList_triggered()
toggleCollapsible(true);
beginChangeState(LIST_MAXIMIZED);
ui.mainSplitter->setSizes({ COLLAPSED, EXPANDED });
ui.bottomSplitter->setSizes({ EXPANDED, COLLAPSED });
showFilterIfEnabled();
}
void MainWindow::on_actionViewProfile_triggered()
@ -1806,8 +1806,20 @@ void MainWindow::on_paste_triggered()
void MainWindow::on_actionFilterTags_triggered()
{
setApplicationState(getCurrentAppState() == "FilterDive" ? "Default" : "FilterDive");
if (state == LIST_MAXIMIZED)
showFilterIfEnabled();
}
void MainWindow::showFilterIfEnabled()
{
if (getCurrentAppState() == "FilterDive") {
const int appW = qApp->desktop()->size().width();
QList<int> profileFilterSizes = { round_int(appW * 0.7), round_int(appW * 0.3) };
ui.bottomSplitter->setSizes(profileFilterSizes);
} else {
ui.bottomSplitter->setSizes({ EXPANDED, COLLAPSED });
}
}
void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight)
{
applicationState[state] = WidgetForQuadrant(topLeft, topRight, bottomLeft, bottomRight);

View file

@ -207,6 +207,7 @@ private:
void beginChangeState(CurrentState s);
void saveSplitterSizes();
void toggleCollapsible(bool toggle);
void showFilterIfEnabled();
void updateLastUsedDir(const QString &s);
void registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight);
void enterState(CurrentState);