From 4aa0ee619741fe638c0a0a20dac31763feba1cb3 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Wed, 23 Dec 2015 15:04:07 +0100 Subject: [PATCH] Revert changes pushed to wrong branch When the time comes to merge dev into master (for real), the following may be useful: https://metlos.wordpress.com/2012/01/13/ git-merging-after-a-revert/ --- OpenBoard.pro | 14 +- TEST_OpenBoard_Win32.txt | 27 - changes_porting_qt5.txt | 844 ------------------ src/adaptors/UBExportAdaptor.cpp | 4 +- src/adaptors/UBExportFullPDF.cpp | 1 - src/adaptors/UBExportPDF.cpp | 1 - src/adaptors/UBMetadataDcSubsetAdaptor.cpp | 1 - src/adaptors/UBSvgSubsetAdaptor.cpp | 17 +- src/adaptors/UBSvgSubsetAdaptor.h | 1 - src/adaptors/UBThumbnailAdaptor.cpp | 2 +- .../publishing/UBDocumentPublisher.cpp | 2 +- src/adaptors/publishing/UBDocumentPublisher.h | 7 - src/api/UBLibraryAPI.h | 1 - src/api/UBW3CWidgetAPI.cpp | 2 +- src/api/UBWidgetMessageAPI.cpp | 2 +- src/api/UBWidgetUniboardAPI.cpp | 8 +- src/board/UBBoardController.cpp | 8 +- src/board/UBBoardController.h | 3 - src/board/UBBoardPaletteManager.cpp | 16 +- src/board/UBBoardView.cpp | 24 +- src/board/UBBoardView.h | 5 +- src/board/UBFeaturesController.cpp | 1 + src/board/UBFeaturesController.h | 1 - src/core/UB.h | 1 - src/core/UBApplication.cpp | 56 +- src/core/UBApplication.h | 32 +- src/core/UBApplicationController.cpp | 78 +- src/core/UBApplicationController.h | 6 +- src/core/UBDisplayManager.cpp | 6 +- src/core/UBDisplayManager.h | 1 - src/core/UBDocumentManager.cpp | 2 +- src/core/UBDownloadManager.cpp | 5 +- src/core/UBOpenSankoreImporter.cpp | 4 +- src/core/UBPersistenceManager.cpp | 4 +- src/core/UBPreferencesController.cpp | 4 +- src/core/UBPreferencesController.h | 1 - src/core/UBSettings.cpp | 38 +- src/core/main.cpp | 32 +- src/desktop/UBCustomCaptureWindow.cpp | 3 - src/desktop/UBCustomCaptureWindow.h | 3 - src/desktop/UBDesktopAnnotationController.cpp | 20 +- src/desktop/UBDesktopPalette.cpp | 4 +- src/desktop/UBDesktopPalette.h | 4 +- src/desktop/UBWindowCapture_linux.cpp | 1 - src/document/UBDocumentController.cpp | 6 +- src/document/UBDocumentController.h | 1 - src/domain/UBGraphicsDelegateFrame.cpp | 7 +- src/domain/UBGraphicsGroupContainerItem.cpp | 2 +- src/domain/UBGraphicsItemDelegate.cpp | 6 +- src/domain/UBGraphicsMediaItem.cpp | 65 +- src/domain/UBGraphicsMediaItem.h | 40 +- src/domain/UBGraphicsMediaItemDelegate.cpp | 125 +-- src/domain/UBGraphicsMediaItemDelegate.h | 20 +- src/domain/UBGraphicsScene.cpp | 10 +- src/domain/UBGraphicsWidgetItem.cpp | 4 +- src/domain/UBGraphicsWidgetItem.h | 1 - src/domain/UBSelectionFrame.cpp | 2 +- src/domain/UBUndoCommand.h | 1 - src/frameworks/UBBase32.cpp | 2 +- src/frameworks/UBCoreGraphicsScene.h | 2 - src/frameworks/UBCryptoUtils.cpp | 8 +- src/frameworks/UBFileSystemUtils.cpp | 8 +- src/frameworks/UBPlatformUtils.h | 2 +- src/frameworks/UBPlatformUtils_linux.cpp | 5 +- src/globals/UBGlobals.h | 6 +- src/gui/UBActionPalette.cpp | 9 +- src/gui/UBActionPalette.h | 2 - src/gui/UBCircleFrame.h | 1 - src/gui/UBColorPicker.h | 1 - src/gui/UBDockPalette.cpp | 4 +- src/gui/UBDocumentThumbnailWidget.cpp | 3 +- src/gui/UBDocumentTreeWidget.h | 1 - src/gui/UBDownloadWidget.cpp | 4 +- src/gui/UBFeaturesActionBar.cpp | 3 +- src/gui/UBFeaturesActionBar.h | 3 - src/gui/UBFeaturesWidget.cpp | 10 +- src/gui/UBFeaturesWidget.h | 6 - src/gui/UBFloatingPalette.cpp | 4 +- src/gui/UBMagnifer.cpp | 4 +- src/gui/UBMagnifer.h | 1 - src/gui/UBMainWindow.cpp | 12 +- src/gui/UBMainWindow.h | 4 +- src/gui/UBMessageWindow.cpp | 2 +- src/gui/UBMessageWindow.h | 2 - src/gui/UBMessagesDialog.cpp | 6 +- src/gui/UBMessagesDialog.h | 3 +- src/gui/UBMousePressFilter.cpp | 2 +- src/gui/UBRubberBand.cpp | 10 +- src/gui/UBScreenMirror.cpp | 3 +- src/gui/UBScreenMirror.h | 1 - src/gui/UBSpinningWheel.cpp | 2 +- src/gui/UBThumbnailWidget.cpp | 8 +- src/gui/UBToolWidget.cpp | 6 +- src/gui/UBToolWidget.h | 1 - src/gui/UBToolbarButtonGroup.cpp | 2 - src/gui/UBToolbarButtonGroup.h | 4 - src/gui/UBWidgetMirror.h | 1 - src/gui/UBZoomPalette.cpp | 1 - src/network/UBNetworkAccessManager.cpp | 4 +- src/pdf-merger/Utils.cpp | 4 +- src/pdf-merger/pdfMerger.pri | 107 +-- src/pdf/GraphicsPDFItem.cpp | 2 +- src/pdf/GraphicsPDFItem.h | 2 +- src/pdf/PDFRenderer.cpp | 3 +- src/pdf/UBWebPluginPDFWidget.cpp | 1 - src/pdf/XPDFRenderer.cpp | 2 +- src/podcast/UBPodcastController.cpp | 20 +- src/podcast/UBPodcastRecordingPalette.h | 1 - src/podcast/quicktime/UBQuickTimeFile.cpp | 2 +- src/tools/UBAbstractDrawRuler.cpp | 2 +- src/tools/UBAbstractDrawRuler.h | 1 - src/tools/UBGraphicsCompass.cpp | 2 +- src/tools/UBGraphicsProtractor.cpp | 50 +- src/web/UBOEmbedParser.cpp | 3 +- src/web/UBTrapFlashController.cpp | 12 +- src/web/UBWebController.cpp | 3 +- src/web/UBWebController.h | 1 - src/web/UBWebKitUtils.cpp | 1 - src/web/browser/WBBrowserWindow.cpp | 1 - src/web/browser/WBChaseWidget.cpp | 1 - src/web/browser/WBChaseWidget.h | 1 - src/web/browser/WBDownloadManager.cpp | 3 +- src/web/browser/WBDownloadManager.h | 1 - src/web/browser/WBEditTableView.h | 1 - src/web/browser/WBHistory.cpp | 33 +- src/web/browser/WBModelMenu.h | 1 - src/web/browser/WBSearchLineEdit.cpp | 1 - src/web/browser/WBSearchLineEdit.h | 1 - src/web/browser/WBSqueezeLabel.h | 2 +- src/web/browser/WBTabWidget.cpp | 4 +- src/web/browser/WBTabWidget.h | 8 - src/web/browser/WBToolBarSearch.cpp | 13 +- src/web/browser/WBUrlLineEdit.cpp | 4 - src/web/browser/WBUrlLineEdit.h | 3 - src/web/browser/WBWebTrapWebView.cpp | 4 +- src/web/browser/WBWebTrapWebView.h | 1 - src/web/browser/WBWebView.cpp | 2 - src/web/web.pri | 2 +- 138 files changed, 495 insertions(+), 1561 deletions(-) delete mode 100644 TEST_OpenBoard_Win32.txt delete mode 100644 changes_porting_qt5.txt diff --git a/OpenBoard.pro b/OpenBoard.pro index 5f073bea..8f56b56b 100644 --- a/OpenBoard.pro +++ b/OpenBoard.pro @@ -28,15 +28,10 @@ VERSION_RC = $$replace(VERSION_RC, "r", "240") # 0xF0 QT += webkit QT += svg QT += network +QT += phonon QT += xml QT += script QT += xmlpatterns -QT += uitools -QT += multimedia -QT += webkitwidgets -QT += multimediawidgets -QT += printsupport -QT += core INCLUDEPATH += src @@ -64,10 +59,9 @@ include(src/pdf-merger/pdfMerger.pri) DEPENDPATH += $$THIRD_PARTY_PATH/quazip/ INCLUDEPATH += $$THIRD_PARTY_PATH/quazip/ include($$THIRD_PARTY_PATH/quazip/quazip.pri) -DEPENDPATH += $$THIRD_PARTY_PATH/qt/singleapplication -INCLUDEPATH += $$THIRD_PARTY_PATH/qt/singleapplication -include($$THIRD_PARTY_PATH/qt/singleapplication/qtsingleapplication.pri) -include($$THIRD_PARTY_PATH/qt/lockedfile/qtlockedfile.pri) +DEPENDPATH += $$THIRD_PARTY_PATH/trolltech/singleapplication +INCLUDEPATH += $$THIRD_PARTY_PATH/trolltech/singleapplication +include($$THIRD_PARTY_PATH/trolltech/singleapplication/qtsingleapplication.pri) FORMS += resources/forms/mainWindow.ui \ resources/forms/preferences.ui \ diff --git a/TEST_OpenBoard_Win32.txt b/TEST_OpenBoard_Win32.txt deleted file mode 100644 index 92c418a0..00000000 --- a/TEST_OpenBoard_Win32.txt +++ /dev/null @@ -1,27 +0,0 @@ - - - - **************************** - * 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 | -----------------------|--------------------| - | | -----------------------|--------------------| - | | -----------------------|--------------------| - | | -----------------------|--------------------| diff --git a/changes_porting_qt5.txt b/changes_porting_qt5.txt deleted file mode 100644 index 4c1324ae..00000000 --- a/changes_porting_qt5.txt +++ /dev/null @@ -1,844 +0,0 @@ - ******************************* - * 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 - - -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 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 by #include - - -UBThumbnailWidget.cpp ---------------------- - -- replace //setAcceptsHoverEvents(true); by setAcceptHoverEvents(enabled); (line775) (accept without "s") - - -UBFeaturesWidget.cpp --------------------- - -- add #include -- add #include 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 by #include - - -UBSpinningWheel.h ------------------- - -- add #include - - -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 by #include - - -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::min(); } -+ static inline qint64 nullJd() { return (std::numeric_limits::min)(); } - static inline qint64 minJd() { return Q_INT64_C(-784350574879); } - static inline qint64 maxJd() { return Q_INT64_C( 784354017364); } - - -UBDisplayManager.h --------------------- - -- replace //#include by #include - - -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 by #include -- 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 by #include - - -UBGraphicsCompass.cpp ----------------------- - -- replace //setAcceptsHoverEvents(true); by setAcceptHoverEvents(true); - - -UBGraphicsProtractor.h ----------------------- - -- replace //#include by -#include -#include -#include - - -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 by -#include - - -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 by include - - - -UBWebKitUtils.h ---------------- - --replace //#include by #include - - -UBWindowCaptureDelegate_win.h ------------------------------- - - replace //#include by #include - -UBOEmbedParser.cpp ------------------- - --replace toAscii--> toLatin1 qurl.setEncodedUrl(url.toLatin1()); (line 230) - --replace - - -WBSqueezeLabel.h ------------------ - -- replace //#include by #include - - -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 by #include - - -WBChaseWidget.h ------------------ - --replace //#include by #include - - - -WBModelMenu.h --------------- - --replace //#include by #include - - - -WBUrlLineEdit.cpp ------------------ - -replace //#include by #include - - -WBEditTableView.cpp --------------------- - -- replace //#include by #include - -WBEditTableView.h ------------------- - -replace //#include by #include - - -WBSearchLineEdit.cpp ---------------------- - --replace //#include by -#include - -WBToolBarSearch.cpp -------------------- - -//#include -#include - -//#include -#include - - -WBToolBarSearch.h ------------------- - - --replace //#include -#include - -WBSearchLineEdit.h ------------------- - -//#include -#include - -WBWebTrapWebView.cpp ---------------------- - - -- replace -//#include -//#include -by -#include -#include - - - -WBWebTrapWebView.h -------------------- - -- replace -//#include -//#include -by -#include -#include - - -WBToolBarSearch.cpp -------------------- - - --add on the top of the file -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) -# include -#endif - - -WBUrlLineEdit.h ---------------- -- replace //#include by //#include - - -WBWebView.h ------------ - - -- replace //#include -//#include - -#include -#include - -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 by #include - - -WBTabWidget.h -------------- -- replace //#include by #include - -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 by #include - -- comment //QtSingleApplication(int &argc, char **argv, Type type); - - -WBTabWidget.h --------------- - -- replace //#include by #include - - -WBBrowserWindow.h ------------------- - -- replace //#include ;//#include by - -#include -#include - - -WBHistory.h ------------ - - replace //#include ;//#include by - -#include -#include - - - -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 - -UBWindowCaptureDelegate_win.h -------------------------------- -#ifdef Q_OS_WIN -#include -#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 by #include - - -- 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 by #include - -- 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 by #include . - -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 by #include . - - - - - - diff --git a/src/adaptors/UBExportAdaptor.cpp b/src/adaptors/UBExportAdaptor.cpp index 5743e108..f14b7058 100644 --- a/src/adaptors/UBExportAdaptor.cpp +++ b/src/adaptors/UBExportAdaptor.cpp @@ -23,7 +23,7 @@ */ -#include + #include "UBExportAdaptor.h" @@ -125,4 +125,4 @@ void UBExportAdaptor::showErrorsList(QList errorsList) dialog->setMessages(errorsList); dialog->show(); } -} +} \ No newline at end of file diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp index cada6124..eee66f5d 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -29,7 +29,6 @@ #include #include -#include #include "core/UBApplication.h" #include "core/UBSettings.h" diff --git a/src/adaptors/UBExportPDF.cpp b/src/adaptors/UBExportPDF.cpp index 9906ece3..4e231c14 100644 --- a/src/adaptors/UBExportPDF.cpp +++ b/src/adaptors/UBExportPDF.cpp @@ -29,7 +29,6 @@ #include #include -#include #include "core/UBApplication.h" #include "core/UBSettings.h" diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index d882ea6a..5e3f237b 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -29,7 +29,6 @@ #include #include -#include #include "core/UBSettings.h" #include "core/UBApplication.h" diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 376a5f88..b58eac6f 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include "domain/UBGraphicsSvgItem.h" #include "domain/UBGraphicsPixmapItem.h" @@ -330,7 +329,7 @@ QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex) UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const QByteArray& pArray) { - UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toLatin1()); + UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toAscii()); return reader.loadScene(); } @@ -1336,7 +1335,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro QUuid uuid = UBGraphicsScene::getPersonalUuid(groupItem); if (!uuid.isNull()) { QDomElement curGroupElement = groupDomDocument->createElement(tGroup); - curGroupElement.setAttribute(aId, uuid.toString()); + curGroupElement.setAttribute(aId, uuid); UBGraphicsGroupContainerItem* group = dynamic_cast(groupItem); if(group && group->Delegate()){ if(group->Delegate()->isLocked()) @@ -1352,7 +1351,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro persistGroupToDom(item, curParent, groupDomDocument); else { QDomElement curSubElement = groupDomDocument->createElement(tElement); - curSubElement.setAttribute(aId, tmpUuid.toString()); + curSubElement.setAttribute(aId, tmpUuid); curGroupElement.appendChild(curSubElement); } } @@ -1991,9 +1990,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::audioItemToLinkedAudio(UBGraphicsMed graphicsItemToSvg(audioItem); - if (audioItem->mediaObject()->state() == QMediaPlayer::PausedState && (audioItem->mediaObject()->duration() - audioItem->mediaObject()->position()) > 0) + if (audioItem->mediaObject()->state() == Phonon::PausedState && audioItem->mediaObject()->remainingTime() > 0) { - qint64 pos = audioItem->mediaObject()->position(); + qint64 pos = audioItem->mediaObject()->currentTime(); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); } @@ -2020,9 +2019,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::videoItemToLinkedVideo(UBGraphicsMed graphicsItemToSvg(videoItem); - if (videoItem->mediaObject()->state() == QMediaPlayer::PausedState && (videoItem->mediaObject()->duration() - videoItem->mediaObject()->position()) > 0) + if (videoItem->mediaObject()->state() == Phonon::PausedState && videoItem->mediaObject()->remainingTime() > 0) { - qint64 pos = videoItem->mediaObject()->position(); + qint64 pos = videoItem->mediaObject()->currentTime(); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); } @@ -2140,7 +2139,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g { if (!svgX.isNull() && !svgY.isNull()) { -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat()); #endif } diff --git a/src/adaptors/UBSvgSubsetAdaptor.h b/src/adaptors/UBSvgSubsetAdaptor.h index 7bc1c88b..c7a3a2e8 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.h +++ b/src/adaptors/UBSvgSubsetAdaptor.h @@ -30,7 +30,6 @@ #include #include -#include #include "frameworks/UBGeometryUtils.h" diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index 96545d0f..1f8565a9 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -95,7 +95,7 @@ const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex) if (file.exists()) { //Warning. Works only with modified Qt -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 pix->load(fileName, 0, Qt::AutoColor); #else pix->load(fileName, 0, Qt::AutoColor, false); diff --git a/src/adaptors/publishing/UBDocumentPublisher.cpp b/src/adaptors/publishing/UBDocumentPublisher.cpp index b285d493..bc8b6381 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.cpp +++ b/src/adaptors/publishing/UBDocumentPublisher.cpp @@ -24,7 +24,7 @@ -#include + #include "UBDocumentPublisher.h" diff --git a/src/adaptors/publishing/UBDocumentPublisher.h b/src/adaptors/publishing/UBDocumentPublisher.h index 21f993b2..3314ac6b 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.h +++ b/src/adaptors/publishing/UBDocumentPublisher.h @@ -30,13 +30,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include typedef struct { diff --git a/src/api/UBLibraryAPI.h b/src/api/UBLibraryAPI.h index ba9a547a..3164e440 100644 --- a/src/api/UBLibraryAPI.h +++ b/src/api/UBLibraryAPI.h @@ -30,7 +30,6 @@ #include #include -#include class UBLibraryAPI : public QObject { diff --git a/src/api/UBW3CWidgetAPI.cpp b/src/api/UBW3CWidgetAPI.cpp index a4a4d4d4..16ef1347 100644 --- a/src/api/UBW3CWidgetAPI.cpp +++ b/src/api/UBW3CWidgetAPI.cpp @@ -59,7 +59,7 @@ UBW3CWidgetAPI::~UBW3CWidgetAPI() QString UBW3CWidgetAPI::uuid() { if (mGraphicsW3CWidget) - return mGraphicsW3CWidget->uuid().toString(); + return mGraphicsW3CWidget->uuid(); else return ""; } diff --git a/src/api/UBWidgetMessageAPI.cpp b/src/api/UBWidgetMessageAPI.cpp index 9d6c6aba..d8c2ac48 100644 --- a/src/api/UBWidgetMessageAPI.cpp +++ b/src/api/UBWidgetMessageAPI.cpp @@ -23,7 +23,7 @@ */ -#include + #include "UBWidgetMessageAPI.h" diff --git a/src/api/UBWidgetUniboardAPI.cpp b/src/api/UBWidgetUniboardAPI.cpp index c4d381e9..10b92c64 100644 --- a/src/api/UBWidgetUniboardAPI.cpp +++ b/src/api/UBWidgetUniboardAPI.cpp @@ -514,7 +514,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event) QString str = "test string"; QMimeData mimeData; - mimeData.setData(tMimeText, str.toLatin1()); + mimeData.setData(tMimeText, str.toAscii()); sDownloadFileDesc desc; desc.dest = sDownloadFileDesc::graphicsWidget; @@ -556,7 +556,7 @@ void UBWidgetUniboardAPI::ProcessDropEvent(QGraphicsSceneDragDropEvent *event) } qDebug() << destFileName; QString mimeText = createMimeText(downloaded, contentType, destFileName); - dropMimeData->setData(tMimeText, mimeText.toLatin1()); + dropMimeData->setData(tMimeText, mimeText.toAscii()); event->setMimeData(dropMimeData); } @@ -588,7 +588,7 @@ void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc de } } - QString destFileName = objDir + QUuid::createUuid().toString() + "." + extention; + QString destFileName = objDir + QUuid::createUuid() + "." + extention; QFile destFile(destFileName); if (!destFile.open(QIODevice::WriteOnly)) { @@ -606,7 +606,7 @@ void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc de QMimeData dropMimeData; QString mimeText = createMimeText(true, contentType, destFileName); - dropMimeData.setData(tMimeText, mimeText.toLatin1()); + dropMimeData.setData(tMimeText, mimeText.toAscii()); destFile.close(); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index ccf9b692..e4f946d9 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -86,7 +86,7 @@ #include "core/memcheck.h" -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 #include bool onboardIsAlreadyRunning = true; #endif @@ -165,7 +165,7 @@ void UBBoardController::init() UBBoardController::~UBBoardController() { -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 if(!onboardIsAlreadyRunning){ QProcess newProcess; newProcess.startDetached("killall onboard"); @@ -828,7 +828,7 @@ void UBBoardController::showKeyboard(bool show) if(show) UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 static bool isFirstTime = true; if(isFirstTime){ QProcess isAlreadyRunningProcess; @@ -2411,7 +2411,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint } } else{ -#ifdef Q_OS_OSX +#ifdef Q_WS_MACX // 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 // the data. diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index 4d796656..970665e4 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -31,9 +31,6 @@ #include #include -#include -#include - #include "document/UBDocumentContainer.h" #include "core/UBApplicationController.h" diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 8bf3416e..d6a4012e 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -225,7 +225,7 @@ void UBBoardPaletteManager::setupPalettes() if (UBPlatformUtils::hasVirtualKeyboard()) { mKeyboardPalette = new UBKeyboardPalette(0); -#ifndef Q_OS_WIN +#ifndef Q_WS_WIN connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated())); #endif } @@ -677,7 +677,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mLeftPalette->setVisible(leftPaletteVisible); mRightPalette->setVisible(rightPaletteVisible); -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN if (rightPaletteVisible) mRightPalette->setAdditionalVOffset(0); #endif @@ -702,24 +702,24 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is if(mKeyboardPalette->m_isVisible) { mKeyboardPalette->hide(); -#ifndef Q_OS_LINUX +#ifndef Q_WS_X11 mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); #else mKeyboardPalette->setParent(0); #endif -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC mKeyboardPalette->setWindowFlags(Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint); #endif mKeyboardPalette->show(); } else // In linux keyboard in desktop mode have to allways be with null parent -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 mKeyboardPalette->setParent(0); #else mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); -#endif //Q_OS_LINUX -#ifdef Q_OS_OSX +#endif //Q_WS_X11 +#ifdef Q_WS_MAC mKeyboardPalette->setWindowFlags(Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint); #endif @@ -727,7 +727,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is mLeftPalette->setVisible(leftPaletteVisible); mRightPalette->setVisible(rightPaletteVisible); -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN if (rightPaletteVisible && UBSettings::settings()->appToolBarPositionedAtTop->get().toBool()) mRightPalette->setAdditionalVOffset(30); #endif diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 6024b07a..3de52352 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -55,7 +55,7 @@ #include "board/UBBoardController.h" #include "board/UBBoardPaletteManager.h" -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC #include "core/UBApplicationController.h" #include "desktop/UBDesktopAnnotationController.h" #endif @@ -366,7 +366,7 @@ void UBBoardView::tabletEvent (QTabletEvent * event) } bool acceptEvent = true; -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC //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 //stylus palette. @@ -750,13 +750,13 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event) if (itemShouldReceiveMousePressEvent(movingItem)){ QGraphicsView::mousePressEvent (event); - QGraphicsItem* item = determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), transform())); + QGraphicsItem* item = determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint()), transform())); //use QGraphicsView::transform() to use not deprecated QGraphicsScene::itemAt() method if (item && (item->type() == QGraphicsProxyWidget::Type) && item->parentObject() && item->parentObject()->type() != QGraphicsProxyWidget::Type) { //Clean up children - QList children = item->childItems(); + QList children = item->children(); for( QList::iterator it = children.begin(); it != children.end(); ++it ) 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 -#if defined(Q_OS_OSX) +#if defined(Q_WS_MACX) bool UBBoardView::directTabletEvent(QEvent *event) { QTabletEvent *tEvent = static_cast(event); @@ -905,7 +905,7 @@ QWidget *UBBoardView::widgetForTabletEvent(QWidget *w, const QPoint &pos) QWidget *childAtPos = NULL; - QList childs = w->childItems(); + QList childs = w->children(); foreach(QObject *child, childs) { QWidget *childWidget = qobject_cast(child); @@ -972,7 +972,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) } mMouseDownPos = event->pos (); - movingItem = scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()); + movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); if (event->button () == Qt::LeftButton && isInteractive()) { @@ -993,7 +993,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) case UBStylusTool::Hand : viewport()->setCursor(QCursor (Qt::ClosedHandCursor)); - mPreviousPoint = event->localPos(); + mPreviousPoint = event->posF(); event->accept(); break; @@ -1107,7 +1107,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event) if (!mMouseButtonIsPressed && !mTabletStylusIsPressed) { break; } - QPointF eventPosition = event->localPos(); + QPointF eventPosition = event->posF (); qreal dx = eventPosition.x () - mPreviousPoint.x (); qreal dy = eventPosition.y () - mPreviousPoint.y (); mController->handScroll (dx, dy); @@ -1230,7 +1230,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event) graphicsItem->Delegate()->commitUndoStep(); bool bReleaseIsNeed = true; - if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()))) + if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint())))) { movingItem = NULL; bReleaseIsNeed = false; @@ -1299,7 +1299,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event) graphicsItem->Delegate()->commitUndoStep(); bool bReleaseIsNeed = true; - if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()))) + if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint())))) { movingItem = NULL; bReleaseIsNeed = false; @@ -1475,7 +1475,7 @@ void UBBoardView::wheelEvent (QWheelEvent *wheelEvent) QPointF scenePos = mapToScene(wheelEvent->pos()); QList itemsList = scene()->items(scenePos); - bool isSelectedAndMouseHower = itemsList.contains(selItem); + QBool isSelectedAndMouseHower = itemsList.contains(selItem); if(isSelectedAndMouseHower) { QGraphicsView::wheelEvent(wheelEvent); diff --git a/src/board/UBBoardView.h b/src/board/UBBoardView.h index 6883590f..14b8dec9 100644 --- a/src/board/UBBoardView.h +++ b/src/board/UBBoardView.h @@ -30,9 +30,6 @@ #define CONTROLVIEW_OBJ_NAME "ControlView" #include -#include -#include - #include "core/UB.h" #include "domain/UBGraphicsDelegateFrame.h" @@ -63,7 +60,7 @@ public: void setMultiselection(bool enable); bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; } // work around for handling tablet events on MAC OS with Qt 4.8.0 and above -#if defined(Q_OS_OSX) +#if defined(Q_WS_MACX) bool directTabletEvent(QEvent *event); QWidget *widgetForTabletEvent(QWidget *w, const QPoint &pos); #endif diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index ab2588e7..d3116613 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -346,6 +346,7 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : scanFS(); featuresModel = new UBFeaturesModel(featuresList, this); + featuresModel->setSupportedDragActions(Qt::CopyAction | Qt::MoveAction); featuresProxyModel = new UBFeaturesProxyModel(this); featuresProxyModel->setFilterFixedString(rootPath); diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index 52337eb1..c1074710 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -43,7 +43,6 @@ #include #include #include -#include class UBFeaturesModel; class UBFeaturesItemDelegate; diff --git a/src/core/UB.h b/src/core/UB.h index be8f53a0..21ba376c 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -29,7 +29,6 @@ #define UB_H_ #include -#include #define UB_MAX_ZOOM 9 diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 5225655b..05a3acbc 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -31,9 +31,8 @@ #include #include #include -#include -#if defined(Q_OS_OSX) +#if defined(Q_WS_MACX) #include #endif @@ -85,13 +84,13 @@ const QString UBApplication::mimeTypeUniboardPage = QString("application/vnd.mne const QString UBApplication::mimeTypeUniboardPageItem = QString("application/vnd.mnemis-uniboard-page-item"); const QString UBApplication::mimeTypeUniboardPageThumbnail = QString("application/vnd.mnemis-uniboard-thumbnail"); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC bool bIsMinimized = false; #endif QObject* UBApplication::staticMemoryCleaner = 0; -#if defined(Q_OS_OSX) +#if defined(Q_WS_MAC) static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event, long handlerRefCon) { Q_UNUSED(event); @@ -154,11 +153,11 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), this, SLOT(toolBarDisplayTextChanged(QVariant))); updateProtoActionsState(); -#ifndef Q_OS_OSX +#ifndef Q_WS_MAC setWindowIcon(QIcon(":/images/OpenBoard.png")); #endif - setStyle("fusion"); + setStyle(new UBStyle()); // Style is owned and deleted by the application QString css = UBFileSystemUtils::readTextFile(UBPlatformUtils::applicationResourcesDirectory() + "/etc/"+ qApp->applicationName()+".css"); if (css.length() > 0) @@ -338,7 +337,7 @@ int UBApplication::exec(const QString& pFileToImport) connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool))); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), this, SLOT(stopScript())); -#ifndef Q_OS_OSX +#ifndef Q_WS_MAC connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized())); #else connect(mainWindow->actionHideApplication, SIGNAL(triggered()), this, SLOT(showMinimized())); @@ -368,7 +367,7 @@ int UBApplication::exec(const QString& pFileToImport) if (pFileToImport.length() > 0) UBApplication::applicationController->importFile(pFileToImport); -#if defined(Q_OS_OSX) +#if defined(Q_WS_MAC) static AEEventHandlerUPP ub_proc_ae_handlerUPP = AEEventHandlerUPP(ub_appleEventProcessor); AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, ub_proc_ae_handlerUPP, SRefCon(UBApplication::applicationController), true); #endif @@ -390,7 +389,7 @@ void UBApplication::onScreenCountChanged(int newCount) mainWindow->actionMultiScreen->setEnabled(displayManager.numScreens() > 1); } -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC void UBApplication::showMinimized() { mainWindow->hide(); @@ -539,7 +538,7 @@ void UBApplication::decorateActionMenu(QAction* action) menu->addSeparator(); -#ifndef Q_OS_LINUX // No Podcast on Linux yet +#ifndef Q_WS_X11 // No Podcast on Linux yet menu->addAction(mainWindow->actionPodcast); mainWindow->actionPodcast->setText(tr("Podcast")); #endif @@ -590,7 +589,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event) { QFileOpenEvent *fileToOpenEvent = static_cast(event); -#if defined(Q_OS_OSX) +#if defined(Q_WS_MACX) ProcessSerialNumber psn; GetCurrentProcess(&psn); SetFrontProcess(&psn); @@ -611,7 +610,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event) boardController->controlView()->setMultiselection(false); } -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC if (bIsMinimized && event->type() == QEvent::ApplicationActivate){ if (mainWindow->isHidden()) mainWindow->show(); bIsMinimized = false; @@ -651,6 +650,39 @@ void UBApplication::cleanup() 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 _html; diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index 2ab2c65a..49977f22 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -29,9 +29,6 @@ #define UBAPPLICATION_H_ #include -#include -#include -#include #include "qtsingleapplication.h" @@ -124,7 +121,7 @@ class UBApplication : public QtSingleApplication private slots: void closing(); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC void showMinimized(); #endif void onScreenCountChanged(int newCount); @@ -137,7 +134,7 @@ class UBApplication : public QtSingleApplication QString checkLanguageAvailabilityForSankore(QString& language); protected: -#if defined(Q_OS_OSX) && !defined(QT_MAC_USE_COCOA) +#if defined(Q_WS_MACX) && !defined(QT_MAC_USE_COCOA) bool macEventFilter(EventHandlerCallRef caller, EventRef event); #endif @@ -147,4 +144,29 @@ 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_ */ diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index b4ae6a28..bb93f0cc 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -22,9 +22,7 @@ * along with OpenBoard. If not, see . */ -#include -#include -#include + #include "UBApplicationController.h" @@ -67,7 +65,7 @@ #include "ui_mainWindow.h" -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC #include #endif @@ -88,6 +86,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, , mAutomaticCheckForUpdates(false) , mCheckingForUpdates(false) , mIsShowingDesktop(false) + , mHttp(0) { mDisplayManager = new UBDisplayManager(this); @@ -122,7 +121,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, QTimer::singleShot (1000, this, SLOT (checkAtLaunch())); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 mMainWindow->setStyleSheet("QToolButton { font-size: 11px}"); #endif @@ -138,6 +137,7 @@ UBApplicationController::~UBApplicationController() delete mBlackScene; delete mMirror; + if (mHttp) delete mHttp; delete(mOpenSankoreImporter); mOpenSankoreImporter = NULL; @@ -478,55 +478,47 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess) UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); } + void UBApplicationController::checkUpdate(QString urlString) { - //connect(networkAccessManager, &QNetworkAccessManager::finished, - // this, &UBApplicationController::updateRequestFinished); - - connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)), - this, SLOT(updateRequestFinished(QNetworkReply*))); - - networkAccessManager->get(QNetworkRequest(QUrl(urlString))); - + if(mHttp) + mHttp->deleteLater(); + QUrl url(urlString); + mHttp = new QHttp(url.host()); + connect(mHttp, SIGNAL(requestFinished(int,bool)), this, SLOT(updateRequestFinished(int,bool))); + connect(mHttp, SIGNAL(responseHeaderReceived(QHttpResponseHeader)), this, SLOT(updateHeaderReceived(QHttpResponseHeader))); + + mHttp->get(url.path()); } - - -void UBApplicationController::updateRequestFinished(QNetworkReply * reply) +void UBApplicationController::updateHeaderReceived(QHttpResponseHeader header) { - if (reply->error()) { - qWarning() << "HTTP Error"; - 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())); - - checkUpdate(redirect_url.toString()); - return; + if(header.statusCode() == 302 && header.hasKey("Location")){ + mHttp->close(); + checkUpdate(header.value("Location")); } +} - // No error and no redirect => we read the whole response - - QString responseString = QString(reply->readAll()); - qDebug() << responseString; - - if (!responseString.isEmpty() && - responseString.contains("version") && - responseString.contains("url")) { - - reply->close(); - reply->deleteLater(); - - downloadJsonFinished(responseString); - } +void UBApplicationController::updateRequestFinished(int id, bool error) +{ + if (error){ + qWarning() << "http command id" << id << "return an error"; + } + else{ + QString responseString = QString(mHttp->readAll()); + qDebug() << responseString; + if (!responseString.isEmpty() && responseString.contains("version") && responseString.contains("url")){ + mHttp->close(); + mHttp->deleteLater(); + mHttp = 0; + downloadJsonFinished(responseString); + } + } } + void UBApplicationController::downloadJsonFinished(QString currentJson) { QScriptValue scriptValue; diff --git a/src/core/UBApplicationController.h b/src/core/UBApplicationController.h index cdcb5051..a33da6d7 100644 --- a/src/core/UBApplicationController.h +++ b/src/core/UBApplicationController.h @@ -29,6 +29,8 @@ #define UBAPPLICATIONCONTROLLER_H_ #include +#include +#include class UBBoardView; @@ -144,7 +146,8 @@ class UBApplicationController : public QObject void checkAtLaunch(); private slots: - void updateRequestFinished(QNetworkReply * reply); + void updateRequestFinished(int id, bool error); + void updateHeaderReceived(QHttpResponseHeader header); protected: @@ -183,6 +186,7 @@ class UBApplicationController : public QObject QNetworkAccessManager *networkAccessManager; void downloadJsonFinished(QString updateString); + QHttp* mHttp; }; #endif /* UBAPPLICATIONCONTROLLER_H_ */ diff --git a/src/core/UBDisplayManager.cpp b/src/core/UBDisplayManager.cpp index 59e858af..5aacc83a 100644 --- a/src/core/UBDisplayManager.cpp +++ b/src/core/UBDisplayManager.cpp @@ -41,8 +41,6 @@ #include "core/memcheck.h" -#include "qdesktopwidget.h" - UBDisplayManager::UBDisplayManager(QObject *parent) : QObject(parent) , mControlScreenIndex(-1) @@ -57,8 +55,8 @@ UBDisplayManager::UBDisplayManager(QObject *parent) initScreenIndexes(); - connect(mDesktop, &QDesktopWidget::resized, this, &UBDisplayManager::adjustScreens); - connect(mDesktop, &QDesktopWidget::workAreaResized, this, &UBDisplayManager::adjustScreens); + connect(mDesktop, SIGNAL(resized(int)), this, SLOT(adjustScreens(int))); + connect(mDesktop, SIGNAL(workAreaResized(int)), this, SLOT(adjustScreens(int))); } diff --git a/src/core/UBDisplayManager.h b/src/core/UBDisplayManager.h index a305716e..e45044ca 100644 --- a/src/core/UBDisplayManager.h +++ b/src/core/UBDisplayManager.h @@ -32,7 +32,6 @@ class UBBlackoutWidget; class UBBoardView; -class QDesktopWidget; class UBDisplayManager : public QObject { diff --git a/src/core/UBDocumentManager.cpp b/src/core/UBDocumentManager.cpp index 60aaa408..8bb20100 100644 --- a/src/core/UBDocumentManager.cpp +++ b/src/core/UBDocumentManager.cpp @@ -168,7 +168,7 @@ UBDocumentProxy* UBDocumentManager::importFile(const QFile& pFile, const QString foreach(UBGraphicsItem* page, pages) { UBApplication::showMessage(tr("Inserting page %1 of %2").arg(++nPage).arg(pages.size()), true); -#ifdef Q_OS_OSX +#ifdef Q_WS_MACX //Workaround for issue 912 QApplication::processEvents(); #endif diff --git a/src/core/UBDownloadManager.cpp b/src/core/UBDownloadManager.cpp index 666f5690..ed365520 100644 --- a/src/core/UBDownloadManager.cpp +++ b/src/core/UBDownloadManager.cpp @@ -77,7 +77,7 @@ void UBAsyncLocalFileDownloader::run() if (mDesc.originalSrcUrl.isEmpty()) mDesc.originalSrcUrl = mDesc.srcUrl; - QString uuid = QUuid::createUuid().toString(); + QString uuid = QUuid::createUuid(); UBPersistenceManager::persistenceManager()->addFileToDocument(UBApplication::boardController->selectedDocument(), mDesc.srcUrl, destDirectory, @@ -399,7 +399,8 @@ 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))); //the desc.srcUrl is encoded. So we have to decode it before. - QUrl url = QUrl::fromEncoded(desc.srcUrl.toUtf8()); + QUrl url; + url.setEncodedUrl(desc.srcUrl.toUtf8()); // We send here the request and store its reply in order to be able to cancel it if needed mDownloads[desc.id] = dynamic_cast(http->get(url, desc.pos, desc.size, desc.isBackground)); } diff --git a/src/core/UBOpenSankoreImporter.cpp b/src/core/UBOpenSankoreImporter.cpp index 21220bb5..43c2358f 100644 --- a/src/core/UBOpenSankoreImporter.cpp +++ b/src/core/UBOpenSankoreImporter.cpp @@ -50,9 +50,9 @@ UBOpenSankoreImporter::UBOpenSankoreImporter(QWidget* mainWidget, QObject *paren void UBOpenSankoreImporter::onProceedClicked() { QProcess newProcess; -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 newProcess.startDetached(qApp->applicationDirPath()+"/Importer/OpenBoardImporter"); -#elif defined Q_OS_OSX +#elif defined Q_WS_MACX newProcess.startDetached(qApp->applicationDirPath()+"/../Resources/OpenBoardImporter.app/Contents/MacOS/OpenBoardImporter"); #else // Windows does not allows to run easily an exe located in a subdirectory when the main diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 60c271ef..64e57691 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -596,7 +596,7 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in UBGraphicsPixmapItem* pixmapItem = qgraphicsitem_cast(item); if(pixmapItem){ - QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid().toString() + ".png"; + QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid() + ".png"; QString destination = source; QUuid newUuid = QUuid::createUuid(); QString fileName = QFileInfo(source).completeBaseName(); @@ -608,7 +608,7 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in UBGraphicsSvgItem* svgItem = qgraphicsitem_cast(item); if(svgItem){ - QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + svgItem->uuid().toString() + ".svg"; + QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + svgItem->uuid() + ".svg"; QString destination = source; QUuid newUuid = QUuid::createUuid(); QString fileName = QFileInfo(source).completeBaseName(); diff --git a/src/core/UBPreferencesController.cpp b/src/core/UBPreferencesController.cpp index f8d2ab90..1c2dc591 100644 --- a/src/core/UBPreferencesController.cpp +++ b/src/core/UBPreferencesController.cpp @@ -44,8 +44,6 @@ #include "core/memcheck.h" -#include "qdesktopwidget.h" - qreal UBPreferencesController::sSliderRatio = 10.0; qreal UBPreferencesController::sMinPenWidth = 0.5; qreal UBPreferencesController::sMaxPenWidth = 50.0; @@ -80,7 +78,7 @@ UBPreferencesController::UBPreferencesController(QWidget *parent) mPreferencesUI = new Ui::preferencesDialog(); // deleted in mPreferencesUI->setupUi(mPreferencesWindow); adjustScreens(1); - connect(mDesktop, &QDesktopWidget::screenCountChanged, this, &UBPreferencesController::adjustScreens); + connect(mDesktop, SIGNAL(screenCountChanged(int)), this, SLOT(adjustScreens(int))); wire(); } diff --git a/src/core/UBPreferencesController.h b/src/core/UBPreferencesController.h index fa15b255..96b64fed 100644 --- a/src/core/UBPreferencesController.h +++ b/src/core/UBPreferencesController.h @@ -29,7 +29,6 @@ #define UBPREFERENCESCONTROLLER_H_ #include -#include class UBColorPicker; class UBApplication; diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 64595ce1..dfddb796 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -306,7 +306,7 @@ void UBSettings::init() bool defaultShowPageImmediatelyOnMirroredScreen = true; -#if defined(Q_OS_LINUX) +#if defined(Q_WS_X11) // screen duplication is very slow on X11 defaultShowPageImmediatelyOnMirroredScreen = false; #endif @@ -334,22 +334,22 @@ void UBSettings::init() int defaultRefreshRateInFramePerSecond = 8; -#if defined(Q_OS_LINUX) +#if defined(Q_WS_X11) // screen duplication is very slow on X11 defaultRefreshRateInFramePerSecond = 2; #endif mirroringRefreshRateInFps = new UBSetting(this, "Mirroring", "RefreshRateInFramePerSecond", QVariant(defaultRefreshRateInFramePerSecond)); - lastImportFilePath = new UBSetting(this, "Import", "LastImportFilePath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); - lastImportFolderPath = new UBSetting(this, "Import", "LastImportFolderPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); - lastExportFilePath = new UBSetting(this, "Export", "LastExportFilePath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); - lastExportDirPath = new UBSetting(this, "Export", "LastExportDirPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); - lastImportToLibraryPath = new UBSetting(this, "Library", "LastImportToLibraryPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); + lastImportFilePath = new UBSetting(this, "Import", "LastImportFilePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastImportFolderPath = new UBSetting(this, "Import", "LastImportFolderPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastExportFilePath = new UBSetting(this, "Export", "LastExportFilePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastExportDirPath = new UBSetting(this, "Export", "LastExportDirPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastImportToLibraryPath = new UBSetting(this, "Library", "LastImportToLibraryPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); - lastPicturePath = new UBSetting(this, "Library", "LastPicturePath", QVariant(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation))); - lastWidgetPath = new UBSetting(this, "Library", "LastWidgetPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); - lastVideoPath = new UBSetting(this, "Library", "LastVideoPath", QVariant(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation))); + lastPicturePath = new UBSetting(this, "Library", "LastPicturePath", QVariant(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation))); + lastWidgetPath = new UBSetting(this, "Library", "LastWidgetPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); + lastVideoPath = new UBSetting(this, "Library", "LastVideoPath", QVariant(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation))); appOnlineUserName = new UBSetting(this, "App", "OnlineUserName", ""); @@ -790,7 +790,7 @@ QString UBSettings::userDataDirectory() qCritical() << "Impossible to create datadirpath " << dataDirPath; } - dataDirPath = UBFileSystemUtils::normalizeFilePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); + dataDirPath = UBFileSystemUtils::normalizeFilePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); dataDirPath.replace(qApp->organizationName() + "/", ""); } return dataDirPath; @@ -811,7 +811,7 @@ QString UBSettings::userImageDirectory() qCritical() << "failed to create image directory " << imageDirectory; } - imageDirectory = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/" + qApp->applicationName(); + imageDirectory = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation) + "/" + qApp->applicationName(); checkDirectory(imageDirectory); } return imageDirectory; @@ -832,10 +832,10 @@ QString UBSettings::userVideoDirectory() } - videoDirectory = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); + videoDirectory = QDesktopServices::storageLocation(QDesktopServices::MoviesLocation); if(videoDirectory.isEmpty()) - videoDirectory = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/" + tr("My Movies"); + videoDirectory = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation) + "/" + tr("My Movies"); else videoDirectory = videoDirectory + "/" + qApp->applicationName(); @@ -858,7 +858,7 @@ QString UBSettings::userAudioDirectory() qCritical() << "failed to create image directory " << audioDirectory; } - audioDirectory = QStandardPaths::writableLocation(QStandardPaths::MusicLocation) + "/" + qApp->applicationName(); + audioDirectory = QDesktopServices::storageLocation(QDesktopServices::MusicLocation) + "/" + qApp->applicationName(); checkDirectory(audioDirectory); } return audioDirectory; @@ -879,7 +879,7 @@ QString UBSettings::userPodcastRecordingDirectory() qCritical() << "failed to create dir " << dirPath; } - dirPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); + dirPath = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); checkDirectory(dirPath); } return dirPath; @@ -1246,13 +1246,13 @@ QString UBSettings::replaceWildcard(QString& path) QString result(path); if (result.startsWith("{Documents}")) { - result = result.replace("{Documents}", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); + result = result.replace("{Documents}", QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)); } else if(result.startsWith("{Home}")) { - result = result.replace("{Home}", QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + result = result.replace("{Home}", QDesktopServices::storageLocation(QDesktopServices::HomeLocation)); } else if(result.startsWith("{Desktop}")) { - result = result.replace("{Desktop}", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)); + result = result.replace("{Desktop}", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); } if(result.contains("{UserLoginName}") && UBPlatformUtils::osUserLoginName().length() > 0) { diff --git a/src/core/main.cpp b/src/core/main.cpp index 3cd783f8..43d7a7c8 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -45,21 +45,21 @@ #endif */ -void ub_message_output(QtMsgType type, const QMessageLogContext& context, const QString& msg) { +void ub_message_output(QtMsgType type, const char *msg) { // We must temporarily remove the handler to avoid the infinite recursion of // ub_message_output -> qt_message_output -> ub_message_output -> qt_message_output ... - QtMessageHandler previousHandler = qInstallMessageHandler(0); + QtMsgHandler previousHandler = qInstallMsgHandler(0); #if defined(QT_NO_DEBUG) // Suppress qDebug output in release builds if (type != QtDebugMsg) { - qt_message_output(type, context, msg); + qt_message_output(type, msg); } #else // Default output in debug builds - qt_message_output(type, context, msg); + qt_message_output(type, msg); #endif if (UBApplication::app() && UBApplication::app()->isVerbose()) { @@ -77,7 +77,7 @@ void ub_message_output(QtMsgType type, const QMessageLogContext& context, const } } - qInstallMessageHandler(previousHandler); + qInstallMsgHandler(previousHandler); } int main(int argc, char *argv[]) @@ -93,19 +93,25 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(OpenBoard); - qInstallMessageHandler(ub_message_output); + qInstallMsgHandler(ub_message_output); - - /* - * 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) +#if defined(Q_WS_X11) qDebug() << "Setting GraphicsSystem to raster"; QApplication::setGraphicsSystem("raster"); #endif - */ + 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(); QString dumpPath = UBSettings::userDataDirectory() + "/log"; @@ -132,7 +138,7 @@ int main(int argc, char *argv[]) } } - //app.initialize(false); // should not be needed anymore + app.initialize(false); QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&))); diff --git a/src/desktop/UBCustomCaptureWindow.cpp b/src/desktop/UBCustomCaptureWindow.cpp index 47eafdbe..cac54f37 100644 --- a/src/desktop/UBCustomCaptureWindow.cpp +++ b/src/desktop/UBCustomCaptureWindow.cpp @@ -24,9 +24,6 @@ -#include -#include -#include #include "UBCustomCaptureWindow.h" diff --git a/src/desktop/UBCustomCaptureWindow.h b/src/desktop/UBCustomCaptureWindow.h index af0c8b63..385b3ede 100644 --- a/src/desktop/UBCustomCaptureWindow.h +++ b/src/desktop/UBCustomCaptureWindow.h @@ -29,9 +29,6 @@ #define UBCUSTOMCAPTUREWINDOW_H_ #include -#include -#include - /** * This class is used to do the custom capture of Uninotes **/ diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 330093fe..20966319 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -80,7 +80,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast(0), false, true); // deleted in UBDesktopAnnotationController::destructor mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); #endif 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)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 connect(UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask())); connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), 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(&mHoldTimerEraser, SIGNAL(timeout()), this, SLOT(eraserActionReleased())); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 connect(mDesktopPalette, SIGNAL(moving()), this, SLOT(refreshMask())); connect(UBApplication::boardController->paletteManager()->rightPalette(), SIGNAL(resized()), this, SLOT(refreshMask())); connect(UBApplication::boardController->paletteManager()->addItemPalette(), SIGNAL(closed()), this, SLOT(refreshMask())); @@ -331,7 +331,7 @@ void UBDesktopAnnotationController::showWindow() UBDrawingController::drawingController()->setStylusTool(mDesktopStylusTool); -#ifndef Q_OS_LINUX +#ifndef Q_WS_X11 mTransparentDrawingView->showFullScreen(); #else // this is necessary to avoid unity to hide the panels @@ -341,7 +341,7 @@ void UBDesktopAnnotationController::showWindow() mDesktopPalette->appear(); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 updateMask(true); #endif } @@ -375,18 +375,18 @@ void UBDesktopAnnotationController::updateBackground() || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Selector) { newBrush = QBrush(Qt::transparent); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 updateMask(true); #endif } else { -#if defined(Q_OS_OSX) +#if defined(Q_WS_MAC) newBrush = QBrush(QColor(127, 127, 127, 15)); #else newBrush = QBrush(QColor(127, 127, 127, 1)); #endif -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 updateMask(false); #endif } @@ -430,7 +430,7 @@ void UBDesktopAnnotationController::customCapture() UBCustomCaptureWindow customCaptureWindow(mDesktopPalette); // need to show the window before execute it to avoid some glitch on windows. -#ifndef Q_OS_WIN // Working only without this call on win32 desktop mode +#ifndef Q_WS_WIN // Working only without this call on win32 desktop mode customCaptureWindow.show(); #endif @@ -901,7 +901,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent) p.drawRect(tabsPalette); } -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 //Rquiered only for compiz wm //TODO. Window manager detection screen diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index de53f032..b086ea2f 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -171,7 +171,7 @@ void UBDesktopPalette::minimizeMe(eMinimizedLocation location) adjustSizeAndPosition(); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 emit refreshMask(); #endif } @@ -201,7 +201,7 @@ void UBDesktopPalette::maximizeMe() // Notify that the maximization has been done emit maximized(); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 emit refreshMask(); #endif } diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index 6ed1f89d..5912f81f 100644 --- a/src/desktop/UBDesktopPalette.h +++ b/src/desktop/UBDesktopPalette.h @@ -55,9 +55,9 @@ class UBDesktopPalette : public UBActionPalette void windowClick(); void screenClick(); -//#ifdef Q_OS_LINUX //TODO: check why this produces an error on linux if uncommented +#ifdef Q_WS_X11 void refreshMask(); -//#endif +#endif public slots: diff --git a/src/desktop/UBWindowCapture_linux.cpp b/src/desktop/UBWindowCapture_linux.cpp index bc84b2ac..b360ebfe 100644 --- a/src/desktop/UBWindowCapture_linux.cpp +++ b/src/desktop/UBWindowCapture_linux.cpp @@ -24,7 +24,6 @@ -#include #include "UBWindowCapture.h" #include "UBDesktopAnnotationController.h" diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index a5a6685c..795b42a4 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -355,7 +355,7 @@ void UBDocumentController::setupViews() } } -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC mMainWindow->actionDelete->setShortcut(QKeySequence(Qt::Key_Backspace)); #endif @@ -394,7 +394,7 @@ void UBDocumentController::setupViews() mDocumentUI->thumbnailWidget->setBackgroundBrush(UBSettings::documentViewLightColor); - #ifdef Q_OS_OSX + #ifdef Q_WS_MACX mMessageWindow = new UBMessageWindow(NULL); #else mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget); @@ -1452,7 +1452,7 @@ void UBDocumentController::showMessage(const QString& message, bool showSpinning QRect newSize = mDocumentUI->thumbnailWidget->geometry(); - #ifdef Q_OS_OSX + #ifdef Q_WS_MACX QPoint point(newSize.left() + margin, newSize.bottom() - mMessageWindow->height() - margin); mMessageWindow->move(mDocumentUI->thumbnailWidget->mapToGlobal(point)); #else diff --git a/src/document/UBDocumentController.h b/src/document/UBDocumentController.h index 7fc70926..786d2829 100644 --- a/src/document/UBDocumentController.h +++ b/src/document/UBDocumentController.h @@ -29,7 +29,6 @@ #define UBDOCUMENTCONTROLLER_H_ #include -#include #include "document/UBDocumentContainer.h" namespace Ui diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index 40a46074..77f45e9d 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -832,10 +832,9 @@ void UBGraphicsDelegateFrame::positionHandles() } resetTransform(); - setTransform(QTransform::fromTranslate(center.x(), center.y()), true); - setTransform(QTransform().rotate(-angle), true); - setTransform(QTransform::fromTranslate(-center.x(), -center.y()), true); - //TODO: combine these transforms into one + translate(center.x(), center.y()); + rotate(-angle); + translate(-center.x(), -center.y()); mBottomRightResizeGripSvgItem->setParentItem(this); mBottomResizeGripSvgItem->setParentItem(this); diff --git a/src/domain/UBGraphicsGroupContainerItem.cpp b/src/domain/UBGraphicsGroupContainerItem.cpp index 3e9e1012..ccb7795f 100644 --- a/src/domain/UBGraphicsGroupContainerItem.cpp +++ b/src/domain/UBGraphicsGroupContainerItem.cpp @@ -297,7 +297,7 @@ QVariant UBGraphicsGroupContainerItem::itemChange(GraphicsItemChange change, con { QVariant newValue = Delegate()->itemChange(change, value); - foreach(QGraphicsItem *child, childItems()) + foreach(QGraphicsItem *child, children()) { UBGraphicsItem *item = dynamic_cast(child); if (item) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index a8271e34..9c45ce27 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -771,7 +771,7 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated) qreal topXTitleBar = topX + (1.6 * mFrameWidth * mAntiScaleRatio); qreal topYTitleBar = topY + frameButtonHeight *mAntiScaleRatio; -#ifndef Q_OS_LINUX +#ifndef Q_WS_X11 topYTitleBar += 5; #endif @@ -792,7 +792,7 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated) button->setParentItem(mFrame); button->setPos(topXTitleBar + (k++ * (frameButtonHeight + 5)), topYTitleBar); button->setTransform(tr); - button->setTransform(QTransform::fromScale(0.8, 0.8), true); + button->scale(0.8,0.8); } else if(button->getSection() == Qt::NoSection){ ++l; @@ -1442,7 +1442,7 @@ void DelegateMediaControl::seekToMousePos(QPointF mousePos) && mDelegate->mediaObject() && mDelegate->mediaObject()->isSeekable()) { qint64 tickPos = (mTotalTimeInMs/length)* (mouseX - minX); - mDelegate->mediaObject()->setPosition(tickPos); + mDelegate->mediaObject()->seek(tickPos); //OSX is a bit lazy updateTicker(tickPos); diff --git a/src/domain/UBGraphicsMediaItem.cpp b/src/domain/UBGraphicsMediaItem.cpp index e4ea11a8..4e4829cd 100644 --- a/src/domain/UBGraphicsMediaItem.cpp +++ b/src/domain/UBGraphicsMediaItem.cpp @@ -49,13 +49,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte { update(); - - //mMediaObject = new Phonon::MediaObject(this); - mMediaObject = new QMediaPlayer(this); - - //playlist = new QMediaPlaylist; - //mMediaObject->setPlaylist(playlist); - + mMediaObject = new Phonon::MediaObject(this); QString mediaPath = pMediaFileUrl.toString(); if ("" == mediaPath) @@ -65,23 +59,10 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte { mMediaType = mediaType_Video; - //mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this); - QAudioFormat format; // to define - format.setByteOrder(QAudioFormat::LittleEndian); - 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); + mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this); + mMediaObject->setTickInterval(50); + mVideoWidget = new Phonon::VideoWidget(); // owned and destructed by the scene ... + Phonon::createPath(mMediaObject, mVideoWidget); if(mVideoWidget->sizeHint() == QSize(1,1)){ mVideoWidget->resize(320,240); @@ -91,19 +72,11 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte haveLinkedImage = true; } - else if (mediaPath.toLower().contains("audios")) - { + else if (mediaPath.toLower().contains("audios")){ mMediaType = mediaType_Audio; + mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); - 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); + mMediaObject->setTickInterval(1000); mAudioWidget = new QWidget(); mAudioWidget->resize(320,26); mAudioWidget->setMinimumSize(150,26); @@ -111,17 +84,16 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte haveLinkedImage = false; } - //Phonon::createPath(mMediaObject, mAudioOutput); - //mSource = Phonon::MediaSource(pMediaFileUrl); - - //mMediaObject->setCurrentSource(mSource); - mMediaObject->setMedia(pMediaFileUrl); + Phonon::createPath(mMediaObject, mAudioOutput); + mSource = Phonon::MediaSource(pMediaFileUrl); + mMediaObject->setCurrentSource(mSource); // we should create delegate after media objects because delegate uses his properties at creation. setDelegate(new UBGraphicsMediaItemDelegate(this, mMediaObject)); + // delegate should be created earler because we setWidget calls resize event for graphics proxy widgt. // resize uses delegate. if (mediaType_Video == mMediaType) @@ -187,11 +159,7 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria absoluteMediaFilename = mMediaFileUrl.toLocalFile(); if (absoluteMediaFilename.length() > 0) - //mMediaObject->setCurrentSource(QMediaSource(absoluteMediaFilename)); - mMediaObject->setMedia(QUrl::fromLocalFile(absoluteMediaFilename)); - - - + mMediaObject->setCurrentSource(Phonon::MediaSource(absoluteMediaFilename)); } } @@ -235,9 +203,7 @@ void UBGraphicsMediaItem::hasMediaChanged(bool hasMedia) { if(hasMedia && mMediaObject->isSeekable()) { - //mMediaObject->seek(mInitialPos); - mMediaObject->setPosition(mInitialPos); - + mMediaObject->seek(mInitialPos); UBGraphicsMediaItemDelegate *med = dynamic_cast(Delegate()); if (med) med->updateTicker(initialPos()); @@ -352,8 +318,7 @@ void UBGraphicsMediaItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QPointF eventPos = mapFromScene( event->scenePos()); QPointF translation = eventPos - mouseMovePos; - //translate(translation.x(), translation.y()); - setPos(translation.x(), translation.y()); + translate(translation.x(), translation.y()); } mMouseMovePos = event->scenePos(); diff --git a/src/domain/UBGraphicsMediaItem.h b/src/domain/UBGraphicsMediaItem.h index 31ea7175..e580021c 100644 --- a/src/domain/UBGraphicsMediaItem.h +++ b/src/domain/UBGraphicsMediaItem.h @@ -28,20 +28,10 @@ #ifndef UBGRAPHICSMEDIAITEM_H #define UBGRAPHICSMEDIAITEM_H -#include #include "UBGraphicsProxyWidget.h" -//#include -//#include -//#include - -#include -#include -#include -#include - -#include -#include - +#include +#include +#include #include "core/UBApplication.h" #include "board/UBBoardController.h" #include "frameworks/UBFileSystemUtils.h" @@ -73,9 +63,7 @@ public: virtual void mediaFileUrl(QUrl url){mMediaFileUrl=url;} - //Phonon::MediaObject* mediaObject() const - QMediaPlayer* mediaObject() const - + Phonon::MediaObject* mediaObject() const { return mMediaObject; } @@ -92,9 +80,7 @@ public: return mMuted; } - // Phonon::VideoWidget* videoWidget() const - QVideoWidget* videoWidget() const - + Phonon::VideoWidget* videoWidget() const { return mVideoWidget; } @@ -129,18 +115,10 @@ protected: virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void clearSource(); - //Phonon::MediaObject *mMediaObject; - //Phonon::VideoWidget *mVideoWidget; - //Phonon::AudioOutput *mAudioOutput; - //Phonon::MediaSource mSource; - - QMediaPlayer *mMediaObject; - QMediaPlaylist *playlist; - QVideoWidget *mVideoWidget; -// QAudioOutput *mAudioOutput; - QMediaPlayer *mAudioOutput; - QMediaService *mSource; - + Phonon::MediaObject *mMediaObject; + Phonon::VideoWidget *mVideoWidget; + Phonon::AudioOutput *mAudioOutput; + Phonon::MediaSource mSource; QWidget *mAudioWidget; private: diff --git a/src/domain/UBGraphicsMediaItemDelegate.cpp b/src/domain/UBGraphicsMediaItemDelegate.cpp index 0c7c0683..4bea2953 100644 --- a/src/domain/UBGraphicsMediaItemDelegate.cpp +++ b/src/domain/UBGraphicsMediaItemDelegate.cpp @@ -43,7 +43,7 @@ #include "core/memcheck.h" -UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaPlayer* pMedia, QObject * parent) +UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent) : UBGraphicsItemDelegate(pDelegated, parent, GF_COMMON | GF_RESPECT_RATIO | GF_TOOLBAR_USED @@ -56,22 +56,11 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD QPalette palette; palette.setBrush ( QPalette::Light, Qt::darkGray ); - mMedia->setNotifyInterval(50); - - connect(mMedia, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), - this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus))); - - connect(mMedia, SIGNAL(stateChanged(QMediaPlayer::State)), - this, SLOT(mediaStateChanged(QMediaPlayer::State))); - - connect(mMedia, static_cast(&QMediaPlayer::error), - this, &UBGraphicsMediaItemDelegate::mediaError); - - connect(mMedia, SIGNAL(positionChanged(qint64)), - this, SLOT(updateTicker(qint64))); - - connect(mMedia, SIGNAL(durationChanged(qint64)), - this, SLOT(totalTimeChanged(qint64))); + mMedia->setTickInterval(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(tick(qint64)), this, SLOT(updateTicker(qint64))); + connect(mMedia, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); if (delegated()->hasLinkedImage()) { @@ -106,12 +95,10 @@ void UBGraphicsMediaItemDelegate::buildButtons() { if(!mPlayPauseButton){ 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); - connect(mStopButton, SIGNAL(clicked(bool)), - mMedia, SLOT(stop())); + connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop())); mMediaControl = new DelegateMediaControl(delegated(), mToolBarItem); mMediaControl->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -122,10 +109,8 @@ void UBGraphicsMediaItemDelegate::buildButtons() else mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); - connect(mMuteButton, SIGNAL(clicked(bool)), - delegated(), SLOT(toggleMute())); - connect(mMuteButton, SIGNAL(clicked(bool)), - this, SLOT(toggleMute())); // for changing button image + connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); + connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); // for changing button image mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton; @@ -135,17 +120,10 @@ void UBGraphicsMediaItemDelegate::buildButtons() if (mToolBarShowTimer) { - connect(mPlayPauseButton, 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())); + connect(mPlayPauseButton, 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())); } @@ -217,82 +195,55 @@ UBGraphicsMediaItem* UBGraphicsMediaItemDelegate::delegated() return dynamic_cast(mDelegated); } + void UBGraphicsMediaItemDelegate::togglePlayPause() { if (delegated() && delegated()->mediaObject()) { - QMediaPlayer * media = delegated()->mediaObject(); - - if (media->state() == QMediaPlayer::StoppedState) + Phonon::MediaObject* media = delegated()->mediaObject(); + if (media->state() == Phonon::StoppedState) { media->play(); - - else if (media->state() == QMediaPlayer::PlayingState) { - - if ((media->duration() - media->position()) <= 0) { + } else if (media->state() == Phonon::PlayingState) { + if (media->remainingTime() <= 0) { media->stop(); media->play(); - } - - else { + } else { media->pause(); if(delegated()->scene()) delegated()->scene()->setModified(true); } - } - - else if (media->state() == QMediaPlayer::PausedState) { - if ((media->duration() - media->position()) <= 0) + } else if (media->state() == Phonon::PausedState) { + if (media->remainingTime() <= 0) { media->stop(); - + } media->play(); - } - - else if ( media->mediaStatus() == QMediaPlayer::LoadingMedia) { - delegated()->mediaObject()->setMedia(delegated()->mediaFileUrl()); + } else if ( media->state() == Phonon::LoadingState ) { + delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl()); media->play(); - } - - else if (media->error()) + } else if (media->state() == Phonon::ErrorState){ qDebug() << "Error appeared." << media->errorString(); - + } } } -void UBGraphicsMediaItemDelegate::mediaStatusChanged(QMediaPlayer::MediaStatus status) -{ - // Possible statuses are: UnknownMediaStatus, NoMedia, LoadingMedia, LoadedMedia, - // StalledMedia, BufferingMedia, BufferedMedia, EndOfMedia, InvalidMedia - - if (status == QMediaPlayer::LoadedMedia) - mMediaControl->totalTimeChanged(delegated()->mediaObject()->duration()); - - // in most cases, the only necessary action is to update the play/pause state - updatePlayPauseState(); -} - -void UBGraphicsMediaItemDelegate::mediaStateChanged(QMediaPlayer::State state) +void UBGraphicsMediaItemDelegate::mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ) { - // Possible states are StoppedState, PlayingState and PausedState + Q_UNUSED(newstate); + Q_UNUSED(oldstate); - // updatePlayPauseState handles this functionality + if (oldstate == Phonon::LoadingState) + { + mMediaControl->totalTimeChanged(delegated()->mediaObject()->totalTime()); + } 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() { - QMediaPlayer * media = delegated()->mediaObject(); + Phonon::MediaObject* media = delegated()->mediaObject(); - if (media->state() == QMediaPlayer::PlayingState) + if (media->state() == Phonon::PlayingState) mPlayPauseButton->setFileName(":/images/pause.svg"); else mPlayPauseButton->setFileName(":/images/play.svg"); @@ -301,8 +252,8 @@ void UBGraphicsMediaItemDelegate::updatePlayPauseState() void UBGraphicsMediaItemDelegate::updateTicker(qint64 time) { - QMediaPlayer* media = delegated()->mediaObject(); - mMediaControl->totalTimeChanged(media->duration()); + Phonon::MediaObject* media = delegated()->mediaObject(); + mMediaControl->totalTimeChanged(media->totalTime()); mMediaControl->updateTicker(time); } diff --git a/src/domain/UBGraphicsMediaItemDelegate.h b/src/domain/UBGraphicsMediaItemDelegate.h index 8cb47b3b..1e9d858c 100644 --- a/src/domain/UBGraphicsMediaItemDelegate.h +++ b/src/domain/UBGraphicsMediaItemDelegate.h @@ -29,8 +29,8 @@ #define UBGRAPHICSMEDIAITEMDELEGATE_H_ #include +#include #include -#include #include "core/UB.h" #include "UBGraphicsItemDelegate.h" @@ -43,12 +43,12 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate Q_OBJECT public: - UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaPlayer* pMedia, QObject * parent = 0); + UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent = 0); virtual ~UBGraphicsMediaItemDelegate(); virtual void positionHandles(); - bool mousePressEvent(QGraphicsSceneMouseEvent* event); + bool mousePressEvent(QGraphicsSceneMouseEvent *event); public slots: @@ -61,18 +61,14 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate void togglePlayPause(); + void mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ); + void updatePlayPauseState(); void totalTimeChanged(qint64 newTotalTime); void hideToolBar(); - void mediaStatusChanged(QMediaPlayer::MediaStatus status); - - void mediaStateChanged(QMediaPlayer::State state); - - void mediaError(QMediaPlayer::Error error); - protected: virtual void buildButtons(); @@ -81,11 +77,11 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate DelegateButton* mPlayPauseButton; DelegateButton* mStopButton; DelegateButton* mMuteButton; - DelegateMediaControl* mMediaControl; + DelegateMediaControl *mMediaControl; - QMediaPlayer* mMedia; // mMedia belongs to the associated UBGraphicsMediaItem (mDelegated) + Phonon::MediaObject* mMedia; - QTimer* mToolBarShowTimer; + QTimer *mToolBarShowTimer; int m_iToolBarShowingInterval; }; diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 78284a86..66e37abf 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1264,7 +1264,7 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, QGraphi UBApplication::undoStack->push(uc); } - pixmapItem->setTransform(QTransform::fromScale(pScaleFactor, pScaleFactor), true); + pixmapItem->scale(pScaleFactor, pScaleFactor); if (pUseAnimation) { @@ -1340,7 +1340,7 @@ UBGraphicsMediaItem* UBGraphicsScene::addMedia(const QUrl& pMediaFileUrl, bool s if (!shouldPlayAsap) { mediaItem->mediaObject()->pause(); - mediaItem->mediaObject()->setPosition(0); + mediaItem->mediaObject()->seek(0); } setDocumentUpdated(); @@ -1403,7 +1403,7 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co qreal ssf = 1 / UBApplication::boardController->systemScaleFactor(); - graphicsWidget->setTransform(QTransform::fromScale(ssf, ssf), true); + graphicsWidget->scale(ssf, ssf); graphicsWidget->setPos(QPointF(pPos.x() - graphicsWidget->boundingRect().width() / 2, pPos.y() - graphicsWidget->boundingRect().height() / 2)); @@ -1530,7 +1530,7 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true); qreal sscale = 1 / UBApplication::boardController->systemScaleFactor(); - svgItem->setTransform(QTransform::fromScale(sscale, sscale), true); + svgItem->scale(sscale, sscale); QPointF half(svgItem->boundingRect().width() / 2, svgItem->boundingRect().height() / 2); svgItem->setPos(pPos - half); @@ -1860,7 +1860,7 @@ QGraphicsItem* UBGraphicsScene::scaleToFitDocumentSize(QGraphicsItem* item, bool { qreal ratio = qMin(maxWidth / size.width(), maxHeight / size.height()); - item->setTransform(QTransform::fromScale(ratio, ratio), true); + item->scale(ratio, ratio); if(center) { diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp index 9ec12d59..5beead86 100644 --- a/src/domain/UBGraphicsWidgetItem.cpp +++ b/src/domain/UBGraphicsWidgetItem.cpp @@ -27,7 +27,6 @@ #include #include -#include #include "UBGraphicsWidgetItem.h" #include "UBGraphicsScene.h" @@ -122,8 +121,7 @@ void UBGraphicsWidgetItem::initialize() page()->setPalette(palette); page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); - connect(page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared, - this, &UBGraphicsWidgetItem::javaScriptWindowObjectCleared); + connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared())); connect(page(), SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested(const QRect&))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(mainFrameLoadFinished (bool))); connect(page()->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayoutCompleted())); diff --git a/src/domain/UBGraphicsWidgetItem.h b/src/domain/UBGraphicsWidgetItem.h index ab2633fe..3d84b09a 100644 --- a/src/domain/UBGraphicsWidgetItem.h +++ b/src/domain/UBGraphicsWidgetItem.h @@ -31,7 +31,6 @@ #include #include #include -#include #include "core/UB.h" diff --git a/src/domain/UBSelectionFrame.cpp b/src/domain/UBSelectionFrame.cpp index 89da1c6d..72708dca 100644 --- a/src/domain/UBSelectionFrame.cpp +++ b/src/domain/UBSelectionFrame.cpp @@ -157,7 +157,7 @@ void UBSelectionFrame::mousePressEvent(QGraphicsSceneMouseEvent *event) mLastTranslateOffset = QPointF(); mRotationAngle = 0; - if (scene()->itemAt(event->scenePos(), transform()) == mRotateButton) { + if (scene()->itemAt(event->scenePos()) == mRotateButton) { mOperationMode = om_rotating; } else { mOperationMode = om_moving; diff --git a/src/domain/UBUndoCommand.h b/src/domain/UBUndoCommand.h index a59e13a4..1d899354 100644 --- a/src/domain/UBUndoCommand.h +++ b/src/domain/UBUndoCommand.h @@ -29,7 +29,6 @@ #define UBABSTRACTUNDOCOMMAND_H_ #include -#include #include class UBUndoCommand : public QUndoCommand diff --git a/src/frameworks/UBBase32.cpp b/src/frameworks/UBBase32.cpp index 92f755d2..dda8a502 100644 --- a/src/frameworks/UBBase32.cpp +++ b/src/frameworks/UBBase32.cpp @@ -53,7 +53,7 @@ QByteArray UBBase32::decode(const QString& base32String) for (i = 0, index = 0, offset = 0; i < base32String.length(); i++) { QChar ch = base32String.at(i); - char lookup = ch.toLatin1() - '0'; + char lookup = ch.toAscii() - '0'; /* Skip chars outside the lookup table */ if (lookup < 0 || lookup >= 80) diff --git a/src/frameworks/UBCoreGraphicsScene.h b/src/frameworks/UBCoreGraphicsScene.h index 281ac820..38de69eb 100644 --- a/src/frameworks/UBCoreGraphicsScene.h +++ b/src/frameworks/UBCoreGraphicsScene.h @@ -29,8 +29,6 @@ #define UBCOREGRAPHICSSCENE_H_ #include -#include -#include class UBCoreGraphicsScene : public QGraphicsScene { diff --git a/src/frameworks/UBCryptoUtils.cpp b/src/frameworks/UBCryptoUtils.cpp index f35d0f2c..214ad72f 100644 --- a/src/frameworks/UBCryptoUtils.cpp +++ b/src/frameworks/UBCryptoUtils.cpp @@ -92,13 +92,13 @@ QString UBCryptoUtils::symetricEncrypt(const QString& clear) free(ciphertext); - return QString::fromLatin1(cipheredData.toBase64()); + return QString::fromAscii(cipheredData.toBase64()); } QString UBCryptoUtils::symetricDecrypt(const QString& encrypted) { - QByteArray encryptedData = QByteArray::fromBase64(encrypted.toLatin1()); + QByteArray encryptedData = QByteArray::fromBase64(encrypted.toAscii()); int encryptedLength = encryptedData.length(); int paddingLength = 0; @@ -132,10 +132,10 @@ void UBCryptoUtils::aesInit() { int i, nrounds = 5; unsigned char key[32], iv[32]; - unsigned char *key_data = (unsigned char *)sAESKey.toLatin1().data(); + unsigned char *key_data = (unsigned char *)sAESKey.toAscii().data(); int key_data_len = sAESKey.length(); - i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), (unsigned char *)sAESSalt.toLatin1().data(), key_data, + i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), (unsigned char *)sAESSalt.toAscii().data(), key_data, key_data_len, nrounds, key, iv); if (i != 32) diff --git a/src/frameworks/UBFileSystemUtils.cpp b/src/frameworks/UBFileSystemUtils.cpp index d70e8df3..7bbfc876 100644 --- a/src/frameworks/UBFileSystemUtils.cpp +++ b/src/frameworks/UBFileSystemUtils.cpp @@ -57,7 +57,7 @@ UBFileSystemUtils::~UBFileSystemUtils() QString UBFileSystemUtils::removeLocalFilePrefix(QString input) { -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN if(input.startsWith("file:///")) return input.mid(8); else @@ -130,12 +130,12 @@ bool UBFileSystemUtils::deleteFile(const QString &path) QString UBFileSystemUtils::defaultTempDirPath() { - return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/" + defaultTempDirName(); + return QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/" + defaultTempDirName(); } QString UBFileSystemUtils::createTempDir(const QString& templateString, bool autoDeleteOnExit) { - QString appTempDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + QString appTempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/" + templateString; int index = 0; @@ -200,7 +200,7 @@ void UBFileSystemUtils::deleteAllTempDirCreatedDuringSession() void UBFileSystemUtils::cleanupGhostTempFolders(const QString& templateString) { - QDir dir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); + QDir dir(QDesktopServices::storageLocation(QDesktopServices::TempLocation)); foreach (QFileInfo dirContent, dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden , QDir::Name)) { diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index c7b99bc1..4d3671c4 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -204,7 +204,7 @@ public: static QString urlFromClipboard(); static QStringList availableTranslations(); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC static void SetMacLocaleByIdentifier(const QString& id); #endif }; diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index 73e901a0..5def77c3 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -28,7 +28,6 @@ #include "UBPlatformUtils.h" #include -#include #include #include @@ -99,7 +98,7 @@ void UBPlatformUtils::bringPreviousProcessToFront() QString UBPlatformUtils::osUserLoginName() { char *user = getenv("USER"); - return QString::fromLatin1(user); + return QString::fromAscii(user); } QString UBPlatformUtils::computerName() @@ -109,7 +108,7 @@ QString UBPlatformUtils::computerName() // 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 if(!gethostname(hostname,255)) - return QString::fromLatin1(hostname); + return QString::fromAscii(hostname); else return "NOT FOUND"; } diff --git a/src/globals/UBGlobals.h b/src/globals/UBGlobals.h index 89c6d272..8b31775a 100644 --- a/src/globals/UBGlobals.h +++ b/src/globals/UBGlobals.h @@ -45,7 +45,7 @@ setStyleSheet(style);\ } -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN #define WARNINGS_DISABLE __pragma(warning(push, 0)); #define WARNINGS_ENABLE __pragma(warning(pop)); @@ -58,7 +58,7 @@ #define THIRD_PARTY_WARNINGS_DISABLE __pragma(warning(push)); #endif //#ifdef NO_THIRD_PARTY_WARNINGS -#else //#ifdef Q_OS_WIN +#else //#ifdef Q_WS_WIN #define WARNINGS_DISABLE _Pragma("GCC diagnostic push"); \ _Pragma("GCC diagnostic ignored \"-Wunused-parameter\""); \ @@ -76,7 +76,7 @@ _Pragma("GCC diagnostic ignored \"-Wsign-compare\""); #endif //#ifdef NO_THIRD_PARTY_WARNINGS -#endif //#ifdef Q_OS_WIN +#endif //#ifdef Q_WS_WIN // anyway on any OS #define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE diff --git a/src/gui/UBActionPalette.cpp b/src/gui/UBActionPalette.cpp index 2eb69dae..b636cd5a 100644 --- a/src/gui/UBActionPalette.cpp +++ b/src/gui/UBActionPalette.cpp @@ -23,8 +23,7 @@ */ -#include -#include + #include "UBActionPalette.h" @@ -104,10 +103,8 @@ UBActionPaletteButton* UBActionPalette::createPaletteButton(QAction* action, QWi mMapActionToButton[action] = button; - connect(button, &UBActionPaletteButton::clicked, - this, &UBActionPalette::buttonClicked); - connect(action, &QAction::changed, - this, &UBActionPalette::actionChanged); + connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked())); + connect(action, SIGNAL(changed()), this, SLOT(actionChanged())); return button; } diff --git a/src/gui/UBActionPalette.h b/src/gui/UBActionPalette.h index ed18d602..fb909f5a 100644 --- a/src/gui/UBActionPalette.h +++ b/src/gui/UBActionPalette.h @@ -31,8 +31,6 @@ #include #include #include -#include - #include "UBFloatingPalette.h" class UBActionPaletteButton; diff --git a/src/gui/UBCircleFrame.h b/src/gui/UBCircleFrame.h index ec61e025..d4c0af81 100644 --- a/src/gui/UBCircleFrame.h +++ b/src/gui/UBCircleFrame.h @@ -29,7 +29,6 @@ #define UBCIRCLEFRAME_H_ #include -#include class UBCircleFrame : public QFrame { diff --git a/src/gui/UBColorPicker.h b/src/gui/UBColorPicker.h index d8894cc4..157e863e 100644 --- a/src/gui/UBColorPicker.h +++ b/src/gui/UBColorPicker.h @@ -29,7 +29,6 @@ #define UBCOLORPICKER_H_ #include -#include class UBColorPicker : public QFrame { diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index f8bfbc1d..ea17d00d 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -654,9 +654,9 @@ void UBTabDockPalette::paintEvent(QPaintEvent *) } painter.save(); - //QPixmap transparencyPix(":/images/tab_mask.png"); + QPixmap transparencyPix(":/images/tab_mask.png"); if (dock->mCurrentTab != i) { - //iconPixmap.setAlphaChannel(transparencyPix); // deprecated; removed for now, to be re-implemented + iconPixmap.setAlphaChannel(transparencyPix); QColor color(0x7F, 0x7F, 0x7F, 0x3F); painter.setBrush(QBrush(color)); } diff --git a/src/gui/UBDocumentThumbnailWidget.cpp b/src/gui/UBDocumentThumbnailWidget.cpp index 66d6efea..be601471 100644 --- a/src/gui/UBDocumentThumbnailWidget.cpp +++ b/src/gui/UBDocumentThumbnailWidget.cpp @@ -190,8 +190,7 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) if (!mDropCaretRectItem && selectedItems().count() < mGraphicItems.count()) { - mDropCaretRectItem = new QGraphicsRectItem(0); - scene()->addItem(mDropCaretRectItem); + mDropCaretRectItem = new QGraphicsRectItem(0, scene()); mDropCaretRectItem->setPen(QPen(Qt::darkGray)); mDropCaretRectItem->setBrush(QBrush(Qt::lightGray)); } diff --git a/src/gui/UBDocumentTreeWidget.h b/src/gui/UBDocumentTreeWidget.h index af78fe56..2f336307 100644 --- a/src/gui/UBDocumentTreeWidget.h +++ b/src/gui/UBDocumentTreeWidget.h @@ -29,7 +29,6 @@ #define UBDOCUMENTTREEWIDGET_H_ #include -#include class UBDocumentProxy; class UBDocumentProxyTreeItem; diff --git a/src/gui/UBDownloadWidget.cpp b/src/gui/UBDownloadWidget.cpp index 71c0b695..a1f3092f 100644 --- a/src/gui/UBDownloadWidget.cpp +++ b/src/gui/UBDownloadWidget.cpp @@ -61,8 +61,8 @@ UBDownloadWidget::UBDownloadWidget(QWidget *parent, const char *name):QWidget(pa mpTree->setRootIsDecorated(false); mpTree->setColumnCount(2); mpTree->header()->setStretchLastSection(false); - mpTree->header()->setSectionResizeMode(eItemColumn_Desc, QHeaderView::Stretch); - mpTree->header()->setSectionResizeMode(eItemColumn_Close, QHeaderView::Custom); + mpTree->header()->setResizeMode(eItemColumn_Desc, QHeaderView::Stretch); + mpTree->header()->setResizeMode(eItemColumn_Close, QHeaderView::Custom); mpTree->resizeColumnToContents(eItemColumn_Close); mpTree->header()->close(); mpLayout->addWidget(mpTree, 1); diff --git a/src/gui/UBFeaturesActionBar.cpp b/src/gui/UBFeaturesActionBar.cpp index 3ffec315..c59ac6b2 100644 --- a/src/gui/UBFeaturesActionBar.cpp +++ b/src/gui/UBFeaturesActionBar.cpp @@ -23,8 +23,7 @@ */ -#include -#include + #include "UBFeaturesActionBar.h" #include "core/memcheck.h" diff --git a/src/gui/UBFeaturesActionBar.h b/src/gui/UBFeaturesActionBar.h index c27cbf89..409b5963 100644 --- a/src/gui/UBFeaturesActionBar.h +++ b/src/gui/UBFeaturesActionBar.h @@ -31,9 +31,6 @@ #include #include #include -#include -#include - #include "board/UBFeaturesController.h" #define BUTTON_SIZE 24 diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 23c5f162..8c791061 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -27,8 +27,6 @@ #include #include -#include -#include #include "UBFeaturesWidget.h" #include "gui/UBThumbnailWidget.h" @@ -269,8 +267,8 @@ void UBFeaturesWidget::onDisplayMetadata( QMap metadata ) { QString previewImageUrl = ":images/libpalette/notFound.png"; - QString widgetsUrl = QUrl::fromEncoded(metadata["Url"].toLatin1()).toString()/*metadata.value("Url", QString())*/; - QString widgetsThumbsUrl = QUrl::fromEncoded(metadata["thumbnailUrl"].toLatin1()).toString(); + QString widgetsUrl = QUrl::fromEncoded(metadata["Url"].toAscii()).toString()/*metadata.value("Url", QString())*/; + QString widgetsThumbsUrl = QUrl::fromEncoded(metadata["thumbnailUrl"].toAscii()).toString(); QString strType = UBFileSystemUtils::mimeTypeFromFileName(widgetsUrl); UBMimeType::Enum thumbType = UBFileSystemUtils::mimeTypeFromString(strType); @@ -442,7 +440,7 @@ void UBFeaturesListView::dragMoveEvent( QDragMoveEvent *event ) void UBFeaturesListView::dropEvent( QDropEvent *event ) { - QObject *eventSource = event->source(); + QWidget *eventSource = event->source(); if (eventSource && eventSource->objectName() == UBFeaturesWidget::objNameFeatureList) { event->setDropAction( Qt::MoveAction ); } @@ -1174,7 +1172,7 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const if (!typeData.isNull()) { typeData += UBFeaturesController::featureTypeSplitter(); } - typeData += QString::number(element.getType()).toLatin1(); + typeData += QString::number(element.getType()).toAscii(); } } diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index f9f67a47..d2b2a966 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -41,10 +41,6 @@ #include #include #include -#include -#include -#include -#include #include "UBDockPaletteWidget.h" #include "core/UBSettings.h" @@ -397,8 +393,6 @@ public: 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 supportedDragActions() const { return Qt::MoveAction | Qt::CopyAction; } - // void setFeaturesList(QList *flist ) { featuresList = flist; } public slots: diff --git a/src/gui/UBFloatingPalette.cpp b/src/gui/UBFloatingPalette.cpp index 749320c2..d01a88fe 100644 --- a/src/gui/UBFloatingPalette.cpp +++ b/src/gui/UBFloatingPalette.cpp @@ -54,11 +54,11 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent) { // standalone window // !!!! Should be included into Windows after QT recompilation -#ifndef Q_OS_WIN +#ifndef Q_WS_WIN setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_MacAlwaysShowToolWindow); #endif -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacNonActivatingToolWindow); setAttribute(Qt::WA_MacNoShadow); diff --git a/src/gui/UBMagnifer.cpp b/src/gui/UBMagnifer.cpp index b6ce41cf..4f242f4b 100644 --- a/src/gui/UBMagnifer.cpp +++ b/src/gui/UBMagnifer.cpp @@ -79,11 +79,11 @@ UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive) { // standalone window // !!!! Should be included into Windows after QT recompilation -#ifndef Q_OS_WIN +#ifndef Q_WS_WIN // setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_MacAlwaysShowToolWindow); #endif -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacNonActivatingToolWindow); setAttribute(Qt::WA_MacNoShadow); diff --git a/src/gui/UBMagnifer.h b/src/gui/UBMagnifer.h index 0e942605..fcc13a8b 100644 --- a/src/gui/UBMagnifer.h +++ b/src/gui/UBMagnifer.h @@ -29,7 +29,6 @@ #define UBMAGNIFIER_H #include -#include class UBMagnifierParams { diff --git a/src/gui/UBMainWindow.cpp b/src/gui/UBMainWindow.cpp index 5269c5dd..93292c26 100644 --- a/src/gui/UBMainWindow.cpp +++ b/src/gui/UBMainWindow.cpp @@ -26,8 +26,6 @@ #include -#include -#include #include "UBMainWindow.h" #include "core/UBApplication.h" @@ -36,7 +34,7 @@ #include "core/UBDisplayManager.h" // work around for handling tablet events on MAC OS with Qt 4.8.0 and above -#if defined(Q_OS_OSX) +#if defined(Q_WS_MACX) #include "board/UBBoardView.h" #endif @@ -64,10 +62,10 @@ UBMainWindow::UBMainWindow(QWidget *parent, Qt::WindowFlags flags) mStackedLayout = new QStackedLayout(centralWidget); setCentralWidget(centralWidget); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC actionPreferences->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Comma)); actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); -#elif defined(Q_OS_WIN) +#elif defined(Q_WS_WIN) 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 actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4)); @@ -150,7 +148,7 @@ void UBMainWindow::closeEvent(QCloseEvent *event) } // work around for handling tablet events on MAC OS with Qt 4.8.0 and above -#if defined(Q_OS_OSX) +#if defined(Q_WS_MACX) bool UBMainWindow::event(QEvent *event) { bool bRes = QMainWindow::event(event); @@ -201,7 +199,7 @@ bool UBMainWindow::yesNoQuestion(QString windowTitle, QString text) messageBox.addButton(tr("No"),QMessageBox::NoRole); messageBox.setIcon(QMessageBox::Question); -#ifdef Q_OS_LINUX +#ifdef Q_WS_X11 // 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); #else diff --git a/src/gui/UBMainWindow.h b/src/gui/UBMainWindow.h index cf6b715d..ecc25fa0 100644 --- a/src/gui/UBMainWindow.h +++ b/src/gui/UBMainWindow.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include "UBDownloadWidget.h" @@ -88,7 +88,7 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow private: // work around for handling tablet events on MAC OS with Qt 4.8.0 and above -#if defined(Q_OS_OSX) +#if defined(Q_WS_MACX) bool event(QEvent *event); #endif UBDownloadWidget* mpDownloadWidget; diff --git a/src/gui/UBMessageWindow.cpp b/src/gui/UBMessageWindow.cpp index 3a1c5109..ea9831de 100644 --- a/src/gui/UBMessageWindow.cpp +++ b/src/gui/UBMessageWindow.cpp @@ -44,7 +44,7 @@ UBMessageWindow::UBMessageWindow(QWidget *parent) mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC mLayout->setContentsMargins(radius() + 15, 8, radius() + 15, 10); #endif diff --git a/src/gui/UBMessageWindow.h b/src/gui/UBMessageWindow.h index db3dc895..68e1825d 100644 --- a/src/gui/UBMessageWindow.h +++ b/src/gui/UBMessageWindow.h @@ -29,8 +29,6 @@ #define UBMESSAGEWINDOW_H_ #include -#include -#include #include "UBFloatingPalette.h" diff --git a/src/gui/UBMessagesDialog.cpp b/src/gui/UBMessagesDialog.cpp index 45c458f9..cfd26307 100644 --- a/src/gui/UBMessagesDialog.cpp +++ b/src/gui/UBMessagesDialog.cpp @@ -23,9 +23,7 @@ */ -#include -#include -#include + #include "UBMessagesDialog.h" @@ -67,4 +65,4 @@ void UBMessagesDialog::setMessages(const QList messages) void UBMessagesDialog::dispose() { delete this; -} +} \ No newline at end of file diff --git a/src/gui/UBMessagesDialog.h b/src/gui/UBMessagesDialog.h index 4a6197cb..ba7e4d2c 100644 --- a/src/gui/UBMessagesDialog.h +++ b/src/gui/UBMessagesDialog.h @@ -29,7 +29,6 @@ #define UB_MESSAGES_DIALOG_H_ #include -#include class UBMessagesDialog : public QWidget { @@ -47,4 +46,4 @@ private: int mMessagesFontSize; }; -#endif /* UB_MESSAGES_DIALOG_H_ */ +#endif /* UB_MESSAGES_DIALOG_H_ */ \ No newline at end of file diff --git a/src/gui/UBMousePressFilter.cpp b/src/gui/UBMousePressFilter.cpp index 126432a7..06e5f872 100644 --- a/src/gui/UBMousePressFilter.cpp +++ b/src/gui/UBMousePressFilter.cpp @@ -23,7 +23,7 @@ */ -#include + #include "UBMousePressFilter.h" diff --git a/src/gui/UBRubberBand.cpp b/src/gui/UBRubberBand.cpp index a6c36e98..d444a735 100644 --- a/src/gui/UBRubberBand.cpp +++ b/src/gui/UBRubberBand.cpp @@ -28,10 +28,10 @@ #include "UBRubberBand.h" #include +#include #include -#include -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC #include #endif @@ -50,11 +50,11 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p) { customStyle = NULL; -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN customStyle = new QWindowsXPStyle(); -#elif defined(Q_OS_OSX) +#elif defined(Q_WS_MAC) customStyle = new QMacStyle(); -#elif defined(Q_OS_LINUX) +#elif defined(Q_WS_X11) customStyle = QStyleFactory::create("oxygen"); #endif diff --git a/src/gui/UBScreenMirror.cpp b/src/gui/UBScreenMirror.cpp index a4cda1be..47f0832d 100644 --- a/src/gui/UBScreenMirror.cpp +++ b/src/gui/UBScreenMirror.cpp @@ -24,7 +24,6 @@ -#include #include "UBScreenMirror.h" @@ -33,7 +32,7 @@ #include "core/UBApplication.h" #include "board/UBBoardController.h" -#if defined(Q_OS_OSX) +#if defined(Q_WS_MAC) #include #endif diff --git a/src/gui/UBScreenMirror.h b/src/gui/UBScreenMirror.h index 6954d48f..a6736d3b 100644 --- a/src/gui/UBScreenMirror.h +++ b/src/gui/UBScreenMirror.h @@ -29,7 +29,6 @@ #define UBSCREENMIRROR_H_ #include -#include class UBScreenMirror : public QWidget { diff --git a/src/gui/UBSpinningWheel.cpp b/src/gui/UBSpinningWheel.cpp index 185420bf..94197697 100644 --- a/src/gui/UBSpinningWheel.cpp +++ b/src/gui/UBSpinningWheel.cpp @@ -64,7 +64,7 @@ void UBSpinningWheel::paintEvent(QPaintEvent *event) pen.setCapStyle(Qt::RoundCap); painter.setPen(pen); - painter.rotate(30 * (mPosition.loadAcquire() % 12)); + painter.rotate(30 * (mPosition % 12)); for(int i = 0; i < 12; i++) { diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index 1acfd3a3..19ac5d01 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -26,7 +26,6 @@ #include #include -#include #include "UBThumbnailWidget.h" #include "UBRubberBand.h" @@ -243,10 +242,9 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event) option.initFrom(&rubberBand); mPrevLassoRect = QRect(); - mLassoRectItem = new QGraphicsRectItem(0); - scene()->addItem(mLassoRectItem); + mLassoRectItem = new QGraphicsRectItem(0, scene()); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC // The following code must stay in synch with \src\gui\styles\qmacstyle_mac.mm QColor strokeColor; strokeColor.setHsvF(0, 0, 0.86, 1.0); @@ -774,7 +772,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD , bCanMoveDown(false) { if(0 <= UBDocumentContainer::pageFromSceneIndex(pSceneIndex)){ - setAcceptHoverEvents(true); + setAcceptsHoverEvents(true); setFlag(QGraphicsItem::ItemIsSelectable, true); } } diff --git a/src/gui/UBToolWidget.cpp b/src/gui/UBToolWidget.cpp index 660617d0..682dddfa 100644 --- a/src/gui/UBToolWidget.cpp +++ b/src/gui/UBToolWidget.cpp @@ -26,9 +26,6 @@ #include -#include -#include - #include "UBToolWidget.h" #include "api/UBWidgetUniboardAPI.h" #include "api/UBW3CWidgetAPI.h" @@ -118,8 +115,7 @@ void UBToolWidget::initialize() setFixedSize(mToolWidget->boundingRect().width() + mContentMargin * 2, mToolWidget->boundingRect().height() + mContentMargin * 2); - connect(mWebView->page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared, - this, &UBToolWidget::javaScriptWindowObjectCleared); + connect(mWebView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared())); mWebView->load(mToolWidget->mainHtml()); diff --git a/src/gui/UBToolWidget.h b/src/gui/UBToolWidget.h index 56fc5e41..35f4eb76 100644 --- a/src/gui/UBToolWidget.h +++ b/src/gui/UBToolWidget.h @@ -29,7 +29,6 @@ #define UBTOOLWIDGET_H_ #include -#include class UBGraphicsWidgetItem; class QWidget; diff --git a/src/gui/UBToolbarButtonGroup.cpp b/src/gui/UBToolbarButtonGroup.cpp index db79e7ac..7c1e85e8 100644 --- a/src/gui/UBToolbarButtonGroup.cpp +++ b/src/gui/UBToolbarButtonGroup.cpp @@ -28,8 +28,6 @@ #include "UBToolbarButtonGroup.h" #include -#include -#include #include "core/UBApplication.h" #include "core/UBSettings.h" diff --git a/src/gui/UBToolbarButtonGroup.h b/src/gui/UBToolbarButtonGroup.h index d802950c..7ba901b3 100644 --- a/src/gui/UBToolbarButtonGroup.h +++ b/src/gui/UBToolbarButtonGroup.h @@ -30,10 +30,6 @@ #include -#include -#include -#include -#include class UBToolbarButtonGroup : public QWidget { diff --git a/src/gui/UBWidgetMirror.h b/src/gui/UBWidgetMirror.h index 6ca2b3d1..3916ae3d 100644 --- a/src/gui/UBWidgetMirror.h +++ b/src/gui/UBWidgetMirror.h @@ -29,7 +29,6 @@ #define UBWIDGETMIRROR_H_ #include -#include class UBWidgetMirror : public QWidget { diff --git a/src/gui/UBZoomPalette.cpp b/src/gui/UBZoomPalette.cpp index 10194113..e380c365 100644 --- a/src/gui/UBZoomPalette.cpp +++ b/src/gui/UBZoomPalette.cpp @@ -28,7 +28,6 @@ #include "UBZoomPalette.h" #include -#include #include #include "core/UBApplication.h" diff --git a/src/network/UBNetworkAccessManager.cpp b/src/network/UBNetworkAccessManager.cpp index 87f3a1ea..7e8a4564 100644 --- a/src/network/UBNetworkAccessManager.cpp +++ b/src/network/UBNetworkAccessManager.cpp @@ -29,8 +29,6 @@ #include #include -#include -#include #include "core/UBApplication.h" #include "core/UBApplicationController.h" @@ -117,7 +115,7 @@ void UBNetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthe passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); QString introMessage = tr("Enter username and password for \"%1\" at %2"); - introMessage = introMessage.arg((reply->url().toString()).toHtmlEscaped()).arg((reply->url().toString()).toHtmlEscaped()); + introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString())); passwordDialog.introLabel->setText(introMessage); passwordDialog.introLabel->setWordWrap(true); diff --git a/src/pdf-merger/Utils.cpp b/src/pdf-merger/Utils.cpp index c7e75098..8e9965c9 100644 --- a/src/pdf-merger/Utils.cpp +++ b/src/pdf-merger/Utils.cpp @@ -78,12 +78,12 @@ double Utils::stringToDouble(const std::string & s ) std::string Utils::uIntToStr(unsigned int integer) { - return std::string(QString::number(integer).toLatin1()); + return std::string(QString::number(integer).toAscii()); } std::string Utils::doubleToStr(double doubleValue) { - return std::string(QString::number(doubleValue).toLatin1()); + return std::string(QString::number(doubleValue).toAscii()); } int Utils::_stringToInt(const std::string & str) //throw ConvertException diff --git a/src/pdf-merger/pdfMerger.pri b/src/pdf-merger/pdfMerger.pri index 456f2df3..b27b90c6 100644 --- a/src/pdf-merger/pdfMerger.pri +++ b/src/pdf-merger/pdfMerger.pri @@ -1,59 +1,60 @@ + HEADERS += \ - src/pdf-merger/AnnotsHandler.h \ - src/pdf-merger/ASCII85Decode.h \ - src/pdf-merger/ASCIIHexDecode.h \ - src/pdf-merger/CCITTFaxDecode.h \ - src/pdf-merger/Config.h \ - src/pdf-merger/ContentHandler.h \ - src/pdf-merger/DCTDecode.h \ - src/pdf-merger/Decoder.h \ - src/pdf-merger/Document.h \ - src/pdf-merger/Exception.h \ - src/pdf-merger/FileIsAbsentException.h \ - src/pdf-merger/Filter.h \ - src/pdf-merger/FilterPredictor.h \ - src/pdf-merger/FlateDecode.h \ - src/pdf-merger/JBIG2Decode.h \ - src/pdf-merger/LZWDecode.h \ - src/pdf-merger/MediaBoxElementHandler.h \ - src/pdf-merger/MergePageDescription.h \ - src/pdf-merger/Merger.h \ - src/pdf-merger/Object.h \ - src/pdf-merger/Page.h \ - src/pdf-merger/PageElementHandler.h \ - src/pdf-merger/PageParser.h \ - src/pdf-merger/Parser.h \ - src/pdf-merger/Rectangle.h \ - src/pdf-merger/RemoveHimSelfHandler.h \ - src/pdf-merger/RunLengthDecode.h \ - src/pdf-merger/Transformation.h \ - src/pdf-merger/TypeElementHandler.h \ - src/pdf-merger/Utils.h \ - src/pdf-merger/AbstractBoxElementHandler.h \ - src/pdf-merger/CropBoxElementHandler.h \ - src/pdf-merger/OverlayDocumentParser.h \ - src/pdf-merger/RotationHandler.h + AnnotsHandler.h \ + ASCII85Decode.h \ + ASCIIHexDecode.h \ + CCITTFaxDecode.h \ + Config.h \ + ContentHandler.h \ + DCTDecode.h \ + Decoder.h \ + Document.h \ + Exception.h \ + FileIsAbsentException.h \ + Filter.h \ + FilterPredictor.h \ + FlateDecode.h \ + JBIG2Decode.h \ + LZWDecode.h \ + MediaBoxElementHandler.h \ + MergePageDescription.h \ + Merger.h \ + Object.h \ + Page.h \ + PageElementHandler.h \ + PageParser.h \ + Parser.h \ + Rectangle.h \ + RemoveHimSelfHandler.h \ + RunLengthDecode.h \ + Transformation.h \ + TypeElementHandler.h \ + Utils.h \ + AbstractBoxElementHandler.h \ + CropBoxElementHandler.h \ + OverlayDocumentParser.h \ + RotationHandler.h SOURCES += \ - src/pdf-merger/AnnotsHandler.cpp \ - src/pdf-merger/ASCII85Decode.cpp \ - src/pdf-merger/ASCIIHexDecode.cpp \ - src/pdf-merger/ContentHandler.cpp \ - src/pdf-merger/Document.cpp \ - src/pdf-merger/Filter.cpp \ - src/pdf-merger/FilterPredictor.cpp \ - src/pdf-merger/FlateDecode.cpp \ - src/pdf-merger/LZWDecode.cpp \ - src/pdf-merger/Merger.cpp \ - src/pdf-merger/Object.cpp \ - src/pdf-merger/Page.cpp \ - src/pdf-merger/PageElementHandler.cpp \ - src/pdf-merger/Parser.cpp \ - src/pdf-merger/Rectangle.cpp \ - src/pdf-merger/RemoveHimselfHandler.cpp \ - src/pdf-merger/RunLengthDecode.cpp \ - src/pdf-merger/Utils.cpp \ - src/pdf-merger/OverlayDocumentParser.cpp \ + AnnotsHandler.cpp \ + ASCII85Decode.cpp \ + ASCIIHexDecode.cpp \ + ContentHandler.cpp \ + Document.cpp \ + Filter.cpp \ + FilterPredictor.cpp \ + FlateDecode.cpp \ + LZWDecode.cpp \ + Merger.cpp \ + Object.cpp \ + Page.cpp \ + PageElementHandler.cpp \ + Parser.cpp \ + Rectangle.cpp \ + RemoveHimselfHandler.cpp \ + RunLengthDecode.cpp \ + Utils.cpp \ + OverlayDocumentParser.cpp \ src/pdf-merger/CCITTFaxDecode.cpp \ src/pdf-merger/JBIG2Decode.cpp \ src/pdf-merger/DCTDecode.cpp diff --git a/src/pdf/GraphicsPDFItem.cpp b/src/pdf/GraphicsPDFItem.cpp index 85761898..03f97bde 100644 --- a/src/pdf/GraphicsPDFItem.cpp +++ b/src/pdf/GraphicsPDFItem.cpp @@ -29,7 +29,7 @@ #include -#include +#include #include "core/memcheck.h" diff --git a/src/pdf/GraphicsPDFItem.h b/src/pdf/GraphicsPDFItem.h index e85a6953..afc4c6ea 100644 --- a/src/pdf/GraphicsPDFItem.h +++ b/src/pdf/GraphicsPDFItem.h @@ -28,7 +28,7 @@ #ifndef GRAPHICSPDFITEM_H #define GRAPHICSPDFITEM_H -#include +#include #include #include "PDFRenderer.h" diff --git a/src/pdf/PDFRenderer.cpp b/src/pdf/PDFRenderer.cpp index 5fdc09c3..1deaac5c 100644 --- a/src/pdf/PDFRenderer.cpp +++ b/src/pdf/PDFRenderer.cpp @@ -26,7 +26,6 @@ #include -#include #include "PDFRenderer.h" @@ -98,7 +97,7 @@ void PDFRenderer::attach() void PDFRenderer::detach() { mRefCount.deref(); - if (mRefCount.loadAcquire() == 0) + if (mRefCount == 0) { sRenderers.remove(mFileUuid); delete this; diff --git a/src/pdf/UBWebPluginPDFWidget.cpp b/src/pdf/UBWebPluginPDFWidget.cpp index 9dd054e9..16274ca2 100644 --- a/src/pdf/UBWebPluginPDFWidget.cpp +++ b/src/pdf/UBWebPluginPDFWidget.cpp @@ -26,7 +26,6 @@ #include -#include #include "UBWebPluginPDFWidget.h" #include "XPDFRenderer.h" diff --git a/src/pdf/XPDFRenderer.cpp b/src/pdf/XPDFRenderer.cpp index 6c65ce9e..f6040675 100644 --- a/src/pdf/XPDFRenderer.cpp +++ b/src/pdf/XPDFRenderer.cpp @@ -66,7 +66,7 @@ XPDFRenderer::~XPDFRenderer() sInstancesCount.deref(); } - if (sInstancesCount.loadAcquire() == 0 && globalParams) + if (sInstancesCount == 0 && globalParams) { delete globalParams; globalParams = 0; diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 12641434..0739499b 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -56,10 +56,10 @@ -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN #include "windowsmedia/UBWindowsMediaVideoEncoder.h" #include "windowsmedia/UBWaveRecorder.h" -#elif defined(Q_OS_OSX) +#elif defined(Q_WS_MAC) #include "quicktime/UBQuickTimeVideoEncoder.h" #include "quicktime/UBAudioQueueRecorder.h" #endif @@ -303,9 +303,9 @@ void UBPodcastController::start() applicationMainModeChanged(UBApplication::applicationController->displayMode()); -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop -#elif defined(Q_OS_OSX) +#elif defined(Q_WS_MAC) mVideoEncoder = new UBQuickTimeVideoEncoder(this); //deleted on stop #endif @@ -487,7 +487,7 @@ void UBPodcastController::processWidgetPaintEvent() { while(mWidgetRepaintRectQueue.size() > 0) { - repaintRect = repaintRect.united(mWidgetRepaintRectQueue.dequeue()); + repaintRect = repaintRect.unite(mWidgetRepaintRectQueue.dequeue()); } } @@ -582,7 +582,7 @@ void UBPodcastController::sceneChanged(const QList & region) QRectF viewportRect = bv->mapToScene(QRect(0, 0, bv->width(), bv->height())).boundingRect(); foreach(const QRectF rect, region) { - QRectF maxRect = rect.intersected(viewportRect); + QRectF maxRect = rect.intersect(viewportRect); mSceneRepaintRectQueue.enqueue(maxRect); } @@ -623,7 +623,7 @@ void UBPodcastController::processScenePaintEvent() { while(mSceneRepaintRectQueue.size() > 0) { - repaintRect = repaintRect.united(mSceneRepaintRectQueue.dequeue()); + repaintRect = repaintRect.unite(mSceneRepaintRectQueue.dequeue()); } } @@ -712,7 +712,7 @@ void UBPodcastController::encodingFinished(bool ok) { QString location; - if (mPodcastRecordingPath == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) + if (mPodcastRecordingPath == QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)) location = tr("on your desktop ..."); else { @@ -793,9 +793,9 @@ QStringList UBPodcastController::audioRecordingDevices() { QStringList devices; -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN devices = UBWaveRecorder::waveInDevices(); -#elif defined(Q_OS_OSX) +#elif defined(Q_WS_MAC) devices = UBAudioQueueRecorder::waveInDevices(); #endif diff --git a/src/podcast/UBPodcastRecordingPalette.h b/src/podcast/UBPodcastRecordingPalette.h index bde6d785..b475c887 100644 --- a/src/podcast/UBPodcastRecordingPalette.h +++ b/src/podcast/UBPodcastRecordingPalette.h @@ -32,7 +32,6 @@ #include "UBPodcastController.h" #include -#include class UBVuMeter; diff --git a/src/podcast/quicktime/UBQuickTimeFile.cpp b/src/podcast/quicktime/UBQuickTimeFile.cpp index 97ebf048..40bdead6 100644 --- a/src/podcast/quicktime/UBQuickTimeFile.cpp +++ b/src/podcast/quicktime/UBQuickTimeFile.cpp @@ -641,7 +641,7 @@ void UBQuickTimeFile::appendAudioBuffer(void* pBuffer, long pLength, int inNumbe } } } -#ifdef Q_OS_OSX +#ifdef Q_WS_MACX free((void*)inPacketDescs); #endif } diff --git a/src/tools/UBAbstractDrawRuler.cpp b/src/tools/UBAbstractDrawRuler.cpp index 167d6bca..4db193d0 100644 --- a/src/tools/UBAbstractDrawRuler.cpp +++ b/src/tools/UBAbstractDrawRuler.cpp @@ -69,7 +69,7 @@ void UBAbstractDrawRuler::create(QGraphicsItem& item) item.setFlag(QGraphicsItem::ItemIsSelectable, true); item.setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); - item.setAcceptHoverEvents(true); + item.setAcceptsHoverEvents(true); mCloseSvgItem = new QGraphicsSvgItem(":/images/closeTool.svg", &item); mCloseSvgItem->setVisible(false); diff --git a/src/tools/UBAbstractDrawRuler.h b/src/tools/UBAbstractDrawRuler.h index 5916c5cf..5b66acc2 100644 --- a/src/tools/UBAbstractDrawRuler.h +++ b/src/tools/UBAbstractDrawRuler.h @@ -29,7 +29,6 @@ #define UB_ABSTRACTDRAWRULER_H_ #include -#include #include "frameworks/UBGeometryUtils.h" class UBGraphicsScene; diff --git a/src/tools/UBGraphicsCompass.cpp b/src/tools/UBGraphicsCompass.cpp index 660025c4..6e0b751f 100644 --- a/src/tools/UBGraphicsCompass.cpp +++ b/src/tools/UBGraphicsCompass.cpp @@ -72,7 +72,7 @@ UBGraphicsCompass::UBGraphicsCompass() setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); - setAcceptHoverEvents(true); + setAcceptsHoverEvents(true); mCloseSvgItem = new QGraphicsSvgItem(":/images/closeTool.svg", this); mCloseSvgItem->setVisible(false); diff --git a/src/tools/UBGraphicsProtractor.cpp b/src/tools/UBGraphicsProtractor.cpp index 05b84257..74f192a0 100644 --- a/src/tools/UBGraphicsProtractor.cpp +++ b/src/tools/UBGraphicsProtractor.cpp @@ -78,7 +78,7 @@ UBGraphicsProtractor::UBGraphicsProtractor() setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::CppTool)); //Necessary to set if we want z value to be assigned correctly setFlag(QGraphicsItem::ItemIsSelectable, false); - setTransform(QTransform::fromScale(1.5, 1.5), true); + scale(1.5, 1.5); } @@ -201,9 +201,9 @@ void UBGraphicsProtractor::mouseMoveEvent(QGraphicsSceneMouseEvent *event) case Resize : prepareGeometryChange(); - setTransform(QTransform::fromTranslate(rect().center().x(), rect().center().y()), true); - setTransform(QTransform::fromScale(scaleFactor, scaleFactor), true); - setTransform(QTransform::fromTranslate(-rect().center().x(), -rect().center().y()), true); + translate(rect().center().x(), rect().center().y()); + scale(scaleFactor, scaleFactor); + translate(-rect().center().x(), -rect().center().y()); mScaleFactor *= scaleFactor; break; @@ -378,7 +378,7 @@ void UBGraphicsProtractor::paintGraduations(QPainter *painter) const int oneDegreeGraduationLength = 5; QFont font1 = painter->font(); -#ifdef Q_OS_OSX +#ifdef Q_WS_MAC font1.setPointSizeF(font1.pointSizeF() - 3); #endif QFontMetricsF fm1(font1); @@ -445,40 +445,40 @@ void UBGraphicsProtractor::paintButtons(QPainter *painter) qreal scale = buttonSizeReference().width() / mCloseSvgItem->boundingRect().width(); mCloseSvgItem->setPos(closeButtonRect().topLeft() + rect().center()); mCloseSvgItem->resetTransform(); - mCloseSvgItem->setTransform(QTransform::fromTranslate(-closeButtonRect().left(),-closeButtonRect().top()), true); - mCloseSvgItem->setRotation(rotation() -mStartAngle); - mCloseSvgItem->setTransform(QTransform::fromTranslate(closeButtonRect().left(), closeButtonRect().top()), true); - mCloseSvgItem->setTransform(QTransform::fromScale(scale * antiSc, scale * antiSc), true);//this do not impact the bounding box of thr svg item... + mCloseSvgItem->translate(-closeButtonRect().left(),-closeButtonRect().top()); + mCloseSvgItem->rotate(-mStartAngle); + mCloseSvgItem->translate(closeButtonRect().left(), closeButtonRect().top()); + mCloseSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item... mResetSvgItem->setPos(resetButtonRect().topLeft() + rect().center()); mResetSvgItem->resetTransform(); - mResetSvgItem->setTransform(QTransform::fromTranslate(-resetButtonRect().left(), -resetButtonRect().top()), true); - mResetSvgItem->setRotation(rotation() -mStartAngle); - mResetSvgItem->setTransform(QTransform::fromTranslate(resetButtonRect().left(), resetButtonRect().top()), true); - mResetSvgItem->setTransform(QTransform::fromScale(scale * antiSc, scale * antiSc), true);//this do not impact the bounding box of thr svg item... + mResetSvgItem->translate(-resetButtonRect().left(), -resetButtonRect().top()); + mResetSvgItem->rotate(-mStartAngle); + mResetSvgItem->translate(resetButtonRect().left(), resetButtonRect().top()); + mResetSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item... mResizeSvgItem->setPos(resizeButtonRect().topLeft() + rect().center()); mResizeSvgItem->resetTransform(); - mResizeSvgItem->setTransform(QTransform::fromTranslate(-resizeButtonRect().left(), -resizeButtonRect().top()), true); - mResizeSvgItem->setRotation(rotation() -mStartAngle); - mResizeSvgItem->setTransform(QTransform::fromTranslate(resizeButtonRect().left(), resizeButtonRect().top()), true); - mResizeSvgItem->setTransform(QTransform::fromScale(scale * antiSc, scale * antiSc), true);//this do not impact the bounding box of thr svg item... + mResizeSvgItem->translate(-resizeButtonRect().left(), -resizeButtonRect().top()); + mResizeSvgItem->rotate(-mStartAngle); + mResizeSvgItem->translate(resizeButtonRect().left(), resizeButtonRect().top()); + mResizeSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item... mRotateSvgItem->setPos(rotateButtonRect().topLeft() + rect().center()); mRotateSvgItem->resetTransform(); - mRotateSvgItem->setTransform(QTransform::fromTranslate(-rotateButtonRect().left(), -rotateButtonRect().top()), true); - mRotateSvgItem->setRotation(rotation() -mStartAngle); - mRotateSvgItem->setTransform(QTransform::fromTranslate(rotateButtonRect().left(), rotateButtonRect().top()), true); - mRotateSvgItem->setTransform(QTransform::fromScale(scale, scale), true);//this do not impact the bounding box of thr svg item... + mRotateSvgItem->translate(-rotateButtonRect().left(), -rotateButtonRect().top()); + mRotateSvgItem->rotate(-mStartAngle); + mRotateSvgItem->translate(rotateButtonRect().left(), rotateButtonRect().top()); + mRotateSvgItem->scale(scale, scale);//this do not impact the bounding box of thr svg item... } qreal scale = markerSizeReference().width()/mMarkerSvgItem->boundingRect().width(); mMarkerSvgItem->setPos(markerButtonRect().topLeft() + rect().center()); mMarkerSvgItem->resetTransform(); - mMarkerSvgItem->setTransform(QTransform::fromTranslate(-markerButtonRect().left(), -markerButtonRect().top()), true); - mMarkerSvgItem->setRotation(rotation() - mStartAngle - mCurrentAngle); - mMarkerSvgItem->setTransform(QTransform::fromTranslate(markerButtonRect().left(), markerButtonRect().top()), true); - mMarkerSvgItem->setTransform(QTransform::fromScale(scale, scale), true);//this do not impact the bounding box of thr svg item... + mMarkerSvgItem->translate(-markerButtonRect().left(), -markerButtonRect().top()); + mMarkerSvgItem->rotate(- mStartAngle - mCurrentAngle); + mMarkerSvgItem->translate(markerButtonRect().left(), markerButtonRect().top()); + mMarkerSvgItem->scale(scale, scale);//this do not impact the bounding box of thr svg item... mCloseSvgItem->setVisible(mShowButtons); mResetSvgItem->setVisible(mShowButtons); diff --git a/src/web/UBOEmbedParser.cpp b/src/web/UBOEmbedParser.cpp index 0760f74e..78576980 100644 --- a/src/web/UBOEmbedParser.cpp +++ b/src/web/UBOEmbedParser.cpp @@ -226,7 +226,8 @@ sOEmbedContent UBOEmbedParser::getXMLInfos(const QString &xml) void UBOEmbedParser::onParseContent(QString url) { - QUrl qurl = QUrl::fromEncoded(url.toLatin1()); + QUrl qurl; + qurl.setEncodedUrl(url.toAscii()); QNetworkRequest req; req.setUrl(qurl); diff --git a/src/web/UBTrapFlashController.cpp b/src/web/UBTrapFlashController.cpp index d00c1434..ba5b97f0 100644 --- a/src/web/UBTrapFlashController.cpp +++ b/src/web/UBTrapFlashController.cpp @@ -28,7 +28,6 @@ #include "UBTrapFlashController.h" #include -#include #include "frameworks/UBFileSystemUtils.h" @@ -100,17 +99,22 @@ void UBTrapFlashController::text_Changed(const QString &newText) { QString new_text = newText; -#ifdef Q_OS_WIN // Defined on Windows. +#ifdef Q_WS_WIN // Defined on Windows. QString illegalCharList(" < > : \" / \\ | ? * "); QRegExp regExp("[<>:\"/\\\\|?*]"); #endif -#ifdef Q_OS_OSX // Defined on Mac OS X. +#ifdef Q_WS_QWS // Defined on Qt for Embedded Linux. QString illegalCharList(" < > : \" / \\ | ? * "); QRegExp regExp("[<>:\"/\\\\|?*]"); #endif -#ifdef Q_OS_LINUX // Defined on X11. +#ifdef Q_WS_MAC // Defined on Mac OS X. + QString illegalCharList(" < > : \" / \\ | ? * "); + QRegExp regExp("[<>:\"/\\\\|?*]"); +#endif + +#ifdef Q_WS_X11 // Defined on X11. QString illegalCharList(" < > : \" / \\ | ? * "); QRegExp regExp("[<>:\"/\\\\|?*]"); #endif diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp index 97c6dfbf..0c21d499 100644 --- a/src/web/UBWebController.cpp +++ b/src/web/UBWebController.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include "frameworks/UBPlatformUtils.h" @@ -299,7 +298,7 @@ void UBWebController::setupPalettes() { mToolsCurrentPalette = new UBWebToolsPalette(UBApplication::mainWindow); UBApplication::boardController->paletteManager()->setCurrentWebToolsPalette(mToolsCurrentPalette); -#ifndef Q_OS_WIN +#ifndef Q_WS_WIN if (UBPlatformUtils::hasVirtualKeyboard() && UBApplication::boardController->paletteManager()->mKeyboardPalette) connect(UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(closed()), UBApplication::boardController->paletteManager()->mKeyboardPalette, SLOT(onDeactivated())); diff --git a/src/web/UBWebController.h b/src/web/UBWebController.h index d7292a00..b82f564a 100644 --- a/src/web/UBWebController.h +++ b/src/web/UBWebController.h @@ -30,7 +30,6 @@ #include #include -#include #include "UBOEmbedParser.h" diff --git a/src/web/UBWebKitUtils.cpp b/src/web/UBWebKitUtils.cpp index 1dce1da9..1bfc2d46 100644 --- a/src/web/UBWebKitUtils.cpp +++ b/src/web/UBWebKitUtils.cpp @@ -24,7 +24,6 @@ #include -#include #include "UBWebKitUtils.h" diff --git a/src/web/browser/WBBrowserWindow.cpp b/src/web/browser/WBBrowserWindow.cpp index 8cba1382..6c93f3fe 100644 --- a/src/web/browser/WBBrowserWindow.cpp +++ b/src/web/browser/WBBrowserWindow.cpp @@ -70,7 +70,6 @@ #include #include -#include #include "core/UBSettings.h" #include "core/UBSetting.h" diff --git a/src/web/browser/WBChaseWidget.cpp b/src/web/browser/WBChaseWidget.cpp index e536eb38..dc10372e 100644 --- a/src/web/browser/WBChaseWidget.cpp +++ b/src/web/browser/WBChaseWidget.cpp @@ -69,7 +69,6 @@ #include "WBChaseWidget.h" #include -#include #include "core/memcheck.h" diff --git a/src/web/browser/WBChaseWidget.h b/src/web/browser/WBChaseWidget.h index 90b2a0fc..20793d93 100644 --- a/src/web/browser/WBChaseWidget.h +++ b/src/web/browser/WBChaseWidget.h @@ -70,7 +70,6 @@ #define WBCHASEWIDGET_H #include -#include class WBChaseWidget : public QWidget diff --git a/src/web/browser/WBDownloadManager.cpp b/src/web/browser/WBDownloadManager.cpp index e52a314d..bb51cda0 100644 --- a/src/web/browser/WBDownloadManager.cpp +++ b/src/web/browser/WBDownloadManager.cpp @@ -70,7 +70,6 @@ #include #include -#include #include "network/UBAutoSaver.h" #include "network/UBNetworkAccessManager.h" @@ -146,7 +145,7 @@ void WBDownloadItem::getFileName() { QSettings settings; settings.beginGroup(QLatin1String("downloadmanager")); - QString defaultLocation = !mCustomDownloadPath.isEmpty() ? mCustomDownloadPath : QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); + QString defaultLocation = !mCustomDownloadPath.isEmpty() ? mCustomDownloadPath : QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString(); if (!downloadDirectory.isEmpty()) downloadDirectory += QLatin1Char('/'); diff --git a/src/web/browser/WBDownloadManager.h b/src/web/browser/WBDownloadManager.h index 53d013d6..8134cd01 100644 --- a/src/web/browser/WBDownloadManager.h +++ b/src/web/browser/WBDownloadManager.h @@ -74,7 +74,6 @@ #include #include -#include class WBDownloadItem : public QWidget, public Ui_DownloadItem { diff --git a/src/web/browser/WBEditTableView.h b/src/web/browser/WBEditTableView.h index 0a33617f..6cf7d20c 100644 --- a/src/web/browser/WBEditTableView.h +++ b/src/web/browser/WBEditTableView.h @@ -70,7 +70,6 @@ #define WBEDITTABLEVIEW_H #include -#include class WBEditTableView : public QTableView { diff --git a/src/web/browser/WBHistory.cpp b/src/web/browser/WBHistory.cpp index b59d5acb..e1c2f7e9 100644 --- a/src/web/browser/WBHistory.cpp +++ b/src/web/browser/WBHistory.cpp @@ -411,8 +411,7 @@ WBHistoryModel::WBHistoryModel(WBHistoryManager *history, QObject *parent) void WBHistoryModel::historyReset() { - beginResetModel(); - endResetModel(); + reset(); } void WBHistoryModel::entryAdded() @@ -752,8 +751,7 @@ QVariant WBHistoryFilterModel::headerData(int section, Qt::Orientation orientati void WBHistoryFilterModel::sourceReset() { m_loaded = false; - beginResetModel(); - endResetModel(); + reset(); } int WBHistoryFilterModel::rowCount(const QModelIndex &parent) const @@ -890,8 +888,7 @@ bool WBHistoryFilterModel::removeRows(int row, int count, const QModelIndex &par this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); m_loaded = false; if (oldCount - count != rowCount()) - beginResetModel(); - endResetModel(); + reset(); return true; } @@ -951,7 +948,7 @@ QModelIndex WBHistoryCompletionModel::index(int row, int column, const QModelInd if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent)) return QModelIndex(); - return createIndex(row, column); + return createIndex(row, column, 0); } QModelIndex WBHistoryCompletionModel::parent(const QModelIndex &) const @@ -981,14 +978,12 @@ void WBHistoryCompletionModel::setSourceModel(QAbstractItemModel *newSourceModel this, SLOT(sourceReset())); } - beginResetModel(); - endResetModel(); + reset(); } void WBHistoryCompletionModel::sourceReset() { - beginResetModel(); - endResetModel(); + reset(); } WBHistoryTreeModel::WBHistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent) @@ -1112,7 +1107,7 @@ QModelIndex WBHistoryTreeModel::index(int row, int column, const QModelIndex &pa return QModelIndex(); if (!parent.isValid()) - return createIndex(row, column); + return createIndex(row, column, 0); return createIndex(row, column, parent.row() + 1); } @@ -1121,7 +1116,7 @@ QModelIndex WBHistoryTreeModel::parent(const QModelIndex &index) const int offset = index.internalId(); if (offset == 0 || !index.isValid()) return QModelIndex(); - return createIndex(offset - 1, 0); + return createIndex(offset - 1, 0, 0); } bool WBHistoryTreeModel::hasChildren(const QModelIndex &parent) const @@ -1188,15 +1183,13 @@ void WBHistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel) this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); } - beginResetModel(); - endResetModel(); + reset(); } void WBHistoryTreeModel::sourceReset() { m_sourceRowCache.clear(); - beginResetModel(); - endResetModel(); + reset(); } void WBHistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start, int end) @@ -1206,8 +1199,7 @@ void WBHistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start if (start != 0 || start != end) { m_sourceRowCache.clear(); - beginResetModel(); - endResetModel(); + reset(); return; } @@ -1257,8 +1249,7 @@ void WBHistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, if (it == m_sourceRowCache.end()) { m_sourceRowCache.clear(); - beginResetModel(); - endResetModel(); + reset(); return; } diff --git a/src/web/browser/WBModelMenu.h b/src/web/browser/WBModelMenu.h index af921b26..ead85a76 100644 --- a/src/web/browser/WBModelMenu.h +++ b/src/web/browser/WBModelMenu.h @@ -70,7 +70,6 @@ #define WBMODELMENU_H #include -#include // A QMenu that is dynamically populated from a QAbstractItemModel class WBModelMenu : public QMenu diff --git a/src/web/browser/WBSearchLineEdit.cpp b/src/web/browser/WBSearchLineEdit.cpp index c8344675..a3ba1a88 100644 --- a/src/web/browser/WBSearchLineEdit.cpp +++ b/src/web/browser/WBSearchLineEdit.cpp @@ -69,7 +69,6 @@ #include "WBSearchLineEdit.h" #include -#include #include "core/memcheck.h" diff --git a/src/web/browser/WBSearchLineEdit.h b/src/web/browser/WBSearchLineEdit.h index 236d52eb..47479525 100644 --- a/src/web/browser/WBSearchLineEdit.h +++ b/src/web/browser/WBSearchLineEdit.h @@ -72,7 +72,6 @@ #include "WBUrlLineEdit.h" #include -#include class WBSearchButton; diff --git a/src/web/browser/WBSqueezeLabel.h b/src/web/browser/WBSqueezeLabel.h index 712df8cc..ac578cf5 100644 --- a/src/web/browser/WBSqueezeLabel.h +++ b/src/web/browser/WBSqueezeLabel.h @@ -69,7 +69,7 @@ #ifndef WBSQUEEZELABEL_H #define WBSQUEEZELABEL_H -#include +#include class WBSqueezeLabel : public QLabel { diff --git a/src/web/browser/WBTabWidget.cpp b/src/web/browser/WBTabWidget.cpp index 23430c88..b552fcba 100644 --- a/src/web/browser/WBTabWidget.cpp +++ b/src/web/browser/WBTabWidget.cpp @@ -78,8 +78,6 @@ #include #include -#include -#include #include "core/memcheck.h" @@ -109,7 +107,7 @@ WBTabBar::WBTabBar(QWidget *parent) setMovable(true); setDocumentMode(false); -#ifdef Q_OS_OSX +#ifdef Q_WS_MACX QFont baseFont = font(); baseFont.setPointSize(baseFont.pointSize() - 2); setFont(baseFont); diff --git a/src/web/browser/WBTabWidget.h b/src/web/browser/WBTabWidget.h index 75c47fc4..9a3f57ca 100644 --- a/src/web/browser/WBTabWidget.h +++ b/src/web/browser/WBTabWidget.h @@ -70,14 +70,6 @@ #define WBTABWIDGET_H #include -#include -#include -#include -#include -#include -#include -#include - /* Tab bar with a few more features such as a context menu and shortcuts */ diff --git a/src/web/browser/WBToolBarSearch.cpp b/src/web/browser/WBToolBarSearch.cpp index b8ddc4c7..c6dd9053 100644 --- a/src/web/browser/WBToolBarSearch.cpp +++ b/src/web/browser/WBToolBarSearch.cpp @@ -70,8 +70,6 @@ #include #include -#include -#include #include "network/UBAutoSaver.h" @@ -144,13 +142,10 @@ void WBToolbarSearch::searchNow() } QUrl url(QLatin1String("http://www.google.com/search")); - QUrlQuery urlQuery; - - urlQuery.addQueryItem(QLatin1String("q"), searchText); - urlQuery.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8")); - urlQuery.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8")); - urlQuery.addQueryItem(QLatin1String("client"), QLatin1String("uniboard-browser")); - url.setQuery(urlQuery); + 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")); emit search(url); } diff --git a/src/web/browser/WBUrlLineEdit.cpp b/src/web/browser/WBUrlLineEdit.cpp index 246895bf..494c2eaa 100644 --- a/src/web/browser/WBUrlLineEdit.cpp +++ b/src/web/browser/WBUrlLineEdit.cpp @@ -74,10 +74,6 @@ #include "globals/UBGlobals.h" #include -#include -#include -#include -#include #include "core/memcheck.h" diff --git a/src/web/browser/WBUrlLineEdit.h b/src/web/browser/WBUrlLineEdit.h index 37090eff..3247c53b 100644 --- a/src/web/browser/WBUrlLineEdit.h +++ b/src/web/browser/WBUrlLineEdit.h @@ -70,9 +70,6 @@ #define WBURLLINEEDIT_H #include -#include -#include -#include #include "WBWebView.h" diff --git a/src/web/browser/WBWebTrapWebView.cpp b/src/web/browser/WBWebTrapWebView.cpp index 0526158e..b036059f 100644 --- a/src/web/browser/WBWebTrapWebView.cpp +++ b/src/web/browser/WBWebTrapWebView.cpp @@ -29,8 +29,6 @@ #include #include -#include -#include #include "web/UBWebKitUtils.h" @@ -63,7 +61,7 @@ void WBWebTrapWebView::setIsTrapping(bool pIsTrapping) mDomElementRect = QRect(); mCurrentContentType = Unknown; /* -#if defined(Q_OS_WIN) +#if defined(Q_WS_WIN) if(mIsTrapping) { diff --git a/src/web/browser/WBWebTrapWebView.h b/src/web/browser/WBWebTrapWebView.h index 00679fe1..57bd7fc1 100644 --- a/src/web/browser/WBWebTrapWebView.h +++ b/src/web/browser/WBWebTrapWebView.h @@ -30,7 +30,6 @@ #include #include -#include class WBWebTrapWebView : public QWebView diff --git a/src/web/browser/WBWebView.cpp b/src/web/browser/WBWebView.cpp index 52bbef37..e83b31ae 100644 --- a/src/web/browser/WBWebView.cpp +++ b/src/web/browser/WBWebView.cpp @@ -82,8 +82,6 @@ #include #include #include -#include -#include #include "core/memcheck.h" diff --git a/src/web/web.pri b/src/web/web.pri index d85e5671..0b447efa 100644 --- a/src/web/web.pri +++ b/src/web/web.pri @@ -1,5 +1,5 @@ -QT += uitools +CONFIG += uitools FORMS += src/web/browser/downloaditem.ui \ src/web/browser/downloads.ui \