Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
f16c06f9
Commit
f16c06f9
authored
Apr 05, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backup
parent
0dd72f68
Changes
43
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
1034 additions
and
821 deletions
+1034
-821
UBExportCFF.cpp
src/adaptors/UBExportCFF.cpp
+60
-0
UBExportCFF.h
src/adaptors/UBExportCFF.h
+39
-0
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+66
-41
UBSvgSubsetAdaptor.h
src/adaptors/UBSvgSubsetAdaptor.h
+2
-0
adaptors.pri
src/adaptors/adaptors.pri
+2
-0
UBBoardController.cpp
src/board/UBBoardController.cpp
+3
-4
UBBoardView.cpp
src/board/UBBoardView.cpp
+3
-1
UB.h
src/core/UB.h
+23
-2
UBApplication.cpp
src/core/UBApplication.cpp
+1
-2
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+11
-10
UBApplicationController.h
src/core/UBApplicationController.h
+1
-1
UBDisplayManager.cpp
src/core/UBDisplayManager.cpp
+5
-17
UBDisplayManager.h
src/core/UBDisplayManager.h
+5
-5
UBDocumentManager.cpp
src/core/UBDocumentManager.cpp
+3
-0
UBPreferencesController.cpp
src/core/UBPreferencesController.cpp
+1
-1
UBDesktopAnnotationController.cpp
src/desktop/UBDesktopAnnotationController.cpp
+1
-0
UBGraphicsAudioItem.cpp
src/domain/UBGraphicsAudioItem.cpp
+2
-2
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+40
-27
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+17
-1
UBGraphicsPDFItem.cpp
src/domain/UBGraphicsPDFItem.cpp
+2
-5
UBGraphicsPixmapItem.cpp
src/domain/UBGraphicsPixmapItem.cpp
+1
-2
UBGraphicsPolygonItem.cpp
src/domain/UBGraphicsPolygonItem.cpp
+8
-3
UBGraphicsPolygonItem.h
src/domain/UBGraphicsPolygonItem.h
+2
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+166
-136
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+43
-24
UBGraphicsSvgItem.cpp
src/domain/UBGraphicsSvgItem.cpp
+2
-5
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+2
-16
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+4
-4
UBGraphicsVideoItem.cpp
src/domain/UBGraphicsVideoItem.cpp
+2
-2
UBGraphicsVideoItemDelegate.cpp
src/domain/UBGraphicsVideoItemDelegate.cpp
+2
-2
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+3
-1
UBItem.h
src/domain/UBItem.h
+1
-0
UBMagnifer.cpp
src/gui/UBMagnifer.cpp
+402
-388
UBMagnifer.h
src/gui/UBMagnifer.h
+97
-96
UBAbstractDrawRuler.cpp
src/tools/UBAbstractDrawRuler.cpp
+1
-0
UBGraphicsCache.cpp
src/tools/UBGraphicsCache.cpp
+1
-7
UBGraphicsCache.h
src/tools/UBGraphicsCache.h
+0
-2
UBGraphicsCompass.cpp
src/tools/UBGraphicsCompass.cpp
+2
-2
UBGraphicsCurtainItem.cpp
src/tools/UBGraphicsCurtainItem.cpp
+2
-4
UBGraphicsCurtainItemDelegate.cpp
src/tools/UBGraphicsCurtainItemDelegate.cpp
+0
-1
UBGraphicsProtractor.cpp
src/tools/UBGraphicsProtractor.cpp
+1
-2
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+2
-2
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+3
-3
No files found.
src/adaptors/UBExportCFF.cpp
0 → 100644
View file @
f16c06f9
#include "UBExportCFF.h"
#include "UBCFFAdaptor.h"
#include "document/UBDocumentProxy.h"
#include "core/UBDocumentManager.h"
#include "core/UBApplication.h"
UBExportCFF
::
UBExportCFF
(
QObject
*
parent
)
:
UBExportAdaptor
(
parent
)
{
}
UBExportCFF
::~
UBExportCFF
()
{
}
QString
UBExportCFF
::
exportName
()
{
return
tr
(
"Export to IWB"
);
}
QString
UBExportCFF
::
exportExtention
()
{
return
QString
(
".iwb"
);
}
void
UBExportCFF
::
persist
(
UBDocumentProxy
*
pDocument
)
{
QString
src
=
pDocument
->
persistencePath
();
if
(
!
pDocument
)
return
;
QString
filename
=
askForFileName
(
pDocument
,
tr
(
"Export as IWB File"
));
if
(
filename
.
length
()
>
0
)
{
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
if
(
mIsVerbose
)
UBApplication
::
showMessage
(
tr
(
"Exporting document..."
));
UBCFFAdaptor
toIWBExporter
;
if
(
toIWBExporter
.
convertUBZToIWB
(
src
,
filename
))
{
if
(
mIsVerbose
)
UBApplication
::
showMessage
(
tr
(
"Export successful."
));
}
else
if
(
mIsVerbose
)
UBApplication
::
showMessage
(
tr
(
"Export failed."
));
QApplication
::
restoreOverrideCursor
();
}
}
\ No newline at end of file
src/adaptors/UBExportCFF.h
0 → 100644
View file @
f16c06f9
/*
* 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 UBExportCFF_H_
#define UBExportCFF_H_
#include <QtCore>
#include "UBExportAdaptor.h"
#include "frameworks/UBFileSystemUtils.h"
class
UBDocumentProxy
;
class
UBExportCFF
:
public
UBExportAdaptor
{
Q_OBJECT
;
public
:
UBExportCFF
(
QObject
*
parent
=
0
);
virtual
~
UBExportCFF
();
virtual
QString
exportName
();
virtual
QString
exportExtention
();
virtual
void
persist
(
UBDocumentProxy
*
pDocument
);
};
#endif
/* UBExportCFF_H_ */
\ No newline at end of file
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
f16c06f9
This diff is collapsed.
Click to expand it.
src/adaptors/UBSvgSubsetAdaptor.h
View file @
f16c06f9
...
@@ -134,6 +134,8 @@ class UBSvgSubsetAdaptor
...
@@ -134,6 +134,8 @@ class UBSvgSubsetAdaptor
void
graphicsItemFromSvg
(
QGraphicsItem
*
gItem
);
void
graphicsItemFromSvg
(
QGraphicsItem
*
gItem
);
qreal
getZValueFromSvg
();
QXmlStreamReader
mXmlReader
;
QXmlStreamReader
mXmlReader
;
int
mFileVersion
;
int
mFileVersion
;
UBDocumentProxy
*
mProxy
;
UBDocumentProxy
*
mProxy
;
...
...
src/adaptors/adaptors.pri
View file @
f16c06f9
...
@@ -14,6 +14,7 @@ HEADERS += src/adaptors/UBExportAdaptor.h\
...
@@ -14,6 +14,7 @@ HEADERS += src/adaptors/UBExportAdaptor.h\
src/adaptors/UBExportWeb.h \
src/adaptors/UBExportWeb.h \
src/adaptors/UBWebPublisher.h \
src/adaptors/UBWebPublisher.h \
src/adaptors/UBImportCFF.h \
src/adaptors/UBImportCFF.h \
src/adaptors/UBExportCFF.h \
src/adaptors/UBCFFSubsetAdaptor.h
src/adaptors/UBCFFSubsetAdaptor.h
HEADERS += src/adaptors/publishing/UBDocumentPublisher.h \
HEADERS += src/adaptors/publishing/UBDocumentPublisher.h \
...
@@ -36,6 +37,7 @@ SOURCES += src/adaptors/UBExportAdaptor.cpp\
...
@@ -36,6 +37,7 @@ SOURCES += src/adaptors/UBExportAdaptor.cpp\
src/adaptors/UBExportWeb.cpp \
src/adaptors/UBExportWeb.cpp \
src/adaptors/UBWebPublisher.cpp \
src/adaptors/UBWebPublisher.cpp \
src/adaptors/UBImportCFF.cpp \
src/adaptors/UBImportCFF.cpp \
src/adaptors/UBExportCFF.cpp \
src/adaptors/UBCFFSubsetAdaptor.cpp \
src/adaptors/UBCFFSubsetAdaptor.cpp \
src/adaptors/publishing/UBDocumentPublisher.cpp
src/adaptors/publishing/UBDocumentPublisher.cpp
...
...
src/board/UBBoardController.cpp
View file @
f16c06f9
...
@@ -664,6 +664,7 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint)
...
@@ -664,6 +664,7 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint)
UBApplication
::
applicationController
->
adjustDisplayView
();
UBApplication
::
applicationController
->
adjustDisplayView
();
emit
controlViewportChanged
();
emit
controlViewportChanged
();
mActiveScene
->
setBackgroundZoomFactor
(
mControlView
->
transform
().
m11
());
}
}
...
@@ -1163,7 +1164,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
...
@@ -1163,7 +1164,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
mControlView
->
setScene
(
mActiveScene
);
mControlView
->
setScene
(
mActiveScene
);
mDisplayView
->
setScene
(
mActiveScene
);
mDisplayView
->
setScene
(
mActiveScene
);
mActiveScene
->
setBackgroundZoomFactor
(
mControlView
->
transform
().
m11
());
pDocumentProxy
->
setDefaultDocumentSize
(
mActiveScene
->
nominalSize
());
pDocumentProxy
->
setDefaultDocumentSize
(
mActiveScene
->
nominalSize
());
updatePageSizeState
();
updatePageSizeState
();
...
@@ -1564,7 +1565,7 @@ void UBBoardController::updateSystemScaleFactor()
...
@@ -1564,7 +1565,7 @@ void UBBoardController::updateSystemScaleFactor()
mControlView
->
setTransform
(
scalingTransform
);
mControlView
->
setTransform
(
scalingTransform
);
mControlView
->
horizontalScrollBar
()
->
setValue
(
viewState
.
horizontalPosition
);
mControlView
->
horizontalScrollBar
()
->
setValue
(
viewState
.
horizontalPosition
);
mControlView
->
verticalScrollBar
()
->
setValue
(
viewState
.
verticalPostition
);
mControlView
->
verticalScrollBar
()
->
setValue
(
viewState
.
verticalPostition
);
}
mActiveScene
->
setBackgroundZoomFactor
(
mControlView
->
transform
().
m11
());
}
void
UBBoardController
::
setWidePageSize
(
bool
checked
)
void
UBBoardController
::
setWidePageSize
(
bool
checked
)
...
@@ -1943,8 +1944,6 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
...
@@ -1943,8 +1944,6 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
if
(
gi
)
if
(
gi
)
{
{
// gi->setZValue(mActiveScene->getNextObjectZIndex());
UBGraphicsItem
::
assignZValue
(
gi
,
mActiveScene
->
getNextObjectZIndex
());
mActiveScene
->
addItem
(
gi
);
mActiveScene
->
addItem
(
gi
);
gi
->
setPos
(
gi
->
pos
()
+
QPointF
(
50
,
50
));
gi
->
setPos
(
gi
->
pos
()
+
QPointF
(
50
,
50
));
}
}
...
...
src/board/UBBoardView.cpp
View file @
f16c06f9
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsTriangle.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
...
@@ -425,7 +426,8 @@ UBBoardView::mousePressEvent (QMouseEvent *event)
...
@@ -425,7 +426,8 @@ UBBoardView::mousePressEvent (QMouseEvent *event)
||
movingItem
->
type
()
==
UBGraphicsCompass
::
Type
||
movingItem
->
type
()
==
UBGraphicsCompass
::
Type
||
movingItem
->
type
()
==
UBGraphicsPDFItem
::
Type
||
movingItem
->
type
()
==
UBGraphicsPDFItem
::
Type
||
movingItem
->
type
()
==
UBGraphicsPolygonItem
::
Type
||
movingItem
->
type
()
==
UBGraphicsPolygonItem
::
Type
||
movingItem
->
type
()
==
UBGraphicsCache
::
Type
)
||
movingItem
->
type
()
==
UBGraphicsCache
::
Type
||
movingItem
->
type
()
==
UBGraphicsTriangle
::
Type
)
{
{
movingItem
=
NULL
;
movingItem
=
NULL
;
QGraphicsView
::
mousePressEvent
(
event
);
QGraphicsView
::
mousePressEvent
(
event
);
...
...
src/core/UB.h
View file @
f16c06f9
...
@@ -62,7 +62,7 @@ struct UBSize
...
@@ -62,7 +62,7 @@ struct UBSize
};
};
};
};
// Deprecated. Keep it for backward campability with old versions
struct
UBItemLayerType
struct
UBItemLayerType
{
{
enum
Enum
enum
Enum
...
@@ -71,17 +71,38 @@ struct UBItemLayerType
...
@@ -71,17 +71,38 @@ struct UBItemLayerType
};
};
};
};
struct
itemLayerType
{
enum
Enum
{
NoLayer
=
0
,
BackgroundItem
,
ObjectItem
,
DrawingItem
,
ToolItem
,
CppTool
,
Eraiser
,
Curtain
,
Pointer
,
Cache
,
SelectedItem
};
};
struct
UBGraphicsItemData
struct
UBGraphicsItemData
{
{
enum
Enum
enum
Enum
{
{
ItemLayerType
ItemLayerType
//Deprecated. Keep it for backward campability with old versions. Use itemLayerType instead
,
ItemLocked
,
ItemLocked
,
ItemEditable
//for text only
,
ItemEditable
//for text only
,
ItemOwnZValue
,
ItemOwnZValue
,
itemLayerType
//use instead of deprecated ItemLayerType
};
};
};
};
struct
UBGraphicsItemType
struct
UBGraphicsItemType
{
{
enum
Enum
enum
Enum
...
...
src/core/UBApplication.cpp
View file @
f16c06f9
...
@@ -289,7 +289,6 @@ int UBApplication::exec(const QString& pFileToImport)
...
@@ -289,7 +289,6 @@ int UBApplication::exec(const QString& pFileToImport)
bool
bUseMultiScreen
=
UBSettings
::
settings
()
->
appUseMultiscreen
->
get
().
toBool
();
bool
bUseMultiScreen
=
UBSettings
::
settings
()
->
appUseMultiscreen
->
get
().
toBool
();
mainWindow
->
actionMultiScreen
->
setChecked
(
bUseMultiScreen
);
mainWindow
->
actionMultiScreen
->
setChecked
(
bUseMultiScreen
);
applicationController
->
useMultiScreen
(
bUseMultiScreen
);
connect
(
mainWindow
->
actionMultiScreen
,
SIGNAL
(
triggered
(
bool
)),
applicationController
,
SLOT
(
useMultiScreen
(
bool
)));
connect
(
mainWindow
->
actionMultiScreen
,
SIGNAL
(
triggered
(
bool
)),
applicationController
,
SLOT
(
useMultiScreen
(
bool
)));
connect
(
mainWindow
->
actionWidePageSize
,
SIGNAL
(
triggered
(
bool
)),
boardController
,
SLOT
(
setWidePageSize
(
bool
)));
connect
(
mainWindow
->
actionWidePageSize
,
SIGNAL
(
triggered
(
bool
)),
boardController
,
SLOT
(
setWidePageSize
(
bool
)));
connect
(
mainWindow
->
actionRegularPageSize
,
SIGNAL
(
triggered
(
bool
)),
boardController
,
SLOT
(
setRegularPageSize
(
bool
)));
connect
(
mainWindow
->
actionRegularPageSize
,
SIGNAL
(
triggered
(
bool
)),
boardController
,
SLOT
(
setRegularPageSize
(
bool
)));
...
@@ -299,7 +298,7 @@ int UBApplication::exec(const QString& pFileToImport)
...
@@ -299,7 +298,7 @@ int UBApplication::exec(const QString& pFileToImport)
connect
(
mainWindow
->
actionCopy
,
SIGNAL
(
triggered
()),
applicationController
,
SLOT
(
actionCopy
()));
connect
(
mainWindow
->
actionCopy
,
SIGNAL
(
triggered
()),
applicationController
,
SLOT
(
actionCopy
()));
connect
(
mainWindow
->
actionPaste
,
SIGNAL
(
triggered
()),
applicationController
,
SLOT
(
actionPaste
()));
connect
(
mainWindow
->
actionPaste
,
SIGNAL
(
triggered
()),
applicationController
,
SLOT
(
actionPaste
()));
applicationController
->
initScreenLayout
();
applicationController
->
initScreenLayout
(
bUseMultiScreen
);
boardController
->
setupLayout
();
boardController
->
setupLayout
();
if
(
pFileToImport
.
length
()
>
0
)
if
(
pFileToImport
.
length
()
>
0
)
...
...
src/core/UBApplicationController.cpp
View file @
f16c06f9
...
@@ -135,14 +135,15 @@ void UBApplicationController::initViewState(int horizontalPosition, int vertical
...
@@ -135,14 +135,15 @@ void UBApplicationController::initViewState(int horizontalPosition, int vertical
}
}
void
UBApplicationController
::
initScreenLayout
()
void
UBApplicationController
::
initScreenLayout
(
bool
useMultiscreen
)
{
{
mDisplayManager
->
set
AsControl
(
mMainWindow
,
true
);
mDisplayManager
->
set
ControlWidget
(
mMainWindow
);
mDisplayManager
->
set
AsDisplay
(
mDisplayView
);
mDisplayManager
->
set
DisplayWidget
(
mDisplayView
);
mDisplayManager
->
set
AsPreviousDisplay
s
(
mPreviousViews
);
mDisplayManager
->
set
PreviousDisplaysWidget
s
(
mPreviousViews
);
mDisplayManager
->
set
AsDesktop
(
mUninoteController
->
drawingView
());
mDisplayManager
->
set
DesktopWidget
(
mUninoteController
->
drawingView
());
mDisplayManager
->
setUseMultiScreen
(
useMultiscreen
);
mDisplayManager
->
adjustScreens
(
-
1
);
mDisplayManager
->
adjustScreens
(
-
1
);
}
}
...
@@ -343,7 +344,6 @@ void UBApplicationController::showBoard()
...
@@ -343,7 +344,6 @@ void UBApplicationController::showBoard()
mirroringEnabled
(
false
);
mirroringEnabled
(
false
);
mMainWindow
->
switchToBoardWidget
();
mMainWindow
->
switchToBoardWidget
();
mDisplayManager
->
setAsDisplay
(
mDisplayView
);
if
(
UBApplication
::
boardController
)
if
(
UBApplication
::
boardController
)
UBApplication
::
boardController
->
show
();
UBApplication
::
boardController
->
show
();
...
@@ -353,7 +353,7 @@ void UBApplicationController::showBoard()
...
@@ -353,7 +353,7 @@ void UBApplicationController::showBoard()
mUninoteController
->
hideWindow
();
mUninoteController
->
hideWindow
();
m
DisplayManager
->
adjustScreens
(
0
);
m
MainWindow
->
show
(
);
emit
mainModeChanged
(
Board
);
emit
mainModeChanged
(
Board
);
...
@@ -637,12 +637,12 @@ void UBApplicationController::mirroringEnabled(bool enabled)
...
@@ -637,12 +637,12 @@ void UBApplicationController::mirroringEnabled(bool enabled)
if
(
enabled
)
if
(
enabled
)
{
{
mMirror
->
start
();
mMirror
->
start
();
mDisplayManager
->
set
AsDisplay
(
mMirror
);
mDisplayManager
->
set
DisplayWidget
(
mMirror
);
}
}
else
else
{
{
mDisplayManager
->
set
AsDisplay
(
mDisplayView
);
mDisplayManager
->
set
DisplayWidget
(
mDisplayView
);
mMirror
->
stop
();
mMirror
->
stop
();
}
}
...
@@ -652,7 +652,7 @@ void UBApplicationController::mirroringEnabled(bool enabled)
...
@@ -652,7 +652,7 @@ void UBApplicationController::mirroringEnabled(bool enabled)
}
}
else
else
{
{
mDisplayManager
->
set
AsDisplay
(
mDisplayView
);
mDisplayManager
->
set
DisplayWidget
(
mDisplayView
);
}
}
}
}
...
@@ -727,6 +727,7 @@ void UBApplicationController::importFile(const QString& pFilePath)
...
@@ -727,6 +727,7 @@ void UBApplicationController::importFile(const QString& pFilePath)
void
UBApplicationController
::
useMultiScreen
(
bool
use
)
void
UBApplicationController
::
useMultiScreen
(
bool
use
)
{
{
mDisplayManager
->
setUseMultiScreen
(
use
);
mDisplayManager
->
setUseMultiScreen
(
use
);
mDisplayManager
->
adjustScreens
(
0
);
UBSettings
::
settings
()
->
appUseMultiscreen
->
set
(
use
);
UBSettings
::
settings
()
->
appUseMultiscreen
->
set
(
use
);
}
}
...
...
src/core/UBApplicationController.h
View file @
f16c06f9
...
@@ -51,7 +51,7 @@ class UBApplicationController : public QObject
...
@@ -51,7 +51,7 @@ class UBApplicationController : public QObject
void
blackout
();
void
blackout
();
void
initScreenLayout
();
void
initScreenLayout
(
bool
useMultiscreen
);
void
closing
();
void
closing
();
...
...
src/core/UBDisplayManager.cpp
View file @
f16c06f9
...
@@ -118,16 +118,11 @@ int UBDisplayManager::numPreviousViews()
...
@@ -118,16 +118,11 @@ int UBDisplayManager::numPreviousViews()
}
}
void
UBDisplayManager
::
set
AsControl
(
QWidget
*
pControlWidget
,
bool
ini
t
)
void
UBDisplayManager
::
set
ControlWidget
(
QWidget
*
pControlWidge
t
)
{
{
if
(
hasControl
()
&&
pControlWidget
&&
(
pControlWidget
!=
mControlWidget
))
if
(
hasControl
()
&&
pControlWidget
&&
(
pControlWidget
!=
mControlWidget
))
{
{
mControlWidget
=
pControlWidget
;
mControlWidget
=
pControlWidget
;
mControlWidget
->
hide
();
mControlWidget
->
setGeometry
(
mDesktop
->
screenGeometry
(
mControlScreenIndex
));
if
(
!
init
)
mControlWidget
->
showFullScreen
();
// !!!! Should be included into Windows after QT recompilation
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
#ifdef Q_WS_MAC
// mControlWidget->setAttribute(Qt::WA_MacNoShadow);
// mControlWidget->setAttribute(Qt::WA_MacNoShadow);
...
@@ -135,14 +130,11 @@ void UBDisplayManager::setAsControl(QWidget* pControlWidget, bool init)
...
@@ -135,14 +130,11 @@ void UBDisplayManager::setAsControl(QWidget* pControlWidget, bool init)
}
}
}
}
void
UBDisplayManager
::
set
AsDesktop
(
QWidget
*
pControlWidget
)
void
UBDisplayManager
::
set
DesktopWidget
(
QWidget
*
pControlWidget
)
{
{
if
(
pControlWidget
&&
(
pControlWidget
!=
mControlWidget
))
if
(
pControlWidget
&&
(
pControlWidget
!=
mControlWidget
))
{
{
mDesktopWidget
=
pControlWidget
;
mDesktopWidget
=
pControlWidget
;
mDesktopWidget
->
hide
();
mDesktopWidget
->
setGeometry
(
mDesktop
->
screenGeometry
(
mControlScreenIndex
));
// mDisplayWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
#ifdef Q_WS_MAC
// mControlWidget->setAttribute(Qt::WA_MacNoShadow);
// mControlWidget->setAttribute(Qt::WA_MacNoShadow);
...
@@ -150,14 +142,11 @@ void UBDisplayManager::setAsDesktop(QWidget* pControlWidget )
...
@@ -150,14 +142,11 @@ void UBDisplayManager::setAsDesktop(QWidget* pControlWidget )
}
}
}
}
void
UBDisplayManager
::
set
AsDisplay
(
QWidget
*
pDisplayWidget
)
void
UBDisplayManager
::
set
DisplayWidget
(
QWidget
*
pDisplayWidget
)
{
{
if
(
pDisplayWidget
&&
(
pDisplayWidget
!=
mDisplayWidget
))
if
(
pDisplayWidget
&&
(
pDisplayWidget
!=
mDisplayWidget
))
{
{
mDisplayWidget
=
pDisplayWidget
;
mDisplayWidget
=
pDisplayWidget
;
mDisplayWidget
->
hide
();
mDisplayWidget
->
setGeometry
(
mDesktop
->
screenGeometry
(
mDisplayScreenIndex
));
mDisplayWidget
->
showFullScreen
();
// !!!! Should be included into Windows after QT recompilation
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
#ifdef Q_WS_MAC
// mDisplayWidget->setAttribute(Qt::WA_MacNoShadow);
// mDisplayWidget->setAttribute(Qt::WA_MacNoShadow);
...
@@ -166,7 +155,7 @@ void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget)
...
@@ -166,7 +155,7 @@ void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget)
}
}
void
UBDisplayManager
::
set
AsPreviousDisplay
s
(
QList
<
UBBoardView
*>
pPreviousViews
)
void
UBDisplayManager
::
set
PreviousDisplaysWidget
s
(
QList
<
UBBoardView
*>
pPreviousViews
)
{
{
mPreviousDisplayWidgets
=
pPreviousViews
;
mPreviousDisplayWidgets
=
pPreviousViews
;
}
}
...
@@ -182,7 +171,7 @@ QRect UBDisplayManager::displayGeometry()
...
@@ -182,7 +171,7 @@ QRect UBDisplayManager::displayGeometry()
return
mDesktop
->
screenGeometry
(
mDisplayScreenIndex
);
return
mDesktop
->
screenGeometry
(
mDisplayScreenIndex
);
}
}
void
UBDisplayManager
::
swap
Screens
(
bool
swap
)
void
UBDisplayManager
::
reinit
Screens
(
bool
swap
)
{
{
Q_UNUSED
(
swap
);
Q_UNUSED
(
swap
);
adjustScreens
(
-
1
);
adjustScreens
(
-
1
);
...
@@ -310,6 +299,5 @@ void UBDisplayManager::setRoleToScreen(DisplayRole role, int screenIndex)
...
@@ -310,6 +299,5 @@ void UBDisplayManager::setRoleToScreen(DisplayRole role, int screenIndex)
void
UBDisplayManager
::
setUseMultiScreen
(
bool
pUse
)
void
UBDisplayManager
::
setUseMultiScreen
(
bool
pUse
)
{
{
mUseMultiScreen
=
pUse
;
mUseMultiScreen
=
pUse
;
adjustScreens
(
0
);
}
}
src/core/UBDisplayManager.h
View file @
f16c06f9
...
@@ -33,13 +33,13 @@ class UBDisplayManager : public QObject
...
@@ -33,13 +33,13 @@ class UBDisplayManager : public QObject
int
numPreviousViews
();
int
numPreviousViews
();
void
set
AsControl
(
QWidget
*
pControlWidget
,
bool
init
=
false
);
void
set
ControlWidget
(
QWidget
*
pControlWidget
);
void
set
AsDisplay
(
QWidget
*
pDisplayWidget
);
void
set
DisplayWidget
(
QWidget
*
pDisplayWidget
);
void
set
AsDesktop
(
QWidget
*
pControlWidget
);
void
set
DesktopWidget
(
QWidget
*
pControlWidget
);
void
set
AsPreviousDisplay
s
(
QList
<
UBBoardView
*>
pPreviousViews
);
void
set
PreviousDisplaysWidget
s
(
QList
<
UBBoardView
*>
pPreviousViews
);
bool
hasControl
()
bool
hasControl
()
{
{
...
@@ -77,7 +77,7 @@ class UBDisplayManager : public QObject
...
@@ -77,7 +77,7 @@ class UBDisplayManager : public QObject
public
slots
:
public
slots
:
void
swap
Screens
(
bool
bswap
);
void
reinit
Screens
(
bool
bswap
);
void
adjustScreens
(
int
screen
);
void
adjustScreens
(
int
screen
);
...
...
src/core/UBDocumentManager.cpp
View file @
f16c06f9
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "adaptors/UBExportFullPDF.h"
#include "adaptors/UBExportFullPDF.h"
#include "adaptors/UBExportDocument.h"
#include "adaptors/UBExportDocument.h"
#include "adaptors/UBExportWeb.h"
#include "adaptors/UBExportWeb.h"
#include "adaptors/UBExportCFF.h"
#include "adaptors/UBWebPublisher.h"
#include "adaptors/UBWebPublisher.h"
#include "adaptors/UBImportDocument.h"
#include "adaptors/UBImportDocument.h"
#include "adaptors/UBImportPDF.h"
#include "adaptors/UBImportPDF.h"
...
@@ -62,6 +63,8 @@ UBDocumentManager::UBDocumentManager(QObject *parent)
...
@@ -62,6 +63,8 @@ UBDocumentManager::UBDocumentManager(QObject *parent)
QString
dummyObjects
=
tr
(
"objects"
);
QString
dummyObjects
=
tr
(
"objects"
);
QString
dummyWidgets
=
tr
(
"widgets"
);
QString
dummyWidgets
=
tr
(
"widgets"
);
UBExportCFF
*
cffExporter
=
new
UBExportCFF
(
this
);
mExportAdaptors
.
append
(
cffExporter
);
UBExportFullPDF
*
exportFullPdf
=
new
UBExportFullPDF
(
this
);
UBExportFullPDF
*
exportFullPdf
=
new
UBExportFullPDF
(
this
);
mExportAdaptors
.
append
(
exportFullPdf
);
mExportAdaptors
.
append
(
exportFullPdf
);
UBExportDocument
*
exportDocument
=
new
UBExportDocument
(
this
);
UBExportDocument
*
exportDocument
=
new
UBExportDocument
(
this
);
...
...
src/core/UBPreferencesController.cpp
View file @
f16c06f9
...
@@ -118,7 +118,7 @@ void UBPreferencesController::wire()
...
@@ -118,7 +118,7 @@ void UBPreferencesController::wire()
connect
(
mPreferencesUI
->
useExternalBrowserCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
webUseExternalBrowser
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
useExternalBrowserCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
webUseExternalBrowser
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
displayBrowserPageCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
webShowPageImmediatelyOnMirroredScreen
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
displayBrowserPageCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
webShowPageImmediatelyOnMirroredScreen
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
swapControlAndDisplayScreensCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
swapControlAndDisplayScreens
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
swapControlAndDisplayScreensCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
swapControlAndDisplayScreens
,
SLOT
(
setBool
(
bool
)));
connect
(
mPreferencesUI
->
swapControlAndDisplayScreensCheckBox
,
SIGNAL
(
clicked
(
bool
)),
UBApplication
::
applicationController
->
displayManager
(),
SLOT
(
swap
Screens
(
bool
)));
connect
(
mPreferencesUI
->
swapControlAndDisplayScreensCheckBox
,
SIGNAL
(
clicked
(
bool
)),
UBApplication
::
applicationController
->
displayManager
(),
SLOT
(
reinit
Screens
(
bool
)));
connect
(
mPreferencesUI
->
toolbarAtTopRadioButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toolbarPositionChanged
(
bool
)));
connect
(
mPreferencesUI
->
toolbarAtTopRadioButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toolbarPositionChanged
(
bool
)));
connect
(
mPreferencesUI
->
toolbarAtBottomRadioButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toolbarPositionChanged
(
bool
)));
connect
(
mPreferencesUI
->
toolbarAtBottomRadioButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toolbarPositionChanged
(
bool
)));
...
...
src/desktop/UBDesktopAnnotationController.cpp
View file @
f16c06f9
...
@@ -88,6 +88,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
...
@@ -88,6 +88,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingScene
=
new
UBGraphicsScene
(
0
);
mTransparentDrawingScene
=
new
UBGraphicsScene
(
0
);
mTransparentDrawingView
->
setScene
(
mTransparentDrawingScene
);
mTransparentDrawingView
->
setScene
(
mTransparentDrawingScene
);
mTransparentDrawingScene
->
setDrawingMode
(
true
);
// mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView);
// mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView);
//mRightPalette = new UBRightPalette(mTransparentDrawingView);
//mRightPalette = new UBRightPalette(mTransparentDrawingView);
...
...
src/domain/UBGraphicsAudioItem.cpp
View file @
f16c06f9
...
@@ -64,6 +64,8 @@ UBGraphicsAudioItem::UBGraphicsAudioItem(const QUrl& pAudioFileUrl, QGraphicsIte
...
@@ -64,6 +64,8 @@ UBGraphicsAudioItem::UBGraphicsAudioItem(const QUrl& pAudioFileUrl, QGraphicsIte
mDelegate
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
mDelegate
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
}
}
void
UBGraphicsAudioItem
::
onStateChanged
(
Phonon
::
State
newState
,
Phonon
::
State
oldState
)
void
UBGraphicsAudioItem
::
onStateChanged
(
Phonon
::
State
newState
,
Phonon
::
State
oldState
)
...
@@ -95,8 +97,6 @@ UBItem* UBGraphicsAudioItem::deepCopy() const
...
@@ -95,8 +97,6 @@ UBItem* UBGraphicsAudioItem::deepCopy() const
UBGraphicsAudioItem
*
copy
=
new
UBGraphicsAudioItem
(
audioUrl
,
parentItem
());
UBGraphicsAudioItem
*
copy
=
new
UBGraphicsAudioItem
(
audioUrl
,
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
f16c06f9
...
@@ -73,29 +73,33 @@ void UBGraphicsItemDelegate::init()
...
@@ -73,29 +73,33 @@ void UBGraphicsItemDelegate::init()
{
{
mFrame
=
new
UBGraphicsDelegateFrame
(
this
,
QRectF
(
0
,
0
,
0
,
0
),
mFrameWidth
,
mRespectRatio
);
mFrame
=
new
UBGraphicsDelegateFrame
(
this
,
QRectF
(
0
,
0
,
0
,
0
),
mFrameWidth
,
mRespectRatio
);
mFrame
->
hide
();
mFrame
->
hide
();
// mFrame->setZValue(UBGraphicsScene::toolLayerStart + 1);
UBGraphicsItem
::
assignZValue
(
mFrame
,
UBGraphicsScene
::
toolLayerStart
+
1
);
mFrame
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
mFrame
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
mDeleteButton
=
new
DelegateButton
(
":/images/close.svg"
,
mDelegated
,
mFrame
);
mDeleteButton
=
new
DelegateButton
(
":/images/close.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
mButtons
<<
mDeleteButton
;
mButtons
<<
mDeleteButton
;
connect
(
mDeleteButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
remove
()));
connect
(
mDeleteButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
remove
()));
if
(
canDuplicate
()){
if
(
canDuplicate
()){
mDuplicateButton
=
new
DelegateButton
(
":/images/duplicate.svg"
,
mDelegated
,
mFrame
);
mDuplicateButton
=
new
DelegateButton
(
":/images/duplicate.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
connect
(
mDuplicateButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
duplicate
()));
connect
(
mDuplicateButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
duplicate
()));
mButtons
<<
mDuplicateButton
;
mButtons
<<
mDuplicateButton
;
}
}
mMenuButton
=
new
DelegateButton
(
":/images/menu.svg"
,
mDelegated
,
mFrame
);
mMenuButton
=
new
DelegateButton
(
":/images/menu.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
connect
(
mMenuButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
showMenu
()));
connect
(
mMenuButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
showMenu
()));
mButtons
<<
mMenuButton
;
mButtons
<<
mMenuButton
;
mZOrderUpButton
=
new
DelegateButton
(
":/images/plus.svg"
,
mDelegated
,
mFrame
,
Qt
::
BottomLeftSection
);
connect
(
mZOrderUpButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
increaseZLevel
()));
mButtons
<<
mZOrderUpButton
;
mZOrderDownButton
=
new
DelegateButton
(
":/images/minus.svg"
,
mDelegated
,
mFrame
,
Qt
::
BottomLeftSection
);
connect
(
mZOrderDownButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
decreaseZLevel
()));
mButtons
<<
mZOrderDownButton
;
buildButtons
();
buildButtons
();
foreach
(
DelegateButton
*
button
,
mButtons
)
foreach
(
DelegateButton
*
button
,
mButtons
)
{
{
button
->
hide
();
button
->
hide
();
// button->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem
::
assignZValue
(
button
,
UBGraphicsScene
::
toolLayerStart
+
2
);
button
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
button
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
}
}
}
}
...
@@ -160,18 +164,9 @@ bool UBGraphicsItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -160,18 +164,9 @@ bool UBGraphicsItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event)
if
(
!
mDelegated
->
isSelected
())
if
(
!
mDelegated
->
isSelected
())
{
{
mDelegated
->
setSelected
(
true
);
mDelegated
->
setSelected
(
true
);
UBGraphicsScene
*
scene
=
static_cast
<
UBGraphicsScene
*>
(
mDelegated
->
scene
());
qDebug
()
<<
mDelegated
->
zValue
();
qDebug
()
<<
mDelegated
->
zValue
();
qDebug
()
<<
scene
->
currentObjectZIndex
();
// To investigate. Z value behavior
// if (mDelegated->zValue() < scene->currentObjectZIndex() && !isLocked())
// mDelegated->setZValue(scene->getNextObjectZIndex());
positionHandles
();
positionHandles
();
return
true
;
return
true
;
}
}
else
else
...
@@ -239,12 +234,13 @@ void UBGraphicsItemDelegate::positionHandles()
...
@@ -239,12 +234,13 @@ void UBGraphicsItemDelegate::positionHandles()
mDeleteButton
->
setTransform
(
tr
);
mDeleteButton
->
setTransform
(
tr
);
qreal
topX
=
mFrame
->
rect
().
left
()
-
mDeleteButton
->
renderer
()
->
viewBox
().
width
()
*
mAntiScaleRatio
/
2
;
qreal
topY
=
mFrame
->
rect
().
top
()
-
mDeleteButton
->
renderer
()
->
viewBox
().
height
()
*
mAntiScaleRatio
/
2
;
// This is where the position of the buttons is calculated. It starts always on the topleft of mFrame!
qreal
bottomX
=
mFrame
->
rect
().
left
()
-
mDeleteButton
->
renderer
()
->
viewBox
().
width
()
*
mAntiScaleRatio
/
2
;
qreal
x
=
mFrame
->
rect
().
left
()
-
mDeleteButton
->
renderer
()
->
viewBox
().
width
()
*
mAntiScaleRatio
/
2
;
qreal
bottomY
=
mFrame
->
rect
().
bottom
()
-
mDeleteButton
->
renderer
()
->
viewBox
().
height
()
*
mAntiScaleRatio
/
2
;
qreal
y
=
mFrame
->
rect
().
top
()
-
mDeleteButton
->
renderer
()
->
viewBox
().
height
()
*
mAntiScaleRatio
/
2
;
mDeleteButton
->
setPos
(
x
,
y
);
mDeleteButton
->
setPos
(
topX
,
topY
);
if
(
!
mDeleteButton
->
scene
())
if
(
!
mDeleteButton
->
scene
())
{
{
...
@@ -262,13 +258,19 @@ void UBGraphicsItemDelegate::positionHandles()
...
@@ -262,13 +258,19 @@ void UBGraphicsItemDelegate::positionHandles()
lock
(
isLocked
());
lock
(
isLocked
());
for
(
int
i
=
1
;
i
<
mButtons
.
length
();
i
++
)
int
i
=
1
,
j
=
0
,
k
=
0
;
{
while
((
i
+
j
)
<
mButtons
.
size
())
{
DelegateButton
*
button
=
mButtons
[
i
];
DelegateButton
*
button
=
mButtons
[
i
+
j
];
button
->
setTransform
(
tr
);
button
->
setTransform
(
tr
);
button
->
setPos
(
x
+
(
i
*
1.6
*
mFrameWidth
*
mAntiScaleRatio
),
y
);
if
(
button
->
getSection
()
==
Qt
::
TopLeftSection
)
{
button
->
setPos
(
topX
+
(
i
++
*
1.6
*
mFrameWidth
*
mAntiScaleRatio
),
topY
);
}
else
if
(
button
->
getSection
()
==
Qt
::
BottomLeftSection
)
{
button
->
setPos
(
bottomX
+
(
++
j
*
1.6
*
mFrameWidth
*
mAntiScaleRatio
),
bottomY
);
}
else
if
(
button
->
getSection
()
==
Qt
::
NoSection
)
{
++
k
;
}
if
(
!
button
->
scene
())
if
(
!
button
->
scene
())
{
{
...
@@ -278,11 +280,10 @@ void UBGraphicsItemDelegate::positionHandles()
...
@@ -278,11 +280,10 @@ void UBGraphicsItemDelegate::positionHandles()
}
}
if
(
!
mFrame
->
isResizing
()){
if
(
!
mFrame
->
isResizing
()){
button
->
show
();
button
->
show
();
button
->
setZValue
(
delegated
()
->
zValue
());
}
}
}
}
}
}
else
{
else
{
foreach
(
DelegateButton
*
button
,
mButtons
)
foreach
(
DelegateButton
*
button
,
mButtons
)
button
->
hide
();
button
->
hide
();
...
@@ -325,7 +326,19 @@ void UBGraphicsItemDelegate::duplicate()
...
@@ -325,7 +326,19 @@ void UBGraphicsItemDelegate::duplicate()
UBApplication
::
boardController
->
copy
();
UBApplication
::
boardController
->
copy
();
UBApplication
::
boardController
->
paste
();
UBApplication
::
boardController
->
paste
();
}
}
void
UBGraphicsItemDelegate
::
increaseZLevel
(
int
delta
)
{
qDebug
()
<<
delegated
()
->
scene
()
->
items
().
count
();
// UBGraphicsItem::assignZValue(delegated(), )
// int valueCandidate = delegated()->data(UBGraphicsItemData::ItemOwnZValue).toInt();
// if (delta < 0) {
// } else if (delta > 0) {
// }
}
void
UBGraphicsItemDelegate
::
lock
(
bool
locked
)
void
UBGraphicsItemDelegate
::
lock
(
bool
locked
)
{
{
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
f16c06f9
...
@@ -33,10 +33,11 @@ class DelegateButton: public QGraphicsSvgItem
...
@@ -33,10 +33,11 @@ class DelegateButton: public QGraphicsSvgItem
Q_OBJECT
Q_OBJECT
public
:
public
:
DelegateButton
(
const
QString
&
fileName
,
QGraphicsItem
*
pDelegated
,
QGraphicsItem
*
parent
=
0
)
DelegateButton
(
const
QString
&
fileName
,
QGraphicsItem
*
pDelegated
,
QGraphicsItem
*
parent
=
0
,
Qt
::
WindowFrameSection
section
=
Qt
::
TopLeftSection
)
:
QGraphicsSvgItem
(
fileName
,
parent
)
:
QGraphicsSvgItem
(
fileName
,
parent
)
,
mDelegated
(
pDelegated
)
,
mDelegated
(
pDelegated
)
,
mIsTransparentToMouseEvent
(
false
)
,
mIsTransparentToMouseEvent
(
false
)
,
mButtonAlignmentSection
(
section
)
{
{
setAcceptedMouseButtons
(
Qt
::
LeftButton
);
setAcceptedMouseButtons
(
Qt
::
LeftButton
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
...
@@ -57,6 +58,9 @@ class DelegateButton: public QGraphicsSvgItem
...
@@ -57,6 +58,9 @@ class DelegateButton: public QGraphicsSvgItem
QGraphicsSvgItem
::
setSharedRenderer
(
new
QSvgRenderer
(
fileName
,
this
));
QGraphicsSvgItem
::
setSharedRenderer
(
new
QSvgRenderer
(
fileName
,
this
));
}
}
void
setSection
(
Qt
::
WindowFrameSection
section
)
{
mButtonAlignmentSection
=
section
;}
Qt
::
WindowFrameSection
getSection
()
const
{
return
mButtonAlignmentSection
;}
protected
:
protected
:
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
...
@@ -80,7 +84,9 @@ class DelegateButton: public QGraphicsSvgItem
...
@@ -80,7 +84,9 @@ class DelegateButton: public QGraphicsSvgItem
QGraphicsItem
*
mDelegated
;
QGraphicsItem
*
mDelegated
;
bool
mIsTransparentToMouseEvent
;
bool
mIsTransparentToMouseEvent
;
Qt
::
WindowFrameSection
mButtonAlignmentSection
;
signals
:
signals
:
void
clicked
(
bool
checked
=
false
);
void
clicked
(
bool
checked
=
false
);
...
@@ -147,6 +153,9 @@ class UBGraphicsItemDelegate : public QObject
...
@@ -147,6 +153,9 @@ class UBGraphicsItemDelegate : public QObject
virtual
void
lock
(
bool
lock
);
virtual
void
lock
(
bool
lock
);
virtual
void
duplicate
();
virtual
void
duplicate
();
virtual
void
increaseZLevel
()
{
increaseZLevel
(
1
);}
virtual
void
decreaseZLevel
()
{
increaseZLevel
(
-
1
);}
protected
:
protected
:
virtual
void
buildButtons
()
{;}
virtual
void
buildButtons
()
{;}
virtual
void
decorateMenu
(
QMenu
*
menu
);
virtual
void
decorateMenu
(
QMenu
*
menu
);
...
@@ -154,10 +163,15 @@ class UBGraphicsItemDelegate : public QObject
...
@@ -154,10 +163,15 @@ class UBGraphicsItemDelegate : public QObject
QGraphicsItem
*
mDelegated
;
QGraphicsItem
*
mDelegated
;
//buttons from the top left section of delegate frame
DelegateButton
*
mDeleteButton
;
DelegateButton
*
mDeleteButton
;
DelegateButton
*
mDuplicateButton
;
DelegateButton
*
mDuplicateButton
;
DelegateButton
*
mMenuButton
;
DelegateButton
*
mMenuButton
;
//buttons from the bottom left section of delegate frame
DelegateButton
*
mZOrderUpButton
;
DelegateButton
*
mZOrderDownButton
;
QMenu
*
mMenu
;
QMenu
*
mMenu
;
QAction
*
mLockAction
;
QAction
*
mLockAction
;
...
@@ -176,6 +190,8 @@ protected slots:
...
@@ -176,6 +190,8 @@ protected slots:
private
:
private
:
virtual
void
increaseZLevel
(
int
delta
);
QPointF
mOffset
;
QPointF
mOffset
;
QTransform
mPreviousTransform
;
QTransform
mPreviousTransform
;
QPointF
mPreviousPosition
;
QPointF
mPreviousPosition
;
...
...
src/domain/UBGraphicsPDFItem.cpp
View file @
f16c06f9
...
@@ -26,7 +26,8 @@
...
@@ -26,7 +26,8 @@
UBGraphicsPDFItem
::
UBGraphicsPDFItem
(
PDFRenderer
*
renderer
,
int
pageNumber
,
QGraphicsItem
*
parent
)
UBGraphicsPDFItem
::
UBGraphicsPDFItem
(
PDFRenderer
*
renderer
,
int
pageNumber
,
QGraphicsItem
*
parent
)
:
GraphicsPDFItem
(
renderer
,
pageNumber
,
parent
)
:
GraphicsPDFItem
(
renderer
,
pageNumber
,
parent
)
{
{
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
//deprecated
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
BackgroundItem
));
//Necessary to set if we want z value to be assigned correctly
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
);
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
);
mDelegate
->
init
();
mDelegate
->
init
();
}
}
...
@@ -84,8 +85,6 @@ UBItem* UBGraphicsPDFItem::deepCopy() const
...
@@ -84,8 +85,6 @@ UBItem* UBGraphicsPDFItem::deepCopy() const
UBGraphicsPDFItem
*
copy
=
new
UBGraphicsPDFItem
(
mRenderer
,
mPageNumber
,
parentItem
());
UBGraphicsPDFItem
*
copy
=
new
UBGraphicsPDFItem
(
mRenderer
,
mPageNumber
,
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -135,8 +134,6 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const
...
@@ -135,8 +134,6 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const
pixmapItem
->
setPixmap
(
pixmap
);
pixmapItem
->
setPixmap
(
pixmap
);
pixmapItem
->
setPos
(
this
->
pos
());
pixmapItem
->
setPos
(
this
->
pos
());
// pixmapItem->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
pixmapItem
,
this
->
zValue
());
pixmapItem
->
setTransform
(
this
->
transform
());
pixmapItem
->
setTransform
(
this
->
transform
());
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBGraphicsPixmapItem.cpp
View file @
f16c06f9
...
@@ -37,6 +37,7 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
...
@@ -37,6 +37,7 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setTransformationMode
(
Qt
::
SmoothTransformation
);
setTransformationMode
(
Qt
::
SmoothTransformation
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
}
}
...
@@ -102,8 +103,6 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const
...
@@ -102,8 +103,6 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const
copy
->
setPixmap
(
this
->
pixmap
());
copy
->
setPixmap
(
this
->
pixmap
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBGraphicsPolygonItem.cpp
View file @
f16c06f9
...
@@ -30,6 +30,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (QGraphicsItem * parent)
...
@@ -30,6 +30,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (QGraphicsItem * parent)
,
mStroke
(
0
)
,
mStroke
(
0
)
{
{
// NOOP
// NOOP
initialize
();
}
}
...
@@ -40,6 +41,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QPolygonF & polygon, QGraphi
...
@@ -40,6 +41,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QPolygonF & polygon, QGraphi
,
mStroke
(
0
)
,
mStroke
(
0
)
{
{
// NOOP
// NOOP
initialize
();
}
}
...
@@ -51,6 +53,12 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth)
...
@@ -51,6 +53,12 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth)
,
mStroke
(
0
)
,
mStroke
(
0
)
{
{
// NOOP
// NOOP
initialize
();
}
void
UBGraphicsPolygonItem
::
initialize
()
{
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
DrawingItem
));
//Necessary to set if we want z value to be assigned correctly
}
}
void
UBGraphicsPolygonItem
::
clearStroke
()
void
UBGraphicsPolygonItem
::
clearStroke
()
...
@@ -153,9 +161,6 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
...
@@ -153,9 +161,6 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
copy
->
setPen
(
this
->
pen
());
copy
->
setPen
(
this
->
pen
());
copy
->
mHasAlpha
=
this
->
mHasAlpha
;
copy
->
mHasAlpha
=
this
->
mHasAlpha
;
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setColorOnDarkBackground
(
this
->
colorOnDarkBackground
());
copy
->
setColorOnDarkBackground
(
this
->
colorOnDarkBackground
());
copy
->
setColorOnLightBackground
(
this
->
colorOnLightBackground
());
copy
->
setColorOnLightBackground
(
this
->
colorOnLightBackground
());
...
...
src/domain/UBGraphicsPolygonItem.h
View file @
f16c06f9
...
@@ -35,6 +35,8 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
...
@@ -35,6 +35,8 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
~
UBGraphicsPolygonItem
();
~
UBGraphicsPolygonItem
();
void
initialize
();
void
setColor
(
const
QColor
&
color
);
void
setColor
(
const
QColor
&
color
);
QColor
color
()
const
;
QColor
color
()
const
;
...
...
src/domain/UBGraphicsScene.cpp
View file @
f16c06f9
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsScene.h
View file @
f16c06f9
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#include "UBItem.h"
#include "UBItem.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCurtainItem.h"
class
UBGraphicsPixmapItem
;
class
UBGraphicsPixmapItem
;
class
UBGraphicsProxyWidget
;
class
UBGraphicsProxyWidget
;
class
UBGraphicsSvgItem
;
class
UBGraphicsSvgItem
;
...
@@ -50,11 +49,41 @@ class UBGraphicsCache;
...
@@ -50,11 +49,41 @@ class UBGraphicsCache;
const
double
PI
=
4
.
0
*
atan
(
1
.
0
);
const
double
PI
=
4
.
0
*
atan
(
1
.
0
);
class
UBZLayerController
{
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
;
};
typedef
QMap
<
itemLayerType
::
Enum
,
ItemLayerTypeData
>
ScopeMap
;
UBZLayerController
();
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
);
private
:
ScopeMap
scopeMap
;
static
qreal
errorNumber
;
};
class
UBGraphicsScene
:
public
UBCoreGraphicsScene
,
public
UBItem
class
UBGraphicsScene
:
public
UBCoreGraphicsScene
,
public
UBItem
{
{
Q_OBJECT
Q_OBJECT
public
:
public
:
// tmp stub for divide addings scene objects from undo mechanism implementation
// tmp stub for divide addings scene objects from undo mechanism implementation
void
setURStackEnable
(
bool
set
=
true
)
{
enableUndoRedoStack
=
set
;}
void
setURStackEnable
(
bool
set
=
true
)
{
enableUndoRedoStack
=
set
;}
...
@@ -152,23 +181,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -152,23 +181,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
return
mCrossedBackground
;
return
mCrossedBackground
;
}
}
void
setDrawingZIndex
(
qreal
pDrawingZIndex
)
{
mDrawingZIndex
=
pDrawingZIndex
;
}
void
setObjectZIndex
(
qreal
pObjectZIndex
)
{
mObjectZIndex
=
pObjectZIndex
;
}
bool
hasBackground
()
bool
hasBackground
()
{
{
return
(
mBackgroundObject
!=
0
);
return
(
mBackgroundObject
!=
0
);
}
}
qreal
getNextObjectZIndex
();
void
addRuler
(
QPointF
center
);
void
addRuler
(
QPointF
center
);
void
addProtractor
(
QPointF
center
);
void
addProtractor
(
QPointF
center
);
void
addCompass
(
QPointF
center
);
void
addCompass
(
QPointF
center
);
...
@@ -225,11 +242,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -225,11 +242,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void
setNominalSize
(
int
pWidth
,
int
pHeight
);
void
setNominalSize
(
int
pWidth
,
int
pHeight
);
qreal
currentObjectZIndex
()
{
return
mObjectZIndex
;
}
enum
RenderingContext
enum
RenderingContext
{
{
Screen
=
0
,
NonScreen
,
PdfExport
,
Podcast
Screen
=
0
,
NonScreen
,
PdfExport
,
Podcast
...
@@ -276,7 +288,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -276,7 +288,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void
hideEraser
();
void
hideEraser
();
void
setBackground
(
bool
pIsDark
,
bool
pIsCrossed
);
void
setBackground
(
bool
pIsDark
,
bool
pIsCrossed
);
void
setBackgroundZoomFactor
(
qreal
zoom
);
void
setDrawingMode
(
bool
bModeDesktop
);
void
deselectAllItems
();
void
deselectAllItems
();
UBGraphicsPixmapItem
*
addPixmap
(
const
QPixmap
&
pPixmap
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
),
qreal
scaleFactor
=
1
.
0
,
bool
pUseAnimation
=
false
);
UBGraphicsPixmapItem
*
addPixmap
(
const
QPixmap
&
pPixmap
,
const
QPointF
&
pPos
=
QPointF
(
0
,
0
),
qreal
scaleFactor
=
1
.
0
,
bool
pUseAnimation
=
false
);
...
@@ -314,18 +327,19 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -314,18 +327,19 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void
recolorAllItems
();
void
recolorAllItems
();
qreal
getNextDrawingZIndex
();
virtual
void
drawItems
(
QPainter
*
painter
,
int
numItems
,
virtual
void
drawItems
(
QPainter
*
painter
,
int
numItems
,
QGraphicsItem
*
items
[],
const
QStyleOptionGraphicsItem
options
[],
QWidget
*
widget
=
0
);
QGraphicsItem
*
items
[],
const
QStyleOptionGraphicsItem
options
[],
QWidget
*
widget
=
0
);
QGraphicsItem
*
rootItem
(
QGraphicsItem
*
item
)
const
;
QGraphicsItem
*
rootItem
(
QGraphicsItem
*
item
)
const
;
virtual
void
drawBackground
(
QPainter
*
painter
,
const
QRectF
&
rect
);
private
:
private
:
void
setDocumentUpdated
();
void
setDocumentUpdated
();
void
createEraiser
();
void
createPointer
();
qreal
mDrawingZIndex
;
qreal
generateZLevel
(
QGraphicsItem
*
item
);
qreal
mObjectZIndex
;
QGraphicsEllipseItem
*
mEraser
;
QGraphicsEllipseItem
*
mEraser
;
QGraphicsEllipseItem
*
mPointer
;
QGraphicsEllipseItem
*
mPointer
;
...
@@ -337,6 +351,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -337,6 +351,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
bool
mDarkBackground
;
bool
mDarkBackground
;
bool
mCrossedBackground
;
bool
mCrossedBackground
;
bool
mIsDesktopMode
;
qreal
mZoomFactor
;
bool
mIsModified
;
bool
mIsModified
;
...
@@ -376,7 +392,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
...
@@ -376,7 +392,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBMagnifier
*
magniferControlViewWidget
;
UBMagnifier
*
magniferControlViewWidget
;
UBMagnifier
*
magniferDisplayViewWidget
;
UBMagnifier
*
magniferDisplayViewWidget
;
UBZLayerController
mZLayerController
;
};
};
#endif
/* UBGRAPHICSSCENE_H_ */
#endif
/* UBGRAPHICSSCENE_H_ */
src/domain/UBGraphicsSvgItem.cpp
View file @
f16c06f9
...
@@ -37,7 +37,6 @@ UBGraphicsSvgItem::UBGraphicsSvgItem(const QString& pFilePath, QGraphicsItem* pa
...
@@ -37,7 +37,6 @@ UBGraphicsSvgItem::UBGraphicsSvgItem(const QString& pFilePath, QGraphicsItem* pa
}
}
}
}
UBGraphicsSvgItem
::
UBGraphicsSvgItem
(
const
QByteArray
&
pFileData
,
QGraphicsItem
*
parent
)
UBGraphicsSvgItem
::
UBGraphicsSvgItem
(
const
QByteArray
&
pFileData
,
QGraphicsItem
*
parent
)
:
QGraphicsSvgItem
(
parent
)
:
QGraphicsSvgItem
(
parent
)
{
{
...
@@ -61,6 +60,8 @@ void UBGraphicsSvgItem::init()
...
@@ -61,6 +60,8 @@ void UBGraphicsSvgItem::init()
setCacheMode
(
QGraphicsItem
::
DeviceCoordinateCache
);
setCacheMode
(
QGraphicsItem
::
DeviceCoordinateCache
);
setMaximumCacheSize
(
boundingRect
().
size
().
toSize
()
*
UB_MAX_ZOOM
);
setMaximumCacheSize
(
boundingRect
().
size
().
toSize
()
*
UB_MAX_ZOOM
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
}
}
...
@@ -132,8 +133,6 @@ UBItem* UBGraphicsSvgItem::deepCopy() const
...
@@ -132,8 +133,6 @@ UBItem* UBGraphicsSvgItem::deepCopy() const
UBGraphicsSvgItem
*
copy
=
new
UBGraphicsSvgItem
(
this
->
fileData
());
UBGraphicsSvgItem
*
copy
=
new
UBGraphicsSvgItem
(
this
->
fileData
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
@@ -187,8 +186,6 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const
...
@@ -187,8 +186,6 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const
pixmapItem
->
setPixmap
(
QPixmap
::
fromImage
(
image
));
pixmapItem
->
setPixmap
(
QPixmap
::
fromImage
(
image
));
pixmapItem
->
setPos
(
this
->
pos
());
pixmapItem
->
setPos
(
this
->
pos
());
// pixmapItem->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
pixmapItem
,
this
->
zValue
());
pixmapItem
->
setTransform
(
this
->
transform
());
pixmapItem
->
setTransform
(
this
->
transform
());
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
pixmapItem
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBGraphicsTextItem.cpp
View file @
f16c06f9
...
@@ -40,23 +40,11 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
...
@@ -40,23 +40,11 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
mTypeTextHereLabel
=
tr
(
"<Type Text Here>"
);
mTypeTextHereLabel
=
tr
(
"<Type Text Here>"
);
// if (lastUsedTextColor.isValid())
// {
// setDefaultTextColor(lastUsedTextColor);
// setColorOnDarkBackground(lastUsedTextColor);
// setColorOnLightBackground(lastUsedTextColor);
// }
// else
// {
// QColor colorOnDarkBG = UBApplication::boardController->penColorOnDarkBackground();
// QColor colorOnLightBG = UBApplication::boardController->penColorOnLightBackground();
// setColorOnDarkBackground(colorOnDarkBG);
// setColorOnLightBackground(colorOnLightBG);
// }
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
// setData(UBGraphicsItemData::ItemEditable, QVariant(true));
// setData(UBGraphicsItemData::ItemEditable, QVariant(true));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
// setFlag(QGraphicsItem::ItemIsMovable, true);
// setFlag(QGraphicsItem::ItemIsMovable, true);
...
@@ -205,8 +193,6 @@ UBItem* UBGraphicsTextItem::deepCopy() const
...
@@ -205,8 +193,6 @@ UBItem* UBGraphicsTextItem::deepCopy() const
copy
->
setHtml
(
toHtml
());
copy
->
setHtml
(
toHtml
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
f16c06f9
...
@@ -96,10 +96,10 @@ void UBGraphicsTextItemDelegate::buildButtons()
...
@@ -96,10 +96,10 @@ void UBGraphicsTextItemDelegate::buildButtons()
{
{
UBGraphicsItemDelegate
::
buildButtons
();
UBGraphicsItemDelegate
::
buildButtons
();
mFontButton
=
new
DelegateButton
(
":/images/font.svg"
,
mDelegated
,
mFrame
);
mFontButton
=
new
DelegateButton
(
":/images/font.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
mColorButton
=
new
DelegateButton
(
":/images/color.svg"
,
mDelegated
,
mFrame
);
mColorButton
=
new
DelegateButton
(
":/images/color.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
mDecreaseSizeButton
=
new
DelegateButton
(
":/images/minus.svg"
,
mDelegated
,
mFrame
);
mDecreaseSizeButton
=
new
DelegateButton
(
":/images/minus.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
mIncreaseSizeButton
=
new
DelegateButton
(
":/images/plus.svg"
,
mDelegated
,
mFrame
);
mIncreaseSizeButton
=
new
DelegateButton
(
":/images/plus.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
connect
(
mFontButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
pickFont
()));
connect
(
mFontButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
pickFont
()));
connect
(
mColorButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
pickColor
()));
connect
(
mColorButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
pickColor
()));
...
...
src/domain/UBGraphicsVideoItem.cpp
View file @
f16c06f9
...
@@ -51,6 +51,8 @@ UBGraphicsVideoItem::UBGraphicsVideoItem(const QUrl& pVideoFileUrl, QGraphicsIte
...
@@ -51,6 +51,8 @@ UBGraphicsVideoItem::UBGraphicsVideoItem(const QUrl& pVideoFileUrl, QGraphicsIte
mDelegate
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
mDelegate
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
connect
(
mDelegate
,
SIGNAL
(
showOnDisplayChanged
(
bool
)),
this
,
SLOT
(
showOnDisplayChanged
(
bool
)));
connect
(
mDelegate
,
SIGNAL
(
showOnDisplayChanged
(
bool
)),
this
,
SLOT
(
showOnDisplayChanged
(
bool
)));
connect
(
mMediaObject
,
SIGNAL
(
hasVideoChanged
(
bool
)),
this
,
SLOT
(
hasVideoChanged
(
bool
)));
connect
(
mMediaObject
,
SIGNAL
(
hasVideoChanged
(
bool
)),
this
,
SLOT
(
hasVideoChanged
(
bool
)));
}
}
...
@@ -68,8 +70,6 @@ UBItem* UBGraphicsVideoItem::deepCopy() const
...
@@ -68,8 +70,6 @@ UBItem* UBGraphicsVideoItem::deepCopy() const
UBGraphicsVideoItem
*
copy
=
new
UBGraphicsVideoItem
(
videoUrl
,
parentItem
());
UBGraphicsVideoItem
*
copy
=
new
UBGraphicsVideoItem
(
videoUrl
,
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBGraphicsVideoItemDelegate.cpp
View file @
f16c06f9
...
@@ -52,8 +52,7 @@ void UBGraphicsVideoItemDelegate::buildButtons()
...
@@ -52,8 +52,7 @@ void UBGraphicsVideoItemDelegate::buildButtons()
mMuteButton
->
hide
();
mMuteButton
->
hide
();
mVideoControl
=
new
DelegateVideoControl
(
delegated
(),
mFrame
);
mVideoControl
=
new
DelegateVideoControl
(
delegated
(),
mFrame
);
// mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem
::
assignZValue
(
mVideoControl
,
delegated
()
->
zValue
());
UBGraphicsItem
::
assignZValue
(
mVideoControl
,
UBGraphicsScene
::
toolLayerStart
+
2
);
mVideoControl
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
mVideoControl
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
connect
(
mPlayPauseButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
togglePlayPause
()));
connect
(
mPlayPauseButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
togglePlayPause
()));
...
@@ -106,6 +105,7 @@ void UBGraphicsVideoItemDelegate::positionHandles()
...
@@ -106,6 +105,7 @@ void UBGraphicsVideoItemDelegate::positionHandles()
}
}
mVideoControl
->
setAntiScale
(
mAntiScaleRatio
);
mVideoControl
->
setAntiScale
(
mAntiScaleRatio
);
mVideoControl
->
setZValue
(
delegated
()
->
zValue
());
mVideoControl
->
show
();
mVideoControl
->
show
();
}
}
else
else
...
...
src/domain/UBGraphicsWidgetItem.cpp
View file @
f16c06f9
...
@@ -39,6 +39,7 @@ UBGraphicsWidgetItem::UBGraphicsWidgetItem(QGraphicsItem *parent, int widgetType
...
@@ -39,6 +39,7 @@ UBGraphicsWidgetItem::UBGraphicsWidgetItem(QGraphicsItem *parent, int widgetType
UBGraphicsWidgetItemDelegate
*
delegate
=
new
UBGraphicsWidgetItemDelegate
(
this
,
widgetType
);
UBGraphicsWidgetItemDelegate
*
delegate
=
new
UBGraphicsWidgetItemDelegate
(
this
,
widgetType
);
delegate
->
init
();
delegate
->
init
();
setDelegate
(
delegate
);
setDelegate
(
delegate
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
}
}
...
@@ -154,6 +155,8 @@ void UBGraphicsWidgetItem::initialize()
...
@@ -154,6 +155,8 @@ void UBGraphicsWidgetItem::initialize()
if
(
mDelegate
&&
mDelegate
->
frame
()
&&
mWebKitWidget
->
resizable
())
if
(
mDelegate
&&
mDelegate
->
frame
()
&&
mWebKitWidget
->
resizable
())
mDelegate
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
mDelegate
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
}
}
...
@@ -408,7 +411,6 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const
...
@@ -408,7 +411,6 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const
UBGraphicsW3CWidgetItem
*
copy
=
new
UBGraphicsW3CWidgetItem
(
mWebKitWidget
->
widgetUrl
(),
parentItem
());
UBGraphicsW3CWidgetItem
*
copy
=
new
UBGraphicsW3CWidgetItem
(
mWebKitWidget
->
widgetUrl
(),
parentItem
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/domain/UBItem.h
View file @
f16c06f9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include <QtGui>
#include <QtGui>
#include "domain/UBGraphicsItemDelegate.h"
#include "domain/UBGraphicsItemDelegate.h"
#include "core/UB.h"
class
UBGraphicsScene
;
class
UBGraphicsScene
;
...
...
src/gui/UBMagnifer.cpp
View file @
f16c06f9
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h"
#include "domain/UBGraphicsScene.h"
#include "board/UBBoardView.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
...
@@ -27,7 +28,6 @@ UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive)
...
@@ -27,7 +28,6 @@ UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive)
:
QWidget
(
parent
,
parent
?
Qt
::
Widget
:
Qt
::
Tool
|
(
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
X11BypassWindowManagerHint
))
:
QWidget
(
parent
,
parent
?
Qt
::
Widget
:
Qt
::
Tool
|
(
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
X11BypassWindowManagerHint
))
,
mShouldMoveWidget
(
false
)
,
mShouldMoveWidget
(
false
)
,
mShouldResizeWidget
(
false
)
,
mShouldResizeWidget
(
false
)
,
inTimer
(
false
)
,
borderPen
(
Qt
::
darkGray
)
,
borderPen
(
Qt
::
darkGray
)
,
gView
(
0
)
,
gView
(
0
)
,
mView
(
0
)
,
mView
(
0
)
...
@@ -70,16 +70,11 @@ UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive)
...
@@ -70,16 +70,11 @@ UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive)
#endif
#endif
}
}
connect
(
&
mRefreshTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
slot_refresh
()));
}
}
UBMagnifier
::~
UBMagnifier
()
UBMagnifier
::~
UBMagnifier
()
{
{
if
(
timerUpdate
!=
0
)
{
killTimer
(
timerUpdate
);
timerUpdate
=
0
;
}
if
(
sClosePixmap
)
if
(
sClosePixmap
)
{
{
delete
sClosePixmap
;
delete
sClosePixmap
;
...
@@ -285,12 +280,8 @@ void UBMagnifier::mouseReleaseEvent(QMouseEvent * event)
...
@@ -285,12 +280,8 @@ void UBMagnifier::mouseReleaseEvent(QMouseEvent * event)
}
}
void
UBMagnifier
::
timerEvent
(
QTimerEvent
*
e
)
void
UBMagnifier
::
slot_refresh
()
{
{
if
(
inTimer
)
return
;
if
(
e
->
timerId
()
==
timerUpdate
)
{
inTimer
=
true
;
if
(
!
(
updPointGrab
.
isNull
()))
if
(
!
(
updPointGrab
.
isNull
()))
grabPoint
(
updPointGrab
);
grabPoint
(
updPointGrab
);
...
@@ -307,28 +298,37 @@ void UBMagnifier::timerEvent(QTimerEvent *e)
...
@@ -307,28 +298,37 @@ void UBMagnifier::timerEvent(QTimerEvent *e)
isCusrsorAlreadyStored
=
false
;
isCusrsorAlreadyStored
=
false
;
setCursor
(
mOldCursor
);
setCursor
(
mOldCursor
);
}
}
}
inTimer
=
false
;
}
}
}
}
void
UBMagnifier
::
grabPoint
()
void
UBMagnifier
::
grabPoint
()
{
{
QMatrix
transM
=
UBApplication
::
boardController
->
controlView
()
->
matrix
();
QPointF
itemPos
=
gView
->
mapFromGlobal
(
updPointGrab
);
QPointF
itemPos
=
gView
->
mapFromGlobal
(
updPointGrab
);
qreal
zWidth
=
size
().
width
()
/
params
.
zoom
;
qreal
zWidth
=
width
()
/
(
params
.
zoom
*
transM
.
m11
());
qreal
zWidthHalf
=
zWidth
/
2
;
qreal
zWidthHalf
=
zWidth
/
2
;
qreal
zHeight
=
size
().
height
()
/
params
.
zoom
;
qreal
zHeight
=
height
()
/
(
params
.
zoom
*
transM
.
m22
());
qreal
zHeightHalf
=
zHeight
/
2
;
qreal
zHeightHalf
=
zHeight
/
2
;
int
x
=
itemPos
.
x
()
-
zWidthHalf
;
int
y
=
itemPos
.
y
()
-
zHeightHalf
;
QPixmap
newPixMap
(
QSize
(
zWidth
,
zHeight
));
QPointF
pfScLtF
(
UBApplication
::
boardController
->
controlView
()
->
mapToScene
(
QPoint
(
itemPos
.
x
(),
itemPos
.
y
())));
((
QWidget
*
)
gView
)
->
render
(
&
newPixMap
,
QPoint
(
0
,
0
),
QRegion
(
x
,
y
,
zWidth
,
zHeight
));
UBApplication
::
boardController
->
activeScene
()
->
update
();
QRect
magnifierRect
=
rect
();
float
x
=
pfScLtF
.
x
()
-
zWidthHalf
;
float
y
=
pfScLtF
.
y
()
-
zHeightHalf
;
QPointF
leftTop
(
x
,
y
);
QPointF
rightBottom
(
x
+
zWidth
,
y
+
zHeight
);
QRectF
srcRect
(
leftTop
,
rightBottom
);
QPixmap
newPixMap
(
QSize
(
width
(),
height
()));
QPainter
painter
(
&
newPixMap
);
UBApplication
::
boardController
->
activeScene
()
->
render
(
&
painter
,
QRectF
(
0
,
0
,
width
(),
height
()),
srcRect
);
painter
.
end
();
pMap
.
fill
(
Qt
::
transparent
);
pMap
.
fill
(
Qt
::
transparent
);
pMap
=
newPixMap
.
scaled
(
QSize
(
width
(),
height
()));
pMap
=
newPixMap
.
scaled
(
QSize
(
width
(),
height
()));
...
@@ -339,28 +339,43 @@ void UBMagnifier::grabPoint()
...
@@ -339,28 +339,43 @@ void UBMagnifier::grabPoint()
void
UBMagnifier
::
grabPoint
(
const
QPoint
&
pGrab
)
void
UBMagnifier
::
grabPoint
(
const
QPoint
&
pGrab
)
{
{
QMatrix
transM
=
UBApplication
::
boardController
->
controlView
()
->
matrix
();
updPointGrab
=
pGrab
;
updPointGrab
=
pGrab
;
QPointF
itemPos
=
gView
->
mapFromGlobal
(
pGrab
);
QPointF
itemPos
=
gView
->
mapFromGlobal
(
pGrab
);
qreal
zWidth
=
size
().
width
()
/
params
.
zoom
;
qreal
zWidth
=
width
()
/
(
params
.
zoom
*
transM
.
m11
());
qreal
zWidthHalf
=
zWidth
/
2
;
qreal
zWidthHalf
=
zWidth
/
2
;
qreal
zHeight
=
size
().
height
()
/
params
.
zoom
;
qreal
zHeight
=
height
()
/
(
params
.
zoom
*
transM
.
m22
());
qreal
zHeightHalf
=
zHeight
/
2
;
qreal
zHeightHalf
=
zHeight
/
2
;
int
x
=
itemPos
.
x
()
-
zWidthHalf
;
int
y
=
itemPos
.
y
()
-
zHeightHalf
;
QPixmap
newPixMap
(
QSize
(
zWidth
,
zHeight
));
QPointF
pfScLtF
(
UBApplication
::
boardController
->
controlView
()
->
mapToScene
(
QPoint
(
itemPos
.
x
(),
itemPos
.
y
())));
((
QWidget
*
)
gView
)
->
render
(
&
newPixMap
,
QPoint
(
0
,
0
),
QRegion
(
x
,
y
,
zWidth
,
zHeight
));
UBApplication
::
boardController
->
activeScene
()
->
update
();
pMap
.
fill
(
Qt
::
transparent
);
pMap
=
newPixMap
.
scaled
(
QSize
(
width
(),
height
()));
QRect
magnifierRect
=
rect
();
float
x
=
pfScLtF
.
x
()
-
zWidthHalf
;
float
y
=
pfScLtF
.
y
()
-
zHeightHalf
;
QPointF
leftTop
(
x
,
y
);
QPointF
rightBottom
(
x
+
zWidth
,
y
+
zHeight
);
QRectF
srcRect
(
leftTop
,
rightBottom
);
QPixmap
newPixMap
(
QSize
(
width
(),
height
()));
QPainter
painter
(
&
newPixMap
);
UBApplication
::
boardController
->
activeScene
()
->
render
(
&
painter
,
QRectF
(
0
,
0
,
width
(),
height
()),
srcRect
);
painter
.
end
();
// pMap.fill(Qt::transparent);
pMap
=
newPixMap
;
pMap
.
setMask
(
bmpMask
);
pMap
.
setMask
(
bmpMask
);
update
();
update
();
}
}
// from global
// from global
void
UBMagnifier
::
grabNMove
(
const
QPoint
&
pGrab
,
const
QPoint
&
pMove
,
bool
needGrab
,
bool
needMove
)
void
UBMagnifier
::
grabNMove
(
const
QPoint
&
pGrab
,
const
QPoint
&
pMove
,
bool
needGrab
,
bool
needMove
)
{
{
...
@@ -380,9 +395,8 @@ void UBMagnifier::grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needG
...
@@ -380,9 +395,8 @@ void UBMagnifier::grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needG
void
UBMagnifier
::
setGrabView
(
QWidget
*
view
)
void
UBMagnifier
::
setGrabView
(
QWidget
*
view
)
{
{
if
(
timerUpdate
!=
0
)
killTimer
(
timerUpdate
);
gView
=
view
;
gView
=
view
;
timerUpdate
=
startTimer
(
200
);
mRefreshTimer
.
setInterval
(
40
);
mRefreshTimer
.
start
();
}
}
src/gui/UBMagnifer.h
View file @
f16c06f9
...
@@ -54,9 +54,11 @@ signals:
...
@@ -54,9 +54,11 @@ signals:
void
magnifierZoomOut_Signal
();
void
magnifierZoomOut_Signal
();
void
magnifierResized_Signal
(
qreal
newPercentSize
);
void
magnifierResized_Signal
(
qreal
newPercentSize
);
public
slots
:
void
slot_refresh
();
protected
:
protected
:
void
paintEvent
(
QPaintEvent
*
);
void
paintEvent
(
QPaintEvent
*
);
void
timerEvent
(
QTimerEvent
*
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
...
@@ -78,10 +80,9 @@ protected:
...
@@ -78,10 +80,9 @@ protected:
QCursor
mResizeCursor
;
QCursor
mResizeCursor
;
private
:
private
:
bool
inTimer
;
QTimer
mRefreshTimer
;
bool
m_isInteractive
;
bool
m_isInteractive
;
int
timerUpdate
;
QPoint
updPointGrab
;
QPoint
updPointGrab
;
QPoint
updPointMove
;
QPoint
updPointMove
;
...
...
src/tools/UBAbstractDrawRuler.cpp
View file @
f16c06f9
...
@@ -48,6 +48,7 @@ UBAbstractDrawRuler::UBAbstractDrawRuler()
...
@@ -48,6 +48,7 @@ UBAbstractDrawRuler::UBAbstractDrawRuler()
QDesktopWidget
*
desktop
=
UBApplication
::
desktop
();
QDesktopWidget
*
desktop
=
UBApplication
::
desktop
();
int
dpiCommon
=
(
desktop
->
physicalDpiX
()
+
desktop
->
physicalDpiY
())
/
2
;
int
dpiCommon
=
(
desktop
->
physicalDpiX
()
+
desktop
->
physicalDpiY
())
/
2
;
sPixelsPerMillimeter
=
qRound
(
dpiCommon
/
25.4
f
);
//because 1inch = 25.4 mm
sPixelsPerMillimeter
=
qRound
(
dpiCommon
/
25.4
f
);
//because 1inch = 25.4 mm
}
}
void
UBAbstractDrawRuler
::
create
(
QGraphicsItem
&
item
)
void
UBAbstractDrawRuler
::
create
(
QGraphicsItem
&
item
)
...
...
src/tools/UBGraphicsCache.cpp
View file @
f16c06f9
...
@@ -33,14 +33,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
...
@@ -33,14 +33,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
// Get the board size and pass it to the shape
// Get the board size and pass it to the shape
QRect
boardRect
=
UBApplication
::
boardController
->
displayView
()
->
rect
();
QRect
boardRect
=
UBApplication
::
boardController
->
displayView
()
->
rect
();
setRect
(
-
15
*
boardRect
.
width
(),
-
15
*
boardRect
.
height
(),
30
*
boardRect
.
width
(),
30
*
boardRect
.
height
());
setRect
(
-
15
*
boardRect
.
width
(),
-
15
*
boardRect
.
height
(),
30
*
boardRect
.
width
(),
30
*
boardRect
.
height
());
// setZValue(CACHE_ZVALUE);
UBGraphicsItem
::
assignZValue
(
this
,
CACHE_ZVALUE
);
setData
(
Qt
::
UserRole
,
QVariant
(
"Cache"
));
setData
(
Qt
::
UserRole
,
QVariant
(
"Cache"
));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
Cache
));
//Necessary to set if we want z value to be assigned correctly
}
}
UBGraphicsCache
::~
UBGraphicsCache
()
UBGraphicsCache
::~
UBGraphicsCache
()
{
{
}
}
UBItem
*
UBGraphicsCache
::
deepCopy
()
const
UBItem
*
UBGraphicsCache
::
deepCopy
()
const
...
@@ -49,8 +47,6 @@ UBItem* UBGraphicsCache::deepCopy() const
...
@@ -49,8 +47,6 @@ UBItem* UBGraphicsCache::deepCopy() const
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setRect
(
this
->
rect
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
// TODO UB 4.7 ... complete all members ?
// TODO UB 4.7 ... complete all members ?
...
@@ -92,8 +88,6 @@ void UBGraphicsCache::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
...
@@ -92,8 +88,6 @@ void UBGraphicsCache::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
Q_UNUSED
(
option
);
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
Q_UNUSED
(
widget
);
UBGraphicsItem
::
assignZValue
(
this
,
CACHE_ZVALUE
);
painter
->
setBrush
(
mMaskColor
);
painter
->
setBrush
(
mMaskColor
);
painter
->
setPen
(
mMaskColor
);
painter
->
setPen
(
mMaskColor
);
...
...
src/tools/UBGraphicsCache.h
View file @
f16c06f9
...
@@ -21,8 +21,6 @@
...
@@ -21,8 +21,6 @@
#include "domain/UBItem.h"
#include "domain/UBItem.h"
#include "core/UB.h"
#include "core/UB.h"
#define CACHE_ZVALUE 100000
typedef
enum
typedef
enum
{
{
eMaskShape_Circle
,
eMaskShape_Circle
,
...
...
src/tools/UBGraphicsCompass.cpp
View file @
f16c06f9
...
@@ -70,6 +70,8 @@ UBGraphicsCompass::UBGraphicsCompass()
...
@@ -70,6 +70,8 @@ UBGraphicsCompass::UBGraphicsCompass()
unsetCursor
();
unsetCursor
();
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
connect
(
UBApplication
::
boardController
,
SIGNAL
(
penColorChanged
()),
this
,
SLOT
(
penColorChanged
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
penColorChanged
()),
this
,
SLOT
(
penColorChanged
()));
connect
(
UBDrawingController
::
drawingController
(),
SIGNAL
(
lineWidthIndexChanged
(
int
)),
this
,
SLOT
(
lineWidthChanged
()));
connect
(
UBDrawingController
::
drawingController
(),
SIGNAL
(
lineWidthIndexChanged
(
int
)),
this
,
SLOT
(
lineWidthChanged
()));
}
}
...
@@ -85,8 +87,6 @@ UBItem* UBGraphicsCompass::deepCopy() const
...
@@ -85,8 +87,6 @@ UBItem* UBGraphicsCompass::deepCopy() const
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setRect
(
this
->
rect
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
// TODO UB 4.7 ... complete all members ?
// TODO UB 4.7 ... complete all members ?
...
...
src/tools/UBGraphicsCurtainItem.cpp
View file @
f16c06f9
...
@@ -49,6 +49,8 @@ UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent)
...
@@ -49,6 +49,8 @@ UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent)
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Tool
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Tool
);
setPen
(
Qt
::
NoPen
);
setPen
(
Qt
::
NoPen
);
this
->
setAcceptHoverEvents
(
true
);
this
->
setAcceptHoverEvents
(
true
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
Curtain
));
//Necessary to set if we want z value to be assigned correctly
}
}
UBGraphicsCurtainItem
::~
UBGraphicsCurtainItem
()
UBGraphicsCurtainItem
::~
UBGraphicsCurtainItem
()
...
@@ -58,8 +60,6 @@ UBGraphicsCurtainItem::~UBGraphicsCurtainItem()
...
@@ -58,8 +60,6 @@ UBGraphicsCurtainItem::~UBGraphicsCurtainItem()
QVariant
UBGraphicsCurtainItem
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
QVariant
UBGraphicsCurtainItem
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
{
// if (change == QGraphicsItem::ItemSelectedHasChanged && QGraphicsRectItem::scene() && isSelected())
// setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain);
QVariant
newValue
=
value
;
QVariant
newValue
=
value
;
...
@@ -131,8 +131,6 @@ UBItem* UBGraphicsCurtainItem::deepCopy() const
...
@@ -131,8 +131,6 @@ UBItem* UBGraphicsCurtainItem::deepCopy() const
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
copy
->
setBrush
(
this
->
brush
());
copy
->
setBrush
(
this
->
brush
());
copy
->
setPen
(
this
->
pen
());
copy
->
setPen
(
this
->
pen
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
src/tools/UBGraphicsCurtainItemDelegate.cpp
View file @
f16c06f9
...
@@ -52,7 +52,6 @@ bool UBGraphicsCurtainItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *ev
...
@@ -52,7 +52,6 @@ bool UBGraphicsCurtainItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *ev
if
(
!
mDelegated
->
isSelected
())
if
(
!
mDelegated
->
isSelected
())
{
{
mDelegated
->
setSelected
(
true
);
mDelegated
->
setSelected
(
true
);
// mDelegated->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain);
positionHandles
();
positionHandles
();
return
true
;
return
true
;
...
...
src/tools/UBGraphicsProtractor.cpp
View file @
f16c06f9
...
@@ -63,6 +63,7 @@ UBGraphicsProtractor::UBGraphicsProtractor()
...
@@ -63,6 +63,7 @@ UBGraphicsProtractor::UBGraphicsProtractor()
mRotateSvgItem
->
setVisible
(
false
);
mRotateSvgItem
->
setVisible
(
false
);
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
scale
(
1.5
,
1.5
);
scale
(
1.5
,
1.5
);
}
}
...
@@ -580,8 +581,6 @@ UBItem* UBGraphicsProtractor::deepCopy() const
...
@@ -580,8 +581,6 @@ UBItem* UBGraphicsProtractor::deepCopy() const
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setRect
(
this
->
rect
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
copy
->
mCurrentAngle
=
this
->
mCurrentAngle
;
copy
->
mCurrentAngle
=
this
->
mCurrentAngle
;
...
...
src/tools/UBGraphicsRuler.cpp
View file @
f16c06f9
...
@@ -44,6 +44,8 @@ UBGraphicsRuler::UBGraphicsRuler()
...
@@ -44,6 +44,8 @@ UBGraphicsRuler::UBGraphicsRuler()
create
(
*
this
);
create
(
*
this
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
updateResizeCursor
();
updateResizeCursor
();
}
}
...
@@ -74,8 +76,6 @@ UBItem* UBGraphicsRuler::deepCopy() const
...
@@ -74,8 +76,6 @@ UBItem* UBGraphicsRuler::deepCopy() const
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setRect
(
this
->
rect
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
// TODO UB 4.7 ... complete all members ?
// TODO UB 4.7 ... complete all members ?
...
...
src/tools/UBGraphicsTriangle.cpp
View file @
f16c06f9
...
@@ -43,8 +43,8 @@ UBGraphicsTriangle::UBGraphicsTriangle()
...
@@ -43,8 +43,8 @@ UBGraphicsTriangle::UBGraphicsTriangle()
mHFlipSvgItem
=
new
QGraphicsSvgItem
(
":/images/hflipTool.svg"
,
this
);
mHFlipSvgItem
=
new
QGraphicsSvgItem
(
":/images/hflipTool.svg"
,
this
);
mHFlipSvgItem
->
setVisible
(
false
);
mHFlipSvgItem
->
setVisible
(
false
);
mHFlipSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
mHFlipSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
mVFlipSvgItem
=
new
QGraphicsSvgItem
(
":/images/vflipTool.svg"
,
this
);
mVFlipSvgItem
=
new
QGraphicsSvgItem
(
":/images/vflipTool.svg"
,
this
);
mVFlipSvgItem
->
setVisible
(
false
);
mVFlipSvgItem
->
setVisible
(
false
);
...
@@ -54,6 +54,8 @@ UBGraphicsTriangle::UBGraphicsTriangle()
...
@@ -54,6 +54,8 @@ UBGraphicsTriangle::UBGraphicsTriangle()
mRotateSvgItem
->
setVisible
(
false
);
mRotateSvgItem
->
setVisible
(
false
);
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
updateResizeCursor
();
updateResizeCursor
();
}
}
...
@@ -93,8 +95,6 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const
...
@@ -93,8 +95,6 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const
copy
->
setPos
(
this
->
pos
());
copy
->
setPos
(
this
->
pos
());
copy
->
setPolygon
(
this
->
polygon
());
copy
->
setPolygon
(
this
->
polygon
());
// copy->setZValue(this->zValue());
UBGraphicsItem
::
assignZValue
(
copy
,
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setTransform
(
this
->
transform
());
// TODO UB 4.7 ... complete all members ?
// TODO UB 4.7 ... complete all members ?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment