From f8517c583bf5fdb787a7d5ce46a8896f9cf04830 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 29 Dec 2017 12:01:21 +0100 Subject: Replace macro TOGGLE_COLLAPSABLE by function toggleCollapsible() There was no reason to do this in a macro. Let the compiler decide if it wants to inline or not. Note that for consistency with the Qt functions, collapsAble was replaced by collabsIble. Signed-off-by: Berthold Stoeger --- desktop-widgets/mainwindow.cpp | 28 ++++++++++++++-------------- desktop-widgets/mainwindow.h | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index d31d3cca6..4c9cc097c 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1117,17 +1117,19 @@ void MainWindow::on_actionYearlyStatistics_triggered() #define BEHAVIOR QList() -#define TOGGLE_COLLAPSABLE( X ) \ - ui.mainSplitter->setCollapsible(0, X); \ - ui.mainSplitter->setCollapsible(1, X); \ - ui.topSplitter->setCollapsible(0, X); \ - ui.topSplitter->setCollapsible(1, X); \ - ui.bottomSplitter->setCollapsible(0, X); \ - ui.bottomSplitter->setCollapsible(1, X); +void MainWindow::toggleCollapsible(bool toggle) +{ + ui.mainSplitter->setCollapsible(0, toggle); + ui.mainSplitter->setCollapsible(1, toggle); + ui.topSplitter->setCollapsible(0, toggle); + ui.topSplitter->setCollapsible(1, toggle); + ui.bottomSplitter->setCollapsible(0, toggle); + ui.bottomSplitter->setCollapsible(1, toggle); +} void MainWindow::on_actionViewList_triggered() { - TOGGLE_COLLAPSABLE( true ); + toggleCollapsible(true); beginChangeState(LIST_MAXIMIZED); ui.mainSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED); ui.bottomSplitter->setSizes(BEHAVIOR << EXPANDED << COLLAPSED); @@ -1135,7 +1137,7 @@ void MainWindow::on_actionViewList_triggered() void MainWindow::on_actionViewProfile_triggered() { - TOGGLE_COLLAPSABLE( true ); + toggleCollapsible(true); beginChangeState(PROFILE_MAXIMIZED); ui.topSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED); ui.mainSplitter->setSizes(BEHAVIOR << EXPANDED << COLLAPSED); @@ -1143,7 +1145,7 @@ void MainWindow::on_actionViewProfile_triggered() void MainWindow::on_actionViewInfo_triggered() { - TOGGLE_COLLAPSABLE( true ); + toggleCollapsible(true); beginChangeState(INFO_MAXIMIZED); ui.topSplitter->setSizes(BEHAVIOR << EXPANDED << COLLAPSED); ui.mainSplitter->setSizes(BEHAVIOR << EXPANDED << COLLAPSED); @@ -1151,7 +1153,7 @@ void MainWindow::on_actionViewInfo_triggered() void MainWindow::on_actionViewMap_triggered() { - TOGGLE_COLLAPSABLE( true ); + toggleCollapsible(true); beginChangeState(MAP_MAXIMIZED); ui.mainSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED); ui.bottomSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED); @@ -1160,7 +1162,7 @@ void MainWindow::on_actionViewMap_triggered() void MainWindow::on_actionViewAll_triggered() { - TOGGLE_COLLAPSABLE( false ); + toggleCollapsible(false); beginChangeState(VIEWALL); static QList mainSizes; const int appH = qApp->desktop()->size().height(); @@ -1207,8 +1209,6 @@ void MainWindow::on_actionViewAll_triggered() ui.bottomSplitter->setCollapsible(1,false); } -#undef TOGGLE_COLLAPSABLE - void MainWindow::beginChangeState(CurrentState s) { if (state == VIEWALL && state != s) { diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 7c44cb425..901d184df 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -205,6 +205,7 @@ private: int file_save_as(); void beginChangeState(CurrentState s); void saveSplitterSizes(); + void toggleCollapsible(bool toggle); QString lastUsedDir(); void updateLastUsedDir(const QString &s); void registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight); -- cgit v1.2.3-70-g09d2