Revert "Revert changes pushed to wrong branch"

This reverts commit 4aa0ee6197.
preferencesAboutTextFull
Craig Watson 9 years ago
parent 4aa0ee6197
commit f4b1079d81
  1. 14
      OpenBoard.pro
  2. 27
      TEST_OpenBoard_Win32.txt
  3. 844
      changes_porting_qt5.txt
  4. 2
      src/adaptors/UBExportAdaptor.cpp
  5. 1
      src/adaptors/UBExportFullPDF.cpp
  6. 1
      src/adaptors/UBExportPDF.cpp
  7. 1
      src/adaptors/UBMetadataDcSubsetAdaptor.cpp
  8. 17
      src/adaptors/UBSvgSubsetAdaptor.cpp
  9. 1
      src/adaptors/UBSvgSubsetAdaptor.h
  10. 2
      src/adaptors/UBThumbnailAdaptor.cpp
  11. 2
      src/adaptors/publishing/UBDocumentPublisher.cpp
  12. 7
      src/adaptors/publishing/UBDocumentPublisher.h
  13. 1
      src/api/UBLibraryAPI.h
  14. 2
      src/api/UBW3CWidgetAPI.cpp
  15. 2
      src/api/UBWidgetMessageAPI.cpp
  16. 8
      src/api/UBWidgetUniboardAPI.cpp
  17. 8
      src/board/UBBoardController.cpp
  18. 3
      src/board/UBBoardController.h
  19. 16
      src/board/UBBoardPaletteManager.cpp
  20. 24
      src/board/UBBoardView.cpp
  21. 5
      src/board/UBBoardView.h
  22. 1
      src/board/UBFeaturesController.cpp
  23. 1
      src/board/UBFeaturesController.h
  24. 1
      src/core/UB.h
  25. 56
      src/core/UBApplication.cpp
  26. 32
      src/core/UBApplication.h
  27. 78
      src/core/UBApplicationController.cpp
  28. 6
      src/core/UBApplicationController.h
  29. 6
      src/core/UBDisplayManager.cpp
  30. 1
      src/core/UBDisplayManager.h
  31. 2
      src/core/UBDocumentManager.cpp
  32. 5
      src/core/UBDownloadManager.cpp
  33. 4
      src/core/UBOpenSankoreImporter.cpp
  34. 4
      src/core/UBPersistenceManager.cpp
  35. 4
      src/core/UBPreferencesController.cpp
  36. 1
      src/core/UBPreferencesController.h
  37. 38
      src/core/UBSettings.cpp
  38. 32
      src/core/main.cpp
  39. 3
      src/desktop/UBCustomCaptureWindow.cpp
  40. 3
      src/desktop/UBCustomCaptureWindow.h
  41. 20
      src/desktop/UBDesktopAnnotationController.cpp
  42. 4
      src/desktop/UBDesktopPalette.cpp
  43. 4
      src/desktop/UBDesktopPalette.h
  44. 1
      src/desktop/UBWindowCapture_linux.cpp
  45. 6
      src/document/UBDocumentController.cpp
  46. 1
      src/document/UBDocumentController.h
  47. 7
      src/domain/UBGraphicsDelegateFrame.cpp
  48. 2
      src/domain/UBGraphicsGroupContainerItem.cpp
  49. 6
      src/domain/UBGraphicsItemDelegate.cpp
  50. 65
      src/domain/UBGraphicsMediaItem.cpp
  51. 40
      src/domain/UBGraphicsMediaItem.h
  52. 125
      src/domain/UBGraphicsMediaItemDelegate.cpp
  53. 20
      src/domain/UBGraphicsMediaItemDelegate.h
  54. 10
      src/domain/UBGraphicsScene.cpp
  55. 4
      src/domain/UBGraphicsWidgetItem.cpp
  56. 1
      src/domain/UBGraphicsWidgetItem.h
  57. 2
      src/domain/UBSelectionFrame.cpp
  58. 1
      src/domain/UBUndoCommand.h
  59. 2
      src/frameworks/UBBase32.cpp
  60. 2
      src/frameworks/UBCoreGraphicsScene.h
  61. 8
      src/frameworks/UBCryptoUtils.cpp
  62. 8
      src/frameworks/UBFileSystemUtils.cpp
  63. 2
      src/frameworks/UBPlatformUtils.h
  64. 5
      src/frameworks/UBPlatformUtils_linux.cpp
  65. 6
      src/globals/UBGlobals.h
  66. 9
      src/gui/UBActionPalette.cpp
  67. 2
      src/gui/UBActionPalette.h
  68. 1
      src/gui/UBCircleFrame.h
  69. 1
      src/gui/UBColorPicker.h
  70. 4
      src/gui/UBDockPalette.cpp
  71. 3
      src/gui/UBDocumentThumbnailWidget.cpp
  72. 1
      src/gui/UBDocumentTreeWidget.h
  73. 4
      src/gui/UBDownloadWidget.cpp
  74. 3
      src/gui/UBFeaturesActionBar.cpp
  75. 3
      src/gui/UBFeaturesActionBar.h
  76. 10
      src/gui/UBFeaturesWidget.cpp
  77. 6
      src/gui/UBFeaturesWidget.h
  78. 4
      src/gui/UBFloatingPalette.cpp
  79. 4
      src/gui/UBMagnifer.cpp
  80. 1
      src/gui/UBMagnifer.h
  81. 12
      src/gui/UBMainWindow.cpp
  82. 4
      src/gui/UBMainWindow.h
  83. 2
      src/gui/UBMessageWindow.cpp
  84. 2
      src/gui/UBMessageWindow.h
  85. 4
      src/gui/UBMessagesDialog.cpp
  86. 1
      src/gui/UBMessagesDialog.h
  87. 2
      src/gui/UBMousePressFilter.cpp
  88. 10
      src/gui/UBRubberBand.cpp
  89. 3
      src/gui/UBScreenMirror.cpp
  90. 1
      src/gui/UBScreenMirror.h
  91. 2
      src/gui/UBSpinningWheel.cpp
  92. 8
      src/gui/UBThumbnailWidget.cpp
  93. 6
      src/gui/UBToolWidget.cpp
  94. 1
      src/gui/UBToolWidget.h
  95. 2
      src/gui/UBToolbarButtonGroup.cpp
  96. 4
      src/gui/UBToolbarButtonGroup.h
  97. 1
      src/gui/UBWidgetMirror.h
  98. 1
      src/gui/UBZoomPalette.cpp
  99. 4
      src/network/UBNetworkAccessManager.cpp
  100. 4
      src/pdf-merger/Utils.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

@ -28,10 +28,15 @@ VERSION_RC = $$replace(VERSION_RC, "r", "240") # 0xF0
QT += webkit QT += webkit
QT += svg QT += svg
QT += network QT += network
QT += phonon
QT += xml QT += xml
QT += script QT += script
QT += xmlpatterns QT += xmlpatterns
QT += uitools
QT += multimedia
QT += webkitwidgets
QT += multimediawidgets
QT += printsupport
QT += core
INCLUDEPATH += src INCLUDEPATH += src
@ -59,9 +64,10 @@ include(src/pdf-merger/pdfMerger.pri)
DEPENDPATH += $$THIRD_PARTY_PATH/quazip/ DEPENDPATH += $$THIRD_PARTY_PATH/quazip/
INCLUDEPATH += $$THIRD_PARTY_PATH/quazip/ INCLUDEPATH += $$THIRD_PARTY_PATH/quazip/
include($$THIRD_PARTY_PATH/quazip/quazip.pri) include($$THIRD_PARTY_PATH/quazip/quazip.pri)
DEPENDPATH += $$THIRD_PARTY_PATH/trolltech/singleapplication DEPENDPATH += $$THIRD_PARTY_PATH/qt/singleapplication
INCLUDEPATH += $$THIRD_PARTY_PATH/trolltech/singleapplication INCLUDEPATH += $$THIRD_PARTY_PATH/qt/singleapplication
include($$THIRD_PARTY_PATH/trolltech/singleapplication/qtsingleapplication.pri) include($$THIRD_PARTY_PATH/qt/singleapplication/qtsingleapplication.pri)
include($$THIRD_PARTY_PATH/qt/lockedfile/qtlockedfile.pri)
FORMS += resources/forms/mainWindow.ui \ FORMS += resources/forms/mainWindow.ui \
resources/forms/preferences.ui \ resources/forms/preferences.ui \

@ -0,0 +1,27 @@
****************************
* TEST OpenBoard *
* under Win32 (Windows 7) *
* *
****************************
======================|====================|
Modules | Status |
======================|====================|
Network Manager | web OK |
----------------------|--------------------|
the video media |.avi not working |
| .mp4 works in small|
| format |
----------------------|--------------------|
audio | OK |
----------------------|--------------------|
| |
----------------------|--------------------|
| |
----------------------|--------------------|
| |
----------------------|--------------------|

@ -0,0 +1,844 @@
*******************************
* PORTING QT4->QT5 *
* CHANGES *
* win32 compilaton &exec *
*******************************
QtSingleApplication replacement for Qt5
----------------------------------------
http://blog.kadu.im/2015/01/qtsingleapplication-replacement-for-qt5.html
UBWidgetMessageAPI.cpp
------------------------
-replace mGraphicsWidgetItem->page()->mainFrame()->evaluateJavaScript(js); by (Line 67)
QtWebKitWidgets
UBGraphicsWidgetItem.h
---------------------
- add #include <QtWebKitWidgets/QWebFrame>
UBGraphicsMediaItem.cpp
*-----------------------
- comment //Phonon::createPath(mMediaObject, mAudioOutput); (line 109)
- replace //mMediaObject->setCurrentSource(QMediaSource(absoluteMediaFilename)); by mMediaObject->setMedia(QUrl::fromLocalFile(absoluteMediaFilename)); (Line 191)
- replace //mAudioOutput = new QMediaPlayer(format, this); by mAudioOutput = new QMediaPlayer;
- replace //mMediaObject->seek(mInitialPos); by mMediaObject->setPosition(mInitialPos);
UBGraphicsMediaItem.h
-----------------------
- replace QAudioOutput *mAudioOutput; by QMediaPlayer *mAudioOutput;
- replace //mMediaObject->setTickInterval(50); by mMediaObject->setPosition(50);
UBGraphicsMediaItemDelegate.h
-------------------------------
- add #include <QtMultimedia/QMediaPlayer> header file
UBGraphicsMediaItemDelegate.cpp
-------------------------------
- replace UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaObject* pMedia, QObject * parent)
by UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaPlayer* pMedia, QObject * parent)
- replace //mMediaObject->setCurrentSource(mSource); by mMediaObject->setMedia(QUrl::fromLocalFile(pMediaFileUrl));
- replace //QMediaObject* media = delegated()->mediaObject(); by QMediaPlayer* media = delegated()->mediaObject();
- replace //remainingTime() by ((media->duration()-media->position()) <= 0) {
- replace totalTime()); by duration() (L246)
- replace //QMediaObject* media = delegated()->mediaObject();
QMediaPlayer* media = delegated()->mediaObject();
//mMediaControl->totalTimeChanged(media->totalTime());
mMediaControl->totalTimeChanged(media->duration()); (line 267)
- replace QMediaPlayer* media = delegated()->mediaObject();if (media->state() == QMediaPlayer::PlayingState)
- replace // delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl());
delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl());
- replace // delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl());
delegated()->mediaObject()->setMedia(delegated()->mediaFileUrl()); line 230
UBGraphicsItemDelegate.cpp
----------------------------
-replace //mDelegate->mediaObject()->seek(tickPos); by mDelegate->mediaObject()->setPosition(tickPos); (line 1445)
- replace //button->scale(0.8,0.8); by button->setScale(0.8);
UBGraphicsGroupContainerItem.cpp
----------------------------------
replace //foreach(QGraphicsItem *child, children()) by foreach(QGraphicsItem *child, childItems()) Line 287
UBGraphicsScene.cpp
-------------------
- replace //graphicsWidget->scale(ssf, ssf); by graphicsWidget->setScale(ssf); (1394)
- replace //svgItem->scale(sscale, sscale); by svgItem->setscale(sscale); (1521)
- replace //item->scale(ratio, ratio); by item->setscale(ratio); (1817)
- replace //pixmapItem->scale(pScaleFactor, pScaleFactor); by pixmapItem->setScale(pScaleFactor); (1273)
UBFileSystemUtils.cpp
--------------------
- replace QDesktopServices by QStandardPaths ; (line 138,139,
UBGraphicsMediaItem
-------------------
- replace //translate(translation.x(), translation.y()); by setPos(translation.x(), translation.y()); line 355
UBGraphicsDelegateFrame.cpp
----------------------------
- replace //translate(center.x(), center.y()); by setPos(center.x(), center.y()); line 840
- replace //translate(-center.x(), -center.y()); by setPos(-center.x(), -center.y()); line 840
- replace rotate(-angle); by setRotation(rotation() - angle); line 840
GraphicsPDFItem.cpp
----------------------
- replace //#include <QtGui/QStyleOptionGraphicsItem> by #include <QtWidgets/QGraphicsItem>
UBThumbnailWidget.cpp
---------------------
- replace //setAcceptsHoverEvents(true); by setAcceptHoverEvents(enabled); (line775) (accept without "s")
UBFeaturesWidget.cpp
--------------------
- add #include <QtWebKitWidgets/QWebview>
- add #include <Qt
OpenBoard.pro
-------------
- add QT += gui
UBDownloadWidget.cpp
--------------------
- replace //mpTree->header()->setResizeMode(eItemColumn_Desc, QHeaderView::Stretch);
mpTree->header()->setSectionResizeMode(eItemColumn_Desc, QHeaderView::Stretch);
//mpTree->header()->setResizeMode(eItemColumn_Close, QHeaderView::Custom);
mpTree->header()->setSectionResizeMode(eItemColumn_Close, QHeaderView::Custom); (Line 64)
UBWebPluginPDFWidget.cpp
--------------------------
- add //#include <QtGui> by #include <QtWidgets>
UBSpinningWheel.h
------------------
- add #include <QAtomicInt>
UBFeaturesWidget.cpp
---------------------
- add replace QWidget *eventSource = (QWidget*)event->source(); by QWidget *eventSource = event->source();
UBSpinningWheel.cpp
-------------------
- replace //painter.rotate(30 * (mPosition % 12)); by int val = mPosition.load(); and painter.rotate(30 * (val % 12));
PDFRenderer.cpp
---------------
- replace //if (mRefCount == 0) by if (mRefCount.load() == 0)
UBThumbnailWidget.cpp
---------------------
- replace //mLassoRectItem = new QGraphicsRectItem(0, scene()); by QRectF rect_init(0,0,0,0); and mLassoRectItem = new QGraphicsRectItem(rect_init, (QGraphicsItem *)scene());
UBDocumentThumbnailWidget.cpp
-----------------------------
-replace //mDropCaretRectItem = new QGraphicsRectItem(0, scene()); by QRectF rectInit(0,0,0,0); and mDropCaretRectItem = new QGraphicsRectItem(rectInit, (QGraphicsItem*)scene());
UBPlatformUtils_win.cpp
------------------------
- replace //#include <QtGui> by #include <QtWidgets>
XPDFRenderer.cpp
----------------
- replace //if (sInstancesCount == 0 && globalParams) by if (sInstancesCount.load() == 0 && globalParams)
C:\Qt_ide\5.2.1\msvc2010\include\QtCore\qdatetime.h
---------------------------------------------------
qdatetime.h.patch
------------------
- error C2589: '('ÿ: jeton non conforme … droite de '::'
- error C2059: erreur de syntaxeÿ: '::'
--- qtbase/src/corelib/tools/qdatetime.h 9 03:11:14 2013
+++ qtbase/src/corelib/tools/qdatetime.h 30 18:15:30 2013
@@ -120,7 +120,7 @@
inline qint64 toJulianDay() const { return jd; }
private:
- static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
+ static inline qint64 nullJd() { return (std::numeric_limits<qint64>::min)(); }
static inline qint64 minJd() { return Q_INT64_C(-784350574879); }
static inline qint64 maxJd() { return Q_INT64_C( 784354017364); }
UBDisplayManager.h
--------------------
- replace //#include <QtGui> by #include <QtWidgets>
UBDockPalette.cpp
----------------
- replace //iconPixmap.setAlphaChannel(transparencyPix); by the block codes as following :
//----------------------------------------------
QImage image = iconPixmap.toImage() ;
image.setAlphaChannel(transparencyPix.toImage());
iconPixmap = iconPixmap.fromImage(image);
//-----------------------------------------------
UBWindowsMediaFile.cpp
---------------------
- replace //#include <QtGui> by #include <QtWidgets>
- replace //if (FAILED(mWMWriter->AllocateSample(pImage.numBytes(), &sampleBuffer))) by if (FAILED(mWMWriter->AllocateSample(pImage. byteCount()(), &sampleBuffer)))
- replace //memcpy((void*) rawBuffer, imageBuffer, pImage.numBytes()); by memcpy((void*) rawBuffer, imageBuffer, pImage.byteCount());
UBWaveRecorder.cpp
-------------------
UBGraphicsProtractor.h
----------------------
- replace //#include <QtGui> by #include <QtWidgets>
UBGraphicsCompass.cpp
----------------------
- replace //setAcceptsHoverEvents(true); by setAcceptHoverEvents(true);
UBGraphicsProtractor.h
----------------------
- replace //#include <QtGui> by
#include <QtWidgets>
#include <QtWidgets/QGraphicsItem>
#include <QtWidgets/QGraphicsView>
UBGraphicsProtractor.cpp
-------------------------
-replace //translate(rect().center().x(), rect().center().y()); by setPos(rect().center().x(), rect().center().y()); line 205
-replace //translate(-rect().center().x(), -rect().center().y()); by setPos(-rect().center().x(), -rect().center().y()); line 210
-replace //mResetSvgItem->translate(-resetButtonRect().left(), -resetButtonRect().top()); by mResetSvgItem->setpos(-resetButtonRect().left(), -resetButtonRect().top());
all translate->setPos (Lines 464,468,473,475,477,480,482,484,
- replace //mMarkerSvgItem->rotate(- mStartAngle - mCurrentAngle); by mMarkerSvgItem->setRotation(- mStartAngle - mCurrentAngle);
- replace //mRotateSvgItem->rotate(-mStartAngle); by mRotateSvgItem->setRotation( -mStartAngle); (Line 482)
- replace //mResetSvgItem->rotate(-mStartAngle); by mResetSvgItem->setRotation(-mStartAngle); (Line 467)
- replace //mResizeSvgItem->rotate(-mStartAngle); by mResizeSvgItem->setRotation(-mStartAngle); Line 478)
- replace //mMarkerSvgItem->scale(scale, scale);//this do not impact the bounding box of thr svg item... by mMarkerSvgItem->setScale( scale);//this do not impact the bounding box of thr svg item...
(line 503)
- replace //mRotateSvgItem->scale(scale, scale);//this do not impact the bounding box of thr svg item... (Line 492)
mRotateSvgItem->setScale(scale);//this do not impact the bounding box of thr svg item...
- replace //mResetSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item...
mResetSvgItem->setScale(scale * antiSc);//this do not impact the bounding box of thr svg item... (Line 473)
- replace //scale(1.5, 1.5); by setScale(1.5); (Line 82)
- replace //mCloseSvgItem->rotate(-mStartAngle); by mCloseSvgItem->setRotation(-mStartAngle); (Line 458)
- replace //scale(scaleFactor); by setScale(scaleFactor);
- replace //mCloseSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item... by
mCloseSvgItem->setSale(scale * antiSc);//this do not impact the bounding box of thr svg item... (Line 467)
- replace // mResizeSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item...
mResizeSvgItem->setScale(scale * antiSc);//this do not impact the bounding box of thr svg item... (Line 490)
UBAbstractDrawRuler.h
----------------------
- replace //#include <QtGui> by
#include <QtWidgets>
UBWaveRecorder.cpp
-------------------
-replace // QString deviceName = QString:: fromUtf16(caps.szPname); by QString deviceName = QString::fromWCharArray(caps.szPname) ; (Line 67)
-replace //devices << QString::fromUtf16(caps.szPname); by devices << QString::fromWCharArray(caps.szPname); (Line 242)
UBAbstractDrawRuler.cpp
------------------------
- replace //item.setAcceptsHoverEvents(true); by item.setAcceptHoverEvents(true);
UBCustomCaptureWindow.h
------------------------
- replace //#include <QtGui> by include <QtWidgets>
UBWebKitUtils.h
---------------
-replace //#include <QtWebKit> by #include <QtWebKitWidgets>
UBWindowCaptureDelegate_win.h
------------------------------
- replace //#include <QtGui> by #include <QtWidgets>
UBOEmbedParser.cpp
------------------
-replace toAscii--> toLatin1 qurl.setEncodedUrl(url.toLatin1()); (line 230)
-replace
WBSqueezeLabel.h
-----------------
- replace //#include <QtGui/QLabel> by #include <QtWidgets>
UBWindowCaptureDelegate_win.cpp
--------------------------------
- replace //mCapturedPixmap = QPixmap::grabWindow(mCurrentWindow);
mCapturedPixmap = QScreen::grabWindow(mCurrentWindow);
UBOEmbedParser.cpp
-----------------
- replace //qurl.setEncodedUrl(url.toAscii()); by qurl.setUrl(url.toLatin1(),QUrl::TolerantMode);
WBChaseWidget.cpp
------------------
- replace //#include <QtGui> by #include <QtWidgets>
WBChaseWidget.h
-----------------
-replace //#include <QtGui> by #include <QtWidgets>
WBModelMenu.h
--------------
-replace //#include <QtGui> by #include <QtWidgets>
WBUrlLineEdit.cpp
-----------------
-replace //#include <QtGui> by #include <QtWidgets>
WBEditTableView.cpp
--------------------
- replace //#include <QtGui/QKeyEvent> by #include <QtWidgets>
WBEditTableView.h
------------------
-replace //#include <QtGui> by #include <QtWidgets>
WBSearchLineEdit.cpp
---------------------
-replace //#include <QtGui> by
#include <QtWidgets>
WBToolBarSearch.cpp
-------------------
//#include <QtGui>
#include <QtWidgets>
//#include <QtWebKit>
#include <QtWebKitWidgets>
WBToolBarSearch.h
------------------
-replace //#include <QtGui>
#include <QtWidgets>
WBSearchLineEdit.h
------------------
//#include <QtGui>
#include <QtWidgets>
WBWebTrapWebView.cpp
---------------------
- replace
//#include <QtGui>
//#include <QtWebKit>
by
#include <QtWidgets>
#include <QtWebKitWidgets>
WBWebTrapWebView.h
-------------------
- replace
//#include <QtGui>
//#include <QtWebKit>
by
#include <QtWidgets>
#include <QtWebKitWidgets>
WBToolBarSearch.cpp
-------------------
-add on the top of the file
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
# include <QUrlQuery>
#endif
WBUrlLineEdit.h
---------------
- replace //#include <QtGui> by //#include <QtWebKit>
WBWebView.h
-----------
- replace //#include <QtGui>
//#include <QtWebKit>
#include <QtWidgets>
#include <QtWebKitWidgets>
WBDownloadManager.cpp
----------------------
- replace storageLocation by QStandardPaths => QStandardPaths::writableLocation( QStandardPaths::DesktopLocation
WBToolBarSearch.cpp
--------------------
urlQuery1.addQueryItem(QLatin1String("q"), searchText);
url.setQuery(urlQuery1);
urlQuery2.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8"));
url.setQuery(urlQuery2);
urlQuery3.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8"));
url.setQuery(urlQuery3);
urlQuery4.addQueryItem(QLatin1String("client"), QLatin1String("uniboard-browser"));
url.setQuery(urlQuery4);
/*url.addQueryItem(QLatin1String("q"), searchText);
url.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8"));
url.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8"));
url.addQueryItem(QLatin1String("client"), QLatin1String("uniboard-browser"));
*/
WBTabWidget.cpp
----------------
-replace //#include <QtGui> by #include <QtWidgets>
WBTabWidget.h
-------------
- replace //#include <QtGui> by #include <QtWidgets>
Utils.cpp
---------
- replace toascii() by toLatin1()
****
TODO
****
- solve //mCapturedPixmap = QPixmap::grabWindow(mCurrentWindow);
mCapturedPixmap = QScreen::grabWindow((HWND)mCurrentWindow);
UBGlobals.h
-----------
replace //#ifdef Q_WS_WIN by #ifdef Q_OS_WIN
UBCFFAdaptor.cpp
----------------
************************************************
TODO
************************************************
- to solve dstList.setInsertInOrder(true); (Line 1954)
qtsingleapplication.h
---------------------
- replace //#include <QtGui/QApplication> by #include <QGuiApplication>
- comment //QtSingleApplication(int &argc, char **argv, Type type);
WBTabWidget.h
--------------
- replace //#include <QtWebKit> by #include <QtWebKitWidgets>
WBBrowserWindow.h
------------------
- replace //#include <QtGui> ;//#include <QtWebKit> by
#include <QtWidgets>
#include <QtWebKitWidgets>
WBHistory.h
-----------
- replace //#include <QtGui> ;//#include <QtWebKit> by
#include <QtWidgets>
#include <QtWebKitWidgets>
UBGlobals.h
------------
- replace //#ifdef Q_WS_WIN by #ifdef Q_OS_WIN
UBWindowCaptureDelegate_win.cpp
-------------------------------
- solve the HWND -->WId window conversion from //mCapturedPixmap = QPixmap::grabWindow(mCurrentWindow);
=> solution : add into the UBWindowCaptureDelegate_win.h header : the inclusion header #include <qwindowdefs_win.h>
UBWindowCaptureDelegate_win.h
-------------------------------
#ifdef Q_OS_WIN
#include <qwindowdefs_win.h>
#endif
qtsingleapplication.cpp
------------------------
- replace the content by the source file repository (CW)
qtsingleapplication.h
------------------------
- replace the content by the source file repository (CW)
UBWindowCaptureDelegate_win.cpp
--------------------------------
************************************************
TODO
************************************************
- solve the // mCapturedPixmap = QPixmap::grabWindow(mCurrentWindow); => pb of conversion between HWND and WId.
qtlockedfile_win.cpp
---------------------
- add #if QT_VERSION >= 0x050000
#define QT_WA(unicode, ansi) unicode
#endif
qtsingleapplication.cpp
-------------------------
- remove the contentfrom source repository(CW).
qtsingleapplication.h
-------------------------
- remove the contentfrom source repository(CW).
qtlocalpeer.h
-------------
- replace the content by the old basis source repository (OpenBoard-Third-party)
qtlocalpeer.cpp
---------------
- replace the content by the old basis source repository (OpenBoard-Third-party)
UBNetworkAccessManager.cpp
--------------------------
- replace //#include <QtGui> by #include <QtWidgets>
- replace // introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString())); by :
introMessage = introMessage.arg(QString(reply->url().toString())).toHtmlEscaped().arg(QString(reply->url().toString())).toHtmlEscaped();
WBHistory.cpp
--------------
- replace //#include <QtGui> by #include <QtWidgets>
- replace reset() by beginResetModel();
m_sourceRowCache.clear();
endResetModel(); (Line 1213,1268,)
-replace //reset(); by
beginResetModel();
endResetModel(); (Line 999,1006..)
}
- replace createIndex(row, column, 0); by (Line 969,1131,1140)
createIndex(row, column);
WBHistory.h
------------
- replace class WBHistoryFilterModel : public QAbstractProxyModel, by
class WBHistoryFilterModel : public QAbstractProxyModel, public QAbstractItemModel
- ?? pb at the level of compiler error:
UBBoardView.cpp
----------------
************************************************
TODO done cf below
************************************************
SOLVE THE ItemAt
- comment the mouseReleaseEvent method
- comment the mousePressEvent method
WBHistory.cpp
--------------
- comment and remove //beginResetModel(); and //endResetModel(); (Line 247)
- comment and remove //beginResetModel(); and //endResetModel(); (Line 837-843)
UBApplication.cpp
------------------
-remove and comment //QApplication::setStyle(new UBStyle()); // Style is owned and deleted by the application.
UBTrapFlashController.h
-----------------------
- replace //#include <QtGui> by #include <QtWidgets>.
UBTrapFlashController.cpp
-------------------------
- replace //#ifdef Q_WS_WIN // Defined on Windows. by#ifdef Q_OS_WIN // Defined on Windows.
UBPodcastController.cpp
-------------------------
-replace QDesktopServices::storageLocation. (Line 715)
-replace by QStandardPaths::writableLocation.
- replace repaintRect = repaintRect.unite(mSceneRepaintRectQueue.dequeue()); by repaintRect = repaintRect.united(mSceneRepaintRectQueue.dequeue());
- replace QRectF maxRect = rect.intersect(viewportRect); by RectF maxRect = rect.intersected(viewportRect);
- replace repaintRect = repaintRect.unite(mWidgetRepaintRectQueue.dequeue()); by repaintRect = repaintRect.united(mWidgetRepaintRectQueue.dequeue());
main.cpp
----------
- move QMessageLogContext context_m; on line 58
- replace // qt_message_output(type, msg); by qt_message_output(type,context_m, msg);
COMPILATION STATUS IN DEBUG STATUS :
************************************
- compile all libraries (freetype.lib quazip.lib,xpdf.lib) with success
- issue: error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0'
=> solution: complation in RELEASE MODE
- problem : LINK : fatal error LNK1123: échec lors de la conversion en fichier COFF msvc 2010 qt 5.2
=> solution :
Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
- install the followin tools in your computer quth the msvc 2010 config:
cf https://support.microsoft.com/fr-fr/kb/2934068 :
support microsoft : " Erreur se produit lorsque vous installez le Kit de développement logiciel Windows pour Windows 7 et.NET Framework 4 "
steps :
------
1) remove and reinstall Microsoft Visual C++ 2010 SP1 Redistributable Package (x32) : vcredist_x32.exe
2) remove and reinstall Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) : vcredist_x64.exe
3) install Microsoft Windows SDK for Windows 7 and .NET Framework 4 (ISO).
4) reinstall Microsoft Visual Studio 2010 Service Pack 1 (Installer) download the iso from the link https://www.microsoft.com/en-us/download/confirmation.aspx?id=23691
cf link : https://msdn.microsoft.com/fr-fr/library/7dz62kfh.aspx
cf http://stackoverflow.com/questions/10888391/error-link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-inval
=> solution : the tools cvtres.exe was broken so copy C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe
into C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe
OpenBoard.pro
--------------
- pb: fatal error LNK1123: échec lors de la conversion en fichier COFF vs 2010 qt 5.2 => add QMAKE_LFLAGS += /INCREMENTAL:NO
UBBoardView.cpp
----------------
the ItemAt issue was solved by the last update methods from the repository.
UBGraphicsTextItem.cpp
----------------------
- replace //#include <QtGui> by #include <QtWidgets>.

@ -23,7 +23,7 @@
*/ */
#include <QFileDialog>
#include "UBExportAdaptor.h" #include "UBExportAdaptor.h"

@ -29,6 +29,7 @@
#include <QtCore> #include <QtCore>
#include <QtSvg> #include <QtSvg>
#include <QPrinter>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"

@ -29,6 +29,7 @@
#include <QtCore> #include <QtCore>
#include <QtSvg> #include <QtSvg>
#include <QPrinter>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"

@ -29,6 +29,7 @@
#include <QtGui> #include <QtGui>
#include <QtXml> #include <QtXml>
#include <QDesktopWidget>
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"

@ -30,6 +30,7 @@
#include <QtCore> #include <QtCore>
#include <QtXml> #include <QtXml>
#include <QGraphicsTextItem> #include <QGraphicsTextItem>
#include <QDomElement>
#include "domain/UBGraphicsSvgItem.h" #include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsPixmapItem.h" #include "domain/UBGraphicsPixmapItem.h"
@ -329,7 +330,7 @@ QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex)
UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const QByteArray& pArray) UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const QByteArray& pArray)
{ {
UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toAscii()); UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toLatin1());
return reader.loadScene(); return reader.loadScene();
} }
@ -1335,7 +1336,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
QUuid uuid = UBGraphicsScene::getPersonalUuid(groupItem); QUuid uuid = UBGraphicsScene::getPersonalUuid(groupItem);
if (!uuid.isNull()) { if (!uuid.isNull()) {
QDomElement curGroupElement = groupDomDocument->createElement(tGroup); QDomElement curGroupElement = groupDomDocument->createElement(tGroup);
curGroupElement.setAttribute(aId, uuid); curGroupElement.setAttribute(aId, uuid.toString());
UBGraphicsGroupContainerItem* group = dynamic_cast<UBGraphicsGroupContainerItem*>(groupItem); UBGraphicsGroupContainerItem* group = dynamic_cast<UBGraphicsGroupContainerItem*>(groupItem);
if(group && group->Delegate()){ if(group && group->Delegate()){
if(group->Delegate()->isLocked()) if(group->Delegate()->isLocked())
@ -1351,7 +1352,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
persistGroupToDom(item, curParent, groupDomDocument); persistGroupToDom(item, curParent, groupDomDocument);
else { else {
QDomElement curSubElement = groupDomDocument->createElement(tElement); QDomElement curSubElement = groupDomDocument->createElement(tElement);
curSubElement.setAttribute(aId, tmpUuid); curSubElement.setAttribute(aId, tmpUuid.toString());
curGroupElement.appendChild(curSubElement); curGroupElement.appendChild(curSubElement);
} }
} }
@ -1990,9 +1991,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::audioItemToLinkedAudio(UBGraphicsMed
graphicsItemToSvg(audioItem); graphicsItemToSvg(audioItem);
if (audioItem->mediaObject()->state() == Phonon::PausedState && audioItem->mediaObject()->remainingTime() > 0) if (audioItem->mediaObject()->state() == QMediaPlayer::PausedState && (audioItem->mediaObject()->duration() - audioItem->mediaObject()->position()) > 0)
{ {
qint64 pos = audioItem->mediaObject()->currentTime(); qint64 pos = audioItem->mediaObject()->position();
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos));
} }
@ -2019,9 +2020,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::videoItemToLinkedVideo(UBGraphicsMed
graphicsItemToSvg(videoItem); graphicsItemToSvg(videoItem);
if (videoItem->mediaObject()->state() == Phonon::PausedState && videoItem->mediaObject()->remainingTime() > 0) if (videoItem->mediaObject()->state() == QMediaPlayer::PausedState && (videoItem->mediaObject()->duration() - videoItem->mediaObject()->position()) > 0)
{ {
qint64 pos = videoItem->mediaObject()->currentTime(); qint64 pos = videoItem->mediaObject()->position();
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos));
} }
@ -2139,7 +2140,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
{ {
if (!svgX.isNull() && !svgY.isNull()) if (!svgX.isNull() && !svgY.isNull())
{ {
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat()); gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat());
#endif #endif
} }

@ -30,6 +30,7 @@
#include <QtGui> #include <QtGui>
#include <QtXml> #include <QtXml>
#include <QGraphicsItem>
#include "frameworks/UBGeometryUtils.h" #include "frameworks/UBGeometryUtils.h"

@ -95,7 +95,7 @@ const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex)
if (file.exists()) if (file.exists())
{ {
//Warning. Works only with modified Qt //Warning. Works only with modified Qt
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
pix->load(fileName, 0, Qt::AutoColor); pix->load(fileName, 0, Qt::AutoColor);
#else #else
pix->load(fileName, 0, Qt::AutoColor, false); pix->load(fileName, 0, Qt::AutoColor, false);

@ -24,7 +24,7 @@
#include <QPushButton>
#include "UBDocumentPublisher.h" #include "UBDocumentPublisher.h"

@ -30,6 +30,13 @@
#include <QtGui> #include <QtGui>
#include <QtNetwork> #include <QtNetwork>
#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QDialogButtonBox>
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
typedef struct typedef struct
{ {

@ -30,6 +30,7 @@
#include <QtGui> #include <QtGui>
#include <QtWebKit> #include <QtWebKit>
#include <QWebView>
class UBLibraryAPI : public QObject class UBLibraryAPI : public QObject
{ {

@ -59,7 +59,7 @@ UBW3CWidgetAPI::~UBW3CWidgetAPI()
QString UBW3CWidgetAPI::uuid() QString UBW3CWidgetAPI::uuid()
{ {
if (mGraphicsW3CWidget) if (mGraphicsW3CWidget)
return mGraphicsW3CWidget->uuid(); return mGraphicsW3CWidget->uuid().toString();
else else
return ""; return "";
} }

@ -23,7 +23,7 @@
*/ */
#include <QWebFrame>
#include "UBWidgetMessageAPI.h" #include "UBWidgetMessageAPI.h"

@ -514,7 +514,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event)
QString str = "test string"; QString str = "test string";
QMimeData mimeData; QMimeData mimeData;
mimeData.setData(tMimeText, str.toAscii()); mimeData.setData(tMimeText, str.toLatin1());
sDownloadFileDesc desc; sDownloadFileDesc desc;
desc.dest = sDownloadFileDesc::graphicsWidget; desc.dest = sDownloadFileDesc::graphicsWidget;
@ -556,7 +556,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event)
} }
qDebug() << destFileName; qDebug() << destFileName;
QString mimeText = createMimeText(downloaded, contentType, destFileName); QString mimeText = createMimeText(downloaded, contentType, destFileName);
dropMimeData->setData(tMimeText, mimeText.toAscii()); dropMimeData->setData(tMimeText, mimeText.toLatin1());
event->setMimeData(dropMimeData); event->setMimeData(dropMimeData);
} }
@ -588,7 +588,7 @@ void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc de
} }
} }
QString destFileName = objDir + QUuid::createUuid() + "." + extention; QString destFileName = objDir + QUuid::createUuid().toString() + "." + extention;
QFile destFile(destFileName); QFile destFile(destFileName);
if (!destFile.open(QIODevice::WriteOnly)) { if (!destFile.open(QIODevice::WriteOnly)) {
@ -606,7 +606,7 @@ void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc de
QMimeData dropMimeData; QMimeData dropMimeData;
QString mimeText = createMimeText(true, contentType, destFileName); QString mimeText = createMimeText(true, contentType, destFileName);
dropMimeData.setData(tMimeText, mimeText.toAscii()); dropMimeData.setData(tMimeText, mimeText.toLatin1());
destFile.close(); destFile.close();

@ -86,7 +86,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
#include <QProcess> #include <QProcess>
bool onboardIsAlreadyRunning = true; bool onboardIsAlreadyRunning = true;
#endif #endif
@ -165,7 +165,7 @@ void UBBoardController::init()
UBBoardController::~UBBoardController() UBBoardController::~UBBoardController()
{ {
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
if(!onboardIsAlreadyRunning){ if(!onboardIsAlreadyRunning){
QProcess newProcess; QProcess newProcess;
newProcess.startDetached("killall onboard"); newProcess.startDetached("killall onboard");
@ -828,7 +828,7 @@ void UBBoardController::showKeyboard(bool show)
if(show) if(show)
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
static bool isFirstTime = true; static bool isFirstTime = true;
if(isFirstTime){ if(isFirstTime){
QProcess isAlreadyRunningProcess; QProcess isAlreadyRunningProcess;
@ -2411,7 +2411,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
} }
} }
else{ else{
#ifdef Q_WS_MACX #ifdef Q_OS_OSX
// With Safari, in 95% of the drops, the mime datas are hidden in Apple Web Archive pasteboard type. // With Safari, in 95% of the drops, the mime datas are hidden in Apple Web Archive pasteboard type.
// This is due to the way Safari is working so we have to dig into the pasteboard in order to retrieve // This is due to the way Safari is working so we have to dig into the pasteboard in order to retrieve
// the data. // the data.

@ -31,6 +31,9 @@
#include <QtGui> #include <QtGui>
#include <QObject> #include <QObject>
#include <QHBoxLayout>
#include <QUndoCommand>
#include "document/UBDocumentContainer.h" #include "document/UBDocumentContainer.h"
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"

@ -225,7 +225,7 @@ void UBBoardPaletteManager::setupPalettes()
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
{ {
mKeyboardPalette = new UBKeyboardPalette(0); mKeyboardPalette = new UBKeyboardPalette(0);
#ifndef Q_WS_WIN #ifndef Q_OS_WIN
connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated())); connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated()));
#endif #endif
} }
@ -677,7 +677,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
mLeftPalette->setVisible(leftPaletteVisible); mLeftPalette->setVisible(leftPaletteVisible);
mRightPalette->setVisible(rightPaletteVisible); mRightPalette->setVisible(rightPaletteVisible);
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
if (rightPaletteVisible) if (rightPaletteVisible)
mRightPalette->setAdditionalVOffset(0); mRightPalette->setAdditionalVOffset(0);
#endif #endif
@ -702,24 +702,24 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
if(mKeyboardPalette->m_isVisible) if(mKeyboardPalette->m_isVisible)
{ {
mKeyboardPalette->hide(); mKeyboardPalette->hide();
#ifndef Q_WS_X11 #ifndef Q_OS_LINUX
mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
#else #else
mKeyboardPalette->setParent(0); mKeyboardPalette->setParent(0);
#endif #endif
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
mKeyboardPalette->setWindowFlags(Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint); mKeyboardPalette->setWindowFlags(Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint);
#endif #endif
mKeyboardPalette->show(); mKeyboardPalette->show();
} }
else else
// In linux keyboard in desktop mode have to allways be with null parent // In linux keyboard in desktop mode have to allways be with null parent
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
mKeyboardPalette->setParent(0); mKeyboardPalette->setParent(0);
#else #else
mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
#endif //Q_WS_X11 #endif //Q_OS_LINUX
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
mKeyboardPalette->setWindowFlags(Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint); mKeyboardPalette->setWindowFlags(Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint);
#endif #endif
@ -727,7 +727,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
mLeftPalette->setVisible(leftPaletteVisible); mLeftPalette->setVisible(leftPaletteVisible);
mRightPalette->setVisible(rightPaletteVisible); mRightPalette->setVisible(rightPaletteVisible);
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
if (rightPaletteVisible && UBSettings::settings()->appToolBarPositionedAtTop->get().toBool()) if (rightPaletteVisible && UBSettings::settings()->appToolBarPositionedAtTop->get().toBool())
mRightPalette->setAdditionalVOffset(30); mRightPalette->setAdditionalVOffset(30);
#endif #endif

@ -55,7 +55,7 @@
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"
#include "desktop/UBDesktopAnnotationController.h" #include "desktop/UBDesktopAnnotationController.h"
#endif #endif
@ -366,7 +366,7 @@ void UBBoardView::tabletEvent (QTabletEvent * event)
} }
bool acceptEvent = true; bool acceptEvent = true;
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
//Work around #1388. After selecting annotation tool in desktop mode, annotation view appears on top when //Work around #1388. After selecting annotation tool in desktop mode, annotation view appears on top when
//using Mac OS X. In this case tablet event should send mouse event so as to let user interact with //using Mac OS X. In this case tablet event should send mouse event so as to let user interact with
//stylus palette. //stylus palette.
@ -750,13 +750,13 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
if (itemShouldReceiveMousePressEvent(movingItem)){ if (itemShouldReceiveMousePressEvent(movingItem)){
QGraphicsView::mousePressEvent (event); QGraphicsView::mousePressEvent (event);
QGraphicsItem* item = determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint()), transform())); QGraphicsItem* item = determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), transform()));
//use QGraphicsView::transform() to use not deprecated QGraphicsScene::itemAt() method //use QGraphicsView::transform() to use not deprecated QGraphicsScene::itemAt() method
if (item && (item->type() == QGraphicsProxyWidget::Type) && item->parentObject() && item->parentObject()->type() != QGraphicsProxyWidget::Type) if (item && (item->type() == QGraphicsProxyWidget::Type) && item->parentObject() && item->parentObject()->type() != QGraphicsProxyWidget::Type)
{ {
//Clean up children //Clean up children
QList<QGraphicsItem*> children = item->children(); QList<QGraphicsItem*> children = item->childItems();
for( QList<QGraphicsItem*>::iterator it = children.begin(); it != children.end(); ++it ) for( QList<QGraphicsItem*>::iterator it = children.begin(); it != children.end(); ++it )
if ((*it)->pos().x() < 0 || (*it)->pos().y() < 0) if ((*it)->pos().x() < 0 || (*it)->pos().y() < 0)
@ -865,7 +865,7 @@ void UBBoardView::setMultiselection(bool enable)
} }
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above // work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX) #if defined(Q_OS_OSX)
bool UBBoardView::directTabletEvent(QEvent *event) bool UBBoardView::directTabletEvent(QEvent *event)
{ {
QTabletEvent *tEvent = static_cast<QTabletEvent *>(event); QTabletEvent *tEvent = static_cast<QTabletEvent *>(event);
@ -905,7 +905,7 @@ QWidget *UBBoardView::widgetForTabletEvent(QWidget *w, const QPoint &pos)
QWidget *childAtPos = NULL; QWidget *childAtPos = NULL;
QList<QObject *> childs = w->children(); QList<QObject *> childs = w->childItems();
foreach(QObject *child, childs) foreach(QObject *child, childs)
{ {
QWidget *childWidget = qobject_cast<QWidget *>(child); QWidget *childWidget = qobject_cast<QWidget *>(child);
@ -972,7 +972,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
} }
mMouseDownPos = event->pos (); mMouseDownPos = event->pos ();
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); movingItem = scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform());
if (event->button () == Qt::LeftButton && isInteractive()) if (event->button () == Qt::LeftButton && isInteractive())
{ {
@ -993,7 +993,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
case UBStylusTool::Hand : case UBStylusTool::Hand :
viewport()->setCursor(QCursor (Qt::ClosedHandCursor)); viewport()->setCursor(QCursor (Qt::ClosedHandCursor));
mPreviousPoint = event->posF(); mPreviousPoint = event->localPos();
event->accept(); event->accept();
break; break;
@ -1107,7 +1107,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
if (!mMouseButtonIsPressed && !mTabletStylusIsPressed) { if (!mMouseButtonIsPressed && !mTabletStylusIsPressed) {
break; break;
} }
QPointF eventPosition = event->posF (); QPointF eventPosition = event->localPos();
qreal dx = eventPosition.x () - mPreviousPoint.x (); qreal dx = eventPosition.x () - mPreviousPoint.x ();
qreal dy = eventPosition.y () - mPreviousPoint.y (); qreal dy = eventPosition.y () - mPreviousPoint.y ();
mController->handScroll (dx, dy); mController->handScroll (dx, dy);
@ -1230,7 +1230,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
graphicsItem->Delegate()->commitUndoStep(); graphicsItem->Delegate()->commitUndoStep();
bool bReleaseIsNeed = true; bool bReleaseIsNeed = true;
if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint())))) if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform())))
{ {
movingItem = NULL; movingItem = NULL;
bReleaseIsNeed = false; bReleaseIsNeed = false;
@ -1299,7 +1299,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
graphicsItem->Delegate()->commitUndoStep(); graphicsItem->Delegate()->commitUndoStep();
bool bReleaseIsNeed = true; bool bReleaseIsNeed = true;
if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint())))) if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform())))
{ {
movingItem = NULL; movingItem = NULL;
bReleaseIsNeed = false; bReleaseIsNeed = false;
@ -1475,7 +1475,7 @@ void UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
QPointF scenePos = mapToScene(wheelEvent->pos()); QPointF scenePos = mapToScene(wheelEvent->pos());
QList<QGraphicsItem *> itemsList = scene()->items(scenePos); QList<QGraphicsItem *> itemsList = scene()->items(scenePos);
QBool isSelectedAndMouseHower = itemsList.contains(selItem); bool isSelectedAndMouseHower = itemsList.contains(selItem);
if(isSelectedAndMouseHower) if(isSelectedAndMouseHower)
{ {
QGraphicsView::wheelEvent(wheelEvent); QGraphicsView::wheelEvent(wheelEvent);

@ -30,6 +30,9 @@
#define CONTROLVIEW_OBJ_NAME "ControlView" #define CONTROLVIEW_OBJ_NAME "ControlView"
#include <QtGui> #include <QtGui>
#include <QGraphicsView>
#include <QRubberBand>
#include "core/UB.h" #include "core/UB.h"
#include "domain/UBGraphicsDelegateFrame.h" #include "domain/UBGraphicsDelegateFrame.h"
@ -60,7 +63,7 @@ public:
void setMultiselection(bool enable); void setMultiselection(bool enable);
bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; } bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; }
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above // work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX) #if defined(Q_OS_OSX)
bool directTabletEvent(QEvent *event); bool directTabletEvent(QEvent *event);
QWidget *widgetForTabletEvent(QWidget *w, const QPoint &pos); QWidget *widgetForTabletEvent(QWidget *w, const QPoint &pos);
#endif #endif

@ -346,7 +346,6 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
scanFS(); scanFS();
featuresModel = new UBFeaturesModel(featuresList, this); featuresModel = new UBFeaturesModel(featuresList, this);
featuresModel->setSupportedDragActions(Qt::CopyAction | Qt::MoveAction);
featuresProxyModel = new UBFeaturesProxyModel(this); featuresProxyModel = new UBFeaturesProxyModel(this);
featuresProxyModel->setFilterFixedString(rootPath); featuresProxyModel->setFilterFixedString(rootPath);

@ -43,6 +43,7 @@
#include <QThread> #include <QThread>
#include <QMutex> #include <QMutex>
#include <QWaitCondition> #include <QWaitCondition>
#include <QListView>
class UBFeaturesModel; class UBFeaturesModel;
class UBFeaturesItemDelegate; class UBFeaturesItemDelegate;

@ -29,6 +29,7 @@
#define UB_H_ #define UB_H_
#include <QtGui> #include <QtGui>
#include <QGraphicsItem>
#define UB_MAX_ZOOM 9 #define UB_MAX_ZOOM 9

@ -31,8 +31,9 @@
#include <QtWebKit> #include <QtWebKit>
#include <QtXml> #include <QtXml>
#include <QFontDatabase> #include <QFontDatabase>
#include <QStyleFactory>
#if defined(Q_WS_MACX) #if defined(Q_OS_OSX)
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#endif #endif
@ -84,13 +85,13 @@ const QString UBApplication::mimeTypeUniboardPage = QString("application/vnd.mne
const QString UBApplication::mimeTypeUniboardPageItem = QString("application/vnd.mnemis-uniboard-page-item"); const QString UBApplication::mimeTypeUniboardPageItem = QString("application/vnd.mnemis-uniboard-page-item");
const QString UBApplication::mimeTypeUniboardPageThumbnail = QString("application/vnd.mnemis-uniboard-thumbnail"); const QString UBApplication::mimeTypeUniboardPageThumbnail = QString("application/vnd.mnemis-uniboard-thumbnail");
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
bool bIsMinimized = false; bool bIsMinimized = false;
#endif #endif
QObject* UBApplication::staticMemoryCleaner = 0; QObject* UBApplication::staticMemoryCleaner = 0;
#if defined(Q_WS_MAC) #if defined(Q_OS_OSX)
static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event, long handlerRefCon) static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event, long handlerRefCon)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -153,11 +154,11 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), this, SLOT(toolBarDisplayTextChanged(QVariant))); connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), this, SLOT(toolBarDisplayTextChanged(QVariant)));
updateProtoActionsState(); updateProtoActionsState();
#ifndef Q_WS_MAC #ifndef Q_OS_OSX
setWindowIcon(QIcon(":/images/OpenBoard.png")); setWindowIcon(QIcon(":/images/OpenBoard.png"));
#endif #endif
setStyle(new UBStyle()); // Style is owned and deleted by the application setStyle("fusion");
QString css = UBFileSystemUtils::readTextFile(UBPlatformUtils::applicationResourcesDirectory() + "/etc/"+ qApp->applicationName()+".css"); QString css = UBFileSystemUtils::readTextFile(UBPlatformUtils::applicationResourcesDirectory() + "/etc/"+ qApp->applicationName()+".css");
if (css.length() > 0) if (css.length() > 0)
@ -337,7 +338,7 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool))); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool)));
connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), this, SLOT(stopScript())); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), this, SLOT(stopScript()));
#ifndef Q_WS_MAC #ifndef Q_OS_OSX
connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized())); connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized()));
#else #else
connect(mainWindow->actionHideApplication, SIGNAL(triggered()), this, SLOT(showMinimized())); connect(mainWindow->actionHideApplication, SIGNAL(triggered()), this, SLOT(showMinimized()));
@ -367,7 +368,7 @@ int UBApplication::exec(const QString& pFileToImport)
if (pFileToImport.length() > 0) if (pFileToImport.length() > 0)
UBApplication::applicationController->importFile(pFileToImport); UBApplication::applicationController->importFile(pFileToImport);
#if defined(Q_WS_MAC) #if defined(Q_OS_OSX)
static AEEventHandlerUPP ub_proc_ae_handlerUPP = AEEventHandlerUPP(ub_appleEventProcessor); static AEEventHandlerUPP ub_proc_ae_handlerUPP = AEEventHandlerUPP(ub_appleEventProcessor);
AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, ub_proc_ae_handlerUPP, SRefCon(UBApplication::applicationController), true); AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, ub_proc_ae_handlerUPP, SRefCon(UBApplication::applicationController), true);
#endif #endif
@ -389,7 +390,7 @@ void UBApplication::onScreenCountChanged(int newCount)
mainWindow->actionMultiScreen->setEnabled(displayManager.numScreens() > 1); mainWindow->actionMultiScreen->setEnabled(displayManager.numScreens() > 1);
} }
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
void UBApplication::showMinimized() void UBApplication::showMinimized()
{ {
mainWindow->hide(); mainWindow->hide();
@ -538,7 +539,7 @@ void UBApplication::decorateActionMenu(QAction* action)
menu->addSeparator(); menu->addSeparator();
#ifndef Q_WS_X11 // No Podcast on Linux yet #ifndef Q_OS_LINUX // No Podcast on Linux yet
menu->addAction(mainWindow->actionPodcast); menu->addAction(mainWindow->actionPodcast);
mainWindow->actionPodcast->setText(tr("Podcast")); mainWindow->actionPodcast->setText(tr("Podcast"));
#endif #endif
@ -589,7 +590,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
{ {
QFileOpenEvent *fileToOpenEvent = static_cast<QFileOpenEvent *>(event); QFileOpenEvent *fileToOpenEvent = static_cast<QFileOpenEvent *>(event);
#if defined(Q_WS_MACX) #if defined(Q_OS_OSX)
ProcessSerialNumber psn; ProcessSerialNumber psn;
GetCurrentProcess(&psn); GetCurrentProcess(&psn);
SetFrontProcess(&psn); SetFrontProcess(&psn);
@ -610,7 +611,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
boardController->controlView()->setMultiselection(false); boardController->controlView()->setMultiselection(false);
} }
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
if (bIsMinimized && event->type() == QEvent::ApplicationActivate){ if (bIsMinimized && event->type() == QEvent::ApplicationActivate){
if (mainWindow->isHidden()) mainWindow->show(); if (mainWindow->isHidden()) mainWindow->show();
bIsMinimized = false; bIsMinimized = false;
@ -650,39 +651,6 @@ void UBApplication::cleanup()
documentController = NULL; documentController = NULL;
} }
void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
bool enabled, const QString& text, QPalette::ColorRole textRole) const
{
if (text.isEmpty())
return;
QPen savedPen;
if (textRole != QPalette::NoRole)
{
savedPen = painter->pen();
painter->setPen(QPen(pal.brush(textRole), savedPen.widthF()));
}
if (!enabled)
{
QPen pen = painter->pen();
QColor half = pen.color();
half.setRed(half.red() / 2);
half.setGreen(half.green() / 2);
half.setBlue(half.blue() / 2);
painter->setPen(half);
painter->drawText(rect, alignment, text);
painter->setPen(pen);
}
painter->drawText(rect, alignment, text);
if (textRole != QPalette::NoRole)
painter->setPen(savedPen);
}
QString UBApplication::urlFromHtml(QString html) QString UBApplication::urlFromHtml(QString html)
{ {
QString _html; QString _html;

@ -29,6 +29,9 @@
#define UBAPPLICATION_H_ #define UBAPPLICATION_H_
#include <QtGui> #include <QtGui>
#include <QUndoStack>
#include <QToolBar>
#include <QMenu>
#include "qtsingleapplication.h" #include "qtsingleapplication.h"
@ -121,7 +124,7 @@ class UBApplication : public QtSingleApplication
private slots: private slots:
void closing(); void closing();
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
void showMinimized(); void showMinimized();
#endif #endif
void onScreenCountChanged(int newCount); void onScreenCountChanged(int newCount);
@ -134,7 +137,7 @@ class UBApplication : public QtSingleApplication
QString checkLanguageAvailabilityForSankore(QString& language); QString checkLanguageAvailabilityForSankore(QString& language);
protected: protected:
#if defined(Q_WS_MACX) && !defined(QT_MAC_USE_COCOA) #if defined(Q_OS_OSX) && !defined(QT_MAC_USE_COCOA)
bool macEventFilter(EventHandlerCallRef caller, EventRef event); bool macEventFilter(EventHandlerCallRef caller, EventRef event);
#endif #endif
@ -144,29 +147,4 @@ class UBApplication : public QtSingleApplication
}; };
class UBStyle : public QPlastiqueStyle
{
public:
UBStyle()
: QPlastiqueStyle()
{
// NOOP
}
virtual ~UBStyle()
{
// NOOP
}
/*
* redefined to be more cocoa like on texts
*/
virtual void drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
bool enabled, const QString& text, QPalette::ColorRole textRole) const;
};
#endif /* UBAPPLICATION_H_ */ #endif /* UBAPPLICATION_H_ */

@ -22,7 +22,9 @@
* along with OpenBoard. If not, see <http://www.gnu.org/licenses/>. * along with OpenBoard. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <QScriptValue>
#include <QScriptEngine>
#include <QUrl>
#include "UBApplicationController.h" #include "UBApplicationController.h"
@ -65,7 +67,7 @@
#include "ui_mainWindow.h" #include "ui_mainWindow.h"
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#endif #endif
@ -86,7 +88,6 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView,
, mAutomaticCheckForUpdates(false) , mAutomaticCheckForUpdates(false)
, mCheckingForUpdates(false) , mCheckingForUpdates(false)
, mIsShowingDesktop(false) , mIsShowingDesktop(false)
, mHttp(0)
{ {
mDisplayManager = new UBDisplayManager(this); mDisplayManager = new UBDisplayManager(this);
@ -121,7 +122,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView,
QTimer::singleShot (1000, this, SLOT (checkAtLaunch())); QTimer::singleShot (1000, this, SLOT (checkAtLaunch()));
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
mMainWindow->setStyleSheet("QToolButton { font-size: 11px}"); mMainWindow->setStyleSheet("QToolButton { font-size: 11px}");
#endif #endif
@ -137,7 +138,6 @@ UBApplicationController::~UBApplicationController()
delete mBlackScene; delete mBlackScene;
delete mMirror; delete mMirror;
if (mHttp) delete mHttp;
delete(mOpenSankoreImporter); delete(mOpenSankoreImporter);
mOpenSankoreImporter = NULL; mOpenSankoreImporter = NULL;
@ -478,45 +478,53 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
} }
void UBApplicationController::checkUpdate(QString urlString) void UBApplicationController::checkUpdate(QString urlString)
{ {
if(mHttp) //connect(networkAccessManager, &QNetworkAccessManager::finished,
mHttp->deleteLater(); // this, &UBApplicationController::updateRequestFinished);
QUrl url(urlString);
mHttp = new QHttp(url.host()); connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)),
connect(mHttp, SIGNAL(requestFinished(int,bool)), this, SLOT(updateRequestFinished(int,bool))); this, SLOT(updateRequestFinished(QNetworkReply*)));
connect(mHttp, SIGNAL(responseHeaderReceived(QHttpResponseHeader)), this, SLOT(updateHeaderReceived(QHttpResponseHeader)));
networkAccessManager->get(QNetworkRequest(QUrl(urlString)));
mHttp->get(url.path());
} }
void UBApplicationController::updateHeaderReceived(QHttpResponseHeader header)
void UBApplicationController::updateRequestFinished(QNetworkReply * reply)
{ {
if(header.statusCode() == 302 && header.hasKey("Location")){ if (reply->error()) {
mHttp->close(); qWarning() << "HTTP Error";
checkUpdate(header.value("Location")); return;
} }
// Check if we are being redirected. If so, call checkUpdate again
QVariant redirect_target = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
} if (!redirect_target.isNull()) {
// The returned URL might be relative. resolved() creates an absolute url from it
QUrl redirect_url(reply->url().resolved(redirect_target.toUrl()));
void UBApplicationController::updateRequestFinished(int id, bool error) checkUpdate(redirect_url.toString());
{ return;
if (error){ }
qWarning() << "http command id" << id << "return an error";
}
else{ // No error and no redirect => we read the whole response
QString responseString = QString(mHttp->readAll());
qDebug() << responseString;
if (!responseString.isEmpty() && responseString.contains("version") && responseString.contains("url")){
mHttp->close();
mHttp->deleteLater();
mHttp = 0;
downloadJsonFinished(responseString);
}
}
}
QString responseString = QString(reply->readAll());
qDebug() << responseString;
if (!responseString.isEmpty() &&
responseString.contains("version") &&
responseString.contains("url")) {
reply->close();
reply->deleteLater();
downloadJsonFinished(responseString);
}
}
void UBApplicationController::downloadJsonFinished(QString currentJson) void UBApplicationController::downloadJsonFinished(QString currentJson)

@ -29,8 +29,6 @@
#define UBAPPLICATIONCONTROLLER_H_ #define UBAPPLICATIONCONTROLLER_H_
#include <QtGui> #include <QtGui>
#include <QFtp>
#include <QHttpResponseHeader>
class UBBoardView; class UBBoardView;
@ -146,8 +144,7 @@ class UBApplicationController : public QObject
void checkAtLaunch(); void checkAtLaunch();
private slots: private slots:
void updateRequestFinished(int id, bool error); void updateRequestFinished(QNetworkReply * reply);
void updateHeaderReceived(QHttpResponseHeader header);
protected: protected:
@ -186,7 +183,6 @@ class UBApplicationController : public QObject
QNetworkAccessManager *networkAccessManager; QNetworkAccessManager *networkAccessManager;
void downloadJsonFinished(QString updateString); void downloadJsonFinished(QString updateString);
QHttp* mHttp;
}; };
#endif /* UBAPPLICATIONCONTROLLER_H_ */ #endif /* UBAPPLICATIONCONTROLLER_H_ */

@ -41,6 +41,8 @@
#include "core/memcheck.h" #include "core/memcheck.h"
#include "qdesktopwidget.h"
UBDisplayManager::UBDisplayManager(QObject *parent) UBDisplayManager::UBDisplayManager(QObject *parent)
: QObject(parent) : QObject(parent)
, mControlScreenIndex(-1) , mControlScreenIndex(-1)
@ -55,8 +57,8 @@ UBDisplayManager::UBDisplayManager(QObject *parent)
initScreenIndexes(); initScreenIndexes();
connect(mDesktop, SIGNAL(resized(int)), this, SLOT(adjustScreens(int))); connect(mDesktop, &QDesktopWidget::resized, this, &UBDisplayManager::adjustScreens);
connect(mDesktop, SIGNAL(workAreaResized(int)), this, SLOT(adjustScreens(int))); connect(mDesktop, &QDesktopWidget::workAreaResized, this, &UBDisplayManager::adjustScreens);
} }

@ -32,6 +32,7 @@
class UBBlackoutWidget; class UBBlackoutWidget;
class UBBoardView; class UBBoardView;
class QDesktopWidget;
class UBDisplayManager : public QObject class UBDisplayManager : public QObject
{ {

@ -168,7 +168,7 @@ UBDocumentProxy* UBDocumentManager::importFile(const QFile& pFile, const QString
foreach(UBGraphicsItem* page, pages) foreach(UBGraphicsItem* page, pages)
{ {
UBApplication::showMessage(tr("Inserting page %1 of %2").arg(++nPage).arg(pages.size()), true); UBApplication::showMessage(tr("Inserting page %1 of %2").arg(++nPage).arg(pages.size()), true);
#ifdef Q_WS_MACX #ifdef Q_OS_OSX
//Workaround for issue 912 //Workaround for issue 912
QApplication::processEvents(); QApplication::processEvents();
#endif #endif

@ -77,7 +77,7 @@ void UBAsyncLocalFileDownloader::run()
if (mDesc.originalSrcUrl.isEmpty()) if (mDesc.originalSrcUrl.isEmpty())
mDesc.originalSrcUrl = mDesc.srcUrl; mDesc.originalSrcUrl = mDesc.srcUrl;
QString uuid = QUuid::createUuid(); QString uuid = QUuid::createUuid().toString();
UBPersistenceManager::persistenceManager()->addFileToDocument(UBApplication::boardController->selectedDocument(), UBPersistenceManager::persistenceManager()->addFileToDocument(UBApplication::boardController->selectedDocument(),
mDesc.srcUrl, mDesc.srcUrl,
destDirectory, destDirectory,
@ -399,8 +399,7 @@ void UBDownloadManager::startFileDownload(sDownloadFileDesc desc)
connect(http, SIGNAL(downloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onDownloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool))); connect(http, SIGNAL(downloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onDownloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)));
//the desc.srcUrl is encoded. So we have to decode it before. //the desc.srcUrl is encoded. So we have to decode it before.
QUrl url; QUrl url = QUrl::fromEncoded(desc.srcUrl.toUtf8());
url.setEncodedUrl(desc.srcUrl.toUtf8());
// We send here the request and store its reply in order to be able to cancel it if needed // We send here the request and store its reply in order to be able to cancel it if needed
mDownloads[desc.id] = dynamic_cast<QObject *>(http->get(url, desc.pos, desc.size, desc.isBackground)); mDownloads[desc.id] = dynamic_cast<QObject *>(http->get(url, desc.pos, desc.size, desc.isBackground));
} }

@ -50,9 +50,9 @@ UBOpenSankoreImporter::UBOpenSankoreImporter(QWidget* mainWidget, QObject *paren
void UBOpenSankoreImporter::onProceedClicked() void UBOpenSankoreImporter::onProceedClicked()
{ {
QProcess newProcess; QProcess newProcess;
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
newProcess.startDetached(qApp->applicationDirPath()+"/Importer/OpenBoardImporter"); newProcess.startDetached(qApp->applicationDirPath()+"/Importer/OpenBoardImporter");
#elif defined Q_WS_MACX #elif defined Q_OS_OSX
newProcess.startDetached(qApp->applicationDirPath()+"/../Resources/OpenBoardImporter.app/Contents/MacOS/OpenBoardImporter"); newProcess.startDetached(qApp->applicationDirPath()+"/../Resources/OpenBoardImporter.app/Contents/MacOS/OpenBoardImporter");
#else #else
// Windows does not allows to run easily an exe located in a subdirectory when the main // Windows does not allows to run easily an exe located in a subdirectory when the main

@ -596,7 +596,7 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in
UBGraphicsPixmapItem* pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*>(item); UBGraphicsPixmapItem* pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*>(item);
if(pixmapItem){ if(pixmapItem){
QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid() + ".png"; QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid().toString() + ".png";
QString destination = source; QString destination = source;
QUuid newUuid = QUuid::createUuid(); QUuid newUuid = QUuid::createUuid();
QString fileName = QFileInfo(source).completeBaseName(); QString fileName = QFileInfo(source).completeBaseName();
@ -608,7 +608,7 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in
UBGraphicsSvgItem* svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*>(item); UBGraphicsSvgItem* svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*>(item);
if(svgItem){ if(svgItem){
QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + svgItem->uuid() + ".svg"; QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + svgItem->uuid().toString() + ".svg";
QString destination = source; QString destination = source;
QUuid newUuid = QUuid::createUuid(); QUuid newUuid = QUuid::createUuid();
QString fileName = QFileInfo(source).completeBaseName(); QString fileName = QFileInfo(source).completeBaseName();

@ -44,6 +44,8 @@
#include "core/memcheck.h" #include "core/memcheck.h"
#include "qdesktopwidget.h"
qreal UBPreferencesController::sSliderRatio = 10.0; qreal UBPreferencesController::sSliderRatio = 10.0;
qreal UBPreferencesController::sMinPenWidth = 0.5; qreal UBPreferencesController::sMinPenWidth = 0.5;
qreal UBPreferencesController::sMaxPenWidth = 50.0; qreal UBPreferencesController::sMaxPenWidth = 50.0;
@ -78,7 +80,7 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
mPreferencesUI = new Ui::preferencesDialog(); // deleted in mPreferencesUI = new Ui::preferencesDialog(); // deleted in
mPreferencesUI->setupUi(mPreferencesWindow); mPreferencesUI->setupUi(mPreferencesWindow);
adjustScreens(1); adjustScreens(1);
connect(mDesktop, SIGNAL(screenCountChanged(int)), this, SLOT(adjustScreens(int))); connect(mDesktop, &QDesktopWidget::screenCountChanged, this, &UBPreferencesController::adjustScreens);
wire(); wire();
} }

@ -29,6 +29,7 @@
#define UBPREFERENCESCONTROLLER_H_ #define UBPREFERENCESCONTROLLER_H_
#include <QtGui> #include <QtGui>
#include <QDialog>
class UBColorPicker; class UBColorPicker;
class UBApplication; class UBApplication;

@ -306,7 +306,7 @@ void UBSettings::init()
bool defaultShowPageImmediatelyOnMirroredScreen = true; bool defaultShowPageImmediatelyOnMirroredScreen = true;
#if defined(Q_WS_X11) #if defined(Q_OS_LINUX)
// screen duplication is very slow on X11 // screen duplication is very slow on X11
defaultShowPageImmediatelyOnMirroredScreen = false; defaultShowPageImmediatelyOnMirroredScreen = false;
#endif #endif
@ -334,22 +334,22 @@ void UBSettings::init()
int defaultRefreshRateInFramePerSecond = 8; int defaultRefreshRateInFramePerSecond = 8;
#if defined(Q_WS_X11) #if defined(Q_OS_LINUX)
// screen duplication is very slow on X11 // screen duplication is very slow on X11
defaultRefreshRateInFramePerSecond = 2; defaultRefreshRateInFramePerSecond = 2;
#endif #endif
mirroringRefreshRateInFps = new UBSetting(this, "Mirroring", "RefreshRateInFramePerSecond", QVariant(defaultRefreshRateInFramePerSecond)); mirroringRefreshRateInFps = new UBSetting(this, "Mirroring", "RefreshRateInFramePerSecond", QVariant(defaultRefreshRateInFramePerSecond));
lastImportFilePath = new UBSetting(this, "Import", "LastImportFilePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); lastImportFilePath = new UBSetting(this, "Import", "LastImportFilePath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
lastImportFolderPath = new UBSetting(this, "Import", "LastImportFolderPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); lastImportFolderPath = new UBSetting(this, "Import", "LastImportFolderPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
lastExportFilePath = new UBSetting(this, "Export", "LastExportFilePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); lastExportFilePath = new UBSetting(this, "Export", "LastExportFilePath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
lastExportDirPath = new UBSetting(this, "Export", "LastExportDirPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); lastExportDirPath = new UBSetting(this, "Export", "LastExportDirPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
lastImportToLibraryPath = new UBSetting(this, "Library", "LastImportToLibraryPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); lastImportToLibraryPath = new UBSetting(this, "Library", "LastImportToLibraryPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
lastPicturePath = new UBSetting(this, "Library", "LastPicturePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation))); lastPicturePath = new UBSetting(this, "Library", "LastPicturePath", QVariant(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)));
lastWidgetPath = new UBSetting(this, "Library", "LastWidgetPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); lastWidgetPath = new UBSetting(this, "Library", "LastWidgetPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
lastVideoPath = new UBSetting(this, "Library", "LastVideoPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation))); lastVideoPath = new UBSetting(this, "Library", "LastVideoPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)));
appOnlineUserName = new UBSetting(this, "App", "OnlineUserName", ""); appOnlineUserName = new UBSetting(this, "App", "OnlineUserName", "");
@ -790,7 +790,7 @@ QString UBSettings::userDataDirectory()
qCritical() << "Impossible to create datadirpath " << dataDirPath; qCritical() << "Impossible to create datadirpath " << dataDirPath;
} }
dataDirPath = UBFileSystemUtils::normalizeFilePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); dataDirPath = UBFileSystemUtils::normalizeFilePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
dataDirPath.replace(qApp->organizationName() + "/", ""); dataDirPath.replace(qApp->organizationName() + "/", "");
} }
return dataDirPath; return dataDirPath;
@ -811,7 +811,7 @@ QString UBSettings::userImageDirectory()
qCritical() << "failed to create image directory " << imageDirectory; qCritical() << "failed to create image directory " << imageDirectory;
} }
imageDirectory = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation) + "/" + qApp->applicationName(); imageDirectory = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/" + qApp->applicationName();
checkDirectory(imageDirectory); checkDirectory(imageDirectory);
} }
return imageDirectory; return imageDirectory;
@ -832,10 +832,10 @@ QString UBSettings::userVideoDirectory()
} }
videoDirectory = QDesktopServices::storageLocation(QDesktopServices::MoviesLocation); videoDirectory = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
if(videoDirectory.isEmpty()) if(videoDirectory.isEmpty())
videoDirectory = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation) + "/" + tr("My Movies"); videoDirectory = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/" + tr("My Movies");
else else
videoDirectory = videoDirectory + "/" + qApp->applicationName(); videoDirectory = videoDirectory + "/" + qApp->applicationName();
@ -858,7 +858,7 @@ QString UBSettings::userAudioDirectory()
qCritical() << "failed to create image directory " << audioDirectory; qCritical() << "failed to create image directory " << audioDirectory;
} }
audioDirectory = QDesktopServices::storageLocation(QDesktopServices::MusicLocation) + "/" + qApp->applicationName(); audioDirectory = QStandardPaths::writableLocation(QStandardPaths::MusicLocation) + "/" + qApp->applicationName();
checkDirectory(audioDirectory); checkDirectory(audioDirectory);
} }
return audioDirectory; return audioDirectory;
@ -879,7 +879,7 @@ QString UBSettings::userPodcastRecordingDirectory()
qCritical() << "failed to create dir " << dirPath; qCritical() << "failed to create dir " << dirPath;
} }
dirPath = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); dirPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
checkDirectory(dirPath); checkDirectory(dirPath);
} }
return dirPath; return dirPath;
@ -1246,13 +1246,13 @@ QString UBSettings::replaceWildcard(QString& path)
QString result(path); QString result(path);
if (result.startsWith("{Documents}")) { if (result.startsWith("{Documents}")) {
result = result.replace("{Documents}", QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)); result = result.replace("{Documents}", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
} }
else if(result.startsWith("{Home}")) { else if(result.startsWith("{Home}")) {
result = result.replace("{Home}", QDesktopServices::storageLocation(QDesktopServices::HomeLocation)); result = result.replace("{Home}", QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
} }
else if(result.startsWith("{Desktop}")) { else if(result.startsWith("{Desktop}")) {
result = result.replace("{Desktop}", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); result = result.replace("{Desktop}", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
} }
if(result.contains("{UserLoginName}") && UBPlatformUtils::osUserLoginName().length() > 0) { if(result.contains("{UserLoginName}") && UBPlatformUtils::osUserLoginName().length() > 0) {

@ -45,21 +45,21 @@
#endif #endif
*/ */
void ub_message_output(QtMsgType type, const char *msg) { void ub_message_output(QtMsgType type, const QMessageLogContext& context, const QString& msg) {
// We must temporarily remove the handler to avoid the infinite recursion of // We must temporarily remove the handler to avoid the infinite recursion of
// ub_message_output -> qt_message_output -> ub_message_output -> qt_message_output ... // ub_message_output -> qt_message_output -> ub_message_output -> qt_message_output ...
QtMsgHandler previousHandler = qInstallMsgHandler(0); QtMessageHandler previousHandler = qInstallMessageHandler(0);
#if defined(QT_NO_DEBUG) #if defined(QT_NO_DEBUG)
// Suppress qDebug output in release builds // Suppress qDebug output in release builds
if (type != QtDebugMsg) if (type != QtDebugMsg)
{ {
qt_message_output(type, msg); qt_message_output(type, context, msg);
} }
#else #else
// Default output in debug builds // Default output in debug builds
qt_message_output(type, msg); qt_message_output(type, context, msg);
#endif #endif
if (UBApplication::app() && UBApplication::app()->isVerbose()) { if (UBApplication::app() && UBApplication::app()->isVerbose()) {
@ -77,7 +77,7 @@ void ub_message_output(QtMsgType type, const char *msg) {
} }
} }
qInstallMsgHandler(previousHandler); qInstallMessageHandler(previousHandler);
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -93,25 +93,19 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(OpenBoard); Q_INIT_RESOURCE(OpenBoard);
qInstallMsgHandler(ub_message_output); qInstallMessageHandler(ub_message_output);
#if defined(Q_WS_X11)
/*
* setGraphicsSystem is obsolete in Qt5, made redundant by the QPA framework.
* TODO: check if this works ok, if not, explore how to use QPA framework
#if defined(Q_OS_LINUX)
qDebug() << "Setting GraphicsSystem to raster"; qDebug() << "Setting GraphicsSystem to raster";
QApplication::setGraphicsSystem("raster"); QApplication::setGraphicsSystem("raster");
#endif #endif
*/
UBApplication app("OpenBoard", argc, argv); UBApplication app("OpenBoard", argc, argv);
//BUGFIX:
//when importing a OpenBoard file that contains a non standard character
//the codecForLocale or the codecForCString is used to convert the file path
//into a const char*. This is why in french windows setup the codec name shouldn't be
//set to UTF-8. For example, setting UTF-8, will convert "Haïti" into "HaÂ-ti.
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
//QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QStringList args = app.arguments(); QStringList args = app.arguments();
QString dumpPath = UBSettings::userDataDirectory() + "/log"; QString dumpPath = UBSettings::userDataDirectory() + "/log";
@ -138,7 +132,7 @@ int main(int argc, char *argv[])
} }
} }
app.initialize(false); //app.initialize(false); // should not be needed anymore
QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&))); QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&)));

@ -24,6 +24,9 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QStyle>
#include "UBCustomCaptureWindow.h" #include "UBCustomCaptureWindow.h"

@ -29,6 +29,9 @@
#define UBCUSTOMCAPTUREWINDOW_H_ #define UBCUSTOMCAPTUREWINDOW_H_
#include <QtGui> #include <QtGui>
#include <QDialog>
#include <QRubberBand>
/** /**
* This class is used to do the custom capture of Uninotes * This class is used to do the custom capture of Uninotes
**/ **/

@ -80,7 +80,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast<QWidget*>(0), false, true); // deleted in UBDesktopAnnotationController::destructor mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast<QWidget*>(0), false, true); // deleted in UBDesktopAnnotationController::destructor
mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true);
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true);
#endif #endif
mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Window); mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Window);
@ -109,7 +109,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
connect( UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(keyboardActivated(bool)), connect( UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(keyboardActivated(bool)),
mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
connect(UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask())); connect(UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask()));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(refreshMask())); connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(refreshMask()));
connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask())); connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask()));
@ -162,7 +162,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
connect(&mHoldTimerMarker, SIGNAL(timeout()), this, SLOT(markerActionReleased())); connect(&mHoldTimerMarker, SIGNAL(timeout()), this, SLOT(markerActionReleased()));
connect(&mHoldTimerEraser, SIGNAL(timeout()), this, SLOT(eraserActionReleased())); connect(&mHoldTimerEraser, SIGNAL(timeout()), this, SLOT(eraserActionReleased()));
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
connect(mDesktopPalette, SIGNAL(moving()), this, SLOT(refreshMask())); connect(mDesktopPalette, SIGNAL(moving()), this, SLOT(refreshMask()));
connect(UBApplication::boardController->paletteManager()->rightPalette(), SIGNAL(resized()), this, SLOT(refreshMask())); connect(UBApplication::boardController->paletteManager()->rightPalette(), SIGNAL(resized()), this, SLOT(refreshMask()));
connect(UBApplication::boardController->paletteManager()->addItemPalette(), SIGNAL(closed()), this, SLOT(refreshMask())); connect(UBApplication::boardController->paletteManager()->addItemPalette(), SIGNAL(closed()), this, SLOT(refreshMask()));
@ -331,7 +331,7 @@ void UBDesktopAnnotationController::showWindow()
UBDrawingController::drawingController()->setStylusTool(mDesktopStylusTool); UBDrawingController::drawingController()->setStylusTool(mDesktopStylusTool);
#ifndef Q_WS_X11 #ifndef Q_OS_LINUX
mTransparentDrawingView->showFullScreen(); mTransparentDrawingView->showFullScreen();
#else #else
// this is necessary to avoid unity to hide the panels // this is necessary to avoid unity to hide the panels
@ -341,7 +341,7 @@ void UBDesktopAnnotationController::showWindow()
mDesktopPalette->appear(); mDesktopPalette->appear();
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
updateMask(true); updateMask(true);
#endif #endif
} }
@ -375,18 +375,18 @@ void UBDesktopAnnotationController::updateBackground()
|| UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Selector) || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Selector)
{ {
newBrush = QBrush(Qt::transparent); newBrush = QBrush(Qt::transparent);
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
updateMask(true); updateMask(true);
#endif #endif
} }
else else
{ {
#if defined(Q_WS_MAC) #if defined(Q_OS_OSX)
newBrush = QBrush(QColor(127, 127, 127, 15)); newBrush = QBrush(QColor(127, 127, 127, 15));
#else #else
newBrush = QBrush(QColor(127, 127, 127, 1)); newBrush = QBrush(QColor(127, 127, 127, 1));
#endif #endif
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
updateMask(false); updateMask(false);
#endif #endif
} }
@ -430,7 +430,7 @@ void UBDesktopAnnotationController::customCapture()
UBCustomCaptureWindow customCaptureWindow(mDesktopPalette); UBCustomCaptureWindow customCaptureWindow(mDesktopPalette);
// need to show the window before execute it to avoid some glitch on windows. // need to show the window before execute it to avoid some glitch on windows.
#ifndef Q_WS_WIN // Working only without this call on win32 desktop mode #ifndef Q_OS_WIN // Working only without this call on win32 desktop mode
customCaptureWindow.show(); customCaptureWindow.show();
#endif #endif
@ -901,7 +901,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
p.drawRect(tabsPalette); p.drawRect(tabsPalette);
} }
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
//Rquiered only for compiz wm //Rquiered only for compiz wm
//TODO. Window manager detection screen //TODO. Window manager detection screen

@ -171,7 +171,7 @@ void UBDesktopPalette::minimizeMe(eMinimizedLocation location)
adjustSizeAndPosition(); adjustSizeAndPosition();
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
emit refreshMask(); emit refreshMask();
#endif #endif
} }
@ -201,7 +201,7 @@ void UBDesktopPalette::maximizeMe()
// Notify that the maximization has been done // Notify that the maximization has been done
emit maximized(); emit maximized();
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
emit refreshMask(); emit refreshMask();
#endif #endif
} }

@ -55,9 +55,9 @@ class UBDesktopPalette : public UBActionPalette
void windowClick(); void windowClick();
void screenClick(); void screenClick();
#ifdef Q_WS_X11 //#ifdef Q_OS_LINUX //TODO: check why this produces an error on linux if uncommented
void refreshMask(); void refreshMask();
#endif //#endif
public slots: public slots:

@ -24,6 +24,7 @@
#include <QDialog>
#include "UBWindowCapture.h" #include "UBWindowCapture.h"
#include "UBDesktopAnnotationController.h" #include "UBDesktopAnnotationController.h"

@ -355,7 +355,7 @@ void UBDocumentController::setupViews()
} }
} }
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
mMainWindow->actionDelete->setShortcut(QKeySequence(Qt::Key_Backspace)); mMainWindow->actionDelete->setShortcut(QKeySequence(Qt::Key_Backspace));
#endif #endif
@ -394,7 +394,7 @@ void UBDocumentController::setupViews()
mDocumentUI->thumbnailWidget->setBackgroundBrush(UBSettings::documentViewLightColor); mDocumentUI->thumbnailWidget->setBackgroundBrush(UBSettings::documentViewLightColor);
#ifdef Q_WS_MACX #ifdef Q_OS_OSX
mMessageWindow = new UBMessageWindow(NULL); mMessageWindow = new UBMessageWindow(NULL);
#else #else
mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget); mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget);
@ -1452,7 +1452,7 @@ void UBDocumentController::showMessage(const QString& message, bool showSpinning
QRect newSize = mDocumentUI->thumbnailWidget->geometry(); QRect newSize = mDocumentUI->thumbnailWidget->geometry();
#ifdef Q_WS_MACX #ifdef Q_OS_OSX
QPoint point(newSize.left() + margin, newSize.bottom() - mMessageWindow->height() - margin); QPoint point(newSize.left() + margin, newSize.bottom() - mMessageWindow->height() - margin);
mMessageWindow->move(mDocumentUI->thumbnailWidget->mapToGlobal(point)); mMessageWindow->move(mDocumentUI->thumbnailWidget->mapToGlobal(point));
#else #else

@ -29,6 +29,7 @@
#define UBDOCUMENTCONTROLLER_H_ #define UBDOCUMENTCONTROLLER_H_
#include <QtGui> #include <QtGui>
#include <QTreeWidgetItem>
#include "document/UBDocumentContainer.h" #include "document/UBDocumentContainer.h"
namespace Ui namespace Ui

@ -832,9 +832,10 @@ void UBGraphicsDelegateFrame::positionHandles()
} }
resetTransform(); resetTransform();
translate(center.x(), center.y()); setTransform(QTransform::fromTranslate(center.x(), center.y()), true);
rotate(-angle); setTransform(QTransform().rotate(-angle), true);
translate(-center.x(), -center.y()); setTransform(QTransform::fromTranslate(-center.x(), -center.y()), true);
//TODO: combine these transforms into one
mBottomRightResizeGripSvgItem->setParentItem(this); mBottomRightResizeGripSvgItem->setParentItem(this);
mBottomResizeGripSvgItem->setParentItem(this); mBottomResizeGripSvgItem->setParentItem(this);

@ -297,7 +297,7 @@ QVariant UBGraphicsGroupContainerItem::itemChange(GraphicsItemChange change, con
{ {
QVariant newValue = Delegate()->itemChange(change, value); QVariant newValue = Delegate()->itemChange(change, value);
foreach(QGraphicsItem *child, children()) foreach(QGraphicsItem *child, childItems())
{ {
UBGraphicsItem *item = dynamic_cast<UBGraphicsItem*>(child); UBGraphicsItem *item = dynamic_cast<UBGraphicsItem*>(child);
if (item) if (item)

@ -771,7 +771,7 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated)
qreal topXTitleBar = topX + (1.6 * mFrameWidth * mAntiScaleRatio); qreal topXTitleBar = topX + (1.6 * mFrameWidth * mAntiScaleRatio);
qreal topYTitleBar = topY + frameButtonHeight *mAntiScaleRatio; qreal topYTitleBar = topY + frameButtonHeight *mAntiScaleRatio;
#ifndef Q_WS_X11 #ifndef Q_OS_LINUX
topYTitleBar += 5; topYTitleBar += 5;
#endif #endif
@ -792,7 +792,7 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated)
button->setParentItem(mFrame); button->setParentItem(mFrame);
button->setPos(topXTitleBar + (k++ * (frameButtonHeight + 5)), topYTitleBar); button->setPos(topXTitleBar + (k++ * (frameButtonHeight + 5)), topYTitleBar);
button->setTransform(tr); button->setTransform(tr);
button->scale(0.8,0.8); button->setTransform(QTransform::fromScale(0.8, 0.8), true);
} }
else if(button->getSection() == Qt::NoSection){ else if(button->getSection() == Qt::NoSection){
++l; ++l;
@ -1442,7 +1442,7 @@ void DelegateMediaControl::seekToMousePos(QPointF mousePos)
&& mDelegate->mediaObject() && mDelegate->mediaObject()->isSeekable()) && mDelegate->mediaObject() && mDelegate->mediaObject()->isSeekable())
{ {
qint64 tickPos = (mTotalTimeInMs/length)* (mouseX - minX); qint64 tickPos = (mTotalTimeInMs/length)* (mouseX - minX);
mDelegate->mediaObject()->seek(tickPos); mDelegate->mediaObject()->setPosition(tickPos);
//OSX is a bit lazy //OSX is a bit lazy
updateTicker(tickPos); updateTicker(tickPos);

@ -49,7 +49,13 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
{ {
update(); update();
mMediaObject = new Phonon::MediaObject(this);
//mMediaObject = new Phonon::MediaObject(this);
mMediaObject = new QMediaPlayer(this);
//playlist = new QMediaPlaylist;
//mMediaObject->setPlaylist(playlist);
QString mediaPath = pMediaFileUrl.toString(); QString mediaPath = pMediaFileUrl.toString();
if ("" == mediaPath) if ("" == mediaPath)
@ -59,10 +65,23 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
{ {
mMediaType = mediaType_Video; mMediaType = mediaType_Video;
mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this); //mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
mMediaObject->setTickInterval(50); QAudioFormat format; // to define
mVideoWidget = new Phonon::VideoWidget(); // owned and destructed by the scene ... format.setByteOrder(QAudioFormat::LittleEndian);
Phonon::createPath(mMediaObject, mVideoWidget); format.setSampleType(QAudioFormat::UnSignedInt);
//mAudioOutput = new QAudioOutput(format, this);
mAudioOutput = new QMediaPlayer;
//mMediaObject->setTickInterval(50);
mMediaObject->setPosition(50);
//mVideoWidget = new Phonon::VideoWidget(); // owned and destructed by the scene ...
mVideoWidget = new QVideoWidget(); // owned and destructed by the scene ...
//Phonon::createPath(mMediaObject, mVideoWidget);
mMediaObject->setVideoOutput(mVideoWidget);
if(mVideoWidget->sizeHint() == QSize(1,1)){ if(mVideoWidget->sizeHint() == QSize(1,1)){
mVideoWidget->resize(320,240); mVideoWidget->resize(320,240);
@ -72,11 +91,19 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
haveLinkedImage = true; haveLinkedImage = true;
} }
else if (mediaPath.toLower().contains("audios")){ else if (mediaPath.toLower().contains("audios"))
{
mMediaType = mediaType_Audio; mMediaType = mediaType_Audio;
mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
mMediaObject->setTickInterval(1000); QAudioFormat format;
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::UnSignedInt);
// mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
//mAudioOutput = new QMediaPlayer(format, this);
mAudioOutput = new QMediaPlayer;
//mMediaObject->setTickInterval(1000);
mAudioWidget = new QWidget(); mAudioWidget = new QWidget();
mAudioWidget->resize(320,26); mAudioWidget->resize(320,26);
mAudioWidget->setMinimumSize(150,26); mAudioWidget->setMinimumSize(150,26);
@ -84,16 +111,17 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
haveLinkedImage = false; haveLinkedImage = false;
} }
Phonon::createPath(mMediaObject, mAudioOutput); //Phonon::createPath(mMediaObject, mAudioOutput);
//mSource = Phonon::MediaSource(pMediaFileUrl);
//mMediaObject->setCurrentSource(mSource);
mMediaObject->setMedia(pMediaFileUrl);
mSource = Phonon::MediaSource(pMediaFileUrl);
mMediaObject->setCurrentSource(mSource);
// we should create delegate after media objects because delegate uses his properties at creation. // we should create delegate after media objects because delegate uses his properties at creation.
setDelegate(new UBGraphicsMediaItemDelegate(this, mMediaObject)); setDelegate(new UBGraphicsMediaItemDelegate(this, mMediaObject));
// delegate should be created earler because we setWidget calls resize event for graphics proxy widgt. // delegate should be created earler because we setWidget calls resize event for graphics proxy widgt.
// resize uses delegate. // resize uses delegate.
if (mediaType_Video == mMediaType) if (mediaType_Video == mMediaType)
@ -159,7 +187,11 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria
absoluteMediaFilename = mMediaFileUrl.toLocalFile(); absoluteMediaFilename = mMediaFileUrl.toLocalFile();
if (absoluteMediaFilename.length() > 0) if (absoluteMediaFilename.length() > 0)
mMediaObject->setCurrentSource(Phonon::MediaSource(absoluteMediaFilename)); //mMediaObject->setCurrentSource(QMediaSource(absoluteMediaFilename));
mMediaObject->setMedia(QUrl::fromLocalFile(absoluteMediaFilename));
} }
} }
@ -203,7 +235,9 @@ void UBGraphicsMediaItem::hasMediaChanged(bool hasMedia)
{ {
if(hasMedia && mMediaObject->isSeekable()) if(hasMedia && mMediaObject->isSeekable())
{ {
mMediaObject->seek(mInitialPos); //mMediaObject->seek(mInitialPos);
mMediaObject->setPosition(mInitialPos);
UBGraphicsMediaItemDelegate *med = dynamic_cast<UBGraphicsMediaItemDelegate *>(Delegate()); UBGraphicsMediaItemDelegate *med = dynamic_cast<UBGraphicsMediaItemDelegate *>(Delegate());
if (med) if (med)
med->updateTicker(initialPos()); med->updateTicker(initialPos());
@ -318,7 +352,8 @@ void UBGraphicsMediaItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QPointF eventPos = mapFromScene( event->scenePos()); QPointF eventPos = mapFromScene( event->scenePos());
QPointF translation = eventPos - mouseMovePos; QPointF translation = eventPos - mouseMovePos;
translate(translation.x(), translation.y()); //translate(translation.x(), translation.y());
setPos(translation.x(), translation.y());
} }
mMouseMovePos = event->scenePos(); mMouseMovePos = event->scenePos();

@ -28,10 +28,20 @@
#ifndef UBGRAPHICSMEDIAITEM_H #ifndef UBGRAPHICSMEDIAITEM_H
#define UBGRAPHICSMEDIAITEM_H #define UBGRAPHICSMEDIAITEM_H
#include <QtWidgets/QGraphicsView>
#include "UBGraphicsProxyWidget.h" #include "UBGraphicsProxyWidget.h"
#include <phonon/AudioOutput> //#include <phonon/AudioOutput>
#include <phonon/MediaObject> //#include <phonon/MediaObject>
#include <phonon/VideoWidget> //#include <phonon/VideoWidget>
#include <QAudioOutput>
#include <QMediaObject>
#include <QMediaPlayer>
#include <QMediaService>
#include <QtMultimediaWidgets/QVideoWidget>
#include <QtMultimedia/QVideoFrame>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
@ -63,7 +73,9 @@ public:
virtual void mediaFileUrl(QUrl url){mMediaFileUrl=url;} virtual void mediaFileUrl(QUrl url){mMediaFileUrl=url;}
Phonon::MediaObject* mediaObject() const //Phonon::MediaObject* mediaObject() const
QMediaPlayer* mediaObject() const
{ {
return mMediaObject; return mMediaObject;
} }
@ -80,7 +92,9 @@ public:
return mMuted; return mMuted;
} }
Phonon::VideoWidget* videoWidget() const // Phonon::VideoWidget* videoWidget() const
QVideoWidget* videoWidget() const
{ {
return mVideoWidget; return mVideoWidget;
} }
@ -115,10 +129,18 @@ protected:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void clearSource(); virtual void clearSource();
Phonon::MediaObject *mMediaObject; //Phonon::MediaObject *mMediaObject;
Phonon::VideoWidget *mVideoWidget; //Phonon::VideoWidget *mVideoWidget;
Phonon::AudioOutput *mAudioOutput; //Phonon::AudioOutput *mAudioOutput;
Phonon::MediaSource mSource; //Phonon::MediaSource mSource;
QMediaPlayer *mMediaObject;
QMediaPlaylist *playlist;
QVideoWidget *mVideoWidget;
// QAudioOutput *mAudioOutput;
QMediaPlayer *mAudioOutput;
QMediaService *mSource;
QWidget *mAudioWidget; QWidget *mAudioWidget;
private: private:

@ -43,7 +43,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent) UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaPlayer* pMedia, QObject * parent)
: UBGraphicsItemDelegate(pDelegated, parent, GF_COMMON : UBGraphicsItemDelegate(pDelegated, parent, GF_COMMON
| GF_RESPECT_RATIO | GF_RESPECT_RATIO
| GF_TOOLBAR_USED | GF_TOOLBAR_USED
@ -56,11 +56,22 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
QPalette palette; QPalette palette;
palette.setBrush ( QPalette::Light, Qt::darkGray ); palette.setBrush ( QPalette::Light, Qt::darkGray );
mMedia->setTickInterval(50); mMedia->setNotifyInterval(50);
connect(mMedia, SIGNAL(stateChanged (Phonon::State, Phonon::State)), this, SLOT(mediaStateChanged (Phonon::State, Phonon::State)));
connect(mMedia, SIGNAL(finished()), this, SLOT(updatePlayPauseState())); connect(mMedia, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
connect(mMedia, SIGNAL(tick(qint64)), this, SLOT(updateTicker(qint64))); this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
connect(mMedia, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64)));
connect(mMedia, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SLOT(mediaStateChanged(QMediaPlayer::State)));
connect(mMedia, static_cast<void(QMediaPlayer::*)(QMediaPlayer::Error)>(&QMediaPlayer::error),
this, &UBGraphicsMediaItemDelegate::mediaError);
connect(mMedia, SIGNAL(positionChanged(qint64)),
this, SLOT(updateTicker(qint64)));
connect(mMedia, SIGNAL(durationChanged(qint64)),
this, SLOT(totalTimeChanged(qint64)));
if (delegated()->hasLinkedImage()) if (delegated()->hasLinkedImage())
{ {
@ -95,10 +106,12 @@ void UBGraphicsMediaItemDelegate::buildButtons()
{ {
if(!mPlayPauseButton){ if(!mPlayPauseButton){
mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); connect(mPlayPauseButton, SIGNAL(clicked(bool)),
this, SLOT(togglePlayPause()));
mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop())); connect(mStopButton, SIGNAL(clicked(bool)),
mMedia, SLOT(stop()));
mMediaControl = new DelegateMediaControl(delegated(), mToolBarItem); mMediaControl = new DelegateMediaControl(delegated(), mToolBarItem);
mMediaControl->setFlag(QGraphicsItem::ItemIsSelectable, true); mMediaControl->setFlag(QGraphicsItem::ItemIsSelectable, true);
@ -109,8 +122,10 @@ void UBGraphicsMediaItemDelegate::buildButtons()
else else
mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); connect(mMuteButton, SIGNAL(clicked(bool)),
connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); // for changing button image delegated(), SLOT(toggleMute()));
connect(mMuteButton, SIGNAL(clicked(bool)),
this, SLOT(toggleMute())); // for changing button image
mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton; mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton;
@ -120,10 +135,17 @@ void UBGraphicsMediaItemDelegate::buildButtons()
if (mToolBarShowTimer) if (mToolBarShowTimer)
{ {
connect(mPlayPauseButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); connect(mPlayPauseButton, SIGNAL(clicked(bool)),
connect(mStopButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); mToolBarShowTimer, SLOT(start()));
connect(mMediaControl, SIGNAL(used()), mToolBarShowTimer, SLOT(start()));
connect(mMuteButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); connect(mStopButton, SIGNAL(clicked(bool)),
mToolBarShowTimer, SLOT(start()));
connect(mMediaControl, SIGNAL(used()),
mToolBarShowTimer, SLOT(start()));
connect(mMuteButton, SIGNAL(clicked(bool)),
mToolBarShowTimer, SLOT(start()));
} }
@ -195,55 +217,82 @@ UBGraphicsMediaItem* UBGraphicsMediaItemDelegate::delegated()
return dynamic_cast<UBGraphicsMediaItem*>(mDelegated); return dynamic_cast<UBGraphicsMediaItem*>(mDelegated);
} }
void UBGraphicsMediaItemDelegate::togglePlayPause() void UBGraphicsMediaItemDelegate::togglePlayPause()
{ {
if (delegated() && delegated()->mediaObject()) { if (delegated() && delegated()->mediaObject()) {
Phonon::MediaObject* media = delegated()->mediaObject(); QMediaPlayer * media = delegated()->mediaObject();
if (media->state() == Phonon::StoppedState) {
if (media->state() == QMediaPlayer::StoppedState)
media->play(); media->play();
} else if (media->state() == Phonon::PlayingState) {
if (media->remainingTime() <= 0) { else if (media->state() == QMediaPlayer::PlayingState) {
if ((media->duration() - media->position()) <= 0) {
media->stop(); media->stop();
media->play(); media->play();
} else { }
else {
media->pause(); media->pause();
if(delegated()->scene()) if(delegated()->scene())
delegated()->scene()->setModified(true); delegated()->scene()->setModified(true);
} }
} else if (media->state() == Phonon::PausedState) { }
if (media->remainingTime() <= 0) {
else if (media->state() == QMediaPlayer::PausedState) {
if ((media->duration() - media->position()) <= 0)
media->stop(); media->stop();
}
media->play(); media->play();
} else if ( media->state() == Phonon::LoadingState ) { }
delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl());
else if ( media->mediaStatus() == QMediaPlayer::LoadingMedia) {
delegated()->mediaObject()->setMedia(delegated()->mediaFileUrl());
media->play(); media->play();
} else if (media->state() == Phonon::ErrorState){
qDebug() << "Error appeared." << media->errorString();
} }
else if (media->error())
qDebug() << "Error appeared." << media->errorString();
} }
} }
void UBGraphicsMediaItemDelegate::mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ) void UBGraphicsMediaItemDelegate::mediaStatusChanged(QMediaPlayer::MediaStatus status)
{ {
Q_UNUSED(newstate); // Possible statuses are: UnknownMediaStatus, NoMedia, LoadingMedia, LoadedMedia,
Q_UNUSED(oldstate); // StalledMedia, BufferingMedia, BufferedMedia, EndOfMedia, InvalidMedia
if (oldstate == Phonon::LoadingState) if (status == QMediaPlayer::LoadedMedia)
{ mMediaControl->totalTimeChanged(delegated()->mediaObject()->duration());
mMediaControl->totalTimeChanged(delegated()->mediaObject()->totalTime());
} // in most cases, the only necessary action is to update the play/pause state
updatePlayPauseState(); updatePlayPauseState();
} }
void UBGraphicsMediaItemDelegate::mediaStateChanged(QMediaPlayer::State state)
{
// Possible states are StoppedState, PlayingState and PausedState
// updatePlayPauseState handles this functionality
updatePlayPauseState();
}
void UBGraphicsMediaItemDelegate::mediaError(QMediaPlayer::Error error)
{
// Possible errors are NoError, ResourceError, FormatError, NetworkError, AccessDeniedError,
// ServiceMissingError
Q_UNUSED(error);
qDebug() << "Error appeared." << mMedia->errorString();
}
void UBGraphicsMediaItemDelegate::updatePlayPauseState() void UBGraphicsMediaItemDelegate::updatePlayPauseState()
{ {
Phonon::MediaObject* media = delegated()->mediaObject(); QMediaPlayer * media = delegated()->mediaObject();
if (media->state() == Phonon::PlayingState) if (media->state() == QMediaPlayer::PlayingState)
mPlayPauseButton->setFileName(":/images/pause.svg"); mPlayPauseButton->setFileName(":/images/pause.svg");
else else
mPlayPauseButton->setFileName(":/images/play.svg"); mPlayPauseButton->setFileName(":/images/play.svg");
@ -252,8 +301,8 @@ void UBGraphicsMediaItemDelegate::updatePlayPauseState()
void UBGraphicsMediaItemDelegate::updateTicker(qint64 time) void UBGraphicsMediaItemDelegate::updateTicker(qint64 time)
{ {
Phonon::MediaObject* media = delegated()->mediaObject(); QMediaPlayer* media = delegated()->mediaObject();
mMediaControl->totalTimeChanged(media->totalTime()); mMediaControl->totalTimeChanged(media->duration());
mMediaControl->updateTicker(time); mMediaControl->updateTicker(time);
} }

@ -29,8 +29,8 @@
#define UBGRAPHICSMEDIAITEMDELEGATE_H_ #define UBGRAPHICSMEDIAITEMDELEGATE_H_
#include <QtGui> #include <QtGui>
#include <phonon/MediaObject>
#include <QTimer> #include <QTimer>
#include <QtMultimedia>
#include "core/UB.h" #include "core/UB.h"
#include "UBGraphicsItemDelegate.h" #include "UBGraphicsItemDelegate.h"
@ -43,12 +43,12 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
Q_OBJECT Q_OBJECT
public: public:
UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent = 0); UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaPlayer* pMedia, QObject * parent = 0);
virtual ~UBGraphicsMediaItemDelegate(); virtual ~UBGraphicsMediaItemDelegate();
virtual void positionHandles(); virtual void positionHandles();
bool mousePressEvent(QGraphicsSceneMouseEvent *event); bool mousePressEvent(QGraphicsSceneMouseEvent* event);
public slots: public slots:
@ -61,14 +61,18 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
void togglePlayPause(); void togglePlayPause();
void mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate );
void updatePlayPauseState(); void updatePlayPauseState();
void totalTimeChanged(qint64 newTotalTime); void totalTimeChanged(qint64 newTotalTime);
void hideToolBar(); void hideToolBar();
void mediaStatusChanged(QMediaPlayer::MediaStatus status);
void mediaStateChanged(QMediaPlayer::State state);
void mediaError(QMediaPlayer::Error error);
protected: protected:
virtual void buildButtons(); virtual void buildButtons();
@ -77,11 +81,11 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
DelegateButton* mPlayPauseButton; DelegateButton* mPlayPauseButton;
DelegateButton* mStopButton; DelegateButton* mStopButton;
DelegateButton* mMuteButton; DelegateButton* mMuteButton;
DelegateMediaControl *mMediaControl; DelegateMediaControl* mMediaControl;
Phonon::MediaObject* mMedia; QMediaPlayer* mMedia; // mMedia belongs to the associated UBGraphicsMediaItem (mDelegated)
QTimer *mToolBarShowTimer; QTimer* mToolBarShowTimer;
int m_iToolBarShowingInterval; int m_iToolBarShowingInterval;
}; };

@ -1264,7 +1264,7 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, QGraphi
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
} }
pixmapItem->scale(pScaleFactor, pScaleFactor); pixmapItem->setTransform(QTransform::fromScale(pScaleFactor, pScaleFactor), true);
if (pUseAnimation) if (pUseAnimation)
{ {
@ -1340,7 +1340,7 @@ UBGraphicsMediaItem* UBGraphicsScene::addMedia(const QUrl& pMediaFileUrl, bool s
if (!shouldPlayAsap) if (!shouldPlayAsap)
{ {
mediaItem->mediaObject()->pause(); mediaItem->mediaObject()->pause();
mediaItem->mediaObject()->seek(0); mediaItem->mediaObject()->setPosition(0);
} }
setDocumentUpdated(); setDocumentUpdated();
@ -1403,7 +1403,7 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
qreal ssf = 1 / UBApplication::boardController->systemScaleFactor(); qreal ssf = 1 / UBApplication::boardController->systemScaleFactor();
graphicsWidget->scale(ssf, ssf); graphicsWidget->setTransform(QTransform::fromScale(ssf, ssf), true);
graphicsWidget->setPos(QPointF(pPos.x() - graphicsWidget->boundingRect().width() / 2, graphicsWidget->setPos(QPointF(pPos.x() - graphicsWidget->boundingRect().width() / 2,
pPos.y() - graphicsWidget->boundingRect().height() / 2)); pPos.y() - graphicsWidget->boundingRect().height() / 2));
@ -1530,7 +1530,7 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint
svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true); svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
qreal sscale = 1 / UBApplication::boardController->systemScaleFactor(); qreal sscale = 1 / UBApplication::boardController->systemScaleFactor();
svgItem->scale(sscale, sscale); svgItem->setTransform(QTransform::fromScale(sscale, sscale), true);
QPointF half(svgItem->boundingRect().width() / 2, svgItem->boundingRect().height() / 2); QPointF half(svgItem->boundingRect().width() / 2, svgItem->boundingRect().height() / 2);
svgItem->setPos(pPos - half); svgItem->setPos(pPos - half);
@ -1860,7 +1860,7 @@ QGraphicsItem* UBGraphicsScene::scaleToFitDocumentSize(QGraphicsItem* item, bool
{ {
qreal ratio = qMin(maxWidth / size.width(), maxHeight / size.height()); qreal ratio = qMin(maxWidth / size.width(), maxHeight / size.height());
item->scale(ratio, ratio); item->setTransform(QTransform::fromScale(ratio, ratio), true);
if(center) if(center)
{ {

@ -27,6 +27,7 @@
#include <QtNetwork> #include <QtNetwork>
#include <QtXml> #include <QtXml>
#include <QWebFrame>
#include "UBGraphicsWidgetItem.h" #include "UBGraphicsWidgetItem.h"
#include "UBGraphicsScene.h" #include "UBGraphicsScene.h"
@ -121,7 +122,8 @@ void UBGraphicsWidgetItem::initialize()
page()->setPalette(palette); page()->setPalette(palette);
page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared())); connect(page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared,
this, &UBGraphicsWidgetItem::javaScriptWindowObjectCleared);
connect(page(), SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested(const QRect&))); connect(page(), SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested(const QRect&)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(mainFrameLoadFinished (bool))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(mainFrameLoadFinished (bool)));
connect(page()->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayoutCompleted())); connect(page()->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayoutCompleted()));

@ -31,6 +31,7 @@
#include <QtGui> #include <QtGui>
#include <QtWebKit> #include <QtWebKit>
#include <QDomElement> #include <QDomElement>
#include <QGraphicsWebView>
#include "core/UB.h" #include "core/UB.h"

@ -157,7 +157,7 @@ void UBSelectionFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
mLastTranslateOffset = QPointF(); mLastTranslateOffset = QPointF();
mRotationAngle = 0; mRotationAngle = 0;
if (scene()->itemAt(event->scenePos()) == mRotateButton) { if (scene()->itemAt(event->scenePos(), transform()) == mRotateButton) {
mOperationMode = om_rotating; mOperationMode = om_rotating;
} else { } else {
mOperationMode = om_moving; mOperationMode = om_moving;

@ -29,6 +29,7 @@
#define UBABSTRACTUNDOCOMMAND_H_ #define UBABSTRACTUNDOCOMMAND_H_
#include <QtGui> #include <QtGui>
#include <QUndoCommand>
#include <core/UB.h> #include <core/UB.h>
class UBUndoCommand : public QUndoCommand class UBUndoCommand : public QUndoCommand

@ -53,7 +53,7 @@ QByteArray UBBase32::decode(const QString& base32String)
for (i = 0, index = 0, offset = 0; i < base32String.length(); i++) for (i = 0, index = 0, offset = 0; i < base32String.length(); i++)
{ {
QChar ch = base32String.at(i); QChar ch = base32String.at(i);
char lookup = ch.toAscii() - '0'; char lookup = ch.toLatin1() - '0';
/* Skip chars outside the lookup table */ /* Skip chars outside the lookup table */
if (lookup < 0 || lookup >= 80) if (lookup < 0 || lookup >= 80)

@ -29,6 +29,8 @@
#define UBCOREGRAPHICSSCENE_H_ #define UBCOREGRAPHICSSCENE_H_
#include <QtGui> #include <QtGui>
#include <QGraphicsScene>
#include <QGraphicsItem>
class UBCoreGraphicsScene : public QGraphicsScene class UBCoreGraphicsScene : public QGraphicsScene
{ {

@ -92,13 +92,13 @@ QString UBCryptoUtils::symetricEncrypt(const QString& clear)
free(ciphertext); free(ciphertext);
return QString::fromAscii(cipheredData.toBase64()); return QString::fromLatin1(cipheredData.toBase64());
} }
QString UBCryptoUtils::symetricDecrypt(const QString& encrypted) QString UBCryptoUtils::symetricDecrypt(const QString& encrypted)
{ {
QByteArray encryptedData = QByteArray::fromBase64(encrypted.toAscii()); QByteArray encryptedData = QByteArray::fromBase64(encrypted.toLatin1());
int encryptedLength = encryptedData.length(); int encryptedLength = encryptedData.length();
int paddingLength = 0; int paddingLength = 0;
@ -132,10 +132,10 @@ void UBCryptoUtils::aesInit()
{ {
int i, nrounds = 5; int i, nrounds = 5;
unsigned char key[32], iv[32]; unsigned char key[32], iv[32];
unsigned char *key_data = (unsigned char *)sAESKey.toAscii().data(); unsigned char *key_data = (unsigned char *)sAESKey.toLatin1().data();
int key_data_len = sAESKey.length(); int key_data_len = sAESKey.length();
i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), (unsigned char *)sAESSalt.toAscii().data(), key_data, i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), (unsigned char *)sAESSalt.toLatin1().data(), key_data,
key_data_len, nrounds, key, iv); key_data_len, nrounds, key, iv);
if (i != 32) if (i != 32)

@ -57,7 +57,7 @@ UBFileSystemUtils::~UBFileSystemUtils()
QString UBFileSystemUtils::removeLocalFilePrefix(QString input) QString UBFileSystemUtils::removeLocalFilePrefix(QString input)
{ {
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
if(input.startsWith("file:///")) if(input.startsWith("file:///"))
return input.mid(8); return input.mid(8);
else else
@ -130,12 +130,12 @@ bool UBFileSystemUtils::deleteFile(const QString &path)
QString UBFileSystemUtils::defaultTempDirPath() QString UBFileSystemUtils::defaultTempDirPath()
{ {
return QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/" + defaultTempDirName(); return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/" + defaultTempDirName();
} }
QString UBFileSystemUtils::createTempDir(const QString& templateString, bool autoDeleteOnExit) QString UBFileSystemUtils::createTempDir(const QString& templateString, bool autoDeleteOnExit)
{ {
QString appTempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation) QString appTempDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation)
+ "/" + templateString; + "/" + templateString;
int index = 0; int index = 0;
@ -200,7 +200,7 @@ void UBFileSystemUtils::deleteAllTempDirCreatedDuringSession()
void UBFileSystemUtils::cleanupGhostTempFolders(const QString& templateString) void UBFileSystemUtils::cleanupGhostTempFolders(const QString& templateString)
{ {
QDir dir(QDesktopServices::storageLocation(QDesktopServices::TempLocation)); QDir dir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
foreach (QFileInfo dirContent, dir.entryInfoList(QDir::Dirs foreach (QFileInfo dirContent, dir.entryInfoList(QDir::Dirs
| QDir::NoDotAndDotDot | QDir::Hidden , QDir::Name)) | QDir::NoDotAndDotDot | QDir::Hidden , QDir::Name))
{ {

@ -204,7 +204,7 @@ public:
static QString urlFromClipboard(); static QString urlFromClipboard();
static QStringList availableTranslations(); static QStringList availableTranslations();
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
static void SetMacLocaleByIdentifier(const QString& id); static void SetMacLocaleByIdentifier(const QString& id);
#endif #endif
}; };

@ -28,6 +28,7 @@
#include "UBPlatformUtils.h" #include "UBPlatformUtils.h"
#include <QtGui> #include <QtGui>
#include <QApplication>
#include <unistd.h> #include <unistd.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -98,7 +99,7 @@ void UBPlatformUtils::bringPreviousProcessToFront()
QString UBPlatformUtils::osUserLoginName() QString UBPlatformUtils::osUserLoginName()
{ {
char *user = getenv("USER"); char *user = getenv("USER");
return QString::fromAscii(user); return QString::fromLatin1(user);
} }
QString UBPlatformUtils::computerName() QString UBPlatformUtils::computerName()
@ -108,7 +109,7 @@ QString UBPlatformUtils::computerName()
// if the name is longer than 255 the name is truncated but os doesn't ensure // if the name is longer than 255 the name is truncated but os doesn't ensure
// that the last character returned is a null character // that the last character returned is a null character
if(!gethostname(hostname,255)) if(!gethostname(hostname,255))
return QString::fromAscii(hostname); return QString::fromLatin1(hostname);
else else
return "NOT FOUND"; return "NOT FOUND";
} }

@ -45,7 +45,7 @@
setStyleSheet(style);\ setStyleSheet(style);\
} }
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
#define WARNINGS_DISABLE __pragma(warning(push, 0)); #define WARNINGS_DISABLE __pragma(warning(push, 0));
#define WARNINGS_ENABLE __pragma(warning(pop)); #define WARNINGS_ENABLE __pragma(warning(pop));
@ -58,7 +58,7 @@
#define THIRD_PARTY_WARNINGS_DISABLE __pragma(warning(push)); #define THIRD_PARTY_WARNINGS_DISABLE __pragma(warning(push));
#endif //#ifdef NO_THIRD_PARTY_WARNINGS #endif //#ifdef NO_THIRD_PARTY_WARNINGS
#else //#ifdef Q_WS_WIN #else //#ifdef Q_OS_WIN
#define WARNINGS_DISABLE _Pragma("GCC diagnostic push"); \ #define WARNINGS_DISABLE _Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\""); \ _Pragma("GCC diagnostic ignored \"-Wunused-parameter\""); \
@ -76,7 +76,7 @@ _Pragma("GCC diagnostic ignored \"-Wsign-compare\"");
#endif //#ifdef NO_THIRD_PARTY_WARNINGS #endif //#ifdef NO_THIRD_PARTY_WARNINGS
#endif //#ifdef Q_WS_WIN #endif //#ifdef Q_OS_WIN
// anyway on any OS // anyway on any OS
#define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE #define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE

@ -23,7 +23,8 @@
*/ */
#include <QLayout>
#include <QAction>
#include "UBActionPalette.h" #include "UBActionPalette.h"
@ -103,8 +104,10 @@ UBActionPaletteButton* UBActionPalette::createPaletteButton(QAction* action, QWi
mMapActionToButton[action] = button; mMapActionToButton[action] = button;
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked())); connect(button, &UBActionPaletteButton::clicked,
connect(action, SIGNAL(changed()), this, SLOT(actionChanged())); this, &UBActionPalette::buttonClicked);
connect(action, &QAction::changed,
this, &UBActionPalette::actionChanged);
return button; return button;
} }

@ -31,6 +31,8 @@
#include <QtGui> #include <QtGui>
#include <QPoint> #include <QPoint>
#include <QButtonGroup> #include <QButtonGroup>
#include <QToolButton>
#include "UBFloatingPalette.h" #include "UBFloatingPalette.h"
class UBActionPaletteButton; class UBActionPaletteButton;

@ -29,6 +29,7 @@
#define UBCIRCLEFRAME_H_ #define UBCIRCLEFRAME_H_
#include <QtGui> #include <QtGui>
#include <QFrame>
class UBCircleFrame : public QFrame class UBCircleFrame : public QFrame
{ {

@ -29,6 +29,7 @@
#define UBCOLORPICKER_H_ #define UBCOLORPICKER_H_
#include <QtGui> #include <QtGui>
#include <QFrame>
class UBColorPicker : public QFrame class UBColorPicker : public QFrame
{ {

@ -654,9 +654,9 @@ void UBTabDockPalette::paintEvent(QPaintEvent *)
} }
painter.save(); painter.save();
QPixmap transparencyPix(":/images/tab_mask.png"); //QPixmap transparencyPix(":/images/tab_mask.png");
if (dock->mCurrentTab != i) { if (dock->mCurrentTab != i) {
iconPixmap.setAlphaChannel(transparencyPix); //iconPixmap.setAlphaChannel(transparencyPix); // deprecated; removed for now, to be re-implemented
QColor color(0x7F, 0x7F, 0x7F, 0x3F); QColor color(0x7F, 0x7F, 0x7F, 0x3F);
painter.setBrush(QBrush(color)); painter.setBrush(QBrush(color));
} }

@ -190,7 +190,8 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event)
if (!mDropCaretRectItem && selectedItems().count() < mGraphicItems.count()) if (!mDropCaretRectItem && selectedItems().count() < mGraphicItems.count())
{ {
mDropCaretRectItem = new QGraphicsRectItem(0, scene()); mDropCaretRectItem = new QGraphicsRectItem(0);
scene()->addItem(mDropCaretRectItem);
mDropCaretRectItem->setPen(QPen(Qt::darkGray)); mDropCaretRectItem->setPen(QPen(Qt::darkGray));
mDropCaretRectItem->setBrush(QBrush(Qt::lightGray)); mDropCaretRectItem->setBrush(QBrush(Qt::lightGray));
} }

@ -29,6 +29,7 @@
#define UBDOCUMENTTREEWIDGET_H_ #define UBDOCUMENTTREEWIDGET_H_
#include <QtGui> #include <QtGui>
#include <QTreeWidget>
class UBDocumentProxy; class UBDocumentProxy;
class UBDocumentProxyTreeItem; class UBDocumentProxyTreeItem;

@ -61,8 +61,8 @@ UBDownloadWidget::UBDownloadWidget(QWidget *parent, const char *name):QWidget(pa
mpTree->setRootIsDecorated(false); mpTree->setRootIsDecorated(false);
mpTree->setColumnCount(2); mpTree->setColumnCount(2);
mpTree->header()->setStretchLastSection(false); mpTree->header()->setStretchLastSection(false);
mpTree->header()->setResizeMode(eItemColumn_Desc, QHeaderView::Stretch); mpTree->header()->setSectionResizeMode(eItemColumn_Desc, QHeaderView::Stretch);
mpTree->header()->setResizeMode(eItemColumn_Close, QHeaderView::Custom); mpTree->header()->setSectionResizeMode(eItemColumn_Close, QHeaderView::Custom);
mpTree->resizeColumnToContents(eItemColumn_Close); mpTree->resizeColumnToContents(eItemColumn_Close);
mpTree->header()->close(); mpTree->header()->close();
mpLayout->addWidget(mpTree, 1); mpLayout->addWidget(mpTree, 1);

@ -23,7 +23,8 @@
*/ */
#include <QButtonGroup>
#include <QAction>
#include "UBFeaturesActionBar.h" #include "UBFeaturesActionBar.h"
#include "core/memcheck.h" #include "core/memcheck.h"

@ -31,6 +31,9 @@
#include <QWidget> #include <QWidget>
#include <QToolButton> #include <QToolButton>
#include <QDropEvent> #include <QDropEvent>
#include <QLineEdit>
#include <QLayout>
#include "board/UBFeaturesController.h" #include "board/UBFeaturesController.h"
#define BUTTON_SIZE 24 #define BUTTON_SIZE 24

@ -27,6 +27,8 @@
#include <QDomDocument> #include <QDomDocument>
#include <QWebView> #include <QWebView>
#include <QWebFrame>
#include <QWidget>
#include "UBFeaturesWidget.h" #include "UBFeaturesWidget.h"
#include "gui/UBThumbnailWidget.h" #include "gui/UBThumbnailWidget.h"
@ -267,8 +269,8 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
{ {
QString previewImageUrl = ":images/libpalette/notFound.png"; QString previewImageUrl = ":images/libpalette/notFound.png";
QString widgetsUrl = QUrl::fromEncoded(metadata["Url"].toAscii()).toString()/*metadata.value("Url", QString())*/; QString widgetsUrl = QUrl::fromEncoded(metadata["Url"].toLatin1()).toString()/*metadata.value("Url", QString())*/;
QString widgetsThumbsUrl = QUrl::fromEncoded(metadata["thumbnailUrl"].toAscii()).toString(); QString widgetsThumbsUrl = QUrl::fromEncoded(metadata["thumbnailUrl"].toLatin1()).toString();
QString strType = UBFileSystemUtils::mimeTypeFromFileName(widgetsUrl); QString strType = UBFileSystemUtils::mimeTypeFromFileName(widgetsUrl);
UBMimeType::Enum thumbType = UBFileSystemUtils::mimeTypeFromString(strType); UBMimeType::Enum thumbType = UBFileSystemUtils::mimeTypeFromString(strType);
@ -440,7 +442,7 @@ void UBFeaturesListView::dragMoveEvent( QDragMoveEvent *event )
void UBFeaturesListView::dropEvent( QDropEvent *event ) void UBFeaturesListView::dropEvent( QDropEvent *event )
{ {
QWidget *eventSource = event->source(); QObject *eventSource = event->source();
if (eventSource && eventSource->objectName() == UBFeaturesWidget::objNameFeatureList) { if (eventSource && eventSource->objectName() == UBFeaturesWidget::objNameFeatureList) {
event->setDropAction( Qt::MoveAction ); event->setDropAction( Qt::MoveAction );
} }
@ -1172,7 +1174,7 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const
if (!typeData.isNull()) { if (!typeData.isNull()) {
typeData += UBFeaturesController::featureTypeSplitter(); typeData += UBFeaturesController::featureTypeSplitter();
} }
typeData += QString::number(element.getType()).toAscii(); typeData += QString::number(element.getType()).toLatin1();
} }
} }

@ -41,6 +41,10 @@
#include <QGraphicsLinearLayout> #include <QGraphicsLinearLayout>
#include <QStackedWidget> #include <QStackedWidget>
#include <QDropEvent> #include <QDropEvent>
#include <QPushButton>
#include <QProgressBar>
#include <QLabel>
#include <QTreeWidget>
#include "UBDockPaletteWidget.h" #include "UBDockPaletteWidget.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
@ -393,6 +397,8 @@ public:
void moveData(const UBFeature &source, const UBFeature &destination, Qt::DropAction action, bool deleteManualy = false); void moveData(const UBFeature &source, const UBFeature &destination, Qt::DropAction action, bool deleteManualy = false);
Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; } Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }
Qt::DropActions supportedDragActions() const { return Qt::MoveAction | Qt::CopyAction; }
// void setFeaturesList(QList <UBFeature> *flist ) { featuresList = flist; } // void setFeaturesList(QList <UBFeature> *flist ) { featuresList = flist; }
public slots: public slots:

@ -54,11 +54,11 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
{ {
// standalone window // standalone window
// !!!! Should be included into Windows after QT recompilation // !!!! Should be included into Windows after QT recompilation
#ifndef Q_WS_WIN #ifndef Q_OS_WIN
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacAlwaysShowToolWindow);
#endif #endif
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacAlwaysShowToolWindow);
setAttribute(Qt::WA_MacNonActivatingToolWindow); setAttribute(Qt::WA_MacNonActivatingToolWindow);
setAttribute(Qt::WA_MacNoShadow); setAttribute(Qt::WA_MacNoShadow);

@ -79,11 +79,11 @@ UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive)
{ {
// standalone window // standalone window
// !!!! Should be included into Windows after QT recompilation // !!!! Should be included into Windows after QT recompilation
#ifndef Q_WS_WIN #ifndef Q_OS_WIN
// setAttribute(Qt::WA_TranslucentBackground); // setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacAlwaysShowToolWindow);
#endif #endif
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacAlwaysShowToolWindow);
setAttribute(Qt::WA_MacNonActivatingToolWindow); setAttribute(Qt::WA_MacNonActivatingToolWindow);
setAttribute(Qt::WA_MacNoShadow); setAttribute(Qt::WA_MacNoShadow);

@ -29,6 +29,7 @@
#define UBMAGNIFIER_H #define UBMAGNIFIER_H
#include <QtGui> #include <QtGui>
#include <QWidget>
class UBMagnifierParams class UBMagnifierParams
{ {

@ -26,6 +26,8 @@
#include <QtGui> #include <QtGui>
#include <QToolTip>
#include <QStackedLayout>
#include "UBMainWindow.h" #include "UBMainWindow.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
@ -34,7 +36,7 @@
#include "core/UBDisplayManager.h" #include "core/UBDisplayManager.h"
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above // work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX) #if defined(Q_OS_OSX)
#include "board/UBBoardView.h" #include "board/UBBoardView.h"
#endif #endif
@ -62,10 +64,10 @@ UBMainWindow::UBMainWindow(QWidget *parent, Qt::WindowFlags flags)
mStackedLayout = new QStackedLayout(centralWidget); mStackedLayout = new QStackedLayout(centralWidget);
setCentralWidget(centralWidget); setCentralWidget(centralWidget);
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
actionPreferences->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Comma)); actionPreferences->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Comma));
actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
#elif defined(Q_WS_WIN) #elif defined(Q_OS_WIN)
actionPreferences->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return)); actionPreferences->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return));
// this code, because it unusable, system key combination can`t be triggered, even we add it manually // this code, because it unusable, system key combination can`t be triggered, even we add it manually
actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4)); actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));
@ -148,7 +150,7 @@ void UBMainWindow::closeEvent(QCloseEvent *event)
} }
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above // work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX) #if defined(Q_OS_OSX)
bool UBMainWindow::event(QEvent *event) bool UBMainWindow::event(QEvent *event)
{ {
bool bRes = QMainWindow::event(event); bool bRes = QMainWindow::event(event);
@ -199,7 +201,7 @@ bool UBMainWindow::yesNoQuestion(QString windowTitle, QString text)
messageBox.addButton(tr("No"),QMessageBox::NoRole); messageBox.addButton(tr("No"),QMessageBox::NoRole);
messageBox.setIcon(QMessageBox::Question); messageBox.setIcon(QMessageBox::Question);
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
// to avoid to be handled by x11. This allows us to keep to the back all the windows manager stuff like palette, toolbar ... // to avoid to be handled by x11. This allows us to keep to the back all the windows manager stuff like palette, toolbar ...
messageBox.setWindowFlags(Qt::Dialog | Qt::X11BypassWindowManagerHint); messageBox.setWindowFlags(Qt::Dialog | Qt::X11BypassWindowManagerHint);
#else #else

@ -30,7 +30,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QWidget> #include <QWidget>
#include <QWebView> #include <QtWebKitWidgets/QWebView>
#include <QMessageBox> #include <QMessageBox>
#include "UBDownloadWidget.h" #include "UBDownloadWidget.h"
@ -88,7 +88,7 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
private: private:
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above // work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX) #if defined(Q_OS_OSX)
bool event(QEvent *event); bool event(QEvent *event);
#endif #endif
UBDownloadWidget* mpDownloadWidget; UBDownloadWidget* mpDownloadWidget;

@ -44,7 +44,7 @@ UBMessageWindow::UBMessageWindow(QWidget *parent)
mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4); mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4);
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
mLayout->setContentsMargins(radius() + 15, 8, radius() + 15, 10); mLayout->setContentsMargins(radius() + 15, 8, radius() + 15, 10);
#endif #endif

@ -29,6 +29,8 @@
#define UBMESSAGEWINDOW_H_ #define UBMESSAGEWINDOW_H_
#include <QtGui> #include <QtGui>
#include <QHBoxLayout>
#include <QLabel>
#include "UBFloatingPalette.h" #include "UBFloatingPalette.h"

@ -23,7 +23,9 @@
*/ */
#include <QLayout>
#include <QTextEdit>
#include <QPushButton>
#include "UBMessagesDialog.h" #include "UBMessagesDialog.h"

@ -29,6 +29,7 @@
#define UB_MESSAGES_DIALOG_H_ #define UB_MESSAGES_DIALOG_H_
#include <QtGui> #include <QtGui>
#include <QWidget>
class UBMessagesDialog : public QWidget class UBMessagesDialog : public QWidget
{ {

@ -23,7 +23,7 @@
*/ */
#include <QApplication>
#include "UBMousePressFilter.h" #include "UBMousePressFilter.h"

@ -28,10 +28,10 @@
#include "UBRubberBand.h" #include "UBRubberBand.h"
#include <QtGui> #include <QtGui>
#include <QtGui/QPlastiqueStyle>
#include <QStyleFactory> #include <QStyleFactory>
#include <QStyle>
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
#include <QtGui/QMacStyle> #include <QtGui/QMacStyle>
#endif #endif
@ -50,11 +50,11 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p)
{ {
customStyle = NULL; customStyle = NULL;
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
customStyle = new QWindowsXPStyle(); customStyle = new QWindowsXPStyle();
#elif defined(Q_WS_MAC) #elif defined(Q_OS_OSX)
customStyle = new QMacStyle(); customStyle = new QMacStyle();
#elif defined(Q_WS_X11) #elif defined(Q_OS_LINUX)
customStyle = QStyleFactory::create("oxygen"); customStyle = QStyleFactory::create("oxygen");
#endif #endif

@ -24,6 +24,7 @@
#include <QDesktopWidget>
#include "UBScreenMirror.h" #include "UBScreenMirror.h"
@ -32,7 +33,7 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#if defined(Q_WS_MAC) #if defined(Q_OS_OSX)
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#endif #endif

@ -29,6 +29,7 @@
#define UBSCREENMIRROR_H_ #define UBSCREENMIRROR_H_
#include <QtGui> #include <QtGui>
#include <QWidget>
class UBScreenMirror : public QWidget class UBScreenMirror : public QWidget
{ {

@ -64,7 +64,7 @@ void UBSpinningWheel::paintEvent(QPaintEvent *event)
pen.setCapStyle(Qt::RoundCap); pen.setCapStyle(Qt::RoundCap);
painter.setPen(pen); painter.setPen(pen);
painter.rotate(30 * (mPosition % 12)); painter.rotate(30 * (mPosition.loadAcquire() % 12));
for(int i = 0; i < 12; i++) for(int i = 0; i < 12; i++)
{ {

@ -26,6 +26,7 @@
#include <QString> #include <QString>
#include <QCursor> #include <QCursor>
#include <QGraphicsRectItem>
#include "UBThumbnailWidget.h" #include "UBThumbnailWidget.h"
#include "UBRubberBand.h" #include "UBRubberBand.h"
@ -242,9 +243,10 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
option.initFrom(&rubberBand); option.initFrom(&rubberBand);
mPrevLassoRect = QRect(); mPrevLassoRect = QRect();
mLassoRectItem = new QGraphicsRectItem(0, scene()); mLassoRectItem = new QGraphicsRectItem(0);
scene()->addItem(mLassoRectItem);
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
// The following code must stay in synch with <Qt installation folder>\src\gui\styles\qmacstyle_mac.mm // The following code must stay in synch with <Qt installation folder>\src\gui\styles\qmacstyle_mac.mm
QColor strokeColor; QColor strokeColor;
strokeColor.setHsvF(0, 0, 0.86, 1.0); strokeColor.setHsvF(0, 0, 0.86, 1.0);
@ -772,7 +774,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD
, bCanMoveDown(false) , bCanMoveDown(false)
{ {
if(0 <= UBDocumentContainer::pageFromSceneIndex(pSceneIndex)){ if(0 <= UBDocumentContainer::pageFromSceneIndex(pSceneIndex)){
setAcceptsHoverEvents(true); setAcceptHoverEvents(true);
setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsSelectable, true);
} }
} }

@ -26,6 +26,9 @@
#include <QtGui> #include <QtGui>
#include <QWebView>
#include <QWebFrame>
#include "UBToolWidget.h" #include "UBToolWidget.h"
#include "api/UBWidgetUniboardAPI.h" #include "api/UBWidgetUniboardAPI.h"
#include "api/UBW3CWidgetAPI.h" #include "api/UBW3CWidgetAPI.h"
@ -115,7 +118,8 @@ void UBToolWidget::initialize()
setFixedSize(mToolWidget->boundingRect().width() + mContentMargin * 2, mToolWidget->boundingRect().height() + mContentMargin * 2); setFixedSize(mToolWidget->boundingRect().width() + mContentMargin * 2, mToolWidget->boundingRect().height() + mContentMargin * 2);
connect(mWebView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared())); connect(mWebView->page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared,
this, &UBToolWidget::javaScriptWindowObjectCleared);
mWebView->load(mToolWidget->mainHtml()); mWebView->load(mToolWidget->mainHtml());

@ -29,6 +29,7 @@
#define UBTOOLWIDGET_H_ #define UBTOOLWIDGET_H_
#include <QtGui> #include <QtGui>
#include <QWidget>
class UBGraphicsWidgetItem; class UBGraphicsWidgetItem;
class QWidget; class QWidget;

@ -28,6 +28,8 @@
#include "UBToolbarButtonGroup.h" #include "UBToolbarButtonGroup.h"
#include <QtGui> #include <QtGui>
#include <QLayout>
#include <QStyleOption>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"

@ -30,6 +30,10 @@
#include <QtGui> #include <QtGui>
#include <QWidget>
#include <QToolBar>
#include <QToolButton>
#include <QActionGroup>
class UBToolbarButtonGroup : public QWidget class UBToolbarButtonGroup : public QWidget
{ {

@ -29,6 +29,7 @@
#define UBWIDGETMIRROR_H_ #define UBWIDGETMIRROR_H_
#include <QtGui> #include <QtGui>
#include <QWidget>
class UBWidgetMirror : public QWidget class UBWidgetMirror : public QWidget
{ {

@ -28,6 +28,7 @@
#include "UBZoomPalette.h" #include "UBZoomPalette.h"
#include <QtGui> #include <QtGui>
#include <QPushButton>
#include <math.h> #include <math.h>
#include "core/UBApplication.h" #include "core/UBApplication.h"

@ -29,6 +29,8 @@
#include <QtGui> #include <QtGui>
#include <QtNetwork> #include <QtNetwork>
#include <QMessageBox>
#include <QPushButton>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"
@ -115,7 +117,7 @@ void UBNetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthe
passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32));
QString introMessage = tr("<qt>Enter username and password for \"%1\" at %2</qt>"); QString introMessage = tr("<qt>Enter username and password for \"%1\" at %2</qt>");
introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString())); introMessage = introMessage.arg((reply->url().toString()).toHtmlEscaped()).arg((reply->url().toString()).toHtmlEscaped());
passwordDialog.introLabel->setText(introMessage); passwordDialog.introLabel->setText(introMessage);
passwordDialog.introLabel->setWordWrap(true); passwordDialog.introLabel->setWordWrap(true);

@ -78,12 +78,12 @@ double Utils::stringToDouble(const std::string & s )
std::string Utils::uIntToStr(unsigned int integer) std::string Utils::uIntToStr(unsigned int integer)
{ {
return std::string(QString::number(integer).toAscii()); return std::string(QString::number(integer).toLatin1());
} }
std::string Utils::doubleToStr(double doubleValue) std::string Utils::doubleToStr(double doubleValue)
{ {
return std::string(QString::number(doubleValue).toAscii()); return std::string(QString::number(doubleValue).toLatin1());
} }
int Utils::_stringToInt(const std::string & str) //throw ConvertException int Utils::_stringToInt(const std::string & str) //throw ConvertException

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save