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

preferencesAboutTextFull
shibakaneki 13 years ago
commit 9e4aa8a568
  1. 117
      src/board/UBBoardPaletteManager.cpp
  2. 10
      src/board/UBBoardPaletteManager.h
  3. 9
      src/core/UBApplication.cpp
  4. 15
      src/core/UBApplicationController.cpp
  5. 75
      src/gui/UBCachePropertiesWidget.cpp
  6. 15
      src/gui/UBDockPalette.cpp
  7. 8
      src/gui/UBDockPalette.h
  8. 7
      src/gui/UBDockPaletteWidget.h

@ -19,6 +19,7 @@
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBSetting.h" #include "core/UBSetting.h"
#include "core/UBDisplayManager.h" #include "core/UBDisplayManager.h"
@ -162,20 +163,20 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mpPageNavigWidget = new UBPageNavigationWidget(); mpPageNavigWidget = new UBPageNavigationWidget();
mpPageNavigWidget->registerMode(eUBDockPaletteWidget_BOARD); mpPageNavigWidget->registerMode(eUBDockPaletteWidget_BOARD);
connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpLibWidget = new UBLibWidget(); mpLibWidget = new UBLibWidget();
mpLibWidget ->registerMode(eUBDockPaletteWidget_BOARD); mpLibWidget ->registerMode(eUBDockPaletteWidget_BOARD);
mpLibWidget ->registerMode(eUBDockPaletteWidget_DESKTOP); mpLibWidget ->registerMode(eUBDockPaletteWidget_DESKTOP);
connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
// mpCachePropWidget = new UBCachePropertiesWidget(); mpCachePropWidget = new UBCachePropertiesWidget();
// mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD); mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
// mpTeacherBarWidget = new UBTeacherBarWidget(); mpTeacherBarWidget = new UBTeacherBarWidget();
// mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD); mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode))); // connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
//------------------------------------------------// //------------------------------------------------//
// Add the dock palettes // Add the dock palettes
@ -183,7 +184,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
// LEFT palette widgets // LEFT palette widgets
mLeftPalette->registerWidget(mpPageNavigWidget); mLeftPalette->registerWidget(mpPageNavigWidget);
mLeftPalette->addTabWidget(mpPageNavigWidget); mLeftPalette->addTab(mpPageNavigWidget);
mLeftPalette->connectSignals(); mLeftPalette->connectSignals();
@ -193,24 +194,62 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
// RIGHT palette widgets // RIGHT palette widgets
mRightPalette->registerWidget(mpLibWidget); mRightPalette->registerWidget(mpLibWidget);
mRightPalette->addTabWidget(mpLibWidget); mRightPalette->addTab(mpLibWidget);
// // ??? // ???
// mRightPalette->registerWidget(mpCachePropWidget); mRightPalette->registerWidget(mpCachePropWidget);
// mRightPalette->addTabWidget(mpCachePropWidget); // mRightPalette->addTab(mpCachePropWidget);
// // ??? // ???
// mRightPalette->registerWidget(mpTeacherBarWidget); mRightPalette->registerWidget(mpTeacherBarWidget);
// mRightPalette->addTabWidget(mpTeacherBarWidget); mRightPalette->addTab(mpTeacherBarWidget);
mRightPalette->connectSignals(); mRightPalette->connectSignals();
//------------------------------------------------// //------------------------------------------------//
mLeftPalette->showTabWidget(0); changeMode(eUBDockPaletteWidget_BOARD, true);
mRightPalette->showTabWidget(0);
//------------------------------------------------// //------------------------------------------------//
// mLeftPalette->showTabWidget(0);
// mRightPalette->showTabWidget(0);
//
// //------------------------------------------------//
}
void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode)
{
switch( mainMode )
{
case UBApplicationController::Board:
// call changeMode only when switch NOT from desktop mode
if(!UBApplication::applicationController->isShowingDesktop())
changeMode(eUBDockPaletteWidget_BOARD);
break;
default:
break;
}
}
void UBBoardPaletteManager::slot_changeDesktopMode(bool isDesktop)
{
UBApplicationController::MainMode currMode = UBApplication::applicationController->displayMode();
if(!isDesktop)
{
switch( currMode )
{
case UBApplicationController::Board:
changeMode(eUBDockPaletteWidget_BOARD);
break;
default:
break;
}
}
else
changeMode(eUBDockPaletteWidget_DESKTOP);
} }
void UBBoardPaletteManager::setupPalettes() void UBBoardPaletteManager::setupPalettes()
@ -605,8 +644,39 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl)
} }
void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode) void UBBoardPaletteManager::processPalettersWidget(UBDockPalette *paletter, eUBDockPaletteWidgetMode mode)
{ {
//-------------------------------//
// get full right palette widgets list, parse it, show all widgets for BOARD mode, and hide all other
QVector<UBDockPaletteWidget*> widgetsList = paletter->GetWidgetsList();
for(int i = 0; i < widgetsList.size(); i++)
{
UBDockPaletteWidget* pNextWidget = widgetsList.at(i);
if( pNextWidget != NULL )
{
if( pNextWidget->GetRegisteredModes().contains(mode) )
{
paletter->addTab(pNextWidget);
}
else
{
paletter->removeTab(pNextWidget->name());
}
}
}
//-------------------------------//
if(widgetsList.size() > 0)
paletter->showTabWidget(0);
paletter->update();
}
void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool isInit)
{
processPalettersWidget(mRightPalette, newMode);
processPalettersWidget(mLeftPalette, newMode);
switch( newMode ) switch( newMode )
{ {
case eUBDockPaletteWidget_BOARD: case eUBDockPaletteWidget_BOARD:
@ -617,7 +687,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
mLeftPalette->setVisible(true); mLeftPalette->setVisible(true);
mRightPalette->setVisible(true); mRightPalette->setVisible(true);
containerResized(); if( !isInit )
containerResized();
} }
break; break;
@ -629,7 +700,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
mLeftPalette->setVisible(false); mLeftPalette->setVisible(false);
mRightPalette->setVisible(true); mRightPalette->setVisible(true);
UBApplication::applicationController->uninotesController()->TransparentWidgetResized(); if( !isInit )
UBApplication::applicationController->uninotesController()->TransparentWidgetResized();
} }
break; break;
@ -643,6 +715,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
break; break;
} }
if( !isInit )
UBApplication::boardController->notifyPageChanged();
emit signal_changeMode(newMode); emit signal_changeMode(newMode);
} }

@ -27,6 +27,9 @@
#include "gui/UBCachePropertiesWidget.h" #include "gui/UBCachePropertiesWidget.h"
#include "gui/UBTeacherBarWidget.h" #include "gui/UBTeacherBarWidget.h"
#include "core/UBApplicationController.h"
class UBStylusPalette; class UBStylusPalette;
class UBClockPalette; class UBClockPalette;
class UBPageNumberPalette; class UBPageNumberPalette;
@ -37,6 +40,7 @@ class UBFloatingPalette;
class UBServerXMLHttpRequest; class UBServerXMLHttpRequest;
class UBKeyboardPalette; class UBKeyboardPalette;
class UBMainWindow; class UBMainWindow;
class UBApplicationController;
class UBBoardPaletteManager : public QObject class UBBoardPaletteManager : public QObject
{ {
@ -57,7 +61,9 @@ class UBBoardPaletteManager : public QObject
UBKeyboardPalette *mKeyboardPalette; UBKeyboardPalette *mKeyboardPalette;
// UBRightPalette* createDesktopRightPalette(QWidget* parent); // UBRightPalette* createDesktopRightPalette(QWidget* parent);
void changeMode(eUBDockPaletteWidgetMode newMode); void processPalettersWidget(UBDockPalette *paletter, eUBDockPaletteWidgetMode mode);
void changeMode(eUBDockPaletteWidgetMode newMode, bool isInit = false);
signals: signals:
void connectToDocController(); void connectToDocController();
@ -71,6 +77,8 @@ class UBBoardPaletteManager : public QObject
void addItem(const QPixmap& pPixmap, const QPointF& p = QPointF(0.0, 0.0), qreal scale = 1.0, const QUrl& sourceUrl = QUrl()); 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); // void slot_changeMode(eUBDockPaletteWidgetMode newMode);
void slot_changeMainMode(UBApplicationController::MainMode);
void slot_changeDesktopMode(bool);
private: private:

@ -244,6 +244,15 @@ int UBApplication::exec(const QString& pFileToImport)
applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner);
connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)),
boardController->paletteManager(), SLOT(slot_changeMainMode(UBApplicationController::MainMode)));
connect(applicationController, SIGNAL(desktopMode(bool)),
boardController->paletteManager(), SLOT(slot_changeDesktopMode(bool)));
connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool))); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool)));
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized())); connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized()));

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

@ -6,6 +6,7 @@
#include "UBCachePropertiesWidget.h" #include "UBCachePropertiesWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
@ -269,40 +270,59 @@ void UBCachePropertiesWidget::updateShapeButtons()
void UBCachePropertiesWidget::updateCurrentCache() void UBCachePropertiesWidget::updateCurrentCache()
{ {
// Get the current page cache bool isBoardMode = false;
QList<QGraphicsItem*> items = UBApplication::boardController->activeScene()->items(); // this widget can work only on Board mode
foreach(QGraphicsItem* it, items) if( UBApplication::applicationController != NULL )
{ {
if("Cache" == it->data(Qt::UserRole).toString()) // if app controller is available, and current mode is Board, and no show desktop, than all ok, just process
{ if( UBApplication::applicationController->displayMode() == UBApplicationController::Board &&
setEnabled(true); !UBApplication::applicationController->isShowingDesktop())
emit showTab(name()); isBoardMode = true;
mpCurrentCache = dynamic_cast<UBGraphicsCache*>(it); }
if((NULL != mpCurrentCache) && (!mCaches.contains(mpCurrentCache))) // if app controller == null, than we do not know what mode now, so just process
{ else
mCaches.append(mpCurrentCache); isBoardMode = true;
}
// Update the values of the cache properties if(isBoardMode)
mpSizeSlider->setValue(mpCurrentCache->shapeWidth()); {
updateCacheColor(mpCurrentCache->maskColor()); // Get the current page cache
switch(mpCurrentCache->maskshape()) QList<QGraphicsItem*> items = UBApplication::boardController->activeScene()->items();
foreach(QGraphicsItem* it, items)
{
if("Cache" == it->data(Qt::UserRole).toString())
{ {
case eMaskShape_Circle: setEnabled(true);
mpCircleButton->setChecked(true); emit showTab(name());
mpSquareButton->setChecked(false); mpCurrentCache = dynamic_cast<UBGraphicsCache*>(it);
break; if((NULL != mpCurrentCache) && (!mCaches.contains(mpCurrentCache)))
case eMaskShap_Rectangle: {
mpCircleButton->setChecked(false); mCaches.append(mpCurrentCache);
mpSquareButton->setChecked(true); }
break;
// Update the values of the cache properties
mpSizeSlider->setValue(mpCurrentCache->shapeWidth());
updateCacheColor(mpCurrentCache->maskColor());
switch(mpCurrentCache->maskshape())
{
case eMaskShape_Circle:
mpCircleButton->setChecked(true);
mpSquareButton->setChecked(false);
break;
case eMaskShap_Rectangle:
mpCircleButton->setChecked(false);
mpSquareButton->setChecked(true);
break;
}
return;
} }
return;
} }
} }
// If we fall here, that means that this page has no cache // If we fall here, that means:
// 1 - that this page has no cache
// 2 - we do not on Board page
// 3 - we in board mode, but show desktop (as really - desktop mode)
emit hideTab(name()); emit hideTab(name());
mpCurrentCache = NULL; mpCurrentCache = NULL;
setDisabled(true); setDisabled(true);
@ -320,3 +340,4 @@ void UBCachePropertiesWidget::onCacheEnabled()
{ {
emit showTab(name()); emit showTab(name());
} }

@ -57,15 +57,15 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
if (parent) if (parent)
{ {
setAttribute(Qt::WA_NoMousePropagation); setAttribute(Qt::WA_NoMousePropagation);
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
} }
else else
{ {
// standalone window // standalone window
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
// !!!! Should be included into Windows after QT recompilation // !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
//setAttribute(Qt::WA_MacNoShadow); //setAttribute(Qt::WA_MacNoShadow);
#endif #endif
@ -540,7 +540,7 @@ int UBDockPalette::customMargin()
* \brief Add the given tab widget * \brief Add the given tab widget
* @param widget as the given widget * @param widget as the given widget
*/ */
void UBDockPalette::addTabWidget(UBDockPaletteWidget *widget) void UBDockPalette::addTab(UBDockPaletteWidget *widget)
{ {
if(!mTabWidgets.contains(widget)) if(!mTabWidgets.contains(widget))
{ {
@ -551,7 +551,6 @@ void UBDockPalette::addTabWidget(UBDockPaletteWidget *widget)
update(); update();
} }
} }
/** /**
* \brief Remove the given tab * \brief Remove the given tab
* @param widgetName as the tab widget name * @param widgetName as the tab widget name
@ -601,7 +600,7 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName)
UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i); UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i);
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName))
{ {
addTabWidget(pCrntWidget); addTab(pCrntWidget);
break; break;
} }
} }

@ -72,10 +72,13 @@ public:
void setBackgroundBrush(const QBrush& brush); void setBackgroundBrush(const QBrush& brush);
void registerWidget(UBDockPaletteWidget* widget); void registerWidget(UBDockPaletteWidget* widget);
void addTabWidget(UBDockPaletteWidget* widget); void addTab(UBDockPaletteWidget* widget);
void removeTab(const QString& widgetName); void removeTab(const QString& widgetName);
void connectSignals(); void connectSignals();
QVector<UBDockPaletteWidget*> GetWidgetsList() { return mRegisteredWidgets; };
public slots: public slots:
void onShowTabWidget(const QString& widgetName); void onShowTabWidget(const QString& widgetName);
void onHideTabWidget(const QString& widgetName); void onHideTabWidget(const QString& widgetName);
@ -90,7 +93,7 @@ protected:
/** The current dock orientation */ /** The current dock orientation */
eUBDockOrientation mOrientation; eUBDockOrientation mOrientation;
/** The current baclground brush */ /** The current background brush */
QBrush mBackgroundBrush; QBrush mBackgroundBrush;
/** The preferred width */ /** The preferred width */
int mPreferredWidth; int mPreferredWidth;
@ -123,7 +126,6 @@ protected:
/** The current widget */ /** The current widget */
QVector<UBDockPaletteWidget*> mRegisteredWidgets; QVector<UBDockPaletteWidget*> mRegisteredWidgets;
// QVector<UBDockPaletteWidget*> mVisibleWidgets; // ???
private slots: private slots:
void onToolbarPosUpdated(); void onToolbarPosUpdated();

@ -27,9 +27,7 @@ public:
void registerMode(eUBDockPaletteWidgetMode mode); void registerMode(eUBDockPaletteWidgetMode mode);
/* The current widget available mode list */ QVector<eUBDockPaletteWidgetMode> GetRegisteredModes() { return mRegisteredModes; };
QVector<eUBDockPaletteWidgetMode> mRegisteredModes;
signals: signals:
@ -45,6 +43,9 @@ protected:
QPixmap mIconToLeft; // arrow like this: < QPixmap mIconToLeft; // arrow like this: <
QString mName; QString mName;
/* The current widget available mode list */
QVector<eUBDockPaletteWidgetMode> mRegisteredModes;
}; };
#endif // UBDOCKPALETTEWIDGET_H #endif // UBDOCKPALETTEWIDGET_H

Loading…
Cancel
Save