|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|