preferencesAboutTextFull
agriche 9 years ago
commit 411a09886a
  1. 10
      src/core/UBDisplayManager.cpp
  2. 3
      src/desktop/UBCustomCaptureWindow.cpp
  3. 2
      src/desktop/UBDesktopAnnotationController.cpp
  4. 50
      src/domain/UBGraphicsMediaItem.cpp
  5. 16
      src/domain/UBGraphicsMediaItem.h
  6. 2
      src/domain/UBGraphicsMediaItemDelegate.cpp
  7. 1
      src/frameworks/UBPlatformUtils.h
  8. 10
      src/frameworks/UBPlatformUtils_linux.cpp
  9. 79
      src/frameworks/UBPlatformUtils_mac.mm
  10. 7
      src/frameworks/UBPlatformUtils_win.cpp

@ -158,7 +158,7 @@ void UBDisplayManager::setDisplayWidget(QWidget* pDisplayWidget)
mDisplayWidget = pDisplayWidget; mDisplayWidget = pDisplayWidget;
mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex)); mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex));
if (UBSettings::settings()->appUseMultiscreen->get().toBool()) if (UBSettings::settings()->appUseMultiscreen->get().toBool())
mDisplayWidget->showFullScreen(); UBPlatformUtils::showFullScreen(mDisplayWidget);
} }
} }
@ -209,14 +209,14 @@ void UBDisplayManager::positionScreens()
{ {
mControlWidget->hide(); mControlWidget->hide();
mControlWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex)); mControlWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex));
mControlWidget->showFullScreen(); UBPlatformUtils::showFullScreen(mControlWidget);
} }
if (mDisplayWidget && mDisplayScreenIndex > -1) if (mDisplayWidget && mDisplayScreenIndex > -1)
{ {
mDisplayWidget->hide(); mDisplayWidget->hide();
mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex)); mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex));
mDisplayWidget->showFullScreen(); UBPlatformUtils::showFullScreen(mDisplayWidget);
} }
else if(mDisplayWidget) else if(mDisplayWidget)
{ {
@ -234,7 +234,7 @@ void UBDisplayManager::positionScreens()
{ {
QWidget* previous = mPreviousDisplayWidgets.at(psi); QWidget* previous = mPreviousDisplayWidgets.at(psi);
previous->setGeometry(mDesktop->screenGeometry(mPreviousScreenIndexes.at(psi))); previous->setGeometry(mDesktop->screenGeometry(mPreviousScreenIndexes.at(psi)));
previous->showFullScreen(); UBPlatformUtils::showFullScreen(previous);
} }
} }
@ -280,7 +280,7 @@ void UBDisplayManager::blackout()
foreach(UBBlackoutWidget *blackoutWidget, mBlackoutWidgets) foreach(UBBlackoutWidget *blackoutWidget, mBlackoutWidgets)
{ {
blackoutWidget->showFullScreen(); UBPlatformUtils::showFullScreen(blackoutWidget);
} }
} }

@ -30,6 +30,7 @@
#include "UBCustomCaptureWindow.h" #include "UBCustomCaptureWindow.h"
#include "frameworks/UBPlatformUtils.h"
#include "gui/UBRubberBand.h" #include "gui/UBRubberBand.h"
#include "core/memcheck.h" #include "core/memcheck.h"
@ -74,7 +75,7 @@ int UBCustomCaptureWindow::execute(const QPixmap &pScreenPixmap)
int currentScreen = desktop->screenNumber(QCursor::pos()); int currentScreen = desktop->screenNumber(QCursor::pos());
setGeometry(desktop->screenGeometry(currentScreen)); setGeometry(desktop->screenGeometry(currentScreen));
showFullScreen(); UBPlatformUtils::showFullScreen(this);
setWindowOpacity(1.0); setWindowOpacity(1.0);
return exec(); return exec();

@ -332,7 +332,7 @@ void UBDesktopAnnotationController::showWindow()
UBDrawingController::drawingController()->setStylusTool(mDesktopStylusTool); UBDrawingController::drawingController()->setStylusTool(mDesktopStylusTool);
#ifndef Q_OS_LINUX #ifndef Q_OS_LINUX
mTransparentDrawingView->showFullScreen(); UBPlatformUtils::showFullScreen(mTransparentDrawingView);
#else #else
// this is necessary to avoid unity to hide the panels // this is necessary to avoid unity to hide the panels
mTransparentDrawingView->show(); mTransparentDrawingView->show();

@ -50,13 +50,8 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
update(); update();
//mMediaObject = new Phonon::MediaObject(this);
mMediaObject = new QMediaPlayer(this); mMediaObject = new QMediaPlayer(this);
//playlist = new QMediaPlaylist;
//mMediaObject->setPlaylist(playlist);
QString mediaPath = pMediaFileUrl.toString(); QString mediaPath = pMediaFileUrl.toString();
if ("" == mediaPath) if ("" == mediaPath)
mediaPath = pMediaFileUrl.toLocalFile(); mediaPath = pMediaFileUrl.toLocalFile();
@ -65,50 +60,27 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
{ {
mMediaType = mediaType_Video; mMediaType = mediaType_Video;
//mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this); mMediaObject->setNotifyInterval(50);
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 ... mVideoWidget = new QVideoWidget(); // owned and destructed by the scene ...
//Phonon::createPath(mMediaObject, mVideoWidget);
mMediaObject->setVideoOutput(mVideoWidget); mMediaObject->setVideoOutput(mVideoWidget);
if(mVideoWidget->sizeHint() == QSize(1,1)){ if(mVideoWidget->sizeHint() == QSize(1,1)){
mVideoWidget->resize(320,240); mVideoWidget->resize(320,240);
} }
//mVideoWidget->setMinimumSize(140,26);
mVideoWidget->setMinimumSize(320,240); mVideoWidget->setMinimumSize(320,240);
haveLinkedImage = true; haveLinkedImage = true;
// DEBUGGING VIDEO
//*****************
qDebug() << "UBGraphicsMediaItem.cpp:" << mVideoWidget << "setMinimumSize(140,26)" ;
} }
else if (mediaPath.toLower().contains("audios")) else if (mediaPath.toLower().contains("audios"))
{ {
mMediaType = mediaType_Audio; mMediaType = mediaType_Audio;
QAudioFormat format; mMediaObject->setNotifyInterval(1000);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::UnSignedInt);
// mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
//mAudioOutput = new QMediaPlayer(format, this);
mAudioOutput = new QMediaPlayer;
//mMediaObject->setTickInterval(1000);
mAudioWidget = new QWidget(); mAudioWidget = new QWidget();
mAudioWidget->resize(320,26); mAudioWidget->resize(320,26);
mAudioWidget->setMinimumSize(150,26); mAudioWidget->setMinimumSize(150,26);
@ -116,10 +88,6 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
haveLinkedImage = false; haveLinkedImage = false;
} }
//Phonon::createPath(mMediaObject, mAudioOutput);
//mSource = Phonon::MediaSource(pMediaFileUrl);
//mMediaObject->setCurrentSource(mSource);
mMediaObject->setMedia(pMediaFileUrl); mMediaObject->setMedia(pMediaFileUrl);
@ -147,7 +115,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
connect(Delegate(), SIGNAL(showOnDisplayChanged(bool)), this, SLOT(showOnDisplayChanged(bool))); connect(Delegate(), SIGNAL(showOnDisplayChanged(bool)), this, SLOT(showOnDisplayChanged(bool)));
connect(mMediaObject, SIGNAL(hasVideoChanged(bool)), this, SLOT(hasMediaChanged(bool))); connect(mMediaObject, SIGNAL(videoAvailableChanged(bool)), this, SLOT(hasMediaChanged(bool)));
} }
@ -192,12 +160,8 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria
absoluteMediaFilename = mMediaFileUrl.toLocalFile(); absoluteMediaFilename = mMediaFileUrl.toLocalFile();
if (absoluteMediaFilename.length() > 0) if (absoluteMediaFilename.length() > 0)
//mMediaObject->setCurrentSource(QMediaSource(absoluteMediaFilename));
mMediaObject->setMedia(QUrl::fromLocalFile(absoluteMediaFilename)); mMediaObject->setMedia(QUrl::fromLocalFile(absoluteMediaFilename));
} }
} }
@ -230,7 +194,7 @@ void UBGraphicsMediaItem::toggleMute()
void UBGraphicsMediaItem::setMute(bool bMute) void UBGraphicsMediaItem::setMute(bool bMute)
{ {
mMuted = bMute; mMuted = bMute;
mAudioOutput->setMuted(mMuted); mMediaObject->setMuted(mMuted);
mMutedByUserAction = mMuted; mMutedByUserAction = mMuted;
sIsMutedByDefault = mMuted; sIsMutedByDefault = mMuted;
} }
@ -240,7 +204,6 @@ void UBGraphicsMediaItem::hasMediaChanged(bool hasMedia)
{ {
if(hasMedia && mMediaObject->isSeekable()) if(hasMedia && mMediaObject->isSeekable())
{ {
//mMediaObject->seek(mInitialPos);
mMediaObject->setPosition(mInitialPos); mMediaObject->setPosition(mInitialPos);
UBGraphicsMediaItemDelegate *med = dynamic_cast<UBGraphicsMediaItemDelegate *>(Delegate()); UBGraphicsMediaItemDelegate *med = dynamic_cast<UBGraphicsMediaItemDelegate *>(Delegate());
@ -268,12 +231,12 @@ void UBGraphicsMediaItem::showOnDisplayChanged(bool shown)
if (!shown) if (!shown)
{ {
mMuted = true; mMuted = true;
mAudioOutput->setMuted(mMuted); mMediaObject->setMuted(mMuted);
} }
else if (!mMutedByUserAction) else if (!mMutedByUserAction)
{ {
mMuted = false; mMuted = false;
mAudioOutput->setMuted(mMuted); mMediaObject->setMuted(mMuted);
} }
} }
@ -357,7 +320,6 @@ void UBGraphicsMediaItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QPointF eventPos = mapFromScene( event->scenePos()); QPointF eventPos = mapFromScene( event->scenePos());
QPointF translation = eventPos - mouseMovePos; QPointF translation = eventPos - mouseMovePos;
//translate(translation.x(), translation.y());
setPos(translation.x(), translation.y()); setPos(translation.x(), translation.y());
} }

@ -30,9 +30,6 @@
#include <QtWidgets/QGraphicsView> #include <QtWidgets/QGraphicsView>
#include "UBGraphicsProxyWidget.h" #include "UBGraphicsProxyWidget.h"
//#include <phonon/AudioOutput>
//#include <phonon/MediaObject>
//#include <phonon/VideoWidget>
#include <QAudioOutput> #include <QAudioOutput>
#include <QMediaObject> #include <QMediaObject>
@ -73,9 +70,7 @@ public:
virtual void mediaFileUrl(QUrl url){mMediaFileUrl=url;} virtual void mediaFileUrl(QUrl url){mMediaFileUrl=url;}
//Phonon::MediaObject* mediaObject() const
QMediaPlayer* mediaObject() const QMediaPlayer* mediaObject() const
{ {
return mMediaObject; return mMediaObject;
} }
@ -92,9 +87,7 @@ public:
return mMuted; return mMuted;
} }
// Phonon::VideoWidget* videoWidget() const
QVideoWidget* videoWidget() const QVideoWidget* videoWidget() const
{ {
return mVideoWidget; return mVideoWidget;
} }
@ -129,17 +122,8 @@ protected:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void clearSource(); virtual void clearSource();
//Phonon::MediaObject *mMediaObject;
//Phonon::VideoWidget *mVideoWidget;
//Phonon::AudioOutput *mAudioOutput;
//Phonon::MediaSource mSource;
QMediaPlayer *mMediaObject; QMediaPlayer *mMediaObject;
QMediaPlaylist *playlist;
QVideoWidget *mVideoWidget; QVideoWidget *mVideoWidget;
// QAudioOutput *mAudioOutput;
QMediaPlayer *mAudioOutput;
QMediaService *mSource;
QWidget *mAudioWidget; QWidget *mAudioWidget;

@ -252,7 +252,7 @@ void UBGraphicsMediaItemDelegate::togglePlayPause()
media->play(); media->play();
} }
else if (media->error()) if (media->error())
qDebug() << "Error appeared." << media->errorString(); qDebug() << "Error appeared." << media->errorString();
} }

@ -204,6 +204,7 @@ public:
static QString urlFromClipboard(); static QString urlFromClipboard();
static QStringList availableTranslations(); static QStringList availableTranslations();
static void setFrontProcess(); static void setFrontProcess();
static void showFullScreen(QWidget * pWidget);
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
static void SetMacLocaleByIdentifier(const QString& id); static void SetMacLocaleByIdentifier(const QString& id);

@ -31,7 +31,6 @@
#include <QApplication> #include <QApplication>
#include <unistd.h> #include <unistd.h>
#include <X11/Xlib.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
@ -430,7 +429,14 @@ QString UBPlatformUtils::urlFromClipboard()
return qsRet; return qsRet;
} }
void UBPlatformUtils::setFrontProcess() void UBPlatformUtils::setFrontProcess()
{ {
// not used in Linux
}
void UBPlatformUtils::showFullScreen(QWidget *pWidget)
{
pWidget->showFullScreen();
} }

@ -65,7 +65,7 @@ void UBPlatformUtils::init()
//originalSetSystemUIMode = APEPatchCreate((const void *)SetSystemUIMode, (const void *)emptySetSystemUIMode); //originalSetSystemUIMode = APEPatchCreate((const void *)SetSystemUIMode, (const void *)emptySetSystemUIMode);
setDesktopMode(false); //setDesktopMode(false);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@ -93,20 +93,24 @@ void UBPlatformUtils::init()
void UBPlatformUtils::setDesktopMode(bool desktop) void UBPlatformUtils::setDesktopMode(bool desktop)
{ /* {
#ifndef OS_NEWER_THAN_OR_EQUAL_TO_1010
//OSStatus (*functor)(SystemUIMode, SystemUIOptions) = (OSStatus (*)(SystemUIMode, SystemUIOptions))originalSetSystemUIMode;
if (desktop) //qDebug() << "setDesktopMode called. desktop = " << desktop;
{
functor(kUIModeNormal, 0); @try {
// temporarily disabled due to bug: when switching to desktop mode (and calling this),
// openboard switches right back to the board mode. clicking again on desktop mode works.
/*if (desktop) {
[NSApp setPresentationOptions:NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
}
else*/
[NSApp setPresentationOptions:NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock];
} }
else
{ @catch(NSException * exception) {
functor(kUIModeAllHidden, 0); qDebug() << "Error setting presentation options";
} }
#endif
*/
} }
@ -533,29 +537,35 @@ QString UBPlatformUtils::urlFromClipboard()
void UBPlatformUtils::SetMacLocaleByIdentifier(const QString& id) void UBPlatformUtils::SetMacLocaleByIdentifier(const QString& id)
{ {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @autoreleasepool {
// convert id from QString to CFString
// TODO: clean this up
const QByteArray utf8 = id.toUtf8();
const char* cString = utf8.constData();
NSString * ns = [[NSString alloc] initWithUTF8String:cString];
const char * strName = id.toLatin1().data(); CFStringRef iName = (__bridge CFStringRef)ns;
CFStringRef iName = CFStringCreateWithCString(NULL, strName, kCFStringEncodingISOLatin1 );
CFStringRef keys[] = { kTISPropertyInputSourceCategory, kTISPropertyInputSourceID }; CFStringRef keys[] = { kTISPropertyInputSourceID };
CFStringRef values[] = { kTISCategoryKeyboardInputSource, iName }; CFStringRef values[] = { iName };
CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 2, NULL, NULL); CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 1, NULL, NULL);
// get list of current enabled keyboard layouts. dict filters the list // get list of current enabled keyboard layouts. dict filters the list
CFArrayRef kbds = TISCreateInputSourceList(dict, true); // false specifies that we search only through the active input sources
if (kbds!=NULL) CFArrayRef kbds = TISCreateInputSourceList(dict, false);
{
if (CFArrayGetCount(kbds)!=0) if (kbds && CFArrayGetCount(kbds) == 0)
{ // if not found in the active sources, we search again through all sources installed
kbds = TISCreateInputSourceList(dict, true);
if (kbds && CFArrayGetCount(kbds)!=0) {
TISInputSourceRef klRef = (TISInputSourceRef)CFArrayGetValueAtIndex(kbds, 0); TISInputSourceRef klRef = (TISInputSourceRef)CFArrayGetValueAtIndex(kbds, 0);
if (klRef!=NULL) if (klRef!=NULL)
TISSelectInputSource(klRef); TISSelectInputSource(klRef);
} }
} }
[pool drain];
} }
/** /**
@ -568,6 +578,23 @@ void UBPlatformUtils::setFrontProcess()
// activate the application, forcing focus on it // activate the application, forcing focus on it
[app activateWithOptions: NSApplicationActivateIgnoringOtherApps]; [app activateWithOptions: NSApplicationActivateIgnoringOtherApps];
// other option:NSApplicationActivateAllWindows. This won't steal focus from another app, e.g // other option: NSApplicationActivateAllWindows. This won't steal focus from another app, e.g
// if the user is doing something else while waiting for OpenBoard to load // if the user is doing something else while waiting for OpenBoard to load
} }
/**
* @brief Full-screen a QWidget. Specific behaviour is platform-dependent.
* @param pWidget the QWidget to maximize
*/
void UBPlatformUtils::showFullScreen(QWidget *pWidget)
{
pWidget->showMaximized();
/* On OS X, we want to hide the Dock and menu bar (aka "kiosk mode"). Qt's default behaviour
* when full-screening a QWidget is to set the dock and menu bar to auto-hide.
* Since it is impossible to later set different presentation options (i.e Hide dock & menu bar)
* to NSApplication, we have to avoid calling QWidget::showFullScreen on OSX.
*/
}

@ -427,4 +427,11 @@ QString UBPlatformUtils::urlFromClipboard()
void UBPlatformUtils::setFrontProcess() void UBPlatformUtils::setFrontProcess()
{ {
// not used in Windows
}
void UBPlatformUtils::showFullScreen(QWidget *pWidget)
{
pWidget->showFullScreen();
} }

Loading…
Cancel
Save