|
|
@ -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" |
|
|
|
|
|
|
|
|
|
|
@ -91,7 +92,7 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na |
|
|
|
mpSizeLabel = new QLabel(tr("Size:"), mpProperties); |
|
|
|
mpSizeLabel = new QLabel(tr("Size:"), mpProperties); |
|
|
|
mpSizeSlider = new QSlider(Qt::Horizontal, mpProperties); |
|
|
|
mpSizeSlider = new QSlider(Qt::Horizontal, mpProperties); |
|
|
|
mpSizeSlider->setMinimumHeight(20); |
|
|
|
mpSizeSlider->setMinimumHeight(20); |
|
|
|
mpSizeSlider->setMinimum(0); |
|
|
|
mpSizeSlider->setMinimum(50); |
|
|
|
mpSizeSlider->setMaximum(MAX_SHAPE_WIDTH); |
|
|
|
mpSizeSlider->setMaximum(MAX_SHAPE_WIDTH); |
|
|
|
mpSizeLayout->addWidget(mpSizeLabel, 0); |
|
|
|
mpSizeLayout->addWidget(mpSizeLabel, 0); |
|
|
|
mpSizeLayout->addWidget(mpSizeSlider, 1); |
|
|
|
mpSizeLayout->addWidget(mpSizeSlider, 1); |
|
|
@ -204,16 +205,21 @@ UBCachePropertiesWidget::~UBCachePropertiesWidget() |
|
|
|
|
|
|
|
|
|
|
|
void UBCachePropertiesWidget::onCloseClicked() |
|
|
|
void UBCachePropertiesWidget::onCloseClicked() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Remove the current cache from the list
|
|
|
|
if(!mCaches.empty()) |
|
|
|
mCaches.remove(mCaches.indexOf(mpCurrentCache)); |
|
|
|
{ |
|
|
|
|
|
|
|
// Remove the current cache from the list
|
|
|
|
|
|
|
|
mCaches.remove(mCaches.indexOf(mpCurrentCache)); |
|
|
|
|
|
|
|
|
|
|
|
// Remove the cache from the board
|
|
|
|
// Remove the cache from the board
|
|
|
|
UBApplication::boardController->activeScene()->removeItem(mpCurrentCache); |
|
|
|
UBApplication::boardController->activeScene()->removeItem(mpCurrentCache); |
|
|
|
mpCurrentCache = NULL; |
|
|
|
mpCurrentCache = NULL; |
|
|
|
|
|
|
|
|
|
|
|
if(mCaches.empty()) |
|
|
|
if(mCaches.empty()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
emit cacheListEmpty(); |
|
|
|
emit cacheListEmpty(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
emit hideTab(name()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -269,40 +275,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 are not in Board mode
|
|
|
|
|
|
|
|
// 3 - we are 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 +345,4 @@ void UBCachePropertiesWidget::onCacheEnabled() |
|
|
|
{ |
|
|
|
{ |
|
|
|
emit showTab(name()); |
|
|
|
emit showTab(name()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|