diff --git a/OpenBoard.pro b/OpenBoard.pro index 8f56b56b..5f073bea 100644 --- a/OpenBoard.pro +++ b/OpenBoard.pro @@ -28,10 +28,15 @@ 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 @@ -59,9 +64,10 @@ 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/trolltech/singleapplication -INCLUDEPATH += $$THIRD_PARTY_PATH/trolltech/singleapplication -include($$THIRD_PARTY_PATH/trolltech/singleapplication/qtsingleapplication.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) FORMS += resources/forms/mainWindow.ui \ resources/forms/preferences.ui \ diff --git a/TEST_OpenBoard_Win32.txt b/TEST_OpenBoard_Win32.txt new file mode 100644 index 00000000..92c418a0 --- /dev/null +++ b/TEST_OpenBoard_Win32.txt @@ -0,0 +1,27 @@ + + + + **************************** + * TEST OpenBoard * + * under Win32 (Windows 7) * + * * + **************************** + + +======================|====================| + Modules | Status | +======================|====================| +Network Manager | web OK | +----------------------|--------------------| + the video media |.avi not working | + | .mp4 works in small| + | format | +----------------------|--------------------| + audio | OK | +----------------------|--------------------| + | | +----------------------|--------------------| + | | +----------------------|--------------------| + | | +----------------------|--------------------| diff --git a/changes_porting_qt5.txt b/changes_porting_qt5.txt new file mode 100644 index 00000000..4c1324ae --- /dev/null +++ b/changes_porting_qt5.txt @@ -0,0 +1,844 @@ + ******************************* + * PORTING QT4->QT5 * + * CHANGES * + * win32 compilaton &exec * + ******************************* + + + + + + + + + + QtSingleApplication replacement for Qt5 +---------------------------------------- + +http://blog.kadu.im/2015/01/qtsingleapplication-replacement-for-qt5.html + + + + +UBWidgetMessageAPI.cpp +------------------------ + +-replace mGraphicsWidgetItem->page()->mainFrame()->evaluateJavaScript(js); by (Line 67) + +QtWebKitWidgets + + +UBGraphicsWidgetItem.h +--------------------- + +- add #include + + +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 f14b7058..5743e108 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 eee66f5d..cada6124 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "core/UBApplication.h" #include "core/UBSettings.h" diff --git a/src/adaptors/UBExportPDF.cpp b/src/adaptors/UBExportPDF.cpp index 4e231c14..9906ece3 100644 --- a/src/adaptors/UBExportPDF.cpp +++ b/src/adaptors/UBExportPDF.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "core/UBApplication.h" #include "core/UBSettings.h" diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index 5e3f237b..d882ea6a 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "core/UBSettings.h" #include "core/UBApplication.h" diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index b58eac6f..376a5f88 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "domain/UBGraphicsSvgItem.h" #include "domain/UBGraphicsPixmapItem.h" @@ -329,7 +330,7 @@ QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex) UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const QByteArray& pArray) { - UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toAscii()); + UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toLatin1()); return reader.loadScene(); } @@ -1335,7 +1336,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro QUuid uuid = UBGraphicsScene::getPersonalUuid(groupItem); if (!uuid.isNull()) { QDomElement curGroupElement = groupDomDocument->createElement(tGroup); - curGroupElement.setAttribute(aId, uuid); + curGroupElement.setAttribute(aId, uuid.toString()); UBGraphicsGroupContainerItem* group = dynamic_cast(groupItem); if(group && group->Delegate()){ if(group->Delegate()->isLocked()) @@ -1351,7 +1352,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro persistGroupToDom(item, curParent, groupDomDocument); else { QDomElement curSubElement = groupDomDocument->createElement(tElement); - curSubElement.setAttribute(aId, tmpUuid); + curSubElement.setAttribute(aId, tmpUuid.toString()); curGroupElement.appendChild(curSubElement); } } @@ -1990,9 +1991,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::audioItemToLinkedAudio(UBGraphicsMed graphicsItemToSvg(audioItem); - if (audioItem->mediaObject()->state() == Phonon::PausedState && audioItem->mediaObject()->remainingTime() > 0) + if (audioItem->mediaObject()->state() == QMediaPlayer::PausedState && (audioItem->mediaObject()->duration() - audioItem->mediaObject()->position()) > 0) { - qint64 pos = audioItem->mediaObject()->currentTime(); + qint64 pos = audioItem->mediaObject()->position(); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); } @@ -2019,9 +2020,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::videoItemToLinkedVideo(UBGraphicsMed graphicsItemToSvg(videoItem); - if (videoItem->mediaObject()->state() == Phonon::PausedState && videoItem->mediaObject()->remainingTime() > 0) + if (videoItem->mediaObject()->state() == QMediaPlayer::PausedState && (videoItem->mediaObject()->duration() - videoItem->mediaObject()->position()) > 0) { - qint64 pos = videoItem->mediaObject()->currentTime(); + qint64 pos = videoItem->mediaObject()->position(); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); } @@ -2139,7 +2140,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g { if (!svgX.isNull() && !svgY.isNull()) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat()); #endif } diff --git a/src/adaptors/UBSvgSubsetAdaptor.h b/src/adaptors/UBSvgSubsetAdaptor.h index c7a3a2e8..7bc1c88b 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.h +++ b/src/adaptors/UBSvgSubsetAdaptor.h @@ -30,6 +30,7 @@ #include #include +#include #include "frameworks/UBGeometryUtils.h" diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index 1f8565a9..96545d0f 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_WS_X11 +#ifdef Q_OS_LINUX 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 bc8b6381..b285d493 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 3314ac6b..21f993b2 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.h +++ b/src/adaptors/publishing/UBDocumentPublisher.h @@ -30,6 +30,13 @@ #include #include +#include +#include +#include +#include +#include +#include +#include typedef struct { diff --git a/src/api/UBLibraryAPI.h b/src/api/UBLibraryAPI.h index 3164e440..ba9a547a 100644 --- a/src/api/UBLibraryAPI.h +++ b/src/api/UBLibraryAPI.h @@ -30,6 +30,7 @@ #include #include +#include class UBLibraryAPI : public QObject { diff --git a/src/api/UBW3CWidgetAPI.cpp b/src/api/UBW3CWidgetAPI.cpp index 16ef1347..a4a4d4d4 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(); + return mGraphicsW3CWidget->uuid().toString(); else return ""; } diff --git a/src/api/UBWidgetMessageAPI.cpp b/src/api/UBWidgetMessageAPI.cpp index d8c2ac48..9d6c6aba 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 10b92c64..c4d381e9 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.toAscii()); + mimeData.setData(tMimeText, str.toLatin1()); 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.toAscii()); + dropMimeData->setData(tMimeText, mimeText.toLatin1()); event->setMimeData(dropMimeData); } @@ -588,7 +588,7 @@ void UBWidgetUniboardAPI::onDownloadFinished(bool pSuccess, sDownloadFileDesc de } } - QString destFileName = objDir + QUuid::createUuid() + "." + extention; + QString destFileName = objDir + QUuid::createUuid().toString() + "." + extention; QFile destFile(destFileName); 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.toAscii()); + dropMimeData.setData(tMimeText, mimeText.toLatin1()); destFile.close(); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index e4f946d9..ccf9b692 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -86,7 +86,7 @@ #include "core/memcheck.h" -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX #include bool onboardIsAlreadyRunning = true; #endif @@ -165,7 +165,7 @@ void UBBoardController::init() UBBoardController::~UBBoardController() { -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX 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_WS_X11 +#ifdef Q_OS_LINUX static bool isFirstTime = true; if(isFirstTime){ QProcess isAlreadyRunningProcess; @@ -2411,7 +2411,7 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint } } else{ -#ifdef Q_WS_MACX +#ifdef Q_OS_OSX // With Safari, in 95% of the drops, the mime datas are hidden in Apple Web Archive pasteboard type. // 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 970665e4..4d796656 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -31,6 +31,9 @@ #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 d6a4012e..8bf3416e 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_WS_WIN +#ifndef Q_OS_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_WS_WIN +#ifdef Q_OS_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_WS_X11 +#ifndef Q_OS_LINUX mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); #else mKeyboardPalette->setParent(0); #endif -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX 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_WS_X11 +#ifdef Q_OS_LINUX mKeyboardPalette->setParent(0); #else mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); -#endif //Q_WS_X11 -#ifdef Q_WS_MAC +#endif //Q_OS_LINUX +#ifdef Q_OS_OSX 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_WS_WIN +#ifdef Q_OS_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 3de52352..6024b07a 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_WS_MAC +#ifdef Q_OS_OSX #include "core/UBApplicationController.h" #include "desktop/UBDesktopAnnotationController.h" #endif @@ -366,7 +366,7 @@ void UBBoardView::tabletEvent (QTabletEvent * event) } bool acceptEvent = true; -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX //Work around #1388. After selecting annotation tool in desktop mode, annotation view appears on top when //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->posF().toPoint()), transform())); + QGraphicsItem* item = determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().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->children(); + QList children = item->childItems(); 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_WS_MACX) +#if defined(Q_OS_OSX) 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->children(); + QList childs = w->childItems(); 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->posF().toPoint())); + movingItem = scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()); 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->posF(); + mPreviousPoint = event->localPos(); event->accept(); break; @@ -1107,7 +1107,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event) if (!mMouseButtonIsPressed && !mTabletStylusIsPressed) { break; } - QPointF eventPosition = event->posF (); + QPointF eventPosition = event->localPos(); 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->posF().toPoint())))) + if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()))) { 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->posF().toPoint())))) + if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()))) { movingItem = NULL; bReleaseIsNeed = false; @@ -1475,7 +1475,7 @@ void UBBoardView::wheelEvent (QWheelEvent *wheelEvent) QPointF scenePos = mapToScene(wheelEvent->pos()); QList itemsList = scene()->items(scenePos); - QBool isSelectedAndMouseHower = itemsList.contains(selItem); + bool isSelectedAndMouseHower = itemsList.contains(selItem); if(isSelectedAndMouseHower) { QGraphicsView::wheelEvent(wheelEvent); diff --git a/src/board/UBBoardView.h b/src/board/UBBoardView.h index 14b8dec9..6883590f 100644 --- a/src/board/UBBoardView.h +++ b/src/board/UBBoardView.h @@ -30,6 +30,9 @@ #define CONTROLVIEW_OBJ_NAME "ControlView" #include +#include +#include + #include "core/UB.h" #include "domain/UBGraphicsDelegateFrame.h" @@ -60,7 +63,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_WS_MACX) +#if defined(Q_OS_OSX) 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 d3116613..ab2588e7 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -346,7 +346,6 @@ 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 c1074710..52337eb1 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -43,6 +43,7 @@ #include #include #include +#include class UBFeaturesModel; class UBFeaturesItemDelegate; diff --git a/src/core/UB.h b/src/core/UB.h index 21ba376c..be8f53a0 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -29,6 +29,7 @@ #define UB_H_ #include +#include #define UB_MAX_ZOOM 9 diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 05a3acbc..5225655b 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -31,8 +31,9 @@ #include #include #include +#include -#if defined(Q_WS_MACX) +#if defined(Q_OS_OSX) #include #endif @@ -84,13 +85,13 @@ const QString UBApplication::mimeTypeUniboardPage = QString("application/vnd.mne const QString UBApplication::mimeTypeUniboardPageItem = QString("application/vnd.mnemis-uniboard-page-item"); const QString UBApplication::mimeTypeUniboardPageThumbnail = QString("application/vnd.mnemis-uniboard-thumbnail"); -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX bool bIsMinimized = false; #endif QObject* UBApplication::staticMemoryCleaner = 0; -#if defined(Q_WS_MAC) +#if defined(Q_OS_OSX) static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event, long handlerRefCon) { Q_UNUSED(event); @@ -153,11 +154,11 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), this, SLOT(toolBarDisplayTextChanged(QVariant))); updateProtoActionsState(); -#ifndef Q_WS_MAC +#ifndef Q_OS_OSX setWindowIcon(QIcon(":/images/OpenBoard.png")); #endif - setStyle(new UBStyle()); // Style is owned and deleted by the application + setStyle("fusion"); QString css = UBFileSystemUtils::readTextFile(UBPlatformUtils::applicationResourcesDirectory() + "/etc/"+ qApp->applicationName()+".css"); if (css.length() > 0) @@ -337,7 +338,7 @@ int UBApplication::exec(const QString& pFileToImport) connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool))); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), this, SLOT(stopScript())); -#ifndef Q_WS_MAC +#ifndef Q_OS_OSX connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized())); #else connect(mainWindow->actionHideApplication, SIGNAL(triggered()), this, SLOT(showMinimized())); @@ -367,7 +368,7 @@ int UBApplication::exec(const QString& pFileToImport) if (pFileToImport.length() > 0) UBApplication::applicationController->importFile(pFileToImport); -#if defined(Q_WS_MAC) +#if defined(Q_OS_OSX) static AEEventHandlerUPP ub_proc_ae_handlerUPP = AEEventHandlerUPP(ub_appleEventProcessor); AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, ub_proc_ae_handlerUPP, SRefCon(UBApplication::applicationController), true); #endif @@ -389,7 +390,7 @@ void UBApplication::onScreenCountChanged(int newCount) mainWindow->actionMultiScreen->setEnabled(displayManager.numScreens() > 1); } -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX void UBApplication::showMinimized() { mainWindow->hide(); @@ -538,7 +539,7 @@ void UBApplication::decorateActionMenu(QAction* action) menu->addSeparator(); -#ifndef Q_WS_X11 // No Podcast on Linux yet +#ifndef Q_OS_LINUX // No Podcast on Linux yet menu->addAction(mainWindow->actionPodcast); mainWindow->actionPodcast->setText(tr("Podcast")); #endif @@ -589,7 +590,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event) { QFileOpenEvent *fileToOpenEvent = static_cast(event); -#if defined(Q_WS_MACX) +#if defined(Q_OS_OSX) ProcessSerialNumber psn; GetCurrentProcess(&psn); SetFrontProcess(&psn); @@ -610,7 +611,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event) boardController->controlView()->setMultiselection(false); } -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX if (bIsMinimized && event->type() == QEvent::ApplicationActivate){ if (mainWindow->isHidden()) mainWindow->show(); bIsMinimized = false; @@ -650,39 +651,6 @@ 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 49977f22..2ab2c65a 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -29,6 +29,9 @@ #define UBAPPLICATION_H_ #include +#include +#include +#include #include "qtsingleapplication.h" @@ -121,7 +124,7 @@ class UBApplication : public QtSingleApplication private slots: void closing(); -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX void showMinimized(); #endif void onScreenCountChanged(int newCount); @@ -134,7 +137,7 @@ class UBApplication : public QtSingleApplication QString checkLanguageAvailabilityForSankore(QString& language); protected: -#if defined(Q_WS_MACX) && !defined(QT_MAC_USE_COCOA) +#if defined(Q_OS_OSX) && !defined(QT_MAC_USE_COCOA) bool macEventFilter(EventHandlerCallRef caller, EventRef event); #endif @@ -144,29 +147,4 @@ class UBApplication : public QtSingleApplication }; - -class UBStyle : public QPlastiqueStyle -{ - public: - - UBStyle() - : QPlastiqueStyle() - { - // NOOP - } - - virtual ~UBStyle() - { - // NOOP - } - - /* - * redefined to be more cocoa like on texts - */ - virtual void drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, - bool enabled, const QString& text, QPalette::ColorRole textRole) const; - - -}; - #endif /* UBAPPLICATION_H_ */ diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index bb93f0cc..b4ae6a28 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -22,7 +22,9 @@ * along with OpenBoard. If not, see . */ - +#include +#include +#include #include "UBApplicationController.h" @@ -65,7 +67,7 @@ #include "ui_mainWindow.h" -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX #include #endif @@ -86,7 +88,6 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, , mAutomaticCheckForUpdates(false) , mCheckingForUpdates(false) , mIsShowingDesktop(false) - , mHttp(0) { mDisplayManager = new UBDisplayManager(this); @@ -121,7 +122,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, QTimer::singleShot (1000, this, SLOT (checkAtLaunch())); -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX mMainWindow->setStyleSheet("QToolButton { font-size: 11px}"); #endif @@ -137,7 +138,6 @@ UBApplicationController::~UBApplicationController() delete mBlackScene; delete mMirror; - if (mHttp) delete mHttp; delete(mOpenSankoreImporter); mOpenSankoreImporter = NULL; @@ -478,45 +478,53 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess) UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); } - void UBApplicationController::checkUpdate(QString 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()); + //connect(networkAccessManager, &QNetworkAccessManager::finished, + // this, &UBApplicationController::updateRequestFinished); + + connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)), + this, SLOT(updateRequestFinished(QNetworkReply*))); + + networkAccessManager->get(QNetworkRequest(QUrl(urlString))); + } -void UBApplicationController::updateHeaderReceived(QHttpResponseHeader header) + + +void UBApplicationController::updateRequestFinished(QNetworkReply * reply) { - if(header.statusCode() == 302 && header.hasKey("Location")){ - mHttp->close(); - checkUpdate(header.value("Location")); + 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())); -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); - } - } -} + checkUpdate(redirect_url.toString()); + return; + } + + + // 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::downloadJsonFinished(QString currentJson) diff --git a/src/core/UBApplicationController.h b/src/core/UBApplicationController.h index a33da6d7..cdcb5051 100644 --- a/src/core/UBApplicationController.h +++ b/src/core/UBApplicationController.h @@ -29,8 +29,6 @@ #define UBAPPLICATIONCONTROLLER_H_ #include -#include -#include class UBBoardView; @@ -146,8 +144,7 @@ class UBApplicationController : public QObject void checkAtLaunch(); private slots: - void updateRequestFinished(int id, bool error); - void updateHeaderReceived(QHttpResponseHeader header); + void updateRequestFinished(QNetworkReply * reply); protected: @@ -186,7 +183,6 @@ 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 5aacc83a..59e858af 100644 --- a/src/core/UBDisplayManager.cpp +++ b/src/core/UBDisplayManager.cpp @@ -41,6 +41,8 @@ #include "core/memcheck.h" +#include "qdesktopwidget.h" + UBDisplayManager::UBDisplayManager(QObject *parent) : QObject(parent) , mControlScreenIndex(-1) @@ -55,8 +57,8 @@ UBDisplayManager::UBDisplayManager(QObject *parent) initScreenIndexes(); - connect(mDesktop, SIGNAL(resized(int)), this, SLOT(adjustScreens(int))); - connect(mDesktop, SIGNAL(workAreaResized(int)), this, SLOT(adjustScreens(int))); + connect(mDesktop, &QDesktopWidget::resized, this, &UBDisplayManager::adjustScreens); + connect(mDesktop, &QDesktopWidget::workAreaResized, this, &UBDisplayManager::adjustScreens); } diff --git a/src/core/UBDisplayManager.h b/src/core/UBDisplayManager.h index e45044ca..a305716e 100644 --- a/src/core/UBDisplayManager.h +++ b/src/core/UBDisplayManager.h @@ -32,6 +32,7 @@ class UBBlackoutWidget; class UBBoardView; +class QDesktopWidget; class UBDisplayManager : public QObject { diff --git a/src/core/UBDocumentManager.cpp b/src/core/UBDocumentManager.cpp index 8bb20100..60aaa408 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_WS_MACX +#ifdef Q_OS_OSX //Workaround for issue 912 QApplication::processEvents(); #endif diff --git a/src/core/UBDownloadManager.cpp b/src/core/UBDownloadManager.cpp index ed365520..666f5690 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(); + QString uuid = QUuid::createUuid().toString(); UBPersistenceManager::persistenceManager()->addFileToDocument(UBApplication::boardController->selectedDocument(), mDesc.srcUrl, destDirectory, @@ -399,8 +399,7 @@ void UBDownloadManager::startFileDownload(sDownloadFileDesc desc) connect(http, SIGNAL(downloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onDownloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool))); //the desc.srcUrl is encoded. So we have to decode it before. - QUrl url; - url.setEncodedUrl(desc.srcUrl.toUtf8()); + QUrl url = QUrl::fromEncoded(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 43c2358f..21220bb5 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_WS_X11 +#ifdef Q_OS_LINUX newProcess.startDetached(qApp->applicationDirPath()+"/Importer/OpenBoardImporter"); -#elif defined Q_WS_MACX +#elif defined Q_OS_OSX newProcess.startDetached(qApp->applicationDirPath()+"/../Resources/OpenBoardImporter.app/Contents/MacOS/OpenBoardImporter"); #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 64e57691..60c271ef 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() + ".png"; + QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid().toString() + ".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() + ".svg"; + QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + svgItem->uuid().toString() + ".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 1c2dc591..f8d2ab90 100644 --- a/src/core/UBPreferencesController.cpp +++ b/src/core/UBPreferencesController.cpp @@ -44,6 +44,8 @@ #include "core/memcheck.h" +#include "qdesktopwidget.h" + qreal UBPreferencesController::sSliderRatio = 10.0; qreal UBPreferencesController::sMinPenWidth = 0.5; qreal UBPreferencesController::sMaxPenWidth = 50.0; @@ -78,7 +80,7 @@ UBPreferencesController::UBPreferencesController(QWidget *parent) mPreferencesUI = new Ui::preferencesDialog(); // deleted in mPreferencesUI->setupUi(mPreferencesWindow); adjustScreens(1); - connect(mDesktop, SIGNAL(screenCountChanged(int)), this, SLOT(adjustScreens(int))); + connect(mDesktop, &QDesktopWidget::screenCountChanged, this, &UBPreferencesController::adjustScreens); wire(); } diff --git a/src/core/UBPreferencesController.h b/src/core/UBPreferencesController.h index 96b64fed..fa15b255 100644 --- a/src/core/UBPreferencesController.h +++ b/src/core/UBPreferencesController.h @@ -29,6 +29,7 @@ #define UBPREFERENCESCONTROLLER_H_ #include +#include class UBColorPicker; class UBApplication; diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index dfddb796..64595ce1 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -306,7 +306,7 @@ void UBSettings::init() bool defaultShowPageImmediatelyOnMirroredScreen = true; -#if defined(Q_WS_X11) +#if defined(Q_OS_LINUX) // screen duplication is very slow on X11 defaultShowPageImmediatelyOnMirroredScreen = false; #endif @@ -334,22 +334,22 @@ void UBSettings::init() int defaultRefreshRateInFramePerSecond = 8; -#if defined(Q_WS_X11) +#if defined(Q_OS_LINUX) // 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(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))); + 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))); - 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))); + 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))); appOnlineUserName = new UBSetting(this, "App", "OnlineUserName", ""); @@ -790,7 +790,7 @@ QString UBSettings::userDataDirectory() qCritical() << "Impossible to create datadirpath " << dataDirPath; } - dataDirPath = UBFileSystemUtils::normalizeFilePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); + dataDirPath = UBFileSystemUtils::normalizeFilePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); dataDirPath.replace(qApp->organizationName() + "/", ""); } return dataDirPath; @@ -811,7 +811,7 @@ QString UBSettings::userImageDirectory() qCritical() << "failed to create image directory " << imageDirectory; } - imageDirectory = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation) + "/" + qApp->applicationName(); + imageDirectory = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/" + qApp->applicationName(); checkDirectory(imageDirectory); } return imageDirectory; @@ -832,10 +832,10 @@ QString UBSettings::userVideoDirectory() } - videoDirectory = QDesktopServices::storageLocation(QDesktopServices::MoviesLocation); + videoDirectory = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); if(videoDirectory.isEmpty()) - videoDirectory = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation) + "/" + tr("My Movies"); + videoDirectory = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/" + tr("My Movies"); else videoDirectory = videoDirectory + "/" + qApp->applicationName(); @@ -858,7 +858,7 @@ QString UBSettings::userAudioDirectory() qCritical() << "failed to create image directory " << audioDirectory; } - audioDirectory = QDesktopServices::storageLocation(QDesktopServices::MusicLocation) + "/" + qApp->applicationName(); + audioDirectory = QStandardPaths::writableLocation(QStandardPaths::MusicLocation) + "/" + qApp->applicationName(); checkDirectory(audioDirectory); } return audioDirectory; @@ -879,7 +879,7 @@ QString UBSettings::userPodcastRecordingDirectory() qCritical() << "failed to create dir " << dirPath; } - dirPath = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); + dirPath = QStandardPaths::writableLocation(QStandardPaths::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}", QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)); + result = result.replace("{Documents}", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); } else if(result.startsWith("{Home}")) { - result = result.replace("{Home}", QDesktopServices::storageLocation(QDesktopServices::HomeLocation)); + result = result.replace("{Home}", QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); } else if(result.startsWith("{Desktop}")) { - result = result.replace("{Desktop}", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); + result = result.replace("{Desktop}", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)); } if(result.contains("{UserLoginName}") && UBPlatformUtils::osUserLoginName().length() > 0) { diff --git a/src/core/main.cpp b/src/core/main.cpp index 43d7a7c8..3cd783f8 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -45,21 +45,21 @@ #endif */ -void ub_message_output(QtMsgType type, const char *msg) { +void ub_message_output(QtMsgType type, const QMessageLogContext& context, const QString& msg) { // We must temporarily remove the handler to avoid the infinite recursion of // ub_message_output -> qt_message_output -> ub_message_output -> qt_message_output ... - QtMsgHandler previousHandler = qInstallMsgHandler(0); + QtMessageHandler previousHandler = qInstallMessageHandler(0); #if defined(QT_NO_DEBUG) // Suppress qDebug output in release builds if (type != QtDebugMsg) { - qt_message_output(type, msg); + qt_message_output(type, context, msg); } #else // Default output in debug builds - qt_message_output(type, msg); + qt_message_output(type, context, msg); #endif if (UBApplication::app() && UBApplication::app()->isVerbose()) { @@ -77,7 +77,7 @@ void ub_message_output(QtMsgType type, const char *msg) { } } - qInstallMsgHandler(previousHandler); + qInstallMessageHandler(previousHandler); } int main(int argc, char *argv[]) @@ -93,25 +93,19 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(OpenBoard); - qInstallMsgHandler(ub_message_output); + qInstallMessageHandler(ub_message_output); -#if defined(Q_WS_X11) + + /* + * setGraphicsSystem is obsolete in Qt5, made redundant by the QPA framework. + * TODO: check if this works ok, if not, explore how to use QPA framework +#if defined(Q_OS_LINUX) qDebug() << "Setting GraphicsSystem to raster"; 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"; @@ -138,7 +132,7 @@ int main(int argc, char *argv[]) } } - app.initialize(false); + //app.initialize(false); // should not be needed anymore QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&))); diff --git a/src/desktop/UBCustomCaptureWindow.cpp b/src/desktop/UBCustomCaptureWindow.cpp index cac54f37..47eafdbe 100644 --- a/src/desktop/UBCustomCaptureWindow.cpp +++ b/src/desktop/UBCustomCaptureWindow.cpp @@ -24,6 +24,9 @@ +#include +#include +#include #include "UBCustomCaptureWindow.h" diff --git a/src/desktop/UBCustomCaptureWindow.h b/src/desktop/UBCustomCaptureWindow.h index 385b3ede..af0c8b63 100644 --- a/src/desktop/UBCustomCaptureWindow.h +++ b/src/desktop/UBCustomCaptureWindow.h @@ -29,6 +29,9 @@ #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 20966319..330093fe 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_WS_MAC +#ifdef Q_OS_OSX 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_WS_X11 +#ifdef Q_OS_LINUX 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_WS_X11 +#ifdef Q_OS_LINUX 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_WS_X11 +#ifndef Q_OS_LINUX mTransparentDrawingView->showFullScreen(); #else // this is necessary to avoid unity to hide the panels @@ -341,7 +341,7 @@ void UBDesktopAnnotationController::showWindow() mDesktopPalette->appear(); -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX updateMask(true); #endif } @@ -375,18 +375,18 @@ void UBDesktopAnnotationController::updateBackground() || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Selector) { newBrush = QBrush(Qt::transparent); -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX updateMask(true); #endif } else { -#if defined(Q_WS_MAC) +#if defined(Q_OS_OSX) newBrush = QBrush(QColor(127, 127, 127, 15)); #else newBrush = QBrush(QColor(127, 127, 127, 1)); #endif -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX 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_WS_WIN // Working only without this call on win32 desktop mode +#ifndef Q_OS_WIN // Working only without this call on win32 desktop mode customCaptureWindow.show(); #endif @@ -901,7 +901,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent) p.drawRect(tabsPalette); } -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX //Rquiered only for compiz wm //TODO. Window manager detection screen diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index b086ea2f..de53f032 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -171,7 +171,7 @@ void UBDesktopPalette::minimizeMe(eMinimizedLocation location) adjustSizeAndPosition(); -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX emit refreshMask(); #endif } @@ -201,7 +201,7 @@ void UBDesktopPalette::maximizeMe() // Notify that the maximization has been done emit maximized(); -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX emit refreshMask(); #endif } diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index 5912f81f..6ed1f89d 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_WS_X11 +//#ifdef Q_OS_LINUX //TODO: check why this produces an error on linux if uncommented void refreshMask(); -#endif +//#endif public slots: diff --git a/src/desktop/UBWindowCapture_linux.cpp b/src/desktop/UBWindowCapture_linux.cpp index b360ebfe..bc84b2ac 100644 --- a/src/desktop/UBWindowCapture_linux.cpp +++ b/src/desktop/UBWindowCapture_linux.cpp @@ -24,6 +24,7 @@ +#include #include "UBWindowCapture.h" #include "UBDesktopAnnotationController.h" diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 795b42a4..a5a6685c 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -355,7 +355,7 @@ void UBDocumentController::setupViews() } } -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX mMainWindow->actionDelete->setShortcut(QKeySequence(Qt::Key_Backspace)); #endif @@ -394,7 +394,7 @@ void UBDocumentController::setupViews() mDocumentUI->thumbnailWidget->setBackgroundBrush(UBSettings::documentViewLightColor); - #ifdef Q_WS_MACX + #ifdef Q_OS_OSX 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_WS_MACX + #ifdef Q_OS_OSX 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 786d2829..7fc70926 100644 --- a/src/document/UBDocumentController.h +++ b/src/document/UBDocumentController.h @@ -29,6 +29,7 @@ #define UBDOCUMENTCONTROLLER_H_ #include +#include #include "document/UBDocumentContainer.h" namespace Ui diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index 77f45e9d..40a46074 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -832,9 +832,10 @@ void UBGraphicsDelegateFrame::positionHandles() } resetTransform(); - translate(center.x(), center.y()); - rotate(-angle); - translate(-center.x(), -center.y()); + 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 mBottomRightResizeGripSvgItem->setParentItem(this); mBottomResizeGripSvgItem->setParentItem(this); diff --git a/src/domain/UBGraphicsGroupContainerItem.cpp b/src/domain/UBGraphicsGroupContainerItem.cpp index ccb7795f..3e9e1012 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, children()) + foreach(QGraphicsItem *child, childItems()) { UBGraphicsItem *item = dynamic_cast(child); if (item) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 9c45ce27..a8271e34 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_WS_X11 +#ifndef Q_OS_LINUX 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->scale(0.8,0.8); + button->setTransform(QTransform::fromScale(0.8, 0.8), true); } 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()->seek(tickPos); + mDelegate->mediaObject()->setPosition(tickPos); //OSX is a bit lazy updateTicker(tickPos); diff --git a/src/domain/UBGraphicsMediaItem.cpp b/src/domain/UBGraphicsMediaItem.cpp index 4e4829cd..e4ea11a8 100644 --- a/src/domain/UBGraphicsMediaItem.cpp +++ b/src/domain/UBGraphicsMediaItem.cpp @@ -49,7 +49,13 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte { update(); - mMediaObject = new Phonon::MediaObject(this); + + //mMediaObject = new Phonon::MediaObject(this); + mMediaObject = new QMediaPlayer(this); + + //playlist = new QMediaPlaylist; + //mMediaObject->setPlaylist(playlist); + QString mediaPath = pMediaFileUrl.toString(); if ("" == mediaPath) @@ -59,10 +65,23 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte { mMediaType = mediaType_Video; - mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this); - mMediaObject->setTickInterval(50); - mVideoWidget = new Phonon::VideoWidget(); // owned and destructed by the scene ... - Phonon::createPath(mMediaObject, mVideoWidget); + //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); if(mVideoWidget->sizeHint() == QSize(1,1)){ mVideoWidget->resize(320,240); @@ -72,11 +91,19 @@ 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); - mMediaObject->setTickInterval(1000); + QAudioFormat format; + format.setByteOrder(QAudioFormat::LittleEndian); + format.setSampleType(QAudioFormat::UnSignedInt); + + // mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); + //mAudioOutput = new QMediaPlayer(format, this); + mAudioOutput = new QMediaPlayer; + + //mMediaObject->setTickInterval(1000); mAudioWidget = new QWidget(); mAudioWidget->resize(320,26); mAudioWidget->setMinimumSize(150,26); @@ -84,16 +111,17 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte haveLinkedImage = false; } - Phonon::createPath(mMediaObject, mAudioOutput); + //Phonon::createPath(mMediaObject, mAudioOutput); + //mSource = Phonon::MediaSource(pMediaFileUrl); + + //mMediaObject->setCurrentSource(mSource); + mMediaObject->setMedia(pMediaFileUrl); - mSource = Phonon::MediaSource(pMediaFileUrl); - mMediaObject->setCurrentSource(mSource); // we should create delegate after media objects because delegate uses his properties at creation. 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) @@ -159,7 +187,11 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria absoluteMediaFilename = mMediaFileUrl.toLocalFile(); if (absoluteMediaFilename.length() > 0) - mMediaObject->setCurrentSource(Phonon::MediaSource(absoluteMediaFilename)); + //mMediaObject->setCurrentSource(QMediaSource(absoluteMediaFilename)); + mMediaObject->setMedia(QUrl::fromLocalFile(absoluteMediaFilename)); + + + } } @@ -203,7 +235,9 @@ void UBGraphicsMediaItem::hasMediaChanged(bool hasMedia) { if(hasMedia && mMediaObject->isSeekable()) { - mMediaObject->seek(mInitialPos); + //mMediaObject->seek(mInitialPos); + mMediaObject->setPosition(mInitialPos); + UBGraphicsMediaItemDelegate *med = dynamic_cast(Delegate()); if (med) med->updateTicker(initialPos()); @@ -318,7 +352,8 @@ void UBGraphicsMediaItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QPointF eventPos = mapFromScene( event->scenePos()); QPointF translation = eventPos - mouseMovePos; - translate(translation.x(), translation.y()); + //translate(translation.x(), translation.y()); + setPos(translation.x(), translation.y()); } mMouseMovePos = event->scenePos(); diff --git a/src/domain/UBGraphicsMediaItem.h b/src/domain/UBGraphicsMediaItem.h index e580021c..31ea7175 100644 --- a/src/domain/UBGraphicsMediaItem.h +++ b/src/domain/UBGraphicsMediaItem.h @@ -28,10 +28,20 @@ #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" @@ -63,7 +73,9 @@ public: virtual void mediaFileUrl(QUrl url){mMediaFileUrl=url;} - Phonon::MediaObject* mediaObject() const + //Phonon::MediaObject* mediaObject() const + QMediaPlayer* mediaObject() const + { return mMediaObject; } @@ -80,7 +92,9 @@ public: return mMuted; } - Phonon::VideoWidget* videoWidget() const + // Phonon::VideoWidget* videoWidget() const + QVideoWidget* videoWidget() const + { return mVideoWidget; } @@ -115,10 +129,18 @@ protected: virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void clearSource(); - Phonon::MediaObject *mMediaObject; - Phonon::VideoWidget *mVideoWidget; - Phonon::AudioOutput *mAudioOutput; - Phonon::MediaSource mSource; + //Phonon::MediaObject *mMediaObject; + //Phonon::VideoWidget *mVideoWidget; + //Phonon::AudioOutput *mAudioOutput; + //Phonon::MediaSource mSource; + + QMediaPlayer *mMediaObject; + QMediaPlaylist *playlist; + QVideoWidget *mVideoWidget; +// QAudioOutput *mAudioOutput; + QMediaPlayer *mAudioOutput; + QMediaService *mSource; + QWidget *mAudioWidget; private: diff --git a/src/domain/UBGraphicsMediaItemDelegate.cpp b/src/domain/UBGraphicsMediaItemDelegate.cpp index 4bea2953..0c7c0683 100644 --- a/src/domain/UBGraphicsMediaItemDelegate.cpp +++ b/src/domain/UBGraphicsMediaItemDelegate.cpp @@ -43,7 +43,7 @@ #include "core/memcheck.h" -UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent) +UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaPlayer* pMedia, QObject * parent) : UBGraphicsItemDelegate(pDelegated, parent, GF_COMMON | GF_RESPECT_RATIO | GF_TOOLBAR_USED @@ -56,11 +56,22 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD QPalette palette; palette.setBrush ( QPalette::Light, Qt::darkGray ); - 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))); + 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))); if (delegated()->hasLinkedImage()) { @@ -95,10 +106,12 @@ 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); @@ -109,8 +122,10 @@ 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; @@ -120,10 +135,17 @@ 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())); } @@ -195,55 +217,82 @@ UBGraphicsMediaItem* UBGraphicsMediaItemDelegate::delegated() return dynamic_cast(mDelegated); } - void UBGraphicsMediaItemDelegate::togglePlayPause() { if (delegated() && delegated()->mediaObject()) { - Phonon::MediaObject* media = delegated()->mediaObject(); - if (media->state() == Phonon::StoppedState) { + QMediaPlayer * media = delegated()->mediaObject(); + + if (media->state() == QMediaPlayer::StoppedState) media->play(); - } else if (media->state() == Phonon::PlayingState) { - if (media->remainingTime() <= 0) { + + else if (media->state() == QMediaPlayer::PlayingState) { + + if ((media->duration() - media->position()) <= 0) { media->stop(); media->play(); - } else { + } + + else { media->pause(); if(delegated()->scene()) delegated()->scene()->setModified(true); } - } else if (media->state() == Phonon::PausedState) { - if (media->remainingTime() <= 0) { + } + + else if (media->state() == QMediaPlayer::PausedState) { + if ((media->duration() - media->position()) <= 0) media->stop(); - } + media->play(); - } else if ( media->state() == Phonon::LoadingState ) { - delegated()->mediaObject()->setCurrentSource(delegated()->mediaFileUrl()); + } + + else if ( media->mediaStatus() == QMediaPlayer::LoadingMedia) { + delegated()->mediaObject()->setMedia(delegated()->mediaFileUrl()); media->play(); - } else if (media->state() == Phonon::ErrorState){ - qDebug() << "Error appeared." << media->errorString(); } + + else if (media->error()) + qDebug() << "Error appeared." << media->errorString(); + } } -void UBGraphicsMediaItemDelegate::mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate ) +void UBGraphicsMediaItemDelegate::mediaStatusChanged(QMediaPlayer::MediaStatus status) { - Q_UNUSED(newstate); - Q_UNUSED(oldstate); + // Possible statuses are: UnknownMediaStatus, NoMedia, LoadingMedia, LoadedMedia, + // StalledMedia, BufferingMedia, BufferedMedia, EndOfMedia, InvalidMedia - if (oldstate == Phonon::LoadingState) - { - mMediaControl->totalTimeChanged(delegated()->mediaObject()->totalTime()); - } + 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) +{ + // Possible states are StoppedState, PlayingState and PausedState + + // updatePlayPauseState handles this functionality + updatePlayPauseState(); +} + +void UBGraphicsMediaItemDelegate::mediaError(QMediaPlayer::Error error) +{ + // Possible errors are NoError, ResourceError, FormatError, NetworkError, AccessDeniedError, + // ServiceMissingError + Q_UNUSED(error); + + qDebug() << "Error appeared." << mMedia->errorString(); +} + void UBGraphicsMediaItemDelegate::updatePlayPauseState() { - Phonon::MediaObject* media = delegated()->mediaObject(); + QMediaPlayer * media = delegated()->mediaObject(); - if (media->state() == Phonon::PlayingState) + if (media->state() == QMediaPlayer::PlayingState) mPlayPauseButton->setFileName(":/images/pause.svg"); else mPlayPauseButton->setFileName(":/images/play.svg"); @@ -252,8 +301,8 @@ void UBGraphicsMediaItemDelegate::updatePlayPauseState() void UBGraphicsMediaItemDelegate::updateTicker(qint64 time) { - Phonon::MediaObject* media = delegated()->mediaObject(); - mMediaControl->totalTimeChanged(media->totalTime()); + QMediaPlayer* media = delegated()->mediaObject(); + mMediaControl->totalTimeChanged(media->duration()); mMediaControl->updateTicker(time); } diff --git a/src/domain/UBGraphicsMediaItemDelegate.h b/src/domain/UBGraphicsMediaItemDelegate.h index 1e9d858c..8cb47b3b 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, Phonon::MediaObject* pMedia, QObject * parent = 0); + UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, QMediaPlayer* pMedia, QObject * parent = 0); virtual ~UBGraphicsMediaItemDelegate(); virtual void positionHandles(); - bool mousePressEvent(QGraphicsSceneMouseEvent *event); + bool mousePressEvent(QGraphicsSceneMouseEvent* event); public slots: @@ -61,14 +61,18 @@ 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(); @@ -77,11 +81,11 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate DelegateButton* mPlayPauseButton; DelegateButton* mStopButton; DelegateButton* mMuteButton; - DelegateMediaControl *mMediaControl; + DelegateMediaControl* mMediaControl; - Phonon::MediaObject* mMedia; + QMediaPlayer* mMedia; // mMedia belongs to the associated UBGraphicsMediaItem (mDelegated) - QTimer *mToolBarShowTimer; + QTimer* mToolBarShowTimer; int m_iToolBarShowingInterval; }; diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 66e37abf..78284a86 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->scale(pScaleFactor, pScaleFactor); + pixmapItem->setTransform(QTransform::fromScale(pScaleFactor, pScaleFactor), true); if (pUseAnimation) { @@ -1340,7 +1340,7 @@ UBGraphicsMediaItem* UBGraphicsScene::addMedia(const QUrl& pMediaFileUrl, bool s if (!shouldPlayAsap) { mediaItem->mediaObject()->pause(); - mediaItem->mediaObject()->seek(0); + mediaItem->mediaObject()->setPosition(0); } setDocumentUpdated(); @@ -1403,7 +1403,7 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co qreal ssf = 1 / UBApplication::boardController->systemScaleFactor(); - graphicsWidget->scale(ssf, ssf); + graphicsWidget->setTransform(QTransform::fromScale(ssf, ssf), true); graphicsWidget->setPos(QPointF(pPos.x() - graphicsWidget->boundingRect().width() / 2, 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->scale(sscale, sscale); + svgItem->setTransform(QTransform::fromScale(sscale, sscale), true); 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->scale(ratio, ratio); + item->setTransform(QTransform::fromScale(ratio, ratio), true); if(center) { diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp index 5beead86..9ec12d59 100644 --- a/src/domain/UBGraphicsWidgetItem.cpp +++ b/src/domain/UBGraphicsWidgetItem.cpp @@ -27,6 +27,7 @@ #include #include +#include #include "UBGraphicsWidgetItem.h" #include "UBGraphicsScene.h" @@ -121,7 +122,8 @@ void UBGraphicsWidgetItem::initialize() page()->setPalette(palette); page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); - connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared())); + connect(page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared, + this, &UBGraphicsWidgetItem::javaScriptWindowObjectCleared); connect(page(), SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested(const QRect&))); connect(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 3d84b09a..ab2633fe 100644 --- a/src/domain/UBGraphicsWidgetItem.h +++ b/src/domain/UBGraphicsWidgetItem.h @@ -31,6 +31,7 @@ #include #include #include +#include #include "core/UB.h" diff --git a/src/domain/UBSelectionFrame.cpp b/src/domain/UBSelectionFrame.cpp index 72708dca..89da1c6d 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()) == mRotateButton) { + if (scene()->itemAt(event->scenePos(), transform()) == mRotateButton) { mOperationMode = om_rotating; } else { mOperationMode = om_moving; diff --git a/src/domain/UBUndoCommand.h b/src/domain/UBUndoCommand.h index 1d899354..a59e13a4 100644 --- a/src/domain/UBUndoCommand.h +++ b/src/domain/UBUndoCommand.h @@ -29,6 +29,7 @@ #define UBABSTRACTUNDOCOMMAND_H_ #include +#include #include class UBUndoCommand : public QUndoCommand diff --git a/src/frameworks/UBBase32.cpp b/src/frameworks/UBBase32.cpp index dda8a502..92f755d2 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.toAscii() - '0'; + char lookup = ch.toLatin1() - '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 38de69eb..281ac820 100644 --- a/src/frameworks/UBCoreGraphicsScene.h +++ b/src/frameworks/UBCoreGraphicsScene.h @@ -29,6 +29,8 @@ #define UBCOREGRAPHICSSCENE_H_ #include +#include +#include class UBCoreGraphicsScene : public QGraphicsScene { diff --git a/src/frameworks/UBCryptoUtils.cpp b/src/frameworks/UBCryptoUtils.cpp index 214ad72f..f35d0f2c 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::fromAscii(cipheredData.toBase64()); + return QString::fromLatin1(cipheredData.toBase64()); } QString UBCryptoUtils::symetricDecrypt(const QString& encrypted) { - QByteArray encryptedData = QByteArray::fromBase64(encrypted.toAscii()); + QByteArray encryptedData = QByteArray::fromBase64(encrypted.toLatin1()); 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.toAscii().data(); + unsigned char *key_data = (unsigned char *)sAESKey.toLatin1().data(); int key_data_len = sAESKey.length(); - i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), (unsigned char *)sAESSalt.toAscii().data(), key_data, + i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), (unsigned char *)sAESSalt.toLatin1().data(), key_data, key_data_len, nrounds, key, iv); if (i != 32) diff --git a/src/frameworks/UBFileSystemUtils.cpp b/src/frameworks/UBFileSystemUtils.cpp index 7bbfc876..d70e8df3 100644 --- a/src/frameworks/UBFileSystemUtils.cpp +++ b/src/frameworks/UBFileSystemUtils.cpp @@ -57,7 +57,7 @@ UBFileSystemUtils::~UBFileSystemUtils() QString UBFileSystemUtils::removeLocalFilePrefix(QString input) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN if(input.startsWith("file:///")) return input.mid(8); else @@ -130,12 +130,12 @@ bool UBFileSystemUtils::deleteFile(const QString &path) QString UBFileSystemUtils::defaultTempDirPath() { - return QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/" + defaultTempDirName(); + return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/" + defaultTempDirName(); } QString UBFileSystemUtils::createTempDir(const QString& templateString, bool autoDeleteOnExit) { - QString appTempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation) + QString appTempDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/" + templateString; int index = 0; @@ -200,7 +200,7 @@ void UBFileSystemUtils::deleteAllTempDirCreatedDuringSession() void UBFileSystemUtils::cleanupGhostTempFolders(const QString& templateString) { - QDir dir(QDesktopServices::storageLocation(QDesktopServices::TempLocation)); + QDir dir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); foreach (QFileInfo dirContent, dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden , QDir::Name)) { diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index 4d3671c4..c7b99bc1 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -204,7 +204,7 @@ public: static QString urlFromClipboard(); static QStringList availableTranslations(); -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX static void SetMacLocaleByIdentifier(const QString& id); #endif }; diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index 5def77c3..73e901a0 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -28,6 +28,7 @@ #include "UBPlatformUtils.h" #include +#include #include #include @@ -98,7 +99,7 @@ void UBPlatformUtils::bringPreviousProcessToFront() QString UBPlatformUtils::osUserLoginName() { char *user = getenv("USER"); - return QString::fromAscii(user); + return QString::fromLatin1(user); } QString UBPlatformUtils::computerName() @@ -108,7 +109,7 @@ QString UBPlatformUtils::computerName() // if the name is longer than 255 the name is truncated but os doesn't ensure // that the last character returned is a null character if(!gethostname(hostname,255)) - return QString::fromAscii(hostname); + return QString::fromLatin1(hostname); else return "NOT FOUND"; } diff --git a/src/globals/UBGlobals.h b/src/globals/UBGlobals.h index 8b31775a..89c6d272 100644 --- a/src/globals/UBGlobals.h +++ b/src/globals/UBGlobals.h @@ -45,7 +45,7 @@ setStyleSheet(style);\ } -#ifdef Q_WS_WIN +#ifdef Q_OS_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_WS_WIN +#else //#ifdef Q_OS_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_WS_WIN +#endif //#ifdef Q_OS_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 b636cd5a..2eb69dae 100644 --- a/src/gui/UBActionPalette.cpp +++ b/src/gui/UBActionPalette.cpp @@ -23,7 +23,8 @@ */ - +#include +#include #include "UBActionPalette.h" @@ -103,8 +104,10 @@ UBActionPaletteButton* UBActionPalette::createPaletteButton(QAction* action, QWi mMapActionToButton[action] = button; - connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked())); - connect(action, SIGNAL(changed()), this, SLOT(actionChanged())); + connect(button, &UBActionPaletteButton::clicked, + this, &UBActionPalette::buttonClicked); + connect(action, &QAction::changed, + this, &UBActionPalette::actionChanged); return button; } diff --git a/src/gui/UBActionPalette.h b/src/gui/UBActionPalette.h index fb909f5a..ed18d602 100644 --- a/src/gui/UBActionPalette.h +++ b/src/gui/UBActionPalette.h @@ -31,6 +31,8 @@ #include #include #include +#include + #include "UBFloatingPalette.h" class UBActionPaletteButton; diff --git a/src/gui/UBCircleFrame.h b/src/gui/UBCircleFrame.h index d4c0af81..ec61e025 100644 --- a/src/gui/UBCircleFrame.h +++ b/src/gui/UBCircleFrame.h @@ -29,6 +29,7 @@ #define UBCIRCLEFRAME_H_ #include +#include class UBCircleFrame : public QFrame { diff --git a/src/gui/UBColorPicker.h b/src/gui/UBColorPicker.h index 157e863e..d8894cc4 100644 --- a/src/gui/UBColorPicker.h +++ b/src/gui/UBColorPicker.h @@ -29,6 +29,7 @@ #define UBCOLORPICKER_H_ #include +#include class UBColorPicker : public QFrame { diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index ea17d00d..f8bfbc1d 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); + //iconPixmap.setAlphaChannel(transparencyPix); // deprecated; removed for now, to be re-implemented QColor color(0x7F, 0x7F, 0x7F, 0x3F); painter.setBrush(QBrush(color)); } diff --git a/src/gui/UBDocumentThumbnailWidget.cpp b/src/gui/UBDocumentThumbnailWidget.cpp index be601471..66d6efea 100644 --- a/src/gui/UBDocumentThumbnailWidget.cpp +++ b/src/gui/UBDocumentThumbnailWidget.cpp @@ -190,7 +190,8 @@ void UBDocumentThumbnailWidget::dragMoveEvent(QDragMoveEvent *event) if (!mDropCaretRectItem && selectedItems().count() < mGraphicItems.count()) { - mDropCaretRectItem = new QGraphicsRectItem(0, scene()); + mDropCaretRectItem = new QGraphicsRectItem(0); + scene()->addItem(mDropCaretRectItem); mDropCaretRectItem->setPen(QPen(Qt::darkGray)); mDropCaretRectItem->setBrush(QBrush(Qt::lightGray)); } diff --git a/src/gui/UBDocumentTreeWidget.h b/src/gui/UBDocumentTreeWidget.h index 2f336307..af78fe56 100644 --- a/src/gui/UBDocumentTreeWidget.h +++ b/src/gui/UBDocumentTreeWidget.h @@ -29,6 +29,7 @@ #define UBDOCUMENTTREEWIDGET_H_ #include +#include class UBDocumentProxy; class UBDocumentProxyTreeItem; diff --git a/src/gui/UBDownloadWidget.cpp b/src/gui/UBDownloadWidget.cpp index a1f3092f..71c0b695 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()->setResizeMode(eItemColumn_Desc, QHeaderView::Stretch); - mpTree->header()->setResizeMode(eItemColumn_Close, QHeaderView::Custom); + mpTree->header()->setSectionResizeMode(eItemColumn_Desc, QHeaderView::Stretch); + mpTree->header()->setSectionResizeMode(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 c59ac6b2..3ffec315 100644 --- a/src/gui/UBFeaturesActionBar.cpp +++ b/src/gui/UBFeaturesActionBar.cpp @@ -23,7 +23,8 @@ */ - +#include +#include #include "UBFeaturesActionBar.h" #include "core/memcheck.h" diff --git a/src/gui/UBFeaturesActionBar.h b/src/gui/UBFeaturesActionBar.h index 409b5963..c27cbf89 100644 --- a/src/gui/UBFeaturesActionBar.h +++ b/src/gui/UBFeaturesActionBar.h @@ -31,6 +31,9 @@ #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 8c791061..23c5f162 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -27,6 +27,8 @@ #include #include +#include +#include #include "UBFeaturesWidget.h" #include "gui/UBThumbnailWidget.h" @@ -267,8 +269,8 @@ void UBFeaturesWidget::onDisplayMetadata( QMap metadata ) { QString previewImageUrl = ":images/libpalette/notFound.png"; - QString widgetsUrl = QUrl::fromEncoded(metadata["Url"].toAscii()).toString()/*metadata.value("Url", QString())*/; - QString widgetsThumbsUrl = QUrl::fromEncoded(metadata["thumbnailUrl"].toAscii()).toString(); + QString widgetsUrl = QUrl::fromEncoded(metadata["Url"].toLatin1()).toString()/*metadata.value("Url", QString())*/; + QString widgetsThumbsUrl = QUrl::fromEncoded(metadata["thumbnailUrl"].toLatin1()).toString(); QString strType = UBFileSystemUtils::mimeTypeFromFileName(widgetsUrl); UBMimeType::Enum thumbType = UBFileSystemUtils::mimeTypeFromString(strType); @@ -440,7 +442,7 @@ void UBFeaturesListView::dragMoveEvent( QDragMoveEvent *event ) void UBFeaturesListView::dropEvent( QDropEvent *event ) { - QWidget *eventSource = event->source(); + QObject *eventSource = event->source(); if (eventSource && eventSource->objectName() == UBFeaturesWidget::objNameFeatureList) { event->setDropAction( Qt::MoveAction ); } @@ -1172,7 +1174,7 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const if (!typeData.isNull()) { typeData += UBFeaturesController::featureTypeSplitter(); } - typeData += QString::number(element.getType()).toAscii(); + typeData += QString::number(element.getType()).toLatin1(); } } diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index d2b2a966..f9f67a47 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -41,6 +41,10 @@ #include #include #include +#include +#include +#include +#include #include "UBDockPaletteWidget.h" #include "core/UBSettings.h" @@ -393,6 +397,8 @@ 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 d01a88fe..749320c2 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_WS_WIN +#ifndef Q_OS_WIN setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_MacAlwaysShowToolWindow); #endif -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX 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 4f242f4b..b6ce41cf 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_WS_WIN +#ifndef Q_OS_WIN // setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_MacAlwaysShowToolWindow); #endif -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX 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 fcc13a8b..0e942605 100644 --- a/src/gui/UBMagnifer.h +++ b/src/gui/UBMagnifer.h @@ -29,6 +29,7 @@ #define UBMAGNIFIER_H #include +#include class UBMagnifierParams { diff --git a/src/gui/UBMainWindow.cpp b/src/gui/UBMainWindow.cpp index 93292c26..5269c5dd 100644 --- a/src/gui/UBMainWindow.cpp +++ b/src/gui/UBMainWindow.cpp @@ -26,6 +26,8 @@ #include +#include +#include #include "UBMainWindow.h" #include "core/UBApplication.h" @@ -34,7 +36,7 @@ #include "core/UBDisplayManager.h" // work around for handling tablet events on MAC OS with Qt 4.8.0 and above -#if defined(Q_WS_MACX) +#if defined(Q_OS_OSX) #include "board/UBBoardView.h" #endif @@ -62,10 +64,10 @@ UBMainWindow::UBMainWindow(QWidget *parent, Qt::WindowFlags flags) mStackedLayout = new QStackedLayout(centralWidget); setCentralWidget(centralWidget); -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX actionPreferences->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Comma)); actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); -#elif defined(Q_WS_WIN) +#elif defined(Q_OS_WIN) actionPreferences->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return)); // 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)); @@ -148,7 +150,7 @@ void UBMainWindow::closeEvent(QCloseEvent *event) } // work around for handling tablet events on MAC OS with Qt 4.8.0 and above -#if defined(Q_WS_MACX) +#if defined(Q_OS_OSX) bool UBMainWindow::event(QEvent *event) { bool bRes = QMainWindow::event(event); @@ -199,7 +201,7 @@ bool UBMainWindow::yesNoQuestion(QString windowTitle, QString text) messageBox.addButton(tr("No"),QMessageBox::NoRole); messageBox.setIcon(QMessageBox::Question); -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX // to avoid to be handled by x11. This allows us to keep to the back all the windows manager stuff like palette, toolbar ... messageBox.setWindowFlags(Qt::Dialog | Qt::X11BypassWindowManagerHint); #else diff --git a/src/gui/UBMainWindow.h b/src/gui/UBMainWindow.h index ecc25fa0..cf6b715d 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_WS_MACX) +#if defined(Q_OS_OSX) bool event(QEvent *event); #endif UBDownloadWidget* mpDownloadWidget; diff --git a/src/gui/UBMessageWindow.cpp b/src/gui/UBMessageWindow.cpp index ea9831de..3a1c5109 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_WS_MAC +#ifdef Q_OS_OSX mLayout->setContentsMargins(radius() + 15, 8, radius() + 15, 10); #endif diff --git a/src/gui/UBMessageWindow.h b/src/gui/UBMessageWindow.h index 68e1825d..db3dc895 100644 --- a/src/gui/UBMessageWindow.h +++ b/src/gui/UBMessageWindow.h @@ -29,6 +29,8 @@ #define UBMESSAGEWINDOW_H_ #include +#include +#include #include "UBFloatingPalette.h" diff --git a/src/gui/UBMessagesDialog.cpp b/src/gui/UBMessagesDialog.cpp index cfd26307..45c458f9 100644 --- a/src/gui/UBMessagesDialog.cpp +++ b/src/gui/UBMessagesDialog.cpp @@ -23,7 +23,9 @@ */ - +#include +#include +#include #include "UBMessagesDialog.h" @@ -65,4 +67,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 ba7e4d2c..4a6197cb 100644 --- a/src/gui/UBMessagesDialog.h +++ b/src/gui/UBMessagesDialog.h @@ -29,6 +29,7 @@ #define UB_MESSAGES_DIALOG_H_ #include +#include class UBMessagesDialog : public QWidget { @@ -46,4 +47,4 @@ private: int mMessagesFontSize; }; -#endif /* UB_MESSAGES_DIALOG_H_ */ \ No newline at end of file +#endif /* UB_MESSAGES_DIALOG_H_ */ diff --git a/src/gui/UBMousePressFilter.cpp b/src/gui/UBMousePressFilter.cpp index 06e5f872..126432a7 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 d444a735..a6c36e98 100644 --- a/src/gui/UBRubberBand.cpp +++ b/src/gui/UBRubberBand.cpp @@ -28,10 +28,10 @@ #include "UBRubberBand.h" #include -#include #include +#include -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX #include #endif @@ -50,11 +50,11 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p) { customStyle = NULL; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN customStyle = new QWindowsXPStyle(); -#elif defined(Q_WS_MAC) +#elif defined(Q_OS_OSX) customStyle = new QMacStyle(); -#elif defined(Q_WS_X11) +#elif defined(Q_OS_LINUX) customStyle = QStyleFactory::create("oxygen"); #endif diff --git a/src/gui/UBScreenMirror.cpp b/src/gui/UBScreenMirror.cpp index 47f0832d..a4cda1be 100644 --- a/src/gui/UBScreenMirror.cpp +++ b/src/gui/UBScreenMirror.cpp @@ -24,6 +24,7 @@ +#include #include "UBScreenMirror.h" @@ -32,7 +33,7 @@ #include "core/UBApplication.h" #include "board/UBBoardController.h" -#if defined(Q_WS_MAC) +#if defined(Q_OS_OSX) #include #endif diff --git a/src/gui/UBScreenMirror.h b/src/gui/UBScreenMirror.h index a6736d3b..6954d48f 100644 --- a/src/gui/UBScreenMirror.h +++ b/src/gui/UBScreenMirror.h @@ -29,6 +29,7 @@ #define UBSCREENMIRROR_H_ #include +#include class UBScreenMirror : public QWidget { diff --git a/src/gui/UBSpinningWheel.cpp b/src/gui/UBSpinningWheel.cpp index 94197697..185420bf 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 % 12)); + painter.rotate(30 * (mPosition.loadAcquire() % 12)); for(int i = 0; i < 12; i++) { diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index 19ac5d01..1acfd3a3 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -26,6 +26,7 @@ #include #include +#include #include "UBThumbnailWidget.h" #include "UBRubberBand.h" @@ -242,9 +243,10 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event) option.initFrom(&rubberBand); mPrevLassoRect = QRect(); - mLassoRectItem = new QGraphicsRectItem(0, scene()); + mLassoRectItem = new QGraphicsRectItem(0); + scene()->addItem(mLassoRectItem); -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX // The following code must stay in synch with \src\gui\styles\qmacstyle_mac.mm QColor strokeColor; strokeColor.setHsvF(0, 0, 0.86, 1.0); @@ -772,7 +774,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD , bCanMoveDown(false) { if(0 <= UBDocumentContainer::pageFromSceneIndex(pSceneIndex)){ - setAcceptsHoverEvents(true); + setAcceptHoverEvents(true); setFlag(QGraphicsItem::ItemIsSelectable, true); } } diff --git a/src/gui/UBToolWidget.cpp b/src/gui/UBToolWidget.cpp index 682dddfa..660617d0 100644 --- a/src/gui/UBToolWidget.cpp +++ b/src/gui/UBToolWidget.cpp @@ -26,6 +26,9 @@ #include +#include +#include + #include "UBToolWidget.h" #include "api/UBWidgetUniboardAPI.h" #include "api/UBW3CWidgetAPI.h" @@ -115,7 +118,8 @@ void UBToolWidget::initialize() setFixedSize(mToolWidget->boundingRect().width() + mContentMargin * 2, mToolWidget->boundingRect().height() + mContentMargin * 2); - connect(mWebView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared())); + connect(mWebView->page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared, + this, &UBToolWidget::javaScriptWindowObjectCleared); mWebView->load(mToolWidget->mainHtml()); diff --git a/src/gui/UBToolWidget.h b/src/gui/UBToolWidget.h index 35f4eb76..56fc5e41 100644 --- a/src/gui/UBToolWidget.h +++ b/src/gui/UBToolWidget.h @@ -29,6 +29,7 @@ #define UBTOOLWIDGET_H_ #include +#include class UBGraphicsWidgetItem; class QWidget; diff --git a/src/gui/UBToolbarButtonGroup.cpp b/src/gui/UBToolbarButtonGroup.cpp index 7c1e85e8..db79e7ac 100644 --- a/src/gui/UBToolbarButtonGroup.cpp +++ b/src/gui/UBToolbarButtonGroup.cpp @@ -28,6 +28,8 @@ #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 7ba901b3..d802950c 100644 --- a/src/gui/UBToolbarButtonGroup.h +++ b/src/gui/UBToolbarButtonGroup.h @@ -30,6 +30,10 @@ #include +#include +#include +#include +#include class UBToolbarButtonGroup : public QWidget { diff --git a/src/gui/UBWidgetMirror.h b/src/gui/UBWidgetMirror.h index 3916ae3d..6ca2b3d1 100644 --- a/src/gui/UBWidgetMirror.h +++ b/src/gui/UBWidgetMirror.h @@ -29,6 +29,7 @@ #define UBWIDGETMIRROR_H_ #include +#include class UBWidgetMirror : public QWidget { diff --git a/src/gui/UBZoomPalette.cpp b/src/gui/UBZoomPalette.cpp index e380c365..10194113 100644 --- a/src/gui/UBZoomPalette.cpp +++ b/src/gui/UBZoomPalette.cpp @@ -28,6 +28,7 @@ #include "UBZoomPalette.h" #include +#include #include #include "core/UBApplication.h" diff --git a/src/network/UBNetworkAccessManager.cpp b/src/network/UBNetworkAccessManager.cpp index 7e8a4564..87f3a1ea 100644 --- a/src/network/UBNetworkAccessManager.cpp +++ b/src/network/UBNetworkAccessManager.cpp @@ -29,6 +29,8 @@ #include #include +#include +#include #include "core/UBApplication.h" #include "core/UBApplicationController.h" @@ -115,7 +117,7 @@ void UBNetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthe passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); QString introMessage = tr("Enter username and password for \"%1\" at %2"); - introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString())); + introMessage = introMessage.arg((reply->url().toString()).toHtmlEscaped()).arg((reply->url().toString()).toHtmlEscaped()); passwordDialog.introLabel->setText(introMessage); passwordDialog.introLabel->setWordWrap(true); diff --git a/src/pdf-merger/Utils.cpp b/src/pdf-merger/Utils.cpp index 8e9965c9..c7e75098 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).toAscii()); + return std::string(QString::number(integer).toLatin1()); } std::string Utils::doubleToStr(double doubleValue) { - return std::string(QString::number(doubleValue).toAscii()); + return std::string(QString::number(doubleValue).toLatin1()); } int Utils::_stringToInt(const std::string & str) //throw ConvertException diff --git a/src/pdf-merger/pdfMerger.pri b/src/pdf-merger/pdfMerger.pri index b27b90c6..456f2df3 100644 --- a/src/pdf-merger/pdfMerger.pri +++ b/src/pdf-merger/pdfMerger.pri @@ -1,60 +1,59 @@ - HEADERS += \ - 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 + 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 SOURCES += \ - 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/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 \ 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 03f97bde..85761898 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 afc4c6ea..e85a6953 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 1deaac5c..5fdc09c3 100644 --- a/src/pdf/PDFRenderer.cpp +++ b/src/pdf/PDFRenderer.cpp @@ -26,6 +26,7 @@ #include +#include #include "PDFRenderer.h" @@ -97,7 +98,7 @@ void PDFRenderer::attach() void PDFRenderer::detach() { mRefCount.deref(); - if (mRefCount == 0) + if (mRefCount.loadAcquire() == 0) { sRenderers.remove(mFileUuid); delete this; diff --git a/src/pdf/UBWebPluginPDFWidget.cpp b/src/pdf/UBWebPluginPDFWidget.cpp index 16274ca2..9dd054e9 100644 --- a/src/pdf/UBWebPluginPDFWidget.cpp +++ b/src/pdf/UBWebPluginPDFWidget.cpp @@ -26,6 +26,7 @@ #include +#include #include "UBWebPluginPDFWidget.h" #include "XPDFRenderer.h" diff --git a/src/pdf/XPDFRenderer.cpp b/src/pdf/XPDFRenderer.cpp index f6040675..6c65ce9e 100644 --- a/src/pdf/XPDFRenderer.cpp +++ b/src/pdf/XPDFRenderer.cpp @@ -66,7 +66,7 @@ XPDFRenderer::~XPDFRenderer() sInstancesCount.deref(); } - if (sInstancesCount == 0 && globalParams) + if (sInstancesCount.loadAcquire() == 0 && globalParams) { delete globalParams; globalParams = 0; diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 0739499b..12641434 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -56,10 +56,10 @@ -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #include "windowsmedia/UBWindowsMediaVideoEncoder.h" #include "windowsmedia/UBWaveRecorder.h" -#elif defined(Q_WS_MAC) +#elif defined(Q_OS_OSX) #include "quicktime/UBQuickTimeVideoEncoder.h" #include "quicktime/UBAudioQueueRecorder.h" #endif @@ -303,9 +303,9 @@ void UBPodcastController::start() applicationMainModeChanged(UBApplication::applicationController->displayMode()); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop -#elif defined(Q_WS_MAC) +#elif defined(Q_OS_OSX) mVideoEncoder = new UBQuickTimeVideoEncoder(this); //deleted on stop #endif @@ -487,7 +487,7 @@ void UBPodcastController::processWidgetPaintEvent() { while(mWidgetRepaintRectQueue.size() > 0) { - repaintRect = repaintRect.unite(mWidgetRepaintRectQueue.dequeue()); + repaintRect = repaintRect.united(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.intersect(viewportRect); + QRectF maxRect = rect.intersected(viewportRect); mSceneRepaintRectQueue.enqueue(maxRect); } @@ -623,7 +623,7 @@ void UBPodcastController::processScenePaintEvent() { while(mSceneRepaintRectQueue.size() > 0) { - repaintRect = repaintRect.unite(mSceneRepaintRectQueue.dequeue()); + repaintRect = repaintRect.united(mSceneRepaintRectQueue.dequeue()); } } @@ -712,7 +712,7 @@ void UBPodcastController::encodingFinished(bool ok) { QString location; - if (mPodcastRecordingPath == QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)) + if (mPodcastRecordingPath == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) location = tr("on your desktop ..."); else { @@ -793,9 +793,9 @@ QStringList UBPodcastController::audioRecordingDevices() { QStringList devices; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN devices = UBWaveRecorder::waveInDevices(); -#elif defined(Q_WS_MAC) +#elif defined(Q_OS_OSX) devices = UBAudioQueueRecorder::waveInDevices(); #endif diff --git a/src/podcast/UBPodcastRecordingPalette.h b/src/podcast/UBPodcastRecordingPalette.h index b475c887..bde6d785 100644 --- a/src/podcast/UBPodcastRecordingPalette.h +++ b/src/podcast/UBPodcastRecordingPalette.h @@ -32,6 +32,7 @@ #include "UBPodcastController.h" #include +#include class UBVuMeter; diff --git a/src/podcast/quicktime/UBQuickTimeFile.cpp b/src/podcast/quicktime/UBQuickTimeFile.cpp index 40bdead6..97ebf048 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_WS_MACX +#ifdef Q_OS_OSX free((void*)inPacketDescs); #endif } diff --git a/src/tools/UBAbstractDrawRuler.cpp b/src/tools/UBAbstractDrawRuler.cpp index 4db193d0..167d6bca 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.setAcceptsHoverEvents(true); + item.setAcceptHoverEvents(true); mCloseSvgItem = new QGraphicsSvgItem(":/images/closeTool.svg", &item); mCloseSvgItem->setVisible(false); diff --git a/src/tools/UBAbstractDrawRuler.h b/src/tools/UBAbstractDrawRuler.h index 5b66acc2..5916c5cf 100644 --- a/src/tools/UBAbstractDrawRuler.h +++ b/src/tools/UBAbstractDrawRuler.h @@ -29,6 +29,7 @@ #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 6e0b751f..660025c4 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); - setAcceptsHoverEvents(true); + setAcceptHoverEvents(true); mCloseSvgItem = new QGraphicsSvgItem(":/images/closeTool.svg", this); mCloseSvgItem->setVisible(false); diff --git a/src/tools/UBGraphicsProtractor.cpp b/src/tools/UBGraphicsProtractor.cpp index 74f192a0..05b84257 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); - scale(1.5, 1.5); + setTransform(QTransform::fromScale(1.5, 1.5), true); } @@ -201,9 +201,9 @@ void UBGraphicsProtractor::mouseMoveEvent(QGraphicsSceneMouseEvent *event) case Resize : prepareGeometryChange(); - translate(rect().center().x(), rect().center().y()); - scale(scaleFactor, scaleFactor); - translate(-rect().center().x(), -rect().center().y()); + 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); mScaleFactor *= scaleFactor; break; @@ -378,7 +378,7 @@ void UBGraphicsProtractor::paintGraduations(QPainter *painter) const int oneDegreeGraduationLength = 5; QFont font1 = painter->font(); -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX 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->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... + 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... mResetSvgItem->setPos(resetButtonRect().topLeft() + rect().center()); mResetSvgItem->resetTransform(); - 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... + 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... mResizeSvgItem->setPos(resizeButtonRect().topLeft() + rect().center()); mResizeSvgItem->resetTransform(); - 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... + 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... mRotateSvgItem->setPos(rotateButtonRect().topLeft() + rect().center()); mRotateSvgItem->resetTransform(); - 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... + 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... } qreal scale = markerSizeReference().width()/mMarkerSvgItem->boundingRect().width(); mMarkerSvgItem->setPos(markerButtonRect().topLeft() + rect().center()); mMarkerSvgItem->resetTransform(); - 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... + 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... mCloseSvgItem->setVisible(mShowButtons); mResetSvgItem->setVisible(mShowButtons); diff --git a/src/web/UBOEmbedParser.cpp b/src/web/UBOEmbedParser.cpp index 78576980..0760f74e 100644 --- a/src/web/UBOEmbedParser.cpp +++ b/src/web/UBOEmbedParser.cpp @@ -226,8 +226,7 @@ sOEmbedContent UBOEmbedParser::getXMLInfos(const QString &xml) void UBOEmbedParser::onParseContent(QString url) { - QUrl qurl; - qurl.setEncodedUrl(url.toAscii()); + QUrl qurl = QUrl::fromEncoded(url.toLatin1()); QNetworkRequest req; req.setUrl(qurl); diff --git a/src/web/UBTrapFlashController.cpp b/src/web/UBTrapFlashController.cpp index ba5b97f0..d00c1434 100644 --- a/src/web/UBTrapFlashController.cpp +++ b/src/web/UBTrapFlashController.cpp @@ -28,6 +28,7 @@ #include "UBTrapFlashController.h" #include +#include #include "frameworks/UBFileSystemUtils.h" @@ -99,22 +100,17 @@ void UBTrapFlashController::text_Changed(const QString &newText) { QString new_text = newText; -#ifdef Q_WS_WIN // Defined on Windows. +#ifdef Q_OS_WIN // Defined on Windows. QString illegalCharList(" < > : \" / \\ | ? * "); QRegExp regExp("[<>:\"/\\\\|?*]"); #endif -#ifdef Q_WS_QWS // Defined on Qt for Embedded Linux. +#ifdef Q_OS_OSX // Defined on Mac OS X. QString illegalCharList(" < > : \" / \\ | ? * "); QRegExp regExp("[<>:\"/\\\\|?*]"); #endif -#ifdef Q_WS_MAC // Defined on Mac OS X. - QString illegalCharList(" < > : \" / \\ | ? * "); - QRegExp regExp("[<>:\"/\\\\|?*]"); -#endif - -#ifdef Q_WS_X11 // Defined on X11. +#ifdef Q_OS_LINUX // Defined on X11. QString illegalCharList(" < > : \" / \\ | ? * "); QRegExp regExp("[<>:\"/\\\\|?*]"); #endif diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp index 0c21d499..97c6dfbf 100644 --- a/src/web/UBWebController.cpp +++ b/src/web/UBWebController.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "frameworks/UBPlatformUtils.h" @@ -298,7 +299,7 @@ void UBWebController::setupPalettes() { mToolsCurrentPalette = new UBWebToolsPalette(UBApplication::mainWindow); UBApplication::boardController->paletteManager()->setCurrentWebToolsPalette(mToolsCurrentPalette); -#ifndef Q_WS_WIN +#ifndef Q_OS_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 b82f564a..d7292a00 100644 --- a/src/web/UBWebController.h +++ b/src/web/UBWebController.h @@ -30,6 +30,7 @@ #include #include +#include #include "UBOEmbedParser.h" diff --git a/src/web/UBWebKitUtils.cpp b/src/web/UBWebKitUtils.cpp index 1bfc2d46..1dce1da9 100644 --- a/src/web/UBWebKitUtils.cpp +++ b/src/web/UBWebKitUtils.cpp @@ -24,6 +24,7 @@ #include +#include #include "UBWebKitUtils.h" diff --git a/src/web/browser/WBBrowserWindow.cpp b/src/web/browser/WBBrowserWindow.cpp index 6c93f3fe..8cba1382 100644 --- a/src/web/browser/WBBrowserWindow.cpp +++ b/src/web/browser/WBBrowserWindow.cpp @@ -70,6 +70,7 @@ #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 dc10372e..e536eb38 100644 --- a/src/web/browser/WBChaseWidget.cpp +++ b/src/web/browser/WBChaseWidget.cpp @@ -69,6 +69,7 @@ #include "WBChaseWidget.h" #include +#include #include "core/memcheck.h" diff --git a/src/web/browser/WBChaseWidget.h b/src/web/browser/WBChaseWidget.h index 20793d93..90b2a0fc 100644 --- a/src/web/browser/WBChaseWidget.h +++ b/src/web/browser/WBChaseWidget.h @@ -70,6 +70,7 @@ #define WBCHASEWIDGET_H #include +#include class WBChaseWidget : public QWidget diff --git a/src/web/browser/WBDownloadManager.cpp b/src/web/browser/WBDownloadManager.cpp index bb51cda0..e52a314d 100644 --- a/src/web/browser/WBDownloadManager.cpp +++ b/src/web/browser/WBDownloadManager.cpp @@ -70,6 +70,7 @@ #include #include +#include #include "network/UBAutoSaver.h" #include "network/UBNetworkAccessManager.h" @@ -145,7 +146,7 @@ void WBDownloadItem::getFileName() { QSettings settings; settings.beginGroup(QLatin1String("downloadmanager")); - QString defaultLocation = !mCustomDownloadPath.isEmpty() ? mCustomDownloadPath : QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); + QString defaultLocation = !mCustomDownloadPath.isEmpty() ? mCustomDownloadPath : QStandardPaths::writableLocation(QStandardPaths::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 8134cd01..53d013d6 100644 --- a/src/web/browser/WBDownloadManager.h +++ b/src/web/browser/WBDownloadManager.h @@ -74,6 +74,7 @@ #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 6cf7d20c..0a33617f 100644 --- a/src/web/browser/WBEditTableView.h +++ b/src/web/browser/WBEditTableView.h @@ -70,6 +70,7 @@ #define WBEDITTABLEVIEW_H #include +#include class WBEditTableView : public QTableView { diff --git a/src/web/browser/WBHistory.cpp b/src/web/browser/WBHistory.cpp index e1c2f7e9..b59d5acb 100644 --- a/src/web/browser/WBHistory.cpp +++ b/src/web/browser/WBHistory.cpp @@ -411,7 +411,8 @@ WBHistoryModel::WBHistoryModel(WBHistoryManager *history, QObject *parent) void WBHistoryModel::historyReset() { - reset(); + beginResetModel(); + endResetModel(); } void WBHistoryModel::entryAdded() @@ -751,7 +752,8 @@ QVariant WBHistoryFilterModel::headerData(int section, Qt::Orientation orientati void WBHistoryFilterModel::sourceReset() { m_loaded = false; - reset(); + beginResetModel(); + endResetModel(); } int WBHistoryFilterModel::rowCount(const QModelIndex &parent) const @@ -888,7 +890,8 @@ bool WBHistoryFilterModel::removeRows(int row, int count, const QModelIndex &par this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); m_loaded = false; if (oldCount - count != rowCount()) - reset(); + beginResetModel(); + endResetModel(); return true; } @@ -948,7 +951,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, 0); + return createIndex(row, column); } QModelIndex WBHistoryCompletionModel::parent(const QModelIndex &) const @@ -978,12 +981,14 @@ void WBHistoryCompletionModel::setSourceModel(QAbstractItemModel *newSourceModel this, SLOT(sourceReset())); } - reset(); + beginResetModel(); + endResetModel(); } void WBHistoryCompletionModel::sourceReset() { - reset(); + beginResetModel(); + endResetModel(); } WBHistoryTreeModel::WBHistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent) @@ -1107,7 +1112,7 @@ QModelIndex WBHistoryTreeModel::index(int row, int column, const QModelIndex &pa return QModelIndex(); if (!parent.isValid()) - return createIndex(row, column, 0); + return createIndex(row, column); return createIndex(row, column, parent.row() + 1); } @@ -1116,7 +1121,7 @@ QModelIndex WBHistoryTreeModel::parent(const QModelIndex &index) const int offset = index.internalId(); if (offset == 0 || !index.isValid()) return QModelIndex(); - return createIndex(offset - 1, 0, 0); + return createIndex(offset - 1, 0); } bool WBHistoryTreeModel::hasChildren(const QModelIndex &parent) const @@ -1183,13 +1188,15 @@ void WBHistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel) this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); } - reset(); + beginResetModel(); + endResetModel(); } void WBHistoryTreeModel::sourceReset() { m_sourceRowCache.clear(); - reset(); + beginResetModel(); + endResetModel(); } void WBHistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start, int end) @@ -1199,7 +1206,8 @@ void WBHistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start if (start != 0 || start != end) { m_sourceRowCache.clear(); - reset(); + beginResetModel(); + endResetModel(); return; } @@ -1249,7 +1257,8 @@ void WBHistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, if (it == m_sourceRowCache.end()) { m_sourceRowCache.clear(); - reset(); + beginResetModel(); + endResetModel(); return; } diff --git a/src/web/browser/WBModelMenu.h b/src/web/browser/WBModelMenu.h index ead85a76..af921b26 100644 --- a/src/web/browser/WBModelMenu.h +++ b/src/web/browser/WBModelMenu.h @@ -70,6 +70,7 @@ #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 a3ba1a88..c8344675 100644 --- a/src/web/browser/WBSearchLineEdit.cpp +++ b/src/web/browser/WBSearchLineEdit.cpp @@ -69,6 +69,7 @@ #include "WBSearchLineEdit.h" #include +#include #include "core/memcheck.h" diff --git a/src/web/browser/WBSearchLineEdit.h b/src/web/browser/WBSearchLineEdit.h index 47479525..236d52eb 100644 --- a/src/web/browser/WBSearchLineEdit.h +++ b/src/web/browser/WBSearchLineEdit.h @@ -72,6 +72,7 @@ #include "WBUrlLineEdit.h" #include +#include class WBSearchButton; diff --git a/src/web/browser/WBSqueezeLabel.h b/src/web/browser/WBSqueezeLabel.h index ac578cf5..712df8cc 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 b552fcba..23430c88 100644 --- a/src/web/browser/WBTabWidget.cpp +++ b/src/web/browser/WBTabWidget.cpp @@ -78,6 +78,8 @@ #include #include +#include +#include #include "core/memcheck.h" @@ -107,7 +109,7 @@ WBTabBar::WBTabBar(QWidget *parent) setMovable(true); setDocumentMode(false); -#ifdef Q_WS_MACX +#ifdef Q_OS_OSX 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 9a3f57ca..75c47fc4 100644 --- a/src/web/browser/WBTabWidget.h +++ b/src/web/browser/WBTabWidget.h @@ -70,6 +70,14 @@ #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 c6dd9053..b8ddc4c7 100644 --- a/src/web/browser/WBToolBarSearch.cpp +++ b/src/web/browser/WBToolBarSearch.cpp @@ -70,6 +70,8 @@ #include #include +#include +#include #include "network/UBAutoSaver.h" @@ -142,10 +144,13 @@ void WBToolbarSearch::searchNow() } QUrl url(QLatin1String("http://www.google.com/search")); - 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")); + 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); emit search(url); } diff --git a/src/web/browser/WBUrlLineEdit.cpp b/src/web/browser/WBUrlLineEdit.cpp index 494c2eaa..246895bf 100644 --- a/src/web/browser/WBUrlLineEdit.cpp +++ b/src/web/browser/WBUrlLineEdit.cpp @@ -74,6 +74,10 @@ #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 3247c53b..37090eff 100644 --- a/src/web/browser/WBUrlLineEdit.h +++ b/src/web/browser/WBUrlLineEdit.h @@ -70,6 +70,9 @@ #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 b036059f..0526158e 100644 --- a/src/web/browser/WBWebTrapWebView.cpp +++ b/src/web/browser/WBWebTrapWebView.cpp @@ -29,6 +29,8 @@ #include #include +#include +#include #include "web/UBWebKitUtils.h" @@ -61,7 +63,7 @@ void WBWebTrapWebView::setIsTrapping(bool pIsTrapping) mDomElementRect = QRect(); mCurrentContentType = Unknown; /* -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) if(mIsTrapping) { diff --git a/src/web/browser/WBWebTrapWebView.h b/src/web/browser/WBWebTrapWebView.h index 57bd7fc1..00679fe1 100644 --- a/src/web/browser/WBWebTrapWebView.h +++ b/src/web/browser/WBWebTrapWebView.h @@ -30,6 +30,7 @@ #include #include +#include class WBWebTrapWebView : public QWebView diff --git a/src/web/browser/WBWebView.cpp b/src/web/browser/WBWebView.cpp index e83b31ae..52bbef37 100644 --- a/src/web/browser/WBWebView.cpp +++ b/src/web/browser/WBWebView.cpp @@ -82,6 +82,8 @@ #include #include #include +#include +#include #include "core/memcheck.h" diff --git a/src/web/web.pri b/src/web/web.pri index 0b447efa..d85e5671 100644 --- a/src/web/web.pri +++ b/src/web/web.pri @@ -1,5 +1,5 @@ -CONFIG += uitools +QT += uitools FORMS += src/web/browser/downloaditem.ui \ src/web/browser/downloads.ui \