Commit 20a787f1 authored by Claudio Valerio's avatar Claudio Valerio

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

Conflicts:
	src/board/UBBoardView.cpp
	src/domain/UBGraphicsItemDelegate.cpp
parents 93f69f80 05564470
......@@ -131,7 +131,7 @@ win32 {
}
macx {
LIBS += "-Lplugins/cffadaptor/lib/mac" "-lCFF_Adaptor"
LIBS += "-Lplugins/cffadaptor/lib/macx" "-lCFF_Adaptor"
LIBS += -framework Foundation
LIBS += -lcrypto
LIBS += -framework AppKit
......
......@@ -10,14 +10,16 @@ linux-g++: SUB_DIR = linux
linux-g++-32: SUB_DIR = linux
linux-g++-64: SUB_DIR = linux
QUAZIP_DIR = "$$PWD/../../../Sankore-ThirdParty/quazip"
ZLIB_DIR = "$$PWD/../../../Sankore-ThirdParty/zlib"
THIRD_PARTY_PATH = ../../../Sankore-ThirdParty
QUAZIP_DIR = "$$PWD/../../../Sankore-ThirdParty/quazip/quazip-0.3"
INCLUDEPATH += src \
"$$QUAZIP_DIR/quazip-0.3" \
"$$ZLIB_DIR/1.2.3/include"
INCLUDEPATH += src
LIBS += "-L$$QUAZIP_DIR/lib/$$SUB_DIR" "-lquazip"
DEPENDPATH += $$THIRD_PARTY_PATH/quazip/
INCLUDEPATH += $$THIRD_PARTY_PATH/quazip/
include($$THIRD_PARTY_PATH/quazip/quazip.pri)
LIBS += "-L$$THIRD_PARTY_PATH/quazip/lib/$$SUB_DIR" "-lquazip"
QT += xml xmlpatterns core
QT += gui
......
......@@ -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(){
......
......@@ -6,20 +6,20 @@ var sankoreLang = {
"example_question":"This is an example of the question",
"answer":"This is an example of the answer",
"q":"Q",
"add_new_question":"Add new question ...",
"add_new_question":"Add a new question ...",
"options":"Options",
"close":"Close",
"delete_question":"Delete question",
"delete_answer":"Delete answer",
"delete_question":"Delete the question",
"delete_answer":"Delete a possibility",
"right_answer":"Right answer",
"template_question":"Enter your question here ...",
"template_answer":"Enter the answer here ...",
"add_answer":"Add answer",
"template_question":"Enter a question here ...",
"template_answer":"Enter a possibility here ...",
"add_answer":"Add a possibility",
"select_text":"Choose the right answer",
"options_desc":"You can choose any of these three options of displaying your answers. See a short their description.",
"radio_desc":"This option allow to choose one answer only and the answers are displayed as radio buttons.",
"checkbox_desc":"This option allow to choose several answers and the answers are displayed as checkboxes.",
"select_desc":"This option allow to chose one answer only and the answers are displayed as pull-down menu.",
"options_desc":"Types of question",
"radio_desc":"Option 1 : one right answer, possibilities are displayed as radio buttons.",
"checkbox_desc":"Option 2 : several right answers, possibilities are displayed as checkboxes.",
"select_desc":"Option 3 : one right answer, possibilities are displayed as pull-down menu.",
"a":"A"
},
"ru":{
......@@ -49,23 +49,23 @@ var sankoreLang = {
"edit": "Modifier",
"display":"Afficher",
"question":"La question",
"example_question":"Ceci est un exemple de la question",
"answer":"Ceci est un exemple de la réponse",
"example_question":"Ceci est un exemple de question",
"answer":"Ceci est un exemple de réponse",
"q":"Q",
"add_new_question":"Ajouter nouvelle question ...",
"options":"Les options",
"add_new_question":"Ajouter une nouvelle question ...",
"options":"Options",
"close":"Fermer",
"delete_question":"Supprimer la question",
"delete_answer":"Supprimer réponse",
"delete_answer":"Supprimer la possibilité",
"right_answer":"Bonne réponse",
"template_question":"Saisissez votre question ici ...",
"template_answer":"Entrez la réponse ici ...",
"add_answer":"Ajouter une réponse",
"select_text":"Choisissez la bonne réponse",
"options_desc":"Vous pouvez choisir n'importe lequel de ces trois options d'affichage de vos réponses. Voir un court leur description.",
"radio_desc":"Cette option permet de choisir une seule réponse et les réponses sont affichées sous forme de boutons radio.",
"checkbox_desc":"Cette option permet de choisir plusieurs réponses et les réponses sont affichées comme des cases à cocher.",
"select_desc":"Cette option permet de choisir une seule réponse et les réponses sont affichées sous forme de menu déroulant.",
"template_question":"Saisir la question ici ...",
"template_answer":"Saisir une possibilité ici ...",
"add_answer":"Ajouter une possibilité",
"select_text":"Choisir la bonne réponse",
"options_desc":"Types de questions",
"radio_desc":"Option 1 : une seule bonne réponse, les possibilités sont affichées sous forme de boutons radio.",
"checkbox_desc":"Option 2 : plusieurs bonnes réponses, les possibilités sont affichées sous forme de cases à cocher.",
"select_desc":"Option 3 : une seule bonne réponse, les possibilités sont affichées sous forme de menu déroulant.",
"a":"R"
}
};
......
......@@ -3,7 +3,7 @@ var sankoreLang = {
edit: "Edit",
short_desc: "Select the number \"three\".",
add: "Add new block",
enter: "Enter your condition here ..."
enter: "Enter what to do here..."
};
//main function
......
var sankoreLang = {
display: "Affichage",
display: "Afficher",
edit: "Modifier",
short_desc: "Sélectionner le numéro «trois».",
add: "Nouveau bloc",
enter: "Saisissez la consigne ici ..."
enter: "Saisir la consigne ici ..."
};
//main function
......
var sankoreLang = {
display: "D'affichage",
display: "Afficher",
edit: "Modifier",
short_desc: "Combien de signaux entendez-vous?",
short_desc: "Combien de signaux sonores entendez-vous?",
add: "Nouveau bloc",
enter: "Entrez votre description ici ..."
enter: "Saisir votre description ici ..."
};
//main function
......
......@@ -3,7 +3,7 @@ var sankoreLang = {
edit: "Edit",
first_desc: "Odd numbers",
second_desc: "Even numbers",
enter: "Enter your category name here ...",
enter: "Enter a category name here ...",
add: "Add new block"
};
......
var sankoreLang = {
display: "D'affichage",
display: "Afficher",
edit: "Modifier",
first_desc: "Les nombres impairs",
second_desc: "Même les chiffres",
enter: "Entrez votre nom de la catégorie ici ...",
second_desc: "Les nombres pairs",
enter: "Saisir le nom de la catégorie ici ...",
add: "Nouveau bloc"
};
......
......@@ -3,12 +3,12 @@ var sankoreLang = {
edit: "Edit",
first_desc: "Fruits",
second_desc: "Vegetables",
potatoes: "Potatoes",
potatoes: "Potato",
carrot: "Carrot",
onion: "Onion",
apple: "Apple",
pear: "Pear",
enter: "Enter your category name here ...",
enter: "Enter a category name here ...",
add: "Add new block",
text: "Some text"
};
......
var sankoreLang = {
display: "D'affichage",
display: "Afficher",
edit: "Modifier",
first_desc: "Fruits",
second_desc: "Légumes",
potatoes: "Pommes de terre",
potatoes: "Pomme de terre",
carrot: "Carotte",
onion: "Oignon",
apple: "Pomme",
pear: "Poire",
enter: "Entrez votre nom de la catégorie ici ...",
enter: "Saisir le nom de la catégorie ici ...",
add: "Nouveau bloc",
text: "Texte"
};
......
var sankoreLang = {
display: "Display",
edit: "Edit",
text_content: "This is an example. Instead of this text you can put your own content.",
text_content: "This is an example. Instead of this text you can put your own content or drag an drop a picture or an audio file",
new_txt: "New text block",
new_slide: "This is new slide."
new_slide: "This is a new slide."
};
//some flags
......
var sankoreLang = {
display: "D'affichage",
display: "Afficher",
edit: "Modifier",
text_content: "Ceci est un exemple. Au lieu de ce texte, vous pouvez mettre votre propre contenu.",
text_content: "Ceci est un exemple. Au lieu de ce texte, vous pouvez saisir votre propre texte ou glisser-dposer une image, un son.",
new_txt: "Nouveau bloc de texte",
new_slide: "C'est une nouvelle diapositive."
new_slide: "Ceci est une nouvelle diapositive."
};
//some flags
......
......@@ -26,9 +26,9 @@ function checkResponse()
*/
var sankoreLang = {
view: "D'affichage",
view: "Afficher",
edit: "Modifier",
example: "il\ns'agit\nd'une\nphrase\nd'exemple"
example: "Cette phrase\nest un\nexemple."
};
......
......@@ -27,9 +27,9 @@ function checkResponse()
*/
var sankoreLang = {
view: "D'affichage",
view: "Afficher",
edit: "Modifier",
example: "une*longue*,*il*ya*bien*longtemps*..."
example: "Il*était*une*fois*..."
};
var word = "";
......
var sankoreLang = {
display: "Affichage",
display: "Afficher",
edit: "Modifier",
short_desc: "Placez les photos dans l'ordre croissant.",
short_desc: "Placer les photos dans l'ordre croissant.",
add: "Nouveau bloc",
enter: "Saisissez votre texte ici ..."
enter: "Saisir votre texte ici ..."
};
//main function
......
var sankoreLang = {
display: "D'affichage",
display: "Afficher",
edit: "Modifier",
short_desc: "Ecoutez le son et faire le bon mot.",
short_desc: "Ecouter le son et replacer les lettres dans l'ordre.",
add: "Nouveau bloc",
enter: "Entrez votre description ici ...",
enter: "Saisir la consigne ici ...",
example: "exemple"
};
......
var sankoreLang = {
display: "Affichage",
edit: "Modifier",
short_desc: "Sélectionnez les animaux de la liste suivante:",
short_desc: "Sélectionner les animaux dans la liste suivante :",
add: "Nouveau bloc",
enter: "Saisissez votre texte ici ...",
enter: "Saisir le texte ici ...",
cat: "chat",
ball: "balle",
shovel: "pelle",
......
var sankoreLang = {
view: "D'affichage",
view: "Afficher",
edit: "Modifier",
example: "c'est un tas de mots qui ne devraient être répartis à part"
example: "Ceci est une série de mots à séparer correctement"
};
// if use the "view/edit" button or rely on the api instead
......
var sankoreLang = {
view: "D'affichage",
view: "Afficher",
edit: "Modifier",
example: "bonjour, ceci est la première phrase. salut, c'est la deuxième phrase. bonjour à nouveau, c'est la troisième phrase. bonjour, c'est la quatrième phrase. salut, désolé, je suis en retard, je suis la cinquième phrase."
};
......
var sankoreLang = {
view: "D'affichage",
view: "Afficher",
edit: "Modifier",
example: "so*phis*ti*qué"
};
......
......@@ -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);
......
......@@ -664,6 +664,7 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint)
UBApplication::applicationController->adjustDisplayView();
emit controlViewportChanged();
mActiveScene->setBackgroundZoomFactor(mControlView->transform().m11());
}
......@@ -1163,7 +1164,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
mControlView->setScene(mActiveScene);
mDisplayView->setScene(mActiveScene);
mActiveScene->setBackgroundZoomFactor(mControlView->transform().m11());
pDocumentProxy->setDefaultDocumentSize(mActiveScene->nominalSize());
updatePageSizeState();
......@@ -1564,7 +1565,7 @@ void UBBoardController::updateSystemScaleFactor()
mControlView->setTransform(scalingTransform);
mControlView->horizontalScrollBar()->setValue(viewState.horizontalPosition);
mControlView->verticalScrollBar()->setValue(viewState.verticalPostition);
}
mActiveScene->setBackgroundZoomFactor(mControlView->transform().m11());}
void UBBoardController::setWidePageSize(bool checked)
......
......@@ -51,6 +51,7 @@
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsTriangle.h"
#include "core/memcheck.h"
......@@ -418,18 +419,20 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
if (!movingItem
|| movingItem->isSelected()
|| movingItem->type() == UBGraphicsDelegateFrame::Type
|| movingItem->type() == DelegateButton::Type
|| movingItem->type() == UBGraphicsCompass::Type
|| movingItem->type() == UBGraphicsPDFItem::Type
|| movingItem->type() == UBGraphicsPolygonItem::Type
|| movingItem->type() == UBGraphicsCache::Type)
{
movingItem = NULL;
QGraphicsView::mousePressEvent (event);
|| movingItem->isSelected()
|| movingItem->type() == UBGraphicsDelegateFrame::Type
|| movingItem->type() == DelegateButton::Type
|| movingItem->type() == UBGraphicsCompass::Type
|| movingItem->type() == UBGraphicsPDFItem::Type
|| movingItem->type() == UBGraphicsPolygonItem::Type
|| movingItem->type() == UBGraphicsCache::Type
|| movingItem->type() == UBGraphicsTriangle::Type
|| movingItem == this->scene()->backgroundObject())
{
movingItem = NULL;
QGraphicsView::mousePressEvent (event);
}
}
else
{
mLastPressedMousePos = mapToScene(event->pos());
......
......@@ -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
......@@ -377,6 +378,9 @@ void UBSettings::init()
KeyboardLocale = new UBSetting(this, "Board", "StartupKeyboardLocale", 0);
swapControlAndDisplayScreens = new UBSetting(this, "App", "SwapControlAndDisplayScreens", false);
angleTolerance = new UBSetting(this, "App", "AngleTolerance", 4);
historyLimit = new UBSetting(this, "Web", "HistoryLimit", 15);
}
......@@ -1139,3 +1143,4 @@ QString UBSettings::replaceWildcard(QString& path)
return result;
}
......@@ -97,8 +97,7 @@ class UBSettings : public QObject
void setCommunityPassword(const QString& password);
void init();
//user directories
static QString userDataDirectory();
static QString userDocumentDirectory();
......@@ -179,6 +178,7 @@ class UBSettings : public QObject
static const int defaultSoundWidth;
static const int thumbnailSpacing;
static const int longClickInterval;
static const qreal minScreenRatio;
......@@ -326,6 +326,9 @@ class UBSettings : public QObject
UBSetting* KeyboardLocale;
UBSetting* swapControlAndDisplayScreens;
UBSetting* angleTolerance;
UBSetting* historyLimit;
public slots:
void setPenWidthIndex(int index);
......
......@@ -88,6 +88,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingScene = new UBGraphicsScene(0);
mTransparentDrawingView->setScene(mTransparentDrawingScene);
mTransparentDrawingScene->setDrawingMode(true);
// mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView);
//mRightPalette = new UBRightPalette(mTransparentDrawingView);
......
#include "UBAngleWidget.h"
#include <QPainter>
UBAngleWidget::UBAngleWidget(QWidget *parent)
: QWidget(parent)
{
this->setFixedSize(45,30);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
this->setAttribute(Qt::WA_TranslucentBackground);
QImage mask_img(width(), height(), QImage::Format_Mono);
mask_img.fill(0xff);
QPainter mask_ptr(&mask_img);
mask_ptr.setBrush( QBrush( QColor(0, 0, 0) ) );
mask_ptr.drawRoundedRect(0,0,this->geometry().width() - 6,this->geometry().height() - 6,1,1);
bmpMask = QBitmap::fromImage(mask_img);
this->setMask(bmpMask);
}
UBAngleWidget::~UBAngleWidget()
{
}
void UBAngleWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
this->move(this->cursor().pos().x(), this->cursor().pos().y() - 30);
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QBrush brush(Qt::white);
painter.setBrush(brush);
painter.drawRoundedRect(1,1,this->geometry().width() - 10,this->geometry().height() - 10,1,1);
painter.setPen(QColor(85,50,127));
painter.setFont(QFont("Arial", 10));
painter.drawText(1,1,this->geometry().width() - 10,this->geometry().height() - 10, Qt::AlignCenter, text);
}
void UBAngleWidget::setText(QString newText)
{
text = newText;
text.append(QChar(176));
}
\ No newline at end of file
#ifndef UBANGLEWIDGET_H
#define UBANGLEWIDGET_H
#include <QWidget>
#include <QBitmap>
class UBAngleWidget : public QWidget
{
Q_OBJECT
public:
UBAngleWidget(QWidget *parent = 0);
~UBAngleWidget();
void setText(QString);
protected:
void paintEvent(QPaintEvent *event);
private:
QString text;
QBitmap bmpMask;
};
#endif // UBANGLEWIDGET_H
This diff is collapsed.
......@@ -18,6 +18,7 @@
#include <QtGui>
#include "core/UB.h"
#include "domain/UBAngleWidget.h"
class QGraphicsSceneMouseEvent;
class UBGraphicsItemDelegate;
......@@ -47,6 +48,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
enum OperationMode {Scaling, Resizing};
void setOperationMode(OperationMode pMode) {mOperationMode = pMode;}
bool isResizing(){return mResizing;}
private:
QRectF bottomRightResizeGripRect() const;
......@@ -69,8 +71,8 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
void initializeTransform ();
enum FrameTool {None, Move, Rotate, ResizeBottomRight, ResizeTop, ResizeRight, ResizeBottom, ResizeLeft};
FrameTool toolFromPos (QPointF pos);
FrameTool toolFromPos (QPointF pos);
void refreshGeometry();
FrameTool mCurrentTool;
UBGraphicsItemDelegate* mDelegate;
......@@ -90,7 +92,8 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
qreal mTranslateY;
qreal mTotalTranslateX;
qreal mTotalTranslateY;
static const qreal mAngleTolerance;
qreal mAngleTolerance;
QRect mAngleRect;
QPointF mStartingPoint;
QTransform mInitialTransform;
......@@ -111,5 +114,13 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
OperationMode mOperationMode;
QGraphicsItem* delegated();
bool mMirrorX;
bool mMirrorY;
bool mResizing;
bool mMirroredXAtStart;
bool mMirroredYAtStart;
UBAngleWidget *angleWidget;
};
#endif /* UBGRAPHICSDELEGATEFRAME_H_ */
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,10 +131,13 @@ 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();
void setButtonsVisible(bool visible);
signals:
void showOnDisplayChanged(bool shown);
void lockChanged(bool locked);
......@@ -151,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() {;}
......@@ -187,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;
......
......@@ -32,7 +32,7 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
mDelegate->init();
// NOTE: Do not remove this code, I'm just doing a backup of my changes! thx..
//mDelegate->setFlippable(true);
mDelegate->setFlippable(true);
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setTransformationMode(Qt::SmoothTransformation);
......@@ -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,12 +285,15 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
return mPreviousPoint;
}
public slots:
void setSelectedZLevel(QList<QGraphicsItem *> itemList);
void setOwnZlevel(QList<QGraphicsItem *> itemList);
public slots:
void hideEraser();
void setBackground(bool pIsDark, bool pIsCrossed);
void setBackgroundZoomFactor(qreal zoom);
void setDrawingMode(bool bModeDesktop);
void deselectAllItems();
UBGraphicsPixmapItem* addPixmap(const QPixmap& pPixmap, const QPointF& pPos = QPointF(0,0), qreal scaleFactor = 1.0, bool pUseAnimation = false);
......@@ -331,13 +336,13 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
QGraphicsItem* rootItem(QGraphicsItem* item) const;
virtual void drawBackground(QPainter *painter, const QRectF &rect);
private:
void setDocumentUpdated();
void createEraiser();
void createPointer();
qreal generateZLevel(QGraphicsItem *item);
QGraphicsEllipseItem* mEraser;
QGraphicsEllipseItem* mPointer;
......@@ -348,6 +353,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
bool mDarkBackground;
bool mCrossedBackground;
bool mIsDesktopMode;
qreal mZoomFactor;
bool mIsModified;
......@@ -387,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;
......
......@@ -22,7 +22,8 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBGraphicsMediaItem.h \
src/domain/UBGraphicsAudioItem.h \
src/domain/UBGraphicsAudioItemDelegate.h \
src/domain/UBAbstractUndoCommand.h
src/domain/UBAbstractUndoCommand.h\
src/domain/UBAngleWidget.h
HEADERS += src/domain/UBGraphicsItemDelegate.h \
src/domain/UBGraphicsVideoItemDelegate.h \
......@@ -54,7 +55,8 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBGraphicsMediaItem.cpp \
src/domain/UBGraphicsAudioItem.cpp \
src/domain/UBGraphicsAudioItemDelegate.cpp \
src/domain/UBAbstractUndoCommand.cpp
src/domain/UBAbstractUndoCommand.cpp \
src/domain/UBAngleWidget.cpp
SOURCES += src/domain/UBGraphicsItemDelegate.cpp \
src/domain/UBGraphicsVideoItemDelegate.cpp \
......
This diff is collapsed.
/*
* 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 UBMAGNIFIER_H
#define UBMAGNIFIER_H
#include <QtGui>
class UBMagnifierParams
{
public :
int x;
int y;
qreal zoom;
qreal sizePercentFromScene;
};
class UBMagnifier : public QWidget
{
Q_OBJECT
public:
UBMagnifier(QWidget *parent = 0, bool isInteractive = false);
~UBMagnifier();
void setSize(qreal percentFromScene);
void setZoom(qreal zoom);
void setGrabView(QWidget *view);
void setMoveView(QWidget *view) {mView = view;}
void grabPoint();
void grabPoint(const QPoint &point);
void grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needGrab = true, bool needMove = true);
UBMagnifierParams params;
signals:
void magnifierMoved_Signal(QPoint newPos);
void magnifierClose_Signal();
void magnifierZoomIn_Signal();
void magnifierZoomOut_Signal();
void magnifierResized_Signal(qreal newPercentSize);
protected:
void paintEvent(QPaintEvent *);
void timerEvent(QTimerEvent *);
virtual void mousePressEvent ( QMouseEvent * event );
virtual void mouseMoveEvent ( QMouseEvent * event );
virtual void mouseReleaseEvent ( QMouseEvent * event );
QPoint mMousePressPos;
qreal mMousePressDelta;
bool mShouldMoveWidget;
bool mShouldResizeWidget;
QPixmap *sClosePixmap;
QPixmap *sIncreasePixmap;
QPixmap *sDecreasePixmap;
QPixmap *mResizeItem;
bool isCusrsorAlreadyStored;
QCursor mOldCursor;
QCursor mResizeCursor;
private:
bool inTimer;
bool m_isInteractive;
int timerUpdate;
QPoint updPointGrab;
QPoint updPointMove;
QPixmap pMap;
QBitmap bmpMask;
QPen borderPen;
QWidget *gView;
QWidget *mView;
};
#endif // UBMAGNIFIER_H
/*
* 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 UBMAGNIFIER_H
#define UBMAGNIFIER_H
#include <QtGui>
class UBMagnifierParams
{
public :
int x;
int y;
qreal zoom;
qreal sizePercentFromScene;
};
class UBMagnifier : public QWidget
{
Q_OBJECT
public:
UBMagnifier(QWidget *parent = 0, bool isInteractive = false);
~UBMagnifier();
void setSize(qreal percentFromScene);
void setZoom(qreal zoom);
void setGrabView(QWidget *view);
void setMoveView(QWidget *view) {mView = view;}
void grabPoint();
void grabPoint(const QPoint &point);
void grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needGrab = true, bool needMove = true);
UBMagnifierParams params;
signals:
void magnifierMoved_Signal(QPoint newPos);
void magnifierClose_Signal();
void magnifierZoomIn_Signal();
void magnifierZoomOut_Signal();
void magnifierResized_Signal(qreal newPercentSize);
public slots:
void slot_refresh();
protected:
void paintEvent(QPaintEvent *);
virtual void mousePressEvent ( QMouseEvent * event );
virtual void mouseMoveEvent ( QMouseEvent * event );
virtual void mouseReleaseEvent ( QMouseEvent * event );
QPoint mMousePressPos;
qreal mMousePressDelta;
bool mShouldMoveWidget;
bool mShouldResizeWidget;
QPixmap *sClosePixmap;
QPixmap *sIncreasePixmap;
QPixmap *sDecreasePixmap;
QPixmap *mResizeItem;
bool isCusrsorAlreadyStored;
QCursor mOldCursor;
QCursor mResizeCursor;
private:
QTimer mRefreshTimer;
bool m_isInteractive;
QPoint updPointGrab;
QPoint updPointMove;
QPixmap pMap;
QBitmap bmpMask;
QPen borderPen;
QWidget *gView;
QWidget *mView;
};
#endif // UBMAGNIFIER_H
......@@ -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:
......
......@@ -196,6 +196,36 @@ void WBBrowserWindow::setupToolBar()
mTabWidget->addWebAction(mUniboardMainWindow->actionWebReload, QWebPage::Reload);
mTabWidget->addWebAction(mUniboardMainWindow->actionStopLoading, QWebPage::Stop);
mHistoryBackMenu = new QMenu(this);
connect(mHistoryBackMenu, SIGNAL(aboutToShow()),this, SLOT(aboutToShowBackMenu()));
connect(mHistoryBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(openActionUrl(QAction *)));
foreach (QWidget* menuWidget, mUniboardMainWindow->actionWebBack->associatedWidgets())
{
QToolButton *tb = qobject_cast<QToolButton*>(menuWidget);
if (tb && !tb->menu())
{
tb->setMenu(mHistoryBackMenu);
tb->setStyleSheet("QToolButton::menu-indicator { subcontrol-position: bottom left; }");
}
}
mHistoryForwardMenu = new QMenu(this);
connect(mHistoryForwardMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowForwardMenu()));
connect(mHistoryForwardMenu, SIGNAL(triggered(QAction *)), this, SLOT(openActionUrl(QAction *)));
foreach (QWidget* menuWidget, mUniboardMainWindow->actionWebForward->associatedWidgets())
{
QToolButton *tb = qobject_cast<QToolButton*>(menuWidget);
if (tb && !tb->menu())
{
tb->setMenu(mHistoryForwardMenu);
tb->setStyleSheet("QToolButton { padding-right: 8px; }");
}
}
mWebToolBar->insertWidget(mUniboardMainWindow->actionWebBigger, mTabWidget->lineEditStack());
mSearchToolBar = new WBToolbarSearch(mWebToolBar);
......@@ -224,6 +254,22 @@ void WBBrowserWindow::setupToolBarForTutorial()
mTabWidget->addWebAction(mUniboardMainWindow->actionWebBack, QWebPage::Back);
mTabWidget->addWebAction(mUniboardMainWindow->actionWebForward, QWebPage::Forward);
foreach (QWidget* menuWidget, mUniboardMainWindow->actionWebBack->associatedWidgets())
{
QToolButton *tb = qobject_cast<QToolButton*>(menuWidget);
if (tb && tb->menu())
tb->setMenu(NULL);
}
foreach (QWidget* menuWidget, mUniboardMainWindow->actionWebForward->associatedWidgets())
{
QToolButton *tb = qobject_cast<QToolButton*>(menuWidget);
if (tb && tb->menu())
tb->setMenu(NULL);
}
// mTabWidget->addWebAction(mUniboardMainWindow->actionWebReload, QWebPage::Reload);
// mTabWidget->addWebAction(mUniboardMainWindow->actionStopLoading, QWebPage::Stop);
......@@ -534,4 +580,86 @@ void WBBrowserWindow::showTabAtTop(bool attop)
mTabWidget->setTabPosition(QTabWidget::South);
}
void WBBrowserWindow::aboutToShowBackMenu()
{
mHistoryBackMenu->clear();
if (!currentTabWebView())
return;
QWebHistory *history = currentTabWebView()->history();
int historyCount = history->count();
int historyLimit = history->backItems(historyCount).count() - UBSettings::settings()->historyLimit->get().toReal();
if (historyLimit < 0)
historyLimit = 0;
for (int i = history->backItems(historyCount).count() - 1; i >= historyLimit; --i)
{
QWebHistoryItem item = history->backItems(historyCount).at(i);
QAction *action = new QAction(this);
action->setData(-1*(historyCount-i-1));
if (!QWebSettings::iconForUrl(item.originalUrl()).isNull())
action->setIcon(item.icon());
action->setText(item.title().isEmpty() ? item.url().toString() : item.title());
mHistoryBackMenu->addAction(action);
}
mHistoryBackMenu->addSeparator();
QAction *action = new QAction(this);
action->setData("clear");
action->setText("Clear history");
mHistoryBackMenu->addAction(action);
}
void WBBrowserWindow::aboutToShowForwardMenu()
{
mHistoryForwardMenu->clear();
if (!currentTabWebView())
return;
QWebHistory *history = currentTabWebView()->history();
int historyCount = history->count();
int historyLimit = history->forwardItems(historyCount).count();
if (historyLimit > UBSettings::settings()->historyLimit->get().toReal())
historyLimit = UBSettings::settings()->historyLimit->get().toReal();
for (int i = 0; i < historyLimit; ++i)
{
QWebHistoryItem item = history->forwardItems(historyCount).at(i);
QAction *action = new QAction(this);
action->setData(historyCount-i);
if (!QWebSettings::iconForUrl(item.originalUrl()).isNull())
action->setIcon(item.icon());
action->setText(item.title().isEmpty() ? item.url().toString() : item.title());
mHistoryForwardMenu->addAction(action);
}
mHistoryForwardMenu->addSeparator();
QAction *action = new QAction(this);
action->setData("clear");
action->setText("Clear history");
mHistoryForwardMenu->addAction(action);
}
void WBBrowserWindow::openActionUrl(QAction *action)
{
QWebHistory *history = currentTabWebView()->history();
if (action->data() == "clear")
{
history->clear();
return;
}
int offset = action->data().toInt();
if (offset < 0)
history->goToItem(history->backItems(-1*offset).first());
else if (offset > 0)
history->goToItem(history->forwardItems(history->count() - offset + 1).back());
}
\ No newline at end of file
......@@ -112,6 +112,10 @@ class WBBrowserWindow : public QWidget
void showTabAtTop(bool attop);
void aboutToShowBackMenu();
void aboutToShowForwardMenu();
void openActionUrl(QAction *action);
signals:
void activeViewPageChanged();
void activeViewChange(QWidget*);
......@@ -160,6 +164,9 @@ class WBBrowserWindow : public QWidget
QString mLastSearch;
Ui::MainWindow* mUniboardMainWindow;
QMenu *mHistoryBackMenu;
QMenu *mHistoryForwardMenu;
};
#endif // WBBROWSERMAINWINDOW_H
......
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