Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Claudio Valerio 13 years ago
commit d68abb8165
  1. 2
      src/board/UBBoardController.cpp
  2. 1
      src/board/UBBoardController.h
  3. 56
      src/board/UBBoardPaletteManager.cpp
  4. 13
      src/board/UBBoardPaletteManager.h
  5. 57
      src/gui/UBDockPalette.cpp
  6. 13
      src/gui/UBDockPalette.h
  7. 37
      src/gui/UBLeftPalette.cpp
  8. 7
      src/gui/UBLeftPalette.h
  9. 18
      src/gui/UBPageNavigationWidget.cpp
  10. 3
      src/gui/UBPageNavigationWidget.h
  11. 78
      src/gui/UBRightPalette.cpp
  12. 12
      src/gui/UBRightPalette.h
  13. BIN
      src/tools/Mask_specification.doc
  14. BIN
      src/tools/Mask_specification.odt

@ -1155,7 +1155,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
}
// Notify the navigator palette that the document has changed
mPaletteManager->leftPalette()->pageNavigator()->setDocument(pDocumentProxy);
emit setDocOnPageNavigator(pDocumentProxy);
if (sceneChange)
{

@ -261,6 +261,7 @@ class UBBoardController : public QObject
void cacheEnabled();
void cacheDisabled();
void pageChanged();
void setDocOnPageNavigator(UBDocumentProxy* doc);
protected:

@ -73,7 +73,9 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
, mPendingZoomButtonPressed(false)
, mPendingPanButtonPressed(false)
, mPendingEraseButtonPressed(false)
, mpPageNavigWidget(NULL)
, mpLibWidget(NULL)
, mpCachePropWidget(NULL)
{
setupPalettes();
connectPalettes();
@ -82,6 +84,21 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
UBBoardPaletteManager::~UBBoardPaletteManager()
{
if(NULL != mpPageNavigWidget)
{
delete mpPageNavigWidget;
mpPageNavigWidget = NULL;
}
if(NULL != mpLibWidget)
{
delete mpLibWidget;
mpLibWidget = NULL;
}
if(NULL != mpCachePropWidget)
{
delete mpCachePropWidget;
mpCachePropWidget = NULL;
}
delete mAddItemPalette;
if(NULL != mLeftPalette)
{
@ -112,15 +129,37 @@ void UBBoardPaletteManager::setupLayout()
}
/**
* \brief Set up the dock palette widgets
*/
void UBBoardPaletteManager::setupDockPaletteWidgets()
{
// LEFT palette widgets
mLeftPalette->registerWidget(mpPageNavigWidget);
mLeftPalette->addTabWidget(mpPageNavigWidget);
mLeftPalette->connectSignals();
// RIGHT palette widgets
mRightPalette->registerWidget(mpLibWidget);
mRightPalette->registerWidget(mpCachePropWidget);
mRightPalette->addTabWidget(mpLibWidget);
mRightPalette->connectSignals();
}
void UBBoardPaletteManager::setupPalettes()
{
// Add the dock palettes
mLeftPalette = new UBLeftPalette(mContainer);
// We disable the lib palette for the moment because it is not yet available
mRightPalette = new UBRightPalette(mContainer);
// Create the widgets for the dock palettes
mpPageNavigWidget = new UBPageNavigationWidget();
mpLibWidget = new UBLibWidget();
mpCachePropWidget = new UBCachePropertiesWidget();
setupDockPaletteWidgets();
// Add the other palettes
mStylusPalette = new UBStylusPalette(mContainer, UBSettings::settings()->appToolBarOrientationVertical->get().toBool() ? Qt::Vertical : Qt::Horizontal);
connect(mStylusPalette, SIGNAL(stylusToolDoubleClicked(int)), UBApplication::boardController, SLOT(stylusToolDoubleClicked(int)));
@ -396,9 +435,9 @@ void UBBoardPaletteManager::activeSceneChanged()
if (mStylusPalette)
connect(mStylusPalette, SIGNAL(mouseEntered()), activeScene, SLOT(hideEraser()));
if (mLeftPalette)
if (mpPageNavigWidget)
{
mLeftPalette->pageNavigator()->setPageNumber(pageIndex + 1, activeScene->document()->pageCount());
mpPageNavigWidget->setPageNumber(pageIndex + 1, activeScene->document()->pageCount());
}
if (mZoomPalette)
@ -562,10 +601,11 @@ void UBBoardPaletteManager::addItemToLibrary()
, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
QImage image = mPixmap.toImage();
// TODO:Claudio
// This is a wrong way of calling importImageOnLibrary but for the moment it works because element on mRightPalette are predefined.
mRightPalette->libWidget()->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image);
if(NULL != mpLibWidget)
{
mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image);
}
}
else
{

@ -22,6 +22,9 @@
#include "web/UBRoutedMouseEventWebView.h"
#include "gui/UBLeftPalette.h"
#include "gui/UBRightPalette.h"
#include "gui/UBPageNavigationWidget.h"
#include "gui/UBLibWidget.h"
#include "gui/UBCachePropertiesWidget.h"
class UBStylusPalette;
class UBClockPalette;
@ -61,6 +64,7 @@ class UBBoardPaletteManager : public QObject
void setupPalettes();
void connectPalettes();
void positionFreeDisplayPalette();
void setupDockPaletteWidgets();
QWidget* mContainer;
UBBoardController *mBoardControler;
@ -69,7 +73,9 @@ class UBBoardPaletteManager : public QObject
UBZoomPalette *mZoomPalette;
/** The left dock palette */
UBLeftPalette* mLeftPalette;
/** The right dock palette */
UBRightPalette* mRightPalette;
UBActionPalette *mBackgroundsPalette;
@ -95,6 +101,13 @@ class UBBoardPaletteManager : public QObject
QTime mEraseButtonPressedTime;
bool mPendingEraseButtonPressed;
/** The page navigator widget */
UBPageNavigationWidget* mpPageNavigWidget;
/** The library widget */
UBLibWidget* mpLibWidget;
/** The cache properties widget */
UBCachePropertiesWidget* mpCachePropWidget;
private slots:
void changeBackground();

@ -260,6 +260,10 @@ void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
mCanResize = false;
}
/**
* \brief Handle the resize event
* @param event as the resize event
*/
void UBDockPalette::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event);
@ -461,6 +465,10 @@ void UBDockPalette::tabClicked(int tabIndex)
}
}
/**
* \brief Show the tab widget related to the given index
* @param tabIndex as the given index
*/
void UBDockPalette::showTabWidget(int tabIndex)
{
mpStackWidget->setCurrentIndex(tabIndex);
@ -473,6 +481,9 @@ void UBDockPalette::showTabWidget(int tabIndex)
}
}
/**
* \brief Toggle the collapse / expand state
*/
void UBDockPalette::toggleCollapseExpand()
{
if(mLastWidth == -1)
@ -489,11 +500,18 @@ void UBDockPalette::toggleCollapseExpand()
}
}
/**
* \brief Set the tabs orientation
* @param orientation as the given tabs orientation
*/
void UBDockPalette::setTabsOrientation(eUBDockTabOrientation orientation)
{
mTabsOrientation = orientation;
}
/**
* \brief Update the tab position regarding the toolbar position (up or down)
*/
void UBDockPalette::onToolbarPosUpdated()
{
// Get the position of the tab
@ -508,11 +526,19 @@ void UBDockPalette::onToolbarPosUpdated()
update();
}
/**
* \brief Get the custom margin
* @return the custom margin value
*/
int UBDockPalette::customMargin()
{
return 5;
}
/**
* \brief Add the given tab widget
* @param widget as the given widget
*/
void UBDockPalette::addTabWidget(UBDockPaletteWidget *widget)
{
if(!mTabWidgets.contains(widget))
@ -525,6 +551,10 @@ void UBDockPalette::addTabWidget(UBDockPaletteWidget *widget)
}
}
/**
* \brief Remove the given tab
* @param widgetName as the tab widget name
*/
void UBDockPalette::removeTab(const QString &widgetName)
{
for(int i = 0; i < mTabWidgets.size(); i++)
@ -541,17 +571,28 @@ void UBDockPalette::removeTab(const QString &widgetName)
}
}
/**
* \brief Handle the resize request
* @param event as the given resize request
*/
void UBDockPalette::onResizeRequest(QResizeEvent *event)
{
resizeEvent(event);
}
/**
* \brief Get the tab spacing
* @return the tab spacing
*/
int UBDockPalette::tabSpacing()
{
return 2;
}
// This method is used to show the tab widget
/**
* \brief Show the given widget
* @param widgetName as the given widget name
*/
void UBDockPalette::onShowTabWidget(const QString &widgetName)
{
for(int i = 0; i < mRegisteredWidgets.size(); i++)
@ -565,12 +606,18 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName)
}
}
// This method is used to hide the tab widget
/**
* \brief Hide the given widget
* @param widgetName as the given widget name
*/
void UBDockPalette::onHideTabWidget(const QString &widgetName)
{
removeTab(widgetName);
}
/**
* \brief Connect the show / hide signals of the widget related to this dock palette
*/
void UBDockPalette::connectSignals()
{
for(int i=0; i < mRegisteredWidgets.size(); i++)
@ -580,10 +627,16 @@ void UBDockPalette::connectSignals()
}
}
/**
* \brief Register the given widget
* @param widget as the given widget
*/
void UBDockPalette::registerWidget(UBDockPaletteWidget *widget)
{
if(!mRegisteredWidgets.contains(widget))
{
// Update the parent of this widget
widget->setParent(this);
mRegisteredWidgets.append(widget);
// By default, the widget is hidden

@ -72,16 +72,15 @@ public:
void setBackgroundBrush(const QBrush& brush);
void registerWidget(UBDockPaletteWidget* widget);
void addTabWidget(UBDockPaletteWidget* widget);
void removeTab(const QString& widgetName);
void connectSignals();
public slots:
void onShowTabWidget(const QString& widgetName);
void onHideTabWidget(const QString& widgetName);
protected:
void addTabWidget(UBDockPaletteWidget* widget);
void removeTab(const QString& widgetName);
void connectSignals();
virtual int border();
virtual int radius();
virtual int customMargin();
@ -109,15 +108,10 @@ protected:
QTime mClickTime;
/** The mouse pressed position */
QPoint mMousePressPos;
// /** The palette icon */
// QPixmap mIcon;
// QPixmap mCollapsedIcon;
/** The tab orientation */
eUBDockTabOrientation mTabsOrientation;
/** The h position of the tab */
int mHTab;
/** The tab widgets */
//QMap<QString, UBDockPaletteWidget*> mTabWidgets;
/** The stacked widget */
QStackedWidget* mpStackWidget;
/** The layout */
@ -136,7 +130,6 @@ private slots:
private:
void tabClicked(int tabIndex);
int tabSpacing();
void toggleCollapseExpand();
};

@ -13,52 +13,45 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBLeftPalette.h"
#include "core/UBSettings.h"
/**
* \brief The constructor
*/
UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name):UBDockPalette(parent)
, mpPageNavigator(NULL)
{
setObjectName(name);
setOrientation(eUBDockOrientation_Left);
mLastWidth = 300;
mCollapseWidth = 180;
/*
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height());
mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin());
*/
resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), parentWidget()->height());
mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin());
// Add the widgets here
mpPageNavigator = new UBPageNavigationWidget(this);
addTabWidget(mpPageNavigator);
}
/**
* \brief The destructor
*/
UBLeftPalette::~UBLeftPalette()
{
if(NULL != mpPageNavigator)
{
delete mpPageNavigator;
mpPageNavigator = NULL;
}
}
/**
* \brief Update the maximum width
*/
void UBLeftPalette::updateMaxWidth()
{
setMaximumWidth(300);
}
/**
* \brief Handle the resize event
* @param event as the resize event
*/
void UBLeftPalette::resizeEvent(QResizeEvent *event)
{
UBDockPalette::resizeEvent(event);
if(NULL != mpPageNavigator)
{
mpPageNavigator->setMinimumHeight(height() - 2*border());
}
UBSettings::settings()->navigPaletteWidth->set(width());
}
UBPageNavigationWidget* UBLeftPalette::pageNavigator()
{
return mpPageNavigator;
}

@ -16,7 +16,6 @@
#define UBLEFTPALETTE_H
#include "UBDockPalette.h"
#include "UBPageNavigationWidget.h"
class UBLeftPalette : public UBDockPalette
{
@ -24,15 +23,9 @@ public:
UBLeftPalette(QWidget* parent=0, const char* name="UBLeftPalette");
~UBLeftPalette();
UBPageNavigationWidget* pageNavigator();
protected:
void updateMaxWidth();
void resizeEvent(QResizeEvent *event);
private:
UBPageNavigationWidget* mpPageNavigator;
};
#endif // UBLEFTPALETTE_H

@ -68,6 +68,7 @@ UBPageNavigationWidget::UBPageNavigationWidget(QWidget *parent, const char *name
mTimerID = startTimer(1000);
connect(mNavigator, SIGNAL(changeCurrentPage()), this, SLOT(changeCurrentPage()));
connect(UBApplication::boardController, SIGNAL(setDocOnPageNavigator(UBDocumentProxy*)), this, SLOT(onSetDocOnPageNavigator(UBDocumentProxy*)));
}
/**
@ -173,12 +174,29 @@ void UBPageNavigationWidget::setPageNumber(int current, int total)
mPageNbr->setText(QString("%1 / %2").arg(current).arg(total));
}
/**
* \brief Get the custom margin value
* @return the custom margin value
*/
int UBPageNavigationWidget::customMargin()
{
return 5;
}
/**
* \brief Get the border value
* @return the border value
*/
int UBPageNavigationWidget::border()
{
return 15;
}
/**
* \brief Set the current document
* @param doc as the current document
*/
void UBPageNavigationWidget::onSetDocOnPageNavigator(UBDocumentProxy *doc)
{
setDocument(doc);
}

@ -45,6 +45,9 @@ public slots:
protected:
virtual void timerEvent(QTimerEvent *event);
private slots:
void onSetDocOnPageNavigator(UBDocumentProxy* doc);
private:
void updateTime();
int customMargin();

@ -17,9 +17,10 @@
#include "UBRightPalette.h"
/**
* \brief The constructor
*/
UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(parent)
, mpLibWidget(NULL)
{
setObjectName(name);
setOrientation(eUBDockOrientation_Right);
@ -27,50 +28,32 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(
mLastWidth = 300;
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height());
mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin());
// Create and register the widgets
mpLibWidget = new UBLibWidget(this);
mpCachePropWidget = new UBCachePropertiesWidget(this);
registerWidget(mpLibWidget);
registerWidget(mpCachePropWidget);
// Add the visible widgets
addTabWidget(mpLibWidget);
connectSignals();
}
/**
* \brief The destructor
*/
UBRightPalette::~UBRightPalette()
{
if(NULL != mpLibWidget)
{
delete mpLibWidget;
mpLibWidget = NULL;
}
if(NULL != mpCachePropWidget)
{
delete mpCachePropWidget;
mpCachePropWidget = NULL;
}
}
UBLibWidget* UBRightPalette::libWidget()
{
return mpLibWidget;
}
/**
* \brief Handle the mouse move event
* @event as the mouse move event
*/
void UBRightPalette::mouseMoveEvent(QMouseEvent *event)
{
if(mCanResize)
{
UBDockPalette::mouseMoveEvent(event);
}
else
{
//qDebug() << "Mouse move event detected!" ;
}
}
/**
* \brief Handle the resize event
* @param event as the resize event
*/
void UBRightPalette::resizeEvent(QResizeEvent *event)
{
UBDockPalette::resizeEvent(event);
@ -78,39 +61,12 @@ void UBRightPalette::resizeEvent(QResizeEvent *event)
emit resized();
}
/**
* \brief Update the maximum width
*/
void UBRightPalette::updateMaxWidth()
{
setMaximumWidth((int)((parentWidget()->width() * 2)/3));
setMaximumHeight(parentWidget()->height());
setMinimumHeight(parentWidget()->height());
}
//void UBRightPalette::onCacheEnabled()
//{
// if(mpCachePropWidget->isHidden())
// {
// mpCachePropWidget->setVisible(true);
// // Add the cache tab
// addTabWidget(mpCachePropWidget);
// }
// // Set the cache of the current page as the active one for the properties widget
// mpCachePropWidget->updateCurrentCache();
// // Show the cache properties widget
// for(int i = 0; i < mTabWidgets.size(); i++)
// {
// if((NULL != mTabWidgets.at(i)) && ("CachePropWidget" == mTabWidgets.at(i)->name()))
// {
// showTabWidget(i);
// break;
// }
// }
//}
//void UBRightPalette::onCacheDisabled()
//{
// removeTab(mpCachePropWidget->name());
// mpCachePropWidget->hide();
//}

@ -16,8 +16,6 @@
#define UBRIGHTPALETTE_H
#include "UBDockPalette.h"
#include "UBLibWidget.h"
#include "UBCachePropertiesWidget.h"
class UBRightPalette : public UBDockPalette
{
@ -26,8 +24,6 @@ public:
UBRightPalette(QWidget* parent=0, const char* name="UBRightPalette");
~UBRightPalette();
UBLibWidget* libWidget();
signals:
void resized();
@ -35,14 +31,6 @@ protected:
void updateMaxWidth();
void mouseMoveEvent(QMouseEvent *event);
void resizeEvent(QResizeEvent *event);
private slots:
// void onCacheEnabled();
// void onCacheDisabled();
private:
UBLibWidget* mpLibWidget;
UBCachePropertiesWidget* mpCachePropWidget;
};
#endif // UBRIGHTPALETTE_H

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save