Merge branch 'maximize' of https://github.com/turtletooth/opentoonz into turtletooth-maximize

This commit is contained in:
shun_iwasawa 2016-07-05 17:21:24 +09:00
commit 617a6d6d2f
5 changed files with 51 additions and 5 deletions

View file

@ -432,7 +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_About, this, &MainWindow::onAbout);
setCommandHandler(MI_MaximizePanel, this, &MainWindow::maximizePanel);
setCommandHandler(MI_FullScreenWindow, this, &MainWindow::fullScreenWindow);
}
//-----------------------------------------------------------------------------
@ -1094,6 +1096,36 @@ 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<DockWidget*>(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::onCurrentRoomChanged(int newRoomIndex) {
@ -1878,12 +1910,13 @@ 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_About, tr("&About OpenToonz..."), "");
createRightClickMenuAction(MI_BlendColors, tr("&Blend colors"), "");
createToggle(MI_OnionSkin, tr("Onion Skin"), "", false,
createToggle(MI_OnionSkin, tr("Onion Skin Toggle"), "//", false,
RightClickMenuCommandType);
// createRightClickMenuAction(MI_LoadSubSceneFile, tr("Load As

View file

@ -69,7 +69,7 @@ class MainWindow final : public QMainWindow {
bool m_saveSettingsOnQuit;
int m_oldRoomIndex;
QString m_currentRoomsChoice;
bool panelMaximized;
UpdateChecker *m_updateChecker;
TopBar *m_topBar;
@ -100,6 +100,8 @@ public:
void onLoadScene();
void onLoadSubScene();
void resetRoomsLayout();
void maximizePanel();
void fullScreenWindow();
void autofillToggle();
void onUpgradeTabPro();
void onAbout();

View file

@ -220,7 +220,8 @@
#define MI_OpenXshView "MI_OpenXshView"
#define MI_OpenCleanupSettings "MI_OpenCleanupSettings"
#define MI_ResetRoomLayout "MI_ResetRoomLayout"
#define MI_MaximizePanel "MI_MaximizePanel"
#define MI_FullScreenWindow "MI_FullScreenWindow"
#define MI_OnionSkin "MI_OnionSkin"
//#define MI_LoadResourceFile "MI_LoadResourceFile"

View file

@ -168,6 +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();
protected:
// Private attributes for dragging purposes

View file

@ -385,6 +385,14 @@ void DockWidget::mouseDoubleClickEvent(QMouseEvent *me) {
//-------------------------------------
void DockWidget::maximizeDock()
{
if (!m_floating) {
parentLayout()->setMaximized(this, !m_maximized);
}
}
//-------------------------------------
//! Switch in selected dock placeholder's hierarchy.
void DockWidget::wheelEvent(QWheelEvent *we) {
if (m_dragging) {