Commit b2628d12 authored by Claudio Valerio's avatar Claudio Valerio

removed tab

parent a6c6ee3f
......@@ -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<UBGraphicsPDFItem*>(scene->backgroundObject());
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(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<UBGraphicsPDFItem*>(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;
......
......@@ -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()
......
......@@ -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)
......
......@@ -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<UBGraphicsItem*> 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();
......
......@@ -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_ */
......@@ -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()){
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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();
};
......
......@@ -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)
{
......
......@@ -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:
......
......@@ -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<QUrl>();
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<QUrl>();
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<QUrl>::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<QUrl>::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);
......
......@@ -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<QString,QString> & getMetadata() const { return metadata; }
void setMetadata( const QMap<QString,QString> &data ) { metadata = data; }
bool operator ==( const UBFeature &f )const;
bool operator !=( const UBFeature &f )const;
const QMap<QString,QString> & getMetadata() const { return metadata; }
void setMetadata( const QMap<QString,QString> &data ) { metadata = data; }
private:
......@@ -148,7 +148,7 @@ private:
QImage mThumbnail;
QString mName;
QString mDisplayName;
QUrl mPath;
QUrl mPath;
UBFeatureElementType elementType;
QMap<QString,QString> metadata;
};
......@@ -161,11 +161,11 @@ friend class UBFeaturesWidget;
Q_OBJECT
public:
UBFeaturesController(QWidget *parentWidget);
UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController();
QList <UBFeature>* 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 <UBFeature> *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 <QUrl> *favoriteSet;
QSet <QUrl> *favoriteSet;
public:
UBFeature trashElement;
......
......@@ -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,
......
......@@ -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("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>");
QString url;
QString _html;
QRegExp comments("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>");
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 <meta> 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)
......
......@@ -58,7 +58,7 @@ class UBApplication : public QtSingleApplication
int exec(const QString& pFileToImport);
void cleanup();
void cleanup();
static QPointer<QUndoStack> undoStack;
......
......@@ -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());
......
......@@ -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)
......
......@@ -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:
......
......@@ -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)
......
......@@ -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();
}
......@@ -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();
......
......@@ -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);
}
......@@ -488,7 +488,7 @@ void UBDocumentController::duplicateSelectedItem()
if (UBApplication::applicationController->displayMode() != UBApplicationController::Document)
return;
if (mSelectionType == Page)
if (mSelectionType == Page)
{
QList<QGraphicsItem*> selectedItems = mDocumentUI->thumbnailWidget->selectedItems();
QList<int> 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<QGraphicsItem*> 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<UBSceneThumbnailPixmap*>(selection.at(i))->sceneIndex() == 0){
mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0)));
firstSceneSelected = true;
}
}
if(!firstSceneSelected)
mMainWindow->actionDuplicate->setEnabled(!trashSelected);
}
QList<QGraphicsItem*> 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<UBSceneThumbnailPixmap*>(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))));
}
......
......@@ -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);
......
......@@ -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()
......
......@@ -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);
......
......@@ -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<UBGraphicsStrokesGroup*>(this)->resetTransform();
QTransform groupTransform = transform();
const_cast<UBGraphicsStrokesGroup*>(this)->resetTransform();
QList<QGraphicsItem*> chl = childItems();
QList<QGraphicsItem*> chl = childItems();
foreach(QGraphicsItem *child, chl)
{
UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child);
foreach(QGraphicsItem *child, chl)
{
UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child);
if (polygon){
if (polygon){
UBGraphicsPolygonItem *polygonCopy = dynamic_cast<UBGraphicsPolygonItem*>(polygon->deepCopy());
if (polygonCopy)
{
......@@ -154,18 +154,18 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
copy->addToGroup(pItem);
polygonCopy->setStrokesGroup(copy);
}
}
}
}
const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform);
copyItemParameters(copy);
}
const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform);
copyItemParameters(copy);
return copy;
return copy;
}
void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const
{
QGraphicsItem *cp = dynamic_cast<QGraphicsItem*>(copy);
QGraphicsItem *cp = dynamic_cast<QGraphicsItem*>(copy);
if(NULL != cp)
{
cp->setTransform(transform());
......
......@@ -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<SYMBOL_KEYS_COUNT; i++)
delete varSymbols[i];
delete [] varSymbols;
}
delete icon;
if (varSymbols!=NULL)
{
for(int i=0; i<SYMBOL_KEYS_COUNT; i++)
delete varSymbols[i];
delete [] varSymbols;
}
delete icon;
}
......@@ -63,7 +63,7 @@ UBKeyboardLocale** UBPlatformUtils::keyboardLayouts;
UBKeyboardLocale** UBPlatformUtils::getKeyboardLayouts(int& nCount)
{
nCount = nKeyboardLayouts;
return keyboardLayouts;
nCount = nKeyboardLayouts;
return keyboardLayouts;
}
......@@ -89,14 +89,14 @@ struct KEYCODE{
struct KEYBT
{
QChar symbol1;
QChar symbol2;
QChar symbol2;
bool capsLockSwitch;
int modifier1;
int modifier2;
KEYCODE codes[8];
KEYBT( QChar _symbol1,
QChar _symbol2,
QChar _symbol2,
bool _capsLockSwitch,
int _modifier1,
int _modifier2,
......@@ -130,40 +130,40 @@ struct KEYBT
class UBKeyboardLocale
{
public:
UBKeyboardLocale(const QString& _fullName,
const QString& _name,
const QString& _id,
QIcon* _icon,
KEYBT** _symbols)
:fullName(_fullName),name(_name), id(_id), icon(_icon),
class UBKeyboardLocale
{
public:
UBKeyboardLocale(const QString& _fullName,
const QString& _name,
const QString& _id,
QIcon* _icon,
KEYBT** _symbols)
:fullName(_fullName),name(_name), id(_id), icon(_icon),
constSymbols(NULL), varSymbols(_symbols)
{}
UBKeyboardLocale(const QString& _fullName,
const QString& _name,
const QString& _id,
QIcon* _icon,
{}
UBKeyboardLocale(const QString& _fullName,
const QString& _name,
const QString& _id,
QIcon* _icon,
KEYBT _symbols[])
:fullName(_fullName),name(_name), id(_id), icon(_icon),
:fullName(_fullName),name(_name), id(_id), icon(_icon),
constSymbols(_symbols), varSymbols(NULL)
{}
{}
~UBKeyboardLocale();
~UBKeyboardLocale();
const QString fullName;
const QString name;
const QString id;
QIcon* icon;
const QString fullName;
const QString name;
const QString id;
QIcon* icon;
KEYBT* operator[] (int index) const
{
return (varSymbols==NULL)? constSymbols + index : varSymbols[index];
}
private:
{
return (varSymbols==NULL)? constSymbols + index : varSymbols[index];
}
private:
KEYBT* constSymbols;
KEYBT** varSymbols;
};
KEYBT** varSymbols;
};
class UBPlatformUtils
......
......@@ -34,7 +34,7 @@
void UBPlatformUtils::init()
{
initializeKeyboardLayouts();
initializeKeyboardLayouts();
}
QString UBPlatformUtils::applicationResourcesDirectory()
......@@ -68,11 +68,11 @@ void UBPlatformUtils::fadeDisplayIn()
QStringList UBPlatformUtils::availableTranslations()
{
QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/";
QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath);
QRegExp sankoreTranslationFiles(".*sankore_.*.qm");
translationsList=translationsList.filter(sankoreTranslationFiles);
return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2");
QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/";
QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath);
QRegExp sankoreTranslationFiles(".*sankore_.*.qm");
translationsList=translationsList.filter(sankoreTranslationFiles);
return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2");
}
QString UBPlatformUtils::translationPath(QString pFilePrefix,QString pLanguage)
......@@ -351,57 +351,57 @@ KEYBT FRENCH_LOCALE[] = {
KEYBT SWISS_FRENCH_LOCALE[] = {
/* § °*/ KEYBTDECL(0xa7, 0xb0, false, 41),
/* 1 +*/ KEYBTDECL(0x31, 0x2b, false, 2),
/* § °*/ KEYBTDECL(0xa7, 0xb0, false, 41),
/* 1 +*/ KEYBTDECL(0x31, 0x2b, false, 2),
/* 2 "*/ KEYBTDECL(0x32, 0x22, false, 3),
/* 3 **/ KEYBTDECL(0x33, 0x2a, false, 4),
/* 3 **/ KEYBTDECL(0x33, 0x2a, false, 4),
/* 4 ç*/ KEYBTDECL(0x34, 0xe7, false, 5),
/* 5 %*/ KEYBTDECL(0x35, 0x25, false, 6),
/* 6 &*/ KEYBTDECL(0x36, 0x26, false, 7),
/* 7 /*/ KEYBTDECL(0x37, 0x2f, false, 8),
/* 8 (*/ KEYBTDECL(0x38, 0x28, false, 9),
/* 9 )*/ KEYBTDECL(0x39, 0x29, false, 10),
/* 0 =*/ KEYBTDECL(0x30, 0x3d, false, 11),
/* ' ?*/ KEYBTDECL(0x27, 0x5f, false, 12),
/* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, KEYCODE(0x5e, 13, 0), KEYCODE(0x60, 13, 1)),
/* q Q*/ KEYBTDECL(0x71, 0x51, true, 16),
/* w W*/ KEYBTDECL(0x77, 0x57, true, 17),
/* e E*/ KEYBTDECLEX8(0x65, 0x45, true, 18, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb),
/* 9 )*/ KEYBTDECL(0x39, 0x29, false, 10),
/* 0 =*/ KEYBTDECL(0x30, 0x3d, false, 11),
/* ' ?*/ KEYBTDECL(0x27, 0x5f, false, 12),
/* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, KEYCODE(0x5e, 13, 0), KEYCODE(0x60, 13, 1)),
/* q Q*/ KEYBTDECL(0x71, 0x51, true, 16),
/* w W*/ KEYBTDECL(0x77, 0x57, true, 17),
/* e E*/ KEYBTDECLEX8(0x65, 0x45, true, 18, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb),
/* r R*/ KEYBTDECL(0x72, 0x52, true, 19),
/* 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)};
/* 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; i<nKeyboardLayouts; i++)
delete keyboardLayouts[i];
delete [] keyboardLayouts;
keyboardLayouts = NULL;
delete keyboardLayouts[i];
delete [] keyboardLayouts;
keyboardLayouts = NULL;
}
QString UBPlatformUtils::urlFromClipboard()
......
This diff is collapsed.
This diff is collapsed.
......@@ -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
/**
......
......@@ -55,5 +55,5 @@ UBDockTeacherGuideWidget::~UBDockTeacherGuideWidget()
UBTeacherGuideWidget* UBDockTeacherGuideWidget::teacherGuideWidget()
{
return mpTeacherGuideWidget;
return mpTeacherGuideWidget;
}
......@@ -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)
......
......@@ -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<UBImgTextThumbnailElement> mThumbsWithLabels;
/** The list of current thumbnails with labels*/
QList<UBImgTextThumbnailElement> mThumbsWithLabels;
/** The current number of columns */
int mNbColumns;
/** The current thumbnails width */
......
......@@ -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<UBMimeDataItem> mimeDataItems;
foreach (QGraphicsItem *item, selectedItems())
mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item)));
QDrag *drag = new QDrag(this);
QList<UBMimeDataItem> 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<UBSceneThumbnailPixmap*> 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<UBSceneThumbnailPixmap*> pixmapItems;
foreach (QGraphicsItem *item, scene()->items(mapToScene(boundingFrame)))
{
UBSceneThumbnailPixmap* sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(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<UBMimeDataItem> mimeDataItems;
......
......@@ -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_ */
......@@ -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);
}
......@@ -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;
};
......
......@@ -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<const UBFeaturesMimeData*>(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()
......
......@@ -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;
......
......@@ -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<UBFeature>();
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)
......
......@@ -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<UBFeature> *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 <UBFeature> *featuresList;
QList <UBFeature> *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;
};
......
......@@ -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();
}
}
}
......
......@@ -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);
}
......
......@@ -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()
......
......@@ -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()
......
......@@ -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);
}
......
......@@ -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;
}
}
......
......@@ -58,7 +58,7 @@ class UBResources : public QObject
QCursor playCursor;
QCursor textCursor;
QCursor rotateCursor;
QCursor drawLineRulerCursor;
QCursor drawLineRulerCursor;
};
#endif /* UBRESOURCES_H_ */
......@@ -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);
}
......@@ -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()
......
......@@ -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
......@@ -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<QUrl> 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)
......
......@@ -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<UBThumbnail*>(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);
}
}
}
}
}
......@@ -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; }
};
......
......@@ -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 );
......
......@@ -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;
......
......@@ -65,7 +65,7 @@ namespace merge_lib
_page->insertToContent(startOfPageElement, matrix.str());
}
void _pageElementNotFound()
{
{
_retrieveBoxFromParent();
}
};
......
......@@ -114,7 +114,7 @@ void Document::saveAs(const char * newFileName)
for ( sizeIterator = sizesAndGenerationNumbers.begin() ; sizeIterator != sizesAndGenerationNumbers.end(); sizeIterator++ )
{
out << std::setfill('0')<<std::setw(10)<<sizeInXref << " " << std::setw(5) << (*sizeIterator).second.second << " n \n";
sizeInXref = sizeInXref + (*sizeIterator).second.first;
sizeInXref = sizeInXref + (*sizeIterator).second.first;
}
out << "trailer\n<<\n/Size " << numberOfObjects << "\n/Info 1 0 R\n"
<< "/Root " << _root->getObjectNumber() << " 0 R\n >>\nstartxref\n" << sizeInXref << "\n%%EOF";
......
......@@ -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;
}
......
......@@ -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;
};
}
......
......@@ -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();
......
......@@ -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<Object *> 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 <object number, its size>
......@@ -263,9 +263,9 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair<un
std::string stream;
if(_hasStream && !_hasStreamInContent)
{
{
getStream(stream);
stream.append("endstream\n");
stream.append("endstream\n");
}
// xxxx + " " + "0" + " " + "obj" + "\n" + _content.size() + "endobj\n", where x - is a digit
unsigned long long objectSizeForXref = (static_cast<unsigned int>(std::log10(static_cast<double>(_number))) + 1) + 14 + _content.size() + stream.size();
......@@ -285,13 +285,13 @@ void Object::serialize(std::ofstream & out, std::map< unsigned int, std::pair<un
}
}
void Object::recalculateObjectNumbers(unsigned int & newNumber)
{
{
_recalculateObjectNumbers(newNumber);
resetIsPassed();
}
void Object::_recalculateObjectNumbers(unsigned int & newNumber)
{
{
_setObjectNumber(newNumber);
Children::iterator childIterator;
......@@ -396,7 +396,7 @@ bool Object::findObject(const std::string & token, Object* & foundObject, unsign
bool result = _findObject(token, foundObject, tokenPositionInContent);
resetIsPassed();
if(result)
{
{
return true;
}
return false;
......@@ -425,7 +425,7 @@ void Object::_addParent(Object * child)
}
void Object::_serialize(std::ofstream & out, const std::string & stream)
{
out << _number << " " << _generationNumber << " obj\n" << _content << stream << "endobj\n";
out << _number << " " << _generationNumber << " obj\n" << _content << stream << "endobj\n";
out.flush();
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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];
......
This diff is collapsed.
This diff is collapsed.
......@@ -39,7 +39,7 @@ namespace merge_lib
PageElementHandler(page),
_basePage(basePage)
{
_setHandlerName(handlerName);
_setHandlerName(handlerName);
}
virtual ~RotationHandler()
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment