Commit b2628d12 authored by Claudio Valerio's avatar Claudio Valerio

removed tab

parent a6c6ee3f
...@@ -55,9 +55,9 @@ UBExportFullPDF::UBExportFullPDF(QObject *parent) ...@@ -55,9 +55,9 @@ UBExportFullPDF::UBExportFullPDF(QObject *parent)
: UBExportAdaptor(parent) : UBExportAdaptor(parent)
{ {
//need to calculate screen resolution //need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mScaleFactor = 72.0f / dpiCommon; mScaleFactor = 72.0f / dpiCommon;
} }
...@@ -95,17 +95,17 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr ...@@ -95,17 +95,17 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr
scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingQuality(UBItem::RenderingQualityHigh);
scene->setRenderingContext(UBGraphicsScene::PdfExport); scene->setRenderingContext(UBGraphicsScene::PdfExport);
QSize pageSize = scene->nominalSize(); QSize pageSize = scene->nominalSize();
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
if (pdfItem) mHasPDFBackgrounds = true; if (pdfItem) mHasPDFBackgrounds = true;
pdfPrinter.setPaperSize(QSizeF(pageSize.width()*mScaleFactor, pageSize.height()*mScaleFactor), QPrinter::Point); pdfPrinter.setPaperSize(QSizeF(pageSize.width()*mScaleFactor, pageSize.height()*mScaleFactor), QPrinter::Point);
if (!pdfPainter) pdfPainter = new QPainter(&pdfPrinter); if (!pdfPainter) pdfPainter = new QPainter(&pdfPrinter);
if (pageIndex != 0) pdfPrinter.newPage(); if (pageIndex != 0) pdfPrinter.newPage();
//render to PDF //render to PDF
scene->setDrawingMode(true); scene->setDrawingMode(true);
...@@ -183,9 +183,9 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS ...@@ -183,9 +183,9 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex); UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex);
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
QSize pageSize = scene->nominalSize(); QSize pageSize = scene->nominalSize();
if (pdfItem) if (pdfItem)
{ {
QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf"; QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf";
QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName; QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName;
......
...@@ -80,15 +80,15 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin ...@@ -80,15 +80,15 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
pdfPrinter.setOutputFormat(QPrinter::PdfFormat); pdfPrinter.setOutputFormat(QPrinter::PdfFormat);
pdfPrinter.setResolution(UBSettings::settings()->pdfResolution->get().toInt()); pdfPrinter.setResolution(UBSettings::settings()->pdfResolution->get().toInt());
pdfPrinter.setOutputFileName(filename); pdfPrinter.setOutputFileName(filename);
pdfPrinter.setFullPage(true); pdfPrinter.setFullPage(true);
//need to calculate screen resolution //need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
float scaleFactor = 72.0f / dpiCommon; float scaleFactor = 72.0f / dpiCommon;
QPainter pdfPainter; QPainter pdfPainter;
bool painterNeedsBegin = true; bool painterNeedsBegin = true;
int existingPageCount = pDocumentProxy->pageCount(); int existingPageCount = pDocumentProxy->pageCount();
...@@ -101,17 +101,17 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin ...@@ -101,17 +101,17 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
bool isCrossed = scene->isCrossedBackground(); bool isCrossed = scene->isCrossedBackground();
scene->setBackground(false, false); scene->setBackground(false, false);
QSize pageSize = scene->nominalSize(); QSize pageSize = scene->nominalSize();
// set high res rendering // set high res rendering
scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingQuality(UBItem::RenderingQualityHigh);
scene->setRenderingContext(UBGraphicsScene::NonScreen); scene->setRenderingContext(UBGraphicsScene::NonScreen);
//setting page size to appropriate value //setting page size to appropriate value
pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point); pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point);
if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter); if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter);
//render to PDF //render to PDF
scene->render(&pdfPainter, QRectF(), scene->normalizedSceneRect()); scene->render(&pdfPainter, QRectF(), scene->normalizedSceneRect());
if (pageIndex < existingPageCount - 1) pdfPrinter.newPage(); if (pageIndex < existingPageCount - 1) pdfPrinter.newPage();
...@@ -122,7 +122,7 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin ...@@ -122,7 +122,7 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
//restore background state //restore background state
scene->setBackground(isDark, isCrossed); scene->setBackground(isDark, isCrossed);
} }
if(!painterNeedsBegin) pdfPainter.end(); if(!painterNeedsBegin) pdfPainter.end();
} }
QString UBExportPDF::exportExtention() QString UBExportPDF::exportExtention()
......
...@@ -174,18 +174,18 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString& ...@@ -174,18 +174,18 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
QString documentRootFolder; QString documentRootFolder;
if(!extractFileToDir(pFile, path, documentRootFolder)){ if(!extractFileToDir(pFile, path, documentRootFolder)){
UBApplication::showMessage(tr("Import of file %1 failed.").arg(fi.baseName())); UBApplication::showMessage(tr("Import of file %1 failed.").arg(fi.baseName()));
return NULL; return NULL;
} }
bool addTitlePage = false; bool addTitlePage = false;
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && !QFile(documentRootFolder+"/page000.svg").exists()) if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && !QFile(documentRootFolder+"/page000.svg").exists())
addTitlePage=true; addTitlePage=true;
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, addTitlePage); UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, addTitlePage);
UBApplication::showMessage(tr("Import successful.")); UBApplication::showMessage(tr("Import successful."));
return newDocument; return newDocument;
} }
bool UBImportDocument::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile) bool UBImportDocument::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile)
......
...@@ -38,7 +38,7 @@ UBImportPDF::UBImportPDF(QObject *parent) ...@@ -38,7 +38,7 @@ UBImportPDF::UBImportPDF(QObject *parent)
: UBPageBasedImportAdaptor(parent) : UBPageBasedImportAdaptor(parent)
{ {
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
this->dpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; this->dpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
} }
...@@ -71,7 +71,7 @@ QList<UBGraphicsItem*> UBImportPDF::import(const QUuid& uuid, const QString& fil ...@@ -71,7 +71,7 @@ QList<UBGraphicsItem*> UBImportPDF::import(const QUuid& uuid, const QString& fil
UBApplication::showMessage(tr("PDF import failed.")); UBApplication::showMessage(tr("PDF import failed."));
return result; return result;
} }
pdfRenderer->setDPI(this->dpi); pdfRenderer->setDPI(this->dpi);
int pdfPageCount = pdfRenderer->pageCount(); int pdfPageCount = pdfRenderer->pageCount();
......
...@@ -44,8 +44,8 @@ class UBImportPDF : public UBPageBasedImportAdaptor ...@@ -44,8 +44,8 @@ class UBImportPDF : public UBPageBasedImportAdaptor
virtual void placeImportedItemToScene(UBGraphicsScene* scene, UBGraphicsItem* item); virtual void placeImportedItemToScene(UBGraphicsScene* scene, UBGraphicsItem* item);
virtual const QString& folderToCopy(); virtual const QString& folderToCopy();
private: private:
int dpi; int dpi;
}; };
#endif /* UBIMPORTPDF_H_ */ #endif /* UBIMPORTPDF_H_ */
...@@ -1249,10 +1249,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1249,10 +1249,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
//disabling g section parsing as a group of elements. Use groups refs instead //disabling g section parsing as a group of elements. Use groups refs instead
// mXmlWriter.writeStartElement("g"); // mXmlWriter.writeStartElement("g");
// mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(strokesGroupItem->uuid())); // mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(strokesGroupItem->uuid()));
// QMatrix matrix = item->sceneMatrix(); // QMatrix matrix = item->sceneMatrix();
// if (!matrix.isIdentity()){ // if (!matrix.isIdentity()){
// mXmlWriter.writeAttribute("transform", toSvgTransform(matrix)); // mXmlWriter.writeAttribute("transform", toSvgTransform(matrix));
// } // }
// Add the polygons // Add the polygons
foreach(QGraphicsItem* item, strokesGroupItem->childItems()){ foreach(QGraphicsItem* item, strokesGroupItem->childItems()){
......
...@@ -32,7 +32,7 @@ class UBGraphicsScene; ...@@ -32,7 +32,7 @@ class UBGraphicsScene;
class UBThumbnailAdaptor //static class class UBThumbnailAdaptor //static class
{ {
Q_DECLARE_TR_FUNCTIONS(UBThumbnailAdaptor) Q_DECLARE_TR_FUNCTIONS(UBThumbnailAdaptor)
public: public:
static QUrl thumbnailUrl(UBDocumentProxy* proxy, int pageIndex); static QUrl thumbnailUrl(UBDocumentProxy* proxy, int pageIndex);
......
...@@ -241,7 +241,7 @@ void UBWidgetUniboardAPI::drawLineTo(const qreal x, const qreal y, const qreal p ...@@ -241,7 +241,7 @@ void UBWidgetUniboardAPI::drawLineTo(const qreal x, const qreal y, const qreal p
if (mScene) if (mScene)
mScene->drawLineTo(QPointF(x, y), pWidth, mScene->drawLineTo(QPointF(x, y), pWidth,
UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line); UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line);
} }
......
...@@ -143,7 +143,7 @@ class UBBoardView : public QGraphicsView ...@@ -143,7 +143,7 @@ class UBBoardView : public QGraphicsView
bool isAbsurdPoint(QPoint point); bool isAbsurdPoint(QPoint point);
bool mVirtualKeyboardActive; bool mVirtualKeyboardActive;
bool mOkOnWidget; bool mOkOnWidget;
bool mWidgetMoved; bool mWidgetMoved;
...@@ -172,9 +172,9 @@ class UBBoardView : public QGraphicsView ...@@ -172,9 +172,9 @@ class UBBoardView : public QGraphicsView
void settingChanged(QVariant newValue); void settingChanged(QVariant newValue);
public slots: public slots:
void virtualKeyboardActivated(bool b); void virtualKeyboardActivated(bool b);
void longPressEvent(); void longPressEvent();
}; };
......
...@@ -55,7 +55,7 @@ UBDrawingController::UBDrawingController(QObject * parent) ...@@ -55,7 +55,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
, mActiveRuler(NULL) , mActiveRuler(NULL)
, mStylusTool((UBStylusTool::Enum)-1) , mStylusTool((UBStylusTool::Enum)-1)
, mLatestDrawingTool((UBStylusTool::Enum)-1) , mLatestDrawingTool((UBStylusTool::Enum)-1)
, mIsDesktopMode(false) , mIsDesktopMode(false)
{ {
connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged())); connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged()));
...@@ -96,7 +96,7 @@ void UBDrawingController::setStylusTool(int tool) ...@@ -96,7 +96,7 @@ void UBDrawingController::setStylusTool(int tool)
{ {
if (tool != mStylusTool) if (tool != mStylusTool)
{ {
UBApplication::boardController->activeScene()->deselectAllItems(); UBApplication::boardController->activeScene()->deselectAllItems();
if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker
|| mStylusTool == UBStylusTool::Line) || mStylusTool == UBStylusTool::Line)
{ {
......
...@@ -61,11 +61,11 @@ class UBDrawingController : public QObject ...@@ -61,11 +61,11 @@ class UBDrawingController : public QObject
UBAbstractDrawRuler* mActiveRuler; UBAbstractDrawRuler* mActiveRuler;
void setInDestopMode(bool mode){ void setInDestopMode(bool mode){
mIsDesktopMode = mode; mIsDesktopMode = mode;
} }
bool isInDesktopMode(){ bool isInDesktopMode(){
return mIsDesktopMode; return mIsDesktopMode;
} }
public slots: public slots:
......
...@@ -255,7 +255,7 @@ QString UBFeature::getVirtualDirFromVirtualPath(const QString &pVirtPath) ...@@ -255,7 +255,7 @@ QString UBFeature::getVirtualDirFromVirtualPath(const QString &pVirtPath)
QString UBFeature::getUrl() const QString UBFeature::getUrl() const
{ {
if ( elementType == FEATURE_INTERNAL ) if ( elementType == FEATURE_INTERNAL )
return getFullPath().toString(); return getFullPath().toString();
return getFullPath().toLocalFile(); return getFullPath().toLocalFile();
...@@ -268,12 +268,12 @@ bool UBFeature::operator ==( const UBFeature &f )const ...@@ -268,12 +268,12 @@ bool UBFeature::operator ==( const UBFeature &f )const
bool UBFeature::operator !=( const UBFeature &f )const bool UBFeature::operator !=( const UBFeature &f )const
{ {
return !(*this == f); return !(*this == f);
} }
bool UBFeature::isFolder() const bool UBFeature::isFolder() const
{ {
return elementType == FEATURE_CATEGORY || elementType == FEATURE_TRASH || elementType == FEATURE_FAVORITE return elementType == FEATURE_CATEGORY || elementType == FEATURE_TRASH || elementType == FEATURE_FAVORITE
|| elementType == FEATURE_FOLDER || elementType == FEATURE_SEARCH; || elementType == FEATURE_FOLDER || elementType == FEATURE_SEARCH;
} }
...@@ -451,11 +451,11 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin ...@@ -451,11 +451,11 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin
if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) { if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) {
featuresList->append( UBFeature( favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) ); featuresList->append( UBFeature( favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) );
} }
if (featureType == FEATURE_FOLDER) { if (featureType == FEATURE_FOLDER) {
fileSystemScan(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName); fileSystemScan(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName);
} }
} }
} }
...@@ -486,35 +486,35 @@ int UBFeaturesController::featuresCount(const QUrl &currPath) ...@@ -486,35 +486,35 @@ int UBFeaturesController::featuresCount(const QUrl &currPath)
void UBFeaturesController::loadFavoriteList() void UBFeaturesController::loadFavoriteList()
{ {
favoriteSet = new QSet<QUrl>(); favoriteSet = new QSet<QUrl>();
QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); QFile file( UBSettings::userDataDirectory() + "/favorites.dat" );
if ( file.exists() ) if ( file.exists() )
{ {
file.open(QIODevice::ReadOnly); file.open(QIODevice::ReadOnly);
QDataStream in(&file); QDataStream in(&file);
int elementsNumber; int elementsNumber;
in >> elementsNumber; in >> elementsNumber;
for ( int i = 0; i < elementsNumber; ++i) for ( int i = 0; i < elementsNumber; ++i)
{ {
QUrl path; QUrl path;
in >> path; in >> path;
favoriteSet->insert( path ); favoriteSet->insert( path );
} }
} }
} }
void UBFeaturesController::saveFavoriteList() void UBFeaturesController::saveFavoriteList()
{ {
QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); QFile file( UBSettings::userDataDirectory() + "/favorites.dat" );
file.resize(0); file.resize(0);
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
QDataStream out(&file); QDataStream out(&file);
out << favoriteSet->size(); out << favoriteSet->size();
for ( QSet<QUrl>::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it ) for ( QSet<QUrl>::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it )
{ {
out << (*it); out << (*it);
} }
file.close(); file.close();
} }
QString UBFeaturesController::uniqNameForFeature(const UBFeature &feature, const QString &pName, const QString &pExtention) const QString UBFeaturesController::uniqNameForFeature(const UBFeature &feature, const QString &pName, const QString &pExtention) const
...@@ -584,29 +584,29 @@ QString UBFeaturesController::adjustName(const QString &str) ...@@ -584,29 +584,29 @@ QString UBFeaturesController::adjustName(const QString &str)
void UBFeaturesController::addToFavorite( const QUrl &path ) void UBFeaturesController::addToFavorite( const QUrl &path )
{ {
QString filePath = fileNameFromUrl( path ); QString filePath = fileNameFromUrl( path );
if ( favoriteSet->find( path ) == favoriteSet->end() ) if ( favoriteSet->find( path ) == favoriteSet->end() )
{ {
QFileInfo fileInfo( filePath ); QFileInfo fileInfo( filePath );
QString fileName = fileInfo.fileName(); QString fileName = fileInfo.fileName();
UBFeatureElementType type = fileTypeFromUrl(filePath); UBFeatureElementType type = fileTypeFromUrl(filePath);
UBFeature elem(favoritePath + "/" + fileName, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) ); UBFeature elem(favoritePath + "/" + fileName, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) );
favoriteSet->insert( path ); favoriteSet->insert( path );
saveFavoriteList(); saveFavoriteList();
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull()) if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull())
featuresModel->addItem( elem ); featuresModel->addItem( elem );
} }
} }
void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManualy) void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManualy)
{ {
// QString filePath = fileNameFromUrl( path ); // QString filePath = fileNameFromUrl( path );
if ( favoriteSet->find( path ) != favoriteSet->end() ) if ( favoriteSet->find( path ) != favoriteSet->end() )
{ {
favoriteSet->erase( favoriteSet->find( path ) ); favoriteSet->erase( favoriteSet->find( path ) );
saveFavoriteList(); saveFavoriteList();
} }
if (deleteManualy) { if (deleteManualy) {
featuresModel->deleteFavoriteItem(path.toString()); featuresModel->deleteFavoriteItem(path.toString());
...@@ -615,10 +615,10 @@ void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManu ...@@ -615,10 +615,10 @@ void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManu
QString UBFeaturesController::fileNameFromUrl( const QUrl &url ) QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
{ {
QString fileName = url.toString(); QString fileName = url.toString();
if ( fileName.contains( "uniboardTool://" ) ) if ( fileName.contains( "uniboardTool://" ) )
return fileName; return fileName;
return url.toLocalFile(); return url.toLocalFile();
} }
...@@ -657,7 +657,7 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path) ...@@ -657,7 +657,7 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path)
fileType = FEATURE_INVALID; fileType = FEATURE_INVALID;
} }
return fileType; return fileType;
} }
QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType pFType = FEATURE_INVALID) QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType pFType = FEATURE_INVALID)
...@@ -759,7 +759,7 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de ...@@ -759,7 +759,7 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de
if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) ) if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) )
{ {
dest = picturesElement; dest = picturesElement;
} }
filePath = dest.getFullPath().toLocalFile() + "/" + mFileName; filePath = dest.getFullPath().toLocalFile() + "/" + mFileName;
...@@ -805,7 +805,7 @@ void UBFeaturesController::addNewFolder(QString name) ...@@ -805,7 +805,7 @@ void UBFeaturesController::addNewFolder(QString name)
if(!QFileInfo(path).exists()) { if(!QFileInfo(path).exists()) {
QDir().mkpath(path); QDir().mkpath(path);
} }
UBFeature newFeatureFolder = UBFeature( currentElement.getFullVirtualPath() + "/" + name, QImage(":images/libpalette/folder.svg"), UBFeature newFeatureFolder = UBFeature( currentElement.getFullVirtualPath() + "/" + name, QImage(":images/libpalette/folder.svg"),
name, QUrl::fromLocalFile( path ), FEATURE_FOLDER ); name, QUrl::fromLocalFile( path ), FEATURE_FOLDER );
...@@ -856,7 +856,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA ...@@ -856,7 +856,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
QString fileName; QString fileName;
QString filePath; QString filePath;
//Audio item //Audio item
if(dest == picturesElement) { if(dest == picturesElement) {
...@@ -897,37 +897,37 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA ...@@ -897,37 +897,37 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination ) UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination )
{ {
/*UBFeature newElement = copyItemToFolder( url, destination ); /*UBFeature newElement = copyItemToFolder( url, destination );
deleteItem( url ); deleteItem( url );
return newElement;*/ return newElement;*/
QString sourcePath = url.toLocalFile(); QString sourcePath = url.toLocalFile();
Q_ASSERT( QFileInfo( sourcePath ).exists() ); Q_ASSERT( QFileInfo( sourcePath ).exists() );
UBFeature possibleDest = getDestinationFeatureForUrl(url); UBFeature possibleDest = getDestinationFeatureForUrl(url);
UBFeature dest = destination; UBFeature dest = destination;
if ( destination != trashElement && if ( destination != trashElement &&
!destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) ) !destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) )
{ {
dest = possibleDest; dest = possibleDest;
} }
QString name = QFileInfo( sourcePath ).fileName(); QString name = QFileInfo( sourcePath ).fileName();
QString destPath = dest.getFullPath().toLocalFile(); QString destPath = dest.getFullPath().toLocalFile();
QString destVirtualPath = dest.getFullVirtualPath(); QString destVirtualPath = dest.getFullVirtualPath();
QString newFullPath = destPath + "/" + name; QString newFullPath = destPath + "/" + name;
if ( sourcePath.compare( newFullPath, Qt::CaseInsensitive ) ) if ( sourcePath.compare( newFullPath, Qt::CaseInsensitive ) )
{ {
QFile( sourcePath ).copy( newFullPath ); QFile( sourcePath ).copy( newFullPath );
deleteItem( url ); deleteItem( url );
} }
QImage thumb = getIcon( newFullPath ); QImage thumb = getIcon( newFullPath );
UBFeatureElementType type = FEATURE_ITEM; UBFeatureElementType type = FEATURE_ITEM;
if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") )
type = FEATURE_INTERACTIVE; type = FEATURE_INTERACTIVE;
UBFeature newElement( destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); UBFeature newElement( destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile( newFullPath ), type );
return newElement; return newElement;
...@@ -1071,7 +1071,7 @@ void UBFeaturesController::deleteItem(const QUrl &url) ...@@ -1071,7 +1071,7 @@ void UBFeaturesController::deleteItem(const QUrl &url)
QString path = url.toLocalFile(); QString path = url.toLocalFile();
Q_ASSERT( QFileInfo( path ).exists() ); Q_ASSERT( QFileInfo( path ).exists() );
QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path ); QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path );
if ( thumbnailPath.length() && QFileInfo( thumbnailPath ).exists()) { if ( thumbnailPath.length() && QFileInfo( thumbnailPath ).exists()) {
if (QFileInfo(thumbnailPath).isFile()) { if (QFileInfo(thumbnailPath).isFile()) {
QFile::remove(thumbnailPath); QFile::remove(thumbnailPath);
......
...@@ -120,22 +120,22 @@ public: ...@@ -120,22 +120,22 @@ public:
QString getDisplayName() const {return mDisplayName;} QString getDisplayName() const {return mDisplayName;}
QImage getThumbnail() const {return mThumbnail;} QImage getThumbnail() const {return mThumbnail;}
QString getVirtualPath() const { return virtualDir; } QString getVirtualPath() const { return virtualDir; }
//QString getPath() const { return mPath; }; //QString getPath() const { return mPath; };
QUrl getFullPath() const { return mPath; } QUrl getFullPath() const { return mPath; }
QString getFullVirtualPath() const { return virtualDir + "/" + mName; } QString getFullVirtualPath() const { return virtualDir + "/" + mName; }
QString getUrl() const; QString getUrl() const;
void setFullPath(const QUrl &newPath) {mPath = newPath;} void setFullPath(const QUrl &newPath) {mPath = newPath;}
void setFullVirtualPath(const QString &newVirtualPath) {virtualDir = newVirtualPath;} void setFullVirtualPath(const QString &newVirtualPath) {virtualDir = newVirtualPath;}
UBFeatureElementType getType() const { return elementType; } UBFeatureElementType getType() const { return elementType; }
bool isFolder() const; bool isFolder() const;
bool allowedCopy() const; bool allowedCopy() const;
bool isDeletable() const; bool isDeletable() const;
bool inTrash() const; bool inTrash() const;
bool operator ==( const UBFeature &f )const; bool operator ==( const UBFeature &f )const;
bool operator !=( const UBFeature &f )const; bool operator !=( const UBFeature &f )const;
const QMap<QString,QString> & getMetadata() const { return metadata; } const QMap<QString,QString> & getMetadata() const { return metadata; }
void setMetadata( const QMap<QString,QString> &data ) { metadata = data; } void setMetadata( const QMap<QString,QString> &data ) { metadata = data; }
private: private:
...@@ -148,7 +148,7 @@ private: ...@@ -148,7 +148,7 @@ private:
QImage mThumbnail; QImage mThumbnail;
QString mName; QString mName;
QString mDisplayName; QString mDisplayName;
QUrl mPath; QUrl mPath;
UBFeatureElementType elementType; UBFeatureElementType elementType;
QMap<QString,QString> metadata; QMap<QString,QString> metadata;
}; };
...@@ -161,11 +161,11 @@ friend class UBFeaturesWidget; ...@@ -161,11 +161,11 @@ friend class UBFeaturesWidget;
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesController(QWidget *parentWidget); UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController(); virtual ~UBFeaturesController();
QList <UBFeature>* getFeatures() const {return featuresList;} QList <UBFeature>* getFeatures() const {return featuresList;}
const QString& getRootPath()const {return rootPath;} const QString& getRootPath()const {return rootPath;}
void scanFS(); void scanFS();
...@@ -173,12 +173,12 @@ public: ...@@ -173,12 +173,12 @@ public:
void addItemAsBackground(const UBFeature &item); void addItemAsBackground(const UBFeature &item);
const UBFeature& getCurrentElement()const {return currentElement;} const UBFeature& getCurrentElement()const {return currentElement;}
void setCurrentElement( const UBFeature &elem ) {currentElement = elem;} void setCurrentElement( const UBFeature &elem ) {currentElement = elem;}
const UBFeature & getTrashElement () const { return trashElement; } const UBFeature & getTrashElement () const { return trashElement; }
void addDownloadedFile( const QUrl &sourceUrl, const QByteArray &pData, const QString pContentSource, const QString pTitle ); void addDownloadedFile( const QUrl &sourceUrl, const QByteArray &pData, const QString pContentSource, const QString pTitle );
UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination ); UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination );
UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination ); UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination );
void moveExternalData(const QUrl &url, const UBFeature &destination); void moveExternalData(const QUrl &url, const UBFeature &destination);
void rescanModel(); void rescanModel();
...@@ -188,9 +188,9 @@ public: ...@@ -188,9 +188,9 @@ public:
void searchStarted(const QString &pattern, QListView *pOnView); void searchStarted(const QString &pattern, QListView *pOnView);
void refreshModels(); void refreshModels();
void deleteItem( const QUrl &url ); void deleteItem( const QUrl &url );
void deleteItem(const UBFeature &pFeature); void deleteItem(const UBFeature &pFeature);
bool isTrash( const QUrl &url ); bool isTrash( const QUrl &url );
void moveToTrash(UBFeature feature, bool deleteManualy = false); void moveToTrash(UBFeature feature, bool deleteManualy = false);
void addToFavorite( const QUrl &path ); void addToFavorite( const QUrl &path );
void removeFromFavorite(const QUrl &path, bool deleteManualy = false); void removeFromFavorite(const QUrl &path, bool deleteManualy = false);
...@@ -202,9 +202,9 @@ public: ...@@ -202,9 +202,9 @@ public:
int featuresCount(const QUrl &currPath); int featuresCount(const QUrl &currPath);
static UBFeatureElementType fileTypeFromUrl( const QString &path ); static UBFeatureElementType fileTypeFromUrl( const QString &path );
static QString fileNameFromUrl( const QUrl &url ); static QString fileNameFromUrl( const QUrl &url );
static QImage getIcon( const QString &path, UBFeatureElementType pFType ); static QImage getIcon( const QString &path, UBFeatureElementType pFType );
static bool isDeletable( const QUrl &url ); static bool isDeletable( const QUrl &url );
static char featureTypeSplitter() {return ':';} static char featureTypeSplitter() {return ':';}
static QString categoryNameForVirtualPath(const QString &str); static QString categoryNameForVirtualPath(const QString &str);
...@@ -255,49 +255,49 @@ private: ...@@ -255,49 +255,49 @@ private:
private: private:
static QImage createThumbnail(const QString &path); static QImage createThumbnail(const QString &path);
//void addImageToCurrentPage( const QString &path ); //void addImageToCurrentPage( const QString &path );
void loadFavoriteList(); void loadFavoriteList();
void saveFavoriteList(); void saveFavoriteList();
QString uniqNameForFeature(const UBFeature &feature, const QString &pName = "Imported", const QString &pExtention = "") const; QString uniqNameForFeature(const UBFeature &feature, const QString &pName = "Imported", const QString &pExtention = "") const;
QString adjustName(const QString &str); QString adjustName(const QString &str);
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
QUrl mUserAudioDirectoryPath; QUrl mUserAudioDirectoryPath;
QUrl mUserVideoDirectoryPath; QUrl mUserVideoDirectoryPath;
QUrl mUserPicturesDirectoryPath; QUrl mUserPicturesDirectoryPath;
QUrl mUserInteractiveDirectoryPath; QUrl mUserInteractiveDirectoryPath;
QUrl mUserAnimationDirectoryPath; QUrl mUserAnimationDirectoryPath;
QString libraryPath; QString libraryPath;
QUrl mLibPicturesDirectoryPath; QUrl mLibPicturesDirectoryPath;
QUrl mLibAudiosDirectoryPath; QUrl mLibAudiosDirectoryPath;
QUrl mLibVideosDirectoryPath; QUrl mLibVideosDirectoryPath;
QUrl mLibInteractiveDirectoryPath; QUrl mLibInteractiveDirectoryPath;
QUrl mLibAnimationsDirectoryPath; QUrl mLibAnimationsDirectoryPath;
QUrl mLibApplicationsDirectoryPath; QUrl mLibApplicationsDirectoryPath;
QUrl mLibShapesDirectoryPath; QUrl mLibShapesDirectoryPath;
QUrl trashDirectoryPath; QUrl trashDirectoryPath;
QUrl mLibSearchDirectoryPath; QUrl mLibSearchDirectoryPath;
int mLastItemOffsetIndex; int mLastItemOffsetIndex;
UBFeature currentElement; UBFeature currentElement;
UBFeature rootElement; UBFeature rootElement;
UBFeature favoriteElement; UBFeature favoriteElement;
UBFeature audiosElement; UBFeature audiosElement;
UBFeature moviesElement; UBFeature moviesElement;
UBFeature picturesElement; UBFeature picturesElement;
UBFeature interactElement; UBFeature interactElement;
UBFeature applicationsElement; UBFeature applicationsElement;
UBFeature flashElement; UBFeature flashElement;
UBFeature shapesElement; UBFeature shapesElement;
UBFeature webSearchElement; UBFeature webSearchElement;
QSet <QUrl> *favoriteSet; QSet <QUrl> *favoriteSet;
public: public:
UBFeature trashElement; UBFeature trashElement;
......
...@@ -51,17 +51,17 @@ struct UBStylusTool ...@@ -51,17 +51,17 @@ struct UBStylusTool
enum Enum enum Enum
{ {
Pen = 0, Pen = 0,
Eraser, Eraser,
Marker, Marker,
Selector, Selector,
Play, Play,
Hand, Hand,
ZoomIn, ZoomIn,
ZoomOut, ZoomOut,
Pointer, Pointer,
Line, Line,
Text, Text,
Capture Capture
}; };
}; };
...@@ -139,18 +139,18 @@ struct UBGraphicsItemType ...@@ -139,18 +139,18 @@ struct UBGraphicsItemType
enum Enum enum Enum
{ {
PolygonItemType = QGraphicsItem::UserType + 1, PolygonItemType = QGraphicsItem::UserType + 1,
PixmapItemType, PixmapItemType,
SvgItemType, SvgItemType,
DelegateButtonType, DelegateButtonType,
MediaItemType, MediaItemType,
PDFItemType, PDFItemType,
TextItemType, TextItemType,
CurtainItemType, CurtainItemType,
RulerItemType, RulerItemType,
CompassItemType, CompassItemType,
ProtractorItemType, ProtractorItemType,
StrokeItemType, StrokeItemType,
TriangleItemType, TriangleItemType,
MagnifierItemType, MagnifierItemType,
cacheItemType, cacheItemType,
AristoItemType, AristoItemType,
......
...@@ -658,17 +658,17 @@ bool UBApplication::handleOpenMessage(const QString& pMessage) ...@@ -658,17 +658,17 @@ bool UBApplication::handleOpenMessage(const QString& pMessage)
void UBApplication::cleanup() void UBApplication::cleanup()
{ {
if (applicationController) delete applicationController; if (applicationController) delete applicationController;
if (boardController) delete boardController; if (boardController) delete boardController;
if (webController) delete webController; if (webController) delete webController;
if (documentController) delete documentController; if (documentController) delete documentController;
if (mUniboardSankoreTransition) delete mUniboardSankoreTransition; if (mUniboardSankoreTransition) delete mUniboardSankoreTransition;
applicationController = NULL; applicationController = NULL;
boardController = NULL; boardController = NULL;
webController = NULL; webController = NULL;
documentController = NULL; documentController = NULL;
mUniboardSankoreTransition = NULL; mUniboardSankoreTransition = NULL;
} }
...@@ -707,19 +707,19 @@ void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, ...@@ -707,19 +707,19 @@ void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment,
QString UBApplication::urlFromHtml(QString html) QString UBApplication::urlFromHtml(QString html)
{ {
QString _html; QString _html;
QRegExp comments("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>"); QRegExp comments("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>");
QString url; QString url;
QDomDocument domDoc; QDomDocument domDoc;
// We remove all the comments & CRLF of this html // We remove all the comments & CRLF of this html
_html = html.remove(comments); _html = html.remove(comments);
domDoc.setContent(_html.remove(QRegExp("[\\0]"))); domDoc.setContent(_html.remove(QRegExp("[\\0]")));
QDomElement rootElem = domDoc.documentElement(); QDomElement rootElem = domDoc.documentElement();
// QUICKFIX: Here we have to check rootElem. Sometimes it can be a <meta> tag // QUICKFIX: Here we have to check rootElem. Sometimes it can be a <meta> tag
// In such a case we will not be able to retrieve the src value // In such a case we will not be able to retrieve the src value
if(rootElem.tagName().toLower().contains("meta")){ if(rootElem.tagName().toLower().contains("meta")){
qDebug() << rootElem.firstChildElement().tagName(); qDebug() << rootElem.firstChildElement().tagName();
// In that case we get the next element // In that case we get the next element
url = rootElem.firstChildElement().attribute("src"); url = rootElem.firstChildElement().attribute("src");
...@@ -727,7 +727,7 @@ QString UBApplication::urlFromHtml(QString html) ...@@ -727,7 +727,7 @@ QString UBApplication::urlFromHtml(QString html)
url = rootElem.attribute("src"); url = rootElem.attribute("src");
} }
return url; return url;
} }
bool UBApplication::isFromWeb(QString url) bool UBApplication::isFromWeb(QString url)
......
...@@ -58,7 +58,7 @@ class UBApplication : public QtSingleApplication ...@@ -58,7 +58,7 @@ class UBApplication : public QtSingleApplication
int exec(const QString& pFileToImport); int exec(const QString& pFileToImport);
void cleanup(); void cleanup();
static QPointer<QUndoStack> undoStack; static QPointer<QUndoStack> undoStack;
......
...@@ -233,10 +233,10 @@ void UBApplicationController::adjustDisplayView() ...@@ -233,10 +233,10 @@ void UBApplicationController::adjustDisplayView()
QRect rect = mControlView->rect(); QRect rect = mControlView->rect();
QPoint center(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); QPoint center(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
QTransform recentTransform = mDisplayView->transform(); QTransform recentTransform = mDisplayView->transform();
if (recentTransform != tr) if (recentTransform != tr)
mDisplayView->setTransform(tr); mDisplayView->setTransform(tr);
mDisplayView->centerOn(mControlView->mapToScene(center)); mDisplayView->centerOn(mControlView->mapToScene(center));
} }
...@@ -493,22 +493,22 @@ void UBApplicationController::showTutorial() ...@@ -493,22 +493,22 @@ void UBApplicationController::showTutorial()
} }
else{ else{
mMainWindow->webToolBar->hide(); mMainWindow->webToolBar->hide();
mMainWindow->boardToolBar->hide(); mMainWindow->boardToolBar->hide();
mMainWindow->documentToolBar->hide(); mMainWindow->documentToolBar->hide();
mMainWindow->tutorialToolBar->show(); mMainWindow->tutorialToolBar->show();
mMainMode = Tutorial; mMainMode = Tutorial;
adaptToolBar(); adaptToolBar();
mUninoteController->hideWindow(); mUninoteController->hideWindow();
UBApplication::webController->show(UBWebController::Tutorial); UBApplication::webController->show(UBWebController::Tutorial);
mirroringEnabled(false); mirroringEnabled(false);
emit mainModeChanged(mMainMode); emit mainModeChanged(mMainMode);
} }
} }
...@@ -543,7 +543,7 @@ void UBApplicationController::showSankoreEditor() ...@@ -543,7 +543,7 @@ void UBApplicationController::showSankoreEditor()
void UBApplicationController::checkUpdate() void UBApplicationController::checkUpdate()
{ {
if(mHttp) if(mHttp)
delete mHttp; delete mHttp;
QUrl url("http://ftp.open-sankore.org/update.json"); QUrl url("http://ftp.open-sankore.org/update.json");
mHttp = new QHttp(url.host()); mHttp = new QHttp(url.host());
......
...@@ -615,7 +615,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -615,7 +615,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager(); UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager();
bool teacherGuideModified = false; bool teacherGuideModified = false;
if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget()) if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget())
teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified(); teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified();
if (pDocumentProxy->isModified() || teacherGuideModified) if (pDocumentProxy->isModified() || teacherGuideModified)
UBMetadataDcSubsetAdaptor::persist(pDocumentProxy); UBMetadataDcSubsetAdaptor::persist(pDocumentProxy);
...@@ -873,7 +873,7 @@ QString UBPersistenceManager::teacherGuideAbsoluteObjectPath(UBDocumentProxy* pD ...@@ -873,7 +873,7 @@ QString UBPersistenceManager::teacherGuideAbsoluteObjectPath(UBDocumentProxy* pD
QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath) QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath)
{ {
QString path = UBFileSystemUtils::removeLocalFilePrefix(pPath); QString path = UBFileSystemUtils::removeLocalFilePrefix(pPath);
QFileInfo fi(path); QFileInfo fi(path);
QString uuid = QUuid::createUuid(); QString uuid = QUuid::createUuid();
if (!fi.exists() || !pDocumentProxy) if (!fi.exists() || !pDocumentProxy)
......
...@@ -61,7 +61,7 @@ class UBSetting : public QObject ...@@ -61,7 +61,7 @@ class UBSetting : public QObject
public slots: public slots:
void setBool(bool pValue); void setBool(bool pValue);
void setString(const QString& pValue); void setString(const QString& pValue);
void setInt(int pValue); void setInt(int pValue);
signals: signals:
......
...@@ -123,21 +123,21 @@ eMediaType UBMediaWidget::mediaType() ...@@ -123,21 +123,21 @@ eMediaType UBMediaWidget::mediaType()
void UBMediaWidget::showEvent(QShowEvent* event) void UBMediaWidget::showEvent(QShowEvent* event)
{ {
if(mType == eMediaType_Audio){ if(mType == eMediaType_Audio){
return; return;
}else{ }else{
if(!mpVideoWidget){ if(!mpVideoWidget){
mpVideoWidget = new Phonon::VideoWidget(this); mpVideoWidget = new Phonon::VideoWidget(this);
mMediaLayout->addStretch(1); mMediaLayout->addStretch(1);
mMediaLayout->addWidget(mpVideoWidget); mMediaLayout->addWidget(mpVideoWidget);
mMediaLayout->addStretch(1); mMediaLayout->addStretch(1);
Phonon::createPath(mpMediaObject, mpVideoWidget); Phonon::createPath(mpMediaObject, mpVideoWidget);
adaptSizeToVideo(); adaptSizeToVideo();
mpMediaObject->play(); mpMediaObject->play();
mpMediaObject->stop(); mpMediaObject->stop();
} }
QWidget::showEvent(event); QWidget::showEvent(event);
} }
} }
void UBMediaWidget::hideEvent(QHideEvent* event) void UBMediaWidget::hideEvent(QHideEvent* event)
......
...@@ -396,7 +396,7 @@ void UBDesktopAnnotationController::hideWindow() ...@@ -396,7 +396,7 @@ void UBDesktopAnnotationController::hideWindow()
void UBDesktopAnnotationController::goToUniboard() void UBDesktopAnnotationController::goToUniboard()
{ {
onToolClicked(); onToolClicked();
hideWindow(); hideWindow();
UBPlatformUtils::setDesktopMode(false); UBPlatformUtils::setDesktopMode(false);
...@@ -408,7 +408,7 @@ void UBDesktopAnnotationController::goToUniboard() ...@@ -408,7 +408,7 @@ void UBDesktopAnnotationController::goToUniboard()
void UBDesktopAnnotationController::customCapture() void UBDesktopAnnotationController::customCapture()
{ {
onToolClicked(); onToolClicked();
mIsFullyTransparent = true; mIsFullyTransparent = true;
updateBackground(); updateBackground();
...@@ -435,7 +435,7 @@ void UBDesktopAnnotationController::customCapture() ...@@ -435,7 +435,7 @@ void UBDesktopAnnotationController::customCapture()
void UBDesktopAnnotationController::windowCapture() void UBDesktopAnnotationController::windowCapture()
{ {
onToolClicked(); onToolClicked();
mIsFullyTransparent = true; mIsFullyTransparent = true;
updateBackground(); updateBackground();
...@@ -957,7 +957,7 @@ void UBDesktopAnnotationController::refreshMask() ...@@ -957,7 +957,7 @@ void UBDesktopAnnotationController::refreshMask()
void UBDesktopAnnotationController::onToolClicked() void UBDesktopAnnotationController::onToolClicked()
{ {
mDesktopEraserPalette->hide(); mDesktopEraserPalette->hide();
mDesktopMarkerPalette->hide(); mDesktopMarkerPalette->hide();
mDesktopPenPalette->hide(); mDesktopPenPalette->hide();
} }
...@@ -61,7 +61,7 @@ class UBDesktopPalette : public UBActionPalette ...@@ -61,7 +61,7 @@ class UBDesktopPalette : public UBActionPalette
void updateShowHideState(bool pShowEnabled); void updateShowHideState(bool pShowEnabled);
void setShowHideButtonVisible(bool visible); void setShowHideButtonVisible(bool visible);
void setDisplaySelectButtonVisible(bool show); void setDisplaySelectButtonVisible(bool show);
void minimizeMe(eMinimizedLocation location); void minimizeMe(eMinimizedLocation location);
void maximizeMe(); void maximizeMe();
void parentResized(); void parentResized();
......
...@@ -141,6 +141,6 @@ int UBDocumentContainer::sceneIndexFromPage(int page) ...@@ -141,6 +141,6 @@ int UBDocumentContainer::sceneIndexFromPage(int page)
void UBDocumentContainer::addEmptyThumbPage() void UBDocumentContainer::addEmptyThumbPage()
{ {
const QPixmap* pThumb = new QPixmap(); const QPixmap* pThumb = new QPixmap();
mDocumentThumbs.append(pThumb); mDocumentThumbs.append(pThumb);
} }
...@@ -488,7 +488,7 @@ void UBDocumentController::duplicateSelectedItem() ...@@ -488,7 +488,7 @@ void UBDocumentController::duplicateSelectedItem()
if (UBApplication::applicationController->displayMode() != UBApplicationController::Document) if (UBApplication::applicationController->displayMode() != UBApplicationController::Document)
return; return;
if (mSelectionType == Page) if (mSelectionType == Page)
{ {
QList<QGraphicsItem*> selectedItems = mDocumentUI->thumbnailWidget->selectedItems(); QList<QGraphicsItem*> selectedItems = mDocumentUI->thumbnailWidget->selectedItems();
QList<int> selectedSceneIndexes; QList<int> selectedSceneIndexes;
...@@ -1141,26 +1141,26 @@ void UBDocumentController::selectionChanged() ...@@ -1141,26 +1141,26 @@ void UBDocumentController::selectionChanged()
mMainWindow->actionNewDocument->setEnabled((groupSelected || docSelected || pageSelected) && !trashSelected); mMainWindow->actionNewDocument->setEnabled((groupSelected || docSelected || pageSelected) && !trashSelected);
mMainWindow->actionExport->setEnabled((docSelected || pageSelected) && !trashSelected); mMainWindow->actionExport->setEnabled((docSelected || pageSelected) && !trashSelected);
bool firstSceneSelected = false; bool firstSceneSelected = false;
if(docSelected) if(docSelected)
mMainWindow->actionDuplicate->setEnabled(!trashSelected); mMainWindow->actionDuplicate->setEnabled(!trashSelected);
else if(pageSelected){ else if(pageSelected){
QList<QGraphicsItem*> selection = mDocumentUI->thumbnailWidget->selectedItems(); QList<QGraphicsItem*> selection = mDocumentUI->thumbnailWidget->selectedItems();
if(pageCount == 1) if(pageCount == 1)
mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0)));
else{ else{
for(int i = 0; i < selection.count() && !firstSceneSelected; i += 1){ for(int i = 0; i < selection.count() && !firstSceneSelected; i += 1){
if(dynamic_cast<UBSceneThumbnailPixmap*>(selection.at(i))->sceneIndex() == 0){ if(dynamic_cast<UBSceneThumbnailPixmap*>(selection.at(i))->sceneIndex() == 0){
mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0)));
firstSceneSelected = true; firstSceneSelected = true;
} }
} }
if(!firstSceneSelected) if(!firstSceneSelected)
mMainWindow->actionDuplicate->setEnabled(!trashSelected); mMainWindow->actionDuplicate->setEnabled(!trashSelected);
} }
} }
else else
mMainWindow->actionDuplicate->setEnabled(false); mMainWindow->actionDuplicate->setEnabled(false);
mMainWindow->actionOpen->setEnabled((docSelected || pageSelected) && !trashSelected); mMainWindow->actionOpen->setEnabled((docSelected || pageSelected) && !trashSelected);
mMainWindow->actionRename->setEnabled((groupSelected || docSelected) && !trashSelected && !defaultGroupSelected); mMainWindow->actionRename->setEnabled((groupSelected || docSelected) && !trashSelected && !defaultGroupSelected);
...@@ -1190,7 +1190,7 @@ void UBDocumentController::selectionChanged() ...@@ -1190,7 +1190,7 @@ void UBDocumentController::selectionChanged()
} }
if(pageSelected && firstSceneSelected) if(pageSelected && firstSceneSelected)
deleteEnabled = false; deleteEnabled = false;
mMainWindow->actionDelete->setEnabled(deleteEnabled); mMainWindow->actionDelete->setEnabled(deleteEnabled);
...@@ -1632,28 +1632,28 @@ int UBDocumentController::getSelectedItemIndex() ...@@ -1632,28 +1632,28 @@ int UBDocumentController::getSelectedItemIndex()
bool UBDocumentController::pageCanBeMovedUp(int page) bool UBDocumentController::pageCanBeMovedUp(int page)
{ {
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
return page >= 2; return page >= 2;
else else
return page >= 1; return page >= 1;
} }
bool UBDocumentController::pageCanBeMovedDown(int page) bool UBDocumentController::pageCanBeMovedDown(int page)
{ {
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
return page != 0 && page < selectedDocument()->pageCount() - 1; return page != 0 && page < selectedDocument()->pageCount() - 1;
else else
return page < selectedDocument()->pageCount() - 1; return page < selectedDocument()->pageCount() - 1;
} }
bool UBDocumentController::pageCanBeDuplicated(int page) bool UBDocumentController::pageCanBeDuplicated(int page)
{ {
return page != 0; return page != 0;
} }
bool UBDocumentController::pageCanBeDeleted(int page) bool UBDocumentController::pageCanBeDeleted(int page)
{ {
return page != 0; return page != 0;
} }
void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*) void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*)
...@@ -1685,9 +1685,9 @@ void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*) ...@@ -1685,9 +1685,9 @@ void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*)
items << pixmapItem; items << pixmapItem;
int pageIndex = pageFromSceneIndex(i); int pageIndex = pageFromSceneIndex(i);
if(pageIndex) if(pageIndex)
labels << tr("Page %1").arg(pageIndex); labels << tr("Page %1").arg(pageIndex);
else else
labels << tr("Title page"); labels << tr("Title page");
itemsPath.append(QUrl::fromLocalFile(proxy->persistencePath() + QString("/pages/%1").arg(UBDocumentContainer::pageFromSceneIndex(i)))); itemsPath.append(QUrl::fromLocalFile(proxy->persistencePath() + QString("/pages/%1").arg(UBDocumentContainer::pageFromSceneIndex(i))));
} }
......
...@@ -39,7 +39,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent ...@@ -39,7 +39,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent
{ {
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setDelegate(new UBGraphicsGroupContainerItemDelegate(this, 0)); setDelegate(new UBGraphicsGroupContainerItemDelegate(this, 0));
Delegate()->init(); Delegate()->init();
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
......
...@@ -79,13 +79,13 @@ void UBGraphicsPolygonItem::setUuid(const QUuid &pUuid) ...@@ -79,13 +79,13 @@ void UBGraphicsPolygonItem::setUuid(const QUuid &pUuid)
void UBGraphicsPolygonItem::clearStroke() void UBGraphicsPolygonItem::clearStroke()
{ {
if (mStroke!=NULL) if (mStroke!=NULL)
{ {
mStroke->remove(this); mStroke->remove(this);
if (mStroke->polygons().empty()) if (mStroke->polygons().empty())
delete mStroke; delete mStroke;
mStroke = NULL; mStroke = NULL;
} }
} }
UBGraphicsPolygonItem::~UBGraphicsPolygonItem() UBGraphicsPolygonItem::~UBGraphicsPolygonItem()
......
...@@ -313,7 +313,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -313,7 +313,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon); UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
public slots: public slots:
void initStroke(); void initStroke();
void hideEraser(); void hideEraser();
void setBackground(bool pIsDark, bool pIsCrossed); void setBackground(bool pIsDark, bool pIsCrossed);
......
...@@ -135,18 +135,18 @@ void UBGraphicsStrokesGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) ...@@ -135,18 +135,18 @@ void UBGraphicsStrokesGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
UBItem* UBGraphicsStrokesGroup::deepCopy() const UBItem* UBGraphicsStrokesGroup::deepCopy() const
{ {
UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup(); UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup();
QTransform groupTransform = transform(); QTransform groupTransform = transform();
const_cast<UBGraphicsStrokesGroup*>(this)->resetTransform(); const_cast<UBGraphicsStrokesGroup*>(this)->resetTransform();
QList<QGraphicsItem*> chl = childItems(); QList<QGraphicsItem*> chl = childItems();
foreach(QGraphicsItem *child, chl) foreach(QGraphicsItem *child, chl)
{ {
UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child); UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child);
if (polygon){ if (polygon){
UBGraphicsPolygonItem *polygonCopy = dynamic_cast<UBGraphicsPolygonItem*>(polygon->deepCopy()); UBGraphicsPolygonItem *polygonCopy = dynamic_cast<UBGraphicsPolygonItem*>(polygon->deepCopy());
if (polygonCopy) if (polygonCopy)
{ {
...@@ -154,18 +154,18 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const ...@@ -154,18 +154,18 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
copy->addToGroup(pItem); copy->addToGroup(pItem);
polygonCopy->setStrokesGroup(copy); polygonCopy->setStrokesGroup(copy);
} }
} }
} }
const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform); const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform);
copyItemParameters(copy); copyItemParameters(copy);
return copy; return copy;
} }
void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const
{ {
QGraphicsItem *cp = dynamic_cast<QGraphicsItem*>(copy); QGraphicsItem *cp = dynamic_cast<QGraphicsItem*>(copy);
if(NULL != cp) if(NULL != cp)
{ {
cp->setTransform(transform()); cp->setTransform(transform());
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
void UBPlatformUtils::destroy() void UBPlatformUtils::destroy()
{ {
destroyKeyboardLayouts(); destroyKeyboardLayouts();
} }
UBPlatformUtils::UBPlatformUtils() UBPlatformUtils::UBPlatformUtils()
...@@ -42,19 +42,19 @@ UBPlatformUtils::~UBPlatformUtils() ...@@ -42,19 +42,19 @@ UBPlatformUtils::~UBPlatformUtils()
bool UBPlatformUtils::hasVirtualKeyboard() bool UBPlatformUtils::hasVirtualKeyboard()
{ {
return keyboardLayouts!=NULL && nKeyboardLayouts!=0; return keyboardLayouts!=NULL && nKeyboardLayouts!=0;
} }
UBKeyboardLocale::~UBKeyboardLocale() UBKeyboardLocale::~UBKeyboardLocale()
{ {
if (varSymbols!=NULL) if (varSymbols!=NULL)
{ {
for(int i=0; i<SYMBOL_KEYS_COUNT; i++) for(int i=0; i<SYMBOL_KEYS_COUNT; i++)
delete varSymbols[i]; delete varSymbols[i];
delete [] varSymbols; delete [] varSymbols;
} }
delete icon; delete icon;
} }
...@@ -63,7 +63,7 @@ UBKeyboardLocale** UBPlatformUtils::keyboardLayouts; ...@@ -63,7 +63,7 @@ UBKeyboardLocale** UBPlatformUtils::keyboardLayouts;
UBKeyboardLocale** UBPlatformUtils::getKeyboardLayouts(int& nCount) UBKeyboardLocale** UBPlatformUtils::getKeyboardLayouts(int& nCount)
{ {
nCount = nKeyboardLayouts; nCount = nKeyboardLayouts;
return keyboardLayouts; return keyboardLayouts;
} }
...@@ -89,14 +89,14 @@ struct KEYCODE{ ...@@ -89,14 +89,14 @@ struct KEYCODE{
struct KEYBT struct KEYBT
{ {
QChar symbol1; QChar symbol1;
QChar symbol2; QChar symbol2;
bool capsLockSwitch; bool capsLockSwitch;
int modifier1; int modifier1;
int modifier2; int modifier2;
KEYCODE codes[8]; KEYCODE codes[8];
KEYBT( QChar _symbol1, KEYBT( QChar _symbol1,
QChar _symbol2, QChar _symbol2,
bool _capsLockSwitch, bool _capsLockSwitch,
int _modifier1, int _modifier1,
int _modifier2, int _modifier2,
...@@ -130,40 +130,40 @@ struct KEYBT ...@@ -130,40 +130,40 @@ struct KEYBT
class UBKeyboardLocale class UBKeyboardLocale
{ {
public: public:
UBKeyboardLocale(const QString& _fullName, UBKeyboardLocale(const QString& _fullName,
const QString& _name, const QString& _name,
const QString& _id, const QString& _id,
QIcon* _icon, QIcon* _icon,
KEYBT** _symbols) KEYBT** _symbols)
:fullName(_fullName),name(_name), id(_id), icon(_icon), :fullName(_fullName),name(_name), id(_id), icon(_icon),
constSymbols(NULL), varSymbols(_symbols) constSymbols(NULL), varSymbols(_symbols)
{} {}
UBKeyboardLocale(const QString& _fullName, UBKeyboardLocale(const QString& _fullName,
const QString& _name, const QString& _name,
const QString& _id, const QString& _id,
QIcon* _icon, QIcon* _icon,
KEYBT _symbols[]) KEYBT _symbols[])
:fullName(_fullName),name(_name), id(_id), icon(_icon), :fullName(_fullName),name(_name), id(_id), icon(_icon),
constSymbols(_symbols), varSymbols(NULL) constSymbols(_symbols), varSymbols(NULL)
{} {}
~UBKeyboardLocale(); ~UBKeyboardLocale();
const QString fullName; const QString fullName;
const QString name; const QString name;
const QString id; const QString id;
QIcon* icon; QIcon* icon;
KEYBT* operator[] (int index) const KEYBT* operator[] (int index) const
{ {
return (varSymbols==NULL)? constSymbols + index : varSymbols[index]; return (varSymbols==NULL)? constSymbols + index : varSymbols[index];
} }
private: private:
KEYBT* constSymbols; KEYBT* constSymbols;
KEYBT** varSymbols; KEYBT** varSymbols;
}; };
class UBPlatformUtils class UBPlatformUtils
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
void UBPlatformUtils::init() void UBPlatformUtils::init()
{ {
initializeKeyboardLayouts(); initializeKeyboardLayouts();
} }
QString UBPlatformUtils::applicationResourcesDirectory() QString UBPlatformUtils::applicationResourcesDirectory()
...@@ -68,11 +68,11 @@ void UBPlatformUtils::fadeDisplayIn() ...@@ -68,11 +68,11 @@ void UBPlatformUtils::fadeDisplayIn()
QStringList UBPlatformUtils::availableTranslations() QStringList UBPlatformUtils::availableTranslations()
{ {
QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/"; QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/";
QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath); QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath);
QRegExp sankoreTranslationFiles(".*sankore_.*.qm"); QRegExp sankoreTranslationFiles(".*sankore_.*.qm");
translationsList=translationsList.filter(sankoreTranslationFiles); translationsList=translationsList.filter(sankoreTranslationFiles);
return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2"); return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2");
} }
QString UBPlatformUtils::translationPath(QString pFilePrefix,QString pLanguage) QString UBPlatformUtils::translationPath(QString pFilePrefix,QString pLanguage)
...@@ -351,57 +351,57 @@ KEYBT FRENCH_LOCALE[] = { ...@@ -351,57 +351,57 @@ KEYBT FRENCH_LOCALE[] = {
KEYBT SWISS_FRENCH_LOCALE[] = { KEYBT SWISS_FRENCH_LOCALE[] = {
/* § °*/ KEYBTDECL(0xa7, 0xb0, false, 41), /* § °*/ KEYBTDECL(0xa7, 0xb0, false, 41),
/* 1 +*/ KEYBTDECL(0x31, 0x2b, false, 2), /* 1 +*/ KEYBTDECL(0x31, 0x2b, false, 2),
/* 2 "*/ KEYBTDECL(0x32, 0x22, false, 3), /* 2 "*/ KEYBTDECL(0x32, 0x22, false, 3),
/* 3 **/ KEYBTDECL(0x33, 0x2a, false, 4), /* 3 **/ KEYBTDECL(0x33, 0x2a, false, 4),
/* 4 ç*/ KEYBTDECL(0x34, 0xe7, false, 5), /* 4 ç*/ KEYBTDECL(0x34, 0xe7, false, 5),
/* 5 %*/ KEYBTDECL(0x35, 0x25, false, 6), /* 5 %*/ KEYBTDECL(0x35, 0x25, false, 6),
/* 6 &*/ KEYBTDECL(0x36, 0x26, false, 7), /* 6 &*/ KEYBTDECL(0x36, 0x26, false, 7),
/* 7 /*/ KEYBTDECL(0x37, 0x2f, false, 8), /* 7 /*/ KEYBTDECL(0x37, 0x2f, false, 8),
/* 8 (*/ KEYBTDECL(0x38, 0x28, false, 9), /* 8 (*/ KEYBTDECL(0x38, 0x28, false, 9),
/* 9 )*/ KEYBTDECL(0x39, 0x29, false, 10), /* 9 )*/ KEYBTDECL(0x39, 0x29, false, 10),
/* 0 =*/ KEYBTDECL(0x30, 0x3d, false, 11), /* 0 =*/ KEYBTDECL(0x30, 0x3d, false, 11),
/* ' ?*/ KEYBTDECL(0x27, 0x5f, false, 12), /* ' ?*/ KEYBTDECL(0x27, 0x5f, false, 12),
/* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, KEYCODE(0x5e, 13, 0), KEYCODE(0x60, 13, 1)), /* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, KEYCODE(0x5e, 13, 0), KEYCODE(0x60, 13, 1)),
/* q Q*/ KEYBTDECL(0x71, 0x51, true, 16), /* q Q*/ KEYBTDECL(0x71, 0x51, true, 16),
/* w W*/ KEYBTDECL(0x77, 0x57, true, 17), /* w W*/ KEYBTDECL(0x77, 0x57, true, 17),
/* e E*/ KEYBTDECLEX8(0x65, 0x45, true, 18, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb), /* e E*/ KEYBTDECLEX8(0x65, 0x45, true, 18, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb),
/* r R*/ KEYBTDECL(0x72, 0x52, true, 19), /* r R*/ KEYBTDECL(0x72, 0x52, true, 19),
/* t T*/ KEYBTDECL(0x74, 0x54, true, 20), /* t T*/ KEYBTDECL(0x74, 0x54, true, 20),
/* z Z*/ KEYBTDECL(0x7a, 0x5a, true, 21), /* z Z*/ KEYBTDECL(0x7a, 0x5a, true, 21),
/* u U*/ KEYBTDECLEX8(0x75, 0x55, true, 22, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc), /* u U*/ KEYBTDECLEX8(0x75, 0x55, true, 22, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc),
/* i I*/ KEYBTDECLEX8(0x69, 0x49, true, 23, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf), /* i I*/ KEYBTDECLEX8(0x69, 0x49, true, 23, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf),
/* o O*/ KEYBTDECLEX8(0x6f, 0x4f, true, 24, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6), /* o O*/ KEYBTDECLEX8(0x6f, 0x4f, true, 24, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6),
/* p P*/ KEYBTDECL(0x70, 0x50, true, 25), /* p P*/ KEYBTDECL(0x70, 0x50, true, 25),
/* è ü*/ KEYBTDECL(0xe8, 0xfa, false, 26), /* è ü*/ KEYBTDECL(0xe8, 0xfa, false, 26),
/* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, KEYCODE(0xa8, 27, 0), KEYCODE(0x21, 27, 1)), /* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, KEYCODE(0xa8, 27, 0), KEYCODE(0x21, 27, 1)),
/* a A*/ KEYBTDECLEX8(0x61, 0x41, true, 30, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4), /* a A*/ KEYBTDECLEX8(0x61, 0x41, true, 30, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4),
/* s S*/ KEYBTDECL(0x73, 0x53, true, 31), /* s S*/ KEYBTDECL(0x73, 0x53, true, 31),
/* d D*/ KEYBTDECL(0x64, 0x44, true, 32), /* d D*/ KEYBTDECL(0x64, 0x44, true, 32),
/* f F*/ KEYBTDECL(0x66, 0x46, true, 33), /* f F*/ KEYBTDECL(0x66, 0x46, true, 33),
/* g G*/ KEYBTDECL(0x67, 0x47, true, 34), /* g G*/ KEYBTDECL(0x67, 0x47, true, 34),
/* h H*/ KEYBTDECL(0x68, 0x48, true, 35), /* h H*/ KEYBTDECL(0x68, 0x48, true, 35),
/* j J*/ KEYBTDECL(0x6a, 0x4a, true, 36), /* j J*/ KEYBTDECL(0x6a, 0x4a, true, 36),
/* k K*/ KEYBTDECL(0x6b, 0x4b, true, 37), /* k K*/ KEYBTDECL(0x6b, 0x4b, true, 37),
/* l L*/ KEYBTDECL(0x6c, 0x4c, true, 38), /* l L*/ KEYBTDECL(0x6c, 0x4c, true, 38),
/* é ö*/ KEYBTDECL(0xe9, 0xf6, false, 39), /* é ö*/ KEYBTDECL(0xe9, 0xf6, false, 39),
/* à ä*/ KEYBTDECL(0xe0, 0xe4, false, 40), /* à ä*/ KEYBTDECL(0xe0, 0xe4, false, 40),
/* $ £*/ KEYBTDECL(0x24, 0xa3, false, 43), /* $ £*/ KEYBTDECL(0x24, 0xa3, false, 43),
/* < >*/ KEYBTDECL(0x3c, 0x3e, false, 44), /* < >*/ KEYBTDECL(0x3c, 0x3e, false, 44),
/* y Y*/ KEYBTDECLEX8(0x79, 0x59, true, 45, 0x79, 0x59, 0, 0, 0, 0, 0xff, 0), /* y Y*/ KEYBTDECLEX8(0x79, 0x59, true, 45, 0x79, 0x59, 0, 0, 0, 0, 0xff, 0),
/* x X*/ KEYBTDECL(0x78, 0x58, true, 46), /* x X*/ KEYBTDECL(0x78, 0x58, true, 46),
/* c C*/ KEYBTDECL(0x63, 0x43, true, 47), /* c C*/ KEYBTDECL(0x63, 0x43, true, 47),
/* v V*/ KEYBTDECL(0x76, 0x56, true, 48), /* v V*/ KEYBTDECL(0x76, 0x56, true, 48),
/* b B*/ KEYBTDECL(0x62, 0x42, true, 49), /* b B*/ KEYBTDECL(0x62, 0x42, true, 49),
/* n N*/ KEYBTDECL(0x6e, 0x4e, true, 50), /* n N*/ KEYBTDECL(0x6e, 0x4e, true, 50),
/* m M*/ KEYBTDECL(0x6d, 0x4d, true, 51), /* m M*/ KEYBTDECL(0x6d, 0x4d, true, 51),
/* , ;*/ KEYBTDECL(0x2c, 0x3b, false, 52), /* , ;*/ KEYBTDECL(0x2c, 0x3b, false, 52),
/* . :*/ KEYBTDECL(0x2e, 0x3a, false, 53), /* . :*/ KEYBTDECL(0x2e, 0x3a, false, 53),
/* - _*/ KEYBTDECL(0x2d, 0x5f, false, 54)}; /* - _*/ KEYBTDECL(0x2d, 0x5f, false, 54)};
void UBPlatformUtils::initializeKeyboardLayouts() void UBPlatformUtils::initializeKeyboardLayouts()
...@@ -418,9 +418,9 @@ void UBPlatformUtils::initializeKeyboardLayouts() ...@@ -418,9 +418,9 @@ void UBPlatformUtils::initializeKeyboardLayouts()
void UBPlatformUtils::destroyKeyboardLayouts() void UBPlatformUtils::destroyKeyboardLayouts()
{ {
for(int i=0; i<nKeyboardLayouts; i++) for(int i=0; i<nKeyboardLayouts; i++)
delete keyboardLayouts[i]; delete keyboardLayouts[i];
delete [] keyboardLayouts; delete [] keyboardLayouts;
keyboardLayouts = NULL; keyboardLayouts = NULL;
} }
QString UBPlatformUtils::urlFromClipboard() QString UBPlatformUtils::urlFromClipboard()
......
This diff is collapsed.
This diff is collapsed.
...@@ -42,7 +42,7 @@ class UBDocumentProxy; ...@@ -42,7 +42,7 @@ class UBDocumentProxy;
#include "UBDockPaletteWidget.h" #include "UBDockPaletteWidget.h"
#define TABSIZE 50 //Height of the tab of the palette #define TABSIZE 50 //Height of the tab of the palette
#define CLICKTIME 1000000 //Clicktime to expand or collapse palette #define CLICKTIME 1000000 //Clicktime to expand or collapse palette
/** /**
......
...@@ -55,5 +55,5 @@ UBDockTeacherGuideWidget::~UBDockTeacherGuideWidget() ...@@ -55,5 +55,5 @@ UBDockTeacherGuideWidget::~UBDockTeacherGuideWidget()
UBTeacherGuideWidget* UBDockTeacherGuideWidget::teacherGuideWidget() UBTeacherGuideWidget* UBDockTeacherGuideWidget::teacherGuideWidget()
{ {
return mpTeacherGuideWidget; return mpTeacherGuideWidget;
} }
...@@ -87,8 +87,8 @@ UBDocumentNavigator::~UBDocumentNavigator() ...@@ -87,8 +87,8 @@ UBDocumentNavigator::~UBDocumentNavigator()
void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{ {
mThumbsWithLabels.clear(); mThumbsWithLabels.clear();
foreach(QGraphicsItem* it, mScene->items()) foreach(QGraphicsItem* it, mScene->items())
{ {
mScene->removeItem(it); mScene->removeItem(it);
delete it; delete it;
...@@ -106,15 +106,15 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) ...@@ -106,15 +106,15 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex); QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex);
UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label); UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label);
UBImgTextThumbnailElement thumbWithText(pixmapItem, labelItem); UBImgTextThumbnailElement thumbWithText(pixmapItem, labelItem);
thumbWithText.setBorder(border()); thumbWithText.setBorder(border());
mThumbsWithLabels.append(thumbWithText); mThumbsWithLabels.append(thumbWithText);
mScene->addItem(pixmapItem); mScene->addItem(pixmapItem);
mScene->addItem(labelItem); mScene->addItem(labelItem);
} }
// Draw the items // Draw the items
refreshScene(); refreshScene();
} }
...@@ -173,7 +173,7 @@ void UBDocumentNavigator::refreshScene() ...@@ -173,7 +173,7 @@ void UBDocumentNavigator::refreshScene()
UBImgTextThumbnailElement& item = mThumbsWithLabels[i]; UBImgTextThumbnailElement& item = mThumbsWithLabels[i];
int columnIndex = i % mNbColumns; int columnIndex = i % mNbColumns;
int rowIndex = i / mNbColumns; int rowIndex = i / mNbColumns;
item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight); item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight);
} }
scene()->setSceneRect(scene()->itemsBoundingRect()); scene()->setSceneRect(scene()->itemsBoundingRect());
} }
...@@ -258,29 +258,29 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event) ...@@ -258,29 +258,29 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
if(NULL != pTextItem) if(NULL != pTextItem)
{ {
for(int i = 0; i < mThumbsWithLabels.size(); i++) for(int i = 0; i < mThumbsWithLabels.size(); i++)
{ {
const UBImgTextThumbnailElement& el = mThumbsWithLabels.at(i); const UBImgTextThumbnailElement& el = mThumbsWithLabels.at(i);
if(el.getCaption() == pTextItem) if(el.getCaption() == pTextItem)
{ {
pCrntItem = el.getThumbnail(); pCrntItem = el.getThumbnail();
break; break;
} }
} }
} }
} }
int index = 0; int index = 0;
for(int i = 0; i < mThumbsWithLabels.size(); i++) for(int i = 0; i < mThumbsWithLabels.size(); i++)
{ {
if (mThumbsWithLabels.at(i).getThumbnail() == pCrntItem) if (mThumbsWithLabels.at(i).getThumbnail() == pCrntItem)
{ {
index = i; index = i;
break; break;
} }
} }
UBApplication::boardController->setActiveDocumentScene(index); UBApplication::boardController->setActiveDocumentScene(index);
} }
QGraphicsView::mousePressEvent(event); QGraphicsView::mousePressEvent(event);
} }
void UBDocumentNavigator::mouseReleaseEvent(QMouseEvent *event) void UBDocumentNavigator::mouseReleaseEvent(QMouseEvent *event)
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "document/UBDocumentContainer.h" #include "document/UBDocumentContainer.h"
#include "UBThumbnailWidget.h" #include "UBThumbnailWidget.h"
#define NO_PAGESELECTED -1 #define NO_PAGESELECTED -1
class UBDocumentNavigator : public QGraphicsView class UBDocumentNavigator : public QGraphicsView
{ {
...@@ -68,8 +68,8 @@ private: ...@@ -68,8 +68,8 @@ private:
QGraphicsScene* mScene; QGraphicsScene* mScene;
/** The current selected item */ /** The current selected item */
//UBSceneThumbnailNavigPixmap* mCrntItem; //UBSceneThumbnailNavigPixmap* mCrntItem;
/** The list of current thumbnails with labels*/ /** The list of current thumbnails with labels*/
QList<UBImgTextThumbnailElement> mThumbsWithLabels; QList<UBImgTextThumbnailElement> mThumbsWithLabels;
/** The current number of columns */ /** The current number of columns */
int mNbColumns; int mNbColumns;
/** The current thumbnails width */ /** The current thumbnails width */
......
...@@ -38,12 +38,12 @@ UBDocumentThumbnailWidget::UBDocumentThumbnailWidget(QWidget* parent) ...@@ -38,12 +38,12 @@ UBDocumentThumbnailWidget::UBDocumentThumbnailWidget(QWidget* parent)
: UBThumbnailWidget(parent) : UBThumbnailWidget(parent)
, mDropCaretRectItem(0) , mDropCaretRectItem(0)
, mClosestDropItem(0) , mClosestDropItem(0)
, mDragEnabled(true) , mDragEnabled(true)
, mScrollMagnitude(0) , mScrollMagnitude(0)
{ {
bCanDrag = false; bCanDrag = false;
mScrollTimer = new QTimer(this); mScrollTimer = new QTimer(this);
connect(mScrollTimer, SIGNAL(timeout()), this, SLOT(autoScroll())); connect(mScrollTimer, SIGNAL(timeout()), this, SLOT(autoScroll()));
} }
...@@ -78,18 +78,18 @@ void UBDocumentThumbnailWidget::mouseMoveEvent(QMouseEvent *event) ...@@ -78,18 +78,18 @@ void UBDocumentThumbnailWidget::mouseMoveEvent(QMouseEvent *event)
{ {
int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex());
if(pageIndex != 0){ if(pageIndex != 0){
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
QList<UBMimeDataItem> mimeDataItems; QList<UBMimeDataItem> mimeDataItems;
foreach (QGraphicsItem *item, selectedItems()) foreach (QGraphicsItem *item, selectedItems())
mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item))); mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item)));
UBMimeData *mime = new UBMimeData(mimeDataItems); UBMimeData *mime = new UBMimeData(mimeDataItems);
drag->setMimeData(mime); drag->setMimeData(mime);
drag->setPixmap(sceneItem->pixmap().scaledToWidth(100)); drag->setPixmap(sceneItem->pixmap().scaledToWidth(100));
drag->setHotSpot(QPoint(drag->pixmap().width()/2, drag->pixmap().height() / 2)); drag->setHotSpot(QPoint(drag->pixmap().width()/2, drag->pixmap().height() / 2));
drag->exec(Qt::MoveAction); drag->exec(Qt::MoveAction);
} }
} }
...@@ -111,43 +111,43 @@ void UBDocumentThumbnailWidget::dragEnterEvent(QDragEnterEvent *event) ...@@ -111,43 +111,43 @@ void UBDocumentThumbnailWidget::dragEnterEvent(QDragEnterEvent *event)
void UBDocumentThumbnailWidget::dragLeaveEvent(QDragLeaveEvent *event) void UBDocumentThumbnailWidget::dragLeaveEvent(QDragLeaveEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
if (mScrollTimer->isActive()) if (mScrollTimer->isActive())
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
deleteDropCaret(); deleteDropCaret();
UBThumbnailWidget::dragLeaveEvent(event); UBThumbnailWidget::dragLeaveEvent(event);
} }
void UBDocumentThumbnailWidget::autoScroll() void UBDocumentThumbnailWidget::autoScroll()
{ {
this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude);
} }
void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
{ {
QRect boundingFrame = frameRect(); QRect boundingFrame = frameRect();
//setting up automatic scrolling //setting up automatic scrolling
const int SCROLL_DISTANCE = 16; const int SCROLL_DISTANCE = 16;
int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y();
if(qAbs(bottomDist) <= SCROLL_DISTANCE) if(qAbs(bottomDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else if(qAbs(topDist) <= SCROLL_DISTANCE) else if(qAbs(topDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else else
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
QList<UBSceneThumbnailPixmap*> pixmapItems; QList<UBSceneThumbnailPixmap*> pixmapItems;
foreach (QGraphicsItem *item, scene()->items(mapToScene(boundingFrame))) foreach (QGraphicsItem *item, scene()->items(mapToScene(boundingFrame)))
{ {
UBSceneThumbnailPixmap* sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(item); UBSceneThumbnailPixmap* sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(item);
...@@ -161,11 +161,11 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) ...@@ -161,11 +161,11 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
int pageIndex = -1; int pageIndex = -1;
if(mClosestDropItem){ if(mClosestDropItem){
pageIndex = UBDocumentContainer::pageFromSceneIndex(mClosestDropItem->sceneIndex()); pageIndex = UBDocumentContainer::pageFromSceneIndex(mClosestDropItem->sceneIndex());
if(pageIndex == 0){ if(pageIndex == 0){
event->acceptProposedAction(); event->acceptProposedAction();
return; return;
} }
} }
if (!mClosestDropItem) if (!mClosestDropItem)
{ {
...@@ -219,19 +219,19 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) ...@@ -219,19 +219,19 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
void UBDocumentThumbnailWidget::dropEvent(QDropEvent *event) void UBDocumentThumbnailWidget::dropEvent(QDropEvent *event)
{ {
if (mScrollTimer->isActive()) if (mScrollTimer->isActive())
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
deleteDropCaret(); deleteDropCaret();
if (mClosestDropItem) if (mClosestDropItem)
{ {
int targetIndex = mDropIsRight ? mGraphicItems.indexOf(mClosestDropItem) + 1 : mGraphicItems.indexOf(mClosestDropItem); int targetIndex = mDropIsRight ? mGraphicItems.indexOf(mClosestDropItem) + 1 : mGraphicItems.indexOf(mClosestDropItem);
if(UBDocumentContainer::pageFromSceneIndex(targetIndex) == 0){ if(UBDocumentContainer::pageFromSceneIndex(targetIndex) == 0){
event->ignore(); event->ignore();
return; return;
} }
QList<UBMimeDataItem> mimeDataItems; QList<UBMimeDataItem> mimeDataItems;
......
...@@ -49,8 +49,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget ...@@ -49,8 +49,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget
signals: signals:
void sceneDropped(UBDocumentProxy* proxy, int source, int target); void sceneDropped(UBDocumentProxy* proxy, int source, int target);
private slots: private slots:
void autoScroll(); void autoScroll();
protected: protected:
...@@ -68,8 +68,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget ...@@ -68,8 +68,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget
UBSceneThumbnailPixmap *mClosestDropItem; UBSceneThumbnailPixmap *mClosestDropItem;
bool mDropIsRight; bool mDropIsRight;
bool mDragEnabled; bool mDragEnabled;
QTimer* mScrollTimer; QTimer* mScrollTimer;
int mScrollMagnitude; int mScrollMagnitude;
}; };
#endif /* UBDOCUMENTTHUMBNAILWIDGET_H_ */ #endif /* UBDOCUMENTTHUMBNAILWIDGET_H_ */
...@@ -116,10 +116,10 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event) ...@@ -116,10 +116,10 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
Q_UNUSED(event); Q_UNUSED(event);
if (mScrollTimer->isActive()) if (mScrollTimer->isActive())
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
if (mDropTargetProxyTi) if (mDropTargetProxyTi)
{ {
...@@ -131,25 +131,25 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event) ...@@ -131,25 +131,25 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event) void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event)
{ {
QRect boundingFrame = frameRect(); QRect boundingFrame = frameRect();
//setting up automatic scrolling //setting up automatic scrolling
const int SCROLL_DISTANCE = 4; const int SCROLL_DISTANCE = 4;
int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y();
if(qAbs(bottomDist) <= SCROLL_DISTANCE) if(qAbs(bottomDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else if(qAbs(topDist) <= SCROLL_DISTANCE) else if(qAbs(topDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else else
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
QTreeWidgetItem* underlyingItem = this->itemAt(event->pos()); QTreeWidgetItem* underlyingItem = this->itemAt(event->pos());
...@@ -461,5 +461,5 @@ bool UBDocumentGroupTreeItem::isDefaultFolder() const ...@@ -461,5 +461,5 @@ bool UBDocumentGroupTreeItem::isDefaultFolder() const
void UBDocumentTreeWidget::autoScroll() void UBDocumentTreeWidget::autoScroll()
{ {
this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude);
} }
...@@ -51,14 +51,14 @@ class UBDocumentTreeWidget : public QTreeWidget ...@@ -51,14 +51,14 @@ class UBDocumentTreeWidget : public QTreeWidget
void itemChangedValidation(QTreeWidgetItem * item, int column); void itemChangedValidation(QTreeWidgetItem * item, int column);
void autoScroll(); void autoScroll();
private: private:
UBDocumentProxyTreeItem *mSelectedProxyTi; UBDocumentProxyTreeItem *mSelectedProxyTi;
QTreeWidgetItem *mDropTargetProxyTi; QTreeWidgetItem *mDropTargetProxyTi;
QBrush mBackground; QBrush mBackground;
QTimer* mScrollTimer; QTimer* mScrollTimer;
int mScrollMagnitude; int mScrollMagnitude;
}; };
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "gui/UBFeaturesWidget.h" #include "gui/UBFeaturesWidget.h"
UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent) UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent)
, featuresController(controller) , featuresController(controller)
, mButtonGroup(NULL) , mButtonGroup(NULL)
, mSearchBar(NULL) , mSearchBar(NULL)
, mLayout(NULL) , mLayout(NULL)
...@@ -46,7 +46,7 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid ...@@ -46,7 +46,7 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
, mpRemoveFavoriteBtn(NULL) , mpRemoveFavoriteBtn(NULL)
, mpNewFolderBtn(NULL) , mpNewFolderBtn(NULL)
{ {
setObjectName(name); setObjectName(name);
setStyleSheet(QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;")); setStyleSheet(QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;"));
setAcceptDrops(true); setAcceptDrops(true);
...@@ -106,8 +106,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid ...@@ -106,8 +106,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/ connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/
connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite())); connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString))); connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString)));
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder())); connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));
connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite())); connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite()));
connect(mpRescanModelAction, SIGNAL(triggered()), this , SLOT(onActionRescanModel())); connect(mpRescanModelAction, SIGNAL(triggered()), this , SLOT(onActionRescanModel()));
connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash())); connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash()));
...@@ -123,33 +123,33 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid ...@@ -123,33 +123,33 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
mLayout->addWidget(mpDeleteBtn); mLayout->addWidget(mpDeleteBtn);
mLayout->addWidget(mpCloseBtn); mLayout->addWidget(mpCloseBtn);
mLayout->addWidget(mpRemoveFavoriteBtn); mLayout->addWidget(mpRemoveFavoriteBtn);
setCurrentState( IN_ROOT ); setCurrentState( IN_ROOT );
mpDeleteBtn->setAcceptDrops(true); mpDeleteBtn->setAcceptDrops(true);
setAcceptDrops( true ); setAcceptDrops( true );
} }
void UBFeaturesActionBar::setCurrentState( UBFeaturesActionBarState state ) void UBFeaturesActionBar::setCurrentState( UBFeaturesActionBarState state )
{ {
currentState = state; currentState = state;
setButtons(); setButtons();
} }
void UBFeaturesActionBar::setButtons() void UBFeaturesActionBar::setButtons()
{ {
switch( currentState ) switch( currentState )
{ {
case IN_FOLDER: case IN_FOLDER:
mpFavoriteBtn->show(); mpFavoriteBtn->show();
mpSocialBtn->hide(); mpSocialBtn->hide();
mSearchBar->show(); mSearchBar->show();
mpDeleteBtn->show(); mpDeleteBtn->show();
mpCloseBtn->hide(); mpCloseBtn->hide();
mpRemoveFavoriteBtn->hide(); mpRemoveFavoriteBtn->hide();
mpNewFolderBtn->show(); mpNewFolderBtn->show();
mpNewFolderBtn->setEnabled(true); mpNewFolderBtn->setEnabled(true);
mpDeleteBtn->setEnabled(true); mpDeleteBtn->setEnabled(true);
// mpRescanModelBtn->show(); // mpRescanModelBtn->show();
break; break;
case IN_ROOT: case IN_ROOT:
mpFavoriteBtn->show(); mpFavoriteBtn->show();
mpSocialBtn->hide(); mpSocialBtn->hide();
...@@ -158,8 +158,8 @@ void UBFeaturesActionBar::setButtons() ...@@ -158,8 +158,8 @@ void UBFeaturesActionBar::setButtons()
mpCloseBtn->hide(); mpCloseBtn->hide();
mpRemoveFavoriteBtn->hide(); mpRemoveFavoriteBtn->hide();
mpNewFolderBtn->show(); mpNewFolderBtn->show();
mpNewFolderBtn->setEnabled(false); mpNewFolderBtn->setEnabled(false);
mpDeleteBtn->setEnabled(false); mpDeleteBtn->setEnabled(false);
// mpRescanModelBtn->show(); // mpRescanModelBtn->show();
break; break;
case IN_PROPERTIES: case IN_PROPERTIES:
...@@ -184,8 +184,8 @@ void UBFeaturesActionBar::setButtons() ...@@ -184,8 +184,8 @@ void UBFeaturesActionBar::setButtons()
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
// mpRescanModelBtn->hide(); // mpRescanModelBtn->hide();
break; break;
case IN_TRASH: case IN_TRASH:
mpFavoriteBtn->hide(); mpFavoriteBtn->hide();
mpSocialBtn->hide(); mpSocialBtn->hide();
mSearchBar->show(); mSearchBar->show();
mpDeleteBtn->show(); mpDeleteBtn->show();
...@@ -196,7 +196,7 @@ void UBFeaturesActionBar::setButtons() ...@@ -196,7 +196,7 @@ void UBFeaturesActionBar::setButtons()
//mpRemoveFavoriteBtn->show(); //mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
// mpRescanModelBtn->hide(); // mpRescanModelBtn->hide();
break; break;
default: default:
break; break;
} }
...@@ -253,7 +253,7 @@ void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event ) ...@@ -253,7 +253,7 @@ void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event )
} }
void UBFeaturesActionBar::dropEvent(QDropEvent *event) void UBFeaturesActionBar::dropEvent(QDropEvent *event)
{ {
const UBFeaturesMimeData *fMimeData = qobject_cast<const UBFeaturesMimeData*>(event->mimeData()); const UBFeaturesMimeData *fMimeData = qobject_cast<const UBFeaturesMimeData*>(event->mimeData());
if (!fMimeData) { if (!fMimeData) {
...@@ -273,22 +273,22 @@ void UBFeaturesActionBar::dropEvent(QDropEvent *event) ...@@ -273,22 +273,22 @@ void UBFeaturesActionBar::dropEvent(QDropEvent *event)
} }
} }
event->setDropAction(Qt::MoveAction); event->setDropAction(Qt::MoveAction);
event->accept(); event->accept();
emit deleteElements(fMimeData); emit deleteElements(fMimeData);
} else if (dest == mpFavoriteBtn) { } else if (dest == mpFavoriteBtn) {
event->setDropAction( Qt::CopyAction); event->setDropAction( Qt::CopyAction);
event->accept(); event->accept();
emit addToFavorite(fMimeData); emit addToFavorite(fMimeData);
} else if (dest == mpRemoveFavoriteBtn) { } else if (dest == mpRemoveFavoriteBtn) {
event->setDropAction( Qt::MoveAction ); event->setDropAction( Qt::MoveAction );
event->accept(); event->accept();
emit removeFromFavorite(fMimeData); emit removeFromFavorite(fMimeData);
} }
} }
UBFeaturesActionBar::~UBFeaturesActionBar() UBFeaturesActionBar::~UBFeaturesActionBar()
......
...@@ -50,26 +50,26 @@ public: ...@@ -50,26 +50,26 @@ public:
enum UBFeaturesActionBarState enum UBFeaturesActionBarState
{ {
IN_ROOT, IN_ROOT,
IN_FOLDER, IN_FOLDER,
IN_PROPERTIES, IN_PROPERTIES,
IN_FAVORITE, IN_FAVORITE,
IN_TRASH IN_TRASH
}; };
class UBFeaturesActionBar : public QWidget class UBFeaturesActionBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesActionBar(UBFeaturesController *controller, QWidget* parent=0, const char* name="UBFeaturesActionBar"); UBFeaturesActionBar(UBFeaturesController *controller, QWidget* parent=0, const char* name="UBFeaturesActionBar");
~UBFeaturesActionBar(); ~UBFeaturesActionBar();
void setCurrentState( UBFeaturesActionBarState state ); void setCurrentState( UBFeaturesActionBarState state );
void cleanText(){ mSearchBar->clear(); } void cleanText(){ mSearchBar->clear(); }
signals: signals:
void searchElement(const QString &text); void searchElement(const QString &text);
void newFolderToCreate(); void newFolderToCreate();
void deleteElements(const UBFeaturesMimeData *data); void deleteElements(const UBFeaturesMimeData *data);
void addToFavorite(const UBFeaturesMimeData *data); void addToFavorite(const UBFeaturesMimeData *data);
void removeFromFavorite(const UBFeaturesMimeData *data); void removeFromFavorite(const UBFeaturesMimeData *data);
...@@ -79,8 +79,8 @@ signals: ...@@ -79,8 +79,8 @@ signals:
void rescanModel(); void rescanModel();
private slots: private slots:
void onSearchTextChanged(QString txt); void onSearchTextChanged(QString txt);
void onActionNewFolder(); void onActionNewFolder();
void onActionFavorite(); void onActionFavorite();
void onActionRemoveFavorite(); void onActionRemoveFavorite();
void onActionTrash(); void onActionTrash();
...@@ -90,17 +90,17 @@ private slots: ...@@ -90,17 +90,17 @@ private slots:
protected: protected:
void dragEnterEvent( QDragEnterEvent *event ); void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event ); void dropEvent( QDropEvent *event );
private: private:
void setButtons(); void setButtons();
UBFeaturesController *featuresController; UBFeaturesController *featuresController;
UBFeaturesActionBarState currentState; UBFeaturesActionBarState currentState;
eButtonSet mCrntButtonSet; eButtonSet mCrntButtonSet;
eButtonSet mPreviousButtonSet; eButtonSet mPreviousButtonSet;
QButtonGroup* mButtonGroup; QButtonGroup* mButtonGroup;
QLineEdit* mSearchBar; QLineEdit* mSearchBar;
QHBoxLayout* mLayout; QHBoxLayout* mLayout;
QAction* mpFavoriteAction; QAction* mpFavoriteAction;
......
...@@ -328,7 +328,7 @@ void UBFeaturesWidget::onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QU ...@@ -328,7 +328,7 @@ void UBFeaturesWidget::onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QU
void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData, QString pTitle) void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData, QString pTitle)
{ {
if (pSuccess) { if (pSuccess) {
qDebug() << pData.length(); qDebug() << pData.length();
controller->addDownloadedFile(sourceUrl, pData, pContentHeader, pTitle); controller->addDownloadedFile(sourceUrl, pData, pContentHeader, pTitle);
controller->refreshModels(); controller->refreshModels();
} }
...@@ -371,20 +371,20 @@ void UBFeaturesWidget::removeElementsFromFavorite() ...@@ -371,20 +371,20 @@ void UBFeaturesWidget::removeElementsFromFavorite()
void UBFeaturesWidget::switchToListView() void UBFeaturesWidget::switchToListView()
{ {
// stackedWidget->setCurrentIndex(ID_LISTVIEW); // stackedWidget->setCurrentIndex(ID_LISTVIEW);
// currentStackedWidget = ID_LISTVIEW; // currentStackedWidget = ID_LISTVIEW;
} }
void UBFeaturesWidget::switchToProperties() void UBFeaturesWidget::switchToProperties()
{ {
// stackedWidget->setCurrentIndex(ID_PROPERTIES); // stackedWidget->setCurrentIndex(ID_PROPERTIES);
// currentStackedWidget = ID_PROPERTIES; // currentStackedWidget = ID_PROPERTIES;
} }
void UBFeaturesWidget::switchToWebView() void UBFeaturesWidget::switchToWebView()
{ {
// stackedWidget->setCurrentIndex(ID_WEBVIEW); // stackedWidget->setCurrentIndex(ID_WEBVIEW);
// currentStackedWidget = ID_WEBVIEW; // currentStackedWidget = ID_WEBVIEW;
} }
QStringList UBFeaturesMimeData::formats() const QStringList UBFeaturesMimeData::formats() const
...@@ -1141,7 +1141,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const ...@@ -1141,7 +1141,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
} else if (role == Qt::UserRole) { } else if (role == Qt::UserRole) {
return featuresList->at(index.row()).getVirtualPath(); return featuresList->at(index.row()).getVirtualPath();
} else if (role == Qt::UserRole + 1) { } else if (role == Qt::UserRole + 1) {
//return featuresList->at(index.row()).getType(); //return featuresList->at(index.row()).getType();
UBFeature f = featuresList->at(index.row()); UBFeature f = featuresList->at(index.row());
return QVariant::fromValue( f ); return QVariant::fromValue( f );
...@@ -1446,12 +1446,12 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde ...@@ -1446,12 +1446,12 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde
{ {
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>(); UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
return feature.isFolder() && path.startsWith( feature.getFullVirtualPath()) ; return feature.isFolder() && path.startsWith( feature.getFullVirtualPath()) ;
} }
QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const
{ {
Q_UNUSED(locale) Q_UNUSED(locale)
...@@ -1473,7 +1473,7 @@ UBFeaturesPathItemDelegate::UBFeaturesPathItemDelegate(QObject *parent) : QStyle ...@@ -1473,7 +1473,7 @@ UBFeaturesPathItemDelegate::UBFeaturesPathItemDelegate(QObject *parent) : QStyle
arrowPixmap = new QPixmap(":images/navig_arrow.png"); arrowPixmap = new QPixmap(":images/navig_arrow.png");
} }
QString UBFeaturesPathItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const QString UBFeaturesPathItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const
{ {
Q_UNUSED(value) Q_UNUSED(value)
Q_UNUSED(locale) Q_UNUSED(locale)
......
...@@ -76,10 +76,10 @@ class UBFeaturesWidget : public UBDockPaletteWidget ...@@ -76,10 +76,10 @@ class UBFeaturesWidget : public UBDockPaletteWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesWidget(QWidget* parent=0, const char* name="UBFeaturesWidget"); UBFeaturesWidget(QWidget* parent=0, const char* name="UBFeaturesWidget");
virtual ~UBFeaturesWidget(); virtual ~UBFeaturesWidget();
bool visibleInMode(eUBDockPaletteWidgetMode mode) bool visibleInMode(eUBDockPaletteWidgetMode mode)
{ {
return mode == eUBDockPaletteWidget_BOARD return mode == eUBDockPaletteWidget_BOARD
|| mode == eUBDockPaletteWidget_DESKTOP; || mode == eUBDockPaletteWidget_DESKTOP;
...@@ -87,9 +87,9 @@ public: ...@@ -87,9 +87,9 @@ public:
UBFeaturesController * getFeaturesController() const { return controller; } UBFeaturesController * getFeaturesController() const { return controller; }
void importImage(const QImage &image, const QString &fileName = QString()); void importImage(const QImage &image, const QString &fileName = QString());
static const int minThumbnailSize = 20; static const int minThumbnailSize = 20;
static const int maxThumbnailSize = 100; static const int maxThumbnailSize = 100;
static const int defaultThumbnailSize = 40; static const int defaultThumbnailSize = 40;
static const char *objNamePathList; static const char *objNamePathList;
static const char *objNameFeatureList; static const char *objNameFeatureList;
...@@ -148,7 +148,7 @@ private: ...@@ -148,7 +148,7 @@ private:
class UBFeaturesListView : public QListView class UBFeaturesListView : public QListView
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" ); UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" );
...@@ -337,7 +337,7 @@ private slots: ...@@ -337,7 +337,7 @@ private slots:
//void onBack(); //void onBack();
private: private:
void populateMetadata(); void populateMetadata();
void adaptSize(); void adaptSize();
QVBoxLayout* mpLayout; QVBoxLayout* mpLayout;
...@@ -363,7 +363,7 @@ public: ...@@ -363,7 +363,7 @@ public:
class UBFeaturesModel : public QAbstractListModel class UBFeaturesModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
signals: signals:
void dataRestructured(); void dataRestructured();
...@@ -372,18 +372,18 @@ public: ...@@ -372,18 +372,18 @@ public:
UBFeaturesModel(QList<UBFeature> *pFeaturesList, QObject *parent = 0) : QAbstractListModel(parent), featuresList(pFeaturesList) {;} UBFeaturesModel(QList<UBFeature> *pFeaturesList, QObject *parent = 0) : QAbstractListModel(parent), featuresList(pFeaturesList) {;}
virtual ~UBFeaturesModel(){;} virtual ~UBFeaturesModel(){;}
void deleteFavoriteItem( const QString &path ); void deleteFavoriteItem( const QString &path );
void deleteItem( const QString &path ); void deleteItem( const QString &path );
void deleteItem(const UBFeature &feature); void deleteItem(const UBFeature &feature);
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
QMimeData *mimeData( const QModelIndexList &indexes ) const; QMimeData *mimeData( const QModelIndexList &indexes ) const;
QStringList mimeTypes() const; QStringList mimeTypes() const;
int rowCount( const QModelIndex &parent ) const; int rowCount( const QModelIndex &parent ) const;
Qt::ItemFlags flags( const QModelIndex &index ) const; Qt::ItemFlags flags( const QModelIndex &index ) const;
bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent); bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent);
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
bool removeRow(int row, const QModelIndex &parent = QModelIndex()); bool removeRow(int row, const QModelIndex &parent = QModelIndex());
//bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); //bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
//bool insertRow(int row, const QModelIndex &parent = QModelIndex()); //bool insertRow(int row, const QModelIndex &parent = QModelIndex());
...@@ -395,69 +395,69 @@ public slots: ...@@ -395,69 +395,69 @@ public slots:
void addItem( const UBFeature &item ); void addItem( const UBFeature &item );
private: private:
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
}; };
class UBFeaturesProxyModel : public QSortFilterProxyModel class UBFeaturesProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} UBFeaturesProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
virtual ~UBFeaturesProxyModel() {} virtual ~UBFeaturesProxyModel() {}
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
}; };
class UBFeaturesSearchProxyModel : public QSortFilterProxyModel class UBFeaturesSearchProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent), mFilterPrefix() {;} UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent), mFilterPrefix() {;}
virtual ~UBFeaturesSearchProxyModel() {} virtual ~UBFeaturesSearchProxyModel() {}
void setFilterPrefix(const QString &newPrefix) {mFilterPrefix = newPrefix;} void setFilterPrefix(const QString &newPrefix) {mFilterPrefix = newPrefix;}
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
private: private:
QString mFilterPrefix; QString mFilterPrefix;
}; };
class UBFeaturesPathProxyModel : public QSortFilterProxyModel class UBFeaturesPathProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesPathProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} UBFeaturesPathProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
virtual ~UBFeaturesPathProxyModel() {} virtual ~UBFeaturesPathProxyModel() {}
void setPath( const QString &p ) { path = p; } void setPath( const QString &p ) { path = p; }
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
private: private:
QString path; QString path;
}; };
class UBFeaturesItemDelegate : public QStyledItemDelegate class UBFeaturesItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesItemDelegate(QObject *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; } UBFeaturesItemDelegate(QObject *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; }
~UBFeaturesItemDelegate() {} ~UBFeaturesItemDelegate() {}
//UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; }; //UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; };
//void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; //void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
//QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual QString displayText ( const QVariant & value, const QLocale & locale ) const; virtual QString displayText ( const QVariant & value, const QLocale & locale ) const;
private: private:
const QListView *listView; const QListView *listView;
}; };
class UBFeaturesPathItemDelegate : public QStyledItemDelegate class UBFeaturesPathItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesPathItemDelegate(QObject *parent = 0); UBFeaturesPathItemDelegate(QObject *parent = 0);
~UBFeaturesPathItemDelegate(); ~UBFeaturesPathItemDelegate();
virtual QString displayText ( const QVariant & value, const QLocale & locale ) const; virtual QString displayText ( const QVariant & value, const QLocale & locale ) const;
void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
private: private:
QPixmap *arrowPixmap; QPixmap *arrowPixmap;
}; };
......
...@@ -284,46 +284,46 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos) ...@@ -284,46 +284,46 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
if(!mCanBeMinimized) if(!mCanBeMinimized)
{ {
// If this floating palette cannot be minimized, we exit this method. // If this floating palette cannot be minimized, we exit this method.
return; return;
} }
if(mMinimizedLocation == eMinimizedLocation_None) if(mMinimizedLocation == eMinimizedLocation_None)
{ {
// Verify if we have to minimize this palette // Verify if we have to minimize this palette
if(pos.x() == 5) if(pos.x() == 5)
{ {
mMinimizedLocation = eMinimizedLocation_Left; mMinimizedLocation = eMinimizedLocation_Left;
} }
// else if(pos.y() == 5) // else if(pos.y() == 5)
// { // {
// mMinimizedLocation = eMinimizedLocation_Top; // mMinimizedLocation = eMinimizedLocation_Top;
// } // }
else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5) else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5)
{ {
mMinimizedLocation = eMinimizedLocation_Right; mMinimizedLocation = eMinimizedLocation_Right;
} }
// else if(pos.y() == parentSize.height() - height() - 5) // else if(pos.y() == parentSize.height() - height() - 5)
// { // {
// mMinimizedLocation = eMinimizedLocation_Bottom; // mMinimizedLocation = eMinimizedLocation_Bottom;
// } // }
// Minimize the Palette // Minimize the Palette
if(mMinimizedLocation != eMinimizedLocation_None) if(mMinimizedLocation != eMinimizedLocation_None)
{ {
emit minimizeStart(mMinimizedLocation); emit minimizeStart(mMinimizedLocation);
} }
} }
else else
{ {
// Restore the palette // Restore the palette
if(pos.x() > 5 && if(pos.x() > 5 &&
pos.y() > 5 && pos.y() > 5 &&
pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 && pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 &&
pos.y() < parentWidget()->size().height() - height() - 5) pos.y() < parentWidget()->size().height() - height() - 5)
{ {
mMinimizedLocation = eMinimizedLocation_None; mMinimizedLocation = eMinimizedLocation_None;
emit maximizeStart(); emit maximizeStart();
} }
} }
} }
......
...@@ -76,10 +76,10 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent) ...@@ -76,10 +76,10 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
createCtrlButtons(); createCtrlButtons();
nCurrentLocale = UBSettings::settings()->KeyboardLocale->get().toInt(); nCurrentLocale = UBSettings::settings()->KeyboardLocale->get().toInt();
if (nCurrentLocale < 0 || nCurrentLocale >= nLocalesCount) if (nCurrentLocale < 0 || nCurrentLocale >= nLocalesCount)
nCurrentLocale = 0; nCurrentLocale = 0;
if (locales!=NULL) if (locales!=NULL)
setInput(locales[nCurrentLocale]); setInput(locales[nCurrentLocale]);
setContentsMargins( 22, 22, 22, 22 ); setContentsMargins( 22, 22, 22, 22 );
...@@ -193,7 +193,7 @@ void UBKeyboardPalette::setLocale(int nLocale) ...@@ -193,7 +193,7 @@ void UBKeyboardPalette::setLocale(int nLocale)
onLocaleChanged(locales[nCurrentLocale]); onLocaleChanged(locales[nCurrentLocale]);
update(); update();
UBSettings::settings()->KeyboardLocale->set(nCurrentLocale); UBSettings::settings()->KeyboardLocale->set(nCurrentLocale);
} }
emit localeChanged(nLocale); emit localeChanged(nLocale);
} }
......
...@@ -34,21 +34,21 @@ ...@@ -34,21 +34,21 @@
void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode) void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode)
{ {
if (keycode.modifier) if (keycode.modifier)
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, true)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, true));
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, true)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, true));
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, false)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, false));
if (keycode.modifier) if (keycode.modifier)
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, false)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, false));
} }
void UBKeyboardButton::sendControlSymbol(int nSymbol) void UBKeyboardButton::sendControlSymbol(int nSymbol)
{ {
CGEventRef event1 = CGEventCreateKeyboardEvent(NULL, nSymbol, true); CGEventRef event1 = CGEventCreateKeyboardEvent(NULL, nSymbol, true);
CGEventRef event2 = CGEventCreateKeyboardEvent(NULL, nSymbol, false); CGEventRef event2 = CGEventCreateKeyboardEvent(NULL, nSymbol, false);
CGEventPost(kCGHIDEventTap, event1); CGEventPost(kCGHIDEventTap, event1);
CGEventPost(kCGHIDEventTap, event2); CGEventPost(kCGHIDEventTap, event2);
} }
void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::createCtrlButtons()
......
...@@ -32,42 +32,42 @@ ...@@ -32,42 +32,42 @@
void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode) void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode)
{ {
INPUT input[2]; INPUT input[2];
input[0].type = INPUT_KEYBOARD; input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = 0; input[0].ki.wVk = 0;
input[0].ki.wScan = keycode.symbol; input[0].ki.wScan = keycode.symbol;
input[0].ki.dwFlags = KEYEVENTF_UNICODE; input[0].ki.dwFlags = KEYEVENTF_UNICODE;
input[0].ki.time = 0; input[0].ki.time = 0;
input[0].ki.dwExtraInfo = 0; input[0].ki.dwExtraInfo = 0;
input[1].type = INPUT_KEYBOARD; input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = 0; input[1].ki.wVk = 0;
input[1].ki.wScan = keycode.symbol; input[1].ki.wScan = keycode.symbol;
input[1].ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; input[1].ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
input[1].ki.time = 0; input[1].ki.time = 0;
input[1].ki.dwExtraInfo = 0; input[1].ki.dwExtraInfo = 0;
::SendInput(2, input, sizeof(input[0])); ::SendInput(2, input, sizeof(input[0]));
} }
void UBKeyboardButton::sendControlSymbol(int nSymbol) void UBKeyboardButton::sendControlSymbol(int nSymbol)
{ {
INPUT input[2]; INPUT input[2];
input[0].type = INPUT_KEYBOARD; input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = nSymbol; input[0].ki.wVk = nSymbol;
input[0].ki.wScan = 0; input[0].ki.wScan = 0;
input[0].ki.dwFlags = 0; input[0].ki.dwFlags = 0;
input[0].ki.time = 0; input[0].ki.time = 0;
input[0].ki.dwExtraInfo = 0; input[0].ki.dwExtraInfo = 0;
input[1].type = INPUT_KEYBOARD; input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = nSymbol; input[1].ki.wVk = nSymbol;
input[1].ki.wScan = 0; input[1].ki.wScan = 0;
input[1].ki.dwFlags = KEYEVENTF_KEYUP; input[1].ki.dwFlags = KEYEVENTF_KEYUP;
input[1].ki.time = 0; input[1].ki.time = 0;
input[1].ki.dwExtraInfo = 0; input[1].ki.dwExtraInfo = 0;
::SendInput(2, input, sizeof(input[0])); ::SendInput(2, input, sizeof(input[0]));
} }
void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::createCtrlButtons()
......
...@@ -63,9 +63,7 @@ UBLeftPalette::~UBLeftPalette() ...@@ -63,9 +63,7 @@ UBLeftPalette::~UBLeftPalette()
void UBLeftPalette::onDocumentSet(UBDocumentProxy* documentProxy) void UBLeftPalette::onDocumentSet(UBDocumentProxy* documentProxy)
{ {
// //This is necessary to force the teacher guide to be showed in priority each time a document is set Q_UNUSED(documentProxy)
// if(documentProxy && UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
// the tab zero is forced // the tab zero is forced
mLastOpenedTabForMode.insert(eUBDockPaletteWidget_BOARD, 0); mLastOpenedTabForMode.insert(eUBDockPaletteWidget_BOARD, 0);
} }
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
* @param name as the object name * @param name as the object name
*/ */
UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name): UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):
UBDockPalette(eUBDockPaletteType_LEFT, parent, name) UBDockPalette(eUBDockPaletteType_LEFT, parent, name)
, mNavigator(NULL) , mNavigator(NULL)
, mLayout(NULL) , mLayout(NULL)
, mHLayout(NULL) , mHLayout(NULL)
, mPageNbr(NULL) , mPageNbr(NULL)
, mClock(NULL) , mClock(NULL)
...@@ -98,13 +98,13 @@ UBNavigatorPalette::~UBNavigatorPalette() ...@@ -98,13 +98,13 @@ UBNavigatorPalette::~UBNavigatorPalette()
} }
if(NULL != mLayout) if(NULL != mLayout)
{ {
delete mLayout; delete mLayout;
mLayout = NULL; mLayout = NULL;
} }
if(NULL != mNavigator) if(NULL != mNavigator)
{ {
delete mNavigator; delete mNavigator;
mNavigator = NULL; mNavigator = NULL;
} }
} }
......
...@@ -58,7 +58,7 @@ class UBResources : public QObject ...@@ -58,7 +58,7 @@ class UBResources : public QObject
QCursor playCursor; QCursor playCursor;
QCursor textCursor; QCursor textCursor;
QCursor rotateCursor; QCursor rotateCursor;
QCursor drawLineRulerCursor; QCursor drawLineRulerCursor;
}; };
#endif /* UBRESOURCES_H_ */ #endif /* UBRESOURCES_H_ */
...@@ -39,17 +39,17 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name): ...@@ -39,17 +39,17 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):
mCollapseWidth = 150; mCollapseWidth = 150;
bool isCollapsed = false; bool isCollapsed = false;
if(mCurrentMode == eUBDockPaletteWidget_BOARD){ if(mCurrentMode == eUBDockPaletteWidget_BOARD){
mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt();
isCollapsed = UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool(); isCollapsed = UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool();
} }
else{ else{
mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt();
isCollapsed = UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool(); isCollapsed = UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool();
} }
if(isCollapsed) if(isCollapsed)
resize(0,parentWidget()->height()); resize(0,parentWidget()->height());
else else
resize(mLastWidth, parentWidget()->height()); resize(mLastWidth, parentWidget()->height());
} }
/** /**
...@@ -77,18 +77,18 @@ void UBRightPalette::mouseMoveEvent(QMouseEvent *event) ...@@ -77,18 +77,18 @@ void UBRightPalette::mouseMoveEvent(QMouseEvent *event)
*/ */
void UBRightPalette::resizeEvent(QResizeEvent *event) void UBRightPalette::resizeEvent(QResizeEvent *event)
{ {
int newWidth = width(); int newWidth = width();
if(mCurrentMode == eUBDockPaletteWidget_BOARD){ if(mCurrentMode == eUBDockPaletteWidget_BOARD){
if(newWidth > mCollapseWidth) if(newWidth > mCollapseWidth)
UBSettings::settings()->rightLibPaletteBoardModeWidth->set(newWidth); UBSettings::settings()->rightLibPaletteBoardModeWidth->set(newWidth);
UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->set(newWidth == 0); UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->set(newWidth == 0);
} }
else{ else{
if(newWidth > mCollapseWidth) if(newWidth > mCollapseWidth)
UBSettings::settings()->rightLibPaletteDesktopModeWidth->set(newWidth); UBSettings::settings()->rightLibPaletteDesktopModeWidth->set(newWidth);
UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->set(newWidth == 0); UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->set(newWidth == 0);
} }
UBDockPalette::resizeEvent(event); UBDockPalette::resizeEvent(event);
emit resized(); emit resized();
} }
...@@ -104,19 +104,19 @@ void UBRightPalette::updateMaxWidth() ...@@ -104,19 +104,19 @@ void UBRightPalette::updateMaxWidth()
bool UBRightPalette::switchMode(eUBDockPaletteWidgetMode mode) bool UBRightPalette::switchMode(eUBDockPaletteWidgetMode mode)
{ {
int newModeWidth; int newModeWidth;
if(mode == eUBDockPaletteWidget_BOARD){ if(mode == eUBDockPaletteWidget_BOARD){
mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt();
newModeWidth = mLastWidth; newModeWidth = mLastWidth;
if(UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool()) if(UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool())
newModeWidth = 0; newModeWidth = 0;
} }
else{ else{
mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt();
newModeWidth = mLastWidth; newModeWidth = mLastWidth;
if(UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool()) if(UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool())
newModeWidth = 0; newModeWidth = 0;
} }
resize(newModeWidth,height()); resize(newModeWidth,height());
return UBDockPalette::switchMode(mode); return UBDockPalette::switchMode(mode);
} }
...@@ -932,7 +932,7 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes() ...@@ -932,7 +932,7 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes()
QStringList licences; QStringList licences;
licences << tr("Attribution-ShareAlike CC BY-SA") licences << tr("Attribution-ShareAlike CC BY-SA")
<< tr("Attribution CC BY") << tr("Attribution CC BY")
<< tr("Attribution-NoDerivs CC BY-ND") << tr("Attribution-NoDerivs CC BY-ND")
<< tr("Attribution-NonCommercial CC BY-NC") << tr("Attribution-NonCommercial CC BY-NC")
<< tr("Attribution-NonCommercial-NoDerivs CC BY-NC-ND") << tr("Attribution-NonCommercial-NoDerivs CC BY-NC-ND")
<< tr("Attribution-NonCommercial-ShareAlike CC BY-NC-SA") << tr("Attribution-NonCommercial-ShareAlike CC BY-NC-SA")
...@@ -1168,8 +1168,8 @@ bool UBTeacherGuidePageZeroWidget::isModified() ...@@ -1168,8 +1168,8 @@ bool UBTeacherGuidePageZeroWidget::isModified()
void UBTeacherGuidePageZeroWidget::resizeEvent(QResizeEvent* ev) void UBTeacherGuidePageZeroWidget::resizeEvent(QResizeEvent* ev)
{ {
emit resized(); emit resized();
QWidget::resizeEvent(ev); QWidget::resizeEvent(ev);
} }
/*************************************************************************** /***************************************************************************
...@@ -1209,54 +1209,54 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget() ...@@ -1209,54 +1209,54 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget()
void UBTeacherGuideWidget::onActiveSceneChanged() void UBTeacherGuideWidget::onActiveSceneChanged()
{ {
if (UBApplication::boardController->currentPage() == 0) { if (UBApplication::boardController->currentPage() == 0) {
if(mpPageZeroWidget->isModified()) if(mpPageZeroWidget->isModified())
mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION); mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION);
else else
mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_EDITION); mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_EDITION);
setCurrentWidget(mpPageZeroWidget); setCurrentWidget(mpPageZeroWidget);
} }
else{ else{
if(mpEditionWidget->isModified()){ if(mpEditionWidget->isModified()){
mCurrentData = mpEditionWidget->getData(); mCurrentData = mpEditionWidget->getData();
mpPresentationWidget->showData(mCurrentData); mpPresentationWidget->showData(mCurrentData);
setCurrentWidget(mpPresentationWidget); setCurrentWidget(mpPresentationWidget);
} }
else else
setCurrentWidget(mpEditionWidget); setCurrentWidget(mpEditionWidget);
} }
} }
void UBTeacherGuideWidget::onTriggeredAction(bool checked) void UBTeacherGuideWidget::onTriggeredAction(bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
if(!mKeyboardActionFired) if(!mKeyboardActionFired)
showPresentationMode(); showPresentationMode();
mKeyboardActionFired=false; mKeyboardActionFired=false;
} }
void UBTeacherGuideWidget::onTriggeredKeyboardAction(bool checked) void UBTeacherGuideWidget::onTriggeredKeyboardAction(bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
mKeyboardActionFired = true; mKeyboardActionFired = true;
} }
void UBTeacherGuideWidget::connectToStylusPalette() void UBTeacherGuideWidget::connectToStylusPalette()
{ {
connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(onTriggeredKeyboardAction(bool))); connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(onTriggeredKeyboardAction(bool)));
} }
void UBTeacherGuideWidget::showPresentationMode() void UBTeacherGuideWidget::showPresentationMode()
......
...@@ -147,7 +147,7 @@ public: ...@@ -147,7 +147,7 @@ public:
bool isModified(); bool isModified();
signals: signals:
void resized(); void resized();
public slots: public slots:
void onActiveSceneChanged(); void onActiveSceneChanged();
...@@ -245,8 +245,8 @@ private: ...@@ -245,8 +245,8 @@ private:
bool mKeyboardActionFired; bool mKeyboardActionFired;
private slots: private slots:
void onTriggeredAction(bool checked); void onTriggeredAction(bool checked);
void onTriggeredKeyboardAction(bool checked); void onTriggeredKeyboardAction(bool checked);
}; };
#endif // UBTEACHERGUIDEWIDGET_H #endif // UBTEACHERGUIDEWIDGET_H
...@@ -173,11 +173,11 @@ void UBTGAdaptableText::showEvent(QShowEvent* e) ...@@ -173,11 +173,11 @@ void UBTGAdaptableText::showEvent(QShowEvent* e)
{ {
Q_UNUSED(e); Q_UNUSED(e);
if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){ if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){
setTextColor(QColor(Qt::lightGray)); setTextColor(QColor(Qt::lightGray));
setPlainText(mPlaceHolderText); setPlainText(mPlaceHolderText);
} }
else else
// If the teacherguide is collapsed, don't updated the size. Or set the size as the expanded size // If the teacherguide is collapsed, don't updated the size. Or set the size as the expanded size
onTextChanged(); onTextChanged();
} }
...@@ -194,16 +194,16 @@ void UBTGAdaptableText::onTextChanged() ...@@ -194,16 +194,16 @@ void UBTGAdaptableText::onTextChanged()
{ {
qreal documentSize = document()->size().height(); qreal documentSize = document()->size().height();
if(height() == documentSize + mBottomMargin){ if(height() == documentSize + mBottomMargin){
return; return;
} }
mIsUpdatingSize = true; mIsUpdatingSize = true;
if(documentSize < mMinimumHeight){ if(documentSize < mMinimumHeight){
setFixedHeight(mMinimumHeight); setFixedHeight(mMinimumHeight);
} }
else{ else{
setFixedHeight(documentSize+mBottomMargin); setFixedHeight(documentSize+mBottomMargin);
} }
updateGeometry(); updateGeometry();
...@@ -239,45 +239,45 @@ void UBTGAdaptableText::bottomMargin(int newValue) ...@@ -239,45 +239,45 @@ void UBTGAdaptableText::bottomMargin(int newValue)
void UBTGAdaptableText::focusInEvent(QFocusEvent* e) void UBTGAdaptableText::focusInEvent(QFocusEvent* e)
{ {
if(isReadOnly()){ if(isReadOnly()){
e->ignore(); e->ignore();
} }
managePlaceholder(true); managePlaceholder(true);
QTextEdit::focusInEvent(e); QTextEdit::focusInEvent(e);
} }
void UBTGAdaptableText::focusOutEvent(QFocusEvent* e) void UBTGAdaptableText::focusOutEvent(QFocusEvent* e)
{ {
managePlaceholder(false); managePlaceholder(false);
QTextEdit::focusOutEvent(e); QTextEdit::focusOutEvent(e);
} }
void UBTGAdaptableText::managePlaceholder(bool focus) void UBTGAdaptableText::managePlaceholder(bool focus)
{ {
if(focus){ if(focus){
if(toPlainText() == mPlaceHolderText){ if(toPlainText() == mPlaceHolderText){
setTextColor(QColor(Qt::black)); setTextColor(QColor(Qt::black));
setPlainText(""); setPlainText("");
} }
setCursorToTheEnd(); setCursorToTheEnd();
} }
else{ else{
if(toPlainText().isEmpty()){ if(toPlainText().isEmpty()){
setTextColor(QColor(Qt::lightGray)); setTextColor(QColor(Qt::lightGray));
setPlainText(mPlaceHolderText); setPlainText(mPlaceHolderText);
} }
} }
} }
void UBTGAdaptableText::setCursorToTheEnd() void UBTGAdaptableText::setCursorToTheEnd()
{ {
QTextDocument* doc = document(); QTextDocument* doc = document();
if(NULL != doc){ if(NULL != doc){
QTextBlock block = doc->lastBlock(); QTextBlock block = doc->lastBlock();
QTextCursor cursor(doc); QTextCursor cursor(doc);
cursor.setPosition(block.position() + block.length() - 1); cursor.setPosition(block.position() + block.length() - 1);
setTextCursor(cursor); setTextCursor(cursor);
} }
} }
/*************************************************************************** /***************************************************************************
...@@ -288,10 +288,10 @@ UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView ...@@ -288,10 +288,10 @@ UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView
, mDragStarted(false) , mDragStarted(false)
{ {
if(!relativePath.startsWith("file://")) if(!relativePath.startsWith("file://"))
mRelativePath = QUrl::fromLocalFile(relativePath).toString(); mRelativePath = QUrl::fromLocalFile(relativePath).toString();
else else
mRelativePath = relativePath; mRelativePath = relativePath;
//NOOP //NOOP
} }
...@@ -438,7 +438,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData() ...@@ -438,7 +438,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData()
tUBGEElementNode* result = new tUBGEElementNode(); tUBGEElementNode* result = new tUBGEElementNode();
QString relativePath = mMediaPath; QString relativePath = mMediaPath;
relativePath = relativePath.replace(UBApplication::boardController->selectedDocument()->persistencePath()+"/",""); relativePath = relativePath.replace(UBApplication::boardController->selectedDocument()->persistencePath()+"/","");
result->name = "media"; result->name = "media";
result->attributes.insert("title",mpTitle->text()); result->attributes.insert("title",mpTitle->text());
result->attributes.insert("relativePath",relativePath); result->attributes.insert("relativePath",relativePath);
result->attributes.insert("mediaType",mMediaType); result->attributes.insert("mediaType",mMediaType);
...@@ -598,7 +598,7 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event) ...@@ -598,7 +598,7 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
QMimeData *mimeData = new QMimeData(); QMimeData *mimeData = new QMimeData();
QList<QUrl> urlList; QList<QUrl> urlList;
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
urlList << QUrl::fromLocalFile(mMediaPath); urlList << QUrl::fromLocalFile(mMediaPath);
#else #else
urlList << QUrl(mMediaPath); urlList << QUrl(mMediaPath);
#endif #endif
...@@ -644,11 +644,11 @@ UBTGUrlWidget::~UBTGUrlWidget() ...@@ -644,11 +644,11 @@ UBTGUrlWidget::~UBTGUrlWidget()
void UBTGUrlWidget::onUrlEditionFinished() void UBTGUrlWidget::onUrlEditionFinished()
{ {
QString url = mpUrl->text(); QString url = mpUrl->text();
if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){ if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){
mpUrl->setText("http://" + mpUrl->text()); mpUrl->setText("http://" + mpUrl->text());
setFocus(); setFocus();
} }
} }
void UBTGUrlWidget::initializeWithDom(QDomElement element) void UBTGUrlWidget::initializeWithDom(QDomElement element)
......
...@@ -224,11 +224,11 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event) ...@@ -224,11 +224,11 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
return; return;
} }
//if(sceneItem){ //if(sceneItem){
// int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); // int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex());
// if(pageIndex == 0){ // if(pageIndex == 0){
// event->ignore(); // event->ignore();
// return; // return;
// } // }
//} //}
mMousePressScenePos = mapToScene(mMousePressPos); mMousePressScenePos = mapToScene(mMousePressPos);
...@@ -846,15 +846,15 @@ void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *even ...@@ -846,15 +846,15 @@ void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *even
void UBSceneThumbnailNavigPixmap::updateButtonsState() void UBSceneThumbnailNavigPixmap::updateButtonsState()
{ {
bCanDelete = false; bCanDelete = false;
bCanMoveUp = false; bCanMoveUp = false;
bCanMoveDown = false; bCanMoveDown = false;
bCanDuplicate = false; bCanDuplicate = false;
if(proxy()){ if(proxy()){
int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneIndex()); int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneIndex());
UBDocumentController* documentController = UBApplication::documentController; UBDocumentController* documentController = UBApplication::documentController;
bCanDelete = documentController->pageCanBeDeleted(pageIndex); bCanDelete = documentController->pageCanBeDeleted(pageIndex);
bCanMoveUp = documentController->pageCanBeMovedUp(pageIndex); bCanMoveUp = documentController->pageCanBeMovedUp(pageIndex);
bCanMoveDown = documentController->pageCanBeMovedDown(pageIndex); bCanMoveDown = documentController->pageCanBeMovedDown(pageIndex);
bCanDuplicate = documentController->pageCanBeDuplicated(pageIndex); bCanDuplicate = documentController->pageCanBeDuplicated(pageIndex);
...@@ -866,14 +866,14 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() ...@@ -866,14 +866,14 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
void UBSceneThumbnailNavigPixmap::deletePage() void UBSceneThumbnailNavigPixmap::deletePage()
{ {
if(UBApplication::mainWindow->yesNoQuestion(QObject::tr("Remove Page"), QObject::tr("Are you sure you want to remove 1 page from the selected document '%0'?").arg(UBApplication::documentController->selectedDocument()->metaData(UBSettings::documentName).toString()))){ if(UBApplication::mainWindow->yesNoQuestion(QObject::tr("Remove Page"), QObject::tr("Are you sure you want to remove 1 page from the selected document '%0'?").arg(UBApplication::documentController->selectedDocument()->metaData(UBSettings::documentName).toString()))){
UBApplication::boardController->deleteScene(sceneIndex()); UBApplication::boardController->deleteScene(sceneIndex());
} }
} }
void UBSceneThumbnailNavigPixmap::duplicatePage() void UBSceneThumbnailNavigPixmap::duplicatePage()
{ {
UBApplication::boardController->duplicateScene(sceneIndex()); UBApplication::boardController->duplicateScene(sceneIndex());
} }
void UBSceneThumbnailNavigPixmap::moveUpPage() void UBSceneThumbnailNavigPixmap::moveUpPage()
...@@ -891,17 +891,17 @@ void UBSceneThumbnailNavigPixmap::moveDownPage() ...@@ -891,17 +891,17 @@ void UBSceneThumbnailNavigPixmap::moveDownPage()
void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal height) void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal height)
{ {
int labelSpacing = 0; int labelSpacing = 0;
if(this->caption) if(this->caption)
{ {
QFontMetrics fm(this->caption->font()); QFontMetrics fm(this->caption->font());
labelSpacing = UBSettings::thumbnailSpacing + fm.height(); labelSpacing = UBSettings::thumbnailSpacing + fm.height();
} }
if(this->thumbnail) if(this->thumbnail)
{ {
int w = this->thumbnail->boundingRect().width(); int w = this->thumbnail->boundingRect().width();
int h = this->thumbnail->boundingRect().height(); int h = this->thumbnail->boundingRect().height();
qreal scaleWidth = width / w; qreal scaleWidth = width / w;
qreal scaleHeight = height / h; qreal scaleHeight = height / h;
qreal scaleFactor = qMin(scaleWidth, scaleHeight); qreal scaleFactor = qMin(scaleWidth, scaleHeight);
UBThumbnail* pix = dynamic_cast<UBThumbnail*>(this->thumbnail); UBThumbnail* pix = dynamic_cast<UBThumbnail*>(this->thumbnail);
...@@ -924,8 +924,8 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh ...@@ -924,8 +924,8 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh
this->thumbnail->setPos(pos); this->thumbnail->setPos(pos);
if(this->caption) if(this->caption)
{ {
QFontMetrics fm(this->caption->font()); QFontMetrics fm(this->caption->font());
QString elidedText = fm.elidedText(this->caption->toPlainText(), Qt::ElideRight, width); QString elidedText = fm.elidedText(this->caption->toPlainText(), Qt::ElideRight, width);
...@@ -935,6 +935,6 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh ...@@ -935,6 +935,6 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh
qreal labelWidth = fm.width(elidedText); qreal labelWidth = fm.width(elidedText);
pos.setX(border + (width - labelWidth) / 2 + col * (width + border)); pos.setX(border + (width - labelWidth) / 2 + col * (width + border));
this->caption->setPos(pos); this->caption->setPos(pos);
} }
} }
} }
...@@ -408,27 +408,27 @@ class UBThumbnailTextItem : public QGraphicsTextItem ...@@ -408,27 +408,27 @@ class UBThumbnailTextItem : public QGraphicsTextItem
class UBImgTextThumbnailElement class UBImgTextThumbnailElement
{ {
private: private:
UBSceneThumbnailNavigPixmap* thumbnail; UBSceneThumbnailNavigPixmap* thumbnail;
UBThumbnailTextItem* caption; UBThumbnailTextItem* caption;
int border; int border;
public: public:
UBImgTextThumbnailElement(UBSceneThumbnailNavigPixmap* thumb, UBThumbnailTextItem* text): border(0) UBImgTextThumbnailElement(UBSceneThumbnailNavigPixmap* thumb, UBThumbnailTextItem* text): border(0)
{ {
this->thumbnail = thumb; this->thumbnail = thumb;
this->caption = text; this->caption = text;
} }
UBSceneThumbnailNavigPixmap* getThumbnail() const { return this->thumbnail; } UBSceneThumbnailNavigPixmap* getThumbnail() const { return this->thumbnail; }
void setThumbnail(UBSceneThumbnailNavigPixmap* newGItem) { this->thumbnail = newGItem; } void setThumbnail(UBSceneThumbnailNavigPixmap* newGItem) { this->thumbnail = newGItem; }
UBThumbnailTextItem* getCaption() const { return this->caption; } UBThumbnailTextItem* getCaption() const { return this->caption; }
void setCaption(UBThumbnailTextItem* newcaption) { this->caption = newcaption; } void setCaption(UBThumbnailTextItem* newcaption) { this->caption = newcaption; }
void Place(int row, int col, qreal width, qreal height); void Place(int row, int col, qreal width, qreal height);
int getBorder() const { return this->border; } int getBorder() const { return this->border; }
void setBorder(int newBorder) { this->border = newBorder; } void setBorder(int newBorder) { this->border = newBorder; }
}; };
......
...@@ -36,7 +36,7 @@ class UBNetworkAccessManager : public QNetworkAccessManager ...@@ -36,7 +36,7 @@ class UBNetworkAccessManager : public QNetworkAccessManager
UBNetworkAccessManager(QObject *parent = 0); UBNetworkAccessManager(QObject *parent = 0);
virtual QNetworkReply *get(const QNetworkRequest &request); virtual QNetworkReply *get(const QNetworkRequest &request);
protected: protected:
virtual QNetworkReply * createRequest ( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 ); virtual QNetworkReply * createRequest ( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 );
......
...@@ -43,7 +43,7 @@ namespace merge_lib ...@@ -43,7 +43,7 @@ namespace merge_lib
protected: protected:
void _retrieveBoxFromParent() void _retrieveBoxFromParent()
{ {
std::string content = _page->getObjectContent(); std::string content = _page->getObjectContent();
std::string mediaBox; std::string mediaBox;
Object * parent = _page; Object * parent = _page;
...@@ -72,8 +72,8 @@ namespace merge_lib ...@@ -72,8 +72,8 @@ namespace merge_lib
{ {
unsigned int startOfMediaBox = _page->getObjectContent().rfind(">>"); unsigned int startOfMediaBox = _page->getObjectContent().rfind(">>");
_page->insertToContent(startOfMediaBox, mediaBox); _page->insertToContent(startOfMediaBox, mediaBox);
_changeObjectContent(startOfMediaBox); _changeObjectContent(startOfMediaBox);
} }
} }
private: private:
virtual void _changeObjectContent(unsigned int startOfPageElement) = 0; virtual void _changeObjectContent(unsigned int startOfPageElement) = 0;
......
...@@ -65,7 +65,7 @@ namespace merge_lib ...@@ -65,7 +65,7 @@ namespace merge_lib
_page->insertToContent(startOfPageElement, matrix.str()); _page->insertToContent(startOfPageElement, matrix.str());
} }
void _pageElementNotFound() void _pageElementNotFound()
{ {
_retrieveBoxFromParent(); _retrieveBoxFromParent();
} }
}; };
......
...@@ -114,7 +114,7 @@ void Document::saveAs(const char * newFileName) ...@@ -114,7 +114,7 @@ void Document::saveAs(const char * newFileName)
for ( sizeIterator = sizesAndGenerationNumbers.begin() ; sizeIterator != sizesAndGenerationNumbers.end(); sizeIterator++ ) for ( sizeIterator = sizesAndGenerationNumbers.begin() ; sizeIterator != sizesAndGenerationNumbers.end(); sizeIterator++ )
{ {
out << std::setfill('0')<<std::setw(10)<<sizeInXref << " " << std::setw(5) << (*sizeIterator).second.second << " n \n"; out << std::setfill('0')<<std::setw(10)<<sizeInXref << " " << std::setw(5) << (*sizeIterator).second.second << " n \n";
sizeInXref = sizeInXref + (*sizeIterator).second.first; sizeInXref = sizeInXref + (*sizeIterator).second.first;
} }
out << "trailer\n<<\n/Size " << numberOfObjects << "\n/Info 1 0 R\n" out << "trailer\n<<\n/Size " << numberOfObjects << "\n/Info 1 0 R\n"
<< "/Root " << _root->getObjectNumber() << " 0 R\n >>\nstartxref\n" << sizeInXref << "\n%%EOF"; << "/Root " << _root->getObjectNumber() << " 0 R\n >>\nstartxref\n" << sizeInXref << "\n%%EOF";
......
...@@ -120,7 +120,7 @@ bool LZWDecode::decode(std::string & encoded) ...@@ -120,7 +120,7 @@ bool LZWDecode::decode(std::string & encoded)
// LZW decoding // LZW decoding
std::string decoded; std::string decoded;
struct DecodingTable struct DecodingTable
{ {
int length; int length;
int head; int head;
unsigned tail; unsigned tail;
...@@ -128,7 +128,7 @@ bool LZWDecode::decode(std::string & encoded) ...@@ -128,7 +128,7 @@ bool LZWDecode::decode(std::string & encoded)
int prevCode = 0; int prevCode = 0;
int newChar = 0; int newChar = 0;
unsigned curSequence[4097]; unsigned curSequence[4097];
int nextLength = 0; int nextLength = 0;
clearTable(); clearTable();
...@@ -219,7 +219,7 @@ bool LZWDecode::decode(std::string & encoded) ...@@ -219,7 +219,7 @@ bool LZWDecode::decode(std::string & encoded)
{ {
_predict->decode(encoded); _predict->decode(encoded);
} }
return true; return true;
} }
......
...@@ -50,12 +50,12 @@ namespace merge_lib ...@@ -50,12 +50,12 @@ namespace merge_lib
std::string &_encoded; std::string &_encoded;
size_t _curSymbolIndex; size_t _curSymbolIndex;
int _earlyChange; // early parameter int _earlyChange; // early parameter
int _readBuf; int _readBuf;
int _readBits; int _readBits;
int _nextCode; int _nextCode;
int _bitsToRead; int _bitsToRead;
bool _first; bool _first;
int _curSequenceLength; int _curSequenceLength;
}; };
} }
......
...@@ -49,7 +49,7 @@ namespace merge_lib ...@@ -49,7 +49,7 @@ namespace merge_lib
{ {
if(_wasCropBoxHandlerCalled()) if(_wasCropBoxHandlerCalled())
{ {
PageElementHandler * tempNextHandler = _nextHandler; PageElementHandler * tempNextHandler = _nextHandler;
_nextHandler = new RemoveHimselfHandler(_page, _handlerName); _nextHandler = new RemoveHimselfHandler(_page, _handlerName);
_nextHandler->addNextHandler(tempNextHandler); _nextHandler->addNextHandler(tempNextHandler);
return; return;
...@@ -61,7 +61,7 @@ namespace merge_lib ...@@ -61,7 +61,7 @@ namespace merge_lib
_page->insertToContent(startOfPageElement, matrix); _page->insertToContent(startOfPageElement, matrix);
} }
void _pageElementNotFound() void _pageElementNotFound()
{ {
if(_wasCropBoxHandlerCalled()) if(_wasCropBoxHandlerCalled())
return; return;
_retrieveBoxFromParent(); _retrieveBoxFromParent();
......
...@@ -36,7 +36,7 @@ std::string NUMBERANDWHITESPACE(" 0123456789"); ...@@ -36,7 +36,7 @@ std::string NUMBERANDWHITESPACE(" 0123456789");
Object::~Object() Object::~Object()
{ {
_parents.clear(); _parents.clear();
_children.clear(); _children.clear();
_content.clear(); _content.clear();
...@@ -107,8 +107,8 @@ void Object::forgetAboutChildren(unsigned int leftBound, unsigned int rightBound ...@@ -107,8 +107,8 @@ void Object::forgetAboutChildren(unsigned int leftBound, unsigned int rightBound
{ {
std::vector<Object *> children = getChildrenByBounds(leftBound, rightBound); std::vector<Object *> children = getChildrenByBounds(leftBound, rightBound);
for(size_t i = 0; i < children.size(); ++i) for(size_t i = 0; i < children.size(); ++i)
{ {
_children.erase(_children.find(children[i]->getObjectNumber())); _children.erase(_children.find(children[i]->getObjectNumber()));
} }
} }
...@@ -250,9 +250,9 @@ void Object::insertToContent(unsigned int position, const std::string & inserted ...@@ -250,9 +250,9 @@ void Object::insertToContent(unsigned int position, const std::string & inserted
} }
void Object::insertToContent(unsigned int position, const char * insertedStr, unsigned int length) void Object::insertToContent(unsigned int position, const char * insertedStr, unsigned int length)
{ {
_recalculateReferencePositions(position, length); _recalculateReferencePositions(position, length);
_content.insert(position, insertedStr, length); _content.insert(position, insertedStr, length);
} }
//vector <object number, its size> //vector <object number, its size>
...@@ -263,9 +263,9 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair<un ...@@ -263,9 +263,9 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair<un
std::string stream; std::string stream;
if(_hasStream && !_hasStreamInContent) if(_hasStream && !_hasStreamInContent)
{ {
getStream(stream); getStream(stream);
stream.append("endstream\n"); stream.append("endstream\n");
} }
// xxxx + " " + "0" + " " + "obj" + "\n" + _content.size() + "endobj\n", where x - is a digit // xxxx + " " + "0" + " " + "obj" + "\n" + _content.size() + "endobj\n", where x - is a digit
unsigned long long objectSizeForXref = (static_cast<unsigned int>(std::log10(static_cast<double>(_number))) + 1) + 14 + _content.size() + stream.size(); unsigned long long objectSizeForXref = (static_cast<unsigned int>(std::log10(static_cast<double>(_number))) + 1) + 14 + _content.size() + stream.size();
...@@ -285,13 +285,13 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair<un ...@@ -285,13 +285,13 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair<un
} }
} }
void Object::recalculateObjectNumbers(unsigned int & newNumber) void Object::recalculateObjectNumbers(unsigned int & newNumber)
{ {
_recalculateObjectNumbers(newNumber); _recalculateObjectNumbers(newNumber);
resetIsPassed(); resetIsPassed();
} }
void Object::_recalculateObjectNumbers(unsigned int & newNumber) void Object::_recalculateObjectNumbers(unsigned int & newNumber)
{ {
_setObjectNumber(newNumber); _setObjectNumber(newNumber);
Children::iterator childIterator; Children::iterator childIterator;
...@@ -396,7 +396,7 @@ bool Object::findObject(const std::string & token, Object* & foundObject, unsign ...@@ -396,7 +396,7 @@ bool Object::findObject(const std::string & token, Object* & foundObject, unsign
bool result = _findObject(token, foundObject, tokenPositionInContent); bool result = _findObject(token, foundObject, tokenPositionInContent);
resetIsPassed(); resetIsPassed();
if(result) if(result)
{ {
return true; return true;
} }
return false; return false;
...@@ -425,7 +425,7 @@ void Object::_addParent(Object * child) ...@@ -425,7 +425,7 @@ void Object::_addParent(Object * child)
} }
void Object::_serialize(std::ofstream & out, const std::string & stream) void Object::_serialize(std::ofstream & out, const std::string & stream)
{ {
out << _number << " " << _generationNumber << " obj\n" << _content << stream << "endobj\n"; out << _number << " " << _generationNumber << " obj\n" << _content << stream << "endobj\n";
out.flush(); out.flush();
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -184,7 +184,7 @@ void Parser::_createObjectTree(const char * fileName) ...@@ -184,7 +184,7 @@ void Parser::_createObjectTree(const char * fileName)
for(; refsIterator != refs.end(); ++refsIterator) for(; refsIterator != refs.end(); ++refsIterator)
{ {
if(_objects.count((*refsIterator).first)) if(_objects.count((*refsIterator).first))
currentObject->addChild(_objects[(*refsIterator).first], (*refsIterator).second); currentObject->addChild(_objects[(*refsIterator).first], (*refsIterator).second);
} }
} }
_root = _objects[rootObjectNumber]; _root = _objects[rootObjectNumber];
......
This diff is collapsed.
This diff is collapsed.
...@@ -39,7 +39,7 @@ namespace merge_lib ...@@ -39,7 +39,7 @@ namespace merge_lib
PageElementHandler(page), PageElementHandler(page),
_basePage(basePage) _basePage(basePage)
{ {
_setHandlerName(handlerName); _setHandlerName(handlerName);
} }
virtual ~RotationHandler() virtual ~RotationHandler()
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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