From 8254e807bd582b9a7e7e1d6e49d03ffdf4406271 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Thu, 3 Dec 2015 14:33:22 +0100 Subject: [PATCH] Fixed compilation on Windows; The project didn't compile on Windows.. list of modifications: - Added essential changes that hadn't been committed / pushed (Qt4->Qt5 changes; other misc. changes by Abdel) - Temporarily disabled podcasts, as the modules don't compile with Qt5.2/ 5.5 Currently, the application compiles on Windows, with MSVC2010 32-bit --- OpenBoard.pro | 2 ++ src/core/UBApplication.cpp | 2 +- src/desktop/UBWindowCaptureDelegate_win.cpp | 3 ++- src/frameworks/UBPlatformUtils_win.cpp | 3 ++- src/gui/UBRubberBand.cpp | 2 +- src/podcast/UBPodcastController.cpp | 8 ++++---- src/podcast/podcast.pri | 16 ++++++++-------- src/podcast/windowsmedia/UBWaveRecorder.cpp | 6 +++--- src/podcast/windowsmedia/UBWindowsMediaFile.cpp | 4 ++-- src/podcast/windowsmedia/UBWindowsMediaFile.h | 3 ++- 10 files changed, 27 insertions(+), 22 deletions(-) diff --git a/OpenBoard.pro b/OpenBoard.pro index a9e2b737..bcaf956d 100644 --- a/OpenBoard.pro +++ b/OpenBoard.pro @@ -124,6 +124,8 @@ win32 { system(echo "$$LONG_VERSION" > $$BUILD_DIR/longversion) system(echo "$$SVN_VERSION" > $$BUILD_DIR/svnversion) + DEFINES += NOMINMAX # avoids compilation error in qdatetime.h + } macx { diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 24558e59..5f1b560c 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -646,7 +646,7 @@ bool UBApplication::isFromWeb(QString url) { bool res = true; - if( url.startsWith("uniboardTool://") || + if( url.startsWith("OpenboardTool://") || url.startsWith("file://") || url.startsWith("/")){ res = false; diff --git a/src/desktop/UBWindowCaptureDelegate_win.cpp b/src/desktop/UBWindowCaptureDelegate_win.cpp index 3db98ac9..cc43b489 100644 --- a/src/desktop/UBWindowCaptureDelegate_win.cpp +++ b/src/desktop/UBWindowCaptureDelegate_win.cpp @@ -27,6 +27,7 @@ #include "UBWindowCaptureDelegate_win.h" #include +#include #include "core/memcheck.h" @@ -79,7 +80,7 @@ int UBWindowCaptureDelegate::execute() mutex.lock(); sleep.wait(&mutex, 200); mutex.unlock(); - mCapturedPixmap = QPixmap::grabWindow(mCurrentWindow); + mCapturedPixmap = QPixmap::grabWindow((WId)mCurrentWindow); return QDialog::Accepted; } else diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp index 1c1f453f..b4f25c67 100644 --- a/src/frameworks/UBPlatformUtils_win.cpp +++ b/src/frameworks/UBPlatformUtils_win.cpp @@ -126,11 +126,12 @@ void UBPlatformUtils::setDesktopMode(bool desktop) } void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivable) -{ +{/* long exStyle = (nonAcivable) ? GetWindowLong(widget->winId(), GWL_EXSTYLE) | WS_EX_NOACTIVATE : GetWindowLong(widget->winId(), GWL_EXSTYLE) & ~WS_EX_NOACTIVATE; SetWindowLong(widget->winId(), GWL_EXSTYLE, exStyle); + */ } #define KEYBTDECL(s1, s2, clSwitch) KEYBT(s1, s2, clSwitch, 0, 0, KEYCODE(s1), KEYCODE(s2)) diff --git a/src/gui/UBRubberBand.cpp b/src/gui/UBRubberBand.cpp index 8fdd3117..2dab3ede 100644 --- a/src/gui/UBRubberBand.cpp +++ b/src/gui/UBRubberBand.cpp @@ -47,7 +47,7 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p) customStyle = NULL; #ifdef Q_OS_WIN - customStyle = new QWindowsXPStyle(); + customStyle = QStyleFactory::create("windows"); #elif defined(Q_OS_OSX) customStyle = QStyleFactory::create("macintosh"); #elif defined(Q_OS_LINUX) diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 12641434..98a5c79f 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -57,8 +57,8 @@ #ifdef Q_OS_WIN - #include "windowsmedia/UBWindowsMediaVideoEncoder.h" - #include "windowsmedia/UBWaveRecorder.h" + // #include "windowsmedia/UBWindowsMediaVideoEncoder.h" + // #include "windowsmedia/UBWaveRecorder.h" #elif defined(Q_OS_OSX) #include "quicktime/UBQuickTimeVideoEncoder.h" #include "quicktime/UBAudioQueueRecorder.h" @@ -304,7 +304,7 @@ void UBPodcastController::start() applicationMainModeChanged(UBApplication::applicationController->displayMode()); #ifdef Q_OS_WIN - mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop + //mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop #elif defined(Q_OS_OSX) mVideoEncoder = new UBQuickTimeVideoEncoder(this); //deleted on stop #endif @@ -794,7 +794,7 @@ QStringList UBPodcastController::audioRecordingDevices() QStringList devices; #ifdef Q_OS_WIN - devices = UBWaveRecorder::waveInDevices(); + //devices = UBWaveRecorder::waveInDevices(); #elif defined(Q_OS_OSX) devices = UBAudioQueueRecorder::waveInDevices(); #endif diff --git a/src/podcast/podcast.pri b/src/podcast/podcast.pri index 3dde6273..a9ced647 100644 --- a/src/podcast/podcast.pri +++ b/src/podcast/podcast.pri @@ -13,14 +13,14 @@ SOURCES += src/podcast/UBPodcastController.cpp \ win32 { - SOURCES += src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp \ - src/podcast/windowsmedia/UBWindowsMediaFile.cpp \ - src/podcast/windowsmedia/UBWaveRecorder.cpp - - HEADERS += src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.h \ - src/podcast/windowsmedia/UBWindowsMediaFile.h \ - src/podcast/windowsmedia/UBWaveRecorder.h -} +# SOURCES += src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp \ +# src/podcast/windowsmedia/UBWindowsMediaFile.cpp \ +# src/podcast/windowsmedia/UBWaveRecorder.cpp +# +# HEADERS += src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.h \ +# src/podcast/windowsmedia/UBWindowsMediaFile.h \ +# src/podcast/windowsmedia/UBWaveRecorder.h +} macx { diff --git a/src/podcast/windowsmedia/UBWaveRecorder.cpp b/src/podcast/windowsmedia/UBWaveRecorder.cpp index 4d0e55bd..31a27835 100644 --- a/src/podcast/windowsmedia/UBWaveRecorder.cpp +++ b/src/podcast/windowsmedia/UBWaveRecorder.cpp @@ -63,7 +63,7 @@ bool UBWaveRecorder::init(const QString& waveInDeviceName) { if (waveInGetDevCaps(i, &caps, sizeof(caps)) == MMSYSERR_NOERROR) { - QString deviceName = QString:: fromUtf16(caps.szPname); + QString deviceName = QString::fromWCharArray(caps.szPname); if (deviceName == waveInDeviceName) { @@ -237,7 +237,7 @@ QStringList UBWaveRecorder::waveInDevices() { if (waveInGetDevCaps(i, &caps, sizeof(caps)) == MMSYSERR_NOERROR) { - devices << QString::fromUtf16(caps.szPname); + devices << QString::fromWCharArray(caps.szPname); } else { @@ -253,7 +253,7 @@ QStringList UBWaveRecorder::waveInDevices() if (mixerGetDevCaps(i, &caps, sizeof(caps)) == MMSYSERR_NOERROR) { - qDebug() << "Mixer: " << QString::fromUtf16(caps.szPname); + qDebug() << "Mixer: " << QString::fromWCharArray(caps.szPname); } } diff --git a/src/podcast/windowsmedia/UBWindowsMediaFile.cpp b/src/podcast/windowsmedia/UBWindowsMediaFile.cpp index af33d0c6..dbb4fe06 100644 --- a/src/podcast/windowsmedia/UBWindowsMediaFile.cpp +++ b/src/podcast/windowsmedia/UBWindowsMediaFile.cpp @@ -383,7 +383,7 @@ bool UBWindowsMediaFile::appendVideoFrame(const QImage& pImage, long mstimestamp INSSBuffer *sampleBuffer = 0; - if (FAILED(mWMWriter->AllocateSample(pImage.numBytes(), &sampleBuffer))) + if (FAILED(mWMWriter->AllocateSample(pImage.byteCount(), &sampleBuffer))) { setLastErrorMessage("Unable to allocate memory for new video frame"); return false; @@ -400,7 +400,7 @@ bool UBWindowsMediaFile::appendVideoFrame(const QImage& pImage, long mstimestamp } const uchar * imageBuffer = pImage.bits(); - memcpy((void*) rawBuffer, imageBuffer, pImage.numBytes()); + memcpy((void*) rawBuffer, imageBuffer, pImage.byteCount()); HRESULT hrWriteSample = mWMWriter->WriteSample(mVideoInputIndex, msToSampleTime(mstimestamp), 0, sampleBuffer); diff --git a/src/podcast/windowsmedia/UBWindowsMediaFile.h b/src/podcast/windowsmedia/UBWindowsMediaFile.h index ff528c7a..703e027a 100644 --- a/src/podcast/windowsmedia/UBWindowsMediaFile.h +++ b/src/podcast/windowsmedia/UBWindowsMediaFile.h @@ -30,8 +30,9 @@ #include -#include +#include +#include class UBWindowsMediaFile : public QObject {