diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index beda62d8..b029d2b7 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -229,9 +229,6 @@ void UBBoardPaletteManager::setupPalettes() mKeyboardPalette = new UBKeyboardPalette(0); #ifndef Q_WS_WIN connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated())); -#endif -#ifndef Q_WS_MAC - // mKeyboardPalette->setParent(mContainer); #endif } @@ -764,13 +761,6 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is emit signal_changeMode(newMode); } -/* -void UBBoardPaletteManager::slot_changeMode(eUBDockPaletteWidgetMode newMode) -{ - emit signal_changeMode(newMode); -} -*/ - void UBBoardPaletteManager::addItem(const QPixmap& pPixmap, const QPointF& pos, qreal scaleFactor, const QUrl& sourceUrl) { mItemUrl = sourceUrl; diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 11005454..afd08aa9 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -205,7 +205,8 @@ void UBSettings::init() appEnableSoftwareUpdates = new UBSetting(this, "App", "EnableSoftwareUpdates", true); appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", false); navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 270); - libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 270); + rightLibPaletteWidth = new UBSetting(this, "Board", "RightLibPaletteWidth", 270); + leftLibPaletteWidth = new UBSetting(this, "Board", "LeftLibPaletteWidth",270); 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 09ca9021..4e8c9666 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -315,7 +315,8 @@ class UBSettings : public QObject UBSetting* soundThumbnailWidth; UBSetting* navigPaletteWidth; - UBSetting* libPaletteWidth; + UBSetting* rightLibPaletteWidth; + UBSetting* leftLibPaletteWidth; UBSetting* communityUser; UBSetting* communityPsw; diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index b168663f..05db3206 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -56,7 +56,7 @@ UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, co mTabWidgets.clear(); // We let 2 pixels in order to keep a small border for the resizing - setMinimumWidth(/*2*border() + 2*/0); + setMinimumWidth(0); if (parent) { @@ -131,138 +131,6 @@ void UBDockPalette::setOrientation(eUBDockOrientation orientation) } } -/** - * \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; -// } -// } -//} - -/** - * \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; -// } -//} - -/** - * \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; -//} - /** * \brief Handle the resize event * @param event as the resize event @@ -356,52 +224,6 @@ void UBDockPalette::paintEvent(QPaintEvent *event) mHTab = height() - border() - nbTabs*TABSIZE - (nbTabs-1)*tabSpacing(); } 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()); -// } -// } -// } } } @@ -758,12 +580,11 @@ UBTabDockPalete::UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent) : { 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*/) +void UBTabDockPalete::paintEvent(QPaintEvent *) { int nTabs = dock->mTabWidgets.size(); if (nTabs <= 0) { @@ -945,6 +766,3 @@ void UBTabDockPalete::mouseReleaseEvent(QMouseEvent *event) dock->mCanResize = false; } - - - diff --git a/src/gui/UBLeftPalette.cpp b/src/gui/UBLeftPalette.cpp index 1a6be579..8dbfba90 100644 --- a/src/gui/UBLeftPalette.cpp +++ b/src/gui/UBLeftPalette.cpp @@ -23,14 +23,13 @@ UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name): UBDockPalette(eUBDockPaletteType_LEFT, parent) { - setObjectName(name); - setOrientation(eUBDockOrientation_Left); - mLastWidth = 270; - mCollapseWidth = 150; + setObjectName(name); + setOrientation(eUBDockOrientation_Left); - resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), parentWidget()->height()); -// mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin()); + mLastWidth = UBSettings::settings()->leftLibPaletteWidth->get().toInt(); + mCollapseWidth = 150; + resize(mLastWidth, parentWidget()->height()); } /** @@ -55,6 +54,6 @@ void UBLeftPalette::updateMaxWidth() */ void UBLeftPalette::resizeEvent(QResizeEvent *event) { + UBSettings::settings()->leftLibPaletteWidth->set(width()); UBDockPalette::resizeEvent(event); -// UBSettings::settings()->navigPaletteWidth->set(width()); } diff --git a/src/gui/UBLibraryWidget.cpp b/src/gui/UBLibraryWidget.cpp index 6c325ee2..0965687b 100644 --- a/src/gui/UBLibraryWidget.cpp +++ b/src/gui/UBLibraryWidget.cpp @@ -91,7 +91,6 @@ void UBLibraryWidget::init() connect(this, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); connect(UBDownloadManager::downloadManager(), SIGNAL(addDownloadedFileToLibrary(bool,QUrl,QString,QByteArray)), this, SLOT(onAddDownloadedFileToLibrary(bool,QUrl,QString,QByteArray))); connect(UBApplication::boardController, SIGNAL(displayMetadata(QMap)), this, SLOT(onDisplayMetadata(QMap))); - connect(mLibraryController,SIGNAL(updateItemsList()),this,SLOT(onRefreshCurrentFolder())); } diff --git a/src/gui/UBRightPalette.cpp b/src/gui/UBRightPalette.cpp index 106daa71..26923eac 100644 --- a/src/gui/UBRightPalette.cpp +++ b/src/gui/UBRightPalette.cpp @@ -27,10 +27,11 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name): { setObjectName(name); setOrientation(eUBDockOrientation_Right); + + mLastWidth = UBSettings::settings()->rightLibPaletteWidth->get().toInt(); mCollapseWidth = 150; - mLastWidth = 270; - resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height()); -// mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin()); + + resize(mLastWidth, parentWidget()->height()); } /** @@ -59,7 +60,7 @@ void UBRightPalette::mouseMoveEvent(QMouseEvent *event) void UBRightPalette::resizeEvent(QResizeEvent *event) { UBDockPalette::resizeEvent(event); - UBSettings::settings()->libPaletteWidth->set(width()); + UBSettings::settings()->rightLibPaletteWidth->set(width()); emit resized(); }