From 01efa143587915e3ff7e42110c8ca53460c350da Mon Sep 17 00:00:00 2001 From: shun_iwasawa Date: Jul 05 2016 10:28:44 +0000 Subject: add small fix and clang format --- diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 956ab0a..9e02bb6 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -432,9 +432,9 @@ centralWidget->setLayout(centralWidgetLayout);*/ setCommandHandler(MI_PickStyleAreas, this, &MainWindow::togglePickStyleAreas); setCommandHandler(MI_PickStyleLines, this, &MainWindow::togglePickStyleLines); - setCommandHandler(MI_About, this, &MainWindow::onAbout); - setCommandHandler(MI_MaximizePanel, this, &MainWindow::maximizePanel); - setCommandHandler(MI_FullScreenWindow, this, &MainWindow::fullScreenWindow); + setCommandHandler(MI_About, this, &MainWindow::onAbout); + setCommandHandler(MI_MaximizePanel, this, &MainWindow::maximizePanel); + setCommandHandler(MI_FullScreenWindow, this, &MainWindow::fullScreenWindow); } //----------------------------------------------------------------------------- @@ -1096,34 +1096,19 @@ void MainWindow::resetRoomsLayout() { QObject::tr("The rooms will be reset the next time you run Toonz.")); } -void MainWindow::maximizePanel() -{ - DockLayout *currDockLayout = getCurrentRoom()->dockLayout(); - QPoint p; - if (!panelMaximized) - { - p = mapFromGlobal(QCursor::pos()); - panelMaximized = true; - } - else { - panelMaximized = false; - } - QWidget* currWidget = currDockLayout->containerOf(p); - DockWidget* currW = static_cast(currWidget); - if (currW) - currW->maximizeDock(); +void MainWindow::maximizePanel() { + DockLayout *currDockLayout = getCurrentRoom()->dockLayout(); + QPoint p = mapFromGlobal(QCursor::pos()); + QWidget *currWidget = currDockLayout->containerOf(p); + DockWidget *currW = dynamic_cast(currWidget); + if (currW) currW->maximizeDock(); } -void MainWindow::fullScreenWindow() -{ - QMainWindow *currWindow = TApp::instance()->getMainWindow(); - if (currWindow->isFullScreen()) { - currWindow->setWindowState(Qt::WindowMaximized); - } - else { - currWindow->setWindowState(Qt::WindowFullScreen); - } - +void MainWindow::fullScreenWindow() { + if (isFullScreen()) + setWindowState(Qt::WindowMaximized); + else + setWindowState(Qt::WindowFullScreen); } //----------------------------------------------------------------------------- @@ -1911,7 +1896,9 @@ void MainWindow::defineActions() { createMenuWindowsAction(MI_ResetRoomLayout, tr("&Reset to Default Rooms"), ""); createMenuWindowsAction(MI_MaximizePanel, tr("Toggle Maximize Panel"), "`"); - createMenuWindowsAction(MI_FullScreenWindow, tr("Toggle Full Screen"), "Ctrl+`"); + createMenuWindowsAction(MI_FullScreenWindow, + tr("Toggle Main Window's Full Screen Mode"), + "Ctrl+`"); createMenuWindowsAction(MI_About, tr("&About OpenToonz..."), ""); createRightClickMenuAction(MI_BlendColors, tr("&Blend colors"), ""); diff --git a/toonz/sources/toonz/mainwindow.h b/toonz/sources/toonz/mainwindow.h index 051fb5e..8efc118 100644 --- a/toonz/sources/toonz/mainwindow.h +++ b/toonz/sources/toonz/mainwindow.h @@ -69,7 +69,6 @@ class MainWindow final : public QMainWindow { bool m_saveSettingsOnQuit; int m_oldRoomIndex; QString m_currentRoomsChoice; - bool panelMaximized; UpdateChecker *m_updateChecker; TopBar *m_topBar; @@ -101,7 +100,7 @@ public: void onLoadSubScene(); void resetRoomsLayout(); void maximizePanel(); - void fullScreenWindow(); + void fullScreenWindow(); void autofillToggle(); void onUpgradeTabPro(); void onAbout(); diff --git a/toonz/sources/toonzqt/docklayout.h b/toonz/sources/toonzqt/docklayout.h index c21d047..b19472a 100644 --- a/toonz/sources/toonzqt/docklayout.h +++ b/toonz/sources/toonzqt/docklayout.h @@ -168,8 +168,8 @@ class DVAPI DockWidget : public QWidget { // privates friend class DockPlaceholder; // As above. // friend Region; //Regions need access to m_saveIndex field. - public: - void maximizeDock(); +public: + void maximizeDock(); protected: // Private attributes for dragging purposes diff --git a/toonz/sources/toonzqt/dockwidget.cpp b/toonz/sources/toonzqt/dockwidget.cpp index 5a56a8d..44b58cf 100644 --- a/toonz/sources/toonzqt/dockwidget.cpp +++ b/toonz/sources/toonzqt/dockwidget.cpp @@ -385,11 +385,10 @@ void DockWidget::mouseDoubleClickEvent(QMouseEvent *me) { //------------------------------------- -void DockWidget::maximizeDock() -{ - if (!m_floating) { - parentLayout()->setMaximized(this, !m_maximized); - } +void DockWidget::maximizeDock() { + if (!m_floating) { + parentLayout()->setMaximized(this, !m_maximized); + } } //-------------------------------------