From 8105a53194abe013f592503dcb00579149e05856 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 23 May 2012 11:50:13 +0200 Subject: [PATCH 1/4] removed eUBDockPaletteType_NAVIGATOR type because isn't a good type --- src/gui/UBDockPalette.cpp | 2 +- src/gui/UBDockPalette.h | 3 +-- src/gui/UBNavigatorPalette.cpp | 7 +------ 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index 935f8549..70af85f9 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -533,7 +533,7 @@ bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode) { bool hasVisibleElements = false; //-------------------------------// - // get full right palette widgets list, parse it, show all widgets for BOARD mode, and hide all other + // get full palette widgets list, parse it, show all widgets for BOARD mode, and hide all other for(int i = 0; i < mRegisteredWidgets.size(); i++) { UBDockPaletteWidget* pNextWidget = mRegisteredWidgets.at(i); diff --git a/src/gui/UBDockPalette.h b/src/gui/UBDockPalette.h index a513db75..9efeeec0 100644 --- a/src/gui/UBDockPalette.h +++ b/src/gui/UBDockPalette.h @@ -79,8 +79,7 @@ private: typedef enum { eUBDockPaletteType_LEFT, - eUBDockPaletteType_RIGHT, - eUBDockPaletteType_NAVIGATOR, + eUBDockPaletteType_RIGHT } eUBDockPaletteType; diff --git a/src/gui/UBNavigatorPalette.cpp b/src/gui/UBNavigatorPalette.cpp index a389e3c3..4ffdb342 100644 --- a/src/gui/UBNavigatorPalette.cpp +++ b/src/gui/UBNavigatorPalette.cpp @@ -24,18 +24,13 @@ * @param name as the object name */ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name): - UBDockPalette(eUBDockPaletteType_NAVIGATOR, parent, name) + UBDockPalette(eUBDockPaletteType_LEFT, parent, name) , mNavigator(NULL) , mLayout(NULL) , mHLayout(NULL) , mPageNbr(NULL) , mClock(NULL) { - setOrientation(eUBDockOrientation_Left); - setMaximumWidth(300); - resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), height()); - mLastWidth = 300; - // Build the gui mLayout = new QVBoxLayout(this); mLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin()); From b1bdf7f0b9b8386bc11843856a132f3c29f22ce8 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 23 May 2012 11:58:06 +0200 Subject: [PATCH 2/4] removed unused settings --- src/core/UBSettings.cpp | 1 - src/core/UBSettings.h | 1 - src/gui/UBNavigatorPalette.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 78d3fd54..c6109e0c 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -204,7 +204,6 @@ void UBSettings::init() appEnableAutomaticSoftwareUpdates = new UBSetting(this, "App", "EnableAutomaticSoftwareUpdates", true); appEnableSoftwareUpdates = new UBSetting(this, "App", "EnableSoftwareUpdates", true); appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", false); - navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 270); rightLibPaletteWidth = new UBSetting(this, "Board", "RightLibPaletteWidth", 270); rightLibPaletteIsCollapsed = new UBSetting(this,"Board", "RightLibPaletteIsCollapsed",false); leftLibPaletteWidth = new UBSetting(this, "Board", "LeftLibPaletteWidth",270); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index acb4b28a..10ff0f64 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -314,7 +314,6 @@ class UBSettings : public QObject UBSetting* gipThumbnailWidth; UBSetting* soundThumbnailWidth; - UBSetting* navigPaletteWidth; UBSetting* rightLibPaletteWidth; UBSetting* rightLibPaletteIsCollapsed; UBSetting* leftLibPaletteWidth; diff --git a/src/gui/UBNavigatorPalette.cpp b/src/gui/UBNavigatorPalette.cpp index 4ffdb342..df67c67e 100644 --- a/src/gui/UBNavigatorPalette.cpp +++ b/src/gui/UBNavigatorPalette.cpp @@ -145,7 +145,6 @@ void UBNavigatorPalette::resizeEvent(QResizeEvent *event) { mNavigator->setMinimumHeight(height() - 2*border()); } - UBSettings::settings()->navigPaletteWidth->set(width()); } void UBNavigatorPalette::timerEvent(QTimerEvent *event) From 065c3d1277f30a91b86d903a7380f184a3057f80 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Wed, 23 May 2012 13:06:35 +0300 Subject: [PATCH 3/4] Pictures and video can be locked now. --- src/board/UBBoardView.cpp | 1 + src/domain/UBGraphicsVideoItem.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 670f0ed8..1e299fde 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -426,6 +426,7 @@ UBBoardView::mousePressEvent (QMouseEvent *event) if (!movingItem || movingItem->isSelected() + || movingItem->data(UBGraphicsItemData::ItemLocked).toBool() || movingItem->type() == UBGraphicsDelegateFrame::Type || movingItem->type() == DelegateButton::Type || movingItem->type() == UBGraphicsCompass::Type diff --git a/src/domain/UBGraphicsVideoItem.cpp b/src/domain/UBGraphicsVideoItem.cpp index a7d12d35..2a87a455 100644 --- a/src/domain/UBGraphicsVideoItem.cpp +++ b/src/domain/UBGraphicsVideoItem.cpp @@ -120,6 +120,9 @@ void UBGraphicsVideoItem::mousePressEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsVideoItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { + if (mDelegate->delegated()->data(UBGraphicsItemData::ItemLocked).toBool()) + return; + if(mShouldMove && (event->buttons() & Qt::LeftButton)) { QPointF offset = event->scenePos() - mMousePressPos; From b42afc9e6d0c28805bc2a1185886c555feaf4020 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 23 May 2012 14:21:24 +0200 Subject: [PATCH 4/4] fixed issue 622 --- src/core/UBSettings.cpp | 12 ++++++---- src/core/UBSettings.h | 12 ++++++---- src/gui/UBDockPalette.cpp | 1 + src/gui/UBDockPalette.h | 2 ++ src/gui/UBLeftPalette.cpp | 47 +++++++++++++++++++++++++++++++++----- src/gui/UBLeftPalette.h | 2 ++ src/gui/UBRightPalette.cpp | 47 ++++++++++++++++++++++++++++++++------ src/gui/UBRightPalette.h | 2 ++ 8 files changed, 104 insertions(+), 21 deletions(-) diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index c6109e0c..b8450d19 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -204,10 +204,14 @@ void UBSettings::init() appEnableAutomaticSoftwareUpdates = new UBSetting(this, "App", "EnableAutomaticSoftwareUpdates", true); appEnableSoftwareUpdates = new UBSetting(this, "App", "EnableSoftwareUpdates", true); appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", false); - rightLibPaletteWidth = new UBSetting(this, "Board", "RightLibPaletteWidth", 270); - rightLibPaletteIsCollapsed = new UBSetting(this,"Board", "RightLibPaletteIsCollapsed",false); - leftLibPaletteWidth = new UBSetting(this, "Board", "LeftLibPaletteWidth",270); - leftLibPaletteIsCollapsed = new UBSetting(this,"Board","LeftLibPaletteIsCollapsed",false); + rightLibPaletteBoardModeWidth = new UBSetting(this, "Board", "RightLibPaletteBoardModeWidth", 270); + rightLibPaletteBoardModeIsCollapsed = new UBSetting(this,"Board", "RightLibPaletteBoardModeIsCollapsed",false); + rightLibPaletteDesktopModeWidth = new UBSetting(this, "Board", "RightLibPaletteDesktopModeWidth", 270); + rightLibPaletteDesktopModeIsCollapsed = new UBSetting(this,"Board", "RightLibPaletteDesktopModeIsCollapsed",false); + leftLibPaletteBoardModeWidth = new UBSetting(this, "Board", "LeftLibPaletteBoardModeWidth",270); + leftLibPaletteBoardModeIsCollapsed = new UBSetting(this,"Board","LeftLibPaletteBoardModeIsCollapsed",false); + leftLibPaletteDesktopModeWidth = new UBSetting(this, "Board", "LeftLibPaletteDesktopModeWidth",270); + leftLibPaletteDesktopModeIsCollapsed = new UBSetting(this,"Board","LeftLibPaletteDesktopModeIsCollapsed",false); appIsInSoftwareUpdateProcess = new UBSetting(this, "App", "IsInSoftwareUpdateProcess", false); appLastSessionDocumentUUID = new UBSetting(this, "App", "LastSessionDocumentUUID", ""); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index 10ff0f64..c928b6fa 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -314,10 +314,14 @@ class UBSettings : public QObject UBSetting* gipThumbnailWidth; UBSetting* soundThumbnailWidth; - UBSetting* rightLibPaletteWidth; - UBSetting* rightLibPaletteIsCollapsed; - UBSetting* leftLibPaletteWidth; - UBSetting* leftLibPaletteIsCollapsed; + UBSetting* rightLibPaletteBoardModeWidth; + UBSetting* rightLibPaletteBoardModeIsCollapsed; + UBSetting* rightLibPaletteDesktopModeWidth; + UBSetting* rightLibPaletteDesktopModeIsCollapsed; + UBSetting* leftLibPaletteBoardModeWidth; + UBSetting* leftLibPaletteBoardModeIsCollapsed; + UBSetting* leftLibPaletteDesktopModeWidth; + UBSetting* leftLibPaletteDesktopModeIsCollapsed; UBSetting* communityUser; UBSetting* communityPsw; diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index 70af85f9..293684fd 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -531,6 +531,7 @@ void UBDockPalette::setVisible(bool visible) bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode) { + mCurrentMode = mode; bool hasVisibleElements = false; //-------------------------------// // get full palette widgets list, parse it, show all widgets for BOARD mode, and hide all other diff --git a/src/gui/UBDockPalette.h b/src/gui/UBDockPalette.h index 9efeeec0..569f391b 100644 --- a/src/gui/UBDockPalette.h +++ b/src/gui/UBDockPalette.h @@ -115,6 +115,8 @@ public: bool switchMode(eUBDockPaletteWidgetMode mode); + eUBDockPaletteWidgetMode mCurrentMode; + QVector GetWidgetsList() { return mRegisteredWidgets; } public: diff --git a/src/gui/UBLeftPalette.cpp b/src/gui/UBLeftPalette.cpp index 21b3521b..fab827c6 100644 --- a/src/gui/UBLeftPalette.cpp +++ b/src/gui/UBLeftPalette.cpp @@ -25,11 +25,19 @@ UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name): { setObjectName(name); setOrientation(eUBDockOrientation_Left); - - mLastWidth = UBSettings::settings()->leftLibPaletteWidth->get().toInt(); mCollapseWidth = 150; - if(UBSettings::settings()->leftLibPaletteIsCollapsed->get().toBool()) + bool isCollapsed = false; + if(mCurrentMode == eUBDockPaletteWidget_BOARD){ + mLastWidth = UBSettings::settings()->leftLibPaletteBoardModeWidth->get().toInt(); + isCollapsed = UBSettings::settings()->leftLibPaletteBoardModeIsCollapsed->get().toBool(); + } + else{ + mLastWidth = UBSettings::settings()->leftLibPaletteDesktopModeWidth->get().toInt(); + isCollapsed = UBSettings::settings()->leftLibPaletteDesktopModeIsCollapsed->get().toBool(); + } + + if(isCollapsed) resize(0,parentWidget()->height()); else resize(mLastWidth, parentWidget()->height()); @@ -58,8 +66,35 @@ void UBLeftPalette::updateMaxWidth() void UBLeftPalette::resizeEvent(QResizeEvent *event) { int newWidth = width(); - if(newWidth > mCollapseWidth) - UBSettings::settings()->leftLibPaletteWidth->set(newWidth); - UBSettings::settings()->leftLibPaletteIsCollapsed->set(newWidth == 0); + if(mCurrentMode == eUBDockPaletteWidget_BOARD){ + if(newWidth > mCollapseWidth) + UBSettings::settings()->leftLibPaletteBoardModeWidth->set(newWidth); + UBSettings::settings()->leftLibPaletteBoardModeIsCollapsed->set(newWidth == 0); + } + else{ + if(newWidth > mCollapseWidth) + UBSettings::settings()->leftLibPaletteDesktopModeWidth->set(newWidth); + UBSettings::settings()->leftLibPaletteDesktopModeIsCollapsed->set(newWidth == 0); + } UBDockPalette::resizeEvent(event); } + + +bool UBLeftPalette::switchMode(eUBDockPaletteWidgetMode mode) +{ + int newModeWidth; + if(mode == eUBDockPaletteWidget_BOARD){ + mLastWidth = UBSettings::settings()->leftLibPaletteBoardModeWidth->get().toInt(); + newModeWidth = mLastWidth; + if(UBSettings::settings()->leftLibPaletteBoardModeIsCollapsed->get().toBool()) + newModeWidth = 0; + } + else{ + mLastWidth = UBSettings::settings()->leftLibPaletteDesktopModeWidth->get().toInt(); + newModeWidth = mLastWidth; + if(UBSettings::settings()->leftLibPaletteDesktopModeIsCollapsed->get().toBool()) + newModeWidth = 0; + } + resize(newModeWidth,height()); + return UBDockPalette::switchMode(mode); +} diff --git a/src/gui/UBLeftPalette.h b/src/gui/UBLeftPalette.h index cdb49330..8ae3bdf3 100644 --- a/src/gui/UBLeftPalette.h +++ b/src/gui/UBLeftPalette.h @@ -23,6 +23,8 @@ public: UBLeftPalette(QWidget* parent=0, const char* name="UBLeftPalette"); ~UBLeftPalette(); + bool switchMode(eUBDockPaletteWidgetMode mode); + protected: void updateMaxWidth(); void resizeEvent(QResizeEvent *event); diff --git a/src/gui/UBRightPalette.cpp b/src/gui/UBRightPalette.cpp index 9762b5e8..be8205c2 100644 --- a/src/gui/UBRightPalette.cpp +++ b/src/gui/UBRightPalette.cpp @@ -28,9 +28,16 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name): setObjectName(name); setOrientation(eUBDockOrientation_Right); mCollapseWidth = 150; - - mLastWidth = UBSettings::settings()->rightLibPaletteWidth->get().toInt(); - if(UBSettings::settings()->rightLibPaletteIsCollapsed->get().toBool()) + bool isCollapsed = false; + if(mCurrentMode == eUBDockPaletteWidget_BOARD){ + mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); + isCollapsed = UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool(); + } + else{ + mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); + isCollapsed = UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool(); + } + if(isCollapsed) resize(0,parentWidget()->height()); else resize(mLastWidth, parentWidget()->height()); @@ -62,10 +69,17 @@ void UBRightPalette::mouseMoveEvent(QMouseEvent *event) void UBRightPalette::resizeEvent(QResizeEvent *event) { int newWidth = width(); - if(newWidth > mCollapseWidth) - UBSettings::settings()->rightLibPaletteWidth->set(newWidth); - UBSettings::settings()->rightLibPaletteIsCollapsed->set(newWidth == 0); - UBDockPalette::resizeEvent(event); + if(mCurrentMode == eUBDockPaletteWidget_BOARD){ + if(newWidth > mCollapseWidth) + UBSettings::settings()->rightLibPaletteBoardModeWidth->set(newWidth); + UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->set(newWidth == 0); + } + else{ + if(newWidth > mCollapseWidth) + UBSettings::settings()->rightLibPaletteDesktopModeWidth->set(newWidth); + UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->set(newWidth == 0); + } + UBDockPalette::resizeEvent(event); emit resized(); } @@ -78,3 +92,22 @@ void UBRightPalette::updateMaxWidth() setMaximumHeight(parentWidget()->height()); setMinimumHeight(parentWidget()->height()); } + +bool UBRightPalette::switchMode(eUBDockPaletteWidgetMode mode) +{ + int newModeWidth; + if(mode == eUBDockPaletteWidget_BOARD){ + mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); + newModeWidth = mLastWidth; + if(UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool()) + newModeWidth = 0; + } + else{ + mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); + newModeWidth = mLastWidth; + if(UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool()) + newModeWidth = 0; + } + resize(newModeWidth,height()); + return UBDockPalette::switchMode(mode); +} diff --git a/src/gui/UBRightPalette.h b/src/gui/UBRightPalette.h index df0e82e5..00e6dd14 100644 --- a/src/gui/UBRightPalette.h +++ b/src/gui/UBRightPalette.h @@ -23,6 +23,7 @@ class UBRightPalette : public UBDockPalette public: UBRightPalette(QWidget* parent=0, const char* name="UBRightPalette"); ~UBRightPalette(); + bool switchMode(eUBDockPaletteWidgetMode mode); signals: void resized(); @@ -31,6 +32,7 @@ protected: void updateMaxWidth(); void mouseMoveEvent(QMouseEvent *event); void resizeEvent(QResizeEvent *event); + }; #endif // UBRIGHTPALETTE_H