diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro
index 08702f67..6f361ea0 100644
--- a/Sankore_3.1.pro
+++ b/Sankore_3.1.pro
@@ -4,7 +4,8 @@ TEMPLATE = app
THIRD_PARTY_PATH=../Sankore-ThirdParty
CONFIG += debug_and_release \
- no_include_pwd
+ no_include_pwd \
+ link_prl
VERSION_MAJ = 1
VERSION_MIN = 40
diff --git a/resources/images/tab_mask.png b/resources/images/tab_mask.png
new file mode 100644
index 00000000..035608fa
Binary files /dev/null and b/resources/images/tab_mask.png differ
diff --git a/resources/sankore.qrc b/resources/sankore.qrc
index d71aadae..c0ff2a69 100644
--- a/resources/sankore.qrc
+++ b/resources/sankore.qrc
@@ -337,5 +337,6 @@
images/libpalette/WebSearchCategory.svg
images/download_close.png
images/download_open.png
+ images/tab_mask.png
diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp
index 986a8356..c0bf708c 100644
--- a/src/board/UBBoardPaletteManager.cpp
+++ b/src/board/UBBoardPaletteManager.cpp
@@ -727,7 +727,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
case eUBDockPaletteWidget_BOARD:
{
mLeftPalette->setParent(UBApplication::boardController->controlContainer());
- mRightPalette->setParent(UBApplication::boardController->controlContainer());
+ mRightPalette->assignParent(UBApplication::boardController->controlContainer());
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
@@ -752,7 +752,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
case eUBDockPaletteWidget_DESKTOP:
{
mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
- mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
+ mRightPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
@@ -802,7 +802,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
mLeftPalette->setVisible(false);
mRightPalette->setVisible(false);
mLeftPalette->setParent(0);
- mRightPalette->setParent(0);
+ mRightPalette->assignParent(0);
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp
index 0d39c960..b995df59 100644
--- a/src/core/UBSettings.cpp
+++ b/src/core/UBSettings.cpp
@@ -194,8 +194,8 @@ 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", 300);
- libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 300);
+ navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 270);
+ libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 270);
appIsInSoftwareUpdateProcess = new UBSetting(this, "App", "IsInSoftwareUpdateProcess", false);
appLastSessionDocumentUUID = new UBSetting(this, "App", "LastSessionDocumentUUID", "");
diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp
index aa4b0504..dd7d7058 100644
--- a/src/desktop/UBDesktopAnnotationController.cpp
+++ b/src/desktop/UBDesktopAnnotationController.cpp
@@ -900,7 +900,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
{
if(bTransparent)
{
- // Here we have to generate a new mask. This method is certainly resource
+ // Here we have to generate a new mask This method is certainly resource
// consuming but for the moment this is the only solution that I found.
mMask = QPixmap(mTransparentDrawingView->width(), mTransparentDrawingView->height());
@@ -922,13 +922,17 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
UBApplication::boardController->paletteManager()->mKeyboardPalette->width(), UBApplication::boardController->paletteManager()->mKeyboardPalette->height());
}
-// UBApplication::boardController->paletteManager()->mDesktopRightPalette
if(UBApplication::boardController->paletteManager()->rightPalette()->isVisible())
{
- p.drawRect(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(),
- UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(),
- UBApplication::boardController->paletteManager()->rightPalette()->width(),
- UBApplication::boardController->paletteManager()->rightPalette()->height());
+ QRect rightPalette(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(),
+ UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(),
+ UBApplication::boardController->paletteManager()->rightPalette()->width(),
+ UBApplication::boardController->paletteManager()->rightPalette()->height());
+
+ QRect tabsPalette(UBApplication::boardController->paletteManager()->rightPalette()->getTabPaletteRect());
+
+ p.drawRect(rightPalette);
+ p.drawRect(tabsPalette);
}
p.end();
diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp
index d3641157..2ac196f9 100644
--- a/src/desktop/UBDesktopPalette.cpp
+++ b/src/desktop/UBDesktopPalette.cpp
@@ -111,7 +111,6 @@ void UBDesktopPalette::updateShowHideState(bool pShowEnabled)
mShowHideAction->setToolTip(tr("Show Board on Secondary Screen"));
else
mShowHideAction->setToolTip(tr("Show Desktop on Secondary Screen"));
-
}
diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp
index 27539123..c1b9e86e 100644
--- a/src/document/UBDocumentController.cpp
+++ b/src/document/UBDocumentController.cpp
@@ -1455,7 +1455,7 @@ bool UBDocumentController::isOKToOpenDocument(UBDocumentProxy* proxy)
QString docVersion = proxy->metaData(UBSettings::documentVersion).toString();
if (docVersion.isEmpty() || docVersion.startsWith("4.1") || docVersion.startsWith("4.2")
- || docVersion.startsWith("4.3") || docVersion.startsWith("4.4")) // TODO UB 4.7 update if necessary
+ || docVersion.startsWith("4.3") || docVersion.startsWith("4.4") || docVersion.startsWith("4.5")) // TODO UB 4.7 update if necessary
{
return true;
}
diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp
index 8707d6ca..4822099f 100644
--- a/src/gui/UBDockPalette.cpp
+++ b/src/gui/UBDockPalette.cpp
@@ -41,6 +41,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
, mpStackWidget(NULL)
, mpLayout(NULL)
, mCurrentTab(0)
+ , mTabPalette(new UBTabDockPalete(this, parent))
{
setObjectName(name);
@@ -54,7 +55,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
mTabWidgets.clear();
// We let 2 pixels in order to keep a small border for the resizing
- setMinimumWidth(2*border() + 2);
+ setMinimumWidth(/*2*border() + 2*/0);
if (parent)
{
@@ -93,6 +94,10 @@ UBDockPalette::~UBDockPalette()
delete mpLayout;
mpLayout = NULL;
}
+ if (NULL != mTabPalette) {
+ delete mTabPalette;
+ mTabPalette = NULL;
+ }
}
/**
@@ -123,139 +128,139 @@ void UBDockPalette::setOrientation(eUBDockOrientation orientation)
setMaximumWidth(parentWidget()->width());
setMinimumWidth(maximumWidth());
}
-
}
/**
* \brief Handle the mouse move event
* @param as the mouse event
*/
-void UBDockPalette::mouseMoveEvent(QMouseEvent *event)
-{
- QPoint p = event->pos();
-
- if(mCanResize && ((mMousePressPos - p).manhattanLength() > QApplication::startDragDistance()))
- {
- switch(mOrientation)
- {
- case eUBDockOrientation_Left:
- if(p.x() < collapseWidth() && p.x() >= minimumWidth())
- {
- resize(border(), height());
- mLastWidth = collapseWidth() + 1;
- mResized = true;
- }
- else if(p.x() <= maximumWidth() && p.x() >= minimumWidth())
- {
- resize(p.x(), height());
- mResized = true;
- }
- break;
- case eUBDockOrientation_Right:
- if((this->x() + p.x() > parentWidget()->width() - collapseWidth()) && (this->x() + p.x() < parentWidget()->width()))
- {
- resize(border(), height());
- mLastWidth = collapseWidth() + 1;
- mResized = true;
- }
- else if((this->x() + p.x() >= parentWidget()->width() - maximumWidth()) && (this->x() + p.x() <= parentWidget()->width() - this->minimumWidth()))
- {
- resize(parentWidget()->width() - (this->x() + p.x()), height());
- mResized = true;
- }
-
- break;
- case eUBDockOrientation_Top:
- case eUBDockOrientation_Bottom:
- if(p.y() <= maximumHeight())
- {
- resize(width(), p.y());
- mResized = true;
- }
- break;
-
- default:
- break;
- }
- }
-}
+//void UBDockPalette::mouseMoveEvent(QMouseEvent *event)
+//{
+
+// QPoint p = event->pos();
+
+// if(mCanResize && ((mMousePressPos - p).manhattanLength() > QApplication::startDragDistance()))
+// {
+// switch(mOrientation)
+// {
+// case eUBDockOrientation_Left:
+// if(p.x() < collapseWidth() && p.x() >= minimumWidth())
+// {
+// resize(border(), height());
+// mLastWidth = collapseWidth() + 1;
+// mResized = true;
+// }
+// else if(p.x() <= maximumWidth() && p.x() >= minimumWidth())
+// {
+// resize(p.x(), height());
+// mResized = true;
+// }
+// break;
+// case eUBDockOrientation_Right:
+// if((this->x() + p.x() > parentWidget()->width() - collapseWidth()) && (this->x() + p.x() < parentWidget()->width()))
+// {
+// resize(border(), height());
+// mLastWidth = collapseWidth() + 1;
+// mResized = true;
+// }
+// else if((this->x() + p.x() >= parentWidget()->width() - maximumWidth()) && (this->x() + p.x() <= parentWidget()->width() - this->minimumWidth()))
+// {
+// resize(parentWidget()->width() - (this->x() + p.x()), height());
+// mResized = true;
+// }
+
+// break;
+// case eUBDockOrientation_Top:
+// case eUBDockOrientation_Bottom:
+// if(p.y() <= maximumHeight())
+// {
+// resize(width(), p.y());
+// mResized = true;
+// }
+// break;
+
+// default:
+// break;
+// }
+// }
+//}
/**
* \brief Handle the mouse press event
* @param as the mouse event
*/
-void UBDockPalette::mousePressEvent(QMouseEvent *event)
-{
- mClickTime = QTime::currentTime();
- // The goal here is to verify if the user can resize the widget.
- // It is only possible to resize it if the border is selected
- QPoint p = event->pos();
- mMousePressPos = p;
- mResized = false;
-
- switch(mOrientation)
- {
- case eUBDockOrientation_Left:
- if((p.x() >= width() - 2 * border()) && (p.x() <= width()))
- {
- mCanResize = true;
- }
- break;
- case eUBDockOrientation_Right:
- if((p.x() >= 0) && (p.x() <= 2 * border()))
- {
- mCanResize = true;
- }
- break;
- case eUBDockOrientation_Top:
- // Not supported yet
- break;
- case eUBDockOrientation_Bottom:
- // Not supported yet
- break;
- default:
- break;
- }
-}
+//void UBDockPalette::mousePressEvent(QMouseEvent *event)
+//{
+// mClickTime = QTime::currentTime();
+// // The goal here is to verify if the user can resize the widget.
+// // It is only possible to resize it if the border is selected
+// QPoint p = event->pos();
+// mMousePressPos = p;
+// mResized = false;
+
+// switch(mOrientation)
+// {
+// case eUBDockOrientation_Left:
+// if((p.x() >= width() - 2 * border()) && (p.x() <= width()))
+// {
+// mCanResize = true;
+// }
+// break;
+// case eUBDockOrientation_Right:
+// if((p.x() >= 0) && (p.x() <= 2 * border()))
+// {
+// mCanResize = true;
+// }
+// break;
+// case eUBDockOrientation_Top:
+// // Not supported yet
+// break;
+// case eUBDockOrientation_Bottom:
+// // Not supported yet
+// break;
+// default:
+// break;
+// }
+//}
/**
* \brief Handle the mouse release event
* @param event as the mouse event
*/
-void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_UNUSED(event);
- if(!mResized && mClickTime.elapsed() < CLICKTIME)
- {
- int nbTabs = mTabWidgets.size();
- int clickedTab = 0;
- // If the clicked position is in the tab, perform the related action
- if(eUBDockOrientation_Left == mOrientation)
- {
- if(mMousePressPos.x() >= width() - 2*border() &&
- mMousePressPos.y() >= mHTab &&
- mMousePressPos.x() <= width() &&
- mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
- {
- clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
- tabClicked(clickedTab);
- }
- }
- else if(eUBDockOrientation_Right == mOrientation)
- {
- if(mMousePressPos.x() >= 0 &&
- mMousePressPos.x() <= 2*border() &&
- mMousePressPos.y() >= mHTab &&
- mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
- {
- clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
- tabClicked(clickedTab);
- }
- }
- }
-
- mCanResize = false;
-}
+//void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
+//{
+// Q_UNUSED(event);
+// if(!mResized && mClickTime.elapsed() < CLICKTIME)
+// {
+// int nbTabs = mTabWidgets.size();
+// int clickedTab = 0;
+// // If the clicked position is in the tab, perform the related action
+// if(eUBDockOrientation_Left == mOrientation)
+// {
+// if(mMousePressPos.x() >= width() - 2*border() &&
+// mMousePressPos.y() >= mHTab &&
+// mMousePressPos.x() <= width() &&
+// mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
+// {
+// clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
+// tabClicked(clickedTab);
+// }
+// }
+// else if(eUBDockOrientation_Right == mOrientation)
+// {
+// if(mMousePressPos.x() >= 0 &&
+// mMousePressPos.x() <= 2*border() &&
+// mMousePressPos.y() >= mHTab &&
+// mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
+// {
+// clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
+// tabClicked(clickedTab);
+// }
+// }
+// }
+
+// mCanResize = false;
+//}
/**
* \brief Handle the resize event
@@ -288,6 +293,7 @@ void UBDockPalette::resizeEvent(QResizeEvent *event)
break;
}
move(origin.x(), origin.y());
+ moveTabs();
}
/**
@@ -332,11 +338,11 @@ void UBDockPalette::paintEvent(QPaintEvent *event)
// First draw the BIG RECTANGLE (I write it big because the rectangle is big...)
if(mOrientation == eUBDockOrientation_Left)
{
- path.addRect(0.0, 0.0, width()-2*border(), height());
+ path.addRect(0.0, 0.0, width(), height());
}
else if(mOrientation == eUBDockOrientation_Right)
{
- path.addRect(2*border(), 0.0, width()-2*border(), height());
+ path.addRect(0.0, 0.0, width(), height());
}
// THEN DRAW THE small tabs (yes, the tabs are small...)
@@ -348,52 +354,53 @@ void UBDockPalette::paintEvent(QPaintEvent *event)
{
mHTab = height() - border() - nbTabs*TABSIZE - (nbTabs-1)*tabSpacing();
}
-
- for(int i = 0; i < mTabWidgets.size(); i++)
- {
- UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i);
- if(NULL != pCrntWidget)
- {
- if(mOrientation == eUBDockOrientation_Left)
- {
- path.addRoundedRect(width()-4*border(), mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
- painter.drawPath(path);
- QPixmap iconPixmap;
- if(mCollapseWidth >= width())
- {
- // Get the collapsed icon
- iconPixmap = pCrntWidget->iconToRight();
- }
- else
- {
- // Get the expanded icon
- iconPixmap = pCrntWidget->iconToLeft();
- }
- painter.drawPixmap(width() - 2*border() + 1, mHTab + i*TABSIZE + i*tabSpacing() + 1 , 2*border() - 4, TABSIZE - 2, iconPixmap);
- }
- else if(mOrientation == eUBDockOrientation_Right)
- {
- path.addRoundedRect(0.0, mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
- painter.drawPath(path);
- QPixmap iconPixmap;
- if(mCollapseWidth >= width())
- {
- // Get the collapsed icon
- iconPixmap = pCrntWidget->iconToLeft();
- }
- else
- {
- // Get the expanded icon
- iconPixmap = pCrntWidget->iconToRight();
- }
- painter.drawPixmap(2, mHTab + i*TABSIZE + i*tabSpacing() + 1, 2*border() - 4, TABSIZE - 2, iconPixmap);
- }
- else
- {
- painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius());
- }
- }
- }
+ painter.drawPath(path);
+
+// for(int i = 0; i < mTabWidgets.size(); i++)
+// {
+// UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i);
+// if(NULL != pCrntWidget)
+// {
+// if(mOrientation == eUBDockOrientation_Left)
+// {
+// path.addRoundedRect(width()-4*border(), mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
+// painter.drawPath(path);
+// QPixmap iconPixmap;
+// if(mCollapseWidth >= width())
+// {
+// // Get the collapsed icon
+// iconPixmap = pCrntWidget->iconToRight();
+// }
+// else
+// {
+// // Get the expanded icon
+// iconPixmap = pCrntWidget->iconToLeft();
+// }
+// painter.drawPixmap(width() - 2*border() + 1, mHTab + i*TABSIZE + i*tabSpacing() + 1 , 2*border() - 4, TABSIZE - 2, iconPixmap);
+// }
+// else if(mOrientation == eUBDockOrientation_Right)
+// {
+// path.addRoundedRect(0.0, mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
+// painter.drawPath(path);
+// QPixmap iconPixmap;
+// if(mCollapseWidth >= width())
+// {
+// // Get the collapsed icon
+// iconPixmap = pCrntWidget->iconToLeft();
+// }
+// else
+// {
+// // Get the expanded icon
+// iconPixmap = pCrntWidget->iconToRight();
+// }
+// painter.drawPixmap(2, mHTab + i*TABSIZE + i*tabSpacing() + 1, 2*border() - 4, TABSIZE - 2, iconPixmap);
+// }
+// else
+// {
+// painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius());
+// }
+// }
+// }
}
}
@@ -460,6 +467,7 @@ void UBDockPalette::tabClicked(int tabIndex)
{
toggleCollapseExpand();
}
+ mTabPalette->update();
}
/**
@@ -493,7 +501,7 @@ void UBDockPalette::toggleCollapseExpand()
{
// The palette must be collapsed
mLastWidth = width();
- resize(2*border(), height());
+ resize(0, height());
}
else
{
@@ -550,6 +558,7 @@ void UBDockPalette::addTab(UBDockPaletteWidget *widget)
mTabWidgets.append(widget);
mpStackWidget->addWidget(widget);
mpStackWidget->setCurrentWidget(widget);
+ resizeTabs();
update();
}
}
@@ -571,6 +580,8 @@ void UBDockPalette::removeTab(const QString &widgetName)
break;
}
}
+ resizeTabs();
+ mCurrentTab = qMax(mCurrentTab - 1, 0);
}
/**
@@ -666,3 +677,245 @@ void UBDockPalette::onAllDownloadsFinished()
}
}
}
+
+void UBDockPalette::moveTabs()
+{
+ if (!mHTab) {
+ if(eUBDockTabOrientation_Up == mTabsOrientation) {
+ mHTab = border();
+ } else {
+ mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing();
+ }
+ }
+
+ QPoint origin(width(), mHTab);
+
+ switch (mOrientation) {
+ case eUBDockOrientation_Left:
+ origin.setX(width());
+ break;
+ case eUBDockOrientation_Right:
+ if (parentWidget()) {
+ origin.setX(parentWidget()->width() - width() - mTabPalette->width());
+ }
+ break;
+ case eUBDockOrientation_Top: ;
+ case eUBDockOrientation_Bottom: ;
+ }
+
+ mTabPalette->move(origin.x(), origin.y());
+}
+void UBDockPalette::resizeTabs()
+{
+ int numTabs = mTabWidgets.size();
+ mTabPalette->resize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing());
+}
+QRect UBDockPalette::getTabPaletteRect()
+{
+ QRect tabsRect = mTabPalette->rect();
+ QPoint topLeft = mTabPalette->mapToParent(tabsRect.topLeft());
+ QPoint bottomRight = mTabPalette->mapToParent(tabsRect.bottomRight());
+
+ return QRect(topLeft, bottomRight);
+}
+void UBDockPalette::assignParent(QWidget *widget)
+{
+ setParent(widget);
+ mTabPalette->setParent(widget);
+}
+void UBDockPalette::setVisible(bool visible)
+{
+ QWidget::setVisible(visible);
+ mTabPalette->setVisible(visible);
+}
+
+UBTabDockPalete::UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent) :
+ QWidget(parent)
+ , dock(dockPalette)
+{
+ int numTabs = dock->mTabWidgets.size();
+ resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing());
+// move(dock->width(), 20);
+
+ setAttribute(Qt::WA_TranslucentBackground);
+}
+
+void UBTabDockPalete::paintEvent(QPaintEvent */*event*/)
+{
+ int nTabs = dock->mTabWidgets.size();
+ if (nTabs <= 0) {
+ qDebug() << "not enough tabs";
+ return;
+ }
+
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(dock->mBackgroundBrush);
+
+ int yFrom = 0;
+ for (int i = 0; i < nTabs; i++) {
+ UBDockPaletteWidget* pCrntWidget = dock->mTabWidgets.at(i);
+ QPainterPath path;
+ path.setFillRule(Qt::WindingFill);
+ QPixmap iconPixmap;
+
+ switch (dock->mOrientation) {
+ case eUBDockOrientation_Left:
+ path.addRect(0, yFrom, width() / 2, TABSIZE);
+ path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius());
+ if (pCrntWidget) {
+ if(dock->mCollapseWidth >= dock->width()) {
+ // Get the collapsed icon
+ iconPixmap = pCrntWidget->iconToRight();
+ } else {
+ // Get the expanded icon
+ iconPixmap = pCrntWidget->iconToLeft();
+ }
+
+ }
+ break;
+
+ case eUBDockOrientation_Right:
+ path.addRect(width() /2, yFrom, width() / 2, TABSIZE);
+ path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius());
+ if (pCrntWidget) {
+ if(dock->mCollapseWidth >= dock->width()) {
+ // Get the collapsed icon
+ iconPixmap = pCrntWidget->iconToLeft();
+ } else {
+ // Get the expanded icon
+ iconPixmap = pCrntWidget->iconToRight();
+ }
+ }
+ break;
+
+ case eUBDockOrientation_Top: ;
+ case eUBDockOrientation_Bottom: ;
+ default:
+ break;
+ }
+
+ painter.save();
+ QPixmap transparencyPix(":/images/tab_mask.png");
+ if (dock->mCurrentTab != i) {
+ iconPixmap.setAlphaChannel(transparencyPix);
+ QColor color(0x7F, 0x7F, 0x7F, 0x3F);
+ painter.setBrush(QBrush(color));
+ }
+
+ painter.drawPath(path);
+ painter.drawPixmap(2, yFrom + 2, width() - 4, TABSIZE - 4, iconPixmap);
+ yFrom += (TABSIZE + dock->tabSpacing());
+ painter.restore();
+ }
+}
+UBTabDockPalete::~UBTabDockPalete()
+{
+}
+
+void UBTabDockPalete::mousePressEvent(QMouseEvent *event)
+{
+ dock->mClickTime = QTime::currentTime();
+ // The goal here is to verify if the user can resize the widget.
+ // It is only possible to resize it if the border is selected
+ QPoint p = event->pos();
+ dock->mMousePressPos = p;
+ dock->mResized = false;
+
+ switch(dock->mOrientation) {
+ case eUBDockOrientation_Left:
+ dock->mCanResize = true;
+ break;
+ case eUBDockOrientation_Right:
+ dock->mCanResize = true;
+ break;
+ case eUBDockOrientation_Top:
+ // Not supported yet
+ break;
+ case eUBDockOrientation_Bottom:
+ // Not supported yet
+ break;
+ default:
+ break;
+ }
+}
+void UBTabDockPalete::mouseMoveEvent(QMouseEvent *event)
+{
+ QPoint p = event->pos();
+
+ if(dock->mCanResize && ((dock->mMousePressPos - p).manhattanLength() > QApplication::startDragDistance()))
+ {
+ switch(dock->mOrientation) {
+
+ case eUBDockOrientation_Left:
+ p.setX(p.x() + dock->width());
+ if(p.x() < dock->collapseWidth() && p.x() >= dock->minimumWidth()) {
+ dock->resize(0, dock->height());
+ dock->mLastWidth = dock->collapseWidth() + 1;
+ dock->mResized = true;
+ } else if (p.x() <= dock->maximumWidth() && p.x() >= dock->minimumWidth()) {
+ dock->resize(p.x(), dock->height());
+ dock->mResized = true;
+ }
+ break;
+
+ case eUBDockOrientation_Right:
+ p.setX(p.x() - 2 * dock->border());
+ if((dock->x() + p.x() > dock->parentWidget()->width() - dock->collapseWidth()) && (dock->x() + p.x() < dock->parentWidget()->width())) {
+ dock->resize(0, dock->height());
+ dock->mLastWidth = dock->collapseWidth() + 1;
+ dock->mResized = true;
+ } else if((dock->x() + p.x() >= dock->parentWidget()->width() - dock->maximumWidth()) && (dock->x() + p.x() <= dock->parentWidget()->width() - dock->minimumWidth())) {
+ dock->resize(dock->parentWidget()->width() - (dock->x() + p.x()), dock->height());
+ dock->mResized = true;
+ }
+ break;
+
+ case eUBDockOrientation_Top:
+ case eUBDockOrientation_Bottom:
+ if(p.y() <= dock->maximumHeight()) {
+ dock->resize(width(), p.y());
+ dock->mResized = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+void UBTabDockPalete::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_UNUSED(event);
+ if(!dock->mResized && dock->mClickTime.elapsed() < CLICKTIME) {
+ int nbTabs = dock->mTabWidgets.size();
+ int clickedTab = 0;
+ // If the clicked position is in the tab, perform the related action
+
+ if(eUBDockOrientation_Left == dock->mOrientation) {
+ if(dock->mMousePressPos.y() >= dock->mHTab &&
+ dock->mMousePressPos.x() <= width() &&
+ dock->mMousePressPos.y() <= dock->mHTab + nbTabs * TABSIZE + (nbTabs -1)*dock->tabSpacing()) {
+
+ clickedTab = (dock->mMousePressPos.y() - dock->mHTab) / (TABSIZE + dock->tabSpacing());
+ dock->tabClicked(clickedTab);
+ }
+
+ } else if (eUBDockOrientation_Right == dock->mOrientation) {
+ if(dock->mMousePressPos.x() >= 0 &&
+ dock->mMousePressPos.x() <= width() &&
+ dock->mMousePressPos.y() >= 0 &&
+ dock->mMousePressPos.y() <= nbTabs * TABSIZE + (nbTabs -1) * dock->tabSpacing()) {
+
+ clickedTab = (dock->mMousePressPos.y())/(TABSIZE+dock->tabSpacing());
+ dock->tabClicked(clickedTab);
+ }
+ }
+ }
+
+ dock->mCanResize = false;
+}
+
+
+
diff --git a/src/gui/UBDockPalette.h b/src/gui/UBDockPalette.h
index a1b3c758..0e00ad14 100644
--- a/src/gui/UBDockPalette.h
+++ b/src/gui/UBDockPalette.h
@@ -31,8 +31,8 @@
#include "UBDockPaletteWidget.h"
-#define TABSIZE 50
-#define CLICKTIME 1000000
+#define TABSIZE 50 //Height of the tab of the palette
+#define CLICKTIME 1000000 //Clicktime to expand or collapse paltte
/**
* \brief The dock positions
@@ -51,9 +51,33 @@ typedef enum
eUBDockTabOrientation_Down /** Down tabs */
}eUBDockTabOrientation;
+class UBDockPalette;
+
+class UBTabDockPalete : public QWidget
+{
+ Q_OBJECT
+ friend class UBDockPalette;
+
+public:
+
+ UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent = 0);
+ ~UBTabDockPalete();
+
+protected:
+ virtual void mousePressEvent(QMouseEvent *event);
+ virtual void mouseMoveEvent(QMouseEvent *event);
+ virtual void mouseReleaseEvent(QMouseEvent *event);
+ virtual void paintEvent(QPaintEvent *event);
+
+private:
+ UBDockPalette *dock;
+};
+
class UBDockPalette : public QWidget
{
Q_OBJECT
+ friend class UBTabDockPalete;
+
public:
UBDockPalette(QWidget* parent=0, const char* name="UBDockPalette");
~UBDockPalette();
@@ -62,10 +86,14 @@ public:
void setOrientation(eUBDockOrientation orientation);
void setTabsOrientation(eUBDockTabOrientation orientation);
void showTabWidget(int tabIndex);
+ QRect getTabPaletteRect();
- virtual void mouseMoveEvent(QMouseEvent *event);
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *event);
+ virtual void assignParent(QWidget *widget);
+ virtual void setVisible(bool visible);
+
+// virtual void mouseMoveEvent(QMouseEvent *event);
+// virtual void mousePressEvent(QMouseEvent *event);
+// virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void paintEvent(QPaintEvent *event);
virtual void enterEvent(QEvent *);
virtual void leaveEvent(QEvent *);
@@ -77,7 +105,7 @@ public:
void connectSignals();
- QVector GetWidgetsList() { return mRegisteredWidgets; };
+ QVector GetWidgetsList() { return mRegisteredWidgets; }
public slots:
void onShowTabWidget(const QString& widgetName);
@@ -137,6 +165,11 @@ private:
void tabClicked(int tabIndex);
int tabSpacing();
void toggleCollapseExpand();
+ void moveTabs();
+ void resizeTabs();
+
+private:
+ UBTabDockPalete *mTabPalette;
};
diff --git a/src/gui/UBLeftPalette.cpp b/src/gui/UBLeftPalette.cpp
index 391b0efe..9cb518e7 100644
--- a/src/gui/UBLeftPalette.cpp
+++ b/src/gui/UBLeftPalette.cpp
@@ -24,11 +24,11 @@ UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name):UBDockPalette(pa
{
setObjectName(name);
setOrientation(eUBDockOrientation_Left);
- mLastWidth = 300;
- mCollapseWidth = 180;
+ mLastWidth = 270;
+ mCollapseWidth = 150;
resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), parentWidget()->height());
- mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin());
+// mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin());
}
@@ -45,7 +45,7 @@ UBLeftPalette::~UBLeftPalette()
*/
void UBLeftPalette::updateMaxWidth()
{
- setMaximumWidth(300);
+ setMaximumWidth(270);
}
/**
@@ -55,5 +55,5 @@ void UBLeftPalette::updateMaxWidth()
void UBLeftPalette::resizeEvent(QResizeEvent *event)
{
UBDockPalette::resizeEvent(event);
- UBSettings::settings()->navigPaletteWidth->set(width());
+// UBSettings::settings()->navigPaletteWidth->set(width());
}
diff --git a/src/gui/UBRightPalette.cpp b/src/gui/UBRightPalette.cpp
index 3c36658d..b6d21b00 100644
--- a/src/gui/UBRightPalette.cpp
+++ b/src/gui/UBRightPalette.cpp
@@ -26,10 +26,10 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(
{
setObjectName(name);
setOrientation(eUBDockOrientation_Right);
- mCollapseWidth = 180;
- mLastWidth = 300;
+ mCollapseWidth = 150;
+ mLastWidth = 270;
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height());
- mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin());
+// mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin());
}
/**
@@ -37,7 +37,6 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(
*/
UBRightPalette::~UBRightPalette()
{
-
}
/**
diff --git a/src/web/browser/WBBrowserWindow.cpp b/src/web/browser/WBBrowserWindow.cpp
index 14f96f09..e8151811 100644
--- a/src/web/browser/WBBrowserWindow.cpp
+++ b/src/web/browser/WBBrowserWindow.cpp
@@ -205,6 +205,7 @@ void WBBrowserWindow::setupToolBar()
connect(mSearchToolBar, SIGNAL(search(const QUrl&)), SLOT(loadUrl(const QUrl&)));
mChaseWidget = new WBChaseWidget(this);
+ mWebToolBar->insertWidget(mUniboardMainWindow->actionWebBigger, mChaseWidget);
mWebToolBar->insertSeparator(mUniboardMainWindow->actionWebBigger);
connect(mUniboardMainWindow->actionHome, SIGNAL(triggered()), this , SLOT(slotHome()));