Commit b650a8af authored by shibakaneki's avatar shibakaneki

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

parents 1ab57def 383fd02a
......@@ -2,8 +2,23 @@
make clean
rm -rf build/linux/release/
rm -rf install
/usr/bin/qmake-qt4
QT_PATH="/usr/local/Trolltech/Qt-4.7.0"
PLUGINS_PATH="$QT_PATH/plugins"
QMAKE_PATH="$QT_PATH/bin/qmake"
if [ ! -e "$QMAKE_PATH" ]; then
echo "qmake command not found at $QMAKE_PATH"
exit 1
fi
if [ ! -e "$PLUGINS_PATH" ]; then
echo "plugins path not found at $PLUGINS_PATH"
exit 1
fi
$QMAKE_PATH -spec linux-g++
make -j 4 release-install
......@@ -25,7 +40,36 @@ chmod +x build/linux/release/product/run.sh
cp -R resources/linux/qtlinux/* build/linux/release/product/
cp -R /usr/lib/qt4/plugins build/linux/release/product/
#copying plugins
cp -R $PLUGINS_PATH build/linux/release/product/
#removing debug version
find build/linux/release/product/ -name *.debug -exec rm {} \;
#copying custom qt library
QT_LIBRARY_DEST_PATH="build/linux/release/product/qtlib"
mkdir $QT_LIBRARY_DEST_PATH
QT_LIBRARY_SOURCE_PATH="$QT_PATH/lib"
copyQtLibrary(){
if [ ! -e "$QT_LIBRARY_SOURCE_PATH/$1.so.4" ]; then
echo "library not found: $QT_LIBRARY_SOURCE_PATH"
exit 1;
fi
cp "$QT_LIBRARY_SOURCE_PATH/$1.so.4" "$QT_LIBRARY_DEST_PATH/"
cp "$QT_LIBRARY_SOURCE_PATH/$1.so.4.7.0" "$QT_LIBRARY_DEST_PATH/"
}
copyQtLibrary libQtWebKit
copyQtLibrary libphonon
copyQtLibrary libQtDBus
copyQtLibrary libQtScript
copyQtLibrary libQtSvg
copyQtLibrary libQtXmlPatterns
copyQtLibrary libQtNetwork
copyQtLibrary libQtXml
copyQtLibrary libQtGui
copyQtLibrary libQtCore
rm -rf install/linux
mkdir -p install/linux
......@@ -36,3 +80,4 @@ cd build/linux/release
# "Removing .svn directories ..."
find . -name .svn -exec rm -rf {} \; 2> /dev/null
tar cvzf ../../../install/linux/Sankore\ 3.1.tar.gz Sankore_3.1.$VERSION -C .
echo "Build Finished"; alert
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="26.703px"
height="22.297px"
viewBox="0 0 26.703 22.297"
enable-background="new 0 0 26.703 22.297"
xml:space="preserve"
inkscape:version="0.48.1 "
sodipodi:docname="closeTool.svg"><metadata
id="metadata3009"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3007" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1016"
inkscape:window-height="660"
id="namedview3005"
showgrid="false"
inkscape:snap-bbox="false"
inkscape:zoom="11.70561"
inkscape:cx="13.3515"
inkscape:cy="11.1485"
inkscape:window-x="289"
inkscape:window-y="195"
inkscape:window-maximized="0"
inkscape:current-layer="g2999" />
<g
id="g2999"
transform="translate(0.08542912,0)">
<path
clip-rule="evenodd"
stroke-miterlimit="3.8637"
d="m 17.978,0.507 c 4.546179,-0.0864046 8.231,3.686 8.231,8.232 l 0,4.838 c 0,4.547 -3.685,8.232 -8.231,8.232 l -9.246,0 c -4.546,0 -8.231,-3.686 -8.231,-8.232 l 0,-4.838 c 0,-4.547 3.943108,-7.97477519 8.4872874,-8.06114175 z"
id="path3001"
inkscape:connector-curvature="0"
style="fill:#333333;fill-rule:evenodd;stroke:#cdcccc;stroke-miterlimit:3.86369991"
sodipodi:nodetypes="sssssssss" />
<path
style="fill:none;stroke:#f9f9f9;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 14.950096,5.2111765 0.170859,12.4726515 5.894609,-2.562873 z"
id="path3015"
inkscape:connector-curvature="0"
transform="translate(-0.08542912,-8.119964e-7)" /><path
style="fill:#cccccc;stroke:#f9f9f9;stroke-width:1.04033172000000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 12.50192,5.211176 12.317001,17.683828 5.9373238,15.120955 z"
id="path3015-5"
inkscape:connector-curvature="0" /></g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="26.703px"
height="22.297px"
viewBox="0 0 26.703 22.297"
enable-background="new 0 0 26.703 22.297"
xml:space="preserve"
inkscape:version="0.48.1 "
sodipodi:docname="hrotateTool.svg"><metadata
id="metadata3009"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3007" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1016"
inkscape:window-height="660"
id="namedview3005"
showgrid="false"
inkscape:snap-bbox="false"
inkscape:zoom="11.70561"
inkscape:cx="13.3515"
inkscape:cy="11.1485"
inkscape:window-x="289"
inkscape:window-y="195"
inkscape:window-maximized="0"
inkscape:current-layer="g2999" />
<g
id="g2999"
transform="translate(0.08542912,0)">
<path
clip-rule="evenodd"
stroke-miterlimit="3.8637"
d="m 17.892571,0.59242912 c 4.546179,-0.0864046 8.231,3.68599998 8.231,8.23199998 l 0,4.8379999 c 0,4.547 -3.685,8.232 -8.231,8.232 l -9.2460001,0 c -4.546,0 -8.23100002,-3.686 -8.23100002,-8.232 l 0,-4.8379999 c 0,-4.547 3.94310802,-7.97477517 8.48728742,-8.06114173 z"
id="path3001"
inkscape:connector-curvature="0"
style="fill:#333333;fill-rule:evenodd;stroke:#cdcccc;stroke-miterlimit:3.86369991"
sodipodi:nodetypes="sssssssss" />
<path
style="fill:none;stroke:#f9f9f9;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 6.4498984,10.208779 18.922551,10.03792 16.359678,4.1433112 z"
id="path3015"
inkscape:connector-curvature="0" /><path
style="fill:#cccccc;stroke:#f9f9f9;stroke-width:1.04033172px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 6.4004609,12.094944 18.873113,12.279863 16.31024,18.65954 z"
id="path3015-5"
inkscape:connector-curvature="0" /></g>
</svg>
\ No newline at end of file
#!/bin/sh
LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
./Sankore\ 3.1
env LD_LIBRARY_PATH=$PWD/qtlib:$LD_LIBRARY_PATH ./Sankore\ 3.1
......@@ -33,6 +33,8 @@
<file>images/resizeRuler.svg</file>
<file>images/resizeCompass.svg</file>
<file>images/closeTool.svg</file>
<file>images/hflipTool.svg</file>
<file>images/vflipTool.svg</file>
<file>images/resetTool.svg</file>
<file>images/angleMarker.svg</file>
<file>images/currentDocument.png</file>
......
......@@ -99,5 +99,5 @@ QString UBExportDocument::exportExtention()
QString UBExportDocument::exportName()
{
return tr("Export to Uniboard Format");
return tr("Export to Sankore Format");
}
......@@ -132,7 +132,7 @@ void UBImportVirtualPrinter::cleanUp(const QFile& pFile, const QString& pPdfFile
UBDocumentProxy* UBImportVirtualPrinter::importFile(const QFile& pFile, const QString& pGroup)
{
UBApplication::showMessage(tr("Importing Uniboard printer file ..."));
UBApplication::showMessage(tr("Importing Sankore printer file ..."));
UBDocumentProxy *document = 0;
QString pdfFilename = pdfFileName(pFile);
......@@ -159,7 +159,7 @@ UBDocumentProxy* UBImportVirtualPrinter::importFile(const QFile& pFile, const QS
if (!document)
{
UBApplication::showMessage(tr("Error while importing Uniboard printer file."));
UBApplication::showMessage(tr("Error while importing Sankore printer file."));
}
cleanUp(pFile, pdfFilename, emfFileNames(pFile));
......@@ -170,7 +170,7 @@ UBDocumentProxy* UBImportVirtualPrinter::importFile(const QFile& pFile, const QS
bool UBImportVirtualPrinter::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile)
{
UBApplication::showMessage(tr("Importing Uniboard printer file ..."));
UBApplication::showMessage(tr("Importing Sankore printer file ..."));
bool result = false;
QString pdfFilename = pdfFileName(pFile);
......@@ -183,7 +183,7 @@ bool UBImportVirtualPrinter::addFileToDocument(UBDocumentProxy* pDocument, const
if (!result)
{
UBApplication::showMessage(tr("Error while importing Uniboard printer file."));
UBApplication::showMessage(tr("Error while importing Sankore printer file."));
}
cleanUp(pFile, pdfFilename, emfFileNames(pFile));
......
......@@ -204,7 +204,7 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
if (xml.hasError())
{
qWarning() << "error parsing uniboard metadata.rdf file " << xml.errorString();
qWarning() << "error parsing sankore metadata.rdf file " << xml.errorString();
}
}
......
......@@ -26,6 +26,7 @@
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsProtractor.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsTriangle.h"
#include "document/UBDocumentProxy.h"
......@@ -644,6 +645,16 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene->addItem(protractor);
scene->registerTool(protractor);
}
}
else if (mXmlReader.name() == "protractor")
{
UBGraphicsTriangle *triangle = triangleFromSvg();
if (triangle)
{
scene->addItem(triangle);
scene->registerTool(triangle);
}
}
else if (mXmlReader.name() == "foreignObject")
{
......@@ -770,7 +781,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (mXmlReader.hasError())
{
qWarning() << "error parsing uniboard file " << mXmlReader.errorString();
qWarning() << "error parsing Sankore file " << mXmlReader.errorString();
}
if (scene)
......@@ -2556,7 +2567,31 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg()
return protractor;
}
UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
{
UBGraphicsTriangle* triangle = new UBGraphicsTriangle();
triangle->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle);
triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(triangle);
QStringRef svgX = mXmlReader.attributes().value("x");
QStringRef svgY = mXmlReader.attributes().value("y");
QStringRef svgWidth = mXmlReader.attributes().value("width");
QStringRef svgHeight = mXmlReader.attributes().value("height");
QStringRef orientationStringRef = mXmlReader.attributes().value("orientation");
UBGraphicsTriangle::UBGraphicsTriangleOrientation orientation = UBGraphicsTriangle::orientationFromStr(orientationStringRef);
if (!svgX.isNull() && !svgY.isNull() && !svgWidth.isNull() && !svgHeight.isNull())
{
triangle->setRect(svgX.toString().toFloat(), svgY.toString().toFloat(), svgWidth.toString().toFloat(), svgHeight.toString().toFloat(), orientation);
}
triangle->setVisible(true);
return triangle;
}
void UBSvgSubsetAdaptor::convertPDFObjectsToImages(UBDocumentProxy* proxy)
{
......
......@@ -31,6 +31,7 @@ class UBGraphicsScene;
class UBDocumentProxy;
class UBGraphicsStroke;
class UBPersistenceManager;
class UBGraphicsTriangle;
class UBSvgSubsetAdaptor
{
......@@ -118,6 +119,8 @@ class UBSvgSubsetAdaptor
UBGraphicsProtractor* protractorFromSvg();
UBGraphicsTriangle* triangleFromSvg();
void graphicsItemFromSvg(QGraphicsItem* gItem);
QXmlStreamReader mXmlReader;
......
......@@ -28,7 +28,7 @@ UBWebPublisher::~UBWebPublisher()
QString UBWebPublisher::exportName()
{
return tr("Publish Document on Uniboard Web");
return tr("Publish Document on Sankore Web");
}
......
......@@ -10,74 +10,55 @@
class UBDocumentProxy;
class UBServerXMLHttpRequest;
class UBGraphicsW3CWidgetItem;
class QWebView;
class UBDocumentPublisher : public UBAbstractPublisher
{
Q_OBJECT;
public:
public:
explicit UBDocumentPublisher(UBDocumentProxy* sourceDocument, QObject *parent = 0);
virtual ~UBDocumentPublisher();
void publish();
protected:
signals:
// not needed as we do not publish svg file anymore
//virtual void rasterizePDF();
//virtual void rasterizeSVGImages();
//virtual void updateSVGForWidget(int sceneIndex);
void loginDone();
virtual void updateGoogleMapApiKey();
protected:
virtual void updateGoogleMapApiKey();
virtual void rasterizeScenes();
virtual void upgradeDocumentForPublishing();
virtual void generateWidgetPropertyScript(UBGraphicsW3CWidgetItem *widgetItem, int pageNumber);
void sendZipToUniboardWeb(const QString& zipFile, const QUuid& publishingUuid);
private slots:
private slots:
void onFinished(QNetworkReply* reply);
void onLinkClicked(const QUrl& url);
void onLoadFinished(bool result);
void postDocument(const QUuid& tokenUuid, const QString& encryptedBase64Token);
void uploadProgress(qint64, qint64);
void postZipUploadResponse(bool, const QByteArray&);
private:
private:
UBDocumentProxy *mSourceDocument;
UBDocumentProxy *mPublishingDocument;
UBServerXMLHttpRequest* mUploadRequest;
QString mTitle;
QString mAuthor;
QString mDescription;
QString mEMail;
bool mAttachPDF;
bool mAttachUBZ;
QUrl mPublishingUrl;
QString mPublishingServiceUrl;
QUuid mAuthenticationUuid;
QString mAuthenticationBase64Token;
void init();
void sendUbw();
QString getBase64Of(QString stringToEncode);
QWebView* mpWebView;
QHBoxLayout* mpLayout;
QNetworkAccessManager* mpNetworkMgr;
QNetworkCookieJar* mpCookieJar;
QString mUsername;
QString mPassword;
QString mCrlf;
bool bCookieSet;
void buildUbwFile();
QString mTmpZipFile;
};
class UBDocumentPublishingDialog : public QDialog, public Ui::documentPublishingDialog
{
Q_OBJECT;
public:
UBDocumentPublishingDialog(QWidget *parent = 0);
~UBDocumentPublishingDialog(){}
private slots:
void updateUIState(const QString& string);
};
#endif // UBDOCUMENTPUBLISHER_H
......@@ -956,7 +956,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
}
else
{
UBApplication::showMessage(tr("Flash is not supported on Uniboard Linux"));
UBApplication::showMessage(tr("Flash is not supported on Sankore Linux"));
}
}
else if (mimeType.startsWith("application/pdf"))
......
......@@ -152,7 +152,7 @@ void UBBoardPaletteManager::setupPalettes()
addItemActions << UBApplication::mainWindow->actionAddItemToCurrentPage;
addItemActions << UBApplication::mainWindow->actionAddItemToNewPage;
addItemActions << UBApplication::mainWindow->actionAddItemToLibrary;
//addItemActions << UBApplication::mainWindow->actionShareItemOnWeb;
addItemActions << UBApplication::mainWindow->actionShareItemOnWeb;
mAddItemPalette = new UBActionPalette(addItemActions, Qt::Horizontal, 0);
mAddItemPalette->setButtonIconSize(QSize(128, 128));
......@@ -306,7 +306,7 @@ void UBBoardPaletteManager::connectPalettes()
connect(UBApplication::mainWindow->actionAddItemToCurrentPage, SIGNAL(triggered()), this, SLOT(addItemToCurrentPage()));
connect(UBApplication::mainWindow->actionAddItemToNewPage, SIGNAL(triggered()), this, SLOT(addItemToNewPage()));
connect(UBApplication::mainWindow->actionAddItemToLibrary, SIGNAL(triggered()), this, SLOT(addItemToLibrary()));
//connect(UBApplication::mainWindow->actionShareItemOnWeb, SIGNAL(triggered()), this, SLOT(shareItemOnWeb()));
connect(UBApplication::mainWindow->actionShareItemOnWeb, SIGNAL(triggered()), this, SLOT(shareItemOnWeb()));
connect(UBApplication::mainWindow->actionEraseItems, SIGNAL(triggered()), mErasePalette, SLOT(close()));
connect(UBApplication::mainWindow->actionEraseAnnotations, SIGNAL(triggered()), mErasePalette, SLOT(close()));
......
......@@ -27,9 +27,10 @@ UBDrawingController* UBDrawingController::drawingController()
UBDrawingController::UBDrawingController(QObject * parent)
: QObject(parent)
, mActiveRuler(NULL)
, mStylusTool((UBStylusTool::Enum)-1)
, mLatestDrawingTool((UBStylusTool::Enum)-1)
, mActiveRuler(NULL)
{
connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged()));
......
......@@ -724,7 +724,7 @@ UBLibElement* UBLibElement::trashElement()
if (trashElement)
return trashElement;
trashElement = new UBLibElement(eUBLibElementType_Folder, UBSettings::trashLibraryPaletteDirPath(), QObject::tr("Trash", "Pictures category element"));
trashElement = new UBLibElement(eUBLibElementType_Folder, QUrl::fromLocalFile(UBSettings::trashLibraryPaletteDirPath()), QObject::tr("Trash", "Pictures category element"));
QImage *categoryImage = new QImage(":images/libpalette/TrashCategory.svg");
trashElement->setThumbnail(categoryImage);
trashElement->setMoveable(false);
......
......@@ -53,7 +53,6 @@ UBApplicationController* UBApplication::applicationController = 0;
UBBoardController* UBApplication::boardController = 0;
UBWebController* UBApplication::webController = 0;
UBDocumentController* UBApplication::documentController = 0;
//UBSoftwareUpdateController* UBApplication::softwareUpdateController = 0;
UniboardSankoreTransition* UBApplication::mUniboardSankoreTransition = 0;
UBMainWindow* UBApplication::mainWindow = 0;
......@@ -91,8 +90,7 @@ static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event,
#endif
UBApplication::UBApplication(const QString &id, int &argc, char **argv)
: QtSingleApplication(id, argc, argv),
UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSingleApplication(id, argc, argv),
mPreferencesController(NULL)
{
......@@ -343,6 +341,10 @@ void UBApplication::showDocument()
applicationController->showDocument();
}
void UBApplication::showSankoreWebDocument()
{
applicationController->showSankoreWebDocument();
}
int UBApplication::toolBarHeight()
{
......
......@@ -88,6 +88,7 @@ class UBApplication : public QtSingleApplication
void showBoard();
void showInternet();
void showDocument();
void showSankoreWebDocument();
void toolBarPositionChanged(QVariant topOrBottom);
void toolBarDisplayTextChanged(QVariant display);
......
......@@ -50,12 +50,13 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo
, mControlView(pControlView)
, mDisplayView(pDisplayView)
, mMirror(0)
, mFtp(0)
, mMainMode(Board)
, mDisplayManager(0)
, mAutomaticCheckForUpdates(false)
, mCheckingForUpdates(false)
, mIsShowingDesktop(false)
, mFtp(0)
{
mDisplayManager = new UBDisplayManager(this);
......@@ -87,11 +88,10 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo
, this, SLOT(addCapturedPixmap(const QPixmap &, bool, const QUrl&)));
networkAccessManager = new QNetworkAccessManager (this);
connect (networkAccessManager, SIGNAL (finished (QNetworkReply*)), this, SLOT (downloadJsonFinished (QNetworkReply*)));
QTimer::singleShot (1000, this, SLOT (checkUpdateAtLaunch()));
#ifdef Q_WS_X11
// mMainWindow->setStyleSheet("QToolButton { font-size: 11px}");
mMainWindow->setStyleSheet("QToolButton { font-size: 11px}");
#endif
}
......@@ -397,6 +397,32 @@ void UBApplicationController::showDocument()
emit mainModeChanged(Document);
}
void UBApplicationController::showSankoreWebDocument()
{
mMainWindow->webToolBar->hide();
mMainWindow->boardToolBar->hide();
mMainWindow->tutorialToolBar->hide();
mMainWindow->documentToolBar->show();
mMainMode = WebDocument;
adaptToolBar();
mirroringEnabled(false);
mMainWindow->switchToSankoreWebDocumentWidget();
UBApplication::documentController->hide();
mMainWindow->show();
mUninoteController->hideWindow();
emit mainModeChanged(WebDocument);
}
void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
{
......
......@@ -24,8 +24,7 @@ class UBApplicationController : public QObject
public:
UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView,
UBMainWindow *pMainWindow, QObject* parent = 0);
UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent = 0);
virtual ~UBApplicationController();
int initialHScroll() { return mInitialHScroll; }
......@@ -53,6 +52,8 @@ class UBApplicationController : public QObject
void showDocument();
void showSankoreWebDocument();
void showMessage(const QString& message, bool showSpinningWheel);
void importFile(const QString& pFilePath);
......@@ -69,7 +70,7 @@ class UBApplicationController : public QObject
enum MainMode
{
Board = 0, Internet, Document, Tutorial, ParaschoolEditor
Board = 0, Internet, Document, Tutorial, ParaschoolEditor, WebDocument
};
MainMode displayMode()
......
......@@ -117,7 +117,7 @@ void UBDisplayManager::setAsControl(QWidget* pControlWidget )
mControlWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
mControlWidget->setAttribute(Qt::WA_MacNoShadow);
// mControlWidget->setAttribute(Qt::WA_MacNoShadow);
#endif
}
}
......@@ -133,7 +133,7 @@ void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget)
mDisplayWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
mDisplayWidget->setAttribute(Qt::WA_MacNoShadow);
// mDisplayWidget->setAttribute(Qt::WA_MacNoShadow);
#endif
}
}
......
......@@ -29,6 +29,7 @@
#include "UBPersistenceManager.h"
#include "core/memcheck.h"
#include "../adaptors/UBExportWeb.h"
UBDocumentManager* UBDocumentManager::sDocumentManager = 0;
......@@ -53,9 +54,12 @@ UBDocumentManager::UBDocumentManager(QObject *parent)
UBExportFullPDF* exportFullPdf = new UBExportFullPDF(this);
mExportAdaptors.append(exportFullPdf);
UBExportDocument* exportDocument = new UBExportDocument(this);
mExportAdaptors.append(exportDocument);
// UBExportWeb* exportWeb = new UBExportWeb(this);
// mExportAdaptors.append(exportWeb);
UBWebPublisher* webPublished = new UBWebPublisher(this);
mExportAdaptors.append(webPublished);
UBImportDocument* documentImport = new UBImportDocument(this);
mImportAdaptors.append(documentImport);
......
......@@ -1000,7 +1000,7 @@ void UBPersistenceManager::checkIfDocumentRepositoryExists()
QMessageBox::question(
QApplication::activeWindow(),
tr("Document Repository Loss"),
tr("Uniboard has lost access to the document repository '%1'. Unfortunately the application must shut down to avoid data corruption. Latest changes may be lost as well.").arg(humanPath),
tr("Sankore has lost access to the document repository '%1'. Unfortunately the application must shut down to avoid data corruption. Latest changes may be lost as well.").arg(humanPath),
QMessageBox::Yes);
UBApplication::quit();
......
......@@ -7,7 +7,7 @@
class UBDocumentProxy;
class UBGraphicsScene;
class UBGraphicsScene::SceneViewState;
class UBGraphicsScene;
class UBSceneCacheID
{
......
......@@ -54,9 +54,14 @@ void ub_message_output(QtMsgType type, const char *msg) {
int main(int argc, char *argv[])
{
// Uncomment next section to have memory leaks information
// tracing in VC++ debug mode under Windows
/*
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
*/
Q_INIT_RESOURCE(sankore);
......
......@@ -64,7 +64,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true);
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true);
//mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true);
#endif
mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Window);
mTransparentDrawingView->setCacheMode(QGraphicsView::CacheNone);
......
......@@ -1446,7 +1446,7 @@ bool UBDocumentController::isOKToOpenDocument(UBDocumentProxy* proxy)
else
{
if (QMessageBox::question( 0, tr("Open Document"),
tr("The document '%1' has been generated with a newer version of Uniboard (%2). By opening it, you may lose some information. Do you want to proceed?")
tr("The document '%1' has been generated with a newer version of Sankore (%2). By opening it, you may lose some information. Do you want to proceed?")
.arg(proxy->metaData(UBSettings::documentName).toString())
.arg(docVersion),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
......
......@@ -57,6 +57,7 @@ qreal UBGraphicsScene::toolLayerStart = 10000000.0;
qreal UBGraphicsScene::toolOffsetRuler = 100;
qreal UBGraphicsScene::toolOffsetProtractor = 100;
qreal UBGraphicsScene::toolOffsetTriangle = 100;
qreal UBGraphicsScene::toolOffsetCompass = 100;
qreal UBGraphicsScene::toolOffsetEraser = 200;
......@@ -126,7 +127,6 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
UBGraphicsScene::~UBGraphicsScene()
{
int a = 13;
// NOOP
}
......@@ -1412,9 +1412,9 @@ void UBGraphicsScene::addProtractor(QPointF center)
void UBGraphicsScene::addTriangle(QPointF center)
{
// Protractor
/*
UBGraphicsTriangle* protractor = new UBGraphicsTriangle(); // mem : owned and destroyed by the scene
// Triangle
UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); // mem : owned and destroyed by the scene
mTools << triangle;
triangle->setZValue(toolLayerStart + toolOffsetProtractor);
......@@ -1426,7 +1426,7 @@ void UBGraphicsScene::addTriangle(QPointF center)
triangle->moveBy(center.x() - itemSceneCenter.x(), center.y() - itemSceneCenter.y());
triangle->setVisible(true);
setModified(true);*/
setModified(true);
}
......
......@@ -235,6 +235,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static qreal toolOffsetProtractor;
static qreal toolOffsetCompass;
static qreal toolOffsetCurtain;
static qreal toolOffsetTriangle;
QSet<QGraphicsItem*> tools(){ return mTools;}
......
......@@ -12,7 +12,6 @@
UBCoreGraphicsScene::UBCoreGraphicsScene(QObject * parent)
: QGraphicsScene ( parent )
{
int a = 13;
//NOOP
}
......
......@@ -56,6 +56,8 @@ QString UBPlatformUtils::preferredLanguage()
void UBPlatformUtils::runInstaller(const QString &installerFilePath)
{
// TODO UB 4.x - auto update & installer are deactivated on Linux
Q_UNUSED(installerFilePath);
}
void UBPlatformUtils::bringPreviousProcessToFront()
......@@ -77,6 +79,8 @@ QString UBPlatformUtils::computerName()
void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivable)
{
Q_UNUSED(widget);
Q_UNUSED(nonAcivable);
}
......@@ -84,6 +88,7 @@ void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivabl
void UBPlatformUtils::setDesktopMode(bool desktop)
{
// NOOP
Q_UNUSED(desktop);
}
const KEYBT ENGLISH_LOCALE[] = {
......
......@@ -46,8 +46,8 @@ void UBPlatformUtils::init()
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *currentPath = [[NSBundle mainBundle] pathForResource:@"Save PDF to Uniboard" ofType:@"workflow"];
NSString *installedPath = [[[@"~/Library/PDF Services" stringByExpandingTildeInPath] stringByAppendingPathComponent:@"Save PDF to Uniboard"] stringByAppendingPathExtension:@"workflow"];
NSString *currentPath = [[NSBundle mainBundle] pathForResource:@"Save PDF to Sankore" ofType:@"workflow"];
NSString *installedPath = [[[@"~/Library/PDF Services" stringByExpandingTildeInPath] stringByAppendingPathComponent:@"Save PDF to Sankore"] stringByAppendingPathExtension:@"workflow"];
NSString *currentVersion = bundleShortVersion([NSBundle bundleWithPath:currentPath]);
NSString *installedVersion = bundleShortVersion([NSBundle bundleWithPath:installedPath]);
......@@ -59,7 +59,7 @@ void UBPlatformUtils::init()
BOOL copyOK = [fileManager copyPath:currentPath toPath:installedPath handler:nil];
if (!copyOK)
{
qWarning("Could not install the 'Save PDF to Uniboard' workflow");
qWarning("Could not install the 'Save PDF to Sankore' workflow");
}
}
......
......@@ -38,7 +38,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
setAttribute(Qt::WA_MacNoShadow);
//setAttribute(Qt::WA_MacNoShadow);
#endif
}
......
......@@ -12,8 +12,8 @@
UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
: QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint))
, mIsMoving(false)
, mCustomPosition(false)
, mIsMoving(false)
, mCanBeMinimized(false)
, mMinimizedLocation(eMinimizedLocation_None)
, mDefaultPosition(position)
......@@ -33,8 +33,8 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
#endif
#ifdef Q_WS_MAC
setAttribute(Qt::WA_MacNonActivatingToolWindow);
setAttribute(Qt::WA_MacNoShadow);
//setAttribute(Qt::WA_MacNonActivatingToolWindow);
//setAttribute(Qt::WA_MacNoShadow);
#endif
}
......
......@@ -32,7 +32,7 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
btnWidth = btnHeight = 16;
buttons = new UBKeyButton*[47];
for(int i=0; i<47; i++)
for (int i=0; i<47; i++)
{
buttons[i] = new UBKeyButton(this);
}
......@@ -102,7 +102,7 @@ void UBKeyboardPalette::setInput(const UBKeyboardLocale* locale)
{
if (locale!=NULL)
{
for(int i=0; i<47; i++)
for (int i=0; i<47; i++)
buttons[i]->setKeyBt((*locale)[i]);
}
else
......@@ -113,17 +113,17 @@ void UBKeyboardPalette::setInput(const UBKeyboardLocale* locale)
UBKeyboardPalette::~UBKeyboardPalette()
{
for(int i=0; i<47; i++)
for (int i=0; i<47; i++)
delete buttons[i];
delete [] buttons;
for(int i=0; i<8; i++)
for (int i=0; i<8; i++)
delete ctrlButtons[i];
delete [] ctrlButtons;
if (locales!=NULL)
{
for(int i=0; i<nLocalesCount; i++)
for (int i=0; i<nLocalesCount; i++)
delete locales[i];
delete [] locales;
}
......@@ -247,7 +247,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event)
ltop = (r.height() - (bth * 5 + 4)) / 2;
int off = lleft;;
for(int i = 0; i<13; i++)
for (int i = 0; i<13; i++)
{
QRect cr(off, ltop, btw, bth);
buttons[i]->setGeometry(cr);
......@@ -262,7 +262,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event)
off = (r.width() - lwidth) / 2;
ctrlButtons[1]->setGeometry(off, ltop, btw * 1.3, bth);
off += btw * 1.3 + 1;
for(int i=0; i<12; i++)
for (int i=0; i<12; i++)
{
QRect cr(off, ltop, btw, bth);
buttons[13 + i]->setGeometry(cr);
......@@ -272,7 +272,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event)
ltop += bth + 1;
lwidth = 12 * btw + 12 + btw * 2;
off = (r.width() - lwidth) / 2;
for(int i=0; i<12; i++)
for (int i=0; i<12; i++)
{
QRect cr(off, ltop, btw, bth);
buttons[13 + 12 + i]->setGeometry(cr);
......@@ -285,7 +285,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event)
off = (r.width() - lwidth) / 2;
ctrlButtons[3]->setGeometry(off, ltop, btw, bth);
off+=btw+1;
for(int i=0; i<10; i++)
for (int i=0; i<10; i++)
{
QRect cr(off, ltop, btw, bth);
buttons[13 + 12 + 12 + i]->setGeometry(cr);
......@@ -309,9 +309,9 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event)
UBKeyboardButton::UBKeyboardButton(UBKeyboardPalette* parent)
:QWidget(parent),
keyboard(parent),
bFocused(false),
bPressed(false),
keyboard(parent)
bPressed(false)
{
setCursor(Qt::PointingHandCursor);
}
......@@ -361,8 +361,8 @@ void UBKeyboardButton::mouseReleaseEvent ( QMouseEvent * )
}
UBKeyButton::UBKeyButton(UBKeyboardPalette* parent)
:UBKeyboardButton(parent),
keybt(0)
:UBKeyboardButton(parent),
keybt(0)
{}
UBKeyButton::~UBKeyButton()
......@@ -390,9 +390,9 @@ void UBKeyButton::paintContent(QPainter& painter)
UBCntrlButton::UBCntrlButton(UBKeyboardPalette* parent, const QString& _label, int _code )
:UBKeyboardButton(parent),
label(_label),
code(_code)
:UBKeyboardButton(parent),
label(_label),
code(_code)
{}
UBCntrlButton::~UBCntrlButton()
......@@ -412,7 +412,7 @@ void UBCntrlButton::paintContent(QPainter& painter)
}
UBCapsLockButton::UBCapsLockButton(UBKeyboardPalette* parent)
:UBKeyboardButton(parent)
:UBKeyboardButton(parent)
{}
UBCapsLockButton::~UBCapsLockButton()
......@@ -434,11 +434,11 @@ void UBCapsLockButton::paintContent(QPainter& painter)
UBLocaleButton::UBLocaleButton(UBKeyboardPalette* parent)
:UBKeyboardButton(parent)
:UBKeyboardButton(parent)
{
localeMenu = new QMenu(this);
for(int i=0; i<parent->nLocalesCount; i++)
for (int i=0; i<parent->nLocalesCount; i++)
{
QAction* action = (parent->locales[i]->icon!=NULL) ?
localeMenu->addAction(*parent->locales[i]->icon, parent->locales[i]->fullName)
......
......@@ -41,7 +41,7 @@ void x11SendKey(Display *display, int keyCode, int modifiers)
// Get the root window for the current display.
Window winRoot = XDefaultRootWindow(display);
if (winRoot==NULL)
if (winRoot==0)
return;
// Find the window which has the current keyboard focus.
......
......@@ -69,16 +69,6 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
*/
UBLibNavigatorWidget::~UBLibNavigatorWidget()
{
//if(NULL != mLayout)
//{
// delete mLayout;
// mLayout = NULL;
//}
//if(NULL != mLibWidget)
//{
// delete mLibWidget;
// mLibWidget = NULL;
//}
if(NULL != mPathViewer)
{
delete mPathViewer;
......@@ -99,7 +89,7 @@ UBLibNavigatorWidget::~UBLibNavigatorWidget()
void UBLibNavigatorWidget::dropMe(const QMimeData *_data)
{
// Forward the mime data to the library widget
Q_UNUSED(_data);
}
/**
......
......@@ -14,6 +14,7 @@ UBMainWindow::UBMainWindow(QWidget *parent, Qt::WindowFlags flags)
, mBoardWidget(0)
, mWebWidget(0)
, mDocumentsWidget(0)
, mSankoreWebDocumentWidget(0)
{
Ui::MainWindow::setupUi(this);
......@@ -91,6 +92,19 @@ void UBMainWindow::switchToDocumentsWidget()
}
}
void UBMainWindow::addSankoreWebDocumentWidget(QWebView* pWidget)
{
if(!mSankoreWebDocumentWidget){
mSankoreWebDocumentWidget = pWidget;
mStackedLayout->addWidget(mSankoreWebDocumentWidget);
}
}
void UBMainWindow::switchToSankoreWebDocumentWidget()
{
if(mSankoreWebDocumentWidget)
mStackedLayout->setCurrentWidget(mSankoreWebDocumentWidget);
}
void UBMainWindow::keyPressEvent(QKeyEvent *event)
{
QMainWindow::keyPressEvent(event);
......
......@@ -5,6 +5,7 @@
#include <QMainWindow>
#include <QWidget>
#include <QWebView>
class QStackedLayout;
......@@ -27,6 +28,9 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void addDocumentsWidget(QWidget *pWidget);
void switchToDocumentsWidget();
void addSankoreWebDocumentWidget(QWebView* pWidget);
void switchToSankoreWebDocumentWidget();
public slots:
void onExportDone();
......@@ -45,6 +49,7 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
QWidget *mBoardWidget;
QWidget *mWebWidget;
QWidget *mDocumentsWidget;
QWebView* mSankoreWebDocumentWidget;
};
......
......@@ -14,6 +14,7 @@
#include "UBCookieJar.h"
#include "core/memcheck.h"
UBNetworkAccessManager *UBNetworkAccessManager::sNetworkAccessManager = 0;
......
......@@ -127,8 +127,9 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
qreal xscale = p->worldTransform().m11();
qreal yscale = p->worldTransform().m22();
bool bZoomChanged = false;
bool bFirstThumbnail = false;
if(mScaleX != xscale || mScaleY != yscale)
if(fabs(mScaleX - xscale) > 0.1 || fabs(mScaleY - yscale) > 0.1)
{
mScaleX = xscale;
mScaleY = yscale;
......@@ -138,9 +139,14 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
// First verify if the thumbnails and the pages are generated
if(!bThumbGenerated)
{
if(pageNumber == 1)
{
bFirstThumbnail = true;
}
if(!mThumbMap[pageNumber - 1])
{
// Generate the thumbnail
mThumbs << *createPDFImage(pageNumber, xscale, yscale, bounds);
mThumbMap[pageNumber - 1] = true;
......@@ -164,10 +170,9 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
}
}
// Warning: verify pagenumber
QImage pdfImage;
if(!bThumbGenerated)
if(!bThumbGenerated || bFirstThumbnail)
{
pdfImage = mThumbs.at(pageNumber - 1);
}
......@@ -176,8 +181,6 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
pdfImage = mNumPageToPageMap[pageNumber];
}
pdfImage.rect();
QTransform savedTransform = p->worldTransform();
p->resetTransform();
QTime t;
......
......@@ -338,7 +338,7 @@ void UBPodcastController::start()
}
else
{
videoFileName = mPodcastRecordingPath + "/" + tr("Uniboard Cast") + "." + mVideoEncoder->videoFileExtension();
videoFileName = mPodcastRecordingPath + "/" + tr("Sankore Cast") + "." + mVideoEncoder->videoFileExtension();
}
videoFileName = UBFileSystemUtils::nextAvailableFileName(videoFileName, " ");
......
#include "UBAbstractDrawRuler.h"
#include <QtSvg>
#include "core/UB.h"
#include "gui/UBResources.h"
#include "domain/UBGraphicsScene.h"
#include "board/UBDrawingController.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
const QColor UBAbstractDrawRuler::sLightBackgroundMiddleFillColor = QColor(0x72, 0x72, 0x72, sFillTransparency);
const QColor UBAbstractDrawRuler::sLightBackgroundEdgeFillColor = QColor(0xc3, 0xc3, 0xc3, sFillTransparency);
const QColor UBAbstractDrawRuler::sLightBackgroundDrawColor = QColor(0x33, 0x33, 0x33, sDrawTransparency);
const QColor UBAbstractDrawRuler::sDarkBackgroundMiddleFillColor = QColor(0xb5, 0xb5, 0xb5, sFillTransparency);
const QColor UBAbstractDrawRuler::sDarkBackgroundEdgeFillColor = QColor(0xdd, 0xdd, 0xdd, sFillTransparency);
const QColor UBAbstractDrawRuler::sDarkBackgroundDrawColor = QColor(0xff, 0xff, 0xff, sDrawTransparency);
const int UBAbstractDrawRuler::sLeftEdgeMargin = 10;
const int UBAbstractDrawRuler::sDegreeToQtAngleUnit = 16;
const int UBAbstractDrawRuler::sRotationRadius = 15;
const int UBAbstractDrawRuler::sPixelsPerMillimeter = 5;
const int UBAbstractDrawRuler::sFillTransparency = 127;
const int UBAbstractDrawRuler::sDrawTransparency = 192;
const int UBAbstractDrawRuler::sRoundingRadius = sLeftEdgeMargin / 2;
UBAbstractDrawRuler::UBAbstractDrawRuler()
: mShowButtons(false)
, mAntiScaleRatio(1.0)
{}
void UBAbstractDrawRuler::create(QGraphicsItem& item)
{
item.setFlag(QGraphicsItem::ItemIsMovable, true);
item.setFlag(QGraphicsItem::ItemIsSelectable, true);
item.setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
item.setAcceptsHoverEvents(true);
mCloseSvgItem = new QGraphicsSvgItem(":/images/closeTool.svg", &item);
mCloseSvgItem->setVisible(false);
mCloseSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
}
UBAbstractDrawRuler::~UBAbstractDrawRuler()
{
}
QCursor UBAbstractDrawRuler::moveCursor() const
{
return Qt::SizeAllCursor;
}
QCursor UBAbstractDrawRuler::rotateCursor() const
{
return UBResources::resources()->rotateCursor;
}
QCursor UBAbstractDrawRuler::closeCursor() const
{
return Qt::ArrowCursor;
}
QCursor UBAbstractDrawRuler::drawRulerLineCursor() const
{
return UBResources::resources()->drawLineRulerCursor;
}
QColor UBAbstractDrawRuler::drawColor() const
{
return scene()->isDarkBackground() ? sDarkBackgroundDrawColor : sLightBackgroundDrawColor;
}
QColor UBAbstractDrawRuler::middleFillColor() const
{
return scene()->isDarkBackground() ? sDarkBackgroundMiddleFillColor : sLightBackgroundMiddleFillColor;
}
QColor UBAbstractDrawRuler::edgeFillColor() const
{
return scene()->isDarkBackground() ? sDarkBackgroundEdgeFillColor : sLightBackgroundEdgeFillColor;
}
QFont UBAbstractDrawRuler::font() const
{
QFont font("Arial");
font.setPixelSize(16);
return font;
}
void UBAbstractDrawRuler::StartLine(const QPointF& position, qreal width)
{}
void UBAbstractDrawRuler::DrawLine(const QPointF& position, qreal width)
{}
void UBAbstractDrawRuler::EndLine()
{}
void UBAbstractDrawRuler::paint()
{
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
QTransform antiScaleTransform;
antiScaleTransform.scale(mAntiScaleRatio, mAntiScaleRatio);
mCloseSvgItem->setTransform(antiScaleTransform);
mCloseSvgItem->setPos(closeButtonRect().topLeft());
}
......@@ -3,18 +3,66 @@
#include <QtGui>
class UBGraphicsScene;
class QGraphicsSvgItem;
class UBAbstractDrawRuler : public QObject
{
Q_OBJECT;
Q_OBJECT
public:
public:
UBAbstractDrawRuler();
~UBAbstractDrawRuler();
virtual void StartLine(const QPointF& position, qreal width) = 0;
virtual void DrawLine(const QPointF& position, qreal width) = 0;
virtual void EndLine() = 0;
void create(QGraphicsItem& item);
virtual void StartLine(const QPointF& position, qreal width);
virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine();
signals:
void hidden();
protected:
void paint();
virtual UBGraphicsScene* scene() const = 0;
virtual void rotateAroundCenter(qreal angle) = 0;
virtual QPointF rotationCenter() const = 0;
virtual QRectF closeButtonRect() const = 0;
bool mShowButtons;
QGraphicsSvgItem* mCloseSvgItem;
qreal mAntiScaleRatio;
QPointF startDrawPosition;
QCursor moveCursor() const;
QCursor rotateCursor() const;
QCursor closeCursor() const;
QCursor drawRulerLineCursor() const;
QColor drawColor() const;
QColor middleFillColor() const;
QColor edgeFillColor() const;
QFont font() const;
static const QColor sLightBackgroundEdgeFillColor;
static const QColor sLightBackgroundMiddleFillColor;
static const QColor sLightBackgroundDrawColor;
static const QColor sDarkBackgroundEdgeFillColor;
static const QColor sDarkBackgroundMiddleFillColor;
static const QColor sDarkBackgroundDrawColor;
static const int sLeftEdgeMargin;
static const int sDegreeToQtAngleUnit;
static const int sRotationRadius;
static const int sPixelsPerMillimeter;
static const int sFillTransparency;
static const int sDrawTransparency;
static const int sRoundingRadius;
};
......
This diff is collapsed.
......@@ -13,12 +13,12 @@
#include <QtSvg>
#include "core/UB.h"
#include "tools/UBAbstractDrawRuler.h"
#include "domain/UBItem.h"
class UBGraphicsScene;
class UBGraphicsProtractor : public QObject, public QGraphicsEllipseItem, public UBItem
class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipseItem, public UBItem
{
Q_OBJECT;
......@@ -41,10 +41,6 @@ class UBGraphicsProtractor : public QObject, public QGraphicsEllipseItem, public
return Type;
}
signals:
void hidden();
protected:
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget);
......@@ -58,6 +54,7 @@ class UBGraphicsProtractor : public QObject, public QGraphicsEllipseItem, public
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event);
virtual QPainterPath shape() const;
QRectF boundingRect() const;
private:
// Helpers
void paintGraduations (QPainter *painter);
......@@ -66,16 +63,15 @@ class UBGraphicsProtractor : public QObject, public QGraphicsEllipseItem, public
Tool toolFromPos (QPointF pos);
qreal antiScale () const;
UBGraphicsScene* scene() const;
QColor drawColor() const;
QBrush fillBrush() const;
QSizeF buttonSizeReference () const{return QSizeF(radius() / 10, mCloseSvgItem->boundingRect().height() * radius()/(10 * mCloseSvgItem->boundingRect().width()));}
QSizeF markerSizeReference () const{return QSizeF(radius() / 10, mMarkerSvgItem->boundingRect().height() * radius()/(10 * mMarkerSvgItem->boundingRect().width()));}
QRectF resetButtonBounds () const;
QRectF closeButtonBounds () const;
QRectF resizeButtonBounds () const;
QRectF rotateButtonBounds () const{return QRectF(buttonSizeReference().width() * 5.5, -buttonSizeReference().width() * 5, buttonSizeReference().width(), buttonSizeReference().width());}
QRectF markerButtonBounds () const{return QRectF(radius() + 3, -markerSizeReference().height() / 2 , markerSizeReference().width(), markerSizeReference().height());}
QRectF resetButtonRect () const;
QRectF closeButtonRect () const;
QRectF resizeButtonRect () const;
QRectF rotateButtonRect () const{return QRectF(buttonSizeReference().width() * 5.5, -buttonSizeReference().width() * 5, buttonSizeReference().width(), buttonSizeReference().width());}
QRectF markerButtonRect () const{return QRectF(radius() + 3, -markerSizeReference().height() / 2 , markerSizeReference().width(), markerSizeReference().height());}
inline qreal radius () const{return rect().height() / 2 - 20;}
// Members
......@@ -87,21 +83,18 @@ class UBGraphicsProtractor : public QObject, public QGraphicsEllipseItem, public
qreal mStartAngle;
qreal mScaleFactor;
QGraphicsSvgItem* mCloseSvgItem;
QGraphicsSvgItem* mResetSvgItem;
QGraphicsSvgItem* mResizeSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
QGraphicsSvgItem* mMarkerSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
static const int sFillTransparency;
static const int sDrawTransparency;
static const QRectF sDefaultRect;
static const QColor sFillColor;
static const QColor sFillColorCenter;
static const QColor sDrawColor;
static const QColor sDarkBackgroundFillColor;
static const QColor sDarkBackgroundFillColorCenter;
static const QColor sDarkBackgroundDrawColor;
virtual void rotateAroundCenter(qreal angle);
virtual QPointF rotationCenter() const;
int sFillTransparency;
int sDrawTransparency;
};
#endif /* UBGRAPHICSPROTRACTOR_H_ */
This diff is collapsed.
......@@ -39,11 +39,8 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine();
signals:
void hidden();
protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
......@@ -56,58 +53,37 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
bool mResizing;
bool mRotating;
// Helpers
void fillBackground(QPainter *painter);
void paintGraduations(QPainter *painter);
void paintRotationCenter(QPainter *painter);
void rotateAroundTopLeftOrigin(qreal angle);
void updateResizeCursor();
QPointF topLeftOrigin() const;
QCursor moveCursor() const;
QCursor resizeCursor() const;
QCursor rotateCursor() const;
QCursor closeCursor() const;
QCursor drawRulerLineCursor() const;
QRectF resizeButtonRect() const;
QRectF closeButtonRect() const;
QRectF rotateButtonRect() const;
UBGraphicsScene* scene() const;
QColor drawColor() const;
QColor middleFillColor() const;
QColor edgeFillColor() const;
QFont font() const;
virtual void rotateAroundCenter(qreal angle);
int drawLineDirection;
// Members
bool mResizing;
bool mRotating;
bool mShowButtons;
QGraphicsSvgItem* mCloseSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
QGraphicsSvgItem* mResizeSvgItem;
void updateResizeCursor();
QCursor resizeCursor() const{return mResizeCursor;}
virtual QPointF rotationCenter() const;
virtual QRectF resizeButtonRect() const;
virtual QRectF closeButtonRect() const;
virtual QRectF rotateButtonRect() const;
virtual UBGraphicsScene* scene() const;
QCursor mResizeCursor;
qreal mAntiScaleRatio;
QPointF startDrawPosition;
int drawLineDirection;
// Constants
static const QRect sDefaultRect;
static const int sLeftEdgeMargin = 10;
static const int sMinLength = 150;
static const int sDegreeToQtAngleUnit = 16;
static const int sRotationRadius = 15;
static const int sPixelsPerMillimeter = 5;
static const int sFillTransparency = 127;
static const int sDrawTransparency = 192;
static const int sRoundingRadius = sLeftEdgeMargin / 2;
static const QColor sLightBackgroundEdgeFillColor;
static const QColor sLightBackgroundMiddleFillColor;
static const QColor sLightBackgroundDrawColor;
static const QColor sDarkBackgroundEdgeFillColor;
static const QColor sDarkBackgroundMiddleFillColor;
static const QColor sDarkBackgroundDrawColor;
};
#endif /* UBGRAPHICSRULER_H_ */
This diff is collapsed.
......@@ -15,17 +15,107 @@
#include "core/UB.h"
#include "domain/UBItem.h"
#include "tools/UBAbstractDrawRuler.h"
class UBGraphicsScene;
class UBItem;
class UBGraphicsTriangle : public QObject, public QGraphicsPolygonItem, public UBItem
class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonItem, public UBItem
{
Q_OBJECT;
public:
UBGraphicsTriangle();
virtual ~UBGraphicsTriangle();
enum { Type = UBGraphicsItemType::TriangleItemType };
virtual int type() const
{
return Type;
}
virtual UBItem* deepCopy(void) const;
enum UBGraphicsTriangleOrientation
{
BottomLeft = 0,
BottomRight,
TopLeft,
TopRight
};
static UBGraphicsTriangleOrientation orientationFromStr(QStringRef& str)
{
if (str == "BottomLeft") return BottomLeft;
if (str == "BottomRight") return BottomRight;
if (str == "TopLeft") return TopLeft;
if (str == "TopRight") return TopRight;
return sDefaultOrientation;
}
void setRect(const QRectF &rect, UBGraphicsTriangleOrientation orientation)
{
setRect(rect.x(), rect.y(), rect.width(), rect.height(), orientation);
}
void setRect(qreal x, qreal y, qreal w, qreal h, UBGraphicsTriangleOrientation orientation);
void setOrientation(UBGraphicsTriangleOrientation orientation);
QRectF rect() const {return boundingRect();}
UBGraphicsScene* scene() const;
protected:
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget);
virtual void rotateAroundCenter(qreal angle);
virtual QPointF rotationCenter() const;
virtual QRectF closeButtonRect() const;
QPolygonF resize1Polygon() const;
QPolygonF resize2Polygon() const;
QRectF hFlipRect() const;
QRectF vFlipRect() const;
QRectF rotateRect() const;
QCursor moveResizeCursor() const;
QCursor flipCursor() const;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
QTransform calculateRotationTransform();
qreal angle;
void rotateAroundCenter(QTransform& transform);
bool mResizing1;
bool mResizing2;
bool mRotating;
QGraphicsSvgItem* mHFlipSvgItem;
QGraphicsSvgItem* mVFlipSvgItem;
QGraphicsSvgItem* mRotateSvgItem;
static const QRect sDefaultRect;
static const UBGraphicsTriangleOrientation sDefaultOrientation;
void paintGraduations(QPainter *painter);
UBGraphicsTriangleOrientation mOrientation;
static const int d = 70; // width of triangle border
static const int sArrowLength = 30;
static const int sMinWidth = 200;
static const int sMinHeight = 150;
};
#endif /* UBGRAPHICSTRIANGLE_H_ */
......@@ -151,7 +151,7 @@ void WBWebPage::handleUnsupportedContent(QNetworkReply *reply)
if (isPDF)
{
QMessageBox messageBox(mainWindow());
messageBox.setText(tr("Download PDF Document: would you prefer to download the PDF file or add it to the current Uniboard document?"));
messageBox.setText(tr("Download PDF Document: would you prefer to download the PDF file or add it to the current Sankore document?"));
messageBox.addButton(tr("Download"), QMessageBox::AcceptRole);
QAbstractButton *addButton =
......
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