From b2628d12b823e735abab1c50b563b58482c21b03 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 19 Feb 2013 10:12:33 +0100 Subject: [PATCH] removed tab --- src/adaptors/UBExportFullPDF.cpp | 18 +- src/adaptors/UBExportPDF.cpp | 24 +- src/adaptors/UBImportDocument.cpp | 12 +- src/adaptors/UBImportPDF.cpp | 4 +- src/adaptors/UBImportPDF.h | 4 +- src/adaptors/UBSvgSubsetAdaptor.cpp | 8 +- src/adaptors/UBThumbnailAdaptor.h | 2 +- src/api/UBWidgetUniboardAPI.cpp | 2 +- src/board/UBBoardView.h | 6 +- src/board/UBDrawingController.cpp | 4 +- src/board/UBDrawingController.h | 4 +- src/board/UBFeaturesController.cpp | 136 +-- src/board/UBFeaturesController.h | 78 +- src/core/UB.h | 38 +- src/core/UBApplication.cpp | 32 +- src/core/UBApplication.h | 2 +- src/core/UBApplicationController.cpp | 28 +- src/core/UBPersistenceManager.cpp | 4 +- src/core/UBSetting.h | 2 +- src/customWidgets/UBMediaWidget.cpp | 30 +- src/desktop/UBDesktopAnnotationController.cpp | 12 +- src/desktop/UBDesktopPalette.h | 2 +- src/document/UBDocumentContainer.cpp | 4 +- src/document/UBDocumentController.cpp | 60 +- src/domain/UBGraphicsGroupContainerItem.cpp | 2 +- src/domain/UBGraphicsPolygonItem.cpp | 6 +- src/domain/UBGraphicsScene.h | 2 +- src/domain/UBGraphicsStrokesGroup.cpp | 28 +- src/frameworks/UBPlatformUtils.cpp | 22 +- src/frameworks/UBPlatformUtils.h | 58 +- src/frameworks/UBPlatformUtils_linux.cpp | 106 +-- src/frameworks/UBPlatformUtils_win.cpp | 518 +++++------ src/gui/UBDockPalette.cpp | 856 +++++++++--------- src/gui/UBDockPalette.h | 2 +- src/gui/UBDockTeacherGuideWidget.cpp | 2 +- src/gui/UBDocumentNavigator.cpp | 42 +- src/gui/UBDocumentNavigator.h | 6 +- src/gui/UBDocumentThumbnailWidget.cpp | 104 +-- src/gui/UBDocumentThumbnailWidget.h | 8 +- src/gui/UBDocumentTreeWidget.cpp | 48 +- src/gui/UBDocumentTreeWidget.h | 6 +- src/gui/UBFeaturesActionBar.cpp | 50 +- src/gui/UBFeaturesActionBar.h | 38 +- src/gui/UBFeaturesWidget.cpp | 22 +- src/gui/UBFeaturesWidget.h | 68 +- src/gui/UBFloatingPalette.cpp | 60 +- src/gui/UBKeyboardPalette.cpp | 10 +- src/gui/UBKeyboardPalette_mac.cpp | 14 +- src/gui/UBKeyboardPalette_win.cpp | 56 +- src/gui/UBLeftPalette.cpp | 4 +- src/gui/UBNavigatorPalette.cpp | 14 +- src/gui/UBResources.h | 2 +- src/gui/UBRightPalette.cpp | 66 +- src/gui/UBTeacherGuideWidget.cpp | 60 +- src/gui/UBTeacherGuideWidget.h | 6 +- src/gui/UBTeacherGuideWidgetsTools.cpp | 88 +- src/gui/UBThumbnailWidget.cpp | 42 +- src/gui/UBThumbnailWidget.h | 30 +- src/network/UBNetworkAccessManager.h | 2 +- src/pdf-merger/AbstractBoxElementHandler.h | 6 +- src/pdf-merger/CropBoxElementHandler.h | 2 +- src/pdf-merger/Document.cpp | 2 +- src/pdf-merger/LZWDecode.cpp | 6 +- src/pdf-merger/LZWDecode.h | 8 +- src/pdf-merger/MediaBoxElementHandler.h | 4 +- src/pdf-merger/Object.cpp | 22 +- src/pdf-merger/Object.h | 252 +++--- src/pdf-merger/OverlayDocumentParser.cpp | 10 +- src/pdf-merger/OverlayDocumentParser.h | 16 +- src/pdf-merger/Parser.cpp | 2 +- src/pdf-merger/Parser.h | 4 +- src/pdf-merger/RemoveHimSelfHandler.h | 30 +- src/pdf-merger/RotationHandler.h | 2 +- src/pdf-merger/Utils.cpp | 2 +- src/pdf/PDFRenderer.h | 8 +- src/pdf/XPDFRenderer.cpp | 16 +- src/podcast/UBPodcastController.cpp | 18 +- src/tools/UBAbstractDrawRuler.cpp | 12 +- src/tools/UBGraphicsProtractor.h | 18 +- src/tools/UBGraphicsRuler.h | 34 +- src/web/UBWebController.cpp | 2 +- src/web/UBWebController.h | 6 +- src/web/browser/WBBrowserWindow.cpp | 2 +- src/web/browser/WBBrowserWindow.h | 4 +- src/web/browser/WBUrlLineEdit.cpp | 2 +- 85 files changed, 1726 insertions(+), 1728 deletions(-) diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp index d98dd977..0bc4ca28 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -55,9 +55,9 @@ UBExportFullPDF::UBExportFullPDF(QObject *parent) : UBExportAdaptor(parent) { //need to calculate screen resolution - QDesktopWidget* desktop = UBApplication::desktop(); - int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; - mScaleFactor = 72.0f / dpiCommon; + QDesktopWidget* desktop = UBApplication::desktop(); + int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; + mScaleFactor = 72.0f / dpiCommon; } @@ -95,17 +95,17 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingContext(UBGraphicsScene::PdfExport); - QSize pageSize = scene->nominalSize(); + QSize pageSize = scene->nominalSize(); - UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast(scene->backgroundObject()); + UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast(scene->backgroundObject()); 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 (pageIndex != 0) pdfPrinter.newPage(); + if (pageIndex != 0) pdfPrinter.newPage(); //render to PDF scene->setDrawingMode(true); @@ -183,9 +183,9 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast(scene->backgroundObject()); - QSize pageSize = scene->nominalSize(); + QSize pageSize = scene->nominalSize(); - if (pdfItem) + if (pdfItem) { QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf"; QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName; diff --git a/src/adaptors/UBExportPDF.cpp b/src/adaptors/UBExportPDF.cpp index 90a0993b..52b853af 100644 --- a/src/adaptors/UBExportPDF.cpp +++ b/src/adaptors/UBExportPDF.cpp @@ -80,15 +80,15 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin pdfPrinter.setOutputFormat(QPrinter::PdfFormat); pdfPrinter.setResolution(UBSettings::settings()->pdfResolution->get().toInt()); pdfPrinter.setOutputFileName(filename); - pdfPrinter.setFullPage(true); + pdfPrinter.setFullPage(true); //need to calculate screen resolution - QDesktopWidget* desktop = UBApplication::desktop(); - int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; - float scaleFactor = 72.0f / dpiCommon; - + QDesktopWidget* desktop = UBApplication::desktop(); + int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; + float scaleFactor = 72.0f / dpiCommon; + QPainter pdfPainter; - bool painterNeedsBegin = true; + bool painterNeedsBegin = true; int existingPageCount = pDocumentProxy->pageCount(); @@ -101,17 +101,17 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin bool isCrossed = scene->isCrossedBackground(); scene->setBackground(false, false); - QSize pageSize = scene->nominalSize(); + QSize pageSize = scene->nominalSize(); // set high res rendering scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingContext(UBGraphicsScene::NonScreen); - //setting page size to appropriate value - pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point); - if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter); + //setting page size to appropriate value + pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point); + if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter); //render to PDF - scene->render(&pdfPainter, QRectF(), scene->normalizedSceneRect()); + scene->render(&pdfPainter, QRectF(), scene->normalizedSceneRect()); if (pageIndex < existingPageCount - 1) pdfPrinter.newPage(); @@ -122,7 +122,7 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin //restore background state scene->setBackground(isDark, isCrossed); } - if(!painterNeedsBegin) pdfPainter.end(); + if(!painterNeedsBegin) pdfPainter.end(); } QString UBExportPDF::exportExtention() diff --git a/src/adaptors/UBImportDocument.cpp b/src/adaptors/UBImportDocument.cpp index c7e750ef..dbbb34b1 100644 --- a/src/adaptors/UBImportDocument.cpp +++ b/src/adaptors/UBImportDocument.cpp @@ -174,18 +174,18 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString& QString documentRootFolder; - if(!extractFileToDir(pFile, path, documentRootFolder)){ - UBApplication::showMessage(tr("Import of file %1 failed.").arg(fi.baseName())); - return NULL; - } + if(!extractFileToDir(pFile, path, documentRootFolder)){ + UBApplication::showMessage(tr("Import of file %1 failed.").arg(fi.baseName())); + return NULL; + } bool addTitlePage = false; if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && !QFile(documentRootFolder+"/page000.svg").exists()) addTitlePage=true; UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, addTitlePage); - UBApplication::showMessage(tr("Import successful.")); - return newDocument; + UBApplication::showMessage(tr("Import successful.")); + return newDocument; } bool UBImportDocument::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile) diff --git a/src/adaptors/UBImportPDF.cpp b/src/adaptors/UBImportPDF.cpp index 773bbf13..16b44ad4 100644 --- a/src/adaptors/UBImportPDF.cpp +++ b/src/adaptors/UBImportPDF.cpp @@ -38,7 +38,7 @@ UBImportPDF::UBImportPDF(QObject *parent) : UBPageBasedImportAdaptor(parent) { QDesktopWidget* desktop = UBApplication::desktop(); - this->dpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; + this->dpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; } @@ -71,7 +71,7 @@ QList UBImportPDF::import(const QUuid& uuid, const QString& fil UBApplication::showMessage(tr("PDF import failed.")); return result; } - pdfRenderer->setDPI(this->dpi); + pdfRenderer->setDPI(this->dpi); int pdfPageCount = pdfRenderer->pageCount(); diff --git a/src/adaptors/UBImportPDF.h b/src/adaptors/UBImportPDF.h index 752b7d57..9617b237 100644 --- a/src/adaptors/UBImportPDF.h +++ b/src/adaptors/UBImportPDF.h @@ -44,8 +44,8 @@ class UBImportPDF : public UBPageBasedImportAdaptor virtual void placeImportedItemToScene(UBGraphicsScene* scene, UBGraphicsItem* item); virtual const QString& folderToCopy(); - private: - int dpi; + private: + int dpi; }; #endif /* UBIMPORTPDF_H_ */ diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 5435b8e9..b8f76027 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -1249,10 +1249,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) //disabling g section parsing as a group of elements. Use groups refs instead // mXmlWriter.writeStartElement("g"); // mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(strokesGroupItem->uuid())); -// QMatrix matrix = item->sceneMatrix(); -// if (!matrix.isIdentity()){ -// mXmlWriter.writeAttribute("transform", toSvgTransform(matrix)); -// } +// QMatrix matrix = item->sceneMatrix(); +// if (!matrix.isIdentity()){ +// mXmlWriter.writeAttribute("transform", toSvgTransform(matrix)); +// } // Add the polygons foreach(QGraphicsItem* item, strokesGroupItem->childItems()){ diff --git a/src/adaptors/UBThumbnailAdaptor.h b/src/adaptors/UBThumbnailAdaptor.h index c7aaadca..c83a7c5c 100644 --- a/src/adaptors/UBThumbnailAdaptor.h +++ b/src/adaptors/UBThumbnailAdaptor.h @@ -32,7 +32,7 @@ class UBGraphicsScene; class UBThumbnailAdaptor //static class { - Q_DECLARE_TR_FUNCTIONS(UBThumbnailAdaptor) + Q_DECLARE_TR_FUNCTIONS(UBThumbnailAdaptor) public: static QUrl thumbnailUrl(UBDocumentProxy* proxy, int pageIndex); diff --git a/src/api/UBWidgetUniboardAPI.cpp b/src/api/UBWidgetUniboardAPI.cpp index f4d4309a..3e40b290 100644 --- a/src/api/UBWidgetUniboardAPI.cpp +++ b/src/api/UBWidgetUniboardAPI.cpp @@ -241,7 +241,7 @@ void UBWidgetUniboardAPI::drawLineTo(const qreal x, const qreal y, const qreal p if (mScene) mScene->drawLineTo(QPointF(x, y), pWidth, - UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line); + UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line); } diff --git a/src/board/UBBoardView.h b/src/board/UBBoardView.h index 0f137ebc..2509169a 100644 --- a/src/board/UBBoardView.h +++ b/src/board/UBBoardView.h @@ -143,7 +143,7 @@ class UBBoardView : public QGraphicsView bool isAbsurdPoint(QPoint point); - bool mVirtualKeyboardActive; + bool mVirtualKeyboardActive; bool mOkOnWidget; bool mWidgetMoved; @@ -172,9 +172,9 @@ class UBBoardView : public QGraphicsView void settingChanged(QVariant newValue); - public slots: + public slots: - void virtualKeyboardActivated(bool b); + void virtualKeyboardActivated(bool b); void longPressEvent(); }; diff --git a/src/board/UBDrawingController.cpp b/src/board/UBDrawingController.cpp index 3f2ce6d9..76262b99 100644 --- a/src/board/UBDrawingController.cpp +++ b/src/board/UBDrawingController.cpp @@ -55,7 +55,7 @@ UBDrawingController::UBDrawingController(QObject * parent) , mActiveRuler(NULL) , mStylusTool((UBStylusTool::Enum)-1) , mLatestDrawingTool((UBStylusTool::Enum)-1) - , mIsDesktopMode(false) + , mIsDesktopMode(false) { connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged())); @@ -96,7 +96,7 @@ void UBDrawingController::setStylusTool(int tool) { if (tool != mStylusTool) { - UBApplication::boardController->activeScene()->deselectAllItems(); + UBApplication::boardController->activeScene()->deselectAllItems(); if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker || mStylusTool == UBStylusTool::Line) { diff --git a/src/board/UBDrawingController.h b/src/board/UBDrawingController.h index c267da25..f9a8de30 100644 --- a/src/board/UBDrawingController.h +++ b/src/board/UBDrawingController.h @@ -61,11 +61,11 @@ class UBDrawingController : public QObject UBAbstractDrawRuler* mActiveRuler; void setInDestopMode(bool mode){ - mIsDesktopMode = mode; + mIsDesktopMode = mode; } bool isInDesktopMode(){ - return mIsDesktopMode; + return mIsDesktopMode; } public slots: diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index ee41802b..80f4aefd 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -255,7 +255,7 @@ QString UBFeature::getVirtualDirFromVirtualPath(const QString &pVirtPath) QString UBFeature::getUrl() const { - if ( elementType == FEATURE_INTERNAL ) + if ( elementType == FEATURE_INTERNAL ) return getFullPath().toString(); return getFullPath().toLocalFile(); @@ -268,12 +268,12 @@ bool UBFeature::operator ==( const UBFeature &f )const bool UBFeature::operator !=( const UBFeature &f )const { - return !(*this == f); + return !(*this == f); } 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; } @@ -451,11 +451,11 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) { featuresList->append( UBFeature( favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) ); - } + } if (featureType == FEATURE_FOLDER) { fileSystemScan(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName); - } + } } } @@ -486,35 +486,35 @@ int UBFeaturesController::featuresCount(const QUrl &currPath) void UBFeaturesController::loadFavoriteList() { - favoriteSet = new QSet(); - QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); - if ( file.exists() ) - { - file.open(QIODevice::ReadOnly); - QDataStream in(&file); - int elementsNumber; - in >> elementsNumber; - for ( int i = 0; i < elementsNumber; ++i) - { - QUrl path; - in >> path; + favoriteSet = new QSet(); + QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); + if ( file.exists() ) + { + file.open(QIODevice::ReadOnly); + QDataStream in(&file); + int elementsNumber; + in >> elementsNumber; + for ( int i = 0; i < elementsNumber; ++i) + { + QUrl path; + in >> path; favoriteSet->insert( path ); - } - } + } + } } void UBFeaturesController::saveFavoriteList() { - QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); - file.resize(0); - file.open(QIODevice::WriteOnly); - QDataStream out(&file); - out << favoriteSet->size(); - for ( QSet::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it ) - { - out << (*it); - } - file.close(); + QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); + file.resize(0); + file.open(QIODevice::WriteOnly); + QDataStream out(&file); + out << favoriteSet->size(); + for ( QSet::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it ) + { + out << (*it); + } + file.close(); } QString UBFeaturesController::uniqNameForFeature(const UBFeature &feature, const QString &pName, const QString &pExtention) const @@ -584,29 +584,29 @@ QString UBFeaturesController::adjustName(const QString &str) void UBFeaturesController::addToFavorite( const QUrl &path ) { - QString filePath = fileNameFromUrl( path ); - if ( favoriteSet->find( path ) == favoriteSet->end() ) - { - QFileInfo fileInfo( filePath ); - QString fileName = fileInfo.fileName(); + QString filePath = fileNameFromUrl( path ); + if ( favoriteSet->find( path ) == favoriteSet->end() ) + { + QFileInfo fileInfo( filePath ); + QString fileName = fileInfo.fileName(); UBFeatureElementType type = fileTypeFromUrl(filePath); UBFeature elem(favoritePath + "/" + fileName, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) ); - favoriteSet->insert( path ); - saveFavoriteList(); + favoriteSet->insert( path ); + saveFavoriteList(); if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull()) featuresModel->addItem( elem ); - } + } } void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManualy) { -// QString filePath = fileNameFromUrl( path ); - if ( favoriteSet->find( path ) != favoriteSet->end() ) - { - favoriteSet->erase( favoriteSet->find( path ) ); - saveFavoriteList(); - } +// QString filePath = fileNameFromUrl( path ); + if ( favoriteSet->find( path ) != favoriteSet->end() ) + { + favoriteSet->erase( favoriteSet->find( path ) ); + saveFavoriteList(); + } if (deleteManualy) { featuresModel->deleteFavoriteItem(path.toString()); @@ -615,10 +615,10 @@ void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManu QString UBFeaturesController::fileNameFromUrl( const QUrl &url ) { - QString fileName = url.toString(); - if ( fileName.contains( "uniboardTool://" ) ) - return fileName; - return url.toLocalFile(); + QString fileName = url.toString(); + if ( fileName.contains( "uniboardTool://" ) ) + return fileName; + return url.toLocalFile(); } @@ -657,7 +657,7 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path) fileType = FEATURE_INVALID; } - return fileType; + return fileType; } QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType pFType = FEATURE_INVALID) @@ -759,7 +759,7 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) ) { - dest = picturesElement; + dest = picturesElement; } filePath = dest.getFullPath().toLocalFile() + "/" + mFileName; @@ -805,7 +805,7 @@ void UBFeaturesController::addNewFolder(QString name) if(!QFileInfo(path).exists()) { QDir().mkpath(path); - } + } UBFeature newFeatureFolder = UBFeature( currentElement.getFullVirtualPath() + "/" + name, QImage(":images/libpalette/folder.svg"), name, QUrl::fromLocalFile( path ), FEATURE_FOLDER ); @@ -856,7 +856,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA QString fileName; QString filePath; - + //Audio item if(dest == picturesElement) { @@ -897,37 +897,37 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination ) { - /*UBFeature newElement = copyItemToFolder( url, destination ); - deleteItem( url ); - return newElement;*/ + /*UBFeature newElement = copyItemToFolder( url, destination ); + deleteItem( url ); + return newElement;*/ QString sourcePath = url.toLocalFile(); - Q_ASSERT( QFileInfo( sourcePath ).exists() ); + Q_ASSERT( QFileInfo( sourcePath ).exists() ); UBFeature possibleDest = getDestinationFeatureForUrl(url); - UBFeature dest = destination; + UBFeature dest = destination; - if ( destination != trashElement && - !destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) ) - { - dest = possibleDest; - } + if ( destination != trashElement && + !destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) ) + { + dest = possibleDest; + } - QString name = QFileInfo( sourcePath ).fileName(); + QString name = QFileInfo( sourcePath ).fileName(); QString destPath = dest.getFullPath().toLocalFile(); - QString destVirtualPath = dest.getFullVirtualPath(); - QString newFullPath = destPath + "/" + name; + QString destVirtualPath = dest.getFullVirtualPath(); + QString newFullPath = destPath + "/" + name; if ( sourcePath.compare( newFullPath, Qt::CaseInsensitive ) ) { - QFile( sourcePath ).copy( newFullPath ); + QFile( sourcePath ).copy( newFullPath ); deleteItem( url ); } QImage thumb = getIcon( newFullPath ); - + UBFeatureElementType type = FEATURE_ITEM; - if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) + if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) type = FEATURE_INTERACTIVE; UBFeature newElement( destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); return newElement; @@ -1071,7 +1071,7 @@ void UBFeaturesController::deleteItem(const QUrl &url) QString path = url.toLocalFile(); Q_ASSERT( QFileInfo( path ).exists() ); - QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path ); + QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path ); if ( thumbnailPath.length() && QFileInfo( thumbnailPath ).exists()) { if (QFileInfo(thumbnailPath).isFile()) { QFile::remove(thumbnailPath); diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index ecaf78e1..10fb65c9 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -120,22 +120,22 @@ public: QString getDisplayName() const {return mDisplayName;} QImage getThumbnail() const {return mThumbnail;} QString getVirtualPath() const { return virtualDir; } - //QString getPath() const { return mPath; }; + //QString getPath() const { return mPath; }; QUrl getFullPath() const { return mPath; } QString getFullVirtualPath() const { return virtualDir + "/" + mName; } - QString getUrl() const; + QString getUrl() const; void setFullPath(const QUrl &newPath) {mPath = newPath;} void setFullVirtualPath(const QString &newVirtualPath) {virtualDir = newVirtualPath;} UBFeatureElementType getType() const { return elementType; } - bool isFolder() const; + bool isFolder() const; bool allowedCopy() const; - bool isDeletable() const; + bool isDeletable() const; bool inTrash() const; - bool operator ==( const UBFeature &f )const; - bool operator !=( const UBFeature &f )const; - const QMap & getMetadata() const { return metadata; } - void setMetadata( const QMap &data ) { metadata = data; } + bool operator ==( const UBFeature &f )const; + bool operator !=( const UBFeature &f )const; + const QMap & getMetadata() const { return metadata; } + void setMetadata( const QMap &data ) { metadata = data; } private: @@ -148,7 +148,7 @@ private: QImage mThumbnail; QString mName; QString mDisplayName; - QUrl mPath; + QUrl mPath; UBFeatureElementType elementType; QMap metadata; }; @@ -161,11 +161,11 @@ friend class UBFeaturesWidget; Q_OBJECT public: - UBFeaturesController(QWidget *parentWidget); + UBFeaturesController(QWidget *parentWidget); virtual ~UBFeaturesController(); QList * getFeatures() const {return featuresList;} - + const QString& getRootPath()const {return rootPath;} void scanFS(); @@ -173,12 +173,12 @@ public: void addItemAsBackground(const UBFeature &item); const UBFeature& getCurrentElement()const {return currentElement;} 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 ); - UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination ); - UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination ); + UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination ); + UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination ); void moveExternalData(const QUrl &url, const UBFeature &destination); void rescanModel(); @@ -188,9 +188,9 @@ public: void searchStarted(const QString &pattern, QListView *pOnView); void refreshModels(); - void deleteItem( const QUrl &url ); + void deleteItem( const QUrl &url ); void deleteItem(const UBFeature &pFeature); - bool isTrash( const QUrl &url ); + bool isTrash( const QUrl &url ); void moveToTrash(UBFeature feature, bool deleteManualy = false); void addToFavorite( const QUrl &path ); void removeFromFavorite(const QUrl &path, bool deleteManualy = false); @@ -202,9 +202,9 @@ public: int featuresCount(const QUrl &currPath); 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 bool isDeletable( const QUrl &url ); + static bool isDeletable( const QUrl &url ); static char featureTypeSplitter() {return ':';} static QString categoryNameForVirtualPath(const QString &str); @@ -255,49 +255,49 @@ private: private: static QImage createThumbnail(const QString &path); - //void addImageToCurrentPage( const QString &path ); - void loadFavoriteList(); - void saveFavoriteList(); + //void addImageToCurrentPage( const QString &path ); + void loadFavoriteList(); + void saveFavoriteList(); QString uniqNameForFeature(const UBFeature &feature, const QString &pName = "Imported", const QString &pExtention = "") const; QString adjustName(const QString &str); QList *featuresList; - QUrl mUserAudioDirectoryPath; + QUrl mUserAudioDirectoryPath; QUrl mUserVideoDirectoryPath; QUrl mUserPicturesDirectoryPath; QUrl mUserInteractiveDirectoryPath; QUrl mUserAnimationDirectoryPath; - QString libraryPath; + QString libraryPath; QUrl mLibPicturesDirectoryPath; - QUrl mLibAudiosDirectoryPath; - QUrl mLibVideosDirectoryPath; + QUrl mLibAudiosDirectoryPath; + QUrl mLibVideosDirectoryPath; QUrl mLibInteractiveDirectoryPath; QUrl mLibAnimationsDirectoryPath; - QUrl mLibApplicationsDirectoryPath; - QUrl mLibShapesDirectoryPath; + QUrl mLibApplicationsDirectoryPath; + QUrl mLibShapesDirectoryPath; - QUrl trashDirectoryPath; - QUrl mLibSearchDirectoryPath; + QUrl trashDirectoryPath; + QUrl mLibSearchDirectoryPath; - int mLastItemOffsetIndex; - UBFeature currentElement; + int mLastItemOffsetIndex; + UBFeature currentElement; UBFeature rootElement; UBFeature favoriteElement; - UBFeature audiosElement; - UBFeature moviesElement; - UBFeature picturesElement; - UBFeature interactElement; + UBFeature audiosElement; + UBFeature moviesElement; + UBFeature picturesElement; + UBFeature interactElement; UBFeature applicationsElement; - UBFeature flashElement; - UBFeature shapesElement; - UBFeature webSearchElement; + UBFeature flashElement; + UBFeature shapesElement; + UBFeature webSearchElement; - QSet *favoriteSet; + QSet *favoriteSet; public: UBFeature trashElement; diff --git a/src/core/UB.h b/src/core/UB.h index 9a3d8d0f..8b9b6e61 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -51,17 +51,17 @@ struct UBStylusTool enum Enum { Pen = 0, - Eraser, - Marker, - Selector, + Eraser, + Marker, + Selector, Play, - Hand, - ZoomIn, - ZoomOut, - Pointer, - Line, - Text, - Capture + Hand, + ZoomIn, + ZoomOut, + Pointer, + Line, + Text, + Capture }; }; @@ -139,18 +139,18 @@ struct UBGraphicsItemType enum Enum { PolygonItemType = QGraphicsItem::UserType + 1, - PixmapItemType, + PixmapItemType, SvgItemType, DelegateButtonType, - MediaItemType, - PDFItemType, - TextItemType, - CurtainItemType, + MediaItemType, + PDFItemType, + TextItemType, + CurtainItemType, RulerItemType, - CompassItemType, - ProtractorItemType, - StrokeItemType, - TriangleItemType, + CompassItemType, + ProtractorItemType, + StrokeItemType, + TriangleItemType, MagnifierItemType, cacheItemType, AristoItemType, diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 4d7849dd..b972c2c6 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -658,17 +658,17 @@ bool UBApplication::handleOpenMessage(const QString& pMessage) void UBApplication::cleanup() { - if (applicationController) delete applicationController; - if (boardController) delete boardController; - if (webController) delete webController; - if (documentController) delete documentController; + if (applicationController) delete applicationController; + if (boardController) delete boardController; + if (webController) delete webController; + if (documentController) delete documentController; if (mUniboardSankoreTransition) delete mUniboardSankoreTransition; - applicationController = NULL; - boardController = NULL; - webController = NULL; - documentController = NULL; + applicationController = NULL; + boardController = NULL; + webController = NULL; + documentController = NULL; mUniboardSankoreTransition = NULL; } @@ -707,19 +707,19 @@ void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, QString UBApplication::urlFromHtml(QString html) { - QString _html; - QRegExp comments("\\"); - QString url; + QString _html; + QRegExp comments("\\"); + QString url; QDomDocument domDoc; - // We remove all the comments & CRLF of this html - _html = html.remove(comments); - domDoc.setContent(_html.remove(QRegExp("[\\0]"))); + // We remove all the comments & CRLF of this html + _html = html.remove(comments); + domDoc.setContent(_html.remove(QRegExp("[\\0]"))); QDomElement rootElem = domDoc.documentElement(); // QUICKFIX: Here we have to check rootElem. Sometimes it can be a tag // 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(); // In that case we get the next element url = rootElem.firstChildElement().attribute("src"); @@ -727,7 +727,7 @@ QString UBApplication::urlFromHtml(QString html) url = rootElem.attribute("src"); } - return url; + return url; } bool UBApplication::isFromWeb(QString url) diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index d4ea58ee..ab3267b5 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -58,7 +58,7 @@ class UBApplication : public QtSingleApplication int exec(const QString& pFileToImport); - void cleanup(); + void cleanup(); static QPointer undoStack; diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index cffeeb60..f117358d 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -233,10 +233,10 @@ void UBApplicationController::adjustDisplayView() QRect rect = mControlView->rect(); QPoint center(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); - QTransform recentTransform = mDisplayView->transform(); + QTransform recentTransform = mDisplayView->transform(); - if (recentTransform != tr) - mDisplayView->setTransform(tr); + if (recentTransform != tr) + mDisplayView->setTransform(tr); mDisplayView->centerOn(mControlView->mapToScene(center)); } @@ -493,22 +493,22 @@ void UBApplicationController::showTutorial() } else{ - mMainWindow->webToolBar->hide(); - mMainWindow->boardToolBar->hide(); - mMainWindow->documentToolBar->hide(); - mMainWindow->tutorialToolBar->show(); + mMainWindow->webToolBar->hide(); + mMainWindow->boardToolBar->hide(); + mMainWindow->documentToolBar->hide(); + 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); - emit mainModeChanged(mMainMode); + mirroringEnabled(false); + emit mainModeChanged(mMainMode); } } @@ -543,7 +543,7 @@ void UBApplicationController::showSankoreEditor() void UBApplicationController::checkUpdate() { - if(mHttp) + if(mHttp) delete mHttp; QUrl url("http://ftp.open-sankore.org/update.json"); mHttp = new QHttp(url.host()); diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 64483254..abf9f440 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -615,7 +615,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager(); bool teacherGuideModified = false; if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget()) - teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified(); + teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified(); if (pDocumentProxy->isModified() || teacherGuideModified) UBMetadataDcSubsetAdaptor::persist(pDocumentProxy); @@ -873,7 +873,7 @@ QString UBPersistenceManager::teacherGuideAbsoluteObjectPath(UBDocumentProxy* pD QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath) { QString path = UBFileSystemUtils::removeLocalFilePrefix(pPath); - QFileInfo fi(path); + QFileInfo fi(path); QString uuid = QUuid::createUuid(); if (!fi.exists() || !pDocumentProxy) diff --git a/src/core/UBSetting.h b/src/core/UBSetting.h index be07b5d0..bf1b9e44 100644 --- a/src/core/UBSetting.h +++ b/src/core/UBSetting.h @@ -61,7 +61,7 @@ class UBSetting : public QObject public slots: void setBool(bool pValue); - void setString(const QString& pValue); + void setString(const QString& pValue); void setInt(int pValue); signals: diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index 7818384f..a3422cb6 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -123,21 +123,21 @@ eMediaType UBMediaWidget::mediaType() void UBMediaWidget::showEvent(QShowEvent* event) { - if(mType == eMediaType_Audio){ - return; - }else{ - if(!mpVideoWidget){ - mpVideoWidget = new Phonon::VideoWidget(this); - mMediaLayout->addStretch(1); - mMediaLayout->addWidget(mpVideoWidget); - mMediaLayout->addStretch(1); - Phonon::createPath(mpMediaObject, mpVideoWidget); - adaptSizeToVideo(); - mpMediaObject->play(); - mpMediaObject->stop(); - } - QWidget::showEvent(event); - } + if(mType == eMediaType_Audio){ + return; + }else{ + if(!mpVideoWidget){ + mpVideoWidget = new Phonon::VideoWidget(this); + mMediaLayout->addStretch(1); + mMediaLayout->addWidget(mpVideoWidget); + mMediaLayout->addStretch(1); + Phonon::createPath(mpMediaObject, mpVideoWidget); + adaptSizeToVideo(); + mpMediaObject->play(); + mpMediaObject->stop(); + } + QWidget::showEvent(event); + } } void UBMediaWidget::hideEvent(QHideEvent* event) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 0bb9ff00..ce517dde 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -396,7 +396,7 @@ void UBDesktopAnnotationController::hideWindow() void UBDesktopAnnotationController::goToUniboard() { - onToolClicked(); + onToolClicked(); hideWindow(); UBPlatformUtils::setDesktopMode(false); @@ -408,7 +408,7 @@ void UBDesktopAnnotationController::goToUniboard() void UBDesktopAnnotationController::customCapture() { - onToolClicked(); + onToolClicked(); mIsFullyTransparent = true; updateBackground(); @@ -435,7 +435,7 @@ void UBDesktopAnnotationController::customCapture() void UBDesktopAnnotationController::windowCapture() { - onToolClicked(); + onToolClicked(); mIsFullyTransparent = true; updateBackground(); @@ -957,7 +957,7 @@ void UBDesktopAnnotationController::refreshMask() void UBDesktopAnnotationController::onToolClicked() { - mDesktopEraserPalette->hide(); - mDesktopMarkerPalette->hide(); - mDesktopPenPalette->hide(); + mDesktopEraserPalette->hide(); + mDesktopMarkerPalette->hide(); + mDesktopPenPalette->hide(); } diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index fb60b9f0..6919e2b3 100644 --- a/src/desktop/UBDesktopPalette.h +++ b/src/desktop/UBDesktopPalette.h @@ -61,7 +61,7 @@ class UBDesktopPalette : public UBActionPalette void updateShowHideState(bool pShowEnabled); void setShowHideButtonVisible(bool visible); void setDisplaySelectButtonVisible(bool show); - void minimizeMe(eMinimizedLocation location); + void minimizeMe(eMinimizedLocation location); void maximizeMe(); void parentResized(); diff --git a/src/document/UBDocumentContainer.cpp b/src/document/UBDocumentContainer.cpp index 0ad8b4b1..b649f558 100644 --- a/src/document/UBDocumentContainer.cpp +++ b/src/document/UBDocumentContainer.cpp @@ -141,6 +141,6 @@ int UBDocumentContainer::sceneIndexFromPage(int page) void UBDocumentContainer::addEmptyThumbPage() { - const QPixmap* pThumb = new QPixmap(); - mDocumentThumbs.append(pThumb); + const QPixmap* pThumb = new QPixmap(); + mDocumentThumbs.append(pThumb); } diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 68e9ecbf..ee78dc44 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -488,7 +488,7 @@ void UBDocumentController::duplicateSelectedItem() if (UBApplication::applicationController->displayMode() != UBApplicationController::Document) return; - if (mSelectionType == Page) + if (mSelectionType == Page) { QList selectedItems = mDocumentUI->thumbnailWidget->selectedItems(); QList selectedSceneIndexes; @@ -1141,26 +1141,26 @@ void UBDocumentController::selectionChanged() mMainWindow->actionNewDocument->setEnabled((groupSelected || docSelected || pageSelected) && !trashSelected); mMainWindow->actionExport->setEnabled((docSelected || pageSelected) && !trashSelected); - bool firstSceneSelected = false; + bool firstSceneSelected = false; if(docSelected) - mMainWindow->actionDuplicate->setEnabled(!trashSelected); + mMainWindow->actionDuplicate->setEnabled(!trashSelected); else if(pageSelected){ - QList selection = mDocumentUI->thumbnailWidget->selectedItems(); - if(pageCount == 1) - mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); - else{ - for(int i = 0; i < selection.count() && !firstSceneSelected; i += 1){ - if(dynamic_cast(selection.at(i))->sceneIndex() == 0){ - mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); - firstSceneSelected = true; - } - } - if(!firstSceneSelected) - mMainWindow->actionDuplicate->setEnabled(!trashSelected); - } + QList selection = mDocumentUI->thumbnailWidget->selectedItems(); + if(pageCount == 1) + mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); + else{ + for(int i = 0; i < selection.count() && !firstSceneSelected; i += 1){ + if(dynamic_cast(selection.at(i))->sceneIndex() == 0){ + mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); + firstSceneSelected = true; + } + } + if(!firstSceneSelected) + mMainWindow->actionDuplicate->setEnabled(!trashSelected); + } } else - mMainWindow->actionDuplicate->setEnabled(false); + mMainWindow->actionDuplicate->setEnabled(false); mMainWindow->actionOpen->setEnabled((docSelected || pageSelected) && !trashSelected); mMainWindow->actionRename->setEnabled((groupSelected || docSelected) && !trashSelected && !defaultGroupSelected); @@ -1190,7 +1190,7 @@ void UBDocumentController::selectionChanged() } if(pageSelected && firstSceneSelected) - deleteEnabled = false; + deleteEnabled = false; mMainWindow->actionDelete->setEnabled(deleteEnabled); @@ -1632,28 +1632,28 @@ int UBDocumentController::getSelectedItemIndex() bool UBDocumentController::pageCanBeMovedUp(int page) { - if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) - return page >= 2; - else - return page >= 1; + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) + return page >= 2; + else + return page >= 1; } bool UBDocumentController::pageCanBeMovedDown(int page) { - if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) - return page != 0 && page < selectedDocument()->pageCount() - 1; - else - return page < selectedDocument()->pageCount() - 1; + if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) + return page != 0 && page < selectedDocument()->pageCount() - 1; + else + return page < selectedDocument()->pageCount() - 1; } bool UBDocumentController::pageCanBeDuplicated(int page) { - return page != 0; + return page != 0; } bool UBDocumentController::pageCanBeDeleted(int page) { - return page != 0; + return page != 0; } void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*) @@ -1685,9 +1685,9 @@ void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*) items << pixmapItem; int pageIndex = pageFromSceneIndex(i); if(pageIndex) - labels << tr("Page %1").arg(pageIndex); + labels << tr("Page %1").arg(pageIndex); else - labels << tr("Title page"); + labels << tr("Title page"); itemsPath.append(QUrl::fromLocalFile(proxy->persistencePath() + QString("/pages/%1").arg(UBDocumentContainer::pageFromSceneIndex(i)))); } diff --git a/src/domain/UBGraphicsGroupContainerItem.cpp b/src/domain/UBGraphicsGroupContainerItem.cpp index 78124fb9..e04bfed8 100644 --- a/src/domain/UBGraphicsGroupContainerItem.cpp +++ b/src/domain/UBGraphicsGroupContainerItem.cpp @@ -39,7 +39,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent { setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); - setDelegate(new UBGraphicsGroupContainerItemDelegate(this, 0)); + setDelegate(new UBGraphicsGroupContainerItemDelegate(this, 0)); Delegate()->init(); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); diff --git a/src/domain/UBGraphicsPolygonItem.cpp b/src/domain/UBGraphicsPolygonItem.cpp index 3773bd74..6ef40300 100644 --- a/src/domain/UBGraphicsPolygonItem.cpp +++ b/src/domain/UBGraphicsPolygonItem.cpp @@ -79,13 +79,13 @@ void UBGraphicsPolygonItem::setUuid(const QUuid &pUuid) void UBGraphicsPolygonItem::clearStroke() { - if (mStroke!=NULL) - { + if (mStroke!=NULL) + { mStroke->remove(this); if (mStroke->polygons().empty()) delete mStroke; mStroke = NULL; - } + } } UBGraphicsPolygonItem::~UBGraphicsPolygonItem() diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index 223cfccc..718a3716 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -313,7 +313,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon); public slots: - void initStroke(); + void initStroke(); void hideEraser(); void setBackground(bool pIsDark, bool pIsCrossed); diff --git a/src/domain/UBGraphicsStrokesGroup.cpp b/src/domain/UBGraphicsStrokesGroup.cpp index d210b6c2..1bc91877 100644 --- a/src/domain/UBGraphicsStrokesGroup.cpp +++ b/src/domain/UBGraphicsStrokesGroup.cpp @@ -135,18 +135,18 @@ void UBGraphicsStrokesGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) UBItem* UBGraphicsStrokesGroup::deepCopy() const { - UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup(); + UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup(); - QTransform groupTransform = transform(); - const_cast(this)->resetTransform(); + QTransform groupTransform = transform(); + const_cast(this)->resetTransform(); - QList chl = childItems(); + QList chl = childItems(); - foreach(QGraphicsItem *child, chl) - { - UBGraphicsPolygonItem *polygon = dynamic_cast(child); + foreach(QGraphicsItem *child, chl) + { + UBGraphicsPolygonItem *polygon = dynamic_cast(child); - if (polygon){ + if (polygon){ UBGraphicsPolygonItem *polygonCopy = dynamic_cast(polygon->deepCopy()); if (polygonCopy) { @@ -154,18 +154,18 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const copy->addToGroup(pItem); polygonCopy->setStrokesGroup(copy); } - } + } - } - const_cast(this)->setTransform(groupTransform); - copyItemParameters(copy); + } + const_cast(this)->setTransform(groupTransform); + copyItemParameters(copy); - return copy; + return copy; } void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const { - QGraphicsItem *cp = dynamic_cast(copy); + QGraphicsItem *cp = dynamic_cast(copy); if(NULL != cp) { cp->setTransform(transform()); diff --git a/src/frameworks/UBPlatformUtils.cpp b/src/frameworks/UBPlatformUtils.cpp index 760e1220..1ccc3872 100644 --- a/src/frameworks/UBPlatformUtils.cpp +++ b/src/frameworks/UBPlatformUtils.cpp @@ -27,7 +27,7 @@ void UBPlatformUtils::destroy() { - destroyKeyboardLayouts(); + destroyKeyboardLayouts(); } UBPlatformUtils::UBPlatformUtils() @@ -42,19 +42,19 @@ UBPlatformUtils::~UBPlatformUtils() bool UBPlatformUtils::hasVirtualKeyboard() { - return keyboardLayouts!=NULL && nKeyboardLayouts!=0; + return keyboardLayouts!=NULL && nKeyboardLayouts!=0; } UBKeyboardLocale::~UBKeyboardLocale() { - if (varSymbols!=NULL) - { - for(int i=0; i*/ KEYBTDECL(0x3c, 0x3e, false, 44), - /* y Y*/ KEYBTDECLEX8(0x79, 0x59, true, 45, 0x79, 0x59, 0, 0, 0, 0, 0xff, 0), - /* x X*/ KEYBTDECL(0x78, 0x58, true, 46), - /* c C*/ KEYBTDECL(0x63, 0x43, true, 47), - /* v V*/ KEYBTDECL(0x76, 0x56, true, 48), - /* b B*/ KEYBTDECL(0x62, 0x42, true, 49), - /* n N*/ KEYBTDECL(0x6e, 0x4e, true, 50), - /* m M*/ KEYBTDECL(0x6d, 0x4d, true, 51), - /* , ;*/ KEYBTDECL(0x2c, 0x3b, false, 52), - /* . :*/ KEYBTDECL(0x2e, 0x3a, false, 53), - /* - _*/ KEYBTDECL(0x2d, 0x5f, false, 54)}; + /* t T*/ KEYBTDECL(0x74, 0x54, true, 20), + /* z Z*/ KEYBTDECL(0x7a, 0x5a, true, 21), + /* 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), + /* o O*/ KEYBTDECLEX8(0x6f, 0x4f, true, 24, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6), + /* p P*/ KEYBTDECL(0x70, 0x50, true, 25), + /* è ü*/ KEYBTDECL(0xe8, 0xfa, false, 26), + /* ¨ !*/ 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), + /* s S*/ KEYBTDECL(0x73, 0x53, true, 31), + /* d D*/ KEYBTDECL(0x64, 0x44, true, 32), + /* f F*/ KEYBTDECL(0x66, 0x46, true, 33), + /* g G*/ KEYBTDECL(0x67, 0x47, true, 34), + /* h H*/ KEYBTDECL(0x68, 0x48, true, 35), + /* j J*/ KEYBTDECL(0x6a, 0x4a, true, 36), + /* k K*/ KEYBTDECL(0x6b, 0x4b, true, 37), + /* l L*/ KEYBTDECL(0x6c, 0x4c, true, 38), + /* é ö*/ KEYBTDECL(0xe9, 0xf6, false, 39), + /* à ä*/ KEYBTDECL(0xe0, 0xe4, false, 40), + /* $ £*/ KEYBTDECL(0x24, 0xa3, false, 43), + + /* < >*/ KEYBTDECL(0x3c, 0x3e, false, 44), + /* y Y*/ KEYBTDECLEX8(0x79, 0x59, true, 45, 0x79, 0x59, 0, 0, 0, 0, 0xff, 0), + /* x X*/ KEYBTDECL(0x78, 0x58, true, 46), + /* c C*/ KEYBTDECL(0x63, 0x43, true, 47), + /* v V*/ KEYBTDECL(0x76, 0x56, true, 48), + /* b B*/ KEYBTDECL(0x62, 0x42, true, 49), + /* n N*/ KEYBTDECL(0x6e, 0x4e, true, 50), + /* m M*/ KEYBTDECL(0x6d, 0x4d, true, 51), + /* , ;*/ KEYBTDECL(0x2c, 0x3b, false, 52), + /* . :*/ KEYBTDECL(0x2e, 0x3a, false, 53), + /* - _*/ KEYBTDECL(0x2d, 0x5f, false, 54)}; void UBPlatformUtils::initializeKeyboardLayouts() @@ -418,9 +418,9 @@ void UBPlatformUtils::initializeKeyboardLayouts() void UBPlatformUtils::destroyKeyboardLayouts() { for(int i=0; iwinId(), GWL_EXSTYLE) | WS_EX_NOACTIVATE - : GetWindowLong(widget->winId(), GWL_EXSTYLE) & ~WS_EX_NOACTIVATE; + long exStyle = (nonAcivable) ? GetWindowLong(widget->winId(), GWL_EXSTYLE) | WS_EX_NOACTIVATE + : GetWindowLong(widget->winId(), GWL_EXSTYLE) & ~WS_EX_NOACTIVATE; - SetWindowLong(widget->winId(), GWL_EXSTYLE, exStyle); + SetWindowLong(widget->winId(), GWL_EXSTYLE, exStyle); } #define KEYBTDECL(s1, s2, clSwitch) KEYBT(s1, s2, clSwitch, 0, 0, KEYCODE(s1), KEYCODE(s2)) KEYBT RUSSIAN_LOCALE [] = { - /* Ј і */ KEYBTDECL(0x451, 0x401, true), - /* 1 ! */ KEYBTDECL(0x31, 0x21, false), - /* 2 " */ KEYBTDECL(0x32, 0x5c, false), - /* 3 ? */ KEYBTDECL(0x33, 0x2116, false), - /* 4 ; */ KEYBTDECL(0x34, 0x3b, false), - /* 5 % */ KEYBTDECL(0x35, 0x25, false), - /* 6 : */ KEYBTDECL(0x36, 0x3a, false), - /* 7 ? */ KEYBTDECL(0x37, 0x3f, false), - /* 8 * */ KEYBTDECL(0x38, 0x2a, false), - /* 9 ( */ KEYBTDECL(0x39, 0x28, false), - /* 0 ) */ KEYBTDECL(0x30, 0x29, false), - /* - _ */ KEYBTDECL(0x2d, 0x4f, false), - /* = + */ KEYBTDECL(0x3d, 0x2b, false), - - /* К к */ KEYBTDECL(0x439, 0x419, true), - /* Г г */ KEYBTDECL(0x446, 0x426, true), - /* Х х */ KEYBTDECL(0x443, 0x423, true), - /* Л л */ KEYBTDECL(0x43a, 0x41a, true), - /* Е е */ KEYBTDECL(0x435, 0x415, true), - /* О о */ KEYBTDECL(0x43d, 0x41d, true), - /* З з */ KEYBTDECL(0x433, 0x413, true), - /* Ы ы */ KEYBTDECL(0x448, 0x428, true), - /* Э э */ KEYBTDECL(0x449, 0x429, true), - /* Ъ ъ */ KEYBTDECL(0x437, 0x417, true), - /* И и */ KEYBTDECL(0x445, 0x425, true), - /* Я я */ KEYBTDECL(0x44a, 0x42a, true), - - /* Ж ж */ KEYBTDECL(0x444, 0x424, true), - /* Щ щ */ KEYBTDECL(0x44b, 0x42b, true), - /* Ч ч */ KEYBTDECL(0x432, 0x412, true), - /* Б б */ KEYBTDECL(0x430, 0x410, true), - /* Р р */ KEYBTDECL(0x43f, 0x41f, true), - /* Т т */ KEYBTDECL(0x440, 0x420, true), - /* П п */ KEYBTDECL(0x43e, 0x41e, true), - /* М м */ KEYBTDECL(0x43b, 0x41b, true), - /* Д д */ KEYBTDECL(0x434, 0x414, true), - /* Ц ц */ KEYBTDECL(0x436, 0x416, true), - /* Ь ь */ KEYBTDECL(0x44d, 0x42d, true), - /* \ / */ KEYBTDECL(0x5c, 0x2f, false), - - /* С с */ KEYBTDECL(0x44f, 0x42f, true), - /* Ю ю */ KEYBTDECL(0x447, 0x427, true), - /* У у */ KEYBTDECL(0x441, 0x421, true), - /* Н н */ KEYBTDECL(0x43c, 0x41c, true), - /* Й й */ KEYBTDECL(0x438, 0x418, true), - /* Ф ф */ KEYBTDECL(0x442, 0x422, true), - /* Ш ш */ KEYBTDECL(0x44c, 0x42c, true), - /* В в */ KEYBTDECL(0x431, 0x411, true), - /* А а */ KEYBTDECL(0x44e, 0x42e, true), - /* . , */ KEYBTDECL(0x2e, 0x2c, false)}; + /* Ј і */ KEYBTDECL(0x451, 0x401, true), + /* 1 ! */ KEYBTDECL(0x31, 0x21, false), + /* 2 " */ KEYBTDECL(0x32, 0x5c, false), + /* 3 ? */ KEYBTDECL(0x33, 0x2116, false), + /* 4 ; */ KEYBTDECL(0x34, 0x3b, false), + /* 5 % */ KEYBTDECL(0x35, 0x25, false), + /* 6 : */ KEYBTDECL(0x36, 0x3a, false), + /* 7 ? */ KEYBTDECL(0x37, 0x3f, false), + /* 8 * */ KEYBTDECL(0x38, 0x2a, false), + /* 9 ( */ KEYBTDECL(0x39, 0x28, false), + /* 0 ) */ KEYBTDECL(0x30, 0x29, false), + /* - _ */ KEYBTDECL(0x2d, 0x4f, false), + /* = + */ KEYBTDECL(0x3d, 0x2b, false), + + /* К к */ KEYBTDECL(0x439, 0x419, true), + /* Г г */ KEYBTDECL(0x446, 0x426, true), + /* Х х */ KEYBTDECL(0x443, 0x423, true), + /* Л л */ KEYBTDECL(0x43a, 0x41a, true), + /* Е е */ KEYBTDECL(0x435, 0x415, true), + /* О о */ KEYBTDECL(0x43d, 0x41d, true), + /* З з */ KEYBTDECL(0x433, 0x413, true), + /* Ы ы */ KEYBTDECL(0x448, 0x428, true), + /* Э э */ KEYBTDECL(0x449, 0x429, true), + /* Ъ ъ */ KEYBTDECL(0x437, 0x417, true), + /* И и */ KEYBTDECL(0x445, 0x425, true), + /* Я я */ KEYBTDECL(0x44a, 0x42a, true), + + /* Ж ж */ KEYBTDECL(0x444, 0x424, true), + /* Щ щ */ KEYBTDECL(0x44b, 0x42b, true), + /* Ч ч */ KEYBTDECL(0x432, 0x412, true), + /* Б б */ KEYBTDECL(0x430, 0x410, true), + /* Р р */ KEYBTDECL(0x43f, 0x41f, true), + /* Т т */ KEYBTDECL(0x440, 0x420, true), + /* П п */ KEYBTDECL(0x43e, 0x41e, true), + /* М м */ KEYBTDECL(0x43b, 0x41b, true), + /* Д д */ KEYBTDECL(0x434, 0x414, true), + /* Ц ц */ KEYBTDECL(0x436, 0x416, true), + /* Ь ь */ KEYBTDECL(0x44d, 0x42d, true), + /* \ / */ KEYBTDECL(0x5c, 0x2f, false), + + /* С с */ KEYBTDECL(0x44f, 0x42f, true), + /* Ю ю */ KEYBTDECL(0x447, 0x427, true), + /* У у */ KEYBTDECL(0x441, 0x421, true), + /* Н н */ KEYBTDECL(0x43c, 0x41c, true), + /* Й й */ KEYBTDECL(0x438, 0x418, true), + /* Ф ф */ KEYBTDECL(0x442, 0x422, true), + /* Ш ш */ KEYBTDECL(0x44c, 0x42c, true), + /* В в */ KEYBTDECL(0x431, 0x411, true), + /* А а */ KEYBTDECL(0x44e, 0x42e, true), + /* . , */ KEYBTDECL(0x2e, 0x2c, false)}; KEYBT ENGLISH_LOCALE[] = { - /* ` ~ */ KEYBTDECL(0x60, 0x7e, false), - /* 1 ! */ KEYBTDECL(0x31, 0x21, false), - /* 2 @ */ KEYBTDECL(0x32, 0x40, false), - /* 3 # */ KEYBTDECL(0x33, 0x23, false), - /* 4 $ */ KEYBTDECL(0x34, 0x24, false), - /* 5 % */ KEYBTDECL(0x35, 0x25, false), - /* 6 ^ */ KEYBTDECL(0x36, 0x5e, false), - /* 7 & */ KEYBTDECL(0x37, 0x26, false), - /* 8 * */ KEYBTDECL(0x38, 0x2a, false), - /* 9 ( */ KEYBTDECL(0x39, 0x28, false), - /* 0 ) */ KEYBTDECL(0x30, 0x29, false), - /* - _ */ KEYBTDECL(0x2d, 0x5f, false), - /* = + */ KEYBTDECL(0x3d, 0x2b, false), - - /* q Q */ KEYBTDECL(0x71, 0x51, true), - /* w W */ KEYBTDECL(0x77, 0x57, true), - /* e E */ KEYBTDECL(0x65, 0x45, true), - /* r R */ KEYBTDECL(0x72, 0x52, true), - /* t T */ KEYBTDECL(0x74, 0x54, true), - /* y Y */ KEYBTDECL(0x79, 0x59, true), - /* u U */ KEYBTDECL(0x75, 0x55, true), - /* i I */ KEYBTDECL(0x69, 0x49, true), - /* o O */ KEYBTDECL(0x6f, 0x4f, true), - /* p P */ KEYBTDECL(0x70, 0x50, true), - /* [ { */ KEYBTDECL(0x5b, 0x7b, false), - /* ] } */ KEYBTDECL(0x5d, 0x7d, false), - - /* a A */ KEYBTDECL(0x61, 0x41, true), - /* s S */ KEYBTDECL(0x73, 0x53, true), - /* d D */ KEYBTDECL(0x64, 0x44, true), - /* f F */ KEYBTDECL(0x66, 0x46, true), - /* g G */ KEYBTDECL(0x67, 0x47, true), - /* h H */ KEYBTDECL(0x68, 0x48, true), - /* j J */ KEYBTDECL(0x6a, 0x4a, true), - /* k K */ KEYBTDECL(0x6b, 0x4b, true), - /* l L */ KEYBTDECL(0x6c, 0x4c, true), - /* ; : */ KEYBTDECL(0x3b, 0x3a, false), - /* ' " */ KEYBTDECL(0x27, 0x22, false), - /* \ | */ KEYBTDECL(0x5c, 0x7c, false), - - /* z Z */ KEYBTDECL(0x7a, 0x5a, true), - /* x X */ KEYBTDECL(0x78, 0x58, true), - /* c C */ KEYBTDECL(0x63, 0x43, true), - /* v V */ KEYBTDECL(0x76, 0x56, true), - /* b B */ KEYBTDECL(0x62, 0x42, true), - /* n N */ KEYBTDECL(0x6e, 0x4e, true), - /* m M */ KEYBTDECL(0x6d, 0x4d, true), - /* , < */ KEYBTDECL(0x2c, 0x3c, false), - /* . > */ KEYBTDECL(0x2e, 0x3e, false), - /* / ? */ KEYBTDECL(0x2f, 0x5f, false)}; + /* ` ~ */ KEYBTDECL(0x60, 0x7e, false), + /* 1 ! */ KEYBTDECL(0x31, 0x21, false), + /* 2 @ */ KEYBTDECL(0x32, 0x40, false), + /* 3 # */ KEYBTDECL(0x33, 0x23, false), + /* 4 $ */ KEYBTDECL(0x34, 0x24, false), + /* 5 % */ KEYBTDECL(0x35, 0x25, false), + /* 6 ^ */ KEYBTDECL(0x36, 0x5e, false), + /* 7 & */ KEYBTDECL(0x37, 0x26, false), + /* 8 * */ KEYBTDECL(0x38, 0x2a, false), + /* 9 ( */ KEYBTDECL(0x39, 0x28, false), + /* 0 ) */ KEYBTDECL(0x30, 0x29, false), + /* - _ */ KEYBTDECL(0x2d, 0x5f, false), + /* = + */ KEYBTDECL(0x3d, 0x2b, false), + + /* q Q */ KEYBTDECL(0x71, 0x51, true), + /* w W */ KEYBTDECL(0x77, 0x57, true), + /* e E */ KEYBTDECL(0x65, 0x45, true), + /* r R */ KEYBTDECL(0x72, 0x52, true), + /* t T */ KEYBTDECL(0x74, 0x54, true), + /* y Y */ KEYBTDECL(0x79, 0x59, true), + /* u U */ KEYBTDECL(0x75, 0x55, true), + /* i I */ KEYBTDECL(0x69, 0x49, true), + /* o O */ KEYBTDECL(0x6f, 0x4f, true), + /* p P */ KEYBTDECL(0x70, 0x50, true), + /* [ { */ KEYBTDECL(0x5b, 0x7b, false), + /* ] } */ KEYBTDECL(0x5d, 0x7d, false), + + /* a A */ KEYBTDECL(0x61, 0x41, true), + /* s S */ KEYBTDECL(0x73, 0x53, true), + /* d D */ KEYBTDECL(0x64, 0x44, true), + /* f F */ KEYBTDECL(0x66, 0x46, true), + /* g G */ KEYBTDECL(0x67, 0x47, true), + /* h H */ KEYBTDECL(0x68, 0x48, true), + /* j J */ KEYBTDECL(0x6a, 0x4a, true), + /* k K */ KEYBTDECL(0x6b, 0x4b, true), + /* l L */ KEYBTDECL(0x6c, 0x4c, true), + /* ; : */ KEYBTDECL(0x3b, 0x3a, false), + /* ' " */ KEYBTDECL(0x27, 0x22, false), + /* \ | */ KEYBTDECL(0x5c, 0x7c, false), + + /* z Z */ KEYBTDECL(0x7a, 0x5a, true), + /* x X */ KEYBTDECL(0x78, 0x58, true), + /* c C */ KEYBTDECL(0x63, 0x43, true), + /* v V */ KEYBTDECL(0x76, 0x56, true), + /* b B */ KEYBTDECL(0x62, 0x42, true), + /* n N */ KEYBTDECL(0x6e, 0x4e, true), + /* m M */ KEYBTDECL(0x6d, 0x4d, true), + /* , < */ KEYBTDECL(0x2c, 0x3c, false), + /* . > */ KEYBTDECL(0x2e, 0x3e, false), + /* / ? */ KEYBTDECL(0x2f, 0x5f, false)}; KEYBT FRENCH_LOCALE[] = { - /* ? ? */ KEYBTDECL(0xb2, 0xb2, true), - /* & 1 */ KEYBTDECL(0x26, 0x31, true), - /* ? 2 */ KEYBTDECL(0xe9, 0x32, true), - /* " 3 */ KEYBTDECL(0x22, 0x33, true), - /* ' 4 */ KEYBTDECL(0x27, 0x34, true), - /* ( 5 */ KEYBTDECL(0x28, 0x35, true), - /* - 6 */ KEYBTDECL(0x2d, 0x36, true), - /* ? 7 */ KEYBTDECL(0xe8, 0x37, true), - /* _ 8 */ KEYBTDECL(0x5f, 0x38, true), - /* ? 9 */ KEYBTDECL(0xe7, 0x39, true), - /* ? 0 */ KEYBTDECL(0xe0, 0x30, true), - /* ) ? */ KEYBTDECL(0x29, 0xb0, true), - /* = + */ KEYBTDECL(0x3d, 0x2b, true), - - /* a A */ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe4, 0xc4), - /* z Z */ KEYBTDECL(0x7a, 0x5a, true), - /* e E */ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xeb, 0xcb), - /* r R */ KEYBTDECL(0x72, 0x52, true), - /* t T */ KEYBTDECL(0x74, 0x54, true), - /* y Y */ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0xff), - /* u U */ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xfc, 0xdc), - /* i I */ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xef, 0xcf), - /* o O */ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf6, 0xd6), - /* p P */ KEYBTDECL(0x70, 0x50, true), - /* ^ ? */ KEYBT(0x5e, 0xa8, true, 1, 2, 0x5e, 0xa8), - /* $ ? } */ KEYBTDECL(0x24, 0xa3, true), - - /* q Q */ KEYBTDECL(0x71, 0x51, true), - /* s S */ KEYBTDECL(0x73, 0x53, true), - /* d D */ KEYBTDECL(0x64, 0x44, true), - /* f F */ KEYBTDECL(0x66, 0x46, true), - /* g G */ KEYBTDECL(0x67, 0x47, true), - /* h H */ KEYBTDECL(0x68, 0x48, true), - /* j J */ KEYBTDECL(0x6a, 0x4a, true), - /* k K */ KEYBTDECL(0x6b, 0x4b, true), - /* l L */ KEYBTDECL(0x6c, 0x4c, true), - /* m M */ KEYBTDECL(0x6d, 0x4d, true), - /* ? % */ KEYBTDECL(0xf9, 0x25, true), - /* * ? */ KEYBTDECL(0x2a, 0xb5, true), - - /* w W */ KEYBTDECL(0x77, 0x57, true), - /* x X */ KEYBTDECL(0x78, 0x58, true), - /* c C */ KEYBTDECL(0x63, 0x43, true), - /* v V */ KEYBTDECL(0x76, 0x56, true), - /* b B */ KEYBTDECL(0x62, 0x42, true), - /* n N */ KEYBTDECL(0x6e, 0x4e, true), - /* , ? */ KEYBTDECL(0x2c, 0x3f, true), - /* ; . */ KEYBTDECL(0x3b, 0x2e, true), - /* : / */ KEYBTDECL(0x3a, 0x2f, true), - /* ! ? */ KEYBTDECL(0x21, 0xa7, true)}; + /* ? ? */ KEYBTDECL(0xb2, 0xb2, true), + /* & 1 */ KEYBTDECL(0x26, 0x31, true), + /* ? 2 */ KEYBTDECL(0xe9, 0x32, true), + /* " 3 */ KEYBTDECL(0x22, 0x33, true), + /* ' 4 */ KEYBTDECL(0x27, 0x34, true), + /* ( 5 */ KEYBTDECL(0x28, 0x35, true), + /* - 6 */ KEYBTDECL(0x2d, 0x36, true), + /* ? 7 */ KEYBTDECL(0xe8, 0x37, true), + /* _ 8 */ KEYBTDECL(0x5f, 0x38, true), + /* ? 9 */ KEYBTDECL(0xe7, 0x39, true), + /* ? 0 */ KEYBTDECL(0xe0, 0x30, true), + /* ) ? */ KEYBTDECL(0x29, 0xb0, true), + /* = + */ KEYBTDECL(0x3d, 0x2b, true), + + /* a A */ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe4, 0xc4), + /* z Z */ KEYBTDECL(0x7a, 0x5a, true), + /* e E */ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xeb, 0xcb), + /* r R */ KEYBTDECL(0x72, 0x52, true), + /* t T */ KEYBTDECL(0x74, 0x54, true), + /* y Y */ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0xff), + /* u U */ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xfc, 0xdc), + /* i I */ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xef, 0xcf), + /* o O */ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf6, 0xd6), + /* p P */ KEYBTDECL(0x70, 0x50, true), + /* ^ ? */ KEYBT(0x5e, 0xa8, true, 1, 2, 0x5e, 0xa8), + /* $ ? } */ KEYBTDECL(0x24, 0xa3, true), + + /* q Q */ KEYBTDECL(0x71, 0x51, true), + /* s S */ KEYBTDECL(0x73, 0x53, true), + /* d D */ KEYBTDECL(0x64, 0x44, true), + /* f F */ KEYBTDECL(0x66, 0x46, true), + /* g G */ KEYBTDECL(0x67, 0x47, true), + /* h H */ KEYBTDECL(0x68, 0x48, true), + /* j J */ KEYBTDECL(0x6a, 0x4a, true), + /* k K */ KEYBTDECL(0x6b, 0x4b, true), + /* l L */ KEYBTDECL(0x6c, 0x4c, true), + /* m M */ KEYBTDECL(0x6d, 0x4d, true), + /* ? % */ KEYBTDECL(0xf9, 0x25, true), + /* * ? */ KEYBTDECL(0x2a, 0xb5, true), + + /* w W */ KEYBTDECL(0x77, 0x57, true), + /* x X */ KEYBTDECL(0x78, 0x58, true), + /* c C */ KEYBTDECL(0x63, 0x43, true), + /* v V */ KEYBTDECL(0x76, 0x56, true), + /* b B */ KEYBTDECL(0x62, 0x42, true), + /* n N */ KEYBTDECL(0x6e, 0x4e, true), + /* , ? */ KEYBTDECL(0x2c, 0x3f, true), + /* ; . */ KEYBTDECL(0x3b, 0x2e, true), + /* : / */ KEYBTDECL(0x3a, 0x2f, true), + /* ! ? */ KEYBTDECL(0x21, 0xa7, true)}; KEYBT SWISS_FRENCH_LOCALE[] = { - /* § °*/ KEYBTDECL(0xa7, 0xb0, false), - /* 1 +*/ KEYBTDECL(0x31, 0x2b, false), + /* § °*/ KEYBTDECL(0xa7, 0xb0, false), + /* 1 +*/ KEYBTDECL(0x31, 0x2b, false), /* 2 "*/ KEYBTDECL(0x32, 0x22, false), - /* 3 **/ KEYBTDECL(0x33, 0x2a, false), + /* 3 **/ KEYBTDECL(0x33, 0x2a, false), /* 4 ç*/ KEYBTDECL(0x34, 0xe7, false), /* 5 %*/ KEYBTDECL(0x35, 0x25, false), /* 6 &*/ KEYBTDECL(0x36, 0x26, false), /* 7 /*/ KEYBTDECL(0x37, 0x2f, false), /* 8 (*/ KEYBTDECL(0x38, 0x28, false), - /* 9 )*/ KEYBTDECL(0x39, 0x29, false), - /* 0 =*/ KEYBTDECL(0x30, 0x3d, false), - /* ' ?*/ KEYBTDECL(0x27, 0x5f, false), - /* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, 0x5e, 0x60), - - /* q Q*/ KEYBTDECL(0x71, 0x51, true), - /* w W*/ KEYBTDECL(0x77, 0x57, true), - /* e E*/ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb), + /* 9 )*/ KEYBTDECL(0x39, 0x29, false), + /* 0 =*/ KEYBTDECL(0x30, 0x3d, false), + /* ' ?*/ KEYBTDECL(0x27, 0x5f, false), + /* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, 0x5e, 0x60), + + /* q Q*/ KEYBTDECL(0x71, 0x51, true), + /* w W*/ KEYBTDECL(0x77, 0x57, true), + /* e E*/ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb), /* r R*/ KEYBTDECL(0x72, 0x52, true), - /* t T*/ KEYBTDECL(0x74, 0x54, true), - /* z Z*/ KEYBTDECL(0x7a, 0x5a, true), - /* u U*/ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc), - /* i I*/ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf), - /* o O*/ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6), - /* p P*/ KEYBTDECL(0x70, 0x50, true), - /* è ü*/ KEYBTDECL(0xe8, 0xfa, false), - /* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, 0xa8, 0x21), - - /* a A*/ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4), - /* s S*/ KEYBTDECL(0x73, 0x53, true), - /* d D*/ KEYBTDECL(0x64, 0x44, true), - /* f F*/ KEYBTDECL(0x66, 0x46, true), - /* g G*/ KEYBTDECL(0x67, 0x47, true), - /* h H*/ KEYBTDECL(0x68, 0x48, true), - /* j J*/ KEYBTDECL(0x6a, 0x4a, true), - /* k K*/ KEYBTDECL(0x6b, 0x4b, true), - /* l L*/ KEYBTDECL(0x6c, 0x4c, true), - /* é ö*/ KEYBTDECL(0xe9, 0xf6, false), - /* à ä*/ KEYBTDECL(0xe0, 0xe4, false), - /* $ £*/ KEYBTDECL(0x24, 0xa3, false), - - /* < >*/ KEYBTDECL(0x3c, 0x3e, false), - /* y Y*/ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0, 0, 0xff), - /* x X*/ KEYBTDECL(0x78, 0x58, true), - /* c C*/ KEYBTDECL(0x63, 0x43, true), - /* v V*/ KEYBTDECL(0x76, 0x56, true), - /* b B*/ KEYBTDECL(0x62, 0x42, true), - /* n N*/ KEYBTDECL(0x6e, 0x4e, true), - /* m M*/ KEYBTDECL(0x6d, 0x4d, true), - /* , ;*/ KEYBTDECL(0x2c, 0x3b, false), - /* . :*/ KEYBTDECL(0x2e, 0x3a, false), - /* - _*/ KEYBTDECL(0x2d, 0x5f, false)}; + /* t T*/ KEYBTDECL(0x74, 0x54, true), + /* z Z*/ KEYBTDECL(0x7a, 0x5a, true), + /* u U*/ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc), + /* i I*/ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf), + /* o O*/ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6), + /* p P*/ KEYBTDECL(0x70, 0x50, true), + /* è ü*/ KEYBTDECL(0xe8, 0xfa, false), + /* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, 0xa8, 0x21), + + /* a A*/ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4), + /* s S*/ KEYBTDECL(0x73, 0x53, true), + /* d D*/ KEYBTDECL(0x64, 0x44, true), + /* f F*/ KEYBTDECL(0x66, 0x46, true), + /* g G*/ KEYBTDECL(0x67, 0x47, true), + /* h H*/ KEYBTDECL(0x68, 0x48, true), + /* j J*/ KEYBTDECL(0x6a, 0x4a, true), + /* k K*/ KEYBTDECL(0x6b, 0x4b, true), + /* l L*/ KEYBTDECL(0x6c, 0x4c, true), + /* é ö*/ KEYBTDECL(0xe9, 0xf6, false), + /* à ä*/ KEYBTDECL(0xe0, 0xe4, false), + /* $ £*/ KEYBTDECL(0x24, 0xa3, false), + + /* < >*/ KEYBTDECL(0x3c, 0x3e, false), + /* y Y*/ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0, 0, 0xff), + /* x X*/ KEYBTDECL(0x78, 0x58, true), + /* c C*/ KEYBTDECL(0x63, 0x43, true), + /* v V*/ KEYBTDECL(0x76, 0x56, true), + /* b B*/ KEYBTDECL(0x62, 0x42, true), + /* n N*/ KEYBTDECL(0x6e, 0x4e, true), + /* m M*/ KEYBTDECL(0x6d, 0x4d, true), + /* , ;*/ KEYBTDECL(0x2c, 0x3b, false), + /* . :*/ KEYBTDECL(0x2e, 0x3a, false), + /* - _*/ KEYBTDECL(0x2d, 0x5f, false)}; KEYBT GERMAN_LOCALE[] = { - /* ^ ? */ KEYBTDECL(0x5f, 0xb0, false), - /* 1 ! */ KEYBTDECL(0x31, 0x21, true), - /* 2 " */ KEYBTDECL(0x32, 0x22, true), - /* 3 § */ KEYBTDECL(0x33, 0xa7, true), - /* 4 $ */ KEYBTDECL(0x34, 0x24, true), - /* 5 % */ KEYBTDECL(0x35, 0x25, true), - /* 6 & */ KEYBTDECL(0x36, 0x26, true), - /* 7 / */ KEYBTDECL(0x37, 0x2f, true), - /* 8 ( */ KEYBTDECL(0x38, 0x28, true), - /* 9 ) */ KEYBTDECL(0x39, 0x29, true), - /* 0 = */ KEYBTDECL(0x30, 0x3d, true), - /* ? ? */ KEYBTDECL(0xdf, 0x3f, true), - /* ` ? */ KEYBTDECL(0x60, 0xb4, false), - - /* q Q */ KEYBTDECL(0x71, 0x51, true), - /* w W */ KEYBTDECL(0x77, 0x57, true), - /* e E */ KEYBTDECL(0x65, 0x45, true), - /* r R */ KEYBTDECL(0x72, 0x52, true), - /* t T */ KEYBTDECL(0x74, 0x54, true), - /* z Z */ KEYBTDECL(0x7a, 0x5a, true), - /* u U */ KEYBTDECL(0x75, 0x55, true), - /* i I */ KEYBTDECL(0x69, 0x49, true), - /* o O */ KEYBTDECL(0x6f, 0x4f, true), - /* p P */ KEYBTDECL(0x70, 0x50, true), - /* ? ? */ KEYBTDECL(0xfc, 0xdc, true), - /* + * */ KEYBTDECL(0x2b, 0x2a, true), - - /* a A */ KEYBTDECL(0x61, 0x41, true), - /* s S */ KEYBTDECL(0x73, 0x53, true), - /* d D */ KEYBTDECL(0x64, 0x44, true), - /* f F */ KEYBTDECL(0x66, 0x46, true), - /* g G */ KEYBTDECL(0x67, 0x47, true), - /* h H */ KEYBTDECL(0x68, 0x48, true), - /* j J */ KEYBTDECL(0x6a, 0x4a, true), - /* k K */ KEYBTDECL(0x6b, 0x4b, true), - /* l L */ KEYBTDECL(0x6c, 0x4c, true), - /* ? ? */ KEYBTDECL(0xf6, 0xd6, true), - /* ? ? */ KEYBTDECL(0xe4, 0xc4, true), - /* ' # */ KEYBTDECL(0x27, 0x23, true), - - /* y Y */ KEYBTDECL(0x79, 0x59, true), - /* x X */ KEYBTDECL(0x78, 0x58, true), - /* c C */ KEYBTDECL(0x63, 0x43, true), - /* v V */ KEYBTDECL(0x76, 0x56, true), - /* b B */ KEYBTDECL(0x62, 0x42, true), - /* n N */ KEYBTDECL(0x6e, 0x4e, true), - /* m M */ KEYBTDECL(0x6d, 0x4d, true), - /* , ; */ KEYBTDECL(0x2c, 0x3b, true), - /* . : */ KEYBTDECL(0x2e, 0x3a, true), - /* _ - */ KEYBTDECL(0x5f, 0x2d, false)}; + /* ^ ? */ KEYBTDECL(0x5f, 0xb0, false), + /* 1 ! */ KEYBTDECL(0x31, 0x21, true), + /* 2 " */ KEYBTDECL(0x32, 0x22, true), + /* 3 § */ KEYBTDECL(0x33, 0xa7, true), + /* 4 $ */ KEYBTDECL(0x34, 0x24, true), + /* 5 % */ KEYBTDECL(0x35, 0x25, true), + /* 6 & */ KEYBTDECL(0x36, 0x26, true), + /* 7 / */ KEYBTDECL(0x37, 0x2f, true), + /* 8 ( */ KEYBTDECL(0x38, 0x28, true), + /* 9 ) */ KEYBTDECL(0x39, 0x29, true), + /* 0 = */ KEYBTDECL(0x30, 0x3d, true), + /* ? ? */ KEYBTDECL(0xdf, 0x3f, true), + /* ` ? */ KEYBTDECL(0x60, 0xb4, false), + + /* q Q */ KEYBTDECL(0x71, 0x51, true), + /* w W */ KEYBTDECL(0x77, 0x57, true), + /* e E */ KEYBTDECL(0x65, 0x45, true), + /* r R */ KEYBTDECL(0x72, 0x52, true), + /* t T */ KEYBTDECL(0x74, 0x54, true), + /* z Z */ KEYBTDECL(0x7a, 0x5a, true), + /* u U */ KEYBTDECL(0x75, 0x55, true), + /* i I */ KEYBTDECL(0x69, 0x49, true), + /* o O */ KEYBTDECL(0x6f, 0x4f, true), + /* p P */ KEYBTDECL(0x70, 0x50, true), + /* ? ? */ KEYBTDECL(0xfc, 0xdc, true), + /* + * */ KEYBTDECL(0x2b, 0x2a, true), + + /* a A */ KEYBTDECL(0x61, 0x41, true), + /* s S */ KEYBTDECL(0x73, 0x53, true), + /* d D */ KEYBTDECL(0x64, 0x44, true), + /* f F */ KEYBTDECL(0x66, 0x46, true), + /* g G */ KEYBTDECL(0x67, 0x47, true), + /* h H */ KEYBTDECL(0x68, 0x48, true), + /* j J */ KEYBTDECL(0x6a, 0x4a, true), + /* k K */ KEYBTDECL(0x6b, 0x4b, true), + /* l L */ KEYBTDECL(0x6c, 0x4c, true), + /* ? ? */ KEYBTDECL(0xf6, 0xd6, true), + /* ? ? */ KEYBTDECL(0xe4, 0xc4, true), + /* ' # */ KEYBTDECL(0x27, 0x23, true), + + /* y Y */ KEYBTDECL(0x79, 0x59, true), + /* x X */ KEYBTDECL(0x78, 0x58, true), + /* c C */ KEYBTDECL(0x63, 0x43, true), + /* v V */ KEYBTDECL(0x76, 0x56, true), + /* b B */ KEYBTDECL(0x62, 0x42, true), + /* n N */ KEYBTDECL(0x6e, 0x4e, true), + /* m M */ KEYBTDECL(0x6d, 0x4d, true), + /* , ; */ KEYBTDECL(0x2c, 0x3b, true), + /* . : */ KEYBTDECL(0x2e, 0x3a, true), + /* _ - */ KEYBTDECL(0x5f, 0x2d, false)}; void UBPlatformUtils::initializeKeyboardLayouts() { - nKeyboardLayouts = 5; - keyboardLayouts = new UBKeyboardLocale*[nKeyboardLayouts]; + nKeyboardLayouts = 5; + keyboardLayouts = new UBKeyboardLocale*[nKeyboardLayouts]; keyboardLayouts[0] = new UBKeyboardLocale(tr("English"), "en", "", new QIcon(":/images/flags/en.png"), ENGLISH_LOCALE); keyboardLayouts[1] = new UBKeyboardLocale(tr("Russian"), "ru", "", new QIcon(":/images/flags/ru.png"),RUSSIAN_LOCALE); keyboardLayouts[2] = new UBKeyboardLocale(tr("French"), "fr", "", new QIcon(":/images/flags/fr.png"), FRENCH_LOCALE); @@ -424,10 +424,10 @@ void UBPlatformUtils::initializeKeyboardLayouts() void UBPlatformUtils::destroyKeyboardLayouts() { - for(int i=0; iaddWidget(mpStackWidget); + mpStackWidget = new QStackedWidget(this); + mpLayout->addWidget(mpStackWidget); - // clear the tab widgets - mTabWidgets.clear(); + // clear the tab widgets + mTabWidgets.clear(); - // We let 2 pixels in order to keep a small border for the resizing - setMinimumWidth(0); + // We let 2 pixels in order to keep a small border for the resizing + setMinimumWidth(0); - if (parent) - { - setAttribute(Qt::WA_NoMousePropagation); - setAttribute(Qt::WA_TranslucentBackground); - } - else - { - // standalone window - setAttribute(Qt::WA_TranslucentBackground); - } + if (parent) + { + setAttribute(Qt::WA_NoMousePropagation); + setAttribute(Qt::WA_TranslucentBackground); + } + else + { + // standalone window + setAttribute(Qt::WA_TranslucentBackground); + } - mBackgroundBrush = QBrush(UBSettings::paletteColor); + mBackgroundBrush = QBrush(UBSettings::paletteColor); - // This is the only way to set the background as transparent! - setStyleSheet("QWidget {background-color: transparent}"); + // This is the only way to set the background as transparent! + setStyleSheet("QWidget {background-color: transparent}"); - // Set the position of the tab - onToolbarPosUpdated(); - connect(UBSettings::settings()->appToolBarPositionedAtTop, SIGNAL(changed(QVariant)), this, SLOT(onToolbarPosUpdated())); - connect(UBDownloadManager::downloadManager(), SIGNAL(allDownloadsFinished()), this, SLOT(onAllDownloadsFinished())); + // Set the position of the tab + onToolbarPosUpdated(); + connect(UBSettings::settings()->appToolBarPositionedAtTop, SIGNAL(changed(QVariant)), this, SLOT(onToolbarPosUpdated())); + connect(UBDownloadManager::downloadManager(), SIGNAL(allDownloadsFinished()), this, SLOT(onAllDownloadsFinished())); - connect(UBApplication::boardController,SIGNAL(documentSet(UBDocumentProxy*)),this,SLOT(onDocumentSet(UBDocumentProxy*))); + connect(UBApplication::boardController,SIGNAL(documentSet(UBDocumentProxy*)),this,SLOT(onDocumentSet(UBDocumentProxy*))); } /** @@ -101,21 +101,21 @@ UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, co */ UBDockPalette::~UBDockPalette() { - if(NULL != mpStackWidget) - { - delete mpStackWidget; - mpStackWidget = NULL; - } - if(NULL != mpLayout) - { - delete mpLayout; - mpLayout = NULL; - } + if(NULL != mpStackWidget) + { + delete mpStackWidget; + mpStackWidget = NULL; + } + if(NULL != mpLayout) + { + delete mpLayout; + mpLayout = NULL; + } } void UBDockPalette::onDocumentSet(UBDocumentProxy* documentProxy) { - Q_UNUSED(documentProxy); + Q_UNUSED(documentProxy); } /** @@ -124,7 +124,7 @@ void UBDockPalette::onDocumentSet(UBDocumentProxy* documentProxy) */ eUBDockOrientation UBDockPalette::orientation() { - return mOrientation; + return mOrientation; } /** @@ -133,19 +133,19 @@ eUBDockOrientation UBDockPalette::orientation() */ void UBDockPalette::setOrientation(eUBDockOrientation orientation) { - // Set the size - mOrientation = orientation; + // Set the size + mOrientation = orientation; - if(orientation == eUBDockOrientation_Left || orientation == eUBDockOrientation_Right) - { - setMaximumHeight(parentWidget()->height()); - setMinimumHeight(maximumHeight()); - } - else if(orientation == eUBDockOrientation_Top || orientation == eUBDockOrientation_Bottom) - { - setMaximumWidth(parentWidget()->width()); - setMinimumWidth(maximumWidth()); - } + if(orientation == eUBDockOrientation_Left || orientation == eUBDockOrientation_Right) + { + setMaximumHeight(parentWidget()->height()); + setMinimumHeight(maximumHeight()); + } + else if(orientation == eUBDockOrientation_Top || orientation == eUBDockOrientation_Bottom) + { + setMaximumWidth(parentWidget()->width()); + setMinimumWidth(maximumWidth()); + } } /** @@ -154,32 +154,32 @@ void UBDockPalette::setOrientation(eUBDockOrientation orientation) */ void UBDockPalette::resizeEvent(QResizeEvent *event) { - Q_UNUSED(event); - updateMaxWidth(); - if(parentWidget()) - { - setMinimumHeight(parentWidget()->height()); - } - // Set the position - QPoint origin; - switch(mOrientation) - { - case eUBDockOrientation_Right: - origin.setX(parentWidget()->width() - this->width()); - origin.setY(0); - break; - case eUBDockOrientation_Bottom: - // Not supported yet - case eUBDockOrientation_Top: - // Not supported yet - case eUBDockOrientation_Left: - default: - origin.setX(0); - origin.setY(0); - break; - } - move(origin.x(), origin.y()); - moveTabs(); + Q_UNUSED(event); + updateMaxWidth(); + if(parentWidget()) + { + setMinimumHeight(parentWidget()->height()); + } + // Set the position + QPoint origin; + switch(mOrientation) + { + case eUBDockOrientation_Right: + origin.setX(parentWidget()->width() - this->width()); + origin.setY(0); + break; + case eUBDockOrientation_Bottom: + // Not supported yet + case eUBDockOrientation_Top: + // Not supported yet + case eUBDockOrientation_Left: + default: + origin.setX(0); + origin.setY(0); + break; + } + move(origin.x(), origin.y()); + moveTabs(); } /** @@ -188,9 +188,9 @@ void UBDockPalette::resizeEvent(QResizeEvent *event) */ void UBDockPalette::enterEvent(QEvent *event) { - Q_UNUSED(event); - // We want to set the cursor as an arrow everytime it enters the palette - setCursor(Qt::ArrowCursor); + Q_UNUSED(event); + // We want to set the cursor as an arrow everytime it enters the palette + setCursor(Qt::ArrowCursor); } /** @@ -199,9 +199,9 @@ void UBDockPalette::enterEvent(QEvent *event) */ void UBDockPalette::leaveEvent(QEvent *event) { - Q_UNUSED(event); - // Restore the cursor to its previous shape - unsetCursor(); + Q_UNUSED(event); + // Restore the cursor to its previous shape + unsetCursor(); } /** @@ -210,38 +210,38 @@ void UBDockPalette::leaveEvent(QEvent *event) */ void UBDockPalette::paintEvent(QPaintEvent *event) { - Q_UNUSED(event); - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - painter.setPen(Qt::NoPen); - painter.setBrush(mBackgroundBrush); - QPainterPath path; - path.setFillRule(Qt::WindingFill); - - int nbTabs = mTabWidgets.size(); - if(0 < nbTabs) - { - // First draw the BIG RECTANGLE (I write it big because the rectangle is big...) - if(mOrientation == eUBDockOrientation_Left) - { - path.addRect(0.0, 0.0, width(), height()); - } - else if(mOrientation == eUBDockOrientation_Right) - { - path.addRect(0.0, 0.0, width(), height()); - } - - // THEN DRAW THE small tabs (yes, the tabs are small...) - if(eUBDockTabOrientation_Up == mTabsOrientation) - { - mHTab = border(); - } - else - { - mHTab = height() - border() - nbTabs*TABSIZE - (nbTabs-1)*tabSpacing(); - } - painter.drawPath(path); - } + Q_UNUSED(event); + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(Qt::NoPen); + painter.setBrush(mBackgroundBrush); + QPainterPath path; + path.setFillRule(Qt::WindingFill); + + int nbTabs = mTabWidgets.size(); + if(0 < nbTabs) + { + // First draw the BIG RECTANGLE (I write it big because the rectangle is big...) + if(mOrientation == eUBDockOrientation_Left) + { + path.addRect(0.0, 0.0, width(), height()); + } + else if(mOrientation == eUBDockOrientation_Right) + { + path.addRect(0.0, 0.0, width(), height()); + } + + // THEN DRAW THE small tabs (yes, the tabs are small...) + if(eUBDockTabOrientation_Up == mTabsOrientation) + { + mHTab = border(); + } + else + { + mHTab = height() - border() - nbTabs*TABSIZE - (nbTabs-1)*tabSpacing(); + } + painter.drawPath(path); + } } /** @@ -250,11 +250,11 @@ void UBDockPalette::paintEvent(QPaintEvent *event) */ void UBDockPalette::setBackgroundBrush(const QBrush &brush) { - if (mBackgroundBrush != brush) - { - mBackgroundBrush = brush; - update(); - } + if (mBackgroundBrush != brush) + { + mBackgroundBrush = brush; + update(); + } } /** @@ -263,7 +263,7 @@ void UBDockPalette::setBackgroundBrush(const QBrush &brush) */ int UBDockPalette::border() { - return 15; + return 15; } /** @@ -272,7 +272,7 @@ int UBDockPalette::border() */ int UBDockPalette::radius() { - return 5; + return 5; } /** @@ -280,7 +280,7 @@ int UBDockPalette::radius() */ void UBDockPalette::updateMaxWidth() { - // Only the inherited class will overload this method + // Only the inherited class will overload this method } /** @@ -289,7 +289,7 @@ void UBDockPalette::updateMaxWidth() */ int UBDockPalette::collapseWidth() { - return mCollapseWidth; + return mCollapseWidth; } /** @@ -297,17 +297,17 @@ int UBDockPalette::collapseWidth() */ void UBDockPalette::tabClicked(int tabIndex) { - // If the current tab is not the clicked one, show its content - if(mCurrentTab != tabIndex) - { - showTabWidget(tabIndex); - } - // else collapse the palette - else - { - toggleCollapseExpand(); - } - mTabPalette->update(); + // If the current tab is not the clicked one, show its content + if(mCurrentTab != tabIndex) + { + showTabWidget(tabIndex); + } + // else collapse the palette + else + { + toggleCollapseExpand(); + } + mTabPalette->update(); } /** @@ -316,13 +316,13 @@ void UBDockPalette::tabClicked(int tabIndex) */ void UBDockPalette::showTabWidget(int tabIndex) { - mpStackWidget->setCurrentIndex(tabIndex); - mCurrentTab = tabIndex; + mpStackWidget->setCurrentIndex(tabIndex); + mCurrentTab = tabIndex; - // Update the current tab index - if(NULL != (dynamic_cast(mpStackWidget->widget(tabIndex)))){ - mCrntTabWidget = dynamic_cast(mpStackWidget->widget(tabIndex))->name(); - } + // Update the current tab index + if(NULL != (dynamic_cast(mpStackWidget->widget(tabIndex)))){ + mCrntTabWidget = dynamic_cast(mpStackWidget->widget(tabIndex))->name(); + } } @@ -331,13 +331,13 @@ void UBDockPalette::showTabWidget(int tabIndex) */ void UBDockPalette::toggleCollapseExpand() { - if(width() < mCollapseWidth) - resize(mLastWidth,height()); - else{ - mLastWidth = width(); + if(width() < mCollapseWidth) + resize(mLastWidth,height()); + else{ + mLastWidth = width(); update(); - resize(0,height()); - } + resize(0,height()); + } } /** @@ -346,7 +346,7 @@ void UBDockPalette::toggleCollapseExpand() */ void UBDockPalette::setTabsOrientation(eUBDockTabOrientation orientation) { - mTabsOrientation = orientation; + mTabsOrientation = orientation; } /** @@ -354,17 +354,17 @@ void UBDockPalette::setTabsOrientation(eUBDockTabOrientation orientation) */ void UBDockPalette::onToolbarPosUpdated() { - // Get the position of the tab - if(UBSettings::settings()->appToolBarPositionedAtTop->get().toBool()) - { - setTabsOrientation(eUBDockTabOrientation_Up); - } - else - { - setTabsOrientation(eUBDockTabOrientation_Down); - } - moveTabs(); - update(); + // Get the position of the tab + if(UBSettings::settings()->appToolBarPositionedAtTop->get().toBool()) + { + setTabsOrientation(eUBDockTabOrientation_Up); + } + else + { + setTabsOrientation(eUBDockTabOrientation_Down); + } + moveTabs(); + update(); } /** @@ -373,7 +373,7 @@ void UBDockPalette::onToolbarPosUpdated() */ int UBDockPalette::customMargin() { - return 5; + return 5; } /** @@ -382,15 +382,15 @@ int UBDockPalette::customMargin() */ void UBDockPalette::addTab(UBDockPaletteWidget *widget) { - if(!mTabWidgets.contains(widget) && widget->visibleState()) - { - widget->setVisible(true); - mTabWidgets.append(widget); - mpStackWidget->addWidget(widget); - mpStackWidget->setCurrentWidget(widget); - resizeTabs(); - update(); - } + if(!mTabWidgets.contains(widget) && widget->visibleState()) + { + widget->setVisible(true); + mTabWidgets.append(widget); + mpStackWidget->addWidget(widget); + mpStackWidget->setCurrentWidget(widget); + resizeTabs(); + update(); + } } /** * \brief Remove the given tab @@ -398,16 +398,16 @@ void UBDockPalette::addTab(UBDockPaletteWidget *widget) */ void UBDockPalette::removeTab(UBDockPaletteWidget* widget) { - int nWidget = mTabWidgets.indexOf(widget); - if( nWidget >= 0 ) - { - mpStackWidget->removeWidget(widget); - mTabWidgets.remove(nWidget); - widget->hide(); - update(); - } - resizeTabs(); - mCurrentTab = qMax(mCurrentTab - 1, 0); + int nWidget = mTabWidgets.indexOf(widget); + if( nWidget >= 0 ) + { + mpStackWidget->removeWidget(widget); + mTabWidgets.remove(nWidget); + widget->hide(); + update(); + } + resizeTabs(); + mCurrentTab = qMax(mCurrentTab - 1, 0); } /** @@ -416,7 +416,7 @@ void UBDockPalette::removeTab(UBDockPaletteWidget* widget) */ void UBDockPalette::onResizeRequest(QResizeEvent *event) { - resizeEvent(event); + resizeEvent(event); } /** @@ -425,7 +425,7 @@ void UBDockPalette::onResizeRequest(QResizeEvent *event) */ int UBDockPalette::tabSpacing() { - return 2; + return 2; } /** @@ -434,11 +434,11 @@ int UBDockPalette::tabSpacing() */ void UBDockPalette::onShowTabWidget(UBDockPaletteWidget* widget) { - if (mRegisteredWidgets.contains(widget)) - { - widget->setVisibleState(true); - addTab(widget); - } + if (mRegisteredWidgets.contains(widget)) + { + widget->setVisibleState(true); + addTab(widget); + } } /** @@ -447,11 +447,11 @@ void UBDockPalette::onShowTabWidget(UBDockPaletteWidget* widget) */ void UBDockPalette::onHideTabWidget(UBDockPaletteWidget* widget) { - if (mRegisteredWidgets.contains(widget)) - { - widget->setVisibleState(false); - removeTab(widget); - } + if (mRegisteredWidgets.contains(widget)) + { + widget->setVisibleState(false); + removeTab(widget); + } } /** @@ -459,11 +459,11 @@ void UBDockPalette::onHideTabWidget(UBDockPaletteWidget* widget) */ void UBDockPalette::connectSignals() { - for(int i=0; i < mRegisteredWidgets.size(); i++) - { - connect(mRegisteredWidgets.at(i), SIGNAL(showTab(UBDockPaletteWidget*)), this, SLOT(onShowTabWidget(UBDockPaletteWidget*))); - connect(mRegisteredWidgets.at(i), SIGNAL(hideTab(UBDockPaletteWidget*)), this, SLOT(onHideTabWidget(UBDockPaletteWidget*))); - } + for(int i=0; i < mRegisteredWidgets.size(); i++) + { + connect(mRegisteredWidgets.at(i), SIGNAL(showTab(UBDockPaletteWidget*)), this, SLOT(onShowTabWidget(UBDockPaletteWidget*))); + connect(mRegisteredWidgets.at(i), SIGNAL(hideTab(UBDockPaletteWidget*)), this, SLOT(onHideTabWidget(UBDockPaletteWidget*))); + } } /** @@ -472,15 +472,15 @@ void UBDockPalette::connectSignals() */ void UBDockPalette::registerWidget(UBDockPaletteWidget *widget) { - if(!mRegisteredWidgets.contains(widget)) - { - // Update the parent of this widget - widget->setParent(this); - mRegisteredWidgets.append(widget); + if(!mRegisteredWidgets.contains(widget)) + { + // Update the parent of this widget + widget->setParent(this); + mRegisteredWidgets.append(widget); - // By default, the widget is hidden - widget->hide(); - } + // By default, the widget is hidden + widget->hide(); + } } /** @@ -488,180 +488,180 @@ void UBDockPalette::registerWidget(UBDockPaletteWidget *widget) */ void UBDockPalette::onAllDownloadsFinished() { - for(int i=0; iname()){ - mpStackWidget->setCurrentWidget(pW); - } - } + for(int i=0; iname()){ + mpStackWidget->setCurrentWidget(pW); + } + } } void UBDockPalette::moveTabs() { - // if (!mHTab) { - if(eUBDockTabOrientation_Up == mTabsOrientation) { - mHTab = border(); - } else { - mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing(); - } - // } - - QPoint origin(width(), mHTab + mTabPalette->mVerticalOffset); - - switch (mOrientation) { - case eUBDockOrientation_Left: - origin.setX(width()); - break; - case eUBDockOrientation_Right: - if (parentWidget()) { - origin.setX(parentWidget()->width() - width() - border() * 2); - } - break; - case eUBDockOrientation_Top: ; - case eUBDockOrientation_Bottom: ; - } - - mTabPalette->move(origin.x(), origin.y()); + // if (!mHTab) { + if(eUBDockTabOrientation_Up == mTabsOrientation) { + mHTab = border(); + } else { + mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing(); + } + // } + + QPoint origin(width(), mHTab + mTabPalette->mVerticalOffset); + + switch (mOrientation) { + case eUBDockOrientation_Left: + origin.setX(width()); + break; + case eUBDockOrientation_Right: + if (parentWidget()) { + origin.setX(parentWidget()->width() - width() - border() * 2); + } + break; + case eUBDockOrientation_Top: ; + case eUBDockOrientation_Bottom: ; + } + + mTabPalette->move(origin.x(), origin.y()); } void UBDockPalette::resizeTabs() { - int numTabs = mTabWidgets.size(); - mTabPalette->setFixedSize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); + int numTabs = mTabWidgets.size(); + mTabPalette->setFixedSize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); } QRect UBDockPalette::getTabPaletteRect() { - QRect tabsRect = mTabPalette->rect(); - QPoint topLeft = mTabPalette->mapToParent(tabsRect.topLeft()); - QPoint bottomRight = mTabPalette->mapToParent(tabsRect.bottomRight()); + QRect tabsRect = mTabPalette->rect(); + QPoint topLeft = mTabPalette->mapToParent(tabsRect.topLeft()); + QPoint bottomRight = mTabPalette->mapToParent(tabsRect.bottomRight()); - return QRect(topLeft, bottomRight); + return QRect(topLeft, bottomRight); } void UBDockPalette::assignParent(QWidget *widget) { - setParent(widget); - mTabPalette->setParent(widget); + setParent(widget); + mTabPalette->setParent(widget); } void UBDockPalette::setVisible(bool visible) { - QWidget::setVisible(visible); - mTabPalette->setVisible(visible); + QWidget::setVisible(visible); + mTabPalette->setVisible(visible); } bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode) { - mLastOpenedTabForMode.insert(mCurrentMode, mpStackWidget->currentIndex()); - mCurrentMode = mode; - bool hasVisibleElements = false; - //-------------------------------// - // get full palette widgets list, parse it, show all widgets for BOARD mode, and hide all other - for(int i = 0; i < mRegisteredWidgets.size(); i++) - { - UBDockPaletteWidget* pNextWidget = mRegisteredWidgets.at(i); - if( pNextWidget != NULL ) - { - if( pNextWidget->visibleInMode(mode) ) - { - addTab(pNextWidget); - hasVisibleElements = true; - } - else - { - removeTab(pNextWidget); - } - } - } - //-------------------------------// - - if(mRegisteredWidgets.size() > 0) - showTabWidget(mLastOpenedTabForMode.value(mCurrentMode)); - - update(); - - return hasVisibleElements; + mLastOpenedTabForMode.insert(mCurrentMode, mpStackWidget->currentIndex()); + mCurrentMode = mode; + bool hasVisibleElements = false; + //-------------------------------// + // get full palette widgets list, parse it, show all widgets for BOARD mode, and hide all other + for(int i = 0; i < mRegisteredWidgets.size(); i++) + { + UBDockPaletteWidget* pNextWidget = mRegisteredWidgets.at(i); + if( pNextWidget != NULL ) + { + if( pNextWidget->visibleInMode(mode) ) + { + addTab(pNextWidget); + hasVisibleElements = true; + } + else + { + removeTab(pNextWidget); + } + } + } + //-------------------------------// + + if(mRegisteredWidgets.size() > 0) + showTabWidget(mLastOpenedTabForMode.value(mCurrentMode)); + + update(); + + return hasVisibleElements; } UBTabDockPalette::UBTabDockPalette(UBDockPalette *dockPalette, QWidget *parent) : - QWidget(parent) + QWidget(parent) , dock(dockPalette) , mVerticalOffset(0) , mFlotable(false) { - int numTabs = dock->mTabWidgets.size(); - resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing()); + int numTabs = dock->mTabWidgets.size(); + resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing()); - setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_TranslucentBackground); } void UBTabDockPalette::paintEvent(QPaintEvent *) { - int nTabs = dock->mTabWidgets.size(); - if (nTabs <= 0) { - qDebug() << "not enough tabs"; - return; - } - - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - painter.setPen(Qt::NoPen); - painter.setBrush(dock->mBackgroundBrush); - - int yFrom = 0; - for (int i = 0; i < nTabs; i++) { - UBDockPaletteWidget* pCrntWidget = dock->mTabWidgets.at(i); - QPainterPath path; - path.setFillRule(Qt::WindingFill); - QPixmap iconPixmap; - - switch (dock->mOrientation) { - case eUBDockOrientation_Left: - path.addRect(0, yFrom, width() / 2, TABSIZE); - path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius()); - if (pCrntWidget) { - if(dock->mCollapseWidth >= dock->width()) { - // Get the collapsed icon - iconPixmap = pCrntWidget->iconToRight(); - } else { - // Get the expanded icon - iconPixmap = pCrntWidget->iconToLeft(); - } - - } - break; - - case eUBDockOrientation_Right: - path.addRect(width() /2, yFrom, width() / 2, TABSIZE); - path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius()); - if (pCrntWidget) { - if(dock->mCollapseWidth >= dock->width()) { - // Get the collapsed icon - iconPixmap = pCrntWidget->iconToLeft(); - } else { - // Get the expanded icon - iconPixmap = pCrntWidget->iconToRight(); - } - } - break; - - case eUBDockOrientation_Top: ; - case eUBDockOrientation_Bottom: ; - default: - break; - } - - painter.save(); - QPixmap transparencyPix(":/images/tab_mask.png"); - if (dock->mCurrentTab != i) { - iconPixmap.setAlphaChannel(transparencyPix); - QColor color(0x7F, 0x7F, 0x7F, 0x3F); - painter.setBrush(QBrush(color)); - } - - painter.drawPath(path); - painter.drawPixmap(2, yFrom + 2, width() - 4, TABSIZE - 4, iconPixmap); - yFrom += (TABSIZE + dock->tabSpacing()); - painter.restore(); - } + int nTabs = dock->mTabWidgets.size(); + if (nTabs <= 0) { + qDebug() << "not enough tabs"; + return; + } + + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(Qt::NoPen); + painter.setBrush(dock->mBackgroundBrush); + + int yFrom = 0; + for (int i = 0; i < nTabs; i++) { + UBDockPaletteWidget* pCrntWidget = dock->mTabWidgets.at(i); + QPainterPath path; + path.setFillRule(Qt::WindingFill); + QPixmap iconPixmap; + + switch (dock->mOrientation) { + case eUBDockOrientation_Left: + path.addRect(0, yFrom, width() / 2, TABSIZE); + path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius()); + if (pCrntWidget) { + if(dock->mCollapseWidth >= dock->width()) { + // Get the collapsed icon + iconPixmap = pCrntWidget->iconToRight(); + } else { + // Get the expanded icon + iconPixmap = pCrntWidget->iconToLeft(); + } + + } + break; + + case eUBDockOrientation_Right: + path.addRect(width() /2, yFrom, width() / 2, TABSIZE); + path.addRoundedRect(0, yFrom, width(), TABSIZE, dock->radius(), dock->radius()); + if (pCrntWidget) { + if(dock->mCollapseWidth >= dock->width()) { + // Get the collapsed icon + iconPixmap = pCrntWidget->iconToLeft(); + } else { + // Get the expanded icon + iconPixmap = pCrntWidget->iconToRight(); + } + } + break; + + case eUBDockOrientation_Top: ; + case eUBDockOrientation_Bottom: ; + default: + break; + } + + painter.save(); + QPixmap transparencyPix(":/images/tab_mask.png"); + if (dock->mCurrentTab != i) { + iconPixmap.setAlphaChannel(transparencyPix); + QColor color(0x7F, 0x7F, 0x7F, 0x3F); + painter.setBrush(QBrush(color)); + } + + painter.drawPath(path); + painter.drawPixmap(2, yFrom + 2, width() - 4, TABSIZE - 4, iconPixmap); + yFrom += (TABSIZE + dock->tabSpacing()); + painter.restore(); + } } UBTabDockPalette::~UBTabDockPalette() { @@ -669,100 +669,100 @@ UBTabDockPalette::~UBTabDockPalette() void UBTabDockPalette::mousePressEvent(QMouseEvent *event) { - dock->mClickTime = QTime::currentTime(); - // The goal here is to verify if the user can resize the widget. - // It is only possible to resize it if the border is selected - QPoint p = event->pos(); - dock->mMousePressPos = p; - dock->mResized = false; - - switch(dock->mOrientation) { - case eUBDockOrientation_Left: - dock->mCanResize = true; - break; - case eUBDockOrientation_Right: - dock->mCanResize = true; - break; - case eUBDockOrientation_Top: - // Not supported yet - break; - case eUBDockOrientation_Bottom: - // Not supported yet - break; - default: - break; - } + dock->mClickTime = QTime::currentTime(); + // The goal here is to verify if the user can resize the widget. + // It is only possible to resize it if the border is selected + QPoint p = event->pos(); + dock->mMousePressPos = p; + dock->mResized = false; + + switch(dock->mOrientation) { + case eUBDockOrientation_Left: + dock->mCanResize = true; + break; + case eUBDockOrientation_Right: + dock->mCanResize = true; + break; + case eUBDockOrientation_Top: + // Not supported yet + break; + case eUBDockOrientation_Bottom: + // Not supported yet + break; + default: + break; + } } void UBTabDockPalette::mouseMoveEvent(QMouseEvent *event) { - QPoint p = event->pos(); + QPoint p = event->pos(); - if(dock->mCanResize && ((dock->mMousePressPos - p).manhattanLength() > QApplication::startDragDistance())) - { - if (qAbs(dock->mMousePressPos.y() - p.y()) > 10 && mFlotable) { - qDebug() << "y differences" << dock->mMousePressPos.y() << p.y(); - mVerticalOffset += p.y() - dock->mMousePressPos.y(); - move(this->pos().x(), p.y()); - } + if(dock->mCanResize && ((dock->mMousePressPos - p).manhattanLength() > QApplication::startDragDistance())) + { + if (qAbs(dock->mMousePressPos.y() - p.y()) > 10 && mFlotable) { + qDebug() << "y differences" << dock->mMousePressPos.y() << p.y(); + mVerticalOffset += p.y() - dock->mMousePressPos.y(); + move(this->pos().x(), p.y()); + } - switch(dock->mOrientation) { + switch(dock->mOrientation) { - case eUBDockOrientation_Left: - p.setX(p.x() + dock->width()); - if(p.x() < dock->collapseWidth() && p.x() >= dock->minimumWidth()) { + case eUBDockOrientation_Left: + p.setX(p.x() + dock->width()); + if(p.x() < dock->collapseWidth() && p.x() >= dock->minimumWidth()) { dock->update(); - dock->resize(0, dock->height()); - //dock->mLastWidth = dock->collapseWidth() + 1; - dock->mResized = true; - } else if (p.x() <= dock->maximumWidth() && p.x() >= dock->minimumWidth()) { - dock->resize(p.x(), dock->height()); - dock->mResized = true; - } - break; - - case eUBDockOrientation_Right: - p.setX(p.x() - 2 * dock->border()); - if((dock->x() + p.x() > dock->parentWidget()->width() - dock->collapseWidth()) && (dock->x() + p.x() < dock->parentWidget()->width())) { + dock->resize(0, dock->height()); + //dock->mLastWidth = dock->collapseWidth() + 1; + dock->mResized = true; + } else if (p.x() <= dock->maximumWidth() && p.x() >= dock->minimumWidth()) { + dock->resize(p.x(), dock->height()); + dock->mResized = true; + } + break; + + case eUBDockOrientation_Right: + p.setX(p.x() - 2 * dock->border()); + if((dock->x() + p.x() > dock->parentWidget()->width() - dock->collapseWidth()) && (dock->x() + p.x() < dock->parentWidget()->width())) { dock->update(); - dock->resize(0, dock->height()); - //dock->mLastWidth = dock->collapseWidth() + 1; - dock->mResized = true; - } else if((dock->x() + p.x() >= dock->parentWidget()->width() - dock->maximumWidth()) && (dock->x() + p.x() <= dock->parentWidget()->width() - dock->minimumWidth())) { - dock->resize(dock->parentWidget()->width() - (dock->x() + p.x()), dock->height()); - dock->mResized = true; - } - break; - - case eUBDockOrientation_Top: - case eUBDockOrientation_Bottom: - if(p.y() <= dock->maximumHeight()) { - dock->resize(width(), p.y()); - dock->mResized = true; - } - break; - - default: - break; - } - } + dock->resize(0, dock->height()); + //dock->mLastWidth = dock->collapseWidth() + 1; + dock->mResized = true; + } else if((dock->x() + p.x() >= dock->parentWidget()->width() - dock->maximumWidth()) && (dock->x() + p.x() <= dock->parentWidget()->width() - dock->minimumWidth())) { + dock->resize(dock->parentWidget()->width() - (dock->x() + p.x()), dock->height()); + dock->mResized = true; + } + break; + + case eUBDockOrientation_Top: + case eUBDockOrientation_Bottom: + if(p.y() <= dock->maximumHeight()) { + dock->resize(width(), p.y()); + dock->mResized = true; + } + break; + + default: + break; + } + } } void UBTabDockPalette::mouseReleaseEvent(QMouseEvent *event) { - Q_UNUSED(event); - if(!dock->mResized && dock->mClickTime.elapsed() < CLICKTIME) { - int nbTabs = dock->mTabWidgets.size(); - int clickedTab = 0; - // If the clicked position is in the tab, perform the related action - - if(dock->mMousePressPos.x() >= 0 && - dock->mMousePressPos.x() <= width() && - dock->mMousePressPos.y() >= 0 && - dock->mMousePressPos.y() <= nbTabs * TABSIZE + (nbTabs -1)*dock->tabSpacing()) { - - clickedTab = (dock->mMousePressPos.y()) / (TABSIZE + dock->tabSpacing()); - dock->tabClicked(clickedTab); - } - } - dock->mCanResize = false; + Q_UNUSED(event); + if(!dock->mResized && dock->mClickTime.elapsed() < CLICKTIME) { + int nbTabs = dock->mTabWidgets.size(); + int clickedTab = 0; + // If the clicked position is in the tab, perform the related action + + if(dock->mMousePressPos.x() >= 0 && + dock->mMousePressPos.x() <= width() && + dock->mMousePressPos.y() >= 0 && + dock->mMousePressPos.y() <= nbTabs * TABSIZE + (nbTabs -1)*dock->tabSpacing()) { + + clickedTab = (dock->mMousePressPos.y()) / (TABSIZE + dock->tabSpacing()); + dock->tabClicked(clickedTab); + } + } + dock->mCanResize = false; } diff --git a/src/gui/UBDockPalette.h b/src/gui/UBDockPalette.h index a21eaa3c..74aea59a 100644 --- a/src/gui/UBDockPalette.h +++ b/src/gui/UBDockPalette.h @@ -42,7 +42,7 @@ class UBDocumentProxy; #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 /** diff --git a/src/gui/UBDockTeacherGuideWidget.cpp b/src/gui/UBDockTeacherGuideWidget.cpp index af535b89..1fa0232e 100644 --- a/src/gui/UBDockTeacherGuideWidget.cpp +++ b/src/gui/UBDockTeacherGuideWidget.cpp @@ -55,5 +55,5 @@ UBDockTeacherGuideWidget::~UBDockTeacherGuideWidget() UBTeacherGuideWidget* UBDockTeacherGuideWidget::teacherGuideWidget() { - return mpTeacherGuideWidget; + return mpTeacherGuideWidget; } diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index 3afbd4b2..1d488b54 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -87,8 +87,8 @@ UBDocumentNavigator::~UBDocumentNavigator() void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) { - mThumbsWithLabels.clear(); - foreach(QGraphicsItem* it, mScene->items()) + mThumbsWithLabels.clear(); + foreach(QGraphicsItem* it, mScene->items()) { mScene->removeItem(it); delete it; @@ -106,15 +106,15 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex); UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label); - UBImgTextThumbnailElement thumbWithText(pixmapItem, labelItem); - thumbWithText.setBorder(border()); - mThumbsWithLabels.append(thumbWithText); + UBImgTextThumbnailElement thumbWithText(pixmapItem, labelItem); + thumbWithText.setBorder(border()); + mThumbsWithLabels.append(thumbWithText); - mScene->addItem(pixmapItem); - mScene->addItem(labelItem); + mScene->addItem(pixmapItem); + mScene->addItem(labelItem); } - // Draw the items + // Draw the items refreshScene(); } @@ -173,7 +173,7 @@ void UBDocumentNavigator::refreshScene() UBImgTextThumbnailElement& item = mThumbsWithLabels[i]; int columnIndex = i % mNbColumns; int rowIndex = i / mNbColumns; - item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight); + item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight); } scene()->setSceneRect(scene()->itemsBoundingRect()); } @@ -258,29 +258,29 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event) if(NULL != pTextItem) { for(int i = 0; i < mThumbsWithLabels.size(); i++) - { - const UBImgTextThumbnailElement& el = mThumbsWithLabels.at(i); - if(el.getCaption() == pTextItem) - { - pCrntItem = el.getThumbnail(); - break; - } - } + { + const UBImgTextThumbnailElement& el = mThumbsWithLabels.at(i); + if(el.getCaption() == pTextItem) + { + pCrntItem = el.getThumbnail(); + break; + } + } } } 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; break; } } UBApplication::boardController->setActiveDocumentScene(index); - } - QGraphicsView::mousePressEvent(event); + } + QGraphicsView::mousePressEvent(event); } void UBDocumentNavigator::mouseReleaseEvent(QMouseEvent *event) diff --git a/src/gui/UBDocumentNavigator.h b/src/gui/UBDocumentNavigator.h index b7e792e9..4b22aaa8 100644 --- a/src/gui/UBDocumentNavigator.h +++ b/src/gui/UBDocumentNavigator.h @@ -34,7 +34,7 @@ #include "document/UBDocumentContainer.h" #include "UBThumbnailWidget.h" -#define NO_PAGESELECTED -1 +#define NO_PAGESELECTED -1 class UBDocumentNavigator : public QGraphicsView { @@ -68,8 +68,8 @@ private: QGraphicsScene* mScene; /** The current selected item */ //UBSceneThumbnailNavigPixmap* mCrntItem; - /** The list of current thumbnails with labels*/ - QList mThumbsWithLabels; + /** The list of current thumbnails with labels*/ + QList mThumbsWithLabels; /** The current number of columns */ int mNbColumns; /** The current thumbnails width */ diff --git a/src/gui/UBDocumentThumbnailWidget.cpp b/src/gui/UBDocumentThumbnailWidget.cpp index 79251b36..34aaacb8 100644 --- a/src/gui/UBDocumentThumbnailWidget.cpp +++ b/src/gui/UBDocumentThumbnailWidget.cpp @@ -38,12 +38,12 @@ UBDocumentThumbnailWidget::UBDocumentThumbnailWidget(QWidget* parent) : UBThumbnailWidget(parent) , mDropCaretRectItem(0) , mClosestDropItem(0) - , mDragEnabled(true) + , mDragEnabled(true) , mScrollMagnitude(0) { - bCanDrag = false; + bCanDrag = false; 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) { int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); if(pageIndex != 0){ - QDrag *drag = new QDrag(this); - QList mimeDataItems; - foreach (QGraphicsItem *item, selectedItems()) - mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item))); + QDrag *drag = new QDrag(this); + QList mimeDataItems; + foreach (QGraphicsItem *item, selectedItems()) + mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item))); - UBMimeData *mime = new UBMimeData(mimeDataItems); - drag->setMimeData(mime); + UBMimeData *mime = new UBMimeData(mimeDataItems); + drag->setMimeData(mime); - drag->setPixmap(sceneItem->pixmap().scaledToWidth(100)); - drag->setHotSpot(QPoint(drag->pixmap().width()/2, drag->pixmap().height() / 2)); + drag->setPixmap(sceneItem->pixmap().scaledToWidth(100)); + 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) void UBDocumentThumbnailWidget::dragLeaveEvent(QDragLeaveEvent *event) { Q_UNUSED(event); - if (mScrollTimer->isActive()) - { - mScrollMagnitude = 0; - mScrollTimer->stop(); - } + if (mScrollTimer->isActive()) + { + mScrollMagnitude = 0; + mScrollTimer->stop(); + } deleteDropCaret(); UBThumbnailWidget::dragLeaveEvent(event); } void UBDocumentThumbnailWidget::autoScroll() { - this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); + this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); } void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) { - QRect boundingFrame = frameRect(); - //setting up automatic scrolling - const int SCROLL_DISTANCE = 16; - int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); - if(qAbs(bottomDist) <= SCROLL_DISTANCE) - { - mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; - if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); - } - else if(qAbs(topDist) <= SCROLL_DISTANCE) - { - mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; - if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); - } - else - { - mScrollMagnitude = 0; - mScrollTimer->stop(); - } - - QList pixmapItems; + QRect boundingFrame = frameRect(); + //setting up automatic scrolling + const int SCROLL_DISTANCE = 16; + int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); + if(qAbs(bottomDist) <= SCROLL_DISTANCE) + { + mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; + if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); + } + else if(qAbs(topDist) <= SCROLL_DISTANCE) + { + mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; + if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); + } + else + { + mScrollMagnitude = 0; + mScrollTimer->stop(); + } + + QList pixmapItems; foreach (QGraphicsItem *item, scene()->items(mapToScene(boundingFrame))) { UBSceneThumbnailPixmap* sceneItem = dynamic_cast(item); @@ -161,11 +161,11 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) int pageIndex = -1; if(mClosestDropItem){ - pageIndex = UBDocumentContainer::pageFromSceneIndex(mClosestDropItem->sceneIndex()); - if(pageIndex == 0){ - event->acceptProposedAction(); - return; - } + pageIndex = UBDocumentContainer::pageFromSceneIndex(mClosestDropItem->sceneIndex()); + if(pageIndex == 0){ + event->acceptProposedAction(); + return; + } } if (!mClosestDropItem) { @@ -219,19 +219,19 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) void UBDocumentThumbnailWidget::dropEvent(QDropEvent *event) { - if (mScrollTimer->isActive()) - { - mScrollMagnitude = 0; - mScrollTimer->stop(); - } - deleteDropCaret(); + if (mScrollTimer->isActive()) + { + mScrollMagnitude = 0; + mScrollTimer->stop(); + } + deleteDropCaret(); if (mClosestDropItem) { int targetIndex = mDropIsRight ? mGraphicItems.indexOf(mClosestDropItem) + 1 : mGraphicItems.indexOf(mClosestDropItem); if(UBDocumentContainer::pageFromSceneIndex(targetIndex) == 0){ - event->ignore(); - return; + event->ignore(); + return; } QList mimeDataItems; diff --git a/src/gui/UBDocumentThumbnailWidget.h b/src/gui/UBDocumentThumbnailWidget.h index b7c3a327..5ebda875 100644 --- a/src/gui/UBDocumentThumbnailWidget.h +++ b/src/gui/UBDocumentThumbnailWidget.h @@ -49,8 +49,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget signals: void sceneDropped(UBDocumentProxy* proxy, int source, int target); - private slots: - void autoScroll(); + private slots: + void autoScroll(); protected: @@ -68,8 +68,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget UBSceneThumbnailPixmap *mClosestDropItem; bool mDropIsRight; bool mDragEnabled; - QTimer* mScrollTimer; - int mScrollMagnitude; + QTimer* mScrollTimer; + int mScrollMagnitude; }; #endif /* UBDOCUMENTTHUMBNAILWIDGET_H_ */ diff --git a/src/gui/UBDocumentTreeWidget.cpp b/src/gui/UBDocumentTreeWidget.cpp index 22689f67..dede4664 100644 --- a/src/gui/UBDocumentTreeWidget.cpp +++ b/src/gui/UBDocumentTreeWidget.cpp @@ -116,10 +116,10 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event) Q_UNUSED(event); if (mScrollTimer->isActive()) - { - mScrollMagnitude = 0; - mScrollTimer->stop(); - } + { + mScrollMagnitude = 0; + mScrollTimer->stop(); + } if (mDropTargetProxyTi) { @@ -131,25 +131,25 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event) void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event) { - QRect boundingFrame = frameRect(); - //setting up automatic scrolling - const int SCROLL_DISTANCE = 4; - int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); - if(qAbs(bottomDist) <= SCROLL_DISTANCE) - { - mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; - if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); - } - else if(qAbs(topDist) <= SCROLL_DISTANCE) - { - mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; - if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); - } - else - { - mScrollMagnitude = 0; - mScrollTimer->stop(); - } + QRect boundingFrame = frameRect(); + //setting up automatic scrolling + const int SCROLL_DISTANCE = 4; + int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); + if(qAbs(bottomDist) <= SCROLL_DISTANCE) + { + mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; + if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); + } + else if(qAbs(topDist) <= SCROLL_DISTANCE) + { + mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; + if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); + } + else + { + mScrollMagnitude = 0; + mScrollTimer->stop(); + } QTreeWidgetItem* underlyingItem = this->itemAt(event->pos()); @@ -461,5 +461,5 @@ bool UBDocumentGroupTreeItem::isDefaultFolder() const void UBDocumentTreeWidget::autoScroll() { - this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); + this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); } diff --git a/src/gui/UBDocumentTreeWidget.h b/src/gui/UBDocumentTreeWidget.h index 882873c7..3cd1030c 100644 --- a/src/gui/UBDocumentTreeWidget.h +++ b/src/gui/UBDocumentTreeWidget.h @@ -51,14 +51,14 @@ class UBDocumentTreeWidget : public QTreeWidget void itemChangedValidation(QTreeWidgetItem * item, int column); - void autoScroll(); + void autoScroll(); private: UBDocumentProxyTreeItem *mSelectedProxyTi; QTreeWidgetItem *mDropTargetProxyTi; QBrush mBackground; - QTimer* mScrollTimer; - int mScrollMagnitude; + QTimer* mScrollTimer; + int mScrollMagnitude; }; diff --git a/src/gui/UBFeaturesActionBar.cpp b/src/gui/UBFeaturesActionBar.cpp index 92dfd23e..6da49578 100644 --- a/src/gui/UBFeaturesActionBar.cpp +++ b/src/gui/UBFeaturesActionBar.cpp @@ -26,7 +26,7 @@ #include "gui/UBFeaturesWidget.h" UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent) - , featuresController(controller) + , featuresController(controller) , mButtonGroup(NULL) , mSearchBar(NULL) , mLayout(NULL) @@ -46,7 +46,7 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid , mpRemoveFavoriteBtn(NULL) , mpNewFolderBtn(NULL) { - setObjectName(name); + setObjectName(name); setStyleSheet(QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;")); setAcceptDrops(true); @@ -106,8 +106,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/ connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite())); - connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString))); - connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder())); + connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString))); + connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder())); connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite())); connect(mpRescanModelAction, SIGNAL(triggered()), this , SLOT(onActionRescanModel())); connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash())); @@ -123,33 +123,33 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid mLayout->addWidget(mpDeleteBtn); mLayout->addWidget(mpCloseBtn); mLayout->addWidget(mpRemoveFavoriteBtn); - setCurrentState( IN_ROOT ); - mpDeleteBtn->setAcceptDrops(true); - setAcceptDrops( true ); + setCurrentState( IN_ROOT ); + mpDeleteBtn->setAcceptDrops(true); + setAcceptDrops( true ); } void UBFeaturesActionBar::setCurrentState( UBFeaturesActionBarState state ) { - currentState = state; - setButtons(); + currentState = state; + setButtons(); } void UBFeaturesActionBar::setButtons() { switch( currentState ) { - case IN_FOLDER: - mpFavoriteBtn->show(); + case IN_FOLDER: + mpFavoriteBtn->show(); mpSocialBtn->hide(); mSearchBar->show(); mpDeleteBtn->show(); mpCloseBtn->hide(); mpRemoveFavoriteBtn->hide(); mpNewFolderBtn->show(); - mpNewFolderBtn->setEnabled(true); - mpDeleteBtn->setEnabled(true); + mpNewFolderBtn->setEnabled(true); + mpDeleteBtn->setEnabled(true); // mpRescanModelBtn->show(); - break; + break; case IN_ROOT: mpFavoriteBtn->show(); mpSocialBtn->hide(); @@ -158,8 +158,8 @@ void UBFeaturesActionBar::setButtons() mpCloseBtn->hide(); mpRemoveFavoriteBtn->hide(); mpNewFolderBtn->show(); - mpNewFolderBtn->setEnabled(false); - mpDeleteBtn->setEnabled(false); + mpNewFolderBtn->setEnabled(false); + mpDeleteBtn->setEnabled(false); // mpRescanModelBtn->show(); break; case IN_PROPERTIES: @@ -184,8 +184,8 @@ void UBFeaturesActionBar::setButtons() mpNewFolderBtn->hide(); // mpRescanModelBtn->hide(); break; - case IN_TRASH: - mpFavoriteBtn->hide(); + case IN_TRASH: + mpFavoriteBtn->hide(); mpSocialBtn->hide(); mSearchBar->show(); mpDeleteBtn->show(); @@ -196,7 +196,7 @@ void UBFeaturesActionBar::setButtons() //mpRemoveFavoriteBtn->show(); mpNewFolderBtn->hide(); // mpRescanModelBtn->hide(); - break; + break; default: break; } @@ -253,7 +253,7 @@ void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event ) } void UBFeaturesActionBar::dropEvent(QDropEvent *event) -{ +{ const UBFeaturesMimeData *fMimeData = qobject_cast(event->mimeData()); if (!fMimeData) { @@ -273,22 +273,22 @@ void UBFeaturesActionBar::dropEvent(QDropEvent *event) } } event->setDropAction(Qt::MoveAction); - event->accept(); + event->accept(); emit deleteElements(fMimeData); } else if (dest == mpFavoriteBtn) { event->setDropAction( Qt::CopyAction); - event->accept(); + event->accept(); emit addToFavorite(fMimeData); } else if (dest == mpRemoveFavoriteBtn) { - event->setDropAction( Qt::MoveAction ); - event->accept(); + event->setDropAction( Qt::MoveAction ); + event->accept(); emit removeFromFavorite(fMimeData); - } + } } UBFeaturesActionBar::~UBFeaturesActionBar() diff --git a/src/gui/UBFeaturesActionBar.h b/src/gui/UBFeaturesActionBar.h index 6f4edfc6..616f343a 100644 --- a/src/gui/UBFeaturesActionBar.h +++ b/src/gui/UBFeaturesActionBar.h @@ -50,26 +50,26 @@ public: enum UBFeaturesActionBarState { - IN_ROOT, - IN_FOLDER, - IN_PROPERTIES, - IN_FAVORITE, - IN_TRASH + IN_ROOT, + IN_FOLDER, + IN_PROPERTIES, + IN_FAVORITE, + IN_TRASH }; class UBFeaturesActionBar : public QWidget { - Q_OBJECT + Q_OBJECT public: - UBFeaturesActionBar(UBFeaturesController *controller, QWidget* parent=0, const char* name="UBFeaturesActionBar"); + UBFeaturesActionBar(UBFeaturesController *controller, QWidget* parent=0, const char* name="UBFeaturesActionBar"); ~UBFeaturesActionBar(); - - void setCurrentState( UBFeaturesActionBarState state ); + + void setCurrentState( UBFeaturesActionBarState state ); void cleanText(){ mSearchBar->clear(); } signals: - void searchElement(const QString &text); - void newFolderToCreate(); + void searchElement(const QString &text); + void newFolderToCreate(); void deleteElements(const UBFeaturesMimeData *data); void addToFavorite(const UBFeaturesMimeData *data); void removeFromFavorite(const UBFeaturesMimeData *data); @@ -79,8 +79,8 @@ signals: void rescanModel(); private slots: - void onSearchTextChanged(QString txt); - void onActionNewFolder(); + void onSearchTextChanged(QString txt); + void onActionNewFolder(); void onActionFavorite(); void onActionRemoveFavorite(); void onActionTrash(); @@ -90,17 +90,17 @@ private slots: protected: void dragEnterEvent( QDragEnterEvent *event ); - void dropEvent( QDropEvent *event ); + void dropEvent( QDropEvent *event ); private: - void setButtons(); - UBFeaturesController *featuresController; - UBFeaturesActionBarState currentState; + void setButtons(); + UBFeaturesController *featuresController; + UBFeaturesActionBarState currentState; - eButtonSet mCrntButtonSet; + eButtonSet mCrntButtonSet; eButtonSet mPreviousButtonSet; - QButtonGroup* mButtonGroup; + QButtonGroup* mButtonGroup; QLineEdit* mSearchBar; QHBoxLayout* mLayout; QAction* mpFavoriteAction; diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index f16ba111..066b7365 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -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) { if (pSuccess) { - qDebug() << pData.length(); + qDebug() << pData.length(); controller->addDownloadedFile(sourceUrl, pData, pContentHeader, pTitle); controller->refreshModels(); } @@ -371,20 +371,20 @@ void UBFeaturesWidget::removeElementsFromFavorite() void UBFeaturesWidget::switchToListView() { -// stackedWidget->setCurrentIndex(ID_LISTVIEW); -// currentStackedWidget = ID_LISTVIEW; +// stackedWidget->setCurrentIndex(ID_LISTVIEW); +// currentStackedWidget = ID_LISTVIEW; } void UBFeaturesWidget::switchToProperties() { -// stackedWidget->setCurrentIndex(ID_PROPERTIES); -// currentStackedWidget = ID_PROPERTIES; +// stackedWidget->setCurrentIndex(ID_PROPERTIES); +// currentStackedWidget = ID_PROPERTIES; } void UBFeaturesWidget::switchToWebView() { -// stackedWidget->setCurrentIndex(ID_WEBVIEW); -// currentStackedWidget = ID_WEBVIEW; +// stackedWidget->setCurrentIndex(ID_WEBVIEW); +// currentStackedWidget = ID_WEBVIEW; } QStringList UBFeaturesMimeData::formats() const @@ -1141,7 +1141,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const } else if (role == Qt::UserRole) { return featuresList->at(index.row()).getVirtualPath(); - } else if (role == Qt::UserRole + 1) { + } else if (role == Qt::UserRole + 1) { //return featuresList->at(index.row()).getType(); UBFeature f = featuresList->at(index.row()); return QVariant::fromValue( f ); @@ -1446,12 +1446,12 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde { QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value(); - + 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) @@ -1473,7 +1473,7 @@ UBFeaturesPathItemDelegate::UBFeaturesPathItemDelegate(QObject *parent) : QStyle 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(locale) diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index 85662c8f..44fff056 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -76,10 +76,10 @@ class UBFeaturesWidget : public UBDockPaletteWidget { Q_OBJECT public: - UBFeaturesWidget(QWidget* parent=0, const char* name="UBFeaturesWidget"); + UBFeaturesWidget(QWidget* parent=0, const char* name="UBFeaturesWidget"); virtual ~UBFeaturesWidget(); - bool visibleInMode(eUBDockPaletteWidgetMode mode) + bool visibleInMode(eUBDockPaletteWidgetMode mode) { return mode == eUBDockPaletteWidget_BOARD || mode == eUBDockPaletteWidget_DESKTOP; @@ -87,9 +87,9 @@ public: UBFeaturesController * getFeaturesController() const { return controller; } void importImage(const QImage &image, const QString &fileName = QString()); - static const int minThumbnailSize = 20; - static const int maxThumbnailSize = 100; - static const int defaultThumbnailSize = 40; + static const int minThumbnailSize = 20; + static const int maxThumbnailSize = 100; + static const int defaultThumbnailSize = 40; static const char *objNamePathList; static const char *objNameFeatureList; @@ -148,7 +148,7 @@ private: class UBFeaturesListView : public QListView { - Q_OBJECT + Q_OBJECT public: UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" ); @@ -337,7 +337,7 @@ private slots: //void onBack(); private: - void populateMetadata(); + void populateMetadata(); void adaptSize(); QVBoxLayout* mpLayout; @@ -363,7 +363,7 @@ public: class UBFeaturesModel : public QAbstractListModel { - Q_OBJECT + Q_OBJECT signals: void dataRestructured(); @@ -372,18 +372,18 @@ public: UBFeaturesModel(QList *pFeaturesList, QObject *parent = 0) : QAbstractListModel(parent), featuresList(pFeaturesList) {;} virtual ~UBFeaturesModel(){;} - void deleteFavoriteItem( const QString &path ); + void deleteFavoriteItem( const QString &path ); void deleteItem( const QString &path ); void deleteItem(const UBFeature &feature); - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - QMimeData *mimeData( const QModelIndexList &indexes ) const; - QStringList mimeTypes() const; - int rowCount( const QModelIndex &parent ) const; - Qt::ItemFlags flags( const QModelIndex &index ) const; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; + QMimeData *mimeData( const QModelIndexList &indexes ) const; + QStringList mimeTypes() const; + int rowCount( const QModelIndex &parent ) const; + Qt::ItemFlags flags( const QModelIndex &index ) const; 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 removeRow(int row, const QModelIndex &parent = QModelIndex()); + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool removeRow(int row, const QModelIndex &parent = QModelIndex()); //bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); //bool insertRow(int row, const QModelIndex &parent = QModelIndex()); @@ -395,69 +395,69 @@ public slots: void addItem( const UBFeature &item ); private: - QList *featuresList; + QList *featuresList; }; class UBFeaturesProxyModel : public QSortFilterProxyModel { - Q_OBJECT + Q_OBJECT public: UBFeaturesProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} virtual ~UBFeaturesProxyModel() {} protected: - virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; + virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; }; class UBFeaturesSearchProxyModel : public QSortFilterProxyModel { - Q_OBJECT + Q_OBJECT public: UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent), mFilterPrefix() {;} virtual ~UBFeaturesSearchProxyModel() {} void setFilterPrefix(const QString &newPrefix) {mFilterPrefix = newPrefix;} protected: - virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; + virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; private: QString mFilterPrefix; }; class UBFeaturesPathProxyModel : public QSortFilterProxyModel { - Q_OBJECT + Q_OBJECT public: UBFeaturesPathProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} virtual ~UBFeaturesPathProxyModel() {} void setPath( const QString &p ) { path = p; } protected: - virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; + virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; private: - QString path; + QString path; }; class UBFeaturesItemDelegate : public QStyledItemDelegate { - Q_OBJECT + Q_OBJECT public: UBFeaturesItemDelegate(QObject *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; } ~UBFeaturesItemDelegate() {} - //UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; }; - //void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; + //UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; }; + //void paint(QPainter *painter, 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: - const QListView *listView; + const QListView *listView; }; class UBFeaturesPathItemDelegate : public QStyledItemDelegate { - Q_OBJECT + Q_OBJECT public: UBFeaturesPathItemDelegate(QObject *parent = 0); - ~UBFeaturesPathItemDelegate(); - virtual QString displayText ( const QVariant & value, const QLocale & locale ) const; - void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; + ~UBFeaturesPathItemDelegate(); + virtual QString displayText ( const QVariant & value, const QLocale & locale ) const; + void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; private: - QPixmap *arrowPixmap; + QPixmap *arrowPixmap; }; diff --git a/src/gui/UBFloatingPalette.cpp b/src/gui/UBFloatingPalette.cpp index d7e9e5d1..68c1206f 100644 --- a/src/gui/UBFloatingPalette.cpp +++ b/src/gui/UBFloatingPalette.cpp @@ -284,46 +284,46 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos) if(!mCanBeMinimized) { // If this floating palette cannot be minimized, we exit this method. - return; + return; } if(mMinimizedLocation == eMinimizedLocation_None) { - // Verify if we have to minimize this palette - if(pos.x() == 5) - { - mMinimizedLocation = eMinimizedLocation_Left; - } -// else if(pos.y() == 5) -// { -// mMinimizedLocation = eMinimizedLocation_Top; -// } + // Verify if we have to minimize this palette + if(pos.x() == 5) + { + mMinimizedLocation = eMinimizedLocation_Left; + } +// else if(pos.y() == 5) +// { +// mMinimizedLocation = eMinimizedLocation_Top; +// } else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5) - { - mMinimizedLocation = eMinimizedLocation_Right; - } -// else if(pos.y() == parentSize.height() - height() - 5) -// { -// mMinimizedLocation = eMinimizedLocation_Bottom; -// } - - // Minimize the Palette - if(mMinimizedLocation != eMinimizedLocation_None) - { - emit minimizeStart(mMinimizedLocation); - } + { + mMinimizedLocation = eMinimizedLocation_Right; + } +// else if(pos.y() == parentSize.height() - height() - 5) +// { +// mMinimizedLocation = eMinimizedLocation_Bottom; +// } + + // Minimize the Palette + if(mMinimizedLocation != eMinimizedLocation_None) + { + emit minimizeStart(mMinimizedLocation); + } } else { - // Restore the palette - if(pos.x() > 5 && - pos.y() > 5 && + // Restore the palette + if(pos.x() > 5 && + pos.y() > 5 && pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 && pos.y() < parentWidget()->size().height() - height() - 5) - { - mMinimizedLocation = eMinimizedLocation_None; - emit maximizeStart(); - } + { + mMinimizedLocation = eMinimizedLocation_None; + emit maximizeStart(); + } } } diff --git a/src/gui/UBKeyboardPalette.cpp b/src/gui/UBKeyboardPalette.cpp index 0b5bac15..58ab9e44 100644 --- a/src/gui/UBKeyboardPalette.cpp +++ b/src/gui/UBKeyboardPalette.cpp @@ -76,10 +76,10 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent) createCtrlButtons(); nCurrentLocale = UBSettings::settings()->KeyboardLocale->get().toInt(); - if (nCurrentLocale < 0 || nCurrentLocale >= nLocalesCount) - nCurrentLocale = 0; - if (locales!=NULL) - setInput(locales[nCurrentLocale]); + if (nCurrentLocale < 0 || nCurrentLocale >= nLocalesCount) + nCurrentLocale = 0; + if (locales!=NULL) + setInput(locales[nCurrentLocale]); setContentsMargins( 22, 22, 22, 22 ); @@ -193,7 +193,7 @@ void UBKeyboardPalette::setLocale(int nLocale) onLocaleChanged(locales[nCurrentLocale]); update(); - UBSettings::settings()->KeyboardLocale->set(nCurrentLocale); + UBSettings::settings()->KeyboardLocale->set(nCurrentLocale); } emit localeChanged(nLocale); } diff --git a/src/gui/UBKeyboardPalette_mac.cpp b/src/gui/UBKeyboardPalette_mac.cpp index d3e1c3b2..e1bb9886 100644 --- a/src/gui/UBKeyboardPalette_mac.cpp +++ b/src/gui/UBKeyboardPalette_mac.cpp @@ -34,21 +34,21 @@ void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode) { 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, false)); if (keycode.modifier) - CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, false)); - + CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, false)); + } void UBKeyboardButton::sendControlSymbol(int nSymbol) { - CGEventRef event1 = CGEventCreateKeyboardEvent(NULL, nSymbol, true); - CGEventRef event2 = CGEventCreateKeyboardEvent(NULL, nSymbol, false); + CGEventRef event1 = CGEventCreateKeyboardEvent(NULL, nSymbol, true); + CGEventRef event2 = CGEventCreateKeyboardEvent(NULL, nSymbol, false); - CGEventPost(kCGHIDEventTap, event1); - CGEventPost(kCGHIDEventTap, event2); + CGEventPost(kCGHIDEventTap, event1); + CGEventPost(kCGHIDEventTap, event2); } void UBKeyboardPalette::createCtrlButtons() diff --git a/src/gui/UBKeyboardPalette_win.cpp b/src/gui/UBKeyboardPalette_win.cpp index e4a507a5..afac91fa 100644 --- a/src/gui/UBKeyboardPalette_win.cpp +++ b/src/gui/UBKeyboardPalette_win.cpp @@ -32,42 +32,42 @@ void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode) { - INPUT input[2]; - input[0].type = INPUT_KEYBOARD; - input[0].ki.wVk = 0; + INPUT input[2]; + input[0].type = INPUT_KEYBOARD; + input[0].ki.wVk = 0; input[0].ki.wScan = keycode.symbol; - input[0].ki.dwFlags = KEYEVENTF_UNICODE; - input[0].ki.time = 0; - input[0].ki.dwExtraInfo = 0; + input[0].ki.dwFlags = KEYEVENTF_UNICODE; + input[0].ki.time = 0; + input[0].ki.dwExtraInfo = 0; - input[1].type = INPUT_KEYBOARD; - input[1].ki.wVk = 0; + input[1].type = INPUT_KEYBOARD; + input[1].ki.wVk = 0; input[1].ki.wScan = keycode.symbol; - input[1].ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; - input[1].ki.time = 0; - input[1].ki.dwExtraInfo = 0; + input[1].ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; + input[1].ki.time = 0; + input[1].ki.dwExtraInfo = 0; - ::SendInput(2, input, sizeof(input[0])); + ::SendInput(2, input, sizeof(input[0])); } void UBKeyboardButton::sendControlSymbol(int nSymbol) { - INPUT input[2]; - input[0].type = INPUT_KEYBOARD; - input[0].ki.wVk = nSymbol; - input[0].ki.wScan = 0; - input[0].ki.dwFlags = 0; - input[0].ki.time = 0; - input[0].ki.dwExtraInfo = 0; - - input[1].type = INPUT_KEYBOARD; - input[1].ki.wVk = nSymbol; - input[1].ki.wScan = 0; - input[1].ki.dwFlags = KEYEVENTF_KEYUP; - input[1].ki.time = 0; - input[1].ki.dwExtraInfo = 0; - - ::SendInput(2, input, sizeof(input[0])); + INPUT input[2]; + input[0].type = INPUT_KEYBOARD; + input[0].ki.wVk = nSymbol; + input[0].ki.wScan = 0; + input[0].ki.dwFlags = 0; + input[0].ki.time = 0; + input[0].ki.dwExtraInfo = 0; + + input[1].type = INPUT_KEYBOARD; + input[1].ki.wVk = nSymbol; + input[1].ki.wScan = 0; + input[1].ki.dwFlags = KEYEVENTF_KEYUP; + input[1].ki.time = 0; + input[1].ki.dwExtraInfo = 0; + + ::SendInput(2, input, sizeof(input[0])); } void UBKeyboardPalette::createCtrlButtons() diff --git a/src/gui/UBLeftPalette.cpp b/src/gui/UBLeftPalette.cpp index 1279837a..9037a191 100644 --- a/src/gui/UBLeftPalette.cpp +++ b/src/gui/UBLeftPalette.cpp @@ -63,9 +63,7 @@ UBLeftPalette::~UBLeftPalette() void UBLeftPalette::onDocumentSet(UBDocumentProxy* documentProxy) { -// //This is necessary to force the teacher guide to be showed in priority each time a document is set -// if(documentProxy && UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) - + Q_UNUSED(documentProxy) // the tab zero is forced mLastOpenedTabForMode.insert(eUBDockPaletteWidget_BOARD, 0); } diff --git a/src/gui/UBNavigatorPalette.cpp b/src/gui/UBNavigatorPalette.cpp index 5ed24c26..fe7c0571 100644 --- a/src/gui/UBNavigatorPalette.cpp +++ b/src/gui/UBNavigatorPalette.cpp @@ -33,9 +33,9 @@ * @param name as the object name */ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name): - UBDockPalette(eUBDockPaletteType_LEFT, parent, name) - , mNavigator(NULL) - , mLayout(NULL) + UBDockPalette(eUBDockPaletteType_LEFT, parent, name) + , mNavigator(NULL) + , mLayout(NULL) , mHLayout(NULL) , mPageNbr(NULL) , mClock(NULL) @@ -98,13 +98,13 @@ UBNavigatorPalette::~UBNavigatorPalette() } if(NULL != mLayout) { - delete mLayout; - mLayout = NULL; + delete mLayout; + mLayout = NULL; } if(NULL != mNavigator) { - delete mNavigator; - mNavigator = NULL; + delete mNavigator; + mNavigator = NULL; } } diff --git a/src/gui/UBResources.h b/src/gui/UBResources.h index fd0e2b40..970f3207 100644 --- a/src/gui/UBResources.h +++ b/src/gui/UBResources.h @@ -58,7 +58,7 @@ class UBResources : public QObject QCursor playCursor; QCursor textCursor; QCursor rotateCursor; - QCursor drawLineRulerCursor; + QCursor drawLineRulerCursor; }; #endif /* UBRESOURCES_H_ */ diff --git a/src/gui/UBRightPalette.cpp b/src/gui/UBRightPalette.cpp index 994d55bf..75ec3a6c 100644 --- a/src/gui/UBRightPalette.cpp +++ b/src/gui/UBRightPalette.cpp @@ -39,17 +39,17 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name): mCollapseWidth = 150; bool isCollapsed = false; if(mCurrentMode == eUBDockPaletteWidget_BOARD){ - mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); - isCollapsed = UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool(); + mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); + isCollapsed = UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool(); } else{ - mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); - isCollapsed = UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool(); + mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); + isCollapsed = UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool(); } if(isCollapsed) - resize(0,parentWidget()->height()); + resize(0,parentWidget()->height()); else - resize(mLastWidth, parentWidget()->height()); + resize(mLastWidth, parentWidget()->height()); } /** @@ -77,18 +77,18 @@ void UBRightPalette::mouseMoveEvent(QMouseEvent *event) */ void UBRightPalette::resizeEvent(QResizeEvent *event) { - int newWidth = width(); - if(mCurrentMode == eUBDockPaletteWidget_BOARD){ - if(newWidth > mCollapseWidth) - UBSettings::settings()->rightLibPaletteBoardModeWidth->set(newWidth); - UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->set(newWidth == 0); - } - else{ - if(newWidth > mCollapseWidth) - UBSettings::settings()->rightLibPaletteDesktopModeWidth->set(newWidth); - UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->set(newWidth == 0); - } - UBDockPalette::resizeEvent(event); + int newWidth = width(); + if(mCurrentMode == eUBDockPaletteWidget_BOARD){ + if(newWidth > mCollapseWidth) + UBSettings::settings()->rightLibPaletteBoardModeWidth->set(newWidth); + UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->set(newWidth == 0); + } + else{ + if(newWidth > mCollapseWidth) + UBSettings::settings()->rightLibPaletteDesktopModeWidth->set(newWidth); + UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->set(newWidth == 0); + } + UBDockPalette::resizeEvent(event); emit resized(); } @@ -104,19 +104,19 @@ void UBRightPalette::updateMaxWidth() bool UBRightPalette::switchMode(eUBDockPaletteWidgetMode mode) { - int newModeWidth; - if(mode == eUBDockPaletteWidget_BOARD){ - mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); - newModeWidth = mLastWidth; - if(UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool()) - newModeWidth = 0; - } - else{ - mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); - newModeWidth = mLastWidth; - if(UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool()) - newModeWidth = 0; - } - resize(newModeWidth,height()); - return UBDockPalette::switchMode(mode); + int newModeWidth; + if(mode == eUBDockPaletteWidget_BOARD){ + mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); + newModeWidth = mLastWidth; + if(UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool()) + newModeWidth = 0; + } + else{ + mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); + newModeWidth = mLastWidth; + if(UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool()) + newModeWidth = 0; + } + resize(newModeWidth,height()); + return UBDockPalette::switchMode(mode); } diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 0019f2f5..c429ea87 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -932,7 +932,7 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes() QStringList licences; licences << tr("Attribution-ShareAlike CC BY-SA") << 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-NoDerivs CC BY-NC-ND") << tr("Attribution-NonCommercial-ShareAlike CC BY-NC-SA") @@ -1168,8 +1168,8 @@ bool UBTeacherGuidePageZeroWidget::isModified() void UBTeacherGuidePageZeroWidget::resizeEvent(QResizeEvent* ev) { - emit resized(); - QWidget::resizeEvent(ev); + emit resized(); + QWidget::resizeEvent(ev); } /*************************************************************************** @@ -1209,54 +1209,54 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget() void UBTeacherGuideWidget::onActiveSceneChanged() { if (UBApplication::boardController->currentPage() == 0) { - if(mpPageZeroWidget->isModified()) - mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION); - else - mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_EDITION); + if(mpPageZeroWidget->isModified()) + mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION); + else + mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_EDITION); setCurrentWidget(mpPageZeroWidget); } else{ - if(mpEditionWidget->isModified()){ + if(mpEditionWidget->isModified()){ mCurrentData = mpEditionWidget->getData(); mpPresentationWidget->showData(mCurrentData); - setCurrentWidget(mpPresentationWidget); - } - else - setCurrentWidget(mpEditionWidget); + setCurrentWidget(mpPresentationWidget); + } + else + setCurrentWidget(mpEditionWidget); } } void UBTeacherGuideWidget::onTriggeredAction(bool checked) { - Q_UNUSED(checked); - if(!mKeyboardActionFired) - showPresentationMode(); - mKeyboardActionFired=false; + Q_UNUSED(checked); + if(!mKeyboardActionFired) + showPresentationMode(); + mKeyboardActionFired=false; } void UBTeacherGuideWidget::onTriggeredKeyboardAction(bool checked) { - Q_UNUSED(checked); - mKeyboardActionFired = true; + Q_UNUSED(checked); + mKeyboardActionFired = true; } void UBTeacherGuideWidget::connectToStylusPalette() { - 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->actionMarker, 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->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); - connect(UBApplication::mainWindow->actionZoomOut, 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->actionMarker, 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->actionZoomIn, 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->actionHand, 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->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); - connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(onTriggeredKeyboardAction(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->actionText, 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))); } void UBTeacherGuideWidget::showPresentationMode() diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 0aee5c85..6871e2bb 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -147,7 +147,7 @@ public: bool isModified(); signals: - void resized(); + void resized(); public slots: void onActiveSceneChanged(); @@ -245,8 +245,8 @@ private: bool mKeyboardActionFired; private slots: - void onTriggeredAction(bool checked); - void onTriggeredKeyboardAction(bool checked); + void onTriggeredAction(bool checked); + void onTriggeredKeyboardAction(bool checked); }; #endif // UBTEACHERGUIDEWIDGET_H diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 026c8a48..e8afdf2e 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -173,11 +173,11 @@ void UBTGAdaptableText::showEvent(QShowEvent* e) { Q_UNUSED(e); if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){ - setTextColor(QColor(Qt::lightGray)); - setPlainText(mPlaceHolderText); + setTextColor(QColor(Qt::lightGray)); + setPlainText(mPlaceHolderText); } 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(); } @@ -194,16 +194,16 @@ void UBTGAdaptableText::onTextChanged() { qreal documentSize = document()->size().height(); if(height() == documentSize + mBottomMargin){ - return; + return; } mIsUpdatingSize = true; if(documentSize < mMinimumHeight){ - setFixedHeight(mMinimumHeight); + setFixedHeight(mMinimumHeight); } else{ - setFixedHeight(documentSize+mBottomMargin); + setFixedHeight(documentSize+mBottomMargin); } updateGeometry(); @@ -239,45 +239,45 @@ void UBTGAdaptableText::bottomMargin(int newValue) void UBTGAdaptableText::focusInEvent(QFocusEvent* e) { - if(isReadOnly()){ - e->ignore(); - } - managePlaceholder(true); - QTextEdit::focusInEvent(e); + if(isReadOnly()){ + e->ignore(); + } + managePlaceholder(true); + QTextEdit::focusInEvent(e); } void UBTGAdaptableText::focusOutEvent(QFocusEvent* e) { - managePlaceholder(false); - QTextEdit::focusOutEvent(e); + managePlaceholder(false); + QTextEdit::focusOutEvent(e); } void UBTGAdaptableText::managePlaceholder(bool focus) { - if(focus){ - if(toPlainText() == mPlaceHolderText){ - setTextColor(QColor(Qt::black)); - setPlainText(""); - } - setCursorToTheEnd(); - } - else{ - if(toPlainText().isEmpty()){ - setTextColor(QColor(Qt::lightGray)); - setPlainText(mPlaceHolderText); - } - } + if(focus){ + if(toPlainText() == mPlaceHolderText){ + setTextColor(QColor(Qt::black)); + setPlainText(""); + } + setCursorToTheEnd(); + } + else{ + if(toPlainText().isEmpty()){ + setTextColor(QColor(Qt::lightGray)); + setPlainText(mPlaceHolderText); + } + } } void UBTGAdaptableText::setCursorToTheEnd() { - QTextDocument* doc = document(); - if(NULL != doc){ - QTextBlock block = doc->lastBlock(); - QTextCursor cursor(doc); - cursor.setPosition(block.position() + block.length() - 1); - setTextCursor(cursor); - } + QTextDocument* doc = document(); + if(NULL != doc){ + QTextBlock block = doc->lastBlock(); + QTextCursor cursor(doc); + cursor.setPosition(block.position() + block.length() - 1); + setTextCursor(cursor); + } } /*************************************************************************** @@ -288,10 +288,10 @@ UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView , mDragStarted(false) { - if(!relativePath.startsWith("file://")) - mRelativePath = QUrl::fromLocalFile(relativePath).toString(); - else - mRelativePath = relativePath; + if(!relativePath.startsWith("file://")) + mRelativePath = QUrl::fromLocalFile(relativePath).toString(); + else + mRelativePath = relativePath; //NOOP } @@ -438,7 +438,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData() tUBGEElementNode* result = new tUBGEElementNode(); QString relativePath = mMediaPath; relativePath = relativePath.replace(UBApplication::boardController->selectedDocument()->persistencePath()+"/",""); - result->name = "media"; + result->name = "media"; result->attributes.insert("title",mpTitle->text()); result->attributes.insert("relativePath",relativePath); result->attributes.insert("mediaType",mMediaType); @@ -598,7 +598,7 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event) QMimeData *mimeData = new QMimeData(); QList urlList; #ifdef Q_WS_WIN - urlList << QUrl::fromLocalFile(mMediaPath); + urlList << QUrl::fromLocalFile(mMediaPath); #else urlList << QUrl(mMediaPath); #endif @@ -644,11 +644,11 @@ UBTGUrlWidget::~UBTGUrlWidget() void UBTGUrlWidget::onUrlEditionFinished() { - QString url = mpUrl->text(); - if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){ - mpUrl->setText("http://" + mpUrl->text()); - setFocus(); - } + QString url = mpUrl->text(); + if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){ + mpUrl->setText("http://" + mpUrl->text()); + setFocus(); + } } void UBTGUrlWidget::initializeWithDom(QDomElement element) diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index 01ed39a3..38c93763 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -224,11 +224,11 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event) return; } //if(sceneItem){ - // int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); - // if(pageIndex == 0){ + // int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); + // if(pageIndex == 0){ // event->ignore(); // return; - // } + // } //} mMousePressScenePos = mapToScene(mMousePressPos); @@ -846,15 +846,15 @@ void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *even void UBSceneThumbnailNavigPixmap::updateButtonsState() { - bCanDelete = false; + bCanDelete = false; bCanMoveUp = false; bCanMoveDown = false; bCanDuplicate = false; if(proxy()){ - int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneIndex()); - UBDocumentController* documentController = UBApplication::documentController; - bCanDelete = documentController->pageCanBeDeleted(pageIndex); + int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneIndex()); + UBDocumentController* documentController = UBApplication::documentController; + bCanDelete = documentController->pageCanBeDeleted(pageIndex); bCanMoveUp = documentController->pageCanBeMovedUp(pageIndex); bCanMoveDown = documentController->pageCanBeMovedDown(pageIndex); bCanDuplicate = documentController->pageCanBeDuplicated(pageIndex); @@ -866,14 +866,14 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() 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()))){ - UBApplication::boardController->deleteScene(sceneIndex()); - } + 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()); + } } void UBSceneThumbnailNavigPixmap::duplicatePage() { - UBApplication::boardController->duplicateScene(sceneIndex()); + UBApplication::boardController->duplicateScene(sceneIndex()); } void UBSceneThumbnailNavigPixmap::moveUpPage() @@ -891,17 +891,17 @@ void UBSceneThumbnailNavigPixmap::moveDownPage() void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal height) { int labelSpacing = 0; - if(this->caption) - { + if(this->caption) + { QFontMetrics fm(this->caption->font()); labelSpacing = UBSettings::thumbnailSpacing + fm.height(); - } - if(this->thumbnail) - { + } + if(this->thumbnail) + { int w = this->thumbnail->boundingRect().width(); int h = this->thumbnail->boundingRect().height(); - qreal scaleWidth = width / w; + qreal scaleWidth = width / w; qreal scaleHeight = height / h; qreal scaleFactor = qMin(scaleWidth, scaleHeight); UBThumbnail* pix = dynamic_cast(this->thumbnail); @@ -924,8 +924,8 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh this->thumbnail->setPos(pos); - if(this->caption) - { + if(this->caption) + { QFontMetrics fm(this->caption->font()); 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 qreal labelWidth = fm.width(elidedText); pos.setX(border + (width - labelWidth) / 2 + col * (width + border)); this->caption->setPos(pos); - } - } + } + } } diff --git a/src/gui/UBThumbnailWidget.h b/src/gui/UBThumbnailWidget.h index d78cbc93..6046c0e0 100644 --- a/src/gui/UBThumbnailWidget.h +++ b/src/gui/UBThumbnailWidget.h @@ -408,27 +408,27 @@ class UBThumbnailTextItem : public QGraphicsTextItem class UBImgTextThumbnailElement { private: - UBSceneThumbnailNavigPixmap* thumbnail; - UBThumbnailTextItem* caption; - int border; + UBSceneThumbnailNavigPixmap* thumbnail; + UBThumbnailTextItem* caption; + int border; public: - UBImgTextThumbnailElement(UBSceneThumbnailNavigPixmap* thumb, UBThumbnailTextItem* text): border(0) - { - this->thumbnail = thumb; - this->caption = text; - } + UBImgTextThumbnailElement(UBSceneThumbnailNavigPixmap* thumb, UBThumbnailTextItem* text): border(0) + { + this->thumbnail = thumb; + this->caption = text; + } - UBSceneThumbnailNavigPixmap* getThumbnail() const { return this->thumbnail; } - void setThumbnail(UBSceneThumbnailNavigPixmap* newGItem) { this->thumbnail = newGItem; } + UBSceneThumbnailNavigPixmap* getThumbnail() const { return this->thumbnail; } + void setThumbnail(UBSceneThumbnailNavigPixmap* newGItem) { this->thumbnail = newGItem; } - UBThumbnailTextItem* getCaption() const { return this->caption; } - void setCaption(UBThumbnailTextItem* newcaption) { this->caption = newcaption; } + UBThumbnailTextItem* getCaption() const { return this->caption; } + 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; } - void setBorder(int newBorder) { this->border = newBorder; } + int getBorder() const { return this->border; } + void setBorder(int newBorder) { this->border = newBorder; } }; diff --git a/src/network/UBNetworkAccessManager.h b/src/network/UBNetworkAccessManager.h index 796a1053..13afaf0e 100644 --- a/src/network/UBNetworkAccessManager.h +++ b/src/network/UBNetworkAccessManager.h @@ -36,7 +36,7 @@ class UBNetworkAccessManager : public QNetworkAccessManager UBNetworkAccessManager(QObject *parent = 0); - virtual QNetworkReply *get(const QNetworkRequest &request); + virtual QNetworkReply *get(const QNetworkRequest &request); protected: virtual QNetworkReply * createRequest ( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 ); diff --git a/src/pdf-merger/AbstractBoxElementHandler.h b/src/pdf-merger/AbstractBoxElementHandler.h index 457a71d1..ae7babee 100644 --- a/src/pdf-merger/AbstractBoxElementHandler.h +++ b/src/pdf-merger/AbstractBoxElementHandler.h @@ -43,7 +43,7 @@ namespace merge_lib protected: void _retrieveBoxFromParent() - { + { std::string content = _page->getObjectContent(); std::string mediaBox; Object * parent = _page; @@ -72,8 +72,8 @@ namespace merge_lib { unsigned int startOfMediaBox = _page->getObjectContent().rfind(">>"); _page->insertToContent(startOfMediaBox, mediaBox); - _changeObjectContent(startOfMediaBox); - } + _changeObjectContent(startOfMediaBox); + } } private: virtual void _changeObjectContent(unsigned int startOfPageElement) = 0; diff --git a/src/pdf-merger/CropBoxElementHandler.h b/src/pdf-merger/CropBoxElementHandler.h index 1481e1d0..339716de 100644 --- a/src/pdf-merger/CropBoxElementHandler.h +++ b/src/pdf-merger/CropBoxElementHandler.h @@ -65,7 +65,7 @@ namespace merge_lib _page->insertToContent(startOfPageElement, matrix.str()); } void _pageElementNotFound() - { + { _retrieveBoxFromParent(); } }; diff --git a/src/pdf-merger/Document.cpp b/src/pdf-merger/Document.cpp index 6074d479..1571b57a 100644 --- a/src/pdf-merger/Document.cpp +++ b/src/pdf-merger/Document.cpp @@ -114,7 +114,7 @@ void Document::saveAs(const char * newFileName) for ( sizeIterator = sizesAndGenerationNumbers.begin() ; sizeIterator != sizesAndGenerationNumbers.end(); sizeIterator++ ) { out << std::setfill('0')<getObjectNumber() << " 0 R\n >>\nstartxref\n" << sizeInXref << "\n%%EOF"; diff --git a/src/pdf-merger/LZWDecode.cpp b/src/pdf-merger/LZWDecode.cpp index 6c1aebec..654f6cc0 100644 --- a/src/pdf-merger/LZWDecode.cpp +++ b/src/pdf-merger/LZWDecode.cpp @@ -120,7 +120,7 @@ bool LZWDecode::decode(std::string & encoded) // LZW decoding std::string decoded; struct DecodingTable - { + { int length; int head; unsigned tail; @@ -128,7 +128,7 @@ bool LZWDecode::decode(std::string & encoded) int prevCode = 0; int newChar = 0; - unsigned curSequence[4097]; + unsigned curSequence[4097]; int nextLength = 0; clearTable(); @@ -219,7 +219,7 @@ bool LZWDecode::decode(std::string & encoded) { _predict->decode(encoded); } - return true; + return true; } diff --git a/src/pdf-merger/LZWDecode.h b/src/pdf-merger/LZWDecode.h index 5fc65fc3..2c7df0c0 100644 --- a/src/pdf-merger/LZWDecode.h +++ b/src/pdf-merger/LZWDecode.h @@ -50,12 +50,12 @@ namespace merge_lib std::string &_encoded; size_t _curSymbolIndex; - int _earlyChange; // early parameter - int _readBuf; - int _readBits; + int _earlyChange; // early parameter + int _readBuf; + int _readBits; int _nextCode; int _bitsToRead; - bool _first; + bool _first; int _curSequenceLength; }; } diff --git a/src/pdf-merger/MediaBoxElementHandler.h b/src/pdf-merger/MediaBoxElementHandler.h index e4928ac5..c6afd376 100644 --- a/src/pdf-merger/MediaBoxElementHandler.h +++ b/src/pdf-merger/MediaBoxElementHandler.h @@ -49,7 +49,7 @@ namespace merge_lib { if(_wasCropBoxHandlerCalled()) { - PageElementHandler * tempNextHandler = _nextHandler; + PageElementHandler * tempNextHandler = _nextHandler; _nextHandler = new RemoveHimselfHandler(_page, _handlerName); _nextHandler->addNextHandler(tempNextHandler); return; @@ -61,7 +61,7 @@ namespace merge_lib _page->insertToContent(startOfPageElement, matrix); } void _pageElementNotFound() - { + { if(_wasCropBoxHandlerCalled()) return; _retrieveBoxFromParent(); diff --git a/src/pdf-merger/Object.cpp b/src/pdf-merger/Object.cpp index 4de475ea..5543abab 100644 --- a/src/pdf-merger/Object.cpp +++ b/src/pdf-merger/Object.cpp @@ -36,7 +36,7 @@ std::string NUMBERANDWHITESPACE(" 0123456789"); Object::~Object() -{ +{ _parents.clear(); _children.clear(); _content.clear(); @@ -107,8 +107,8 @@ void Object::forgetAboutChildren(unsigned int leftBound, unsigned int rightBound { std::vector children = getChildrenByBounds(leftBound, rightBound); 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 } void Object::insertToContent(unsigned int position, const char * insertedStr, unsigned int length) -{ +{ _recalculateReferencePositions(position, length); - _content.insert(position, insertedStr, length); + _content.insert(position, insertedStr, length); } //vector @@ -263,9 +263,9 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair(std::log10(static_cast(_number))) + 1) + 14 + _content.size() + stream.size(); @@ -285,13 +285,13 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair obj - // - //endobj - //Object can contain several links to other object. These objects has been named "children". - //Each reference (child object) should be kept with it position(s) in object's content. - //After each content modification, all references should be changed too. - //This convention lighten the recalculation object numbers work. - class Object - { - public: - friend class PageElementHandler; - typedef std::vector ReferencePositionsInContent; - typedef std::pair ChildAndItPositionInContent; - typedef std::map Children; - Object(unsigned int objectNumber, unsigned int generationNumber, const std::string & objectContent, - std::string fileName = "", std::pair streamBounds = std::make_pair ((unsigned int)0,(unsigned int)0), bool hasStream = false - ): - _number(objectNumber), _generationNumber(generationNumber), _oldNumber(objectNumber), _content(objectContent),_parents(),_children(),_isPassed(false), + //This class represents pdf objects, and defines methods for performing + //all necessary operations on pdf objects + //Each object consists of two parts: content and object's number + // obj + // + //endobj + //Object can contain several links to other object. These objects has been named "children". + //Each reference (child object) should be kept with it position(s) in object's content. + //After each content modification, all references should be changed too. + //This convention lighten the recalculation object numbers work. + class Object + { + public: + friend class PageElementHandler; + typedef std::vector ReferencePositionsInContent; + typedef std::pair ChildAndItPositionInContent; + typedef std::map Children; + Object(unsigned int objectNumber, unsigned int generationNumber, const std::string & objectContent, + std::string fileName = "", std::pair streamBounds = std::make_pair ((unsigned int)0,(unsigned int)0), bool hasStream = false + ): + _number(objectNumber), _generationNumber(generationNumber), _oldNumber(objectNumber), _content(objectContent),_parents(),_children(),_isPassed(false), _streamBounds(streamBounds), _fileName(fileName), _hasStream(hasStream), _hasStreamInContent(false) - { - } - virtual ~Object(); - Object * getClone(std::vector & clones); - void addChild(Object * child, const std::vector childPositionsInContent); - void addChild(const Children & children); - ReferencePositionsInContent removeChild(Object * child); - void forgetAboutChildren(unsigned int leftBound, unsigned int rightBound); - Object * getChild(unsigned int objectNumber); - bool findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent); - std::vector getChildrenByBounds(unsigned int leftBound, unsigned int rightBound); - std::vector getSortedByPositionChildren(unsigned int leftBound, unsigned int rightBound); - void removeChildrenByBounds(unsigned int leftBound, unsigned int rightBound); - const Children & getChildren(); - - void removeHimself(); - - unsigned int getObjectNumber() const; - unsigned int getgenerationNumber() const; - - - std::string & getObjectContent(); - - void setObjectContent(const std::string & objectContent); - void appendContent(const std::string & addToContent); - void eraseContent(unsigned int from, unsigned int size); - void insertToContent(unsigned int position, const char * insertedStr, unsigned int length); - void insertToContent(unsigned int position, const std::string & insertedStr); - - //vector - void serialize(std::ofstream & out, std::map< unsigned int, std::pair > & sizesAndGenerationNumbers); - - void recalculateObjectNumbers(unsigned int & newNumber); - - bool isPassed() - { - return _isPassed; - } - void retrieveMaxObjectNumber(unsigned int & maxNumber); - void resetIsPassed() - { - if(_isPassed) - _isPassed = false; - Children::iterator it; - for ( it=_children.begin() ; it != _children.end(); it++ ) - { - if((*it).second.first->isPassed()) - (*it).second.first->resetIsPassed(); - } - - } - unsigned int getOldNumber() - { - return _oldNumber; - } - void setObjectNumber(unsigned int objNumber) - { - _number = objNumber; - _oldNumber = objNumber; - - } - bool getStream(std::string &); - bool hasStream(); - bool getHeader(std::string &content); - void forgetStreamInFile() - { - _hasStreamInContent = true; - _hasStream = true; - } - - std::string getNameSimpleValue(const std::string &content, const std::string &patten, size_t pos = 0); - - unsigned int getChildPosition(const Object * child); //throw (Exception) - const std::set & getParents() - { - return _parents; - } - + { + } + virtual ~Object(); + Object * getClone(std::vector & clones); + void addChild(Object * child, const std::vector childPositionsInContent); + void addChild(const Children & children); + ReferencePositionsInContent removeChild(Object * child); + void forgetAboutChildren(unsigned int leftBound, unsigned int rightBound); + Object * getChild(unsigned int objectNumber); + bool findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent); + std::vector getChildrenByBounds(unsigned int leftBound, unsigned int rightBound); + std::vector getSortedByPositionChildren(unsigned int leftBound, unsigned int rightBound); + void removeChildrenByBounds(unsigned int leftBound, unsigned int rightBound); + const Children & getChildren(); + + void removeHimself(); + + unsigned int getObjectNumber() const; + unsigned int getgenerationNumber() const; + + + std::string & getObjectContent(); + + void setObjectContent(const std::string & objectContent); + void appendContent(const std::string & addToContent); + void eraseContent(unsigned int from, unsigned int size); + void insertToContent(unsigned int position, const char * insertedStr, unsigned int length); + void insertToContent(unsigned int position, const std::string & insertedStr); + + //vector + void serialize(std::ofstream & out, std::map< unsigned int, std::pair > & sizesAndGenerationNumbers); + + void recalculateObjectNumbers(unsigned int & newNumber); + + bool isPassed() + { + return _isPassed; + } + void retrieveMaxObjectNumber(unsigned int & maxNumber); + void resetIsPassed() + { + if(_isPassed) + _isPassed = false; + Children::iterator it; + for ( it=_children.begin() ; it != _children.end(); it++ ) + { + if((*it).second.first->isPassed()) + (*it).second.first->resetIsPassed(); + } + + } + unsigned int getOldNumber() + { + return _oldNumber; + } + void setObjectNumber(unsigned int objNumber) + { + _number = objNumber; + _oldNumber = objNumber; + + } + bool getStream(std::string &); + bool hasStream(); + bool getHeader(std::string &content); + void forgetStreamInFile() + { + _hasStreamInContent = true; + _hasStream = true; + } + + std::string getNameSimpleValue(const std::string &content, const std::string &patten, size_t pos = 0); + + unsigned int getChildPosition(const Object * child); //throw (Exception) + const std::set & getParents() + { + return _parents; + } + Object* findPatternInObjOrParents(const std::string &pattern); - private: - //methods - Object(const Object & copy); - Object * _getClone(std::map & clones); - void _addChild(Object * child, const ReferencePositionsInContent & childPositionsInContent); - void _setObjectNumber(unsigned int objectNumber); - void _addParent(Object * child); - bool _findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent); - void _serialize(std::ofstream & out, const std::string & stream); - void _recalculateObjectNumbers(unsigned int & maxNumber); - void _recalculateReferencePositions(unsigned int changedReference, int displacement); - void _retrieveMaxObjectNumber(unsigned int & maxNumber); - void _serialize(std::ofstream & out, std::map & sizes); + private: + //methods + Object(const Object & copy); + Object * _getClone(std::map & clones); + void _addChild(Object * child, const ReferencePositionsInContent & childPositionsInContent); + void _setObjectNumber(unsigned int objectNumber); + void _addParent(Object * child); + bool _findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent); + void _serialize(std::ofstream & out, const std::string & stream); + void _recalculateObjectNumbers(unsigned int & maxNumber); + void _recalculateReferencePositions(unsigned int changedReference, int displacement); + void _retrieveMaxObjectNumber(unsigned int & maxNumber); + void _serialize(std::ofstream & out, std::map & sizes); bool _getStreamFromContent(std::string & stream); - //members - unsigned int _number; - unsigned int _generationNumber; - unsigned int _oldNumber; - std::string _content; - std::set _parents; - Children _children; - bool _isPassed; - std::pair _streamBounds; - std::string _fileName; - bool _hasStream; - bool _hasStreamInContent; - - }; + //members + unsigned int _number; + unsigned int _generationNumber; + unsigned int _oldNumber; + std::string _content; + std::set _parents; + Children _children; + bool _isPassed; + std::pair _streamBounds; + std::string _fileName; + bool _hasStream; + bool _hasStreamInContent; + + }; } #endif diff --git a/src/pdf-merger/OverlayDocumentParser.cpp b/src/pdf-merger/OverlayDocumentParser.cpp index afadb699..e5c1c8e3 100644 --- a/src/pdf-merger/OverlayDocumentParser.cpp +++ b/src/pdf-merger/OverlayDocumentParser.cpp @@ -58,7 +58,7 @@ void OverlayDocumentParser::_readXRefAndCreateObjects() for(objAndPIter = objectsAndPositions.begin(); objAndPIter != objectsAndPositions.end(); ++objAndPIter) { if((objAndPIter->second > objAndSIter->second) && (objAndPIter->second < nextPosition)) - nextPosition = objAndPIter->second; + nextPosition = objAndPIter->second; } objectsAndSizes[objAndSIter->first] = nextPosition - objAndSIter->second; } @@ -73,7 +73,7 @@ void OverlayDocumentParser::_readXRefAndCreateObjects() if(objIter->second < partStart) partStart = objIter->second; } - unsigned long nextPartStart = partStart + partSize; + unsigned long nextPartStart = partStart + partSize; if((nextPartStart) < fileSize) _getPartOfFileContent(partStart, partSize); @@ -90,18 +90,18 @@ void OverlayDocumentParser::_readXRefAndCreateObjects() { std::pair streamBounds; unsigned int objectNumber; - unsigned int generationNumber; + unsigned int generationNumber; bool hasObjectStream; const std::string content = _getObjectContent(objIter->second - partStart, objectNumber, generationNumber, streamBounds, hasObjectStream); streamBounds.first += partStart; streamBounds.second += partStart; Object * newObject = new Object(objectNumber, generationNumber, content, _document->_documentName ,streamBounds, hasObjectStream); _objects[objectNumber] = newObject; - std::map::iterator temp = objIter; + std::map::iterator temp = objIter; ++objIter; objectsAndPositions.erase(temp); continue; - } + } ++objIter; } partStart = nextPartStart; diff --git a/src/pdf-merger/OverlayDocumentParser.h b/src/pdf-merger/OverlayDocumentParser.h index ae21b560..723ff5fd 100644 --- a/src/pdf-merger/OverlayDocumentParser.h +++ b/src/pdf-merger/OverlayDocumentParser.h @@ -43,20 +43,20 @@ namespace merge_lib Document * parseDocument(const char * fileName); protected: - unsigned int _readTrailerAndReturnRoot(); + unsigned int _readTrailerAndReturnRoot(); private: - //methods + //methods void _getFileContent(const char * fileName); void _readXRefAndCreateObjects(); - void _readXref(std::map & objectsAndSizes); - void _getPartOfFileContent(long startOfPart, unsigned int length); + void _readXref(std::map & objectsAndSizes); + void _getPartOfFileContent(long startOfPart, unsigned int length); unsigned int _getStartOfXrefWithRoot(); - //constants - static int DOC_PART_WITH_START_OF_XREF; + //constants + static int DOC_PART_WITH_START_OF_XREF; - //members - std::string _fileName; + //members + std::string _fileName; }; } #endif diff --git a/src/pdf-merger/Parser.cpp b/src/pdf-merger/Parser.cpp index 6c57090a..c0b3b166 100644 --- a/src/pdf-merger/Parser.cpp +++ b/src/pdf-merger/Parser.cpp @@ -184,7 +184,7 @@ void Parser::_createObjectTree(const char * fileName) for(; refsIterator != refs.end(); ++refsIterator) { if(_objects.count((*refsIterator).first)) - currentObject->addChild(_objects[(*refsIterator).first], (*refsIterator).second); + currentObject->addChild(_objects[(*refsIterator).first], (*refsIterator).second); } } _root = _objects[rootObjectNumber]; diff --git a/src/pdf-merger/Parser.h b/src/pdf-merger/Parser.h index 1ef3a455..df4a0f98 100644 --- a/src/pdf-merger/Parser.h +++ b/src/pdf-merger/Parser.h @@ -60,7 +60,7 @@ namespace merge_lib static bool tokenIsAName(const std::string &content, size_t start ); protected: const std::string & _getObjectContent(unsigned int objectPosition, unsigned int & objectNumber, unsigned int & generationNumber, std::pair &, bool &); - virtual unsigned int _readTrailerAndReturnRoot(); + virtual unsigned int _readTrailerAndReturnRoot(); private: //methods virtual void _getFileContent(const char * fileName); @@ -77,7 +77,7 @@ namespace merge_lib unsigned int _skipWhiteSpaces(const std::string & str); unsigned int _skipWhiteSpacesFromContent(unsigned int fromPosition); const std::map & _getReferences(const std::string & objectContent); - unsigned int _skipNumber(const std::string & str, unsigned int currentPosition); + unsigned int _skipNumber(const std::string & str, unsigned int currentPosition); unsigned int _skipWhiteSpaces(const std::string & str, unsigned int fromPosition); void _createDocument(const char * docName); virtual unsigned int _getStartOfXrefWithRoot(); diff --git a/src/pdf-merger/RemoveHimSelfHandler.h b/src/pdf-merger/RemoveHimSelfHandler.h index 5ba19b72..ba2e8d4d 100644 --- a/src/pdf-merger/RemoveHimSelfHandler.h +++ b/src/pdf-merger/RemoveHimSelfHandler.h @@ -28,21 +28,21 @@ namespace merge_lib { - //This class remove field from Page object's content. - class RemoveHimselfHandler: public PageElementHandler - { - public: - RemoveHimselfHandler(Object * page, const std::string & handlerName): PageElementHandler(page) - { - _setHandlerName(handlerName); - } - virtual ~RemoveHimselfHandler() - { - } - private: - //methods - virtual void _changeObjectContent(unsigned int startOfPageElement); - }; + //This class remove field from Page object's content. + class RemoveHimselfHandler: public PageElementHandler + { + public: + RemoveHimselfHandler(Object * page, const std::string & handlerName): PageElementHandler(page) + { + _setHandlerName(handlerName); + } + virtual ~RemoveHimselfHandler() + { + } + private: + //methods + virtual void _changeObjectContent(unsigned int startOfPageElement); + }; } #endif diff --git a/src/pdf-merger/RotationHandler.h b/src/pdf-merger/RotationHandler.h index 9d749fc9..ebbe8149 100644 --- a/src/pdf-merger/RotationHandler.h +++ b/src/pdf-merger/RotationHandler.h @@ -39,7 +39,7 @@ namespace merge_lib PageElementHandler(page), _basePage(basePage) { - _setHandlerName(handlerName); + _setHandlerName(handlerName); } virtual ~RotationHandler() { diff --git a/src/pdf-merger/Utils.cpp b/src/pdf-merger/Utils.cpp index 5bd2edb7..5fec7279 100644 --- a/src/pdf-merger/Utils.cpp +++ b/src/pdf-merger/Utils.cpp @@ -120,7 +120,7 @@ unsigned long Utils::getFileSize(const char * fileName) pdfFile.open (fileName, std::ios::binary ); if (pdfFile.fail()) { - std::stringstream errorMessage("File "); + std::stringstream errorMessage("File "); errorMessage << fileName << " is absent" << "\0"; throw Exception(errorMessage); } diff --git a/src/pdf/PDFRenderer.h b/src/pdf/PDFRenderer.h index 0c8ea404..cde268f6 100644 --- a/src/pdf/PDFRenderer.h +++ b/src/pdf/PDFRenderer.h @@ -58,7 +58,7 @@ class PDFRenderer : public QObject QUuid fileUuid() const { return mFileUuid; } QByteArray fileData() const { return mFileData; } - void setDPI(int desiredDPI) { this->dpiForRendering = desiredDPI; } + void setDPI(int desiredDPI) { this->dpiForRendering = desiredDPI; } public slots: virtual void render(QPainter *p, int pageNumber, const QRectF &bounds = QRectF()) = 0; @@ -74,9 +74,9 @@ class PDFRenderer : public QObject static QMap< QUuid, QPointer > sRenderers; - protected: - int dpiForRendering; - PDFRenderer(); + protected: + int dpiForRendering; + PDFRenderer(); }; #endif // PDFRENDERER_H diff --git a/src/pdf/XPDFRenderer.cpp b/src/pdf/XPDFRenderer.cpp index 0b7e6053..59cbbe64 100644 --- a/src/pdf/XPDFRenderer.cpp +++ b/src/pdf/XPDFRenderer.cpp @@ -120,15 +120,15 @@ QSizeF XPDFRenderer::pageSizeF(int pageNumber) const { int rotate = mDocument->getPageRotate(pageNumber); - cropWidth = mDocument->getPageCropWidth(pageNumber) * this->dpiForRendering / 72.0; + cropWidth = mDocument->getPageCropWidth(pageNumber) * this->dpiForRendering / 72.0; cropHeight = mDocument->getPageCropHeight(pageNumber) * this->dpiForRendering / 72.0; if (rotate == 90 || rotate == 270) { //switching width and height - qreal tmpVar = cropWidth; - cropWidth = cropHeight; - cropHeight = tmpVar; + qreal tmpVar = cropWidth; + cropWidth = cropHeight; + cropHeight = tmpVar; } } return QSizeF(cropWidth, cropHeight); @@ -156,7 +156,7 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds) p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), *pdfImage); p->setWorldTransform(savedTransform); delete pdfImage; - } + } } QImage* XPDFRenderer::createPDFImage(int pageNumber, qreal xscale, qreal yscale, const QRectF &bounds) @@ -177,18 +177,18 @@ QImage* XPDFRenderer::createPDFImage(int pageNumber, qreal xscale, qreal yscale, if (bounds.isNull()) { - mDocument->displayPage(mSplash, pageNumber, this->dpiForRendering * xscale, this->dpiForRendering *yscale, + mDocument->displayPage(mSplash, pageNumber, this->dpiForRendering * xscale, this->dpiForRendering *yscale, rotation, useMediaBox, crop, printing); } else { - mSliceX = bounds.x() * xscale; + mSliceX = bounds.x() * xscale; mSliceY = bounds.y() * yscale; qreal sliceW = bounds.width() * xscale; qreal sliceH = bounds.height() * yscale; mDocument->displayPageSlice(mSplash, pageNumber, this->dpiForRendering * xscale, this->dpiForRendering * yscale, - rotation, useMediaBox, crop, printing, mSliceX, mSliceY, sliceW, sliceH); + rotation, useMediaBox, crop, printing, mSliceX, mSliceY, sliceW, sliceH); } mpSplashBitmap = mSplash->getBitmap(); diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 7e9d2963..043628f1 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -706,15 +706,15 @@ void UBPodcastController::encodingFinished(bool ok) { if (!mApplicationIsClosing) { - QString location; + QString location; - if (mPodcastRecordingPath == QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)) - location = tr("on your desktop ..."); - else - { - QDir dir(mPodcastRecordingPath); - location = tr("in folder %1").arg(mPodcastRecordingPath); - } + if (mPodcastRecordingPath == QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)) + location = tr("on your desktop ..."); + else + { + QDir dir(mPodcastRecordingPath); + location = tr("in folder %1").arg(mPodcastRecordingPath); + } UBApplication::showMessage(tr("Podcast created %1").arg(location), false); @@ -829,7 +829,7 @@ void UBPodcastController::toggleRecordingPalette(bool visible) - mRecordingPalette->width() / 2; int top = UBApplication::boardController->controlView()->height() - - mRecordingPalette->height() - UBSettings::boardMargin; + - mRecordingPalette->height() - UBSettings::boardMargin; QPoint controlViewPoint(left, top); QPoint mainWindowsPoint = UBApplication::boardController->controlView()->mapTo(UBApplication::mainWindow, controlViewPoint); diff --git a/src/tools/UBAbstractDrawRuler.cpp b/src/tools/UBAbstractDrawRuler.cpp index d7350501..9fee5da4 100644 --- a/src/tools/UBAbstractDrawRuler.cpp +++ b/src/tools/UBAbstractDrawRuler.cpp @@ -49,19 +49,19 @@ const int UBAbstractDrawRuler::sRoundingRadius = sLeftEdgeMargin / 2; UBAbstractDrawRuler::UBAbstractDrawRuler() - : mShowButtons(false) + : mShowButtons(false) , mAntiScaleRatio(1.0) { - //we actually need to evaluate pixels per millimeter - QDesktopWidget* desktop = UBApplication::desktop(); - int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; + //we actually need to evaluate pixels per millimeter + QDesktopWidget* desktop = UBApplication::desktop(); + int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; sPixelsPerMillimeter = qRound(dpiCommon / UBGeometryUtils::inchSize); } void UBAbstractDrawRuler::create(QGraphicsItem& item) { - item.setFlag(QGraphicsItem::ItemIsMovable, true); + item.setFlag(QGraphicsItem::ItemIsMovable, true); item.setFlag(QGraphicsItem::ItemIsSelectable, true); item.setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); @@ -94,7 +94,7 @@ QCursor UBAbstractDrawRuler::closeCursor() const QCursor UBAbstractDrawRuler::drawRulerLineCursor() const { - return UBResources::resources()->drawLineRulerCursor; + return UBResources::resources()->drawLineRulerCursor; } QColor UBAbstractDrawRuler::drawColor() const diff --git a/src/tools/UBGraphicsProtractor.h b/src/tools/UBGraphicsProtractor.h index d77d2dd8..6de2eee7 100644 --- a/src/tools/UBGraphicsProtractor.h +++ b/src/tools/UBGraphicsProtractor.h @@ -40,7 +40,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse public: UBGraphicsProtractor (); - enum Tool {None, Move, Resize, Rotate, Reset, Close, MoveMarker}; + enum Tool {None, Move, Resize, Rotate, Reset, Close, MoveMarker}; qreal angle () { return mStartAngle; } qreal markerAngle () { return mCurrentAngle; } @@ -83,17 +83,17 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse QSizeF buttonSizeReference () const{return QSizeF(radius() / 10, mCloseSvgItem->boundingRect().height() * radius()/(10 * mCloseSvgItem->boundingRect().width()));} QSizeF markerSizeReference () const{return QSizeF(radius() / 10, mMarkerSvgItem->boundingRect().height() * radius()/(10 * mMarkerSvgItem->boundingRect().width()));} - QRectF resetButtonRect () const; - QRectF closeButtonRect () const; - QRectF resizeButtonRect () const; - QRectF rotateButtonRect () const{return QRectF(buttonSizeReference().width() * 5.5, -buttonSizeReference().width() * 5, buttonSizeReference().width(), buttonSizeReference().width());} - QRectF markerButtonRect () const{return QRectF(radius() + 3, -markerSizeReference().height() / 2 , markerSizeReference().width(), markerSizeReference().height());} + QRectF resetButtonRect () const; + QRectF closeButtonRect () const; + QRectF resizeButtonRect () const; + QRectF rotateButtonRect () const{return QRectF(buttonSizeReference().width() * 5.5, -buttonSizeReference().width() * 5, buttonSizeReference().width(), buttonSizeReference().width());} + QRectF markerButtonRect () const{return QRectF(radius() + 3, -markerSizeReference().height() / 2 , markerSizeReference().width(), markerSizeReference().height());} inline qreal radius () const{return rect().height() / 2 - 20;} // Members QPointF mPreviousMousePos; Tool mCurrentTool; - bool mShowButtons; + bool mShowButtons; qreal mCurrentAngle; qreal mSpan; qreal mStartAngle; @@ -102,12 +102,12 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse QGraphicsSvgItem* mResetSvgItem; QGraphicsSvgItem* mResizeSvgItem; QGraphicsSvgItem* mMarkerSvgItem; - QGraphicsSvgItem* mRotateSvgItem; + QGraphicsSvgItem* mRotateSvgItem; static const QRectF sDefaultRect; virtual void rotateAroundCenter(qreal angle); - virtual QPointF rotationCenter() const; + virtual QPointF rotationCenter() const; int sFillTransparency; int sDrawTransparency; diff --git a/src/tools/UBGraphicsRuler.h b/src/tools/UBGraphicsRuler.h index d87da894..68575250 100644 --- a/src/tools/UBGraphicsRuler.h +++ b/src/tools/UBGraphicsRuler.h @@ -51,27 +51,27 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu virtual UBItem* deepCopy() const; virtual void copyItemParameters(UBItem *copy) const; - virtual void StartLine(const QPointF& position, qreal width); - virtual void DrawLine(const QPointF& position, qreal width); + virtual void StartLine(const QPointF& position, qreal width); + virtual void DrawLine(const QPointF& position, qreal width); virtual void EndLine(); protected: - + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); // Events - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); void paintGraduations(QPainter *painter); private: - bool mResizing; + bool mResizing; bool mRotating; @@ -80,11 +80,11 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu void paintRotationCenter(QPainter *painter); virtual void rotateAroundCenter(qreal angle); - QGraphicsSvgItem* mRotateSvgItem; - QGraphicsSvgItem* mResizeSvgItem; + QGraphicsSvgItem* mRotateSvgItem; + QGraphicsSvgItem* mResizeSvgItem; - void updateResizeCursor(); - QCursor resizeCursor() const{return mResizeCursor;} + void updateResizeCursor(); + QCursor resizeCursor() const{return mResizeCursor;} virtual QPointF rotationCenter() const; virtual QRectF resizeButtonRect() const; @@ -92,15 +92,15 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu virtual QRectF rotateButtonRect() const; virtual UBGraphicsScene* scene() const; - QCursor mResizeCursor; + QCursor mResizeCursor; - int drawLineDirection; + int drawLineDirection; // Constants static const QRect sDefaultRect; - static const int sMinLength = 150; // 3sm - static const int sMaxLength = 35000; // 700sm + static const int sMinLength = 150; // 3sm + static const int sMaxLength = 35000; // 700sm }; #endif /* UBGRAPHICSRULER_H_ */ diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp index d1dd709f..cd5e6daf 100644 --- a/src/web/UBWebController.cpp +++ b/src/web/UBWebController.cpp @@ -232,7 +232,7 @@ void UBWebController::tutorialWebInstance() } else - (*mCurrentWebBrowser)->loadUrl(currentUrl); + (*mCurrentWebBrowser)->loadUrl(currentUrl); mStackedWidget->setCurrentIndex(Tutorial); UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget()); diff --git a/src/web/UBWebController.h b/src/web/UBWebController.h index b13dcbca..cc5dac79 100644 --- a/src/web/UBWebController.h +++ b/src/web/UBWebController.h @@ -123,8 +123,8 @@ class UBWebController : public QObject UBTrapFlashController* mTrapFlashController; UBWebToolsPalette** mToolsCurrentPalette; UBWebToolsPalette* mToolsPaletteList[TotalNumberOfWebInstances]; -// UBKeyboardPalette** mKeyboardCurrentPalette; -// UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances]; +// UBKeyboardPalette** mKeyboardCurrentPalette; +// UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances]; bool mToolsPalettePositionned; bool mToolsPalettePositionnedList[TotalNumberOfWebInstances]; @@ -144,7 +144,7 @@ class UBWebController : public QObject void toggleWebTrap(bool checked); void onOEmbedParsed(QVector contents); -// void showKeyboard(bool checked); +// void showKeyboard(bool checked); signals: /** diff --git a/src/web/browser/WBBrowserWindow.cpp b/src/web/browser/WBBrowserWindow.cpp index c35b4dce..09bfef44 100644 --- a/src/web/browser/WBBrowserWindow.cpp +++ b/src/web/browser/WBBrowserWindow.cpp @@ -588,7 +588,7 @@ void WBBrowserWindow::aboutToShowBackMenu() if (!QWebSettings::iconForUrl(item.originalUrl()).isNull()) action->setIcon(item.icon()); - action->setText(item.title().isEmpty() ? item.url().toString() : item.title()); + action->setText(item.title().isEmpty() ? item.url().toString() : item.title()); mHistoryBackMenu->addAction(action); } diff --git a/src/web/browser/WBBrowserWindow.h b/src/web/browser/WBBrowserWindow.h index 74e3dff9..c79049ff 100644 --- a/src/web/browser/WBBrowserWindow.h +++ b/src/web/browser/WBBrowserWindow.h @@ -174,8 +174,8 @@ class WBBrowserWindow : public QWidget Ui::MainWindow* mUniboardMainWindow; - QMenu *mHistoryBackMenu; - QMenu *mHistoryForwardMenu; + QMenu *mHistoryBackMenu; + QMenu *mHistoryForwardMenu; }; #endif // WBBROWSERMAINWINDOW_H diff --git a/src/web/browser/WBUrlLineEdit.cpp b/src/web/browser/WBUrlLineEdit.cpp index fa75ad15..e93ce124 100644 --- a/src/web/browser/WBUrlLineEdit.cpp +++ b/src/web/browser/WBUrlLineEdit.cpp @@ -79,7 +79,7 @@ WBExLineEdit::WBExLineEdit(QWidget *parent) , mLineEdit(new QLineEdit(this)) , mClearButton(0) { - setFocusPolicy(mLineEdit->focusPolicy()); + setFocusPolicy(mLineEdit->focusPolicy()); setAttribute(Qt::WA_InputMethodEnabled); setSizePolicy(mLineEdit->sizePolicy()); setBackgroundRole(mLineEdit->backgroundRole());