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

preferencesAboutTextFull
Ivan Ilin 13 years ago
commit 8bcabeca95
  1. 1
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 119
      src/board/UBBoardPaletteManager.cpp
  3. 16
      src/board/UBBoardPaletteManager.h
  4. 2
      src/board/UBBoardView.cpp
  5. 16
      src/core/UBApplicationController.cpp
  6. 40
      src/desktop/UBDesktopAnnotationController.cpp
  7. 3
      src/desktop/UBDesktopAnnotationController.h
  8. 2
      src/domain/UBGraphicsScene.cpp
  9. 2
      src/gui/UBDockPalette.h
  10. 13
      src/gui/UBDockPaletteWidget.cpp
  11. 20
      src/gui/UBDockPaletteWidget.h

@ -2415,7 +2415,6 @@ UBGraphicsCurtainItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::curtainItemFromSvg
QRectF rect = curtainItem->rect();
rect.setWidth(svgWidth.toString().toFloat());
rect.setHeight(svgHeight.toString().toFloat());
rect.translate(-rect.center());
curtainItem->setRect(rect);

@ -38,6 +38,9 @@
#include "web/browser/WBTabWidget.h"
#include "web/browser/WBWebView.h"
#include "desktop/UBDesktopAnnotationController.h"
#include "network/UBNetworkAccessManager.h"
#include "network/UBServerXMLHttpRequest.h"
@ -76,7 +79,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
, mpPageNavigWidget(NULL)
, mpLibWidget(NULL)
, mpCachePropWidget(NULL)
, mDesktopRightPalette(NULL)
// , mDesktopRightPalette(NULL)
, mpTeacherBarWidget(NULL)
, mpDesktopLibWidget(NULL)
{
@ -131,11 +134,11 @@ UBBoardPaletteManager::~UBBoardPaletteManager()
delete mpDesktopLibWidget;
mpDesktopLibWidget = NULL;
}
if(NULL != mDesktopRightPalette)
{
delete mDesktopRightPalette;
mDesktopRightPalette = NULL;
}
// if(NULL != mDesktopRightPalette)
// {
// delete mDesktopRightPalette;
// mDesktopRightPalette = NULL;
// }
}
void UBBoardPaletteManager::initPalettesPosAtStartup()
@ -153,34 +156,65 @@ void UBBoardPaletteManager::setupLayout()
*/
void UBBoardPaletteManager::setupDockPaletteWidgets()
{
//------------------------------------------------//
// Create the widgets for the dock palettes
mpPageNavigWidget = new UBPageNavigationWidget();
mpPageNavigWidget->registerMode(eUBDockPaletteWidget_BOARD);
connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpLibWidget = new UBLibWidget();
mpLibWidget ->registerMode(eUBDockPaletteWidget_BOARD);
mpLibWidget ->registerMode(eUBDockPaletteWidget_DESKTOP);
connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
// mpCachePropWidget = new UBCachePropertiesWidget();
// mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
// mpTeacherBarWidget = new UBTeacherBarWidget();
// mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
//------------------------------------------------//
// Add the dock palettes
mLeftPalette = new UBLeftPalette(mContainer);
// LEFT palette widgets
mLeftPalette->registerWidget(mpPageNavigWidget);
mLeftPalette->addTabWidget(mpPageNavigWidget);
mLeftPalette->connectSignals();
//------------------------------------------------//
mRightPalette = new UBRightPalette(mContainer);
// RIGHT palette widgets
mRightPalette->registerWidget(mpLibWidget);
mRightPalette->registerWidget(mpCachePropWidget);
mRightPalette->addTabWidget(mpLibWidget);
mRightPalette->registerWidget(mpTeacherBarWidget);
// // ???
// mRightPalette->registerWidget(mpCachePropWidget);
// mRightPalette->addTabWidget(mpCachePropWidget);
// // ???
// mRightPalette->registerWidget(mpTeacherBarWidget);
// mRightPalette->addTabWidget(mpTeacherBarWidget);
mRightPalette->connectSignals();
//------------------------------------------------//
mLeftPalette->showTabWidget(0);
mRightPalette->showTabWidget(0);
//------------------------------------------------//
}
void UBBoardPaletteManager::setupPalettes()
{
// Add the dock palettes
mLeftPalette = new UBLeftPalette(mContainer);
mRightPalette = new UBRightPalette(mContainer);
// Create the widgets for the dock palettes
mpPageNavigWidget = new UBPageNavigationWidget();
mpLibWidget = new UBLibWidget();
mpCachePropWidget = new UBCachePropertiesWidget();
mpTeacherBarWidget = new UBTeacherBarWidget();
setupDockPaletteWidgets();
@ -435,6 +469,8 @@ void UBBoardPaletteManager::containerResized()
mKeyboardPalette->adjustSizeAndPosition();
}
mLeftPalette->resize(mLeftPalette->width()-1, mContainer->height());
mRightPalette->resize(mRightPalette->width()-1, mContainer->height());
mLeftPalette->resize(mLeftPalette->width(), mContainer->height());
mRightPalette->resize(mRightPalette->width(), mContainer->height());
}
@ -569,6 +605,53 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl)
}
void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
{
switch( newMode )
{
case eUBDockPaletteWidget_BOARD:
{
mLeftPalette->setParent(UBApplication::boardController->controlContainer());
mRightPalette->setParent(UBApplication::boardController->controlContainer());
mLeftPalette->setVisible(true);
mRightPalette->setVisible(true);
containerResized();
}
break;
case eUBDockPaletteWidget_DESKTOP:
{
mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mLeftPalette->setVisible(false);
mRightPalette->setVisible(true);
UBApplication::applicationController->uninotesController()->TransparentWidgetResized();
}
break;
default:
{
mLeftPalette->setVisible(false);
mRightPalette->setVisible(false);
mLeftPalette->setParent(0);
mRightPalette->setParent(0);
}
break;
}
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)
{
@ -719,6 +802,7 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var)
mStylusPalette->setVisible(bVisible); // always show stylus palette at startup
}
/*
UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent)
{
mpDesktopLibWidget = new UBLibWidget();
@ -729,6 +813,7 @@ UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent
return mDesktopRightPalette;
}
*/
void UBBoardPaletteManager::connectToDocumentController()
{

@ -48,15 +48,19 @@ class UBBoardPaletteManager : public QObject
void setupLayout();
UBLeftPalette* leftPalette(){return mLeftPalette;}
UBRightPalette* rightPalette(){return mRightPalette;}
void showVirtualKeyboard(bool show = true);
void initPalettesPosAtStartup();
void connectToDocumentController();
UBKeyboardPalette *mKeyboardPalette;
UBRightPalette* createDesktopRightPalette(QWidget* parent);
// UBRightPalette* createDesktopRightPalette(QWidget* parent);
void changeMode(eUBDockPaletteWidgetMode newMode);
signals:
void connectToDocController();
void signal_changeMode(eUBDockPaletteWidgetMode newMode);
public slots:
@ -65,6 +69,8 @@ class UBBoardPaletteManager : public QObject
void addItem(const QUrl& pUrl);
void addItem(const QPixmap& pPixmap, const QPointF& p = QPointF(0.0, 0.0), qreal scale = 1.0, const QUrl& sourceUrl = QUrl());
// void slot_changeMode(eUBDockPaletteWidgetMode newMode);
private:
void setupPalettes();
@ -84,10 +90,10 @@ class UBBoardPaletteManager : public QObject
/** The right dock palette */
UBRightPalette* mRightPalette;
// HACK: here we duplicate the right palette for the desktop mode
// we MUST refactor the architecture in order to use only one
// right palette!
UBRightPalette* mDesktopRightPalette;
// // HACK: here we duplicate the right palette for the desktop mode
// // we MUST refactor the architecture in order to use only one
// // right palette!
// UBRightPalette* mDesktopRightPalette;
UBActionPalette *mBackgroundsPalette;
UBActionPalette *mToolsPalette;

@ -660,8 +660,8 @@ UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
QBool isSlectedAndMouseHower = itemsList.contains(selItem);
if(isSlectedAndMouseHower)
{
wheelEvent->accept();
QGraphicsView::wheelEvent(wheelEvent);
wheelEvent->accept();
}
}

@ -336,6 +336,7 @@ void UBApplicationController::showBoard()
mMainWindow->boardToolBar->show();
mMainMode = Board;
UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_BOARD);
adaptToolBar();
@ -352,6 +353,8 @@ void UBApplicationController::showBoard()
mUninoteController->hideWindow();
mMainWindow->show();
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_BOARD);
emit mainModeChanged(Board);
}
@ -365,6 +368,8 @@ void UBApplicationController::showInternet()
UBApplication::boardController->hide();
}
UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_WEB);
if (UBSettings::settings()->webUseExternalBrowser->get().toBool())
{
showDesktop(true);
@ -384,8 +389,10 @@ void UBApplicationController::showInternet()
mUninoteController->hideWindow();
emit mainModeChanged(Internet);
}
UBApplication::webController->show(UBWebController::WebBrowser);
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_WEB);
UBApplication::webController->show(UBWebController::WebBrowser);
}
@ -397,6 +404,7 @@ void UBApplicationController::showDocument()
mMainWindow->documentToolBar->show();
mMainMode = Document;
UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DOCUMENT);
adaptToolBar();
@ -418,6 +426,8 @@ void UBApplicationController::showDocument()
mUninoteController->hideWindow();
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DOCUMENT);
emit mainModeChanged(Document);
}
@ -429,6 +439,8 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBApplication::boardController->hide();
mMainWindow->hide();
UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DESKTOP);
mUninoteController->showWindow();
if (mMirror)
@ -444,6 +456,8 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBPlatformUtils::bringPreviousProcessToFront();
}
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DESKTOP);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
}

@ -56,7 +56,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mDesktopPenPalette(NULL)
, mDesktopMarkerPalette(NULL)
, mDesktopEraserPalette(NULL)
, mRightPalette(NULL)
// , mRightPalette(NULL)
, mWindowPositionInitialized(0)
, mIsFullyTransparent(false)
, mDesktopToolsPalettePositioned(false)
@ -89,7 +89,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingScene = new UBGraphicsScene(0);
mTransparentDrawingView->setScene(mTransparentDrawingScene);
mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView);
// mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView);
//mRightPalette = new UBRightPalette(mTransparentDrawingView);
mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView);
@ -158,7 +158,8 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
#ifdef Q_WS_X11
connect(mDesktopPalette, SIGNAL(moving()), this, SLOT(refreshMask()));
connect(mRightPalette, SIGNAL(resized()), this, SLOT(refreshMask()));
// connect(mRightPalette, SIGNAL(resized()), this, SLOT(refreshMask()));
connect(UBApplication::boardController->paletteManager()->rightPalette(), SIGNAL(resized()), this, SLOT(refreshMask()));
#endif
onDesktopPaletteMaximized();
}
@ -859,12 +860,34 @@ void UBDesktopAnnotationController::onDesktopPaletteMinimize()
}
}
void UBDesktopAnnotationController::TransparentWidgetResized()
{
/*
int rW = UBApplication::boardController->paletteManager()->rightPalette()->width();
int rH_ = UBApplication::boardController->paletteManager()->rightPalette()->height();
int rH = mTransparentDrawingView->height();
UBApplication::boardController->paletteManager()->rightPalette()->resize(rW+1, rH);
// UBApplication::boardController->paletteManager()->rightPalette()->resize(500, 500);
*/
onTransparentWidgetResized();
}
/**
* \brief Resize the library palette.
*/
void UBDesktopAnnotationController::onTransparentWidgetResized()
{
mRightPalette->resize(mRightPalette->width(), mTransparentDrawingView->height());
int rW = UBApplication::boardController->paletteManager()->rightPalette()->width();
int rH_ = UBApplication::boardController->paletteManager()->rightPalette()->height();
int rH = mTransparentDrawingView->height();
UBApplication::boardController->paletteManager()->rightPalette()->resize(rW+1, rH);
UBApplication::boardController->paletteManager()->rightPalette()->resize(rW, rH);
// mRightPalette->resize(mRightPalette->width(), mTransparentDrawingView->height());
}
void UBDesktopAnnotationController::updateMask(bool bTransparent)
@ -891,10 +914,15 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
{
p.drawRect(mKeyboardPalette->geometry().x(), mKeyboardPalette->geometry().y(), mKeyboardPalette->width(), mKeyboardPalette->height());
}
if(mRightPalette->isVisible())
// UBApplication::boardController->paletteManager()->mDesktopRightPalette
if(UBApplication::boardController->paletteManager()->rightPalette()->isVisible())
{
qDebug() << ">>>>>> Drawing the mask for the right palette";
p.drawRect(mRightPalette->geometry().x(), mRightPalette->geometry().y(), mRightPalette->width(), mRightPalette->height());
p.drawRect(UBApplication::boardController->paletteManager()->rightPalette()->geometry().x(),
UBApplication::boardController->paletteManager()->rightPalette()->geometry().y(),
UBApplication::boardController->paletteManager()->rightPalette()->width(),
UBApplication::boardController->paletteManager()->rightPalette()->height());
}
p.end();

@ -55,6 +55,9 @@ class UBDesktopAnnotationController : public QObject
UBDesktopPalette *desktopPalette();
UBBoardView *drawingView();
void TransparentWidgetResized();
public slots:
void screenLayoutChanged();

@ -1171,7 +1171,7 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
if (graphicsWidget->widgetWebView()->canBeContent())
{
graphicsWidget->widgetWebView()->loadMainHtml();
// graphicsWidget->widgetWebView()->loadMainHtml();
graphicsWidget->setSelected(true);
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget);

@ -123,6 +123,8 @@ protected:
/** The current widget */
QVector<UBDockPaletteWidget*> mRegisteredWidgets;
// QVector<UBDockPaletteWidget*> mVisibleWidgets; // ???
private slots:
void onToolbarPosUpdated();
void onResizeRequest(QResizeEvent* event);

@ -24,3 +24,16 @@ QString UBDockPaletteWidget::name()
{
return mName;
}
void UBDockPaletteWidget::registerMode(eUBDockPaletteWidgetMode mode)
{
if(!mRegisteredModes.contains(mode))
mRegisteredModes.append(mode);
}
void UBDockPaletteWidget::slot_changeMode(eUBDockPaletteWidgetMode newMode)
{
this->setVisible(mRegisteredModes.contains(newMode));
}

@ -5,8 +5,17 @@
#include <QPixmap>
#include <QString>
typedef enum
{
eUBDockPaletteWidget_BOARD,
eUBDockPaletteWidget_WEB,
eUBDockPaletteWidget_DOCUMENT,
eUBDockPaletteWidget_DESKTOP,
} eUBDockPaletteWidgetMode;
class UBDockPaletteWidget : public QWidget
{
Q_OBJECT
public:
UBDockPaletteWidget(QWidget* parent=0, const char* name="UBDockPaletteWidget");
@ -16,10 +25,21 @@ public:
QPixmap iconToLeft();
QString name();
void registerMode(eUBDockPaletteWidgetMode mode);
/* The current widget available mode list */
QVector<eUBDockPaletteWidgetMode> mRegisteredModes;
signals:
void hideTab(const QString& widgetName);
void showTab(const QString& widgetName);
public slots:
void slot_changeMode(eUBDockPaletteWidgetMode newMode);
protected:
QPixmap mIconToRight; // arrow like this: >
QPixmap mIconToLeft; // arrow like this: <

Loading…
Cancel
Save