Commit 856f3257 authored by Aleksei Kanash's avatar Aleksei Kanash

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

parents ed2996c9 26dad723
......@@ -199,7 +199,7 @@ function init(){
if(text)
textField.html(text);
else
textField.html("Enter your notes here ...");
textField.html("Saisir votre texte ici ...");
textField.focus();
}
......
......@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var sankoreLang = {display: "Afficher", edit: "Modifier", add: "Ajouter", enter_data: "Saisir la donnée:", enter_result: "Saisir le résultat:", ok: "Accepter", cancel: "Annuler"};
var sankoreLang = {display: "Afficher", edit: "Modifier", add: "Ajouter", enter_data: "Saisir la donnée:", enter_result: "Saisir le résultat:", ok: "Valider", cancel: "Annuler"};
function init(){
......
......@@ -3,7 +3,7 @@ var sankoreLang = {
edit: "Edit",
short_desc: "Select the number \"three\".",
add: "Add new block",
enter: "Enter what to do here ..."
enter: "Enter what to do here..."
};
//main function
......
......@@ -2559,7 +2559,6 @@ UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg()
graphicsItemFromSvg(ruler);
UBGraphicsItem::assignZValue(ruler, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler);
ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
QStringRef svgWidth = mXmlReader.attributes().value("width");
......@@ -2617,7 +2616,6 @@ UBGraphicsCompass* UBSvgSubsetAdaptor::UBSvgSubsetReader::compassFromSvg()
graphicsItemFromSvg(compass);
UBGraphicsItem::assignZValue(compass, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass);
compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
QStringRef svgX = mXmlReader.attributes().value("x");
......@@ -2681,7 +2679,6 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg()
{
UBGraphicsProtractor* protractor = new UBGraphicsProtractor();
UBGraphicsItem::assignZValue(protractor, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor);
protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(protractor);
......@@ -2751,7 +2748,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
{
UBGraphicsTriangle* triangle = new UBGraphicsTriangle();
UBGraphicsItem::assignZValue(triangle, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle);
triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(triangle);
......
......@@ -419,10 +419,10 @@ UBBoardView::mousePressEvent (QMouseEvent *event)
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
if (!movingItem
if (!movingItem
|| movingItem->isSelected()
|| movingItem->type() == UBGraphicsDelegateFrame::Type
|| movingItem->type() == DelegateButton::Type
|| movingItem->type() == DelegateButton::Type
|| movingItem->type() == UBGraphicsCompass::Type
|| movingItem->type() == UBGraphicsPDFItem::Type
|| movingItem->type() == UBGraphicsPolygonItem::Type
......@@ -434,7 +434,7 @@ UBBoardView::mousePressEvent (QMouseEvent *event)
QGraphicsView::mousePressEvent (event);
}
else
else
{
mLastPressedMousePos = mapToScene(event->pos());
if (suspendedMousePressEvent)
......
......@@ -86,6 +86,7 @@ const int UBSettings::defaultWidgetIconWidth = 110;
const int UBSettings::defaultVideoWidth = 80;
const int UBSettings::thumbnailSpacing = 20;
const int UBSettings::longClickInterval = 2000;
const qreal UBSettings::minScreenRatio = 1.33; // 800/600 or 1024/768
......
......@@ -178,6 +178,7 @@ class UBSettings : public QObject
static const int defaultSoundWidth;
static const int thumbnailSpacing;
static const int longClickInterval;
static const qreal minScreenRatio;
......
This diff is collapsed.
......@@ -21,9 +21,11 @@
#include <QMimeData>
#include "core/UB.h"
#include "core/UBSettings.h"
class QGraphicsSceneMouseEvent;
class QGraphicsItem;
class UBGraphicsScene;
class UBGraphicsProxyWidget;
class UBGraphicsDelegateFrame;
class UBGraphicsWidgetItem;
......@@ -63,20 +65,8 @@ class DelegateButton: public QGraphicsSvgItem
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
{
// make sure delegate is selected, to avoid control being hidden
mDelegated->setSelected(true);
event->setAccepted(!mIsTransparentToMouseEvent);
}
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
emit clicked();
event->setAccepted(!mIsTransparentToMouseEvent);
}
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void modified();
......@@ -84,12 +74,13 @@ class DelegateButton: public QGraphicsSvgItem
QGraphicsItem* mDelegated;
QTime mPressedTime;
bool mIsTransparentToMouseEvent;
Qt::WindowFrameSection mButtonAlignmentSection;
signals:
void clicked (bool checked = false);
void longClicked();
};
......@@ -110,8 +101,12 @@ class UBGraphicsItemDelegate : public QObject
virtual bool mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual bool weelEvent(QGraphicsSceneWheelEvent *event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change,
const QVariant &value);
virtual UBGraphicsScene *castUBGraphicsScene();
void printMessage(const QString &mess) {qDebug() << mess;}
......@@ -123,6 +118,7 @@ class UBGraphicsItemDelegate : public QObject
void setCanDuplicate(bool allow){ mCanDuplicate = allow; }
virtual void positionHandles();
void setZOrderButtonsVisible(bool visible);
void startUndoStep();
void commitUndoStep();
......@@ -135,6 +131,7 @@ class UBGraphicsItemDelegate : public QObject
QMimeData* mimeData(){ return mMimeData; }
void setMimeData(QMimeData* mimeData);
void setDragPixmap(const QPixmap &pix) {mDragPixmap = pix;}
void setFlippable(bool flippable);
bool isFlippable();
......@@ -153,8 +150,10 @@ class UBGraphicsItemDelegate : public QObject
virtual void lock(bool lock);
virtual void duplicate();
virtual void increaseZLevel() {increaseZLevel(1);}
virtual void decreaseZLevel() {increaseZLevel(-1);}
void increaseZLevelUp();
void increaseZLevelDown();
void increaseZlevelTop();
void increaseZlevelBottom();
protected:
virtual void buildButtons() {;}
......@@ -189,18 +188,22 @@ protected slots:
virtual void gotoContentSource(bool checked);
private:
void updateFrame();
void updateButtons(bool showUpdated = false);
virtual void increaseZLevel(int delta);
QPointF mOffset;
QTransform mPreviousTransform;
QPointF mPreviousPosition;
QPointF mDragStartPosition;
qreal mPreviousZValue;
QSizeF mPreviousSize;
bool mCanRotate;
bool mCanDuplicate;
bool mRespectRatio;
QMimeData* mMimeData;
QPixmap mDragPixmap;
/** A boolean saying that this object can be flippable (mirror effect) */
bool mFlippable;
......
......@@ -58,13 +58,18 @@ void UBGraphicsPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
QMimeData* pMime = new QMimeData();
pMime->setImageData(pixmap().toImage());
mDelegate->setMimeData(pMime);
int k = pixmap().width() / 100;
QSize newSize(pixmap().width() / k, pixmap().height() / k);
mDelegate->setDragPixmap(pixmap().scaled(newSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
if (mDelegate->mousePressEvent(event))
{
//NOOP
}
else
{
QGraphicsPixmapItem::mousePressEvent(event);
// QGraphicsPixmapItem::mousePressEvent(event);
}
}
......
......@@ -61,10 +61,6 @@ protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
// UBGraphicsItemDelegate* mDelegate;
};
#endif /* UBGRAPHICSPIXMAPITEM_H_ */
This diff is collapsed.
......@@ -49,33 +49,47 @@ class UBGraphicsCache;
const double PI = 4.0 * atan(1.0);
class UBZLayerController
class UBZLayerController : public QObject
{
public:
Q_OBJECT
public:
struct ItemLayerTypeData {
ItemLayerTypeData() : bottomLimit(0), topLimit(0), curValue(0) {;}
ItemLayerTypeData(qreal bot, qreal top) : bottomLimit(bot), topLimit(top), curValue(bot) {;}
qreal bottomLimit;
qreal topLimit;
qreal curValue;
ItemLayerTypeData() : bottomLimit(0), topLimit(0), curValue(0), incStep(1) {;}
ItemLayerTypeData(qreal bot, qreal top, qreal increment = 1) : bottomLimit(bot), topLimit(top), curValue(bot), incStep(increment) {;}
qreal bottomLimit; //bottom bound of the layer
qreal topLimit;//top bound of the layer
qreal curValue;//current value of variable
qreal incStep;//incremental step
};
enum moveDestination {
up
, down
, top
, bottom
};
typedef QMap<itemLayerType::Enum, ItemLayerTypeData> ScopeMap;
UBZLayerController();
UBZLayerController(QGraphicsScene *scene);
qreal getBottomLimit(itemLayerType::Enum key) const {return scopeMap.value(key).bottomLimit;}
qreal getTopLimit(itemLayerType::Enum key) const {return scopeMap.value(key).topLimit;}
bool validLayerType(itemLayerType::Enum key) const {return scopeMap.contains(key);}
static qreal errorNum() {return errorNumber;}
qreal generateZLevel(itemLayerType::Enum key);
qreal generateZLevel(QGraphicsItem *item);
private:
ScopeMap scopeMap;
static qreal errorNumber;
qreal changeZLevelTo(QGraphicsItem *item, moveDestination dest);
itemLayerType::Enum typeForData(QGraphicsItem *item) const;
private:
ScopeMap scopeMap;
static qreal errorNumber;
QGraphicsScene *mScene;
};
class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
......@@ -87,7 +101,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
// tmp stub for divide addings scene objects from undo mechanism implementation
void setURStackEnable(bool set = true) {enableUndoRedoStack = set;}
UBGraphicsScene(UBDocumentProxy *parent);
UBGraphicsScene(UBDocumentProxy *parent);
virtual ~UBGraphicsScene();
virtual UBItem* deepCopy() const;
......@@ -242,6 +256,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void setNominalSize(int pWidth, int pHeight);
qreal changeZLevelTo(QGraphicsItem *item, UBZLayerController::moveDestination dest);
enum RenderingContext
{
Screen = 0, NonScreen, PdfExport, Podcast
......@@ -257,20 +273,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
return mRenderingContext;
}
static qreal backgroundLayerStart;
static qreal objectLayerStart;
static qreal drawingLayerStart;
static qreal toolLayerStart;
static qreal toolOffsetEraser;
static qreal toolOffsetPointer;
static qreal toolOffsetRuler;
static qreal toolOffsetProtractor;
static qreal toolOffsetCompass;
static qreal toolOffsetCurtain;
static qreal toolOffsetTriangle;
static qreal toolOffsetCache;
QSet<QGraphicsItem*> tools(){ return mTools;}
void registerTool(QGraphicsItem* item)
......@@ -283,7 +285,9 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
return mPreviousPoint;
}
public slots:
void setSelectedZLevel(QList<QGraphicsItem *> itemList);
void setOwnZlevel(QList<QGraphicsItem *> itemList);
public slots:
void hideEraser();
......@@ -339,8 +343,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void createEraiser();
void createPointer();
qreal generateZLevel(QGraphicsItem *item);
QGraphicsEllipseItem* mEraser;
QGraphicsEllipseItem* mPointer;
......@@ -392,7 +394,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBMagnifier *magniferControlViewWidget;
UBMagnifier *magniferDisplayViewWidget;
UBZLayerController mZLayerController;
UBZLayerController *mZLayerController;
};
......
......@@ -109,10 +109,10 @@ void UBGraphicsVideoItem::showOnDisplayChanged(bool shown)
void UBGraphicsVideoItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QDrag* mDrag = new QDrag(event->widget());
QMimeData* pMime = new QMimeData();
mDrag->setMimeData(pMime);
mDrag->start();
// QDrag* mDrag = new QDrag(event->widget());
// QMimeData* pMime = new QMimeData();
// mDrag->setMimeData(pMime);
// mDrag->start();
mShouldMove = (event->buttons() & Qt::LeftButton);
mMousePressPos = event->scenePos();
......
......@@ -82,11 +82,13 @@ void UBGraphicsWidgetItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void UBGraphicsWidgetItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
sendJSEnterEvent();
mDelegate->hoverEnterEvent(event);
UBGraphicsProxyWidget::hoverEnterEvent(event);
}
void UBGraphicsWidgetItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
sendJSLeaveEvent();
mDelegate->hoverLeaveEvent(event);
UBGraphicsProxyWidget::hoverLeaveEvent(event);
}
......
......@@ -29,7 +29,7 @@ UBItem::~UBItem()
// NOOP
}
void UBGraphicsItem::assignZValue(QGraphicsItem *item, int value)
void UBGraphicsItem::assignZValue(QGraphicsItem *item, qreal value)
{
item->setZValue(value);
item->setData(UBGraphicsItemData::ItemOwnZValue, value);
......
......@@ -101,7 +101,7 @@ protected:
public:
static void assignZValue(QGraphicsItem*, int value);
static void assignZValue(QGraphicsItem*, qreal value);
virtual UBGraphicsItemDelegate *Delegate() const = 0;
virtual void remove() = 0;
......
......@@ -44,7 +44,7 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
virtual void StartLine(const QPointF& position, qreal width);
virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine();
virtual void EndLine();
protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment