fixed crash on desktop and web mode

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent dc923f8d17
commit 6d109d8da4
  1. 7
      Sankore_3.1.pro
  2. 64
      src/gui/UBScreenMirror.cpp

@ -292,42 +292,36 @@ macx {
TRANSLATION_ar.path = "$$RESOURCES_DIR/ar.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_ar
}
exists(resources/i18n/sankore_iw.qm) {
TRANSLATION_iw.files = resources/i18n/sankore_iw.qm \
resources/i18n/Localizable.strings
TRANSLATION_iw.path = "$$RESOURCES_DIR/iw.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_iw
}
exists(resources/i18n/sankore_pt.qm) {
TRANSLATION_pt.files = resources/i18n/sankore_pt.qm \
resources/i18n/Localizable.strings
TRANSLATION_pt.path = "$$RESOURCES_DIR/pt.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_pt
}
exists(resources/i18n/sankore_sk.qm) {
TRANSLATION_sk.files = resources/i18n/sankore_sk.qm \
resources/i18n/Localizable.strings
TRANSLATION_sk.path = "$$RESOURCES_DIR/sk.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_sk
}
exists(resources/i18n/sankore_bg.qm) {
TRANSLATION_bg.files = resources/i18n/sankore_bg.qm \
resources/i18n/Localizable.strings
TRANSLATION_bg.path = "$$RESOURCES_DIR/bg.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_bg
}
exists(resources/i18n/sankore_ca.qm) {
TRANSLATION_ca.files = resources/i18n/sankore_ca.qm \
resources/i18n/Localizable.strings
TRANSLATION_ca.path = "$$RESOURCES_DIR/ca.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_ca
}
exists(resources/i18n/sankore_el.qm) {
TRANSLATION_el.files = resources/i18n/sankore_el.qm \
resources/i18n/Localizable.strings
@ -346,7 +340,6 @@ macx {
translation_cs.path = "$$resources_dir/cs.lproj"
qmake_bundle_data += translation_cs
}
exists(resources/i18n/sankore_mg.qm) {
translation_mg.files = resources/i18n/sankore_mg.qm \
resources/i18n/localizable.strings

@ -80,35 +80,41 @@ void UBScreenMirror::timerEvent(QTimerEvent *event)
void UBScreenMirror::grabPixmap()
{
if (mSourceWidget)
{
QPoint topLeft = mSourceWidget->mapToGlobal(mSourceWidget->geometry().topLeft());
QPoint bottomRight = mSourceWidget->mapToGlobal(mSourceWidget->geometry().bottomRight());
mRect.setTopLeft(topLeft);
mRect.setBottomRight(bottomRight);
}
// get image of desktop
WId windowID = qApp->desktop()->screen(mScreenIndex)->winId();
#if defined(Q_WS_MAC)
// Available in Mac OS X v10.6 and later.
CGRect grabRect;
grabRect.origin.x = mRect.x();
grabRect.origin.y = mRect.y();
grabRect.size.width = mRect.width();
grabRect.size.height = mRect.height();
CGImageRef windowImage = CGWindowListCreateImage(grabRect
,kCGWindowListOptionOnScreenOnly
,windowID
,kCGWindowImageDefault);
mLastPixmap = QPixmap::fromMacCGImageRef(windowImage);
#else
mLastPixmap = QPixmap::grabWindow(windowID, mRect.x(), mRect.y(), mRect.width(), mRect.height());
#endif
// if (mSourceWidget)
// {
// QPoint topLeft = mSourceWidget->mapToGlobal(mSourceWidget->geometry().topLeft());
// QPoint bottomRight = mSourceWidget->mapToGlobal(mSourceWidget->geometry().bottomRight());
// mRect.setTopLeft(topLeft);
// mRect.setBottomRight(bottomRight);
// }
// // get image of desktop
// WId windowID = qApp->desktop()->screen(mScreenIndex)->winId();
// qDebug() << windowID;
//#if defined(Q_WS_MAC)
// TODO: bad mac fix. On dual screen mac os x and let web mode for more than one minute and it crashed
// NSAutorelease pull should avoid this.
// // Available in Mac OS X v10.6 and later.
// CGRect grabRect;
// grabRect.origin.x = mRect.x();
// grabRect.origin.y = mRect.y();
// grabRect.size.width = mRect.width();
// grabRect.size.height = mRect.height();
// CGImageRef windowImage = CGWindowListCreateImage(grabRect
// ,kCGWindowListOptionOnScreenOnly
// ,windowID
// ,kCGWindowImageDefault);
// mLastPixmap = QPixmap::fromMacCGImageRef(windowImage);
//#else
// mLastPixmap = QPixmap::grabWindow(windowID, mRect.x(), mRect.y(), mRect.width(), mRect.height());
//#endif
mLastPixmap = QPixmap::grabWidget(mSourceWidget);
mLastPixmap = mLastPixmap.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
}

Loading…
Cancel
Save