|
|
|
@ -6,6 +6,7 @@ |
|
|
|
|
#include "UBCachePropertiesWidget.h" |
|
|
|
|
|
|
|
|
|
#include "core/UBApplication.h" |
|
|
|
|
#include "core/UBApplicationController.h" |
|
|
|
|
#include "board/UBBoardController.h" |
|
|
|
|
#include "domain/UBGraphicsScene.h" |
|
|
|
|
|
|
|
|
@ -91,7 +92,7 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na |
|
|
|
|
mpSizeLabel = new QLabel(tr("Size:"), mpProperties); |
|
|
|
|
mpSizeSlider = new QSlider(Qt::Horizontal, mpProperties); |
|
|
|
|
mpSizeSlider->setMinimumHeight(20); |
|
|
|
|
mpSizeSlider->setMinimum(0); |
|
|
|
|
mpSizeSlider->setMinimum(50); |
|
|
|
|
mpSizeSlider->setMaximum(MAX_SHAPE_WIDTH); |
|
|
|
|
mpSizeLayout->addWidget(mpSizeLabel, 0); |
|
|
|
|
mpSizeLayout->addWidget(mpSizeSlider, 1); |
|
|
|
@ -204,6 +205,8 @@ UBCachePropertiesWidget::~UBCachePropertiesWidget() |
|
|
|
|
|
|
|
|
|
void UBCachePropertiesWidget::onCloseClicked() |
|
|
|
|
{ |
|
|
|
|
if(!mCaches.empty()) |
|
|
|
|
{ |
|
|
|
|
// Remove the current cache from the list
|
|
|
|
|
mCaches.remove(mCaches.indexOf(mpCurrentCache)); |
|
|
|
|
|
|
|
|
@ -215,6 +218,9 @@ void UBCachePropertiesWidget::onCloseClicked() |
|
|
|
|
{ |
|
|
|
|
emit cacheListEmpty(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
emit hideTab(name()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UBCachePropertiesWidget::updateCacheColor(QColor color) |
|
|
|
@ -269,6 +275,21 @@ void UBCachePropertiesWidget::updateShapeButtons() |
|
|
|
|
|
|
|
|
|
void UBCachePropertiesWidget::updateCurrentCache() |
|
|
|
|
{ |
|
|
|
|
bool isBoardMode = false; |
|
|
|
|
// this widget can work only on Board mode
|
|
|
|
|
if( UBApplication::applicationController != NULL ) |
|
|
|
|
{ |
|
|
|
|
// 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 &&
|
|
|
|
|
!UBApplication::applicationController->isShowingDesktop()) |
|
|
|
|
isBoardMode = true; |
|
|
|
|
} |
|
|
|
|
// if app controller == null, than we do not know what mode now, so just process
|
|
|
|
|
else |
|
|
|
|
isBoardMode = true; |
|
|
|
|
|
|
|
|
|
if(isBoardMode) |
|
|
|
|
{ |
|
|
|
|
// Get the current page cache
|
|
|
|
|
QList<QGraphicsItem*> items = UBApplication::boardController->activeScene()->items(); |
|
|
|
|
foreach(QGraphicsItem* it, items) |
|
|
|
@ -301,8 +322,12 @@ void UBCachePropertiesWidget::updateCurrentCache() |
|
|
|
|
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()); |
|
|
|
|
mpCurrentCache = NULL; |
|
|
|
|
setDisabled(true); |
|
|
|
@ -320,3 +345,4 @@ void UBCachePropertiesWidget::onCacheEnabled() |
|
|
|
|
{ |
|
|
|
|
emit showTab(name()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|