commit
3bd44ffc16
After Width: | Height: | Size: 423 B |
After Width: | Height: | Size: 689 B |
After Width: | Height: | Size: 681 B |
After Width: | Height: | Size: 321 B |
@ -0,0 +1,52 @@ |
|||||||
|
QWidget#DockPaletteWidgetBox |
||||||
|
{ |
||||||
|
background: #EEEEEE; |
||||||
|
border-radius: 10px; |
||||||
|
border: 2px solid #999999; |
||||||
|
} |
||||||
|
|
||||||
|
QColorDialog |
||||||
|
{ |
||||||
|
background: #EEEEEE; |
||||||
|
} |
||||||
|
|
||||||
|
QLabel#DockPaletteWidgetTitle |
||||||
|
{ |
||||||
|
color: #FFFFFF; |
||||||
|
font-size : 18px; |
||||||
|
font-weight:bold; |
||||||
|
} |
||||||
|
|
||||||
|
QPushButton#DockPaletteWidgetButton |
||||||
|
{ |
||||||
|
background-color : #DDDDDD; |
||||||
|
color : #555555; |
||||||
|
border-radius : 6px; |
||||||
|
padding : 5px; |
||||||
|
font-weight : bold; |
||||||
|
font-size : 12px; |
||||||
|
} |
||||||
|
|
||||||
|
QPushButton#DockPaletteWidgetButton::checked |
||||||
|
{ |
||||||
|
background-color: #BBBBBB; |
||||||
|
} |
||||||
|
|
||||||
|
QSlider::handle::horizontal |
||||||
|
{ |
||||||
|
background-color:#EEEEEE; |
||||||
|
margin-top:-5px; |
||||||
|
margin-bottom:-5px; |
||||||
|
height:20px; |
||||||
|
width:18px; |
||||||
|
border-radius:10px; |
||||||
|
border:1px solid #555555; |
||||||
|
} |
||||||
|
|
||||||
|
QSlider::groove::horizontal |
||||||
|
{ |
||||||
|
background-color:#999999; |
||||||
|
height:10px; |
||||||
|
border-radius:5px; |
||||||
|
border:1px solid #555555; |
||||||
|
} |
@ -1,85 +0,0 @@ |
|||||||
/*
|
|
||||||
* This program is free software: you can redistribute it and/or modify |
|
||||||
* it under the terms of the GNU General Public License as published by |
|
||||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||||
* (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/ |
|
||||||
#include "UBDesktopToolsPalette.h" |
|
||||||
|
|
||||||
#include "core/UBApplication.h" |
|
||||||
#include "core/UBSettings.h" |
|
||||||
|
|
||||||
#include "board/UBBoardController.h" |
|
||||||
#include "board/UBDrawingController.h" |
|
||||||
|
|
||||||
#include "gui/UBMainWindow.h" |
|
||||||
#include "gui/UBToolbarButtonGroup.h" |
|
||||||
|
|
||||||
#include "core/memcheck.h" |
|
||||||
|
|
||||||
UBDesktopToolsPalette::UBDesktopToolsPalette(QWidget *parent) |
|
||||||
: UBActionPalette(Qt::Horizontal, parent) |
|
||||||
{ |
|
||||||
// Setup color choice widget
|
|
||||||
QList<QAction *> colorActions; |
|
||||||
colorActions.append(UBApplication::mainWindow->actionColor0); |
|
||||||
colorActions.append(UBApplication::mainWindow->actionColor1); |
|
||||||
colorActions.append(UBApplication::mainWindow->actionColor2); |
|
||||||
colorActions.append(UBApplication::mainWindow->actionColor3); |
|
||||||
|
|
||||||
UBToolbarButtonGroup *colorChoice = |
|
||||||
new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions); |
|
||||||
|
|
||||||
colorChoice->displayText(false); |
|
||||||
|
|
||||||
//connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
|
|
||||||
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int))); |
|
||||||
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged())); |
|
||||||
|
|
||||||
layout()->addWidget(colorChoice); |
|
||||||
|
|
||||||
// Setup line width choice widget
|
|
||||||
QList<QAction *> lineWidthActions; |
|
||||||
lineWidthActions.append(UBApplication::mainWindow->actionLineSmall); |
|
||||||
lineWidthActions.append(UBApplication::mainWindow->actionLineMedium); |
|
||||||
lineWidthActions.append(UBApplication::mainWindow->actionLineLarge); |
|
||||||
|
|
||||||
UBToolbarButtonGroup *lineWidthChoice = |
|
||||||
new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions); |
|
||||||
lineWidthChoice->displayText(false); |
|
||||||
|
|
||||||
connect(lineWidthChoice, SIGNAL(activated(int)) |
|
||||||
, UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int))); |
|
||||||
|
|
||||||
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)) |
|
||||||
, lineWidthChoice, SLOT(setCurrentIndex(int))); |
|
||||||
|
|
||||||
layout()->addWidget(lineWidthChoice); |
|
||||||
|
|
||||||
// Setup eraser width choice widget
|
|
||||||
QList<QAction *> eraserWidthActions; |
|
||||||
eraserWidthActions.append(UBApplication::mainWindow->actionEraserSmall); |
|
||||||
eraserWidthActions.append(UBApplication::mainWindow->actionEraserMedium); |
|
||||||
eraserWidthActions.append(UBApplication::mainWindow->actionEraserLarge); |
|
||||||
|
|
||||||
UBToolbarButtonGroup *eraserWidthChoice = |
|
||||||
new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, eraserWidthActions); |
|
||||||
|
|
||||||
connect(eraserWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setEraserWidthIndex(int))); |
|
||||||
|
|
||||||
eraserWidthChoice->displayText(false); |
|
||||||
eraserWidthChoice->setCurrentIndex(UBSettings::settings()->eraserWidthIndex()); |
|
||||||
|
|
||||||
layout()->addWidget(eraserWidthChoice); |
|
||||||
|
|
||||||
addAction(UBApplication::mainWindow->actionEraseDesktopAnnotations); |
|
||||||
|
|
||||||
} |
|
@ -1,29 +0,0 @@ |
|||||||
/*
|
|
||||||
* This program is free software: you can redistribute it and/or modify |
|
||||||
* it under the terms of the GNU General Public License as published by |
|
||||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||||
* (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/ |
|
||||||
#ifndef UBDESKTOPTOOLSPALETTE_H |
|
||||||
#define UBDESKTOPTOOLSPALETTE_H |
|
||||||
|
|
||||||
#include <QtGui> |
|
||||||
|
|
||||||
#include "gui/UBActionPalette.h" |
|
||||||
|
|
||||||
class UBDesktopToolsPalette : public UBActionPalette |
|
||||||
{ |
|
||||||
public: |
|
||||||
UBDesktopToolsPalette(QWidget *parent = 0); |
|
||||||
virtual ~UBDesktopToolsPalette(){} |
|
||||||
}; |
|
||||||
|
|
||||||
#endif // UBDESKTOPTOOLSPALETTE_H
|
|
@ -0,0 +1,317 @@ |
|||||||
|
#include <QColor> |
||||||
|
#include <QPainter> |
||||||
|
#include <QPixmap> |
||||||
|
#include <QColorDialog> |
||||||
|
|
||||||
|
#include "UBCachePropertiesWidget.h" |
||||||
|
|
||||||
|
#include "core/UBApplication.h" |
||||||
|
#include "board/UBBoardController.h" |
||||||
|
#include "domain/UBGraphicsScene.h" |
||||||
|
|
||||||
|
static QVector<UBGraphicsCache*> mCaches; |
||||||
|
|
||||||
|
UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) |
||||||
|
, mpLayout(NULL) |
||||||
|
, mpCachePropertiesLabel(NULL) |
||||||
|
, mpColorLabel(NULL) |
||||||
|
, mpShapeLabel(NULL) |
||||||
|
, mpSizeLabel(NULL) |
||||||
|
, mpColor(NULL) |
||||||
|
, mpSquareButton(NULL) |
||||||
|
, mpCircleButton(NULL) |
||||||
|
, mpCloseButton(NULL) |
||||||
|
, mpSizeSlider(NULL) |
||||||
|
, mpColorLayout(NULL) |
||||||
|
, mpShapeLayout(NULL) |
||||||
|
, mpSizeLayout(NULL) |
||||||
|
, mpCloseLayout(NULL) |
||||||
|
, mpProperties(NULL) |
||||||
|
, mpPropertiesLayout(NULL) |
||||||
|
, mpCurrentCache(NULL) |
||||||
|
{ |
||||||
|
setObjectName(name); |
||||||
|
setAttribute(Qt::WA_StyledBackground, true); |
||||||
|
setStyleSheet(UBApplication::globalStyleSheet()); |
||||||
|
|
||||||
|
mName = "CachePropWidget"; |
||||||
|
mIconToLeft = QPixmap(":images/cache_open.png"); |
||||||
|
mIconToRight = QPixmap(":images/cache_close.png"); |
||||||
|
setContentsMargins(10, 10, 10, 10); |
||||||
|
|
||||||
|
// Build the UI
|
||||||
|
mpLayout = new QVBoxLayout(); |
||||||
|
setLayout(mpLayout); |
||||||
|
|
||||||
|
// Title
|
||||||
|
mpCachePropertiesLabel = new QLabel(tr("Cache Properties"), this); |
||||||
|
mpCachePropertiesLabel->setObjectName("DockPaletteWidgetTitle"); |
||||||
|
mpLayout->addWidget(mpCachePropertiesLabel, 0); |
||||||
|
|
||||||
|
// Properties Box
|
||||||
|
mpProperties = new QWidget(this); |
||||||
|
mpProperties->setObjectName("DockPaletteWidgetBox"); |
||||||
|
mpLayout->addWidget(mpProperties, 1); |
||||||
|
mpPropertiesLayout = new QVBoxLayout(); |
||||||
|
mpProperties->setLayout(mpPropertiesLayout); |
||||||
|
|
||||||
|
|
||||||
|
// Color
|
||||||
|
mpColorLayout = new QHBoxLayout(); |
||||||
|
mpColorLabel = new QLabel(tr("Color:"), mpProperties); |
||||||
|
mpColor = new QPushButton(mpProperties); |
||||||
|
mpColor->setObjectName("DockPaletteWidgetButton"); |
||||||
|
// TODO: Check in the document if the page has a color and assign it to this cache
|
||||||
|
// else set the black color by default
|
||||||
|
updateCacheColor(Qt::black); |
||||||
|
mpColorLayout->addWidget(mpColorLabel, 0); |
||||||
|
mpColorLayout->addWidget(mpColor, 0); |
||||||
|
mpColorLayout->addStretch(1); |
||||||
|
mpPropertiesLayout->addLayout(mpColorLayout, 0); |
||||||
|
|
||||||
|
// Shape
|
||||||
|
mpShapeLayout = new QHBoxLayout(); |
||||||
|
mpShapeLabel = new QLabel(tr("Shape:"), mpProperties); |
||||||
|
mpSquareButton = new QPushButton(mpProperties); |
||||||
|
mpSquareButton->setIcon(QIcon(":images/cache_square.png")); |
||||||
|
mpSquareButton->setObjectName("DockPaletteWidgetButton"); |
||||||
|
mpSquareButton->setCheckable(true); |
||||||
|
mpCircleButton = new QPushButton(mpProperties); |
||||||
|
mpCircleButton->setIcon(QIcon(":images/cache_circle.png")); |
||||||
|
mpCircleButton->setObjectName("DockPaletteWidgetButton"); |
||||||
|
mpCircleButton->setCheckable(true); |
||||||
|
mpShapeLayout->addWidget(mpShapeLabel, 0); |
||||||
|
mpShapeLayout->addWidget(mpSquareButton, 0); |
||||||
|
mpShapeLayout->addWidget(mpCircleButton, 0); |
||||||
|
mpShapeLayout->addStretch(1); |
||||||
|
mpPropertiesLayout->addLayout(mpShapeLayout, 0); |
||||||
|
|
||||||
|
// TODO: Check in the document which shape is saved and check the corresponding button
|
||||||
|
mpCircleButton->setChecked(true); |
||||||
|
|
||||||
|
// Shape Size
|
||||||
|
mpSizeLayout = new QHBoxLayout(); |
||||||
|
mpSizeLabel = new QLabel(tr("Size:"), mpProperties); |
||||||
|
mpSizeSlider = new QSlider(Qt::Horizontal, mpProperties); |
||||||
|
mpSizeSlider->setMinimumHeight(20); |
||||||
|
mpSizeSlider->setMinimum(0); |
||||||
|
mpSizeSlider->setMaximum(MAX_SHAPE_WIDTH); |
||||||
|
mpSizeLayout->addWidget(mpSizeLabel, 0); |
||||||
|
mpSizeLayout->addWidget(mpSizeSlider, 1); |
||||||
|
mpPropertiesLayout->addLayout(mpSizeLayout, 0); |
||||||
|
|
||||||
|
// Close
|
||||||
|
mpCloseLayout = new QHBoxLayout(); |
||||||
|
mpCloseButton = new QPushButton(tr("Close"), mpProperties); |
||||||
|
mpCloseButton->setObjectName("DockPaletteWidgetButton"); |
||||||
|
mpCloseLayout->addWidget(mpCloseButton, 0); |
||||||
|
mpCloseLayout->addStretch(1); |
||||||
|
mpPropertiesLayout->addLayout(mpCloseLayout, 0); |
||||||
|
|
||||||
|
// Fill the empty space
|
||||||
|
mpPropertiesLayout->addStretch(1); |
||||||
|
|
||||||
|
// Connect signals / slots
|
||||||
|
connect(mpCloseButton, SIGNAL(clicked()), this, SLOT(onCloseClicked())); |
||||||
|
connect(mpColor, SIGNAL(clicked()), this, SLOT(onColorClicked())); |
||||||
|
connect(mpCircleButton, SIGNAL(clicked()), this, SLOT(updateShapeButtons())); |
||||||
|
connect(mpSquareButton, SIGNAL(clicked()), this, SLOT(updateShapeButtons())); |
||||||
|
connect(mpSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(onSizeChanged(int))); |
||||||
|
connect(UBApplication::boardController, SIGNAL(pageChanged()), this, SLOT(updateCurrentCache())); |
||||||
|
} |
||||||
|
|
||||||
|
UBCachePropertiesWidget::~UBCachePropertiesWidget() |
||||||
|
{ |
||||||
|
if(NULL != mpCachePropertiesLabel) |
||||||
|
{ |
||||||
|
delete mpCachePropertiesLabel; |
||||||
|
mpCachePropertiesLabel = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpColorLabel) |
||||||
|
{ |
||||||
|
delete mpColorLabel; |
||||||
|
mpColorLabel = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpShapeLabel) |
||||||
|
{ |
||||||
|
delete mpShapeLabel; |
||||||
|
mpShapeLabel = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpSizeLabel) |
||||||
|
{ |
||||||
|
delete mpSizeLabel; |
||||||
|
mpSizeLabel = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpColor) |
||||||
|
{ |
||||||
|
delete mpColor; |
||||||
|
mpColor = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpSquareButton) |
||||||
|
{ |
||||||
|
delete mpSquareButton; |
||||||
|
mpSquareButton = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpCircleButton) |
||||||
|
{ |
||||||
|
delete mpCircleButton; |
||||||
|
mpCircleButton = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpCloseButton) |
||||||
|
{ |
||||||
|
delete mpCloseButton; |
||||||
|
mpCloseButton = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpSizeSlider) |
||||||
|
{ |
||||||
|
delete mpSizeSlider; |
||||||
|
mpSizeSlider = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpColorLayout) |
||||||
|
{ |
||||||
|
delete mpColorLayout; |
||||||
|
mpColorLayout = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpShapeLayout) |
||||||
|
{ |
||||||
|
delete mpShapeLayout; |
||||||
|
mpShapeLayout = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpSizeLayout) |
||||||
|
{ |
||||||
|
delete mpSizeLayout; |
||||||
|
mpSizeLayout = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpCloseLayout) |
||||||
|
{ |
||||||
|
delete mpCloseLayout; |
||||||
|
mpCloseLayout = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpPropertiesLayout) |
||||||
|
{ |
||||||
|
delete mpPropertiesLayout; |
||||||
|
mpPropertiesLayout = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpProperties) |
||||||
|
{ |
||||||
|
delete mpProperties; |
||||||
|
mpProperties = NULL; |
||||||
|
} |
||||||
|
if(NULL != mpLayout) |
||||||
|
{ |
||||||
|
delete mpLayout; |
||||||
|
mpLayout = NULL; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void UBCachePropertiesWidget::onCloseClicked() |
||||||
|
{ |
||||||
|
// Remove the current cache from the list
|
||||||
|
mCaches.remove(mCaches.indexOf(mpCurrentCache)); |
||||||
|
|
||||||
|
// Remove the cache from the board
|
||||||
|
UBApplication::boardController->activeScene()->removeItem(mpCurrentCache); |
||||||
|
mpCurrentCache = NULL; |
||||||
|
|
||||||
|
if(mCaches.empty()) |
||||||
|
{ |
||||||
|
emit cacheListEmpty(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void UBCachePropertiesWidget::updateCacheColor(QColor color) |
||||||
|
{ |
||||||
|
mActualColor = color; |
||||||
|
|
||||||
|
// Update the color on the color button
|
||||||
|
QPixmap pix(32, 32); |
||||||
|
QPainter p; |
||||||
|
|
||||||
|
p.begin(&pix); |
||||||
|
|
||||||
|
p.setBackground(Qt::transparent); |
||||||
|
p.setBrush(color); // The current color
|
||||||
|
p.drawRect(0, 0, 32, 32); |
||||||
|
|
||||||
|
p.end(); |
||||||
|
|
||||||
|
mpColor->setIcon(QIcon(pix)); |
||||||
|
|
||||||
|
if(NULL != mpCurrentCache) |
||||||
|
{ |
||||||
|
mpCurrentCache->setMaskColor(mActualColor); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void UBCachePropertiesWidget::onColorClicked() |
||||||
|
{ |
||||||
|
// Show the color picker
|
||||||
|
QColor newColor = QColorDialog::getColor(mActualColor,this); |
||||||
|
updateCacheColor(newColor); |
||||||
|
} |
||||||
|
|
||||||
|
void UBCachePropertiesWidget::updateShapeButtons() |
||||||
|
{ |
||||||
|
if(mpCircleButton->hasFocus()) |
||||||
|
{ |
||||||
|
mActualShape = eMaskShape_Circle; |
||||||
|
mpSquareButton->setChecked(false); |
||||||
|
} |
||||||
|
else if(mpSquareButton->hasFocus()) |
||||||
|
{ |
||||||
|
mActualShape = eMaskShap_Rectangle; |
||||||
|
mpCircleButton->setChecked(false); |
||||||
|
} |
||||||
|
|
||||||
|
if(NULL != mpCurrentCache) |
||||||
|
{ |
||||||
|
mpCurrentCache->setMaskShape(mActualShape); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void UBCachePropertiesWidget::updateCurrentCache() |
||||||
|
{ |
||||||
|
// Get the current page cache
|
||||||
|
QList<QGraphicsItem*> items = UBApplication::boardController->activeScene()->items(); |
||||||
|
foreach(QGraphicsItem* it, items) |
||||||
|
{ |
||||||
|
if("Cache" == it->data(Qt::UserRole).toString()) |
||||||
|
{ |
||||||
|
setEnabled(true); |
||||||
|
mpCurrentCache = dynamic_cast<UBGraphicsCache*>(it); |
||||||
|
if((NULL != mpCurrentCache) && (!mCaches.contains(mpCurrentCache))) |
||||||
|
{ |
||||||
|
mCaches.append(mpCurrentCache); |
||||||
|
} |
||||||
|
|
||||||
|
// 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; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// If we fall here, that means that this page has no cache
|
||||||
|
mpCurrentCache = NULL; |
||||||
|
setDisabled(true); |
||||||
|
} |
||||||
|
|
||||||
|
void UBCachePropertiesWidget::onSizeChanged(int newSize) |
||||||
|
{ |
||||||
|
if(NULL != mpCurrentCache) |
||||||
|
{ |
||||||
|
mpCurrentCache->setShapeWidth(newSize); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,60 @@ |
|||||||
|
#ifndef UBCACHEPROPERTIESWIDGET_H |
||||||
|
#define UBCACHEPROPERTIESWIDGET_H |
||||||
|
|
||||||
|
#include <QWidget> |
||||||
|
#include <QVBoxLayout> |
||||||
|
#include <QLabel> |
||||||
|
#include <QHBoxLayout> |
||||||
|
#include <QPushButton> |
||||||
|
#include <QSlider> |
||||||
|
#include <QVector> |
||||||
|
|
||||||
|
#include "UBDockPaletteWidget.h" |
||||||
|
#include "tools/UBGraphicsCache.h" |
||||||
|
|
||||||
|
#define MAX_SHAPE_WIDTH 200 |
||||||
|
|
||||||
|
class UBCachePropertiesWidget : public UBDockPaletteWidget |
||||||
|
{ |
||||||
|
Q_OBJECT |
||||||
|
public: |
||||||
|
UBCachePropertiesWidget(QWidget* parent=0, const char* name="UBCachePropertiesWidget"); |
||||||
|
~UBCachePropertiesWidget(); |
||||||
|
|
||||||
|
public slots: |
||||||
|
void updateCurrentCache(); |
||||||
|
|
||||||
|
signals: |
||||||
|
void cacheListEmpty(); |
||||||
|
|
||||||
|
private slots: |
||||||
|
void onCloseClicked(); |
||||||
|
void updateCacheColor(QColor color); |
||||||
|
void onColorClicked(); |
||||||
|
void updateShapeButtons(); |
||||||
|
void onSizeChanged(int newSize); |
||||||
|
|
||||||
|
private: |
||||||
|
QVBoxLayout* mpLayout; |
||||||
|
QLabel* mpCachePropertiesLabel; |
||||||
|
QLabel* mpColorLabel; |
||||||
|
QLabel* mpShapeLabel; |
||||||
|
QLabel* mpSizeLabel; |
||||||
|
QPushButton* mpColor; |
||||||
|
QPushButton* mpSquareButton; |
||||||
|
QPushButton* mpCircleButton; |
||||||
|
QPushButton* mpCloseButton; |
||||||
|
QSlider* mpSizeSlider; |
||||||
|
QHBoxLayout* mpColorLayout; |
||||||
|
QHBoxLayout* mpShapeLayout; |
||||||
|
QHBoxLayout* mpSizeLayout; |
||||||
|
QHBoxLayout* mpCloseLayout; |
||||||
|
QWidget* mpProperties; |
||||||
|
QVBoxLayout* mpPropertiesLayout; |
||||||
|
QColor mActualColor; |
||||||
|
eMaskShape mActualShape; |
||||||
|
UBGraphicsCache* mpCurrentCache; |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
#endif // UBCACHEPROPERTIESWIDGET_H
|
@ -1,84 +0,0 @@ |
|||||||
/*
|
|
||||||
* This program is free software: you can redistribute it and/or modify |
|
||||||
* it under the terms of the GNU General Public License as published by |
|
||||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||||
* (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/ |
|
||||||
|
|
||||||
#include <QtGui> |
|
||||||
|
|
||||||
|
|
||||||
#include "UBClockPalette.h" |
|
||||||
#include "core/memcheck.h" |
|
||||||
|
|
||||||
UBClockPalette::UBClockPalette(QWidget *parent) |
|
||||||
: UBFloatingPalette(Qt::TopRightCorner, parent) |
|
||||||
, mTimeLabel(0) |
|
||||||
{ |
|
||||||
setLayout(new QHBoxLayout()); |
|
||||||
mTimeLabel = new QLabel(parent); |
|
||||||
mTimeLabel->setStyleSheet(QString("QLabel {color: white; background-color: transparent; font-family: Arial; font-weight: bold; font-size: 20px}")); |
|
||||||
|
|
||||||
layout()->setContentsMargins(radius() + 15, 4, radius() + 15, 4); |
|
||||||
layout()->addWidget(mTimeLabel); |
|
||||||
|
|
||||||
mTimeFormat = QLocale::system().timeFormat(QLocale::ShortFormat); |
|
||||||
|
|
||||||
//strip seconds
|
|
||||||
mTimeFormat = mTimeFormat.remove(":ss"); |
|
||||||
mTimeFormat = mTimeFormat.remove(":s"); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
UBClockPalette::~UBClockPalette() |
|
||||||
{ |
|
||||||
// NOOP
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
int UBClockPalette::radius() |
|
||||||
{ |
|
||||||
return 10; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
void UBClockPalette::updateTime() |
|
||||||
{ |
|
||||||
if (mTimeLabel) |
|
||||||
{ |
|
||||||
mTimeLabel->setText(QLocale::system().toString (QTime::currentTime(), mTimeFormat)); |
|
||||||
} |
|
||||||
adjustSizeAndPosition(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
void UBClockPalette::timerEvent(QTimerEvent *event) |
|
||||||
{ |
|
||||||
Q_UNUSED(event); |
|
||||||
updateTime(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
void UBClockPalette::showEvent ( QShowEvent * event ) |
|
||||||
{ |
|
||||||
Q_UNUSED(event); |
|
||||||
updateTime(); |
|
||||||
mTimerID = startTimer(1000); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
void UBClockPalette::hideEvent ( QShowEvent * event ) |
|
||||||
{ |
|
||||||
Q_UNUSED(event); |
|
||||||
killTimer(mTimerID); |
|
||||||
} |
|
||||||
|
|
@ -1,60 +0,0 @@ |
|||||||
/*
|
|
||||||
* This program is free software: you can redistribute it and/or modify |
|
||||||
* it under the terms of the GNU General Public License as published by |
|
||||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||||
* (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/ |
|
||||||
|
|
||||||
#include <QtGui> |
|
||||||
|
|
||||||
#include "UBPageNumberPalette.h" |
|
||||||
|
|
||||||
#include "core/memcheck.h" |
|
||||||
|
|
||||||
UBPageNumberPalette::UBPageNumberPalette(QWidget *parent) |
|
||||||
: UBFloatingPalette(Qt::BottomRightCorner, parent) |
|
||||||
{ |
|
||||||
mLayout = new QHBoxLayout(this); |
|
||||||
mButton = new QPushButton(parent); |
|
||||||
mButton->setStyleSheet(QString("QPushButton { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }")); |
|
||||||
mButton->setFocusPolicy(Qt::NoFocus); |
|
||||||
connect(mButton, SIGNAL(clicked(bool)), this, SLOT(buttonClicked(bool))); |
|
||||||
|
|
||||||
mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4); |
|
||||||
|
|
||||||
mLayout->addWidget(mButton); |
|
||||||
|
|
||||||
setPageNumber(0, 0); |
|
||||||
} |
|
||||||
|
|
||||||
UBPageNumberPalette::~UBPageNumberPalette() |
|
||||||
{ |
|
||||||
delete mButton; |
|
||||||
delete mLayout; |
|
||||||
} |
|
||||||
|
|
||||||
void UBPageNumberPalette::buttonClicked(bool checked) |
|
||||||
{ |
|
||||||
Q_UNUSED(checked); |
|
||||||
|
|
||||||
emit clicked(); |
|
||||||
} |
|
||||||
|
|
||||||
int UBPageNumberPalette::radius() |
|
||||||
{ |
|
||||||
return 10; |
|
||||||
} |
|
||||||
|
|
||||||
void UBPageNumberPalette::setPageNumber(int current, int total) |
|
||||||
{ |
|
||||||
mButton->setText(QString("%1 / %2").arg(current).arg(total)); |
|
||||||
adjustSizeAndPosition(); |
|
||||||
} |
|
@ -1,51 +0,0 @@ |
|||||||
/*
|
|
||||||
* This program is free software: you can redistribute it and/or modify |
|
||||||
* it under the terms of the GNU General Public License as published by |
|
||||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||||
* (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef UBPAGENUMBERPALLETTE_H_ |
|
||||||
#define UBPAGENUMBERPALLETTE_H_ |
|
||||||
|
|
||||||
class QHBoxLayout; |
|
||||||
class QPushButton; |
|
||||||
|
|
||||||
#include "UBFloatingPalette.h" |
|
||||||
|
|
||||||
|
|
||||||
class UBPageNumberPalette : public UBFloatingPalette |
|
||||||
{ |
|
||||||
Q_OBJECT; |
|
||||||
|
|
||||||
public: |
|
||||||
UBPageNumberPalette(QWidget *parent = 0); |
|
||||||
virtual ~UBPageNumberPalette(); |
|
||||||
|
|
||||||
protected: |
|
||||||
int radius(); |
|
||||||
|
|
||||||
private: |
|
||||||
QHBoxLayout *mLayout; |
|
||||||
QPushButton *mButton; |
|
||||||
|
|
||||||
private slots: |
|
||||||
void buttonClicked(bool checked); |
|
||||||
|
|
||||||
public slots: |
|
||||||
void setPageNumber(int current, int total); |
|
||||||
|
|
||||||
signals: |
|
||||||
void clicked(); |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
#endif /* UBPAGENUMBERPALLETTE_H_ */ |
|
Loading…
Reference in new issue