diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-12-29 12:01:21 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-01-04 08:21:43 -0800 |
commit | f8517c583bf5fdb787a7d5ce46a8896f9cf04830 (patch) | |
tree | 438168b68bca1d0f3fa7ea574aace73c4c6fe565 | |
parent | b4e36c591204a26fac63ff59713f8ddd081fb5a6 (diff) | |
download | subsurface-f8517c583bf5fdb787a7d5ce46a8896f9cf04830.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 28 | ||||
-rw-r--r-- | 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<int>() -#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<int> 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); |