removed tab

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent a6c6ee3f61
commit b2628d12b8
  1. 18
      src/adaptors/UBExportFullPDF.cpp
  2. 22
      src/adaptors/UBExportPDF.cpp
  3. 12
      src/adaptors/UBImportDocument.cpp
  4. 4
      src/adaptors/UBImportPDF.cpp
  5. 4
      src/adaptors/UBImportPDF.h
  6. 8
      src/adaptors/UBSvgSubsetAdaptor.cpp
  7. 2
      src/adaptors/UBThumbnailAdaptor.h
  8. 2
      src/api/UBWidgetUniboardAPI.cpp
  9. 6
      src/board/UBBoardView.h
  10. 4
      src/board/UBDrawingController.cpp
  11. 4
      src/board/UBDrawingController.h
  12. 132
      src/board/UBFeaturesController.cpp
  13. 76
      src/board/UBFeaturesController.h
  14. 38
      src/core/UB.h
  15. 32
      src/core/UBApplication.cpp
  16. 2
      src/core/UBApplication.h
  17. 28
      src/core/UBApplicationController.cpp
  18. 4
      src/core/UBPersistenceManager.cpp
  19. 2
      src/core/UBSetting.h
  20. 30
      src/customWidgets/UBMediaWidget.cpp
  21. 12
      src/desktop/UBDesktopAnnotationController.cpp
  22. 2
      src/desktop/UBDesktopPalette.h
  23. 4
      src/document/UBDocumentContainer.cpp
  24. 60
      src/document/UBDocumentController.cpp
  25. 2
      src/domain/UBGraphicsGroupContainerItem.cpp
  26. 6
      src/domain/UBGraphicsPolygonItem.cpp
  27. 2
      src/domain/UBGraphicsScene.h
  28. 28
      src/domain/UBGraphicsStrokesGroup.cpp
  29. 22
      src/frameworks/UBPlatformUtils.cpp
  30. 58
      src/frameworks/UBPlatformUtils.h
  31. 106
      src/frameworks/UBPlatformUtils_linux.cpp
  32. 518
      src/frameworks/UBPlatformUtils_win.cpp
  33. 856
      src/gui/UBDockPalette.cpp
  34. 2
      src/gui/UBDockPalette.h
  35. 2
      src/gui/UBDockTeacherGuideWidget.cpp
  36. 42
      src/gui/UBDocumentNavigator.cpp
  37. 6
      src/gui/UBDocumentNavigator.h
  38. 104
      src/gui/UBDocumentThumbnailWidget.cpp
  39. 8
      src/gui/UBDocumentThumbnailWidget.h
  40. 48
      src/gui/UBDocumentTreeWidget.cpp
  41. 6
      src/gui/UBDocumentTreeWidget.h
  42. 48
      src/gui/UBFeaturesActionBar.cpp
  43. 36
      src/gui/UBFeaturesActionBar.h
  44. 20
      src/gui/UBFeaturesWidget.cpp
  45. 68
      src/gui/UBFeaturesWidget.h
  46. 60
      src/gui/UBFloatingPalette.cpp
  47. 10
      src/gui/UBKeyboardPalette.cpp
  48. 12
      src/gui/UBKeyboardPalette_mac.cpp
  49. 56
      src/gui/UBKeyboardPalette_win.cpp
  50. 4
      src/gui/UBLeftPalette.cpp
  51. 14
      src/gui/UBNavigatorPalette.cpp
  52. 2
      src/gui/UBResources.h
  53. 66
      src/gui/UBRightPalette.cpp
  54. 60
      src/gui/UBTeacherGuideWidget.cpp
  55. 6
      src/gui/UBTeacherGuideWidget.h
  56. 88
      src/gui/UBTeacherGuideWidgetsTools.cpp
  57. 42
      src/gui/UBThumbnailWidget.cpp
  58. 30
      src/gui/UBThumbnailWidget.h
  59. 2
      src/network/UBNetworkAccessManager.h
  60. 2
      src/pdf-merger/Document.cpp
  61. 2
      src/pdf-merger/LZWDecode.h
  62. 2
      src/pdf-merger/Object.cpp
  63. 250
      src/pdf-merger/Object.h
  64. 2
      src/pdf-merger/OverlayDocumentParser.cpp
  65. 16
      src/pdf-merger/OverlayDocumentParser.h
  66. 2
      src/pdf-merger/Parser.h
  67. 30
      src/pdf-merger/RemoveHimSelfHandler.h
  68. 2
      src/pdf-merger/Utils.cpp
  69. 8
      src/pdf/PDFRenderer.h
  70. 16
      src/pdf/XPDFRenderer.cpp
  71. 18
      src/podcast/UBPodcastController.cpp
  72. 12
      src/tools/UBAbstractDrawRuler.cpp
  73. 18
      src/tools/UBGraphicsProtractor.h
  74. 32
      src/tools/UBGraphicsRuler.h
  75. 2
      src/web/UBWebController.cpp
  76. 6
      src/web/UBWebController.h
  77. 2
      src/web/browser/WBBrowserWindow.cpp
  78. 4
      src/web/browser/WBBrowserWindow.h
  79. 2
      src/web/browser/WBUrlLineEdit.cpp

@ -55,9 +55,9 @@ UBExportFullPDF::UBExportFullPDF(QObject *parent)
: UBExportAdaptor(parent) : UBExportAdaptor(parent)
{ {
//need to calculate screen resolution //need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mScaleFactor = 72.0f / dpiCommon; mScaleFactor = 72.0f / dpiCommon;
} }
@ -95,17 +95,17 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr
scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingQuality(UBItem::RenderingQualityHigh);
scene->setRenderingContext(UBGraphicsScene::PdfExport); scene->setRenderingContext(UBGraphicsScene::PdfExport);
QSize pageSize = scene->nominalSize(); QSize pageSize = scene->nominalSize();
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
if (pdfItem) mHasPDFBackgrounds = true; if (pdfItem) mHasPDFBackgrounds = true;
pdfPrinter.setPaperSize(QSizeF(pageSize.width()*mScaleFactor, pageSize.height()*mScaleFactor), QPrinter::Point); pdfPrinter.setPaperSize(QSizeF(pageSize.width()*mScaleFactor, pageSize.height()*mScaleFactor), QPrinter::Point);
if (!pdfPainter) pdfPainter = new QPainter(&pdfPrinter); if (!pdfPainter) pdfPainter = new QPainter(&pdfPrinter);
if (pageIndex != 0) pdfPrinter.newPage(); if (pageIndex != 0) pdfPrinter.newPage();
//render to PDF //render to PDF
scene->setDrawingMode(true); scene->setDrawingMode(true);
@ -183,9 +183,9 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QS
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex); UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex);
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
QSize pageSize = scene->nominalSize(); QSize pageSize = scene->nominalSize();
if (pdfItem) if (pdfItem)
{ {
QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf"; QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf";
QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName; QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName;

@ -80,15 +80,15 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
pdfPrinter.setOutputFormat(QPrinter::PdfFormat); pdfPrinter.setOutputFormat(QPrinter::PdfFormat);
pdfPrinter.setResolution(UBSettings::settings()->pdfResolution->get().toInt()); pdfPrinter.setResolution(UBSettings::settings()->pdfResolution->get().toInt());
pdfPrinter.setOutputFileName(filename); pdfPrinter.setOutputFileName(filename);
pdfPrinter.setFullPage(true); pdfPrinter.setFullPage(true);
//need to calculate screen resolution //need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
float scaleFactor = 72.0f / dpiCommon; float scaleFactor = 72.0f / dpiCommon;
QPainter pdfPainter; QPainter pdfPainter;
bool painterNeedsBegin = true; bool painterNeedsBegin = true;
int existingPageCount = pDocumentProxy->pageCount(); int existingPageCount = pDocumentProxy->pageCount();
@ -101,17 +101,17 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
bool isCrossed = scene->isCrossedBackground(); bool isCrossed = scene->isCrossedBackground();
scene->setBackground(false, false); scene->setBackground(false, false);
QSize pageSize = scene->nominalSize(); QSize pageSize = scene->nominalSize();
// set high res rendering // set high res rendering
scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingQuality(UBItem::RenderingQualityHigh);
scene->setRenderingContext(UBGraphicsScene::NonScreen); scene->setRenderingContext(UBGraphicsScene::NonScreen);
//setting page size to appropriate value //setting page size to appropriate value
pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point); pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point);
if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter); if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter);
//render to PDF //render to PDF
scene->render(&pdfPainter, QRectF(), scene->normalizedSceneRect()); scene->render(&pdfPainter, QRectF(), scene->normalizedSceneRect());
if (pageIndex < existingPageCount - 1) pdfPrinter.newPage(); if (pageIndex < existingPageCount - 1) pdfPrinter.newPage();
@ -122,7 +122,7 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
//restore background state //restore background state
scene->setBackground(isDark, isCrossed); scene->setBackground(isDark, isCrossed);
} }
if(!painterNeedsBegin) pdfPainter.end(); if(!painterNeedsBegin) pdfPainter.end();
} }
QString UBExportPDF::exportExtention() QString UBExportPDF::exportExtention()

@ -174,18 +174,18 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
QString documentRootFolder; QString documentRootFolder;
if(!extractFileToDir(pFile, path, documentRootFolder)){ if(!extractFileToDir(pFile, path, documentRootFolder)){
UBApplication::showMessage(tr("Import of file %1 failed.").arg(fi.baseName())); UBApplication::showMessage(tr("Import of file %1 failed.").arg(fi.baseName()));
return NULL; return NULL;
} }
bool addTitlePage = false; bool addTitlePage = false;
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && !QFile(documentRootFolder+"/page000.svg").exists()) if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && !QFile(documentRootFolder+"/page000.svg").exists())
addTitlePage=true; addTitlePage=true;
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, addTitlePage); UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, addTitlePage);
UBApplication::showMessage(tr("Import successful.")); UBApplication::showMessage(tr("Import successful."));
return newDocument; return newDocument;
} }
bool UBImportDocument::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile) bool UBImportDocument::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile)

@ -38,7 +38,7 @@ UBImportPDF::UBImportPDF(QObject *parent)
: UBPageBasedImportAdaptor(parent) : UBPageBasedImportAdaptor(parent)
{ {
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
this->dpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; this->dpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
} }
@ -71,7 +71,7 @@ QList<UBGraphicsItem*> UBImportPDF::import(const QUuid& uuid, const QString& fil
UBApplication::showMessage(tr("PDF import failed.")); UBApplication::showMessage(tr("PDF import failed."));
return result; return result;
} }
pdfRenderer->setDPI(this->dpi); pdfRenderer->setDPI(this->dpi);
int pdfPageCount = pdfRenderer->pageCount(); int pdfPageCount = pdfRenderer->pageCount();

@ -44,8 +44,8 @@ class UBImportPDF : public UBPageBasedImportAdaptor
virtual void placeImportedItemToScene(UBGraphicsScene* scene, UBGraphicsItem* item); virtual void placeImportedItemToScene(UBGraphicsScene* scene, UBGraphicsItem* item);
virtual const QString& folderToCopy(); virtual const QString& folderToCopy();
private: private:
int dpi; int dpi;
}; };
#endif /* UBIMPORTPDF_H_ */ #endif /* UBIMPORTPDF_H_ */

@ -1249,10 +1249,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
//disabling g section parsing as a group of elements. Use groups refs instead //disabling g section parsing as a group of elements. Use groups refs instead
// mXmlWriter.writeStartElement("g"); // mXmlWriter.writeStartElement("g");
// mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(strokesGroupItem->uuid())); // mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(strokesGroupItem->uuid()));
// QMatrix matrix = item->sceneMatrix(); // QMatrix matrix = item->sceneMatrix();
// if (!matrix.isIdentity()){ // if (!matrix.isIdentity()){
// mXmlWriter.writeAttribute("transform", toSvgTransform(matrix)); // mXmlWriter.writeAttribute("transform", toSvgTransform(matrix));
// } // }
// Add the polygons // Add the polygons
foreach(QGraphicsItem* item, strokesGroupItem->childItems()){ foreach(QGraphicsItem* item, strokesGroupItem->childItems()){

@ -32,7 +32,7 @@ class UBGraphicsScene;
class UBThumbnailAdaptor //static class class UBThumbnailAdaptor //static class
{ {
Q_DECLARE_TR_FUNCTIONS(UBThumbnailAdaptor) Q_DECLARE_TR_FUNCTIONS(UBThumbnailAdaptor)
public: public:
static QUrl thumbnailUrl(UBDocumentProxy* proxy, int pageIndex); static QUrl thumbnailUrl(UBDocumentProxy* proxy, int pageIndex);

@ -241,7 +241,7 @@ void UBWidgetUniboardAPI::drawLineTo(const qreal x, const qreal y, const qreal p
if (mScene) if (mScene)
mScene->drawLineTo(QPointF(x, y), pWidth, mScene->drawLineTo(QPointF(x, y), pWidth,
UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line); UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line);
} }

@ -143,7 +143,7 @@ class UBBoardView : public QGraphicsView
bool isAbsurdPoint(QPoint point); bool isAbsurdPoint(QPoint point);
bool mVirtualKeyboardActive; bool mVirtualKeyboardActive;
bool mOkOnWidget; bool mOkOnWidget;
bool mWidgetMoved; bool mWidgetMoved;
@ -172,9 +172,9 @@ class UBBoardView : public QGraphicsView
void settingChanged(QVariant newValue); void settingChanged(QVariant newValue);
public slots: public slots:
void virtualKeyboardActivated(bool b); void virtualKeyboardActivated(bool b);
void longPressEvent(); void longPressEvent();
}; };

@ -55,7 +55,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
, mActiveRuler(NULL) , mActiveRuler(NULL)
, mStylusTool((UBStylusTool::Enum)-1) , mStylusTool((UBStylusTool::Enum)-1)
, mLatestDrawingTool((UBStylusTool::Enum)-1) , mLatestDrawingTool((UBStylusTool::Enum)-1)
, mIsDesktopMode(false) , mIsDesktopMode(false)
{ {
connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged())); connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged()));
@ -96,7 +96,7 @@ void UBDrawingController::setStylusTool(int tool)
{ {
if (tool != mStylusTool) if (tool != mStylusTool)
{ {
UBApplication::boardController->activeScene()->deselectAllItems(); UBApplication::boardController->activeScene()->deselectAllItems();
if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker
|| mStylusTool == UBStylusTool::Line) || mStylusTool == UBStylusTool::Line)
{ {

@ -61,11 +61,11 @@ class UBDrawingController : public QObject
UBAbstractDrawRuler* mActiveRuler; UBAbstractDrawRuler* mActiveRuler;
void setInDestopMode(bool mode){ void setInDestopMode(bool mode){
mIsDesktopMode = mode; mIsDesktopMode = mode;
} }
bool isInDesktopMode(){ bool isInDesktopMode(){
return mIsDesktopMode; return mIsDesktopMode;
} }
public slots: public slots:

@ -255,7 +255,7 @@ QString UBFeature::getVirtualDirFromVirtualPath(const QString &pVirtPath)
QString UBFeature::getUrl() const QString UBFeature::getUrl() const
{ {
if ( elementType == FEATURE_INTERNAL ) if ( elementType == FEATURE_INTERNAL )
return getFullPath().toString(); return getFullPath().toString();
return getFullPath().toLocalFile(); return getFullPath().toLocalFile();
@ -268,12 +268,12 @@ bool UBFeature::operator ==( const UBFeature &f )const
bool UBFeature::operator !=( const UBFeature &f )const bool UBFeature::operator !=( const UBFeature &f )const
{ {
return !(*this == f); return !(*this == f);
} }
bool UBFeature::isFolder() const bool UBFeature::isFolder() const
{ {
return elementType == FEATURE_CATEGORY || elementType == FEATURE_TRASH || elementType == FEATURE_FAVORITE return elementType == FEATURE_CATEGORY || elementType == FEATURE_TRASH || elementType == FEATURE_FAVORITE
|| elementType == FEATURE_FOLDER || elementType == FEATURE_SEARCH; || elementType == FEATURE_FOLDER || elementType == FEATURE_SEARCH;
} }
@ -451,11 +451,11 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin
if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) { if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) {
featuresList->append( UBFeature( favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) ); featuresList->append( UBFeature( favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) );
} }
if (featureType == FEATURE_FOLDER) { if (featureType == FEATURE_FOLDER) {
fileSystemScan(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName); fileSystemScan(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName);
} }
} }
} }
@ -486,35 +486,35 @@ int UBFeaturesController::featuresCount(const QUrl &currPath)
void UBFeaturesController::loadFavoriteList() void UBFeaturesController::loadFavoriteList()
{ {
favoriteSet = new QSet<QUrl>(); favoriteSet = new QSet<QUrl>();
QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); QFile file( UBSettings::userDataDirectory() + "/favorites.dat" );
if ( file.exists() ) if ( file.exists() )
{ {
file.open(QIODevice::ReadOnly); file.open(QIODevice::ReadOnly);
QDataStream in(&file); QDataStream in(&file);
int elementsNumber; int elementsNumber;
in >> elementsNumber; in >> elementsNumber;
for ( int i = 0; i < elementsNumber; ++i) for ( int i = 0; i < elementsNumber; ++i)
{ {
QUrl path; QUrl path;
in >> path; in >> path;
favoriteSet->insert( path ); favoriteSet->insert( path );
} }
} }
} }
void UBFeaturesController::saveFavoriteList() void UBFeaturesController::saveFavoriteList()
{ {
QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); QFile file( UBSettings::userDataDirectory() + "/favorites.dat" );
file.resize(0); file.resize(0);
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
QDataStream out(&file); QDataStream out(&file);
out << favoriteSet->size(); out << favoriteSet->size();
for ( QSet<QUrl>::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it ) for ( QSet<QUrl>::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it )
{ {
out << (*it); out << (*it);
} }
file.close(); file.close();
} }
QString UBFeaturesController::uniqNameForFeature(const UBFeature &feature, const QString &pName, const QString &pExtention) const QString UBFeaturesController::uniqNameForFeature(const UBFeature &feature, const QString &pName, const QString &pExtention) const
@ -584,29 +584,29 @@ QString UBFeaturesController::adjustName(const QString &str)
void UBFeaturesController::addToFavorite( const QUrl &path ) void UBFeaturesController::addToFavorite( const QUrl &path )
{ {
QString filePath = fileNameFromUrl( path ); QString filePath = fileNameFromUrl( path );
if ( favoriteSet->find( path ) == favoriteSet->end() ) if ( favoriteSet->find( path ) == favoriteSet->end() )
{ {
QFileInfo fileInfo( filePath ); QFileInfo fileInfo( filePath );
QString fileName = fileInfo.fileName(); QString fileName = fileInfo.fileName();
UBFeatureElementType type = fileTypeFromUrl(filePath); UBFeatureElementType type = fileTypeFromUrl(filePath);
UBFeature elem(favoritePath + "/" + fileName, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) ); UBFeature elem(favoritePath + "/" + fileName, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) );
favoriteSet->insert( path ); favoriteSet->insert( path );
saveFavoriteList(); saveFavoriteList();
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull()) if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull())
featuresModel->addItem( elem ); featuresModel->addItem( elem );
} }
} }
void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManualy) void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManualy)
{ {
// QString filePath = fileNameFromUrl( path ); // QString filePath = fileNameFromUrl( path );
if ( favoriteSet->find( path ) != favoriteSet->end() ) if ( favoriteSet->find( path ) != favoriteSet->end() )
{ {
favoriteSet->erase( favoriteSet->find( path ) ); favoriteSet->erase( favoriteSet->find( path ) );
saveFavoriteList(); saveFavoriteList();
} }
if (deleteManualy) { if (deleteManualy) {
featuresModel->deleteFavoriteItem(path.toString()); featuresModel->deleteFavoriteItem(path.toString());
@ -615,10 +615,10 @@ void UBFeaturesController::removeFromFavorite( const QUrl &path, bool deleteManu
QString UBFeaturesController::fileNameFromUrl( const QUrl &url ) QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
{ {
QString fileName = url.toString(); QString fileName = url.toString();
if ( fileName.contains( "uniboardTool://" ) ) if ( fileName.contains( "uniboardTool://" ) )
return fileName; return fileName;
return url.toLocalFile(); return url.toLocalFile();
} }
@ -657,7 +657,7 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path)
fileType = FEATURE_INVALID; fileType = FEATURE_INVALID;
} }
return fileType; return fileType;
} }
QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType pFType = FEATURE_INVALID) QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType pFType = FEATURE_INVALID)
@ -759,7 +759,7 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de
if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) ) if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) )
{ {
dest = picturesElement; dest = picturesElement;
} }
filePath = dest.getFullPath().toLocalFile() + "/" + mFileName; filePath = dest.getFullPath().toLocalFile() + "/" + mFileName;
@ -805,7 +805,7 @@ void UBFeaturesController::addNewFolder(QString name)
if(!QFileInfo(path).exists()) { if(!QFileInfo(path).exists()) {
QDir().mkpath(path); QDir().mkpath(path);
} }
UBFeature newFeatureFolder = UBFeature( currentElement.getFullVirtualPath() + "/" + name, QImage(":images/libpalette/folder.svg"), UBFeature newFeatureFolder = UBFeature( currentElement.getFullVirtualPath() + "/" + name, QImage(":images/libpalette/folder.svg"),
name, QUrl::fromLocalFile( path ), FEATURE_FOLDER ); name, QUrl::fromLocalFile( path ), FEATURE_FOLDER );
@ -897,37 +897,37 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination ) UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination )
{ {
/*UBFeature newElement = copyItemToFolder( url, destination ); /*UBFeature newElement = copyItemToFolder( url, destination );
deleteItem( url ); deleteItem( url );
return newElement;*/ return newElement;*/
QString sourcePath = url.toLocalFile(); QString sourcePath = url.toLocalFile();
Q_ASSERT( QFileInfo( sourcePath ).exists() ); Q_ASSERT( QFileInfo( sourcePath ).exists() );
UBFeature possibleDest = getDestinationFeatureForUrl(url); UBFeature possibleDest = getDestinationFeatureForUrl(url);
UBFeature dest = destination; UBFeature dest = destination;
if ( destination != trashElement && if ( destination != trashElement &&
!destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) ) !destination.getFullVirtualPath().startsWith( possibleDest.getFullVirtualPath(), Qt::CaseInsensitive ) )
{ {
dest = possibleDest; dest = possibleDest;
} }
QString name = QFileInfo( sourcePath ).fileName(); QString name = QFileInfo( sourcePath ).fileName();
QString destPath = dest.getFullPath().toLocalFile(); QString destPath = dest.getFullPath().toLocalFile();
QString destVirtualPath = dest.getFullVirtualPath(); QString destVirtualPath = dest.getFullVirtualPath();
QString newFullPath = destPath + "/" + name; QString newFullPath = destPath + "/" + name;
if ( sourcePath.compare( newFullPath, Qt::CaseInsensitive ) ) if ( sourcePath.compare( newFullPath, Qt::CaseInsensitive ) )
{ {
QFile( sourcePath ).copy( newFullPath ); QFile( sourcePath ).copy( newFullPath );
deleteItem( url ); deleteItem( url );
} }
QImage thumb = getIcon( newFullPath ); QImage thumb = getIcon( newFullPath );
UBFeatureElementType type = FEATURE_ITEM; UBFeatureElementType type = FEATURE_ITEM;
if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") )
type = FEATURE_INTERACTIVE; type = FEATURE_INTERACTIVE;
UBFeature newElement( destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); UBFeature newElement( destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile( newFullPath ), type );
return newElement; return newElement;
@ -1071,7 +1071,7 @@ void UBFeaturesController::deleteItem(const QUrl &url)
QString path = url.toLocalFile(); QString path = url.toLocalFile();
Q_ASSERT( QFileInfo( path ).exists() ); Q_ASSERT( QFileInfo( path ).exists() );
QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path ); QString thumbnailPath = UBFileSystemUtils::thumbnailPath( path );
if ( thumbnailPath.length() && QFileInfo( thumbnailPath ).exists()) { if ( thumbnailPath.length() && QFileInfo( thumbnailPath ).exists()) {
if (QFileInfo(thumbnailPath).isFile()) { if (QFileInfo(thumbnailPath).isFile()) {
QFile::remove(thumbnailPath); QFile::remove(thumbnailPath);

@ -120,22 +120,22 @@ public:
QString getDisplayName() const {return mDisplayName;} QString getDisplayName() const {return mDisplayName;}
QImage getThumbnail() const {return mThumbnail;} QImage getThumbnail() const {return mThumbnail;}
QString getVirtualPath() const { return virtualDir; } QString getVirtualPath() const { return virtualDir; }
//QString getPath() const { return mPath; }; //QString getPath() const { return mPath; };
QUrl getFullPath() const { return mPath; } QUrl getFullPath() const { return mPath; }
QString getFullVirtualPath() const { return virtualDir + "/" + mName; } QString getFullVirtualPath() const { return virtualDir + "/" + mName; }
QString getUrl() const; QString getUrl() const;
void setFullPath(const QUrl &newPath) {mPath = newPath;} void setFullPath(const QUrl &newPath) {mPath = newPath;}
void setFullVirtualPath(const QString &newVirtualPath) {virtualDir = newVirtualPath;} void setFullVirtualPath(const QString &newVirtualPath) {virtualDir = newVirtualPath;}
UBFeatureElementType getType() const { return elementType; } UBFeatureElementType getType() const { return elementType; }
bool isFolder() const; bool isFolder() const;
bool allowedCopy() const; bool allowedCopy() const;
bool isDeletable() const; bool isDeletable() const;
bool inTrash() const; bool inTrash() const;
bool operator ==( const UBFeature &f )const; bool operator ==( const UBFeature &f )const;
bool operator !=( const UBFeature &f )const; bool operator !=( const UBFeature &f )const;
const QMap<QString,QString> & getMetadata() const { return metadata; } const QMap<QString,QString> & getMetadata() const { return metadata; }
void setMetadata( const QMap<QString,QString> &data ) { metadata = data; } void setMetadata( const QMap<QString,QString> &data ) { metadata = data; }
private: private:
@ -148,7 +148,7 @@ private:
QImage mThumbnail; QImage mThumbnail;
QString mName; QString mName;
QString mDisplayName; QString mDisplayName;
QUrl mPath; QUrl mPath;
UBFeatureElementType elementType; UBFeatureElementType elementType;
QMap<QString,QString> metadata; QMap<QString,QString> metadata;
}; };
@ -161,7 +161,7 @@ friend class UBFeaturesWidget;
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesController(QWidget *parentWidget); UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController(); virtual ~UBFeaturesController();
QList <UBFeature>* getFeatures() const {return featuresList;} QList <UBFeature>* getFeatures() const {return featuresList;}
@ -173,12 +173,12 @@ public:
void addItemAsBackground(const UBFeature &item); void addItemAsBackground(const UBFeature &item);
const UBFeature& getCurrentElement()const {return currentElement;} const UBFeature& getCurrentElement()const {return currentElement;}
void setCurrentElement( const UBFeature &elem ) {currentElement = elem;} void setCurrentElement( const UBFeature &elem ) {currentElement = elem;}
const UBFeature & getTrashElement () const { return trashElement; } const UBFeature & getTrashElement () const { return trashElement; }
void addDownloadedFile( const QUrl &sourceUrl, const QByteArray &pData, const QString pContentSource, const QString pTitle ); void addDownloadedFile( const QUrl &sourceUrl, const QByteArray &pData, const QString pContentSource, const QString pTitle );
UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination ); UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination );
UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination ); UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination );
void moveExternalData(const QUrl &url, const UBFeature &destination); void moveExternalData(const QUrl &url, const UBFeature &destination);
void rescanModel(); void rescanModel();
@ -188,9 +188,9 @@ public:
void searchStarted(const QString &pattern, QListView *pOnView); void searchStarted(const QString &pattern, QListView *pOnView);
void refreshModels(); void refreshModels();
void deleteItem( const QUrl &url ); void deleteItem( const QUrl &url );
void deleteItem(const UBFeature &pFeature); void deleteItem(const UBFeature &pFeature);
bool isTrash( const QUrl &url ); bool isTrash( const QUrl &url );
void moveToTrash(UBFeature feature, bool deleteManualy = false); void moveToTrash(UBFeature feature, bool deleteManualy = false);
void addToFavorite( const QUrl &path ); void addToFavorite( const QUrl &path );
void removeFromFavorite(const QUrl &path, bool deleteManualy = false); void removeFromFavorite(const QUrl &path, bool deleteManualy = false);
@ -202,9 +202,9 @@ public:
int featuresCount(const QUrl &currPath); int featuresCount(const QUrl &currPath);
static UBFeatureElementType fileTypeFromUrl( const QString &path ); static UBFeatureElementType fileTypeFromUrl( const QString &path );
static QString fileNameFromUrl( const QUrl &url ); static QString fileNameFromUrl( const QUrl &url );
static QImage getIcon( const QString &path, UBFeatureElementType pFType ); static QImage getIcon( const QString &path, UBFeatureElementType pFType );
static bool isDeletable( const QUrl &url ); static bool isDeletable( const QUrl &url );
static char featureTypeSplitter() {return ':';} static char featureTypeSplitter() {return ':';}
static QString categoryNameForVirtualPath(const QString &str); static QString categoryNameForVirtualPath(const QString &str);
@ -255,49 +255,49 @@ private:
private: private:
static QImage createThumbnail(const QString &path); static QImage createThumbnail(const QString &path);
//void addImageToCurrentPage( const QString &path ); //void addImageToCurrentPage( const QString &path );
void loadFavoriteList(); void loadFavoriteList();
void saveFavoriteList(); void saveFavoriteList();
QString uniqNameForFeature(const UBFeature &feature, const QString &pName = "Imported", const QString &pExtention = "") const; QString uniqNameForFeature(const UBFeature &feature, const QString &pName = "Imported", const QString &pExtention = "") const;
QString adjustName(const QString &str); QString adjustName(const QString &str);
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
QUrl mUserAudioDirectoryPath; QUrl mUserAudioDirectoryPath;
QUrl mUserVideoDirectoryPath; QUrl mUserVideoDirectoryPath;
QUrl mUserPicturesDirectoryPath; QUrl mUserPicturesDirectoryPath;
QUrl mUserInteractiveDirectoryPath; QUrl mUserInteractiveDirectoryPath;
QUrl mUserAnimationDirectoryPath; QUrl mUserAnimationDirectoryPath;
QString libraryPath; QString libraryPath;
QUrl mLibPicturesDirectoryPath; QUrl mLibPicturesDirectoryPath;
QUrl mLibAudiosDirectoryPath; QUrl mLibAudiosDirectoryPath;
QUrl mLibVideosDirectoryPath; QUrl mLibVideosDirectoryPath;
QUrl mLibInteractiveDirectoryPath; QUrl mLibInteractiveDirectoryPath;
QUrl mLibAnimationsDirectoryPath; QUrl mLibAnimationsDirectoryPath;
QUrl mLibApplicationsDirectoryPath; QUrl mLibApplicationsDirectoryPath;
QUrl mLibShapesDirectoryPath; QUrl mLibShapesDirectoryPath;
QUrl trashDirectoryPath; QUrl trashDirectoryPath;
QUrl mLibSearchDirectoryPath; QUrl mLibSearchDirectoryPath;
int mLastItemOffsetIndex; int mLastItemOffsetIndex;
UBFeature currentElement; UBFeature currentElement;
UBFeature rootElement; UBFeature rootElement;
UBFeature favoriteElement; UBFeature favoriteElement;
UBFeature audiosElement; UBFeature audiosElement;
UBFeature moviesElement; UBFeature moviesElement;
UBFeature picturesElement; UBFeature picturesElement;
UBFeature interactElement; UBFeature interactElement;
UBFeature applicationsElement; UBFeature applicationsElement;
UBFeature flashElement; UBFeature flashElement;
UBFeature shapesElement; UBFeature shapesElement;
UBFeature webSearchElement; UBFeature webSearchElement;
QSet <QUrl> *favoriteSet; QSet <QUrl> *favoriteSet;
public: public:
UBFeature trashElement; UBFeature trashElement;

@ -51,17 +51,17 @@ struct UBStylusTool
enum Enum enum Enum
{ {
Pen = 0, Pen = 0,
Eraser, Eraser,
Marker, Marker,
Selector, Selector,
Play, Play,
Hand, Hand,
ZoomIn, ZoomIn,
ZoomOut, ZoomOut,
Pointer, Pointer,
Line, Line,
Text, Text,
Capture Capture
}; };
}; };
@ -139,18 +139,18 @@ struct UBGraphicsItemType
enum Enum enum Enum
{ {
PolygonItemType = QGraphicsItem::UserType + 1, PolygonItemType = QGraphicsItem::UserType + 1,
PixmapItemType, PixmapItemType,
SvgItemType, SvgItemType,
DelegateButtonType, DelegateButtonType,
MediaItemType, MediaItemType,
PDFItemType, PDFItemType,
TextItemType, TextItemType,
CurtainItemType, CurtainItemType,
RulerItemType, RulerItemType,
CompassItemType, CompassItemType,
ProtractorItemType, ProtractorItemType,
StrokeItemType, StrokeItemType,
TriangleItemType, TriangleItemType,
MagnifierItemType, MagnifierItemType,
cacheItemType, cacheItemType,
AristoItemType, AristoItemType,

@ -658,17 +658,17 @@ bool UBApplication::handleOpenMessage(const QString& pMessage)
void UBApplication::cleanup() void UBApplication::cleanup()
{ {
if (applicationController) delete applicationController; if (applicationController) delete applicationController;
if (boardController) delete boardController; if (boardController) delete boardController;
if (webController) delete webController; if (webController) delete webController;
if (documentController) delete documentController; if (documentController) delete documentController;
if (mUniboardSankoreTransition) delete mUniboardSankoreTransition; if (mUniboardSankoreTransition) delete mUniboardSankoreTransition;
applicationController = NULL; applicationController = NULL;
boardController = NULL; boardController = NULL;
webController = NULL; webController = NULL;
documentController = NULL; documentController = NULL;
mUniboardSankoreTransition = NULL; mUniboardSankoreTransition = NULL;
} }
@ -707,19 +707,19 @@ void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment,
QString UBApplication::urlFromHtml(QString html) QString UBApplication::urlFromHtml(QString html)
{ {
QString _html; QString _html;
QRegExp comments("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>"); QRegExp comments("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>");
QString url; QString url;
QDomDocument domDoc; QDomDocument domDoc;
// We remove all the comments & CRLF of this html // We remove all the comments & CRLF of this html
_html = html.remove(comments); _html = html.remove(comments);
domDoc.setContent(_html.remove(QRegExp("[\\0]"))); domDoc.setContent(_html.remove(QRegExp("[\\0]")));
QDomElement rootElem = domDoc.documentElement(); QDomElement rootElem = domDoc.documentElement();
// QUICKFIX: Here we have to check rootElem. Sometimes it can be a <meta> tag // QUICKFIX: Here we have to check rootElem. Sometimes it can be a <meta> tag
// In such a case we will not be able to retrieve the src value // In such a case we will not be able to retrieve the src value
if(rootElem.tagName().toLower().contains("meta")){ if(rootElem.tagName().toLower().contains("meta")){
qDebug() << rootElem.firstChildElement().tagName(); qDebug() << rootElem.firstChildElement().tagName();
// In that case we get the next element // In that case we get the next element
url = rootElem.firstChildElement().attribute("src"); url = rootElem.firstChildElement().attribute("src");
@ -727,7 +727,7 @@ QString UBApplication::urlFromHtml(QString html)
url = rootElem.attribute("src"); url = rootElem.attribute("src");
} }
return url; return url;
} }
bool UBApplication::isFromWeb(QString url) bool UBApplication::isFromWeb(QString url)

@ -58,7 +58,7 @@ class UBApplication : public QtSingleApplication
int exec(const QString& pFileToImport); int exec(const QString& pFileToImport);
void cleanup(); void cleanup();
static QPointer<QUndoStack> undoStack; static QPointer<QUndoStack> undoStack;

@ -233,10 +233,10 @@ void UBApplicationController::adjustDisplayView()
QRect rect = mControlView->rect(); QRect rect = mControlView->rect();
QPoint center(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); QPoint center(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
QTransform recentTransform = mDisplayView->transform(); QTransform recentTransform = mDisplayView->transform();
if (recentTransform != tr) if (recentTransform != tr)
mDisplayView->setTransform(tr); mDisplayView->setTransform(tr);
mDisplayView->centerOn(mControlView->mapToScene(center)); mDisplayView->centerOn(mControlView->mapToScene(center));
} }
@ -493,22 +493,22 @@ void UBApplicationController::showTutorial()
} }
else{ else{
mMainWindow->webToolBar->hide(); mMainWindow->webToolBar->hide();
mMainWindow->boardToolBar->hide(); mMainWindow->boardToolBar->hide();
mMainWindow->documentToolBar->hide(); mMainWindow->documentToolBar->hide();
mMainWindow->tutorialToolBar->show(); mMainWindow->tutorialToolBar->show();
mMainMode = Tutorial; mMainMode = Tutorial;
adaptToolBar(); adaptToolBar();
mUninoteController->hideWindow(); mUninoteController->hideWindow();
UBApplication::webController->show(UBWebController::Tutorial); UBApplication::webController->show(UBWebController::Tutorial);
mirroringEnabled(false); mirroringEnabled(false);
emit mainModeChanged(mMainMode); emit mainModeChanged(mMainMode);
} }
} }
@ -543,7 +543,7 @@ void UBApplicationController::showSankoreEditor()
void UBApplicationController::checkUpdate() void UBApplicationController::checkUpdate()
{ {
if(mHttp) if(mHttp)
delete mHttp; delete mHttp;
QUrl url("http://ftp.open-sankore.org/update.json"); QUrl url("http://ftp.open-sankore.org/update.json");
mHttp = new QHttp(url.host()); mHttp = new QHttp(url.host());

@ -615,7 +615,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager(); UBBoardPaletteManager* paletteManager = UBApplication::boardController->paletteManager();
bool teacherGuideModified = false; bool teacherGuideModified = false;
if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget()) if(UBApplication::app()->boardController->currentPage() == pSceneIndex && paletteManager->teacherGuideDockWidget())
teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified(); teacherGuideModified = paletteManager->teacherGuideDockWidget()->teacherGuideWidget()->isModified();
if (pDocumentProxy->isModified() || teacherGuideModified) if (pDocumentProxy->isModified() || teacherGuideModified)
UBMetadataDcSubsetAdaptor::persist(pDocumentProxy); UBMetadataDcSubsetAdaptor::persist(pDocumentProxy);
@ -873,7 +873,7 @@ QString UBPersistenceManager::teacherGuideAbsoluteObjectPath(UBDocumentProxy* pD
QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath) QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath)
{ {
QString path = UBFileSystemUtils::removeLocalFilePrefix(pPath); QString path = UBFileSystemUtils::removeLocalFilePrefix(pPath);
QFileInfo fi(path); QFileInfo fi(path);
QString uuid = QUuid::createUuid(); QString uuid = QUuid::createUuid();
if (!fi.exists() || !pDocumentProxy) if (!fi.exists() || !pDocumentProxy)

@ -61,7 +61,7 @@ class UBSetting : public QObject
public slots: public slots:
void setBool(bool pValue); void setBool(bool pValue);
void setString(const QString& pValue); void setString(const QString& pValue);
void setInt(int pValue); void setInt(int pValue);
signals: signals:

@ -123,21 +123,21 @@ eMediaType UBMediaWidget::mediaType()
void UBMediaWidget::showEvent(QShowEvent* event) void UBMediaWidget::showEvent(QShowEvent* event)
{ {
if(mType == eMediaType_Audio){ if(mType == eMediaType_Audio){
return; return;
}else{ }else{
if(!mpVideoWidget){ if(!mpVideoWidget){
mpVideoWidget = new Phonon::VideoWidget(this); mpVideoWidget = new Phonon::VideoWidget(this);
mMediaLayout->addStretch(1); mMediaLayout->addStretch(1);
mMediaLayout->addWidget(mpVideoWidget); mMediaLayout->addWidget(mpVideoWidget);
mMediaLayout->addStretch(1); mMediaLayout->addStretch(1);
Phonon::createPath(mpMediaObject, mpVideoWidget); Phonon::createPath(mpMediaObject, mpVideoWidget);
adaptSizeToVideo(); adaptSizeToVideo();
mpMediaObject->play(); mpMediaObject->play();
mpMediaObject->stop(); mpMediaObject->stop();
} }
QWidget::showEvent(event); QWidget::showEvent(event);
} }
} }
void UBMediaWidget::hideEvent(QHideEvent* event) void UBMediaWidget::hideEvent(QHideEvent* event)

@ -396,7 +396,7 @@ void UBDesktopAnnotationController::hideWindow()
void UBDesktopAnnotationController::goToUniboard() void UBDesktopAnnotationController::goToUniboard()
{ {
onToolClicked(); onToolClicked();
hideWindow(); hideWindow();
UBPlatformUtils::setDesktopMode(false); UBPlatformUtils::setDesktopMode(false);
@ -408,7 +408,7 @@ void UBDesktopAnnotationController::goToUniboard()
void UBDesktopAnnotationController::customCapture() void UBDesktopAnnotationController::customCapture()
{ {
onToolClicked(); onToolClicked();
mIsFullyTransparent = true; mIsFullyTransparent = true;
updateBackground(); updateBackground();
@ -435,7 +435,7 @@ void UBDesktopAnnotationController::customCapture()
void UBDesktopAnnotationController::windowCapture() void UBDesktopAnnotationController::windowCapture()
{ {
onToolClicked(); onToolClicked();
mIsFullyTransparent = true; mIsFullyTransparent = true;
updateBackground(); updateBackground();
@ -957,7 +957,7 @@ void UBDesktopAnnotationController::refreshMask()
void UBDesktopAnnotationController::onToolClicked() void UBDesktopAnnotationController::onToolClicked()
{ {
mDesktopEraserPalette->hide(); mDesktopEraserPalette->hide();
mDesktopMarkerPalette->hide(); mDesktopMarkerPalette->hide();
mDesktopPenPalette->hide(); mDesktopPenPalette->hide();
} }

@ -61,7 +61,7 @@ class UBDesktopPalette : public UBActionPalette
void updateShowHideState(bool pShowEnabled); void updateShowHideState(bool pShowEnabled);
void setShowHideButtonVisible(bool visible); void setShowHideButtonVisible(bool visible);
void setDisplaySelectButtonVisible(bool show); void setDisplaySelectButtonVisible(bool show);
void minimizeMe(eMinimizedLocation location); void minimizeMe(eMinimizedLocation location);
void maximizeMe(); void maximizeMe();
void parentResized(); void parentResized();

@ -141,6 +141,6 @@ int UBDocumentContainer::sceneIndexFromPage(int page)
void UBDocumentContainer::addEmptyThumbPage() void UBDocumentContainer::addEmptyThumbPage()
{ {
const QPixmap* pThumb = new QPixmap(); const QPixmap* pThumb = new QPixmap();
mDocumentThumbs.append(pThumb); mDocumentThumbs.append(pThumb);
} }

@ -488,7 +488,7 @@ void UBDocumentController::duplicateSelectedItem()
if (UBApplication::applicationController->displayMode() != UBApplicationController::Document) if (UBApplication::applicationController->displayMode() != UBApplicationController::Document)
return; return;
if (mSelectionType == Page) if (mSelectionType == Page)
{ {
QList<QGraphicsItem*> selectedItems = mDocumentUI->thumbnailWidget->selectedItems(); QList<QGraphicsItem*> selectedItems = mDocumentUI->thumbnailWidget->selectedItems();
QList<int> selectedSceneIndexes; QList<int> selectedSceneIndexes;
@ -1141,26 +1141,26 @@ void UBDocumentController::selectionChanged()
mMainWindow->actionNewDocument->setEnabled((groupSelected || docSelected || pageSelected) && !trashSelected); mMainWindow->actionNewDocument->setEnabled((groupSelected || docSelected || pageSelected) && !trashSelected);
mMainWindow->actionExport->setEnabled((docSelected || pageSelected) && !trashSelected); mMainWindow->actionExport->setEnabled((docSelected || pageSelected) && !trashSelected);
bool firstSceneSelected = false; bool firstSceneSelected = false;
if(docSelected) if(docSelected)
mMainWindow->actionDuplicate->setEnabled(!trashSelected); mMainWindow->actionDuplicate->setEnabled(!trashSelected);
else if(pageSelected){ else if(pageSelected){
QList<QGraphicsItem*> selection = mDocumentUI->thumbnailWidget->selectedItems(); QList<QGraphicsItem*> selection = mDocumentUI->thumbnailWidget->selectedItems();
if(pageCount == 1) if(pageCount == 1)
mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0)));
else{ else{
for(int i = 0; i < selection.count() && !firstSceneSelected; i += 1){ for(int i = 0; i < selection.count() && !firstSceneSelected; i += 1){
if(dynamic_cast<UBSceneThumbnailPixmap*>(selection.at(i))->sceneIndex() == 0){ if(dynamic_cast<UBSceneThumbnailPixmap*>(selection.at(i))->sceneIndex() == 0){
mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0))); mMainWindow->actionDuplicate->setEnabled(!trashSelected && pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(0)));
firstSceneSelected = true; firstSceneSelected = true;
} }
} }
if(!firstSceneSelected) if(!firstSceneSelected)
mMainWindow->actionDuplicate->setEnabled(!trashSelected); mMainWindow->actionDuplicate->setEnabled(!trashSelected);
} }
} }
else else
mMainWindow->actionDuplicate->setEnabled(false); mMainWindow->actionDuplicate->setEnabled(false);
mMainWindow->actionOpen->setEnabled((docSelected || pageSelected) && !trashSelected); mMainWindow->actionOpen->setEnabled((docSelected || pageSelected) && !trashSelected);
mMainWindow->actionRename->setEnabled((groupSelected || docSelected) && !trashSelected && !defaultGroupSelected); mMainWindow->actionRename->setEnabled((groupSelected || docSelected) && !trashSelected && !defaultGroupSelected);
@ -1190,7 +1190,7 @@ void UBDocumentController::selectionChanged()
} }
if(pageSelected && firstSceneSelected) if(pageSelected && firstSceneSelected)
deleteEnabled = false; deleteEnabled = false;
mMainWindow->actionDelete->setEnabled(deleteEnabled); mMainWindow->actionDelete->setEnabled(deleteEnabled);
@ -1632,28 +1632,28 @@ int UBDocumentController::getSelectedItemIndex()
bool UBDocumentController::pageCanBeMovedUp(int page) bool UBDocumentController::pageCanBeMovedUp(int page)
{ {
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
return page >= 2; return page >= 2;
else else
return page >= 1; return page >= 1;
} }
bool UBDocumentController::pageCanBeMovedDown(int page) bool UBDocumentController::pageCanBeMovedDown(int page)
{ {
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
return page != 0 && page < selectedDocument()->pageCount() - 1; return page != 0 && page < selectedDocument()->pageCount() - 1;
else else
return page < selectedDocument()->pageCount() - 1; return page < selectedDocument()->pageCount() - 1;
} }
bool UBDocumentController::pageCanBeDuplicated(int page) bool UBDocumentController::pageCanBeDuplicated(int page)
{ {
return page != 0; return page != 0;
} }
bool UBDocumentController::pageCanBeDeleted(int page) bool UBDocumentController::pageCanBeDeleted(int page)
{ {
return page != 0; return page != 0;
} }
void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*) void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*)
@ -1685,9 +1685,9 @@ void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*)
items << pixmapItem; items << pixmapItem;
int pageIndex = pageFromSceneIndex(i); int pageIndex = pageFromSceneIndex(i);
if(pageIndex) if(pageIndex)
labels << tr("Page %1").arg(pageIndex); labels << tr("Page %1").arg(pageIndex);
else else
labels << tr("Title page"); labels << tr("Title page");
itemsPath.append(QUrl::fromLocalFile(proxy->persistencePath() + QString("/pages/%1").arg(UBDocumentContainer::pageFromSceneIndex(i)))); itemsPath.append(QUrl::fromLocalFile(proxy->persistencePath() + QString("/pages/%1").arg(UBDocumentContainer::pageFromSceneIndex(i))));
} }

@ -39,7 +39,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent
{ {
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setDelegate(new UBGraphicsGroupContainerItemDelegate(this, 0)); setDelegate(new UBGraphicsGroupContainerItemDelegate(this, 0));
Delegate()->init(); Delegate()->init();
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

@ -79,13 +79,13 @@ void UBGraphicsPolygonItem::setUuid(const QUuid &pUuid)
void UBGraphicsPolygonItem::clearStroke() void UBGraphicsPolygonItem::clearStroke()
{ {
if (mStroke!=NULL) if (mStroke!=NULL)
{ {
mStroke->remove(this); mStroke->remove(this);
if (mStroke->polygons().empty()) if (mStroke->polygons().empty())
delete mStroke; delete mStroke;
mStroke = NULL; mStroke = NULL;
} }
} }
UBGraphicsPolygonItem::~UBGraphicsPolygonItem() UBGraphicsPolygonItem::~UBGraphicsPolygonItem()

@ -313,7 +313,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon); UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
public slots: public slots:
void initStroke(); void initStroke();
void hideEraser(); void hideEraser();
void setBackground(bool pIsDark, bool pIsCrossed); void setBackground(bool pIsDark, bool pIsCrossed);

@ -135,18 +135,18 @@ void UBGraphicsStrokesGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
UBItem* UBGraphicsStrokesGroup::deepCopy() const UBItem* UBGraphicsStrokesGroup::deepCopy() const
{ {
UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup(); UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup();
QTransform groupTransform = transform(); QTransform groupTransform = transform();
const_cast<UBGraphicsStrokesGroup*>(this)->resetTransform(); const_cast<UBGraphicsStrokesGroup*>(this)->resetTransform();
QList<QGraphicsItem*> chl = childItems(); QList<QGraphicsItem*> chl = childItems();
foreach(QGraphicsItem *child, chl) foreach(QGraphicsItem *child, chl)
{ {
UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child); UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child);
if (polygon){ if (polygon){
UBGraphicsPolygonItem *polygonCopy = dynamic_cast<UBGraphicsPolygonItem*>(polygon->deepCopy()); UBGraphicsPolygonItem *polygonCopy = dynamic_cast<UBGraphicsPolygonItem*>(polygon->deepCopy());
if (polygonCopy) if (polygonCopy)
{ {
@ -154,18 +154,18 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
copy->addToGroup(pItem); copy->addToGroup(pItem);
polygonCopy->setStrokesGroup(copy); polygonCopy->setStrokesGroup(copy);
} }
} }
} }
const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform); const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform);
copyItemParameters(copy); copyItemParameters(copy);
return copy; return copy;
} }
void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const
{ {
QGraphicsItem *cp = dynamic_cast<QGraphicsItem*>(copy); QGraphicsItem *cp = dynamic_cast<QGraphicsItem*>(copy);
if(NULL != cp) if(NULL != cp)
{ {
cp->setTransform(transform()); cp->setTransform(transform());

@ -27,7 +27,7 @@
void UBPlatformUtils::destroy() void UBPlatformUtils::destroy()
{ {
destroyKeyboardLayouts(); destroyKeyboardLayouts();
} }
UBPlatformUtils::UBPlatformUtils() UBPlatformUtils::UBPlatformUtils()
@ -42,19 +42,19 @@ UBPlatformUtils::~UBPlatformUtils()
bool UBPlatformUtils::hasVirtualKeyboard() bool UBPlatformUtils::hasVirtualKeyboard()
{ {
return keyboardLayouts!=NULL && nKeyboardLayouts!=0; return keyboardLayouts!=NULL && nKeyboardLayouts!=0;
} }
UBKeyboardLocale::~UBKeyboardLocale() UBKeyboardLocale::~UBKeyboardLocale()
{ {
if (varSymbols!=NULL) if (varSymbols!=NULL)
{ {
for(int i=0; i<SYMBOL_KEYS_COUNT; i++) for(int i=0; i<SYMBOL_KEYS_COUNT; i++)
delete varSymbols[i]; delete varSymbols[i];
delete [] varSymbols; delete [] varSymbols;
} }
delete icon; delete icon;
} }
@ -63,7 +63,7 @@ UBKeyboardLocale** UBPlatformUtils::keyboardLayouts;
UBKeyboardLocale** UBPlatformUtils::getKeyboardLayouts(int& nCount) UBKeyboardLocale** UBPlatformUtils::getKeyboardLayouts(int& nCount)
{ {
nCount = nKeyboardLayouts; nCount = nKeyboardLayouts;
return keyboardLayouts; return keyboardLayouts;
} }

@ -89,14 +89,14 @@ struct KEYCODE{
struct KEYBT struct KEYBT
{ {
QChar symbol1; QChar symbol1;
QChar symbol2; QChar symbol2;
bool capsLockSwitch; bool capsLockSwitch;
int modifier1; int modifier1;
int modifier2; int modifier2;
KEYCODE codes[8]; KEYCODE codes[8];
KEYBT( QChar _symbol1, KEYBT( QChar _symbol1,
QChar _symbol2, QChar _symbol2,
bool _capsLockSwitch, bool _capsLockSwitch,
int _modifier1, int _modifier1,
int _modifier2, int _modifier2,
@ -130,40 +130,40 @@ struct KEYBT
class UBKeyboardLocale class UBKeyboardLocale
{ {
public: public:
UBKeyboardLocale(const QString& _fullName, UBKeyboardLocale(const QString& _fullName,
const QString& _name, const QString& _name,
const QString& _id, const QString& _id,
QIcon* _icon, QIcon* _icon,
KEYBT** _symbols) KEYBT** _symbols)
:fullName(_fullName),name(_name), id(_id), icon(_icon), :fullName(_fullName),name(_name), id(_id), icon(_icon),
constSymbols(NULL), varSymbols(_symbols) constSymbols(NULL), varSymbols(_symbols)
{} {}
UBKeyboardLocale(const QString& _fullName, UBKeyboardLocale(const QString& _fullName,
const QString& _name, const QString& _name,
const QString& _id, const QString& _id,
QIcon* _icon, QIcon* _icon,
KEYBT _symbols[]) KEYBT _symbols[])
:fullName(_fullName),name(_name), id(_id), icon(_icon), :fullName(_fullName),name(_name), id(_id), icon(_icon),
constSymbols(_symbols), varSymbols(NULL) constSymbols(_symbols), varSymbols(NULL)
{} {}
~UBKeyboardLocale(); ~UBKeyboardLocale();
const QString fullName; const QString fullName;
const QString name; const QString name;
const QString id; const QString id;
QIcon* icon; QIcon* icon;
KEYBT* operator[] (int index) const KEYBT* operator[] (int index) const
{ {
return (varSymbols==NULL)? constSymbols + index : varSymbols[index]; return (varSymbols==NULL)? constSymbols + index : varSymbols[index];
} }
private: private:
KEYBT* constSymbols; KEYBT* constSymbols;
KEYBT** varSymbols; KEYBT** varSymbols;
}; };
class UBPlatformUtils class UBPlatformUtils

@ -34,7 +34,7 @@
void UBPlatformUtils::init() void UBPlatformUtils::init()
{ {
initializeKeyboardLayouts(); initializeKeyboardLayouts();
} }
QString UBPlatformUtils::applicationResourcesDirectory() QString UBPlatformUtils::applicationResourcesDirectory()
@ -68,11 +68,11 @@ void UBPlatformUtils::fadeDisplayIn()
QStringList UBPlatformUtils::availableTranslations() QStringList UBPlatformUtils::availableTranslations()
{ {
QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/"; QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/";
QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath); QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath);
QRegExp sankoreTranslationFiles(".*sankore_.*.qm"); QRegExp sankoreTranslationFiles(".*sankore_.*.qm");
translationsList=translationsList.filter(sankoreTranslationFiles); translationsList=translationsList.filter(sankoreTranslationFiles);
return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2"); return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2");
} }
QString UBPlatformUtils::translationPath(QString pFilePrefix,QString pLanguage) QString UBPlatformUtils::translationPath(QString pFilePrefix,QString pLanguage)
@ -351,57 +351,57 @@ KEYBT FRENCH_LOCALE[] = {
KEYBT SWISS_FRENCH_LOCALE[] = { KEYBT SWISS_FRENCH_LOCALE[] = {
/* § °*/ KEYBTDECL(0xa7, 0xb0, false, 41), /* § °*/ KEYBTDECL(0xa7, 0xb0, false, 41),
/* 1 +*/ KEYBTDECL(0x31, 0x2b, false, 2), /* 1 +*/ KEYBTDECL(0x31, 0x2b, false, 2),
/* 2 "*/ KEYBTDECL(0x32, 0x22, false, 3), /* 2 "*/ KEYBTDECL(0x32, 0x22, false, 3),
/* 3 **/ KEYBTDECL(0x33, 0x2a, false, 4), /* 3 **/ KEYBTDECL(0x33, 0x2a, false, 4),
/* 4 ç*/ KEYBTDECL(0x34, 0xe7, false, 5), /* 4 ç*/ KEYBTDECL(0x34, 0xe7, false, 5),
/* 5 %*/ KEYBTDECL(0x35, 0x25, false, 6), /* 5 %*/ KEYBTDECL(0x35, 0x25, false, 6),
/* 6 &*/ KEYBTDECL(0x36, 0x26, false, 7), /* 6 &*/ KEYBTDECL(0x36, 0x26, false, 7),
/* 7 /*/ KEYBTDECL(0x37, 0x2f, false, 8), /* 7 /*/ KEYBTDECL(0x37, 0x2f, false, 8),
/* 8 (*/ KEYBTDECL(0x38, 0x28, false, 9), /* 8 (*/ KEYBTDECL(0x38, 0x28, false, 9),
/* 9 )*/ KEYBTDECL(0x39, 0x29, false, 10), /* 9 )*/ KEYBTDECL(0x39, 0x29, false, 10),
/* 0 =*/ KEYBTDECL(0x30, 0x3d, false, 11), /* 0 =*/ KEYBTDECL(0x30, 0x3d, false, 11),
/* ' ?*/ KEYBTDECL(0x27, 0x5f, false, 12), /* ' ?*/ KEYBTDECL(0x27, 0x5f, false, 12),
/* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, KEYCODE(0x5e, 13, 0), KEYCODE(0x60, 13, 1)), /* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, KEYCODE(0x5e, 13, 0), KEYCODE(0x60, 13, 1)),
/* q Q*/ KEYBTDECL(0x71, 0x51, true, 16), /* q Q*/ KEYBTDECL(0x71, 0x51, true, 16),
/* w W*/ KEYBTDECL(0x77, 0x57, true, 17), /* w W*/ KEYBTDECL(0x77, 0x57, true, 17),
/* e E*/ KEYBTDECLEX8(0x65, 0x45, true, 18, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb), /* e E*/ KEYBTDECLEX8(0x65, 0x45, true, 18, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb),
/* r R*/ KEYBTDECL(0x72, 0x52, true, 19), /* r R*/ KEYBTDECL(0x72, 0x52, true, 19),
/* t T*/ KEYBTDECL(0x74, 0x54, true, 20), /* t T*/ KEYBTDECL(0x74, 0x54, true, 20),
/* z Z*/ KEYBTDECL(0x7a, 0x5a, true, 21), /* z Z*/ KEYBTDECL(0x7a, 0x5a, true, 21),
/* u U*/ KEYBTDECLEX8(0x75, 0x55, true, 22, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc), /* u U*/ KEYBTDECLEX8(0x75, 0x55, true, 22, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc),
/* i I*/ KEYBTDECLEX8(0x69, 0x49, true, 23, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf), /* i I*/ KEYBTDECLEX8(0x69, 0x49, true, 23, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf),
/* o O*/ KEYBTDECLEX8(0x6f, 0x4f, true, 24, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6), /* o O*/ KEYBTDECLEX8(0x6f, 0x4f, true, 24, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6),
/* p P*/ KEYBTDECL(0x70, 0x50, true, 25), /* p P*/ KEYBTDECL(0x70, 0x50, true, 25),
/* è ü*/ KEYBTDECL(0xe8, 0xfa, false, 26), /* è ü*/ KEYBTDECL(0xe8, 0xfa, false, 26),
/* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, KEYCODE(0xa8, 27, 0), KEYCODE(0x21, 27, 1)), /* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, KEYCODE(0xa8, 27, 0), KEYCODE(0x21, 27, 1)),
/* a A*/ KEYBTDECLEX8(0x61, 0x41, true, 30, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4), /* a A*/ KEYBTDECLEX8(0x61, 0x41, true, 30, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4),
/* s S*/ KEYBTDECL(0x73, 0x53, true, 31), /* s S*/ KEYBTDECL(0x73, 0x53, true, 31),
/* d D*/ KEYBTDECL(0x64, 0x44, true, 32), /* d D*/ KEYBTDECL(0x64, 0x44, true, 32),
/* f F*/ KEYBTDECL(0x66, 0x46, true, 33), /* f F*/ KEYBTDECL(0x66, 0x46, true, 33),
/* g G*/ KEYBTDECL(0x67, 0x47, true, 34), /* g G*/ KEYBTDECL(0x67, 0x47, true, 34),
/* h H*/ KEYBTDECL(0x68, 0x48, true, 35), /* h H*/ KEYBTDECL(0x68, 0x48, true, 35),
/* j J*/ KEYBTDECL(0x6a, 0x4a, true, 36), /* j J*/ KEYBTDECL(0x6a, 0x4a, true, 36),
/* k K*/ KEYBTDECL(0x6b, 0x4b, true, 37), /* k K*/ KEYBTDECL(0x6b, 0x4b, true, 37),
/* l L*/ KEYBTDECL(0x6c, 0x4c, true, 38), /* l L*/ KEYBTDECL(0x6c, 0x4c, true, 38),
/* é ö*/ KEYBTDECL(0xe9, 0xf6, false, 39), /* é ö*/ KEYBTDECL(0xe9, 0xf6, false, 39),
/* à ä*/ KEYBTDECL(0xe0, 0xe4, false, 40), /* à ä*/ KEYBTDECL(0xe0, 0xe4, false, 40),
/* $ £*/ KEYBTDECL(0x24, 0xa3, false, 43), /* $ £*/ KEYBTDECL(0x24, 0xa3, false, 43),
/* < >*/ KEYBTDECL(0x3c, 0x3e, false, 44), /* < >*/ KEYBTDECL(0x3c, 0x3e, false, 44),
/* y Y*/ KEYBTDECLEX8(0x79, 0x59, true, 45, 0x79, 0x59, 0, 0, 0, 0, 0xff, 0), /* y Y*/ KEYBTDECLEX8(0x79, 0x59, true, 45, 0x79, 0x59, 0, 0, 0, 0, 0xff, 0),
/* x X*/ KEYBTDECL(0x78, 0x58, true, 46), /* x X*/ KEYBTDECL(0x78, 0x58, true, 46),
/* c C*/ KEYBTDECL(0x63, 0x43, true, 47), /* c C*/ KEYBTDECL(0x63, 0x43, true, 47),
/* v V*/ KEYBTDECL(0x76, 0x56, true, 48), /* v V*/ KEYBTDECL(0x76, 0x56, true, 48),
/* b B*/ KEYBTDECL(0x62, 0x42, true, 49), /* b B*/ KEYBTDECL(0x62, 0x42, true, 49),
/* n N*/ KEYBTDECL(0x6e, 0x4e, true, 50), /* n N*/ KEYBTDECL(0x6e, 0x4e, true, 50),
/* m M*/ KEYBTDECL(0x6d, 0x4d, true, 51), /* m M*/ KEYBTDECL(0x6d, 0x4d, true, 51),
/* , ;*/ KEYBTDECL(0x2c, 0x3b, false, 52), /* , ;*/ KEYBTDECL(0x2c, 0x3b, false, 52),
/* . :*/ KEYBTDECL(0x2e, 0x3a, false, 53), /* . :*/ KEYBTDECL(0x2e, 0x3a, false, 53),
/* - _*/ KEYBTDECL(0x2d, 0x5f, false, 54)}; /* - _*/ KEYBTDECL(0x2d, 0x5f, false, 54)};
void UBPlatformUtils::initializeKeyboardLayouts() void UBPlatformUtils::initializeKeyboardLayouts()
@ -418,9 +418,9 @@ void UBPlatformUtils::initializeKeyboardLayouts()
void UBPlatformUtils::destroyKeyboardLayouts() void UBPlatformUtils::destroyKeyboardLayouts()
{ {
for(int i=0; i<nKeyboardLayouts; i++) for(int i=0; i<nKeyboardLayouts; i++)
delete keyboardLayouts[i]; delete keyboardLayouts[i];
delete [] keyboardLayouts; delete [] keyboardLayouts;
keyboardLayouts = NULL; keyboardLayouts = NULL;
} }
QString UBPlatformUtils::urlFromClipboard() QString UBPlatformUtils::urlFromClipboard()

@ -33,7 +33,7 @@
void UBPlatformUtils::init() void UBPlatformUtils::init()
{ {
initializeKeyboardLayouts(); initializeKeyboardLayouts();
} }
@ -70,11 +70,11 @@ void UBPlatformUtils::fadeDisplayIn()
QStringList UBPlatformUtils::availableTranslations() QStringList UBPlatformUtils::availableTranslations()
{ {
QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/"; QString translationsPath = applicationResourcesDirectory() + "/" + "i18n" + "/";
QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath); QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath);
QRegExp sankoreTranslationFiles(".*sankore_.*.qm"); QRegExp sankoreTranslationFiles(".*sankore_.*.qm");
translationsList=translationsList.filter(sankoreTranslationFiles); translationsList=translationsList.filter(sankoreTranslationFiles);
return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2"); return translationsList.replaceInStrings(QRegExp("(.*)sankore_(.*).qm"),"\\2");
} }
QString UBPlatformUtils::translationPath(QString pFilePrefix,QString pLanguage) QString UBPlatformUtils::translationPath(QString pFilePrefix,QString pLanguage)
@ -139,282 +139,282 @@ void UBPlatformUtils::setDesktopMode(bool desktop)
void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivable) void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivable)
{ {
long exStyle = (nonAcivable) ? GetWindowLong(widget->winId(), GWL_EXSTYLE) | WS_EX_NOACTIVATE long exStyle = (nonAcivable) ? GetWindowLong(widget->winId(), GWL_EXSTYLE) | WS_EX_NOACTIVATE
: GetWindowLong(widget->winId(), GWL_EXSTYLE) & ~WS_EX_NOACTIVATE; : GetWindowLong(widget->winId(), GWL_EXSTYLE) & ~WS_EX_NOACTIVATE;
SetWindowLong(widget->winId(), GWL_EXSTYLE, exStyle); SetWindowLong(widget->winId(), GWL_EXSTYLE, exStyle);
} }
#define KEYBTDECL(s1, s2, clSwitch) KEYBT(s1, s2, clSwitch, 0, 0, KEYCODE(s1), KEYCODE(s2)) #define KEYBTDECL(s1, s2, clSwitch) KEYBT(s1, s2, clSwitch, 0, 0, KEYCODE(s1), KEYCODE(s2))
KEYBT RUSSIAN_LOCALE [] = KEYBT RUSSIAN_LOCALE [] =
{ {
/* Ј і */ KEYBTDECL(0x451, 0x401, true), /* Ј і */ KEYBTDECL(0x451, 0x401, true),
/* 1 ! */ KEYBTDECL(0x31, 0x21, false), /* 1 ! */ KEYBTDECL(0x31, 0x21, false),
/* 2 " */ KEYBTDECL(0x32, 0x5c, false), /* 2 " */ KEYBTDECL(0x32, 0x5c, false),
/* 3 ? */ KEYBTDECL(0x33, 0x2116, false), /* 3 ? */ KEYBTDECL(0x33, 0x2116, false),
/* 4 ; */ KEYBTDECL(0x34, 0x3b, false), /* 4 ; */ KEYBTDECL(0x34, 0x3b, false),
/* 5 % */ KEYBTDECL(0x35, 0x25, false), /* 5 % */ KEYBTDECL(0x35, 0x25, false),
/* 6 : */ KEYBTDECL(0x36, 0x3a, false), /* 6 : */ KEYBTDECL(0x36, 0x3a, false),
/* 7 ? */ KEYBTDECL(0x37, 0x3f, false), /* 7 ? */ KEYBTDECL(0x37, 0x3f, false),
/* 8 * */ KEYBTDECL(0x38, 0x2a, false), /* 8 * */ KEYBTDECL(0x38, 0x2a, false),
/* 9 ( */ KEYBTDECL(0x39, 0x28, false), /* 9 ( */ KEYBTDECL(0x39, 0x28, false),
/* 0 ) */ KEYBTDECL(0x30, 0x29, false), /* 0 ) */ KEYBTDECL(0x30, 0x29, false),
/* - _ */ KEYBTDECL(0x2d, 0x4f, false), /* - _ */ KEYBTDECL(0x2d, 0x4f, false),
/* = + */ KEYBTDECL(0x3d, 0x2b, false), /* = + */ KEYBTDECL(0x3d, 0x2b, false),
/* К к */ KEYBTDECL(0x439, 0x419, true), /* К к */ KEYBTDECL(0x439, 0x419, true),
/* Г г */ KEYBTDECL(0x446, 0x426, true), /* Г г */ KEYBTDECL(0x446, 0x426, true),
/* Х х */ KEYBTDECL(0x443, 0x423, true), /* Х х */ KEYBTDECL(0x443, 0x423, true),
/* Л л */ KEYBTDECL(0x43a, 0x41a, true), /* Л л */ KEYBTDECL(0x43a, 0x41a, true),
/* Е е */ KEYBTDECL(0x435, 0x415, true), /* Е е */ KEYBTDECL(0x435, 0x415, true),
/* О о */ KEYBTDECL(0x43d, 0x41d, true), /* О о */ KEYBTDECL(0x43d, 0x41d, true),
/* З з */ KEYBTDECL(0x433, 0x413, true), /* З з */ KEYBTDECL(0x433, 0x413, true),
/* Ы ы */ KEYBTDECL(0x448, 0x428, true), /* Ы ы */ KEYBTDECL(0x448, 0x428, true),
/* Э э */ KEYBTDECL(0x449, 0x429, true), /* Э э */ KEYBTDECL(0x449, 0x429, true),
/* Ъ ъ */ KEYBTDECL(0x437, 0x417, true), /* Ъ ъ */ KEYBTDECL(0x437, 0x417, true),
/* И и */ KEYBTDECL(0x445, 0x425, true), /* И и */ KEYBTDECL(0x445, 0x425, true),
/* Я я */ KEYBTDECL(0x44a, 0x42a, true), /* Я я */ KEYBTDECL(0x44a, 0x42a, true),
/* Ж ж */ KEYBTDECL(0x444, 0x424, true), /* Ж ж */ KEYBTDECL(0x444, 0x424, true),
/* Щ щ */ KEYBTDECL(0x44b, 0x42b, true), /* Щ щ */ KEYBTDECL(0x44b, 0x42b, true),
/* Ч ч */ KEYBTDECL(0x432, 0x412, true), /* Ч ч */ KEYBTDECL(0x432, 0x412, true),
/* Б б */ KEYBTDECL(0x430, 0x410, true), /* Б б */ KEYBTDECL(0x430, 0x410, true),
/* Р р */ KEYBTDECL(0x43f, 0x41f, true), /* Р р */ KEYBTDECL(0x43f, 0x41f, true),
/* Т т */ KEYBTDECL(0x440, 0x420, true), /* Т т */ KEYBTDECL(0x440, 0x420, true),
/* П п */ KEYBTDECL(0x43e, 0x41e, true), /* П п */ KEYBTDECL(0x43e, 0x41e, true),
/* М м */ KEYBTDECL(0x43b, 0x41b, true), /* М м */ KEYBTDECL(0x43b, 0x41b, true),
/* Д д */ KEYBTDECL(0x434, 0x414, true), /* Д д */ KEYBTDECL(0x434, 0x414, true),
/* Ц ц */ KEYBTDECL(0x436, 0x416, true), /* Ц ц */ KEYBTDECL(0x436, 0x416, true),
/* Ь ь */ KEYBTDECL(0x44d, 0x42d, true), /* Ь ь */ KEYBTDECL(0x44d, 0x42d, true),
/* \ / */ KEYBTDECL(0x5c, 0x2f, false), /* \ / */ KEYBTDECL(0x5c, 0x2f, false),
/* С с */ KEYBTDECL(0x44f, 0x42f, true), /* С с */ KEYBTDECL(0x44f, 0x42f, true),
/* Ю ю */ KEYBTDECL(0x447, 0x427, true), /* Ю ю */ KEYBTDECL(0x447, 0x427, true),
/* У у */ KEYBTDECL(0x441, 0x421, true), /* У у */ KEYBTDECL(0x441, 0x421, true),
/* Н н */ KEYBTDECL(0x43c, 0x41c, true), /* Н н */ KEYBTDECL(0x43c, 0x41c, true),
/* Й й */ KEYBTDECL(0x438, 0x418, true), /* Й й */ KEYBTDECL(0x438, 0x418, true),
/* Ф ф */ KEYBTDECL(0x442, 0x422, true), /* Ф ф */ KEYBTDECL(0x442, 0x422, true),
/* Ш ш */ KEYBTDECL(0x44c, 0x42c, true), /* Ш ш */ KEYBTDECL(0x44c, 0x42c, true),
/* В в */ KEYBTDECL(0x431, 0x411, true), /* В в */ KEYBTDECL(0x431, 0x411, true),
/* А а */ KEYBTDECL(0x44e, 0x42e, true), /* А а */ KEYBTDECL(0x44e, 0x42e, true),
/* . , */ KEYBTDECL(0x2e, 0x2c, false)}; /* . , */ KEYBTDECL(0x2e, 0x2c, false)};
KEYBT ENGLISH_LOCALE[] = { KEYBT ENGLISH_LOCALE[] = {
/* ` ~ */ KEYBTDECL(0x60, 0x7e, false), /* ` ~ */ KEYBTDECL(0x60, 0x7e, false),
/* 1 ! */ KEYBTDECL(0x31, 0x21, false), /* 1 ! */ KEYBTDECL(0x31, 0x21, false),
/* 2 @ */ KEYBTDECL(0x32, 0x40, false), /* 2 @ */ KEYBTDECL(0x32, 0x40, false),
/* 3 # */ KEYBTDECL(0x33, 0x23, false), /* 3 # */ KEYBTDECL(0x33, 0x23, false),
/* 4 $ */ KEYBTDECL(0x34, 0x24, false), /* 4 $ */ KEYBTDECL(0x34, 0x24, false),
/* 5 % */ KEYBTDECL(0x35, 0x25, false), /* 5 % */ KEYBTDECL(0x35, 0x25, false),
/* 6 ^ */ KEYBTDECL(0x36, 0x5e, false), /* 6 ^ */ KEYBTDECL(0x36, 0x5e, false),
/* 7 & */ KEYBTDECL(0x37, 0x26, false), /* 7 & */ KEYBTDECL(0x37, 0x26, false),
/* 8 * */ KEYBTDECL(0x38, 0x2a, false), /* 8 * */ KEYBTDECL(0x38, 0x2a, false),
/* 9 ( */ KEYBTDECL(0x39, 0x28, false), /* 9 ( */ KEYBTDECL(0x39, 0x28, false),
/* 0 ) */ KEYBTDECL(0x30, 0x29, false), /* 0 ) */ KEYBTDECL(0x30, 0x29, false),
/* - _ */ KEYBTDECL(0x2d, 0x5f, false), /* - _ */ KEYBTDECL(0x2d, 0x5f, false),
/* = + */ KEYBTDECL(0x3d, 0x2b, false), /* = + */ KEYBTDECL(0x3d, 0x2b, false),
/* q Q */ KEYBTDECL(0x71, 0x51, true), /* q Q */ KEYBTDECL(0x71, 0x51, true),
/* w W */ KEYBTDECL(0x77, 0x57, true), /* w W */ KEYBTDECL(0x77, 0x57, true),
/* e E */ KEYBTDECL(0x65, 0x45, true), /* e E */ KEYBTDECL(0x65, 0x45, true),
/* r R */ KEYBTDECL(0x72, 0x52, true), /* r R */ KEYBTDECL(0x72, 0x52, true),
/* t T */ KEYBTDECL(0x74, 0x54, true), /* t T */ KEYBTDECL(0x74, 0x54, true),
/* y Y */ KEYBTDECL(0x79, 0x59, true), /* y Y */ KEYBTDECL(0x79, 0x59, true),
/* u U */ KEYBTDECL(0x75, 0x55, true), /* u U */ KEYBTDECL(0x75, 0x55, true),
/* i I */ KEYBTDECL(0x69, 0x49, true), /* i I */ KEYBTDECL(0x69, 0x49, true),
/* o O */ KEYBTDECL(0x6f, 0x4f, true), /* o O */ KEYBTDECL(0x6f, 0x4f, true),
/* p P */ KEYBTDECL(0x70, 0x50, true), /* p P */ KEYBTDECL(0x70, 0x50, true),
/* [ { */ KEYBTDECL(0x5b, 0x7b, false), /* [ { */ KEYBTDECL(0x5b, 0x7b, false),
/* ] } */ KEYBTDECL(0x5d, 0x7d, false), /* ] } */ KEYBTDECL(0x5d, 0x7d, false),
/* a A */ KEYBTDECL(0x61, 0x41, true), /* a A */ KEYBTDECL(0x61, 0x41, true),
/* s S */ KEYBTDECL(0x73, 0x53, true), /* s S */ KEYBTDECL(0x73, 0x53, true),
/* d D */ KEYBTDECL(0x64, 0x44, true), /* d D */ KEYBTDECL(0x64, 0x44, true),
/* f F */ KEYBTDECL(0x66, 0x46, true), /* f F */ KEYBTDECL(0x66, 0x46, true),
/* g G */ KEYBTDECL(0x67, 0x47, true), /* g G */ KEYBTDECL(0x67, 0x47, true),
/* h H */ KEYBTDECL(0x68, 0x48, true), /* h H */ KEYBTDECL(0x68, 0x48, true),
/* j J */ KEYBTDECL(0x6a, 0x4a, true), /* j J */ KEYBTDECL(0x6a, 0x4a, true),
/* k K */ KEYBTDECL(0x6b, 0x4b, true), /* k K */ KEYBTDECL(0x6b, 0x4b, true),
/* l L */ KEYBTDECL(0x6c, 0x4c, true), /* l L */ KEYBTDECL(0x6c, 0x4c, true),
/* ; : */ KEYBTDECL(0x3b, 0x3a, false), /* ; : */ KEYBTDECL(0x3b, 0x3a, false),
/* ' " */ KEYBTDECL(0x27, 0x22, false), /* ' " */ KEYBTDECL(0x27, 0x22, false),
/* \ | */ KEYBTDECL(0x5c, 0x7c, false), /* \ | */ KEYBTDECL(0x5c, 0x7c, false),
/* z Z */ KEYBTDECL(0x7a, 0x5a, true), /* z Z */ KEYBTDECL(0x7a, 0x5a, true),
/* x X */ KEYBTDECL(0x78, 0x58, true), /* x X */ KEYBTDECL(0x78, 0x58, true),
/* c C */ KEYBTDECL(0x63, 0x43, true), /* c C */ KEYBTDECL(0x63, 0x43, true),
/* v V */ KEYBTDECL(0x76, 0x56, true), /* v V */ KEYBTDECL(0x76, 0x56, true),
/* b B */ KEYBTDECL(0x62, 0x42, true), /* b B */ KEYBTDECL(0x62, 0x42, true),
/* n N */ KEYBTDECL(0x6e, 0x4e, true), /* n N */ KEYBTDECL(0x6e, 0x4e, true),
/* m M */ KEYBTDECL(0x6d, 0x4d, true), /* m M */ KEYBTDECL(0x6d, 0x4d, true),
/* , < */ KEYBTDECL(0x2c, 0x3c, false), /* , < */ KEYBTDECL(0x2c, 0x3c, false),
/* . > */ KEYBTDECL(0x2e, 0x3e, false), /* . > */ KEYBTDECL(0x2e, 0x3e, false),
/* / ? */ KEYBTDECL(0x2f, 0x5f, false)}; /* / ? */ KEYBTDECL(0x2f, 0x5f, false)};
KEYBT FRENCH_LOCALE[] = { KEYBT FRENCH_LOCALE[] = {
/* ? ? */ KEYBTDECL(0xb2, 0xb2, true), /* ? ? */ KEYBTDECL(0xb2, 0xb2, true),
/* & 1 */ KEYBTDECL(0x26, 0x31, true), /* & 1 */ KEYBTDECL(0x26, 0x31, true),
/* ? 2 */ KEYBTDECL(0xe9, 0x32, true), /* ? 2 */ KEYBTDECL(0xe9, 0x32, true),
/* " 3 */ KEYBTDECL(0x22, 0x33, true), /* " 3 */ KEYBTDECL(0x22, 0x33, true),
/* ' 4 */ KEYBTDECL(0x27, 0x34, true), /* ' 4 */ KEYBTDECL(0x27, 0x34, true),
/* ( 5 */ KEYBTDECL(0x28, 0x35, true), /* ( 5 */ KEYBTDECL(0x28, 0x35, true),
/* - 6 */ KEYBTDECL(0x2d, 0x36, true), /* - 6 */ KEYBTDECL(0x2d, 0x36, true),
/* ? 7 */ KEYBTDECL(0xe8, 0x37, true), /* ? 7 */ KEYBTDECL(0xe8, 0x37, true),
/* _ 8 */ KEYBTDECL(0x5f, 0x38, true), /* _ 8 */ KEYBTDECL(0x5f, 0x38, true),
/* ? 9 */ KEYBTDECL(0xe7, 0x39, true), /* ? 9 */ KEYBTDECL(0xe7, 0x39, true),
/* ? 0 */ KEYBTDECL(0xe0, 0x30, true), /* ? 0 */ KEYBTDECL(0xe0, 0x30, true),
/* ) ? */ KEYBTDECL(0x29, 0xb0, true), /* ) ? */ KEYBTDECL(0x29, 0xb0, true),
/* = + */ KEYBTDECL(0x3d, 0x2b, true), /* = + */ KEYBTDECL(0x3d, 0x2b, true),
/* a A */ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe4, 0xc4), /* a A */ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe4, 0xc4),
/* z Z */ KEYBTDECL(0x7a, 0x5a, true), /* z Z */ KEYBTDECL(0x7a, 0x5a, true),
/* e E */ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xeb, 0xcb), /* e E */ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xeb, 0xcb),
/* r R */ KEYBTDECL(0x72, 0x52, true), /* r R */ KEYBTDECL(0x72, 0x52, true),
/* t T */ KEYBTDECL(0x74, 0x54, true), /* t T */ KEYBTDECL(0x74, 0x54, true),
/* y Y */ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0xff), /* y Y */ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0xff),
/* u U */ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xfc, 0xdc), /* u U */ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xfc, 0xdc),
/* i I */ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xef, 0xcf), /* i I */ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xef, 0xcf),
/* o O */ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf6, 0xd6), /* o O */ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf6, 0xd6),
/* p P */ KEYBTDECL(0x70, 0x50, true), /* p P */ KEYBTDECL(0x70, 0x50, true),
/* ^ ? */ KEYBT(0x5e, 0xa8, true, 1, 2, 0x5e, 0xa8), /* ^ ? */ KEYBT(0x5e, 0xa8, true, 1, 2, 0x5e, 0xa8),
/* $ ? } */ KEYBTDECL(0x24, 0xa3, true), /* $ ? } */ KEYBTDECL(0x24, 0xa3, true),
/* q Q */ KEYBTDECL(0x71, 0x51, true), /* q Q */ KEYBTDECL(0x71, 0x51, true),
/* s S */ KEYBTDECL(0x73, 0x53, true), /* s S */ KEYBTDECL(0x73, 0x53, true),
/* d D */ KEYBTDECL(0x64, 0x44, true), /* d D */ KEYBTDECL(0x64, 0x44, true),
/* f F */ KEYBTDECL(0x66, 0x46, true), /* f F */ KEYBTDECL(0x66, 0x46, true),
/* g G */ KEYBTDECL(0x67, 0x47, true), /* g G */ KEYBTDECL(0x67, 0x47, true),
/* h H */ KEYBTDECL(0x68, 0x48, true), /* h H */ KEYBTDECL(0x68, 0x48, true),
/* j J */ KEYBTDECL(0x6a, 0x4a, true), /* j J */ KEYBTDECL(0x6a, 0x4a, true),
/* k K */ KEYBTDECL(0x6b, 0x4b, true), /* k K */ KEYBTDECL(0x6b, 0x4b, true),
/* l L */ KEYBTDECL(0x6c, 0x4c, true), /* l L */ KEYBTDECL(0x6c, 0x4c, true),
/* m M */ KEYBTDECL(0x6d, 0x4d, true), /* m M */ KEYBTDECL(0x6d, 0x4d, true),
/* ? % */ KEYBTDECL(0xf9, 0x25, true), /* ? % */ KEYBTDECL(0xf9, 0x25, true),
/* * ? */ KEYBTDECL(0x2a, 0xb5, true), /* * ? */ KEYBTDECL(0x2a, 0xb5, true),
/* w W */ KEYBTDECL(0x77, 0x57, true), /* w W */ KEYBTDECL(0x77, 0x57, true),
/* x X */ KEYBTDECL(0x78, 0x58, true), /* x X */ KEYBTDECL(0x78, 0x58, true),
/* c C */ KEYBTDECL(0x63, 0x43, true), /* c C */ KEYBTDECL(0x63, 0x43, true),
/* v V */ KEYBTDECL(0x76, 0x56, true), /* v V */ KEYBTDECL(0x76, 0x56, true),
/* b B */ KEYBTDECL(0x62, 0x42, true), /* b B */ KEYBTDECL(0x62, 0x42, true),
/* n N */ KEYBTDECL(0x6e, 0x4e, true), /* n N */ KEYBTDECL(0x6e, 0x4e, true),
/* , ? */ KEYBTDECL(0x2c, 0x3f, true), /* , ? */ KEYBTDECL(0x2c, 0x3f, true),
/* ; . */ KEYBTDECL(0x3b, 0x2e, true), /* ; . */ KEYBTDECL(0x3b, 0x2e, true),
/* : / */ KEYBTDECL(0x3a, 0x2f, true), /* : / */ KEYBTDECL(0x3a, 0x2f, true),
/* ! ? */ KEYBTDECL(0x21, 0xa7, true)}; /* ! ? */ KEYBTDECL(0x21, 0xa7, true)};
KEYBT SWISS_FRENCH_LOCALE[] = { KEYBT SWISS_FRENCH_LOCALE[] = {
/* § °*/ KEYBTDECL(0xa7, 0xb0, false), /* § °*/ KEYBTDECL(0xa7, 0xb0, false),
/* 1 +*/ KEYBTDECL(0x31, 0x2b, false), /* 1 +*/ KEYBTDECL(0x31, 0x2b, false),
/* 2 "*/ KEYBTDECL(0x32, 0x22, false), /* 2 "*/ KEYBTDECL(0x32, 0x22, false),
/* 3 **/ KEYBTDECL(0x33, 0x2a, false), /* 3 **/ KEYBTDECL(0x33, 0x2a, false),
/* 4 ç*/ KEYBTDECL(0x34, 0xe7, false), /* 4 ç*/ KEYBTDECL(0x34, 0xe7, false),
/* 5 %*/ KEYBTDECL(0x35, 0x25, false), /* 5 %*/ KEYBTDECL(0x35, 0x25, false),
/* 6 &*/ KEYBTDECL(0x36, 0x26, false), /* 6 &*/ KEYBTDECL(0x36, 0x26, false),
/* 7 /*/ KEYBTDECL(0x37, 0x2f, false), /* 7 /*/ KEYBTDECL(0x37, 0x2f, false),
/* 8 (*/ KEYBTDECL(0x38, 0x28, false), /* 8 (*/ KEYBTDECL(0x38, 0x28, false),
/* 9 )*/ KEYBTDECL(0x39, 0x29, false), /* 9 )*/ KEYBTDECL(0x39, 0x29, false),
/* 0 =*/ KEYBTDECL(0x30, 0x3d, false), /* 0 =*/ KEYBTDECL(0x30, 0x3d, false),
/* ' ?*/ KEYBTDECL(0x27, 0x5f, false), /* ' ?*/ KEYBTDECL(0x27, 0x5f, false),
/* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, 0x5e, 0x60), /* ^ `*/ KEYBT(0x5e, 0x60, false, 1, 2, 0x5e, 0x60),
/* q Q*/ KEYBTDECL(0x71, 0x51, true), /* q Q*/ KEYBTDECL(0x71, 0x51, true),
/* w W*/ KEYBTDECL(0x77, 0x57, true), /* w W*/ KEYBTDECL(0x77, 0x57, true),
/* e E*/ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb), /* e E*/ KEYBT(0x65, 0x45, true, 0, 0, 0x65, 0x45, 0xea, 0xca, 0xe8, 0xc8, 0xeb, 0xcb),
/* r R*/ KEYBTDECL(0x72, 0x52, true), /* r R*/ KEYBTDECL(0x72, 0x52, true),
/* t T*/ KEYBTDECL(0x74, 0x54, true), /* t T*/ KEYBTDECL(0x74, 0x54, true),
/* z Z*/ KEYBTDECL(0x7a, 0x5a, true), /* z Z*/ KEYBTDECL(0x7a, 0x5a, true),
/* u U*/ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc), /* u U*/ KEYBT(0x75, 0x55, true, 0, 0, 0x75, 0x55, 0xfb, 0xdb, 0xf9, 0xd9, 0xfc, 0xdc),
/* i I*/ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf), /* i I*/ KEYBT(0x69, 0x49, true, 0, 0, 0x69, 0x49, 0xee, 0xce, 0xec, 0xcc, 0xef, 0xcf),
/* o O*/ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6), /* o O*/ KEYBT(0x6f, 0x4f, true, 0, 0, 0x6f, 0x4f, 0xf4, 0xd4, 0xf2, 0xd2, 0xf6, 0xd6),
/* p P*/ KEYBTDECL(0x70, 0x50, true), /* p P*/ KEYBTDECL(0x70, 0x50, true),
/* è ü*/ KEYBTDECL(0xe8, 0xfa, false), /* è ü*/ KEYBTDECL(0xe8, 0xfa, false),
/* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, 0xa8, 0x21), /* ¨ !*/ KEYBT(0xa8, 0x21, false, 3, 0, 0xa8, 0x21),
/* a A*/ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4), /* a A*/ KEYBT(0x61, 0x41, true, 0, 0, 0x61, 0x41, 0xe2, 0xc2, 0xe0, 0xc0, 0xe4, 0xc4),
/* s S*/ KEYBTDECL(0x73, 0x53, true), /* s S*/ KEYBTDECL(0x73, 0x53, true),
/* d D*/ KEYBTDECL(0x64, 0x44, true), /* d D*/ KEYBTDECL(0x64, 0x44, true),
/* f F*/ KEYBTDECL(0x66, 0x46, true), /* f F*/ KEYBTDECL(0x66, 0x46, true),
/* g G*/ KEYBTDECL(0x67, 0x47, true), /* g G*/ KEYBTDECL(0x67, 0x47, true),
/* h H*/ KEYBTDECL(0x68, 0x48, true), /* h H*/ KEYBTDECL(0x68, 0x48, true),
/* j J*/ KEYBTDECL(0x6a, 0x4a, true), /* j J*/ KEYBTDECL(0x6a, 0x4a, true),
/* k K*/ KEYBTDECL(0x6b, 0x4b, true), /* k K*/ KEYBTDECL(0x6b, 0x4b, true),
/* l L*/ KEYBTDECL(0x6c, 0x4c, true), /* l L*/ KEYBTDECL(0x6c, 0x4c, true),
/* é ö*/ KEYBTDECL(0xe9, 0xf6, false), /* é ö*/ KEYBTDECL(0xe9, 0xf6, false),
/* à ä*/ KEYBTDECL(0xe0, 0xe4, false), /* à ä*/ KEYBTDECL(0xe0, 0xe4, false),
/* $ £*/ KEYBTDECL(0x24, 0xa3, false), /* $ £*/ KEYBTDECL(0x24, 0xa3, false),
/* < >*/ KEYBTDECL(0x3c, 0x3e, false), /* < >*/ KEYBTDECL(0x3c, 0x3e, false),
/* y Y*/ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0, 0, 0xff), /* y Y*/ KEYBT(0x79, 0x59, true, 0, 0, 0x79, 0x59, 0, 0, 0, 0, 0xff),
/* x X*/ KEYBTDECL(0x78, 0x58, true), /* x X*/ KEYBTDECL(0x78, 0x58, true),
/* c C*/ KEYBTDECL(0x63, 0x43, true), /* c C*/ KEYBTDECL(0x63, 0x43, true),
/* v V*/ KEYBTDECL(0x76, 0x56, true), /* v V*/ KEYBTDECL(0x76, 0x56, true),
/* b B*/ KEYBTDECL(0x62, 0x42, true), /* b B*/ KEYBTDECL(0x62, 0x42, true),
/* n N*/ KEYBTDECL(0x6e, 0x4e, true), /* n N*/ KEYBTDECL(0x6e, 0x4e, true),
/* m M*/ KEYBTDECL(0x6d, 0x4d, true), /* m M*/ KEYBTDECL(0x6d, 0x4d, true),
/* , ;*/ KEYBTDECL(0x2c, 0x3b, false), /* , ;*/ KEYBTDECL(0x2c, 0x3b, false),
/* . :*/ KEYBTDECL(0x2e, 0x3a, false), /* . :*/ KEYBTDECL(0x2e, 0x3a, false),
/* - _*/ KEYBTDECL(0x2d, 0x5f, false)}; /* - _*/ KEYBTDECL(0x2d, 0x5f, false)};
KEYBT GERMAN_LOCALE[] = { KEYBT GERMAN_LOCALE[] = {
/* ^ ? */ KEYBTDECL(0x5f, 0xb0, false), /* ^ ? */ KEYBTDECL(0x5f, 0xb0, false),
/* 1 ! */ KEYBTDECL(0x31, 0x21, true), /* 1 ! */ KEYBTDECL(0x31, 0x21, true),
/* 2 " */ KEYBTDECL(0x32, 0x22, true), /* 2 " */ KEYBTDECL(0x32, 0x22, true),
/* 3 § */ KEYBTDECL(0x33, 0xa7, true), /* 3 § */ KEYBTDECL(0x33, 0xa7, true),
/* 4 $ */ KEYBTDECL(0x34, 0x24, true), /* 4 $ */ KEYBTDECL(0x34, 0x24, true),
/* 5 % */ KEYBTDECL(0x35, 0x25, true), /* 5 % */ KEYBTDECL(0x35, 0x25, true),
/* 6 & */ KEYBTDECL(0x36, 0x26, true), /* 6 & */ KEYBTDECL(0x36, 0x26, true),
/* 7 / */ KEYBTDECL(0x37, 0x2f, true), /* 7 / */ KEYBTDECL(0x37, 0x2f, true),
/* 8 ( */ KEYBTDECL(0x38, 0x28, true), /* 8 ( */ KEYBTDECL(0x38, 0x28, true),
/* 9 ) */ KEYBTDECL(0x39, 0x29, true), /* 9 ) */ KEYBTDECL(0x39, 0x29, true),
/* 0 = */ KEYBTDECL(0x30, 0x3d, true), /* 0 = */ KEYBTDECL(0x30, 0x3d, true),
/* ? ? */ KEYBTDECL(0xdf, 0x3f, true), /* ? ? */ KEYBTDECL(0xdf, 0x3f, true),
/* ` ? */ KEYBTDECL(0x60, 0xb4, false), /* ` ? */ KEYBTDECL(0x60, 0xb4, false),
/* q Q */ KEYBTDECL(0x71, 0x51, true), /* q Q */ KEYBTDECL(0x71, 0x51, true),
/* w W */ KEYBTDECL(0x77, 0x57, true), /* w W */ KEYBTDECL(0x77, 0x57, true),
/* e E */ KEYBTDECL(0x65, 0x45, true), /* e E */ KEYBTDECL(0x65, 0x45, true),
/* r R */ KEYBTDECL(0x72, 0x52, true), /* r R */ KEYBTDECL(0x72, 0x52, true),
/* t T */ KEYBTDECL(0x74, 0x54, true), /* t T */ KEYBTDECL(0x74, 0x54, true),
/* z Z */ KEYBTDECL(0x7a, 0x5a, true), /* z Z */ KEYBTDECL(0x7a, 0x5a, true),
/* u U */ KEYBTDECL(0x75, 0x55, true), /* u U */ KEYBTDECL(0x75, 0x55, true),
/* i I */ KEYBTDECL(0x69, 0x49, true), /* i I */ KEYBTDECL(0x69, 0x49, true),
/* o O */ KEYBTDECL(0x6f, 0x4f, true), /* o O */ KEYBTDECL(0x6f, 0x4f, true),
/* p P */ KEYBTDECL(0x70, 0x50, true), /* p P */ KEYBTDECL(0x70, 0x50, true),
/* ? ? */ KEYBTDECL(0xfc, 0xdc, true), /* ? ? */ KEYBTDECL(0xfc, 0xdc, true),
/* + * */ KEYBTDECL(0x2b, 0x2a, true), /* + * */ KEYBTDECL(0x2b, 0x2a, true),
/* a A */ KEYBTDECL(0x61, 0x41, true), /* a A */ KEYBTDECL(0x61, 0x41, true),
/* s S */ KEYBTDECL(0x73, 0x53, true), /* s S */ KEYBTDECL(0x73, 0x53, true),
/* d D */ KEYBTDECL(0x64, 0x44, true), /* d D */ KEYBTDECL(0x64, 0x44, true),
/* f F */ KEYBTDECL(0x66, 0x46, true), /* f F */ KEYBTDECL(0x66, 0x46, true),
/* g G */ KEYBTDECL(0x67, 0x47, true), /* g G */ KEYBTDECL(0x67, 0x47, true),
/* h H */ KEYBTDECL(0x68, 0x48, true), /* h H */ KEYBTDECL(0x68, 0x48, true),
/* j J */ KEYBTDECL(0x6a, 0x4a, true), /* j J */ KEYBTDECL(0x6a, 0x4a, true),
/* k K */ KEYBTDECL(0x6b, 0x4b, true), /* k K */ KEYBTDECL(0x6b, 0x4b, true),
/* l L */ KEYBTDECL(0x6c, 0x4c, true), /* l L */ KEYBTDECL(0x6c, 0x4c, true),
/* ? ? */ KEYBTDECL(0xf6, 0xd6, true), /* ? ? */ KEYBTDECL(0xf6, 0xd6, true),
/* ? ? */ KEYBTDECL(0xe4, 0xc4, true), /* ? ? */ KEYBTDECL(0xe4, 0xc4, true),
/* ' # */ KEYBTDECL(0x27, 0x23, true), /* ' # */ KEYBTDECL(0x27, 0x23, true),
/* y Y */ KEYBTDECL(0x79, 0x59, true), /* y Y */ KEYBTDECL(0x79, 0x59, true),
/* x X */ KEYBTDECL(0x78, 0x58, true), /* x X */ KEYBTDECL(0x78, 0x58, true),
/* c C */ KEYBTDECL(0x63, 0x43, true), /* c C */ KEYBTDECL(0x63, 0x43, true),
/* v V */ KEYBTDECL(0x76, 0x56, true), /* v V */ KEYBTDECL(0x76, 0x56, true),
/* b B */ KEYBTDECL(0x62, 0x42, true), /* b B */ KEYBTDECL(0x62, 0x42, true),
/* n N */ KEYBTDECL(0x6e, 0x4e, true), /* n N */ KEYBTDECL(0x6e, 0x4e, true),
/* m M */ KEYBTDECL(0x6d, 0x4d, true), /* m M */ KEYBTDECL(0x6d, 0x4d, true),
/* , ; */ KEYBTDECL(0x2c, 0x3b, true), /* , ; */ KEYBTDECL(0x2c, 0x3b, true),
/* . : */ KEYBTDECL(0x2e, 0x3a, true), /* . : */ KEYBTDECL(0x2e, 0x3a, true),
/* _ - */ KEYBTDECL(0x5f, 0x2d, false)}; /* _ - */ KEYBTDECL(0x5f, 0x2d, false)};
void UBPlatformUtils::initializeKeyboardLayouts() void UBPlatformUtils::initializeKeyboardLayouts()
{ {
nKeyboardLayouts = 5; nKeyboardLayouts = 5;
keyboardLayouts = new UBKeyboardLocale*[nKeyboardLayouts]; keyboardLayouts = new UBKeyboardLocale*[nKeyboardLayouts];
keyboardLayouts[0] = new UBKeyboardLocale(tr("English"), "en", "", new QIcon(":/images/flags/en.png"), ENGLISH_LOCALE); keyboardLayouts[0] = new UBKeyboardLocale(tr("English"), "en", "", new QIcon(":/images/flags/en.png"), ENGLISH_LOCALE);
keyboardLayouts[1] = new UBKeyboardLocale(tr("Russian"), "ru", "", new QIcon(":/images/flags/ru.png"),RUSSIAN_LOCALE); keyboardLayouts[1] = new UBKeyboardLocale(tr("Russian"), "ru", "", new QIcon(":/images/flags/ru.png"),RUSSIAN_LOCALE);
keyboardLayouts[2] = new UBKeyboardLocale(tr("French"), "fr", "", new QIcon(":/images/flags/fr.png"), FRENCH_LOCALE); keyboardLayouts[2] = new UBKeyboardLocale(tr("French"), "fr", "", new QIcon(":/images/flags/fr.png"), FRENCH_LOCALE);
@ -424,10 +424,10 @@ void UBPlatformUtils::initializeKeyboardLayouts()
void UBPlatformUtils::destroyKeyboardLayouts() void UBPlatformUtils::destroyKeyboardLayouts()
{ {
for(int i=0; i<nKeyboardLayouts; i++) for(int i=0; i<nKeyboardLayouts; i++)
delete keyboardLayouts[i]; delete keyboardLayouts[i];
delete [] keyboardLayouts; delete [] keyboardLayouts;
keyboardLayouts = NULL; keyboardLayouts = NULL;
} }
QString UBPlatformUtils::urlFromClipboard() QString UBPlatformUtils::urlFromClipboard()

File diff suppressed because it is too large Load Diff

@ -42,7 +42,7 @@ class UBDocumentProxy;
#include "UBDockPaletteWidget.h" #include "UBDockPaletteWidget.h"
#define TABSIZE 50 //Height of the tab of the palette #define TABSIZE 50 //Height of the tab of the palette
#define CLICKTIME 1000000 //Clicktime to expand or collapse palette #define CLICKTIME 1000000 //Clicktime to expand or collapse palette
/** /**

@ -55,5 +55,5 @@ UBDockTeacherGuideWidget::~UBDockTeacherGuideWidget()
UBTeacherGuideWidget* UBDockTeacherGuideWidget::teacherGuideWidget() UBTeacherGuideWidget* UBDockTeacherGuideWidget::teacherGuideWidget()
{ {
return mpTeacherGuideWidget; return mpTeacherGuideWidget;
} }

@ -87,8 +87,8 @@ UBDocumentNavigator::~UBDocumentNavigator()
void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{ {
mThumbsWithLabels.clear(); mThumbsWithLabels.clear();
foreach(QGraphicsItem* it, mScene->items()) foreach(QGraphicsItem* it, mScene->items())
{ {
mScene->removeItem(it); mScene->removeItem(it);
delete it; delete it;
@ -106,15 +106,15 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex); QString label = pageIndex == 0 ? tr("Title page") : tr("Page %0").arg(pageIndex);
UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label); UBThumbnailTextItem *labelItem = new UBThumbnailTextItem(label);
UBImgTextThumbnailElement thumbWithText(pixmapItem, labelItem); UBImgTextThumbnailElement thumbWithText(pixmapItem, labelItem);
thumbWithText.setBorder(border()); thumbWithText.setBorder(border());
mThumbsWithLabels.append(thumbWithText); mThumbsWithLabels.append(thumbWithText);
mScene->addItem(pixmapItem); mScene->addItem(pixmapItem);
mScene->addItem(labelItem); mScene->addItem(labelItem);
} }
// Draw the items // Draw the items
refreshScene(); refreshScene();
} }
@ -173,7 +173,7 @@ void UBDocumentNavigator::refreshScene()
UBImgTextThumbnailElement& item = mThumbsWithLabels[i]; UBImgTextThumbnailElement& item = mThumbsWithLabels[i];
int columnIndex = i % mNbColumns; int columnIndex = i % mNbColumns;
int rowIndex = i / mNbColumns; int rowIndex = i / mNbColumns;
item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight); item.Place(rowIndex, columnIndex, mThumbnailWidth, thumbnailHeight);
} }
scene()->setSceneRect(scene()->itemsBoundingRect()); scene()->setSceneRect(scene()->itemsBoundingRect());
} }
@ -258,29 +258,29 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
if(NULL != pTextItem) if(NULL != pTextItem)
{ {
for(int i = 0; i < mThumbsWithLabels.size(); i++) for(int i = 0; i < mThumbsWithLabels.size(); i++)
{ {
const UBImgTextThumbnailElement& el = mThumbsWithLabels.at(i); const UBImgTextThumbnailElement& el = mThumbsWithLabels.at(i);
if(el.getCaption() == pTextItem) if(el.getCaption() == pTextItem)
{ {
pCrntItem = el.getThumbnail(); pCrntItem = el.getThumbnail();
break; break;
} }
} }
} }
} }
int index = 0; int index = 0;
for(int i = 0; i < mThumbsWithLabels.size(); i++) for(int i = 0; i < mThumbsWithLabels.size(); i++)
{ {
if (mThumbsWithLabels.at(i).getThumbnail() == pCrntItem) if (mThumbsWithLabels.at(i).getThumbnail() == pCrntItem)
{ {
index = i; index = i;
break; break;
} }
} }
UBApplication::boardController->setActiveDocumentScene(index); UBApplication::boardController->setActiveDocumentScene(index);
} }
QGraphicsView::mousePressEvent(event); QGraphicsView::mousePressEvent(event);
} }
void UBDocumentNavigator::mouseReleaseEvent(QMouseEvent *event) void UBDocumentNavigator::mouseReleaseEvent(QMouseEvent *event)

@ -34,7 +34,7 @@
#include "document/UBDocumentContainer.h" #include "document/UBDocumentContainer.h"
#include "UBThumbnailWidget.h" #include "UBThumbnailWidget.h"
#define NO_PAGESELECTED -1 #define NO_PAGESELECTED -1
class UBDocumentNavigator : public QGraphicsView class UBDocumentNavigator : public QGraphicsView
{ {
@ -68,8 +68,8 @@ private:
QGraphicsScene* mScene; QGraphicsScene* mScene;
/** The current selected item */ /** The current selected item */
//UBSceneThumbnailNavigPixmap* mCrntItem; //UBSceneThumbnailNavigPixmap* mCrntItem;
/** The list of current thumbnails with labels*/ /** The list of current thumbnails with labels*/
QList<UBImgTextThumbnailElement> mThumbsWithLabels; QList<UBImgTextThumbnailElement> mThumbsWithLabels;
/** The current number of columns */ /** The current number of columns */
int mNbColumns; int mNbColumns;
/** The current thumbnails width */ /** The current thumbnails width */

@ -38,12 +38,12 @@ UBDocumentThumbnailWidget::UBDocumentThumbnailWidget(QWidget* parent)
: UBThumbnailWidget(parent) : UBThumbnailWidget(parent)
, mDropCaretRectItem(0) , mDropCaretRectItem(0)
, mClosestDropItem(0) , mClosestDropItem(0)
, mDragEnabled(true) , mDragEnabled(true)
, mScrollMagnitude(0) , mScrollMagnitude(0)
{ {
bCanDrag = false; bCanDrag = false;
mScrollTimer = new QTimer(this); mScrollTimer = new QTimer(this);
connect(mScrollTimer, SIGNAL(timeout()), this, SLOT(autoScroll())); connect(mScrollTimer, SIGNAL(timeout()), this, SLOT(autoScroll()));
} }
@ -78,18 +78,18 @@ void UBDocumentThumbnailWidget::mouseMoveEvent(QMouseEvent *event)
{ {
int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex());
if(pageIndex != 0){ if(pageIndex != 0){
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
QList<UBMimeDataItem> mimeDataItems; QList<UBMimeDataItem> mimeDataItems;
foreach (QGraphicsItem *item, selectedItems()) foreach (QGraphicsItem *item, selectedItems())
mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item))); mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item)));
UBMimeData *mime = new UBMimeData(mimeDataItems); UBMimeData *mime = new UBMimeData(mimeDataItems);
drag->setMimeData(mime); drag->setMimeData(mime);
drag->setPixmap(sceneItem->pixmap().scaledToWidth(100)); drag->setPixmap(sceneItem->pixmap().scaledToWidth(100));
drag->setHotSpot(QPoint(drag->pixmap().width()/2, drag->pixmap().height() / 2)); drag->setHotSpot(QPoint(drag->pixmap().width()/2, drag->pixmap().height() / 2));
drag->exec(Qt::MoveAction); drag->exec(Qt::MoveAction);
} }
} }
@ -111,43 +111,43 @@ void UBDocumentThumbnailWidget::dragEnterEvent(QDragEnterEvent *event)
void UBDocumentThumbnailWidget::dragLeaveEvent(QDragLeaveEvent *event) void UBDocumentThumbnailWidget::dragLeaveEvent(QDragLeaveEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
if (mScrollTimer->isActive()) if (mScrollTimer->isActive())
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
deleteDropCaret(); deleteDropCaret();
UBThumbnailWidget::dragLeaveEvent(event); UBThumbnailWidget::dragLeaveEvent(event);
} }
void UBDocumentThumbnailWidget::autoScroll() void UBDocumentThumbnailWidget::autoScroll()
{ {
this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude);
} }
void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
{ {
QRect boundingFrame = frameRect(); QRect boundingFrame = frameRect();
//setting up automatic scrolling //setting up automatic scrolling
const int SCROLL_DISTANCE = 16; const int SCROLL_DISTANCE = 16;
int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y();
if(qAbs(bottomDist) <= SCROLL_DISTANCE) if(qAbs(bottomDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else if(qAbs(topDist) <= SCROLL_DISTANCE) else if(qAbs(topDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else else
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
QList<UBSceneThumbnailPixmap*> pixmapItems; QList<UBSceneThumbnailPixmap*> pixmapItems;
foreach (QGraphicsItem *item, scene()->items(mapToScene(boundingFrame))) foreach (QGraphicsItem *item, scene()->items(mapToScene(boundingFrame)))
{ {
UBSceneThumbnailPixmap* sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(item); UBSceneThumbnailPixmap* sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(item);
@ -161,11 +161,11 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
int pageIndex = -1; int pageIndex = -1;
if(mClosestDropItem){ if(mClosestDropItem){
pageIndex = UBDocumentContainer::pageFromSceneIndex(mClosestDropItem->sceneIndex()); pageIndex = UBDocumentContainer::pageFromSceneIndex(mClosestDropItem->sceneIndex());
if(pageIndex == 0){ if(pageIndex == 0){
event->acceptProposedAction(); event->acceptProposedAction();
return; return;
} }
} }
if (!mClosestDropItem) if (!mClosestDropItem)
{ {
@ -219,19 +219,19 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
void UBDocumentThumbnailWidget::dropEvent(QDropEvent *event) void UBDocumentThumbnailWidget::dropEvent(QDropEvent *event)
{ {
if (mScrollTimer->isActive()) if (mScrollTimer->isActive())
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
deleteDropCaret(); deleteDropCaret();
if (mClosestDropItem) if (mClosestDropItem)
{ {
int targetIndex = mDropIsRight ? mGraphicItems.indexOf(mClosestDropItem) + 1 : mGraphicItems.indexOf(mClosestDropItem); int targetIndex = mDropIsRight ? mGraphicItems.indexOf(mClosestDropItem) + 1 : mGraphicItems.indexOf(mClosestDropItem);
if(UBDocumentContainer::pageFromSceneIndex(targetIndex) == 0){ if(UBDocumentContainer::pageFromSceneIndex(targetIndex) == 0){
event->ignore(); event->ignore();
return; return;
} }
QList<UBMimeDataItem> mimeDataItems; QList<UBMimeDataItem> mimeDataItems;

@ -49,8 +49,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget
signals: signals:
void sceneDropped(UBDocumentProxy* proxy, int source, int target); void sceneDropped(UBDocumentProxy* proxy, int source, int target);
private slots: private slots:
void autoScroll(); void autoScroll();
protected: protected:
@ -68,8 +68,8 @@ class UBDocumentThumbnailWidget: public UBThumbnailWidget
UBSceneThumbnailPixmap *mClosestDropItem; UBSceneThumbnailPixmap *mClosestDropItem;
bool mDropIsRight; bool mDropIsRight;
bool mDragEnabled; bool mDragEnabled;
QTimer* mScrollTimer; QTimer* mScrollTimer;
int mScrollMagnitude; int mScrollMagnitude;
}; };
#endif /* UBDOCUMENTTHUMBNAILWIDGET_H_ */ #endif /* UBDOCUMENTTHUMBNAILWIDGET_H_ */

@ -116,10 +116,10 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
Q_UNUSED(event); Q_UNUSED(event);
if (mScrollTimer->isActive()) if (mScrollTimer->isActive())
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
if (mDropTargetProxyTi) if (mDropTargetProxyTi)
{ {
@ -131,25 +131,25 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event) void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event)
{ {
QRect boundingFrame = frameRect(); QRect boundingFrame = frameRect();
//setting up automatic scrolling //setting up automatic scrolling
const int SCROLL_DISTANCE = 4; const int SCROLL_DISTANCE = 4;
int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y(); int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y();
if(qAbs(bottomDist) <= SCROLL_DISTANCE) if(qAbs(bottomDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4; mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else if(qAbs(topDist) <= SCROLL_DISTANCE) else if(qAbs(topDist) <= SCROLL_DISTANCE)
{ {
mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4; mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100); if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
} }
else else
{ {
mScrollMagnitude = 0; mScrollMagnitude = 0;
mScrollTimer->stop(); mScrollTimer->stop();
} }
QTreeWidgetItem* underlyingItem = this->itemAt(event->pos()); QTreeWidgetItem* underlyingItem = this->itemAt(event->pos());
@ -461,5 +461,5 @@ bool UBDocumentGroupTreeItem::isDefaultFolder() const
void UBDocumentTreeWidget::autoScroll() void UBDocumentTreeWidget::autoScroll()
{ {
this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude); this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude);
} }

@ -51,14 +51,14 @@ class UBDocumentTreeWidget : public QTreeWidget
void itemChangedValidation(QTreeWidgetItem * item, int column); void itemChangedValidation(QTreeWidgetItem * item, int column);
void autoScroll(); void autoScroll();
private: private:
UBDocumentProxyTreeItem *mSelectedProxyTi; UBDocumentProxyTreeItem *mSelectedProxyTi;
QTreeWidgetItem *mDropTargetProxyTi; QTreeWidgetItem *mDropTargetProxyTi;
QBrush mBackground; QBrush mBackground;
QTimer* mScrollTimer; QTimer* mScrollTimer;
int mScrollMagnitude; int mScrollMagnitude;
}; };

@ -26,7 +26,7 @@
#include "gui/UBFeaturesWidget.h" #include "gui/UBFeaturesWidget.h"
UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent) UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent)
, featuresController(controller) , featuresController(controller)
, mButtonGroup(NULL) , mButtonGroup(NULL)
, mSearchBar(NULL) , mSearchBar(NULL)
, mLayout(NULL) , mLayout(NULL)
@ -46,7 +46,7 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
, mpRemoveFavoriteBtn(NULL) , mpRemoveFavoriteBtn(NULL)
, mpNewFolderBtn(NULL) , mpNewFolderBtn(NULL)
{ {
setObjectName(name); setObjectName(name);
setStyleSheet(QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;")); setStyleSheet(QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;"));
setAcceptDrops(true); setAcceptDrops(true);
@ -106,8 +106,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/ connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/
connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite())); connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString))); connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString)));
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder())); connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));
connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite())); connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite()));
connect(mpRescanModelAction, SIGNAL(triggered()), this , SLOT(onActionRescanModel())); connect(mpRescanModelAction, SIGNAL(triggered()), this , SLOT(onActionRescanModel()));
connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash())); connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash()));
@ -123,33 +123,33 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
mLayout->addWidget(mpDeleteBtn); mLayout->addWidget(mpDeleteBtn);
mLayout->addWidget(mpCloseBtn); mLayout->addWidget(mpCloseBtn);
mLayout->addWidget(mpRemoveFavoriteBtn); mLayout->addWidget(mpRemoveFavoriteBtn);
setCurrentState( IN_ROOT ); setCurrentState( IN_ROOT );
mpDeleteBtn->setAcceptDrops(true); mpDeleteBtn->setAcceptDrops(true);
setAcceptDrops( true ); setAcceptDrops( true );
} }
void UBFeaturesActionBar::setCurrentState( UBFeaturesActionBarState state ) void UBFeaturesActionBar::setCurrentState( UBFeaturesActionBarState state )
{ {
currentState = state; currentState = state;
setButtons(); setButtons();
} }
void UBFeaturesActionBar::setButtons() void UBFeaturesActionBar::setButtons()
{ {
switch( currentState ) switch( currentState )
{ {
case IN_FOLDER: case IN_FOLDER:
mpFavoriteBtn->show(); mpFavoriteBtn->show();
mpSocialBtn->hide(); mpSocialBtn->hide();
mSearchBar->show(); mSearchBar->show();
mpDeleteBtn->show(); mpDeleteBtn->show();
mpCloseBtn->hide(); mpCloseBtn->hide();
mpRemoveFavoriteBtn->hide(); mpRemoveFavoriteBtn->hide();
mpNewFolderBtn->show(); mpNewFolderBtn->show();
mpNewFolderBtn->setEnabled(true); mpNewFolderBtn->setEnabled(true);
mpDeleteBtn->setEnabled(true); mpDeleteBtn->setEnabled(true);
// mpRescanModelBtn->show(); // mpRescanModelBtn->show();
break; break;
case IN_ROOT: case IN_ROOT:
mpFavoriteBtn->show(); mpFavoriteBtn->show();
mpSocialBtn->hide(); mpSocialBtn->hide();
@ -158,8 +158,8 @@ void UBFeaturesActionBar::setButtons()
mpCloseBtn->hide(); mpCloseBtn->hide();
mpRemoveFavoriteBtn->hide(); mpRemoveFavoriteBtn->hide();
mpNewFolderBtn->show(); mpNewFolderBtn->show();
mpNewFolderBtn->setEnabled(false); mpNewFolderBtn->setEnabled(false);
mpDeleteBtn->setEnabled(false); mpDeleteBtn->setEnabled(false);
// mpRescanModelBtn->show(); // mpRescanModelBtn->show();
break; break;
case IN_PROPERTIES: case IN_PROPERTIES:
@ -184,8 +184,8 @@ void UBFeaturesActionBar::setButtons()
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
// mpRescanModelBtn->hide(); // mpRescanModelBtn->hide();
break; break;
case IN_TRASH: case IN_TRASH:
mpFavoriteBtn->hide(); mpFavoriteBtn->hide();
mpSocialBtn->hide(); mpSocialBtn->hide();
mSearchBar->show(); mSearchBar->show();
mpDeleteBtn->show(); mpDeleteBtn->show();
@ -196,7 +196,7 @@ void UBFeaturesActionBar::setButtons()
//mpRemoveFavoriteBtn->show(); //mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
// mpRescanModelBtn->hide(); // mpRescanModelBtn->hide();
break; break;
default: default:
break; break;
} }
@ -273,22 +273,22 @@ void UBFeaturesActionBar::dropEvent(QDropEvent *event)
} }
} }
event->setDropAction(Qt::MoveAction); event->setDropAction(Qt::MoveAction);
event->accept(); event->accept();
emit deleteElements(fMimeData); emit deleteElements(fMimeData);
} else if (dest == mpFavoriteBtn) { } else if (dest == mpFavoriteBtn) {
event->setDropAction( Qt::CopyAction); event->setDropAction( Qt::CopyAction);
event->accept(); event->accept();
emit addToFavorite(fMimeData); emit addToFavorite(fMimeData);
} else if (dest == mpRemoveFavoriteBtn) { } else if (dest == mpRemoveFavoriteBtn) {
event->setDropAction( Qt::MoveAction ); event->setDropAction( Qt::MoveAction );
event->accept(); event->accept();
emit removeFromFavorite(fMimeData); emit removeFromFavorite(fMimeData);
} }
} }
UBFeaturesActionBar::~UBFeaturesActionBar() UBFeaturesActionBar::~UBFeaturesActionBar()

@ -50,26 +50,26 @@ public:
enum UBFeaturesActionBarState enum UBFeaturesActionBarState
{ {
IN_ROOT, IN_ROOT,
IN_FOLDER, IN_FOLDER,
IN_PROPERTIES, IN_PROPERTIES,
IN_FAVORITE, IN_FAVORITE,
IN_TRASH IN_TRASH
}; };
class UBFeaturesActionBar : public QWidget class UBFeaturesActionBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesActionBar(UBFeaturesController *controller, QWidget* parent=0, const char* name="UBFeaturesActionBar"); UBFeaturesActionBar(UBFeaturesController *controller, QWidget* parent=0, const char* name="UBFeaturesActionBar");
~UBFeaturesActionBar(); ~UBFeaturesActionBar();
void setCurrentState( UBFeaturesActionBarState state ); void setCurrentState( UBFeaturesActionBarState state );
void cleanText(){ mSearchBar->clear(); } void cleanText(){ mSearchBar->clear(); }
signals: signals:
void searchElement(const QString &text); void searchElement(const QString &text);
void newFolderToCreate(); void newFolderToCreate();
void deleteElements(const UBFeaturesMimeData *data); void deleteElements(const UBFeaturesMimeData *data);
void addToFavorite(const UBFeaturesMimeData *data); void addToFavorite(const UBFeaturesMimeData *data);
void removeFromFavorite(const UBFeaturesMimeData *data); void removeFromFavorite(const UBFeaturesMimeData *data);
@ -79,8 +79,8 @@ signals:
void rescanModel(); void rescanModel();
private slots: private slots:
void onSearchTextChanged(QString txt); void onSearchTextChanged(QString txt);
void onActionNewFolder(); void onActionNewFolder();
void onActionFavorite(); void onActionFavorite();
void onActionRemoveFavorite(); void onActionRemoveFavorite();
void onActionTrash(); void onActionTrash();
@ -90,17 +90,17 @@ private slots:
protected: protected:
void dragEnterEvent( QDragEnterEvent *event ); void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event ); void dropEvent( QDropEvent *event );
private: private:
void setButtons(); void setButtons();
UBFeaturesController *featuresController; UBFeaturesController *featuresController;
UBFeaturesActionBarState currentState; UBFeaturesActionBarState currentState;
eButtonSet mCrntButtonSet; eButtonSet mCrntButtonSet;
eButtonSet mPreviousButtonSet; eButtonSet mPreviousButtonSet;
QButtonGroup* mButtonGroup; QButtonGroup* mButtonGroup;
QLineEdit* mSearchBar; QLineEdit* mSearchBar;
QHBoxLayout* mLayout; QHBoxLayout* mLayout;
QAction* mpFavoriteAction; QAction* mpFavoriteAction;

@ -328,7 +328,7 @@ void UBFeaturesWidget::onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QU
void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData, QString pTitle) void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData, QString pTitle)
{ {
if (pSuccess) { if (pSuccess) {
qDebug() << pData.length(); qDebug() << pData.length();
controller->addDownloadedFile(sourceUrl, pData, pContentHeader, pTitle); controller->addDownloadedFile(sourceUrl, pData, pContentHeader, pTitle);
controller->refreshModels(); controller->refreshModels();
} }
@ -371,20 +371,20 @@ void UBFeaturesWidget::removeElementsFromFavorite()
void UBFeaturesWidget::switchToListView() void UBFeaturesWidget::switchToListView()
{ {
// stackedWidget->setCurrentIndex(ID_LISTVIEW); // stackedWidget->setCurrentIndex(ID_LISTVIEW);
// currentStackedWidget = ID_LISTVIEW; // currentStackedWidget = ID_LISTVIEW;
} }
void UBFeaturesWidget::switchToProperties() void UBFeaturesWidget::switchToProperties()
{ {
// stackedWidget->setCurrentIndex(ID_PROPERTIES); // stackedWidget->setCurrentIndex(ID_PROPERTIES);
// currentStackedWidget = ID_PROPERTIES; // currentStackedWidget = ID_PROPERTIES;
} }
void UBFeaturesWidget::switchToWebView() void UBFeaturesWidget::switchToWebView()
{ {
// stackedWidget->setCurrentIndex(ID_WEBVIEW); // stackedWidget->setCurrentIndex(ID_WEBVIEW);
// currentStackedWidget = ID_WEBVIEW; // currentStackedWidget = ID_WEBVIEW;
} }
QStringList UBFeaturesMimeData::formats() const QStringList UBFeaturesMimeData::formats() const
@ -1141,7 +1141,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
} else if (role == Qt::UserRole) { } else if (role == Qt::UserRole) {
return featuresList->at(index.row()).getVirtualPath(); return featuresList->at(index.row()).getVirtualPath();
} else if (role == Qt::UserRole + 1) { } else if (role == Qt::UserRole + 1) {
//return featuresList->at(index.row()).getType(); //return featuresList->at(index.row()).getType();
UBFeature f = featuresList->at(index.row()); UBFeature f = featuresList->at(index.row());
return QVariant::fromValue( f ); return QVariant::fromValue( f );
@ -1451,7 +1451,7 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde
} }
QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const
{ {
Q_UNUSED(locale) Q_UNUSED(locale)
@ -1473,7 +1473,7 @@ UBFeaturesPathItemDelegate::UBFeaturesPathItemDelegate(QObject *parent) : QStyle
arrowPixmap = new QPixmap(":images/navig_arrow.png"); arrowPixmap = new QPixmap(":images/navig_arrow.png");
} }
QString UBFeaturesPathItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const QString UBFeaturesPathItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const
{ {
Q_UNUSED(value) Q_UNUSED(value)
Q_UNUSED(locale) Q_UNUSED(locale)

@ -76,10 +76,10 @@ class UBFeaturesWidget : public UBDockPaletteWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesWidget(QWidget* parent=0, const char* name="UBFeaturesWidget"); UBFeaturesWidget(QWidget* parent=0, const char* name="UBFeaturesWidget");
virtual ~UBFeaturesWidget(); virtual ~UBFeaturesWidget();
bool visibleInMode(eUBDockPaletteWidgetMode mode) bool visibleInMode(eUBDockPaletteWidgetMode mode)
{ {
return mode == eUBDockPaletteWidget_BOARD return mode == eUBDockPaletteWidget_BOARD
|| mode == eUBDockPaletteWidget_DESKTOP; || mode == eUBDockPaletteWidget_DESKTOP;
@ -87,9 +87,9 @@ public:
UBFeaturesController * getFeaturesController() const { return controller; } UBFeaturesController * getFeaturesController() const { return controller; }
void importImage(const QImage &image, const QString &fileName = QString()); void importImage(const QImage &image, const QString &fileName = QString());
static const int minThumbnailSize = 20; static const int minThumbnailSize = 20;
static const int maxThumbnailSize = 100; static const int maxThumbnailSize = 100;
static const int defaultThumbnailSize = 40; static const int defaultThumbnailSize = 40;
static const char *objNamePathList; static const char *objNamePathList;
static const char *objNameFeatureList; static const char *objNameFeatureList;
@ -148,7 +148,7 @@ private:
class UBFeaturesListView : public QListView class UBFeaturesListView : public QListView
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" ); UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" );
@ -337,7 +337,7 @@ private slots:
//void onBack(); //void onBack();
private: private:
void populateMetadata(); void populateMetadata();
void adaptSize(); void adaptSize();
QVBoxLayout* mpLayout; QVBoxLayout* mpLayout;
@ -363,7 +363,7 @@ public:
class UBFeaturesModel : public QAbstractListModel class UBFeaturesModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
signals: signals:
void dataRestructured(); void dataRestructured();
@ -372,18 +372,18 @@ public:
UBFeaturesModel(QList<UBFeature> *pFeaturesList, QObject *parent = 0) : QAbstractListModel(parent), featuresList(pFeaturesList) {;} UBFeaturesModel(QList<UBFeature> *pFeaturesList, QObject *parent = 0) : QAbstractListModel(parent), featuresList(pFeaturesList) {;}
virtual ~UBFeaturesModel(){;} virtual ~UBFeaturesModel(){;}
void deleteFavoriteItem( const QString &path ); void deleteFavoriteItem( const QString &path );
void deleteItem( const QString &path ); void deleteItem( const QString &path );
void deleteItem(const UBFeature &feature); void deleteItem(const UBFeature &feature);
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
QMimeData *mimeData( const QModelIndexList &indexes ) const; QMimeData *mimeData( const QModelIndexList &indexes ) const;
QStringList mimeTypes() const; QStringList mimeTypes() const;
int rowCount( const QModelIndex &parent ) const; int rowCount( const QModelIndex &parent ) const;
Qt::ItemFlags flags( const QModelIndex &index ) const; Qt::ItemFlags flags( const QModelIndex &index ) const;
bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent); bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent);
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
bool removeRow(int row, const QModelIndex &parent = QModelIndex()); bool removeRow(int row, const QModelIndex &parent = QModelIndex());
//bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); //bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
//bool insertRow(int row, const QModelIndex &parent = QModelIndex()); //bool insertRow(int row, const QModelIndex &parent = QModelIndex());
@ -395,69 +395,69 @@ public slots:
void addItem( const UBFeature &item ); void addItem( const UBFeature &item );
private: private:
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
}; };
class UBFeaturesProxyModel : public QSortFilterProxyModel class UBFeaturesProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} UBFeaturesProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
virtual ~UBFeaturesProxyModel() {} virtual ~UBFeaturesProxyModel() {}
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
}; };
class UBFeaturesSearchProxyModel : public QSortFilterProxyModel class UBFeaturesSearchProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent), mFilterPrefix() {;} UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent), mFilterPrefix() {;}
virtual ~UBFeaturesSearchProxyModel() {} virtual ~UBFeaturesSearchProxyModel() {}
void setFilterPrefix(const QString &newPrefix) {mFilterPrefix = newPrefix;} void setFilterPrefix(const QString &newPrefix) {mFilterPrefix = newPrefix;}
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
private: private:
QString mFilterPrefix; QString mFilterPrefix;
}; };
class UBFeaturesPathProxyModel : public QSortFilterProxyModel class UBFeaturesPathProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesPathProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} UBFeaturesPathProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
virtual ~UBFeaturesPathProxyModel() {} virtual ~UBFeaturesPathProxyModel() {}
void setPath( const QString &p ) { path = p; } void setPath( const QString &p ) { path = p; }
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
private: private:
QString path; QString path;
}; };
class UBFeaturesItemDelegate : public QStyledItemDelegate class UBFeaturesItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesItemDelegate(QObject *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; } UBFeaturesItemDelegate(QObject *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; }
~UBFeaturesItemDelegate() {} ~UBFeaturesItemDelegate() {}
//UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; }; //UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; };
//void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; //void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
//QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual QString displayText ( const QVariant & value, const QLocale & locale ) const; virtual QString displayText ( const QVariant & value, const QLocale & locale ) const;
private: private:
const QListView *listView; const QListView *listView;
}; };
class UBFeaturesPathItemDelegate : public QStyledItemDelegate class UBFeaturesPathItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesPathItemDelegate(QObject *parent = 0); UBFeaturesPathItemDelegate(QObject *parent = 0);
~UBFeaturesPathItemDelegate(); ~UBFeaturesPathItemDelegate();
virtual QString displayText ( const QVariant & value, const QLocale & locale ) const; virtual QString displayText ( const QVariant & value, const QLocale & locale ) const;
void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
private: private:
QPixmap *arrowPixmap; QPixmap *arrowPixmap;
}; };

@ -284,46 +284,46 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
if(!mCanBeMinimized) if(!mCanBeMinimized)
{ {
// If this floating palette cannot be minimized, we exit this method. // If this floating palette cannot be minimized, we exit this method.
return; return;
} }
if(mMinimizedLocation == eMinimizedLocation_None) if(mMinimizedLocation == eMinimizedLocation_None)
{ {
// Verify if we have to minimize this palette // Verify if we have to minimize this palette
if(pos.x() == 5) if(pos.x() == 5)
{ {
mMinimizedLocation = eMinimizedLocation_Left; mMinimizedLocation = eMinimizedLocation_Left;
} }
// else if(pos.y() == 5) // else if(pos.y() == 5)
// { // {
// mMinimizedLocation = eMinimizedLocation_Top; // mMinimizedLocation = eMinimizedLocation_Top;
// } // }
else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5) else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5)
{ {
mMinimizedLocation = eMinimizedLocation_Right; mMinimizedLocation = eMinimizedLocation_Right;
} }
// else if(pos.y() == parentSize.height() - height() - 5) // else if(pos.y() == parentSize.height() - height() - 5)
// { // {
// mMinimizedLocation = eMinimizedLocation_Bottom; // mMinimizedLocation = eMinimizedLocation_Bottom;
// } // }
// Minimize the Palette // Minimize the Palette
if(mMinimizedLocation != eMinimizedLocation_None) if(mMinimizedLocation != eMinimizedLocation_None)
{ {
emit minimizeStart(mMinimizedLocation); emit minimizeStart(mMinimizedLocation);
} }
} }
else else
{ {
// Restore the palette // Restore the palette
if(pos.x() > 5 && if(pos.x() > 5 &&
pos.y() > 5 && pos.y() > 5 &&
pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 && pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 &&
pos.y() < parentWidget()->size().height() - height() - 5) pos.y() < parentWidget()->size().height() - height() - 5)
{ {
mMinimizedLocation = eMinimizedLocation_None; mMinimizedLocation = eMinimizedLocation_None;
emit maximizeStart(); emit maximizeStart();
} }
} }
} }

@ -76,10 +76,10 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
createCtrlButtons(); createCtrlButtons();
nCurrentLocale = UBSettings::settings()->KeyboardLocale->get().toInt(); nCurrentLocale = UBSettings::settings()->KeyboardLocale->get().toInt();
if (nCurrentLocale < 0 || nCurrentLocale >= nLocalesCount) if (nCurrentLocale < 0 || nCurrentLocale >= nLocalesCount)
nCurrentLocale = 0; nCurrentLocale = 0;
if (locales!=NULL) if (locales!=NULL)
setInput(locales[nCurrentLocale]); setInput(locales[nCurrentLocale]);
setContentsMargins( 22, 22, 22, 22 ); setContentsMargins( 22, 22, 22, 22 );
@ -193,7 +193,7 @@ void UBKeyboardPalette::setLocale(int nLocale)
onLocaleChanged(locales[nCurrentLocale]); onLocaleChanged(locales[nCurrentLocale]);
update(); update();
UBSettings::settings()->KeyboardLocale->set(nCurrentLocale); UBSettings::settings()->KeyboardLocale->set(nCurrentLocale);
} }
emit localeChanged(nLocale); emit localeChanged(nLocale);
} }

@ -34,21 +34,21 @@
void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode) void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode)
{ {
if (keycode.modifier) if (keycode.modifier)
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, true)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, true));
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, true)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, true));
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, false)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, keycode.code, false));
if (keycode.modifier) if (keycode.modifier)
CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, false)); CGEventPost(kCGSessionEventTap, CGEventCreateKeyboardEvent(NULL, 56, false));
} }
void UBKeyboardButton::sendControlSymbol(int nSymbol) void UBKeyboardButton::sendControlSymbol(int nSymbol)
{ {
CGEventRef event1 = CGEventCreateKeyboardEvent(NULL, nSymbol, true); CGEventRef event1 = CGEventCreateKeyboardEvent(NULL, nSymbol, true);
CGEventRef event2 = CGEventCreateKeyboardEvent(NULL, nSymbol, false); CGEventRef event2 = CGEventCreateKeyboardEvent(NULL, nSymbol, false);
CGEventPost(kCGHIDEventTap, event1); CGEventPost(kCGHIDEventTap, event1);
CGEventPost(kCGHIDEventTap, event2); CGEventPost(kCGHIDEventTap, event2);
} }
void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::createCtrlButtons()

@ -32,42 +32,42 @@
void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode) void UBKeyboardButton::sendUnicodeSymbol(KEYCODE keycode)
{ {
INPUT input[2]; INPUT input[2];
input[0].type = INPUT_KEYBOARD; input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = 0; input[0].ki.wVk = 0;
input[0].ki.wScan = keycode.symbol; input[0].ki.wScan = keycode.symbol;
input[0].ki.dwFlags = KEYEVENTF_UNICODE; input[0].ki.dwFlags = KEYEVENTF_UNICODE;
input[0].ki.time = 0; input[0].ki.time = 0;
input[0].ki.dwExtraInfo = 0; input[0].ki.dwExtraInfo = 0;
input[1].type = INPUT_KEYBOARD; input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = 0; input[1].ki.wVk = 0;
input[1].ki.wScan = keycode.symbol; input[1].ki.wScan = keycode.symbol;
input[1].ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; input[1].ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
input[1].ki.time = 0; input[1].ki.time = 0;
input[1].ki.dwExtraInfo = 0; input[1].ki.dwExtraInfo = 0;
::SendInput(2, input, sizeof(input[0])); ::SendInput(2, input, sizeof(input[0]));
} }
void UBKeyboardButton::sendControlSymbol(int nSymbol) void UBKeyboardButton::sendControlSymbol(int nSymbol)
{ {
INPUT input[2]; INPUT input[2];
input[0].type = INPUT_KEYBOARD; input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = nSymbol; input[0].ki.wVk = nSymbol;
input[0].ki.wScan = 0; input[0].ki.wScan = 0;
input[0].ki.dwFlags = 0; input[0].ki.dwFlags = 0;
input[0].ki.time = 0; input[0].ki.time = 0;
input[0].ki.dwExtraInfo = 0; input[0].ki.dwExtraInfo = 0;
input[1].type = INPUT_KEYBOARD; input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = nSymbol; input[1].ki.wVk = nSymbol;
input[1].ki.wScan = 0; input[1].ki.wScan = 0;
input[1].ki.dwFlags = KEYEVENTF_KEYUP; input[1].ki.dwFlags = KEYEVENTF_KEYUP;
input[1].ki.time = 0; input[1].ki.time = 0;
input[1].ki.dwExtraInfo = 0; input[1].ki.dwExtraInfo = 0;
::SendInput(2, input, sizeof(input[0])); ::SendInput(2, input, sizeof(input[0]));
} }
void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::createCtrlButtons()

@ -63,9 +63,7 @@ UBLeftPalette::~UBLeftPalette()
void UBLeftPalette::onDocumentSet(UBDocumentProxy* documentProxy) void UBLeftPalette::onDocumentSet(UBDocumentProxy* documentProxy)
{ {
// //This is necessary to force the teacher guide to be showed in priority each time a document is set Q_UNUSED(documentProxy)
// if(documentProxy && UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
// the tab zero is forced // the tab zero is forced
mLastOpenedTabForMode.insert(eUBDockPaletteWidget_BOARD, 0); mLastOpenedTabForMode.insert(eUBDockPaletteWidget_BOARD, 0);
} }

@ -33,9 +33,9 @@
* @param name as the object name * @param name as the object name
*/ */
UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name): UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):
UBDockPalette(eUBDockPaletteType_LEFT, parent, name) UBDockPalette(eUBDockPaletteType_LEFT, parent, name)
, mNavigator(NULL) , mNavigator(NULL)
, mLayout(NULL) , mLayout(NULL)
, mHLayout(NULL) , mHLayout(NULL)
, mPageNbr(NULL) , mPageNbr(NULL)
, mClock(NULL) , mClock(NULL)
@ -98,13 +98,13 @@ UBNavigatorPalette::~UBNavigatorPalette()
} }
if(NULL != mLayout) if(NULL != mLayout)
{ {
delete mLayout; delete mLayout;
mLayout = NULL; mLayout = NULL;
} }
if(NULL != mNavigator) if(NULL != mNavigator)
{ {
delete mNavigator; delete mNavigator;
mNavigator = NULL; mNavigator = NULL;
} }
} }

@ -58,7 +58,7 @@ class UBResources : public QObject
QCursor playCursor; QCursor playCursor;
QCursor textCursor; QCursor textCursor;
QCursor rotateCursor; QCursor rotateCursor;
QCursor drawLineRulerCursor; QCursor drawLineRulerCursor;
}; };
#endif /* UBRESOURCES_H_ */ #endif /* UBRESOURCES_H_ */

@ -39,17 +39,17 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):
mCollapseWidth = 150; mCollapseWidth = 150;
bool isCollapsed = false; bool isCollapsed = false;
if(mCurrentMode == eUBDockPaletteWidget_BOARD){ if(mCurrentMode == eUBDockPaletteWidget_BOARD){
mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt();
isCollapsed = UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool(); isCollapsed = UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool();
} }
else{ else{
mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt();
isCollapsed = UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool(); isCollapsed = UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool();
} }
if(isCollapsed) if(isCollapsed)
resize(0,parentWidget()->height()); resize(0,parentWidget()->height());
else else
resize(mLastWidth, parentWidget()->height()); resize(mLastWidth, parentWidget()->height());
} }
/** /**
@ -77,18 +77,18 @@ void UBRightPalette::mouseMoveEvent(QMouseEvent *event)
*/ */
void UBRightPalette::resizeEvent(QResizeEvent *event) void UBRightPalette::resizeEvent(QResizeEvent *event)
{ {
int newWidth = width(); int newWidth = width();
if(mCurrentMode == eUBDockPaletteWidget_BOARD){ if(mCurrentMode == eUBDockPaletteWidget_BOARD){
if(newWidth > mCollapseWidth) if(newWidth > mCollapseWidth)
UBSettings::settings()->rightLibPaletteBoardModeWidth->set(newWidth); UBSettings::settings()->rightLibPaletteBoardModeWidth->set(newWidth);
UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->set(newWidth == 0); UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->set(newWidth == 0);
} }
else{ else{
if(newWidth > mCollapseWidth) if(newWidth > mCollapseWidth)
UBSettings::settings()->rightLibPaletteDesktopModeWidth->set(newWidth); UBSettings::settings()->rightLibPaletteDesktopModeWidth->set(newWidth);
UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->set(newWidth == 0); UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->set(newWidth == 0);
} }
UBDockPalette::resizeEvent(event); UBDockPalette::resizeEvent(event);
emit resized(); emit resized();
} }
@ -104,19 +104,19 @@ void UBRightPalette::updateMaxWidth()
bool UBRightPalette::switchMode(eUBDockPaletteWidgetMode mode) bool UBRightPalette::switchMode(eUBDockPaletteWidgetMode mode)
{ {
int newModeWidth; int newModeWidth;
if(mode == eUBDockPaletteWidget_BOARD){ if(mode == eUBDockPaletteWidget_BOARD){
mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteBoardModeWidth->get().toInt();
newModeWidth = mLastWidth; newModeWidth = mLastWidth;
if(UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool()) if(UBSettings::settings()->rightLibPaletteBoardModeIsCollapsed->get().toBool())
newModeWidth = 0; newModeWidth = 0;
} }
else{ else{
mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt(); mLastWidth = UBSettings::settings()->rightLibPaletteDesktopModeWidth->get().toInt();
newModeWidth = mLastWidth; newModeWidth = mLastWidth;
if(UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool()) if(UBSettings::settings()->rightLibPaletteDesktopModeIsCollapsed->get().toBool())
newModeWidth = 0; newModeWidth = 0;
} }
resize(newModeWidth,height()); resize(newModeWidth,height());
return UBDockPalette::switchMode(mode); return UBDockPalette::switchMode(mode);
} }

@ -932,7 +932,7 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes()
QStringList licences; QStringList licences;
licences << tr("Attribution-ShareAlike CC BY-SA") licences << tr("Attribution-ShareAlike CC BY-SA")
<< tr("Attribution CC BY") << tr("Attribution CC BY")
<< tr("Attribution-NoDerivs CC BY-ND") << tr("Attribution-NoDerivs CC BY-ND")
<< tr("Attribution-NonCommercial CC BY-NC") << tr("Attribution-NonCommercial CC BY-NC")
<< tr("Attribution-NonCommercial-NoDerivs CC BY-NC-ND") << tr("Attribution-NonCommercial-NoDerivs CC BY-NC-ND")
<< tr("Attribution-NonCommercial-ShareAlike CC BY-NC-SA") << tr("Attribution-NonCommercial-ShareAlike CC BY-NC-SA")
@ -1168,8 +1168,8 @@ bool UBTeacherGuidePageZeroWidget::isModified()
void UBTeacherGuidePageZeroWidget::resizeEvent(QResizeEvent* ev) void UBTeacherGuidePageZeroWidget::resizeEvent(QResizeEvent* ev)
{ {
emit resized(); emit resized();
QWidget::resizeEvent(ev); QWidget::resizeEvent(ev);
} }
/*************************************************************************** /***************************************************************************
@ -1209,54 +1209,54 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget()
void UBTeacherGuideWidget::onActiveSceneChanged() void UBTeacherGuideWidget::onActiveSceneChanged()
{ {
if (UBApplication::boardController->currentPage() == 0) { if (UBApplication::boardController->currentPage() == 0) {
if(mpPageZeroWidget->isModified()) if(mpPageZeroWidget->isModified())
mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION); mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION);
else else
mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_EDITION); mpPageZeroWidget->switchToMode(tUBTGZeroPageMode_EDITION);
setCurrentWidget(mpPageZeroWidget); setCurrentWidget(mpPageZeroWidget);
} }
else{ else{
if(mpEditionWidget->isModified()){ if(mpEditionWidget->isModified()){
mCurrentData = mpEditionWidget->getData(); mCurrentData = mpEditionWidget->getData();
mpPresentationWidget->showData(mCurrentData); mpPresentationWidget->showData(mCurrentData);
setCurrentWidget(mpPresentationWidget); setCurrentWidget(mpPresentationWidget);
} }
else else
setCurrentWidget(mpEditionWidget); setCurrentWidget(mpEditionWidget);
} }
} }
void UBTeacherGuideWidget::onTriggeredAction(bool checked) void UBTeacherGuideWidget::onTriggeredAction(bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
if(!mKeyboardActionFired) if(!mKeyboardActionFired)
showPresentationMode(); showPresentationMode();
mKeyboardActionFired=false; mKeyboardActionFired=false;
} }
void UBTeacherGuideWidget::onTriggeredKeyboardAction(bool checked) void UBTeacherGuideWidget::onTriggeredKeyboardAction(bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
mKeyboardActionFired = true; mKeyboardActionFired = true;
} }
void UBTeacherGuideWidget::connectToStylusPalette() void UBTeacherGuideWidget::connectToStylusPalette()
{ {
connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(onTriggeredKeyboardAction(bool))); connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(onTriggeredKeyboardAction(bool)));
} }
void UBTeacherGuideWidget::showPresentationMode() void UBTeacherGuideWidget::showPresentationMode()

@ -147,7 +147,7 @@ public:
bool isModified(); bool isModified();
signals: signals:
void resized(); void resized();
public slots: public slots:
void onActiveSceneChanged(); void onActiveSceneChanged();
@ -245,8 +245,8 @@ private:
bool mKeyboardActionFired; bool mKeyboardActionFired;
private slots: private slots:
void onTriggeredAction(bool checked); void onTriggeredAction(bool checked);
void onTriggeredKeyboardAction(bool checked); void onTriggeredKeyboardAction(bool checked);
}; };
#endif // UBTEACHERGUIDEWIDGET_H #endif // UBTEACHERGUIDEWIDGET_H

@ -173,11 +173,11 @@ void UBTGAdaptableText::showEvent(QShowEvent* e)
{ {
Q_UNUSED(e); Q_UNUSED(e);
if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){ if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){
setTextColor(QColor(Qt::lightGray)); setTextColor(QColor(Qt::lightGray));
setPlainText(mPlaceHolderText); setPlainText(mPlaceHolderText);
} }
else else
// If the teacherguide is collapsed, don't updated the size. Or set the size as the expanded size // If the teacherguide is collapsed, don't updated the size. Or set the size as the expanded size
onTextChanged(); onTextChanged();
} }
@ -194,16 +194,16 @@ void UBTGAdaptableText::onTextChanged()
{ {
qreal documentSize = document()->size().height(); qreal documentSize = document()->size().height();
if(height() == documentSize + mBottomMargin){ if(height() == documentSize + mBottomMargin){
return; return;
} }
mIsUpdatingSize = true; mIsUpdatingSize = true;
if(documentSize < mMinimumHeight){ if(documentSize < mMinimumHeight){
setFixedHeight(mMinimumHeight); setFixedHeight(mMinimumHeight);
} }
else{ else{
setFixedHeight(documentSize+mBottomMargin); setFixedHeight(documentSize+mBottomMargin);
} }
updateGeometry(); updateGeometry();
@ -239,45 +239,45 @@ void UBTGAdaptableText::bottomMargin(int newValue)
void UBTGAdaptableText::focusInEvent(QFocusEvent* e) void UBTGAdaptableText::focusInEvent(QFocusEvent* e)
{ {
if(isReadOnly()){ if(isReadOnly()){
e->ignore(); e->ignore();
} }
managePlaceholder(true); managePlaceholder(true);
QTextEdit::focusInEvent(e); QTextEdit::focusInEvent(e);
} }
void UBTGAdaptableText::focusOutEvent(QFocusEvent* e) void UBTGAdaptableText::focusOutEvent(QFocusEvent* e)
{ {
managePlaceholder(false); managePlaceholder(false);
QTextEdit::focusOutEvent(e); QTextEdit::focusOutEvent(e);
} }
void UBTGAdaptableText::managePlaceholder(bool focus) void UBTGAdaptableText::managePlaceholder(bool focus)
{ {
if(focus){ if(focus){
if(toPlainText() == mPlaceHolderText){ if(toPlainText() == mPlaceHolderText){
setTextColor(QColor(Qt::black)); setTextColor(QColor(Qt::black));
setPlainText(""); setPlainText("");
} }
setCursorToTheEnd(); setCursorToTheEnd();
} }
else{ else{
if(toPlainText().isEmpty()){ if(toPlainText().isEmpty()){
setTextColor(QColor(Qt::lightGray)); setTextColor(QColor(Qt::lightGray));
setPlainText(mPlaceHolderText); setPlainText(mPlaceHolderText);
} }
} }
} }
void UBTGAdaptableText::setCursorToTheEnd() void UBTGAdaptableText::setCursorToTheEnd()
{ {
QTextDocument* doc = document(); QTextDocument* doc = document();
if(NULL != doc){ if(NULL != doc){
QTextBlock block = doc->lastBlock(); QTextBlock block = doc->lastBlock();
QTextCursor cursor(doc); QTextCursor cursor(doc);
cursor.setPosition(block.position() + block.length() - 1); cursor.setPosition(block.position() + block.length() - 1);
setTextCursor(cursor); setTextCursor(cursor);
} }
} }
/*************************************************************************** /***************************************************************************
@ -288,10 +288,10 @@ UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView
, mDragStarted(false) , mDragStarted(false)
{ {
if(!relativePath.startsWith("file://")) if(!relativePath.startsWith("file://"))
mRelativePath = QUrl::fromLocalFile(relativePath).toString(); mRelativePath = QUrl::fromLocalFile(relativePath).toString();
else else
mRelativePath = relativePath; mRelativePath = relativePath;
//NOOP //NOOP
} }
@ -438,7 +438,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData()
tUBGEElementNode* result = new tUBGEElementNode(); tUBGEElementNode* result = new tUBGEElementNode();
QString relativePath = mMediaPath; QString relativePath = mMediaPath;
relativePath = relativePath.replace(UBApplication::boardController->selectedDocument()->persistencePath()+"/",""); relativePath = relativePath.replace(UBApplication::boardController->selectedDocument()->persistencePath()+"/","");
result->name = "media"; result->name = "media";
result->attributes.insert("title",mpTitle->text()); result->attributes.insert("title",mpTitle->text());
result->attributes.insert("relativePath",relativePath); result->attributes.insert("relativePath",relativePath);
result->attributes.insert("mediaType",mMediaType); result->attributes.insert("mediaType",mMediaType);
@ -598,7 +598,7 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
QMimeData *mimeData = new QMimeData(); QMimeData *mimeData = new QMimeData();
QList<QUrl> urlList; QList<QUrl> urlList;
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
urlList << QUrl::fromLocalFile(mMediaPath); urlList << QUrl::fromLocalFile(mMediaPath);
#else #else
urlList << QUrl(mMediaPath); urlList << QUrl(mMediaPath);
#endif #endif
@ -644,11 +644,11 @@ UBTGUrlWidget::~UBTGUrlWidget()
void UBTGUrlWidget::onUrlEditionFinished() void UBTGUrlWidget::onUrlEditionFinished()
{ {
QString url = mpUrl->text(); QString url = mpUrl->text();
if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){ if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){
mpUrl->setText("http://" + mpUrl->text()); mpUrl->setText("http://" + mpUrl->text());
setFocus(); setFocus();
} }
} }
void UBTGUrlWidget::initializeWithDom(QDomElement element) void UBTGUrlWidget::initializeWithDom(QDomElement element)

@ -224,11 +224,11 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
return; return;
} }
//if(sceneItem){ //if(sceneItem){
// int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); // int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex());
// if(pageIndex == 0){ // if(pageIndex == 0){
// event->ignore(); // event->ignore();
// return; // return;
// } // }
//} //}
mMousePressScenePos = mapToScene(mMousePressPos); mMousePressScenePos = mapToScene(mMousePressPos);
@ -846,15 +846,15 @@ void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *even
void UBSceneThumbnailNavigPixmap::updateButtonsState() void UBSceneThumbnailNavigPixmap::updateButtonsState()
{ {
bCanDelete = false; bCanDelete = false;
bCanMoveUp = false; bCanMoveUp = false;
bCanMoveDown = false; bCanMoveDown = false;
bCanDuplicate = false; bCanDuplicate = false;
if(proxy()){ if(proxy()){
int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneIndex()); int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneIndex());
UBDocumentController* documentController = UBApplication::documentController; UBDocumentController* documentController = UBApplication::documentController;
bCanDelete = documentController->pageCanBeDeleted(pageIndex); bCanDelete = documentController->pageCanBeDeleted(pageIndex);
bCanMoveUp = documentController->pageCanBeMovedUp(pageIndex); bCanMoveUp = documentController->pageCanBeMovedUp(pageIndex);
bCanMoveDown = documentController->pageCanBeMovedDown(pageIndex); bCanMoveDown = documentController->pageCanBeMovedDown(pageIndex);
bCanDuplicate = documentController->pageCanBeDuplicated(pageIndex); bCanDuplicate = documentController->pageCanBeDuplicated(pageIndex);
@ -866,14 +866,14 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
void UBSceneThumbnailNavigPixmap::deletePage() void UBSceneThumbnailNavigPixmap::deletePage()
{ {
if(UBApplication::mainWindow->yesNoQuestion(QObject::tr("Remove Page"), QObject::tr("Are you sure you want to remove 1 page from the selected document '%0'?").arg(UBApplication::documentController->selectedDocument()->metaData(UBSettings::documentName).toString()))){ if(UBApplication::mainWindow->yesNoQuestion(QObject::tr("Remove Page"), QObject::tr("Are you sure you want to remove 1 page from the selected document '%0'?").arg(UBApplication::documentController->selectedDocument()->metaData(UBSettings::documentName).toString()))){
UBApplication::boardController->deleteScene(sceneIndex()); UBApplication::boardController->deleteScene(sceneIndex());
} }
} }
void UBSceneThumbnailNavigPixmap::duplicatePage() void UBSceneThumbnailNavigPixmap::duplicatePage()
{ {
UBApplication::boardController->duplicateScene(sceneIndex()); UBApplication::boardController->duplicateScene(sceneIndex());
} }
void UBSceneThumbnailNavigPixmap::moveUpPage() void UBSceneThumbnailNavigPixmap::moveUpPage()
@ -891,17 +891,17 @@ void UBSceneThumbnailNavigPixmap::moveDownPage()
void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal height) void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal height)
{ {
int labelSpacing = 0; int labelSpacing = 0;
if(this->caption) if(this->caption)
{ {
QFontMetrics fm(this->caption->font()); QFontMetrics fm(this->caption->font());
labelSpacing = UBSettings::thumbnailSpacing + fm.height(); labelSpacing = UBSettings::thumbnailSpacing + fm.height();
} }
if(this->thumbnail) if(this->thumbnail)
{ {
int w = this->thumbnail->boundingRect().width(); int w = this->thumbnail->boundingRect().width();
int h = this->thumbnail->boundingRect().height(); int h = this->thumbnail->boundingRect().height();
qreal scaleWidth = width / w; qreal scaleWidth = width / w;
qreal scaleHeight = height / h; qreal scaleHeight = height / h;
qreal scaleFactor = qMin(scaleWidth, scaleHeight); qreal scaleFactor = qMin(scaleWidth, scaleHeight);
UBThumbnail* pix = dynamic_cast<UBThumbnail*>(this->thumbnail); UBThumbnail* pix = dynamic_cast<UBThumbnail*>(this->thumbnail);
@ -924,8 +924,8 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh
this->thumbnail->setPos(pos); this->thumbnail->setPos(pos);
if(this->caption) if(this->caption)
{ {
QFontMetrics fm(this->caption->font()); QFontMetrics fm(this->caption->font());
QString elidedText = fm.elidedText(this->caption->toPlainText(), Qt::ElideRight, width); QString elidedText = fm.elidedText(this->caption->toPlainText(), Qt::ElideRight, width);
@ -935,6 +935,6 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh
qreal labelWidth = fm.width(elidedText); qreal labelWidth = fm.width(elidedText);
pos.setX(border + (width - labelWidth) / 2 + col * (width + border)); pos.setX(border + (width - labelWidth) / 2 + col * (width + border));
this->caption->setPos(pos); this->caption->setPos(pos);
} }
} }
} }

@ -408,27 +408,27 @@ class UBThumbnailTextItem : public QGraphicsTextItem
class UBImgTextThumbnailElement class UBImgTextThumbnailElement
{ {
private: private:
UBSceneThumbnailNavigPixmap* thumbnail; UBSceneThumbnailNavigPixmap* thumbnail;
UBThumbnailTextItem* caption; UBThumbnailTextItem* caption;
int border; int border;
public: public:
UBImgTextThumbnailElement(UBSceneThumbnailNavigPixmap* thumb, UBThumbnailTextItem* text): border(0) UBImgTextThumbnailElement(UBSceneThumbnailNavigPixmap* thumb, UBThumbnailTextItem* text): border(0)
{ {
this->thumbnail = thumb; this->thumbnail = thumb;
this->caption = text; this->caption = text;
} }
UBSceneThumbnailNavigPixmap* getThumbnail() const { return this->thumbnail; } UBSceneThumbnailNavigPixmap* getThumbnail() const { return this->thumbnail; }
void setThumbnail(UBSceneThumbnailNavigPixmap* newGItem) { this->thumbnail = newGItem; } void setThumbnail(UBSceneThumbnailNavigPixmap* newGItem) { this->thumbnail = newGItem; }
UBThumbnailTextItem* getCaption() const { return this->caption; } UBThumbnailTextItem* getCaption() const { return this->caption; }
void setCaption(UBThumbnailTextItem* newcaption) { this->caption = newcaption; } void setCaption(UBThumbnailTextItem* newcaption) { this->caption = newcaption; }
void Place(int row, int col, qreal width, qreal height); void Place(int row, int col, qreal width, qreal height);
int getBorder() const { return this->border; } int getBorder() const { return this->border; }
void setBorder(int newBorder) { this->border = newBorder; } void setBorder(int newBorder) { this->border = newBorder; }
}; };

@ -36,7 +36,7 @@ class UBNetworkAccessManager : public QNetworkAccessManager
UBNetworkAccessManager(QObject *parent = 0); UBNetworkAccessManager(QObject *parent = 0);
virtual QNetworkReply *get(const QNetworkRequest &request); virtual QNetworkReply *get(const QNetworkRequest &request);
protected: protected:
virtual QNetworkReply * createRequest ( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 ); virtual QNetworkReply * createRequest ( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 );

@ -114,7 +114,7 @@ void Document::saveAs(const char * newFileName)
for ( sizeIterator = sizesAndGenerationNumbers.begin() ; sizeIterator != sizesAndGenerationNumbers.end(); sizeIterator++ ) for ( sizeIterator = sizesAndGenerationNumbers.begin() ; sizeIterator != sizesAndGenerationNumbers.end(); sizeIterator++ )
{ {
out << std::setfill('0')<<std::setw(10)<<sizeInXref << " " << std::setw(5) << (*sizeIterator).second.second << " n \n"; out << std::setfill('0')<<std::setw(10)<<sizeInXref << " " << std::setw(5) << (*sizeIterator).second.second << " n \n";
sizeInXref = sizeInXref + (*sizeIterator).second.first; sizeInXref = sizeInXref + (*sizeIterator).second.first;
} }
out << "trailer\n<<\n/Size " << numberOfObjects << "\n/Info 1 0 R\n" out << "trailer\n<<\n/Size " << numberOfObjects << "\n/Info 1 0 R\n"
<< "/Root " << _root->getObjectNumber() << " 0 R\n >>\nstartxref\n" << sizeInXref << "\n%%EOF"; << "/Root " << _root->getObjectNumber() << " 0 R\n >>\nstartxref\n" << sizeInXref << "\n%%EOF";

@ -50,7 +50,7 @@ namespace merge_lib
std::string &_encoded; std::string &_encoded;
size_t _curSymbolIndex; size_t _curSymbolIndex;
int _earlyChange; // early parameter int _earlyChange; // early parameter
int _readBuf; int _readBuf;
int _readBits; int _readBits;
int _nextCode; int _nextCode;

@ -425,7 +425,7 @@ void Object::_addParent(Object * child)
} }
void Object::_serialize(std::ofstream & out, const std::string & stream) void Object::_serialize(std::ofstream & out, const std::string & stream)
{ {
out << _number << " " << _generationNumber << " obj\n" << _content << stream << "endobj\n"; out << _number << " " << _generationNumber << " obj\n" << _content << stream << "endobj\n";
out.flush(); out.flush();
} }

@ -36,137 +36,137 @@
namespace merge_lib namespace merge_lib
{ {
//This class represents pdf objects, and defines methods for performing //This class represents pdf objects, and defines methods for performing
//all necessary operations on pdf objects //all necessary operations on pdf objects
//Each object consists of two parts: content and object's number //Each object consists of two parts: content and object's number
//<object number> <number> obj //<object number> <number> obj
//<content> //<content>
//endobj //endobj
//Object can contain several links to other object. These objects has been named "children". //Object can contain several links to other object. These objects has been named "children".
//Each reference (child object) should be kept with it position(s) in object's content. //Each reference (child object) should be kept with it position(s) in object's content.
//After each content modification, all references should be changed too. //After each content modification, all references should be changed too.
//This convention lighten the recalculation object numbers work. //This convention lighten the recalculation object numbers work.
class Object class Object
{ {
public: public:
friend class PageElementHandler; friend class PageElementHandler;
typedef std::vector<unsigned int> ReferencePositionsInContent; typedef std::vector<unsigned int> ReferencePositionsInContent;
typedef std::pair<Object *, ReferencePositionsInContent > ChildAndItPositionInContent; typedef std::pair<Object *, ReferencePositionsInContent > ChildAndItPositionInContent;
typedef std::map <unsigned int, ChildAndItPositionInContent> Children; typedef std::map <unsigned int, ChildAndItPositionInContent> Children;
Object(unsigned int objectNumber, unsigned int generationNumber, const std::string & objectContent, Object(unsigned int objectNumber, unsigned int generationNumber, const std::string & objectContent,
std::string fileName = "", std::pair<unsigned int, unsigned int> streamBounds = std::make_pair ((unsigned int)0,(unsigned int)0), bool hasStream = false std::string fileName = "", std::pair<unsigned int, unsigned int> streamBounds = std::make_pair ((unsigned int)0,(unsigned int)0), bool hasStream = false
): ):
_number(objectNumber), _generationNumber(generationNumber), _oldNumber(objectNumber), _content(objectContent),_parents(),_children(),_isPassed(false), _number(objectNumber), _generationNumber(generationNumber), _oldNumber(objectNumber), _content(objectContent),_parents(),_children(),_isPassed(false),
_streamBounds(streamBounds), _fileName(fileName), _hasStream(hasStream), _hasStreamInContent(false) _streamBounds(streamBounds), _fileName(fileName), _hasStream(hasStream), _hasStreamInContent(false)
{ {
} }
virtual ~Object(); virtual ~Object();
Object * getClone(std::vector<Object *> & clones); Object * getClone(std::vector<Object *> & clones);
void addChild(Object * child, const std::vector<unsigned int> childPositionsInContent); void addChild(Object * child, const std::vector<unsigned int> childPositionsInContent);
void addChild(const Children & children); void addChild(const Children & children);
ReferencePositionsInContent removeChild(Object * child); ReferencePositionsInContent removeChild(Object * child);
void forgetAboutChildren(unsigned int leftBound, unsigned int rightBound); void forgetAboutChildren(unsigned int leftBound, unsigned int rightBound);
Object * getChild(unsigned int objectNumber); Object * getChild(unsigned int objectNumber);
bool findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent); bool findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent);
std::vector<Object *> getChildrenByBounds(unsigned int leftBound, unsigned int rightBound); std::vector<Object *> getChildrenByBounds(unsigned int leftBound, unsigned int rightBound);
std::vector<Object *> getSortedByPositionChildren(unsigned int leftBound, unsigned int rightBound); std::vector<Object *> getSortedByPositionChildren(unsigned int leftBound, unsigned int rightBound);
void removeChildrenByBounds(unsigned int leftBound, unsigned int rightBound); void removeChildrenByBounds(unsigned int leftBound, unsigned int rightBound);
const Children & getChildren(); const Children & getChildren();
void removeHimself(); void removeHimself();
unsigned int getObjectNumber() const; unsigned int getObjectNumber() const;
unsigned int getgenerationNumber() const; unsigned int getgenerationNumber() const;
std::string & getObjectContent(); std::string & getObjectContent();
void setObjectContent(const std::string & objectContent); void setObjectContent(const std::string & objectContent);
void appendContent(const std::string & addToContent); void appendContent(const std::string & addToContent);
void eraseContent(unsigned int from, unsigned int size); void eraseContent(unsigned int from, unsigned int size);
void insertToContent(unsigned int position, const char * insertedStr, unsigned int length); void insertToContent(unsigned int position, const char * insertedStr, unsigned int length);
void insertToContent(unsigned int position, const std::string & insertedStr); void insertToContent(unsigned int position, const std::string & insertedStr);
//vector <object number, its size> //vector <object number, its size>
void serialize(std::ofstream & out, std::map< unsigned int, std::pair<unsigned long long, unsigned int > > & sizesAndGenerationNumbers); void serialize(std::ofstream & out, std::map< unsigned int, std::pair<unsigned long long, unsigned int > > & sizesAndGenerationNumbers);
void recalculateObjectNumbers(unsigned int & newNumber); void recalculateObjectNumbers(unsigned int & newNumber);
bool isPassed() bool isPassed()
{ {
return _isPassed; return _isPassed;
} }
void retrieveMaxObjectNumber(unsigned int & maxNumber); void retrieveMaxObjectNumber(unsigned int & maxNumber);
void resetIsPassed() void resetIsPassed()
{ {
if(_isPassed) if(_isPassed)
_isPassed = false; _isPassed = false;
Children::iterator it; Children::iterator it;
for ( it=_children.begin() ; it != _children.end(); it++ ) for ( it=_children.begin() ; it != _children.end(); it++ )
{ {
if((*it).second.first->isPassed()) if((*it).second.first->isPassed())
(*it).second.first->resetIsPassed(); (*it).second.first->resetIsPassed();
} }
} }
unsigned int getOldNumber() unsigned int getOldNumber()
{ {
return _oldNumber; return _oldNumber;
} }
void setObjectNumber(unsigned int objNumber) void setObjectNumber(unsigned int objNumber)
{ {
_number = objNumber; _number = objNumber;
_oldNumber = objNumber; _oldNumber = objNumber;
} }
bool getStream(std::string &); bool getStream(std::string &);
bool hasStream(); bool hasStream();
bool getHeader(std::string &content); bool getHeader(std::string &content);
void forgetStreamInFile() void forgetStreamInFile()
{ {
_hasStreamInContent = true; _hasStreamInContent = true;
_hasStream = true; _hasStream = true;
} }
std::string getNameSimpleValue(const std::string &content, const std::string &patten, size_t pos = 0); std::string getNameSimpleValue(const std::string &content, const std::string &patten, size_t pos = 0);
unsigned int getChildPosition(const Object * child); //throw (Exception) unsigned int getChildPosition(const Object * child); //throw (Exception)
const std::set<Object *> & getParents() const std::set<Object *> & getParents()
{ {
return _parents; return _parents;
} }
Object* findPatternInObjOrParents(const std::string &pattern); Object* findPatternInObjOrParents(const std::string &pattern);
private: private:
//methods //methods
Object(const Object & copy); Object(const Object & copy);
Object * _getClone(std::map<unsigned int, Object *> & clones); Object * _getClone(std::map<unsigned int, Object *> & clones);
void _addChild(Object * child, const ReferencePositionsInContent & childPositionsInContent); void _addChild(Object * child, const ReferencePositionsInContent & childPositionsInContent);
void _setObjectNumber(unsigned int objectNumber); void _setObjectNumber(unsigned int objectNumber);
void _addParent(Object * child); void _addParent(Object * child);
bool _findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent); bool _findObject(const std::string & token, Object* & foundObject, unsigned int & tokenPositionInContent);
void _serialize(std::ofstream & out, const std::string & stream); void _serialize(std::ofstream & out, const std::string & stream);
void _recalculateObjectNumbers(unsigned int & maxNumber); void _recalculateObjectNumbers(unsigned int & maxNumber);
void _recalculateReferencePositions(unsigned int changedReference, int displacement); void _recalculateReferencePositions(unsigned int changedReference, int displacement);
void _retrieveMaxObjectNumber(unsigned int & maxNumber); void _retrieveMaxObjectNumber(unsigned int & maxNumber);
void _serialize(std::ofstream & out, std::map<unsigned int, unsigned long long> & sizes); void _serialize(std::ofstream & out, std::map<unsigned int, unsigned long long> & sizes);
bool _getStreamFromContent(std::string & stream); bool _getStreamFromContent(std::string & stream);
//members //members
unsigned int _number; unsigned int _number;
unsigned int _generationNumber; unsigned int _generationNumber;
unsigned int _oldNumber; unsigned int _oldNumber;
std::string _content; std::string _content;
std::set <Object *> _parents; std::set <Object *> _parents;
Children _children; Children _children;
bool _isPassed; bool _isPassed;
std::pair<unsigned int, unsigned int> _streamBounds; std::pair<unsigned int, unsigned int> _streamBounds;
std::string _fileName; std::string _fileName;
bool _hasStream; bool _hasStream;
bool _hasStreamInContent; bool _hasStreamInContent;
}; };
} }
#endif #endif

@ -90,7 +90,7 @@ void OverlayDocumentParser::_readXRefAndCreateObjects()
{ {
std::pair<unsigned int, unsigned int> streamBounds; std::pair<unsigned int, unsigned int> streamBounds;
unsigned int objectNumber; unsigned int objectNumber;
unsigned int generationNumber; unsigned int generationNumber;
bool hasObjectStream; bool hasObjectStream;
const std::string content = _getObjectContent(objIter->second - partStart, objectNumber, generationNumber, streamBounds, hasObjectStream); const std::string content = _getObjectContent(objIter->second - partStart, objectNumber, generationNumber, streamBounds, hasObjectStream);
streamBounds.first += partStart; streamBounds.first += partStart;

@ -43,20 +43,20 @@ namespace merge_lib
Document * parseDocument(const char * fileName); Document * parseDocument(const char * fileName);
protected: protected:
unsigned int _readTrailerAndReturnRoot(); unsigned int _readTrailerAndReturnRoot();
private: private:
//methods //methods
void _getFileContent(const char * fileName); void _getFileContent(const char * fileName);
void _readXRefAndCreateObjects(); void _readXRefAndCreateObjects();
void _readXref(std::map<unsigned int, unsigned long> & objectsAndSizes); void _readXref(std::map<unsigned int, unsigned long> & objectsAndSizes);
void _getPartOfFileContent(long startOfPart, unsigned int length); void _getPartOfFileContent(long startOfPart, unsigned int length);
unsigned int _getStartOfXrefWithRoot(); unsigned int _getStartOfXrefWithRoot();
//constants //constants
static int DOC_PART_WITH_START_OF_XREF; static int DOC_PART_WITH_START_OF_XREF;
//members //members
std::string _fileName; std::string _fileName;
}; };
} }
#endif #endif

@ -60,7 +60,7 @@ namespace merge_lib
static bool tokenIsAName(const std::string &content, size_t start ); static bool tokenIsAName(const std::string &content, size_t start );
protected: protected:
const std::string & _getObjectContent(unsigned int objectPosition, unsigned int & objectNumber, unsigned int & generationNumber, std::pair<unsigned int, unsigned int> &, bool &); const std::string & _getObjectContent(unsigned int objectPosition, unsigned int & objectNumber, unsigned int & generationNumber, std::pair<unsigned int, unsigned int> &, bool &);
virtual unsigned int _readTrailerAndReturnRoot(); virtual unsigned int _readTrailerAndReturnRoot();
private: private:
//methods //methods
virtual void _getFileContent(const char * fileName); virtual void _getFileContent(const char * fileName);

@ -28,21 +28,21 @@
namespace merge_lib namespace merge_lib
{ {
//This class remove field from Page object's content. //This class remove field from Page object's content.
class RemoveHimselfHandler: public PageElementHandler class RemoveHimselfHandler: public PageElementHandler
{ {
public: public:
RemoveHimselfHandler(Object * page, const std::string & handlerName): PageElementHandler(page) RemoveHimselfHandler(Object * page, const std::string & handlerName): PageElementHandler(page)
{ {
_setHandlerName(handlerName); _setHandlerName(handlerName);
} }
virtual ~RemoveHimselfHandler() virtual ~RemoveHimselfHandler()
{ {
} }
private: private:
//methods //methods
virtual void _changeObjectContent(unsigned int startOfPageElement); virtual void _changeObjectContent(unsigned int startOfPageElement);
}; };
} }
#endif #endif

@ -120,7 +120,7 @@ unsigned long Utils::getFileSize(const char * fileName)
pdfFile.open (fileName, std::ios::binary ); pdfFile.open (fileName, std::ios::binary );
if (pdfFile.fail()) if (pdfFile.fail())
{ {
std::stringstream errorMessage("File "); std::stringstream errorMessage("File ");
errorMessage << fileName << " is absent" << "\0"; errorMessage << fileName << " is absent" << "\0";
throw Exception(errorMessage); throw Exception(errorMessage);
} }

@ -58,7 +58,7 @@ class PDFRenderer : public QObject
QUuid fileUuid() const { return mFileUuid; } QUuid fileUuid() const { return mFileUuid; }
QByteArray fileData() const { return mFileData; } QByteArray fileData() const { return mFileData; }
void setDPI(int desiredDPI) { this->dpiForRendering = desiredDPI; } void setDPI(int desiredDPI) { this->dpiForRendering = desiredDPI; }
public slots: public slots:
virtual void render(QPainter *p, int pageNumber, const QRectF &bounds = QRectF()) = 0; virtual void render(QPainter *p, int pageNumber, const QRectF &bounds = QRectF()) = 0;
@ -74,9 +74,9 @@ class PDFRenderer : public QObject
static QMap< QUuid, QPointer<PDFRenderer> > sRenderers; static QMap< QUuid, QPointer<PDFRenderer> > sRenderers;
protected: protected:
int dpiForRendering; int dpiForRendering;
PDFRenderer(); PDFRenderer();
}; };
#endif // PDFRENDERER_H #endif // PDFRENDERER_H

@ -120,15 +120,15 @@ QSizeF XPDFRenderer::pageSizeF(int pageNumber) const
{ {
int rotate = mDocument->getPageRotate(pageNumber); int rotate = mDocument->getPageRotate(pageNumber);
cropWidth = mDocument->getPageCropWidth(pageNumber) * this->dpiForRendering / 72.0; cropWidth = mDocument->getPageCropWidth(pageNumber) * this->dpiForRendering / 72.0;
cropHeight = mDocument->getPageCropHeight(pageNumber) * this->dpiForRendering / 72.0; cropHeight = mDocument->getPageCropHeight(pageNumber) * this->dpiForRendering / 72.0;
if (rotate == 90 || rotate == 270) if (rotate == 90 || rotate == 270)
{ {
//switching width and height //switching width and height
qreal tmpVar = cropWidth; qreal tmpVar = cropWidth;
cropWidth = cropHeight; cropWidth = cropHeight;
cropHeight = tmpVar; cropHeight = tmpVar;
} }
} }
return QSizeF(cropWidth, cropHeight); return QSizeF(cropWidth, cropHeight);
@ -156,7 +156,7 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), *pdfImage); p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), *pdfImage);
p->setWorldTransform(savedTransform); p->setWorldTransform(savedTransform);
delete pdfImage; delete pdfImage;
} }
} }
QImage* XPDFRenderer::createPDFImage(int pageNumber, qreal xscale, qreal yscale, const QRectF &bounds) QImage* XPDFRenderer::createPDFImage(int pageNumber, qreal xscale, qreal yscale, const QRectF &bounds)
@ -177,18 +177,18 @@ QImage* XPDFRenderer::createPDFImage(int pageNumber, qreal xscale, qreal yscale,
if (bounds.isNull()) if (bounds.isNull())
{ {
mDocument->displayPage(mSplash, pageNumber, this->dpiForRendering * xscale, this->dpiForRendering *yscale, mDocument->displayPage(mSplash, pageNumber, this->dpiForRendering * xscale, this->dpiForRendering *yscale,
rotation, useMediaBox, crop, printing); rotation, useMediaBox, crop, printing);
} }
else else
{ {
mSliceX = bounds.x() * xscale; mSliceX = bounds.x() * xscale;
mSliceY = bounds.y() * yscale; mSliceY = bounds.y() * yscale;
qreal sliceW = bounds.width() * xscale; qreal sliceW = bounds.width() * xscale;
qreal sliceH = bounds.height() * yscale; qreal sliceH = bounds.height() * yscale;
mDocument->displayPageSlice(mSplash, pageNumber, this->dpiForRendering * xscale, this->dpiForRendering * yscale, mDocument->displayPageSlice(mSplash, pageNumber, this->dpiForRendering * xscale, this->dpiForRendering * yscale,
rotation, useMediaBox, crop, printing, mSliceX, mSliceY, sliceW, sliceH); rotation, useMediaBox, crop, printing, mSliceX, mSliceY, sliceW, sliceH);
} }
mpSplashBitmap = mSplash->getBitmap(); mpSplashBitmap = mSplash->getBitmap();

@ -706,15 +706,15 @@ void UBPodcastController::encodingFinished(bool ok)
{ {
if (!mApplicationIsClosing) if (!mApplicationIsClosing)
{ {
QString location; QString location;
if (mPodcastRecordingPath == QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)) if (mPodcastRecordingPath == QDesktopServices::storageLocation(QDesktopServices::DesktopLocation))
location = tr("on your desktop ..."); location = tr("on your desktop ...");
else else
{ {
QDir dir(mPodcastRecordingPath); QDir dir(mPodcastRecordingPath);
location = tr("in folder %1").arg(mPodcastRecordingPath); location = tr("in folder %1").arg(mPodcastRecordingPath);
} }
UBApplication::showMessage(tr("Podcast created %1").arg(location), false); UBApplication::showMessage(tr("Podcast created %1").arg(location), false);
@ -829,7 +829,7 @@ void UBPodcastController::toggleRecordingPalette(bool visible)
- mRecordingPalette->width() / 2; - mRecordingPalette->width() / 2;
int top = UBApplication::boardController->controlView()->height() int top = UBApplication::boardController->controlView()->height()
- mRecordingPalette->height() - UBSettings::boardMargin; - mRecordingPalette->height() - UBSettings::boardMargin;
QPoint controlViewPoint(left, top); QPoint controlViewPoint(left, top);
QPoint mainWindowsPoint = UBApplication::boardController->controlView()->mapTo(UBApplication::mainWindow, controlViewPoint); QPoint mainWindowsPoint = UBApplication::boardController->controlView()->mapTo(UBApplication::mainWindow, controlViewPoint);

@ -49,19 +49,19 @@ const int UBAbstractDrawRuler::sRoundingRadius = sLeftEdgeMargin / 2;
UBAbstractDrawRuler::UBAbstractDrawRuler() UBAbstractDrawRuler::UBAbstractDrawRuler()
: mShowButtons(false) : mShowButtons(false)
, mAntiScaleRatio(1.0) , mAntiScaleRatio(1.0)
{ {
//we actually need to evaluate pixels per millimeter //we actually need to evaluate pixels per millimeter
QDesktopWidget* desktop = UBApplication::desktop(); QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
sPixelsPerMillimeter = qRound(dpiCommon / UBGeometryUtils::inchSize); sPixelsPerMillimeter = qRound(dpiCommon / UBGeometryUtils::inchSize);
} }
void UBAbstractDrawRuler::create(QGraphicsItem& item) void UBAbstractDrawRuler::create(QGraphicsItem& item)
{ {
item.setFlag(QGraphicsItem::ItemIsMovable, true); item.setFlag(QGraphicsItem::ItemIsMovable, true);
item.setFlag(QGraphicsItem::ItemIsSelectable, true); item.setFlag(QGraphicsItem::ItemIsSelectable, true);
item.setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); item.setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
@ -94,7 +94,7 @@ QCursor UBAbstractDrawRuler::closeCursor() const
QCursor UBAbstractDrawRuler::drawRulerLineCursor() const QCursor UBAbstractDrawRuler::drawRulerLineCursor() const
{ {
return UBResources::resources()->drawLineRulerCursor; return UBResources::resources()->drawLineRulerCursor;
} }
QColor UBAbstractDrawRuler::drawColor() const QColor UBAbstractDrawRuler::drawColor() const

@ -40,7 +40,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
public: public:
UBGraphicsProtractor (); UBGraphicsProtractor ();
enum Tool {None, Move, Resize, Rotate, Reset, Close, MoveMarker}; enum Tool {None, Move, Resize, Rotate, Reset, Close, MoveMarker};
qreal angle () { return mStartAngle; } qreal angle () { return mStartAngle; }
qreal markerAngle () { return mCurrentAngle; } qreal markerAngle () { return mCurrentAngle; }
@ -83,17 +83,17 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
QSizeF buttonSizeReference () const{return QSizeF(radius() / 10, mCloseSvgItem->boundingRect().height() * radius()/(10 * mCloseSvgItem->boundingRect().width()));} QSizeF buttonSizeReference () const{return QSizeF(radius() / 10, mCloseSvgItem->boundingRect().height() * radius()/(10 * mCloseSvgItem->boundingRect().width()));}
QSizeF markerSizeReference () const{return QSizeF(radius() / 10, mMarkerSvgItem->boundingRect().height() * radius()/(10 * mMarkerSvgItem->boundingRect().width()));} QSizeF markerSizeReference () const{return QSizeF(radius() / 10, mMarkerSvgItem->boundingRect().height() * radius()/(10 * mMarkerSvgItem->boundingRect().width()));}
QRectF resetButtonRect () const; QRectF resetButtonRect () const;
QRectF closeButtonRect () const; QRectF closeButtonRect () const;
QRectF resizeButtonRect () const; QRectF resizeButtonRect () const;
QRectF rotateButtonRect () const{return QRectF(buttonSizeReference().width() * 5.5, -buttonSizeReference().width() * 5, buttonSizeReference().width(), buttonSizeReference().width());} QRectF rotateButtonRect () const{return QRectF(buttonSizeReference().width() * 5.5, -buttonSizeReference().width() * 5, buttonSizeReference().width(), buttonSizeReference().width());}
QRectF markerButtonRect () const{return QRectF(radius() + 3, -markerSizeReference().height() / 2 , markerSizeReference().width(), markerSizeReference().height());} QRectF markerButtonRect () const{return QRectF(radius() + 3, -markerSizeReference().height() / 2 , markerSizeReference().width(), markerSizeReference().height());}
inline qreal radius () const{return rect().height() / 2 - 20;} inline qreal radius () const{return rect().height() / 2 - 20;}
// Members // Members
QPointF mPreviousMousePos; QPointF mPreviousMousePos;
Tool mCurrentTool; Tool mCurrentTool;
bool mShowButtons; bool mShowButtons;
qreal mCurrentAngle; qreal mCurrentAngle;
qreal mSpan; qreal mSpan;
qreal mStartAngle; qreal mStartAngle;
@ -102,12 +102,12 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
QGraphicsSvgItem* mResetSvgItem; QGraphicsSvgItem* mResetSvgItem;
QGraphicsSvgItem* mResizeSvgItem; QGraphicsSvgItem* mResizeSvgItem;
QGraphicsSvgItem* mMarkerSvgItem; QGraphicsSvgItem* mMarkerSvgItem;
QGraphicsSvgItem* mRotateSvgItem; QGraphicsSvgItem* mRotateSvgItem;
static const QRectF sDefaultRect; static const QRectF sDefaultRect;
virtual void rotateAroundCenter(qreal angle); virtual void rotateAroundCenter(qreal angle);
virtual QPointF rotationCenter() const; virtual QPointF rotationCenter() const;
int sFillTransparency; int sFillTransparency;
int sDrawTransparency; int sDrawTransparency;

@ -51,8 +51,8 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
virtual UBItem* deepCopy() const; virtual UBItem* deepCopy() const;
virtual void copyItemParameters(UBItem *copy) const; virtual void copyItemParameters(UBItem *copy) const;
virtual void StartLine(const QPointF& position, qreal width); virtual void StartLine(const QPointF& position, qreal width);
virtual void DrawLine(const QPointF& position, qreal width); virtual void DrawLine(const QPointF& position, qreal width);
virtual void EndLine(); virtual void EndLine();
protected: protected:
@ -61,17 +61,17 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
// Events // Events
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
void paintGraduations(QPainter *painter); void paintGraduations(QPainter *painter);
private: private:
bool mResizing; bool mResizing;
bool mRotating; bool mRotating;
@ -80,11 +80,11 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
void paintRotationCenter(QPainter *painter); void paintRotationCenter(QPainter *painter);
virtual void rotateAroundCenter(qreal angle); virtual void rotateAroundCenter(qreal angle);
QGraphicsSvgItem* mRotateSvgItem; QGraphicsSvgItem* mRotateSvgItem;
QGraphicsSvgItem* mResizeSvgItem; QGraphicsSvgItem* mResizeSvgItem;
void updateResizeCursor(); void updateResizeCursor();
QCursor resizeCursor() const{return mResizeCursor;} QCursor resizeCursor() const{return mResizeCursor;}
virtual QPointF rotationCenter() const; virtual QPointF rotationCenter() const;
virtual QRectF resizeButtonRect() const; virtual QRectF resizeButtonRect() const;
@ -92,15 +92,15 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
virtual QRectF rotateButtonRect() const; virtual QRectF rotateButtonRect() const;
virtual UBGraphicsScene* scene() const; virtual UBGraphicsScene* scene() const;
QCursor mResizeCursor; QCursor mResizeCursor;
int drawLineDirection; int drawLineDirection;
// Constants // Constants
static const QRect sDefaultRect; static const QRect sDefaultRect;
static const int sMinLength = 150; // 3sm static const int sMinLength = 150; // 3sm
static const int sMaxLength = 35000; // 700sm static const int sMaxLength = 35000; // 700sm
}; };
#endif /* UBGRAPHICSRULER_H_ */ #endif /* UBGRAPHICSRULER_H_ */

@ -232,7 +232,7 @@ void UBWebController::tutorialWebInstance()
} }
else else
(*mCurrentWebBrowser)->loadUrl(currentUrl); (*mCurrentWebBrowser)->loadUrl(currentUrl);
mStackedWidget->setCurrentIndex(Tutorial); mStackedWidget->setCurrentIndex(Tutorial);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget()); UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());

@ -123,8 +123,8 @@ class UBWebController : public QObject
UBTrapFlashController* mTrapFlashController; UBTrapFlashController* mTrapFlashController;
UBWebToolsPalette** mToolsCurrentPalette; UBWebToolsPalette** mToolsCurrentPalette;
UBWebToolsPalette* mToolsPaletteList[TotalNumberOfWebInstances]; UBWebToolsPalette* mToolsPaletteList[TotalNumberOfWebInstances];
// UBKeyboardPalette** mKeyboardCurrentPalette; // UBKeyboardPalette** mKeyboardCurrentPalette;
// UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances]; // UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances];
bool mToolsPalettePositionned; bool mToolsPalettePositionned;
bool mToolsPalettePositionnedList[TotalNumberOfWebInstances]; bool mToolsPalettePositionnedList[TotalNumberOfWebInstances];
@ -144,7 +144,7 @@ class UBWebController : public QObject
void toggleWebTrap(bool checked); void toggleWebTrap(bool checked);
void onOEmbedParsed(QVector<sOEmbedContent> contents); void onOEmbedParsed(QVector<sOEmbedContent> contents);
// void showKeyboard(bool checked); // void showKeyboard(bool checked);
signals: signals:
/** /**

@ -588,7 +588,7 @@ void WBBrowserWindow::aboutToShowBackMenu()
if (!QWebSettings::iconForUrl(item.originalUrl()).isNull()) if (!QWebSettings::iconForUrl(item.originalUrl()).isNull())
action->setIcon(item.icon()); action->setIcon(item.icon());
action->setText(item.title().isEmpty() ? item.url().toString() : item.title()); action->setText(item.title().isEmpty() ? item.url().toString() : item.title());
mHistoryBackMenu->addAction(action); mHistoryBackMenu->addAction(action);
} }

@ -174,8 +174,8 @@ class WBBrowserWindow : public QWidget
Ui::MainWindow* mUniboardMainWindow; Ui::MainWindow* mUniboardMainWindow;
QMenu *mHistoryBackMenu; QMenu *mHistoryBackMenu;
QMenu *mHistoryForwardMenu; QMenu *mHistoryForwardMenu;
}; };
#endif // WBBROWSERMAINWINDOW_H #endif // WBBROWSERMAINWINDOW_H

@ -79,7 +79,7 @@ WBExLineEdit::WBExLineEdit(QWidget *parent)
, mLineEdit(new QLineEdit(this)) , mLineEdit(new QLineEdit(this))
, mClearButton(0) , mClearButton(0)
{ {
setFocusPolicy(mLineEdit->focusPolicy()); setFocusPolicy(mLineEdit->focusPolicy());
setAttribute(Qt::WA_InputMethodEnabled); setAttribute(Qt::WA_InputMethodEnabled);
setSizePolicy(mLineEdit->sizePolicy()); setSizePolicy(mLineEdit->sizePolicy());
setBackgroundRole(mLineEdit->backgroundRole()); setBackgroundRole(mLineEdit->backgroundRole());

Loading…
Cancel
Save