diff options
author | aavit <qt-info@nokia.com> | 2010-03-05 10:06:05 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2010-03-05 10:06:05 (GMT) |
commit | ce1d5d10d0316a05a2bfce09239fd532a2d5ca7e (patch) | |
tree | 5eb7ed4e95bc0f08e4a805eaceb731e71d04c2ab /src | |
parent | 512593cb8db6242eda631b8c71d22e2d154abc98 (diff) | |
parent | 4152244217ab7f34e67f7800cb796d8923061f49 (diff) | |
download | Qt-ce1d5d10d0316a05a2bfce09239fd532a2d5ca7e.zip Qt-ce1d5d10d0316a05a2bfce09239fd532a2d5ca7e.tar.gz Qt-ce1d5d10d0316a05a2bfce09239fd532a2d5ca7e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src')
24 files changed, 276 insertions, 194 deletions
diff --git a/src/3rdparty/phonon/ds9/backendnode.cpp b/src/3rdparty/phonon/ds9/backendnode.cpp index 3afcafa..737ab7b 100644 --- a/src/3rdparty/phonon/ds9/backendnode.cpp +++ b/src/3rdparty/phonon/ds9/backendnode.cpp @@ -67,7 +67,7 @@ namespace Phonon if (info.pGraph) { HRESULT hr = info.pGraph->RemoveFilter(filter); - if (hr == VFW_E_NOT_STOPPED && m_mediaObject) { + if (FAILED(hr) && m_mediaObject) { m_mediaObject->ensureStopped(); hr = info.pGraph->RemoveFilter(filter); diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 4523433..25d9ebb 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -76,6 +76,7 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value AllPages All pages should be printed. \value Selection Only the selection should be printed. \value PageRange The specified page range should be printed. + \value CurrentPage Only the currently visible page should be printed. \sa QPrinter::PrintRange */ @@ -89,7 +90,9 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value PrintToFile The print to file option is enabled. \value PrintSelection The print selection option is enabled. \value PrintPageRange The page range selection option is enabled. - \value PrintCollateCopies + \value PrintShowPageSize Show the page size + margins page only if this is enabled. + \value PrintCollateCopies The collate copies option is enabled + \value PrintCurrentPage The print current page option is enabled This value is obsolete and does nothing since Qt 4.5: @@ -97,8 +100,6 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate would create a sheet by default the dialog was given a parent. This is no longer supported in Qt 4.5. If you want to use sheets, use QPrintDialog::open() instead. - - \value PrintShowPageSize Show the page size + margins page only if this is enabled. */ /*! diff --git a/src/gui/dialogs/qabstractprintdialog.h b/src/gui/dialogs/qabstractprintdialog.h index 4d867f6..82e3df8 100644 --- a/src/gui/dialogs/qabstractprintdialog.h +++ b/src/gui/dialogs/qabstractprintdialog.h @@ -65,7 +65,8 @@ public: enum PrintRange { AllPages, Selection, - PageRange + PageRange, + CurrentPage }; enum PrintDialogOption { @@ -75,7 +76,8 @@ public: PrintPageRange = 0x0004, PrintShowPageSize = 0x0008, PrintCollateCopies = 0x0010, - DontUseSheet = 0x0020 + DontUseSheet = 0x0020, + PrintCurrentPage = 0x0040 }; Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption) diff --git a/src/gui/dialogs/qprintdialog_qws.cpp b/src/gui/dialogs/qprintdialog_qws.cpp index 1336c04..b071427 100644 --- a/src/gui/dialogs/qprintdialog_qws.cpp +++ b/src/gui/dialogs/qprintdialog_qws.cpp @@ -178,6 +178,10 @@ void QPrintDialogPrivate::_q_okClicked() q->setPrintRange(QPrintDialog::PageRange); q->setFromTo(firstPage->value(), lastPage->value()); break; + case (int)QPrintDialog::CurrentPage: + q->setPrintRange(QPrintDialog::CurrentPage); + q->setFromTo(0, 0); + break; } q->accept(); } @@ -375,6 +379,7 @@ void QPrintDialogPrivate::setupOptions() rangeCombo->addItem(QPrintDialog::tr("Print all"), QPrintDialog::AllPages); rangeCombo->addItem(QPrintDialog::tr("Print selection"), QPrintDialog::Selection); rangeCombo->addItem(QPrintDialog::tr("Print range"), QPrintDialog::PageRange); + rangeCombo->addItem(QPrintDialog::tr("Print current page"), QPrintDialog::CurrentPage); QObject::connect(rangeCombo, SIGNAL(activated(int)), q, SLOT(_q_printRangeSelected(int))); @@ -490,6 +495,9 @@ void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings) if (!q->isOptionEnabled(QPrintDialog::PrintPageRange) && rangeCombo->findData(QPrintDialog::PageRange) > 0) rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::PageRange)); + if (!q->isOptionEnabled(QPrintDialog::PrintCurrentPage) + && rangeCombo->findData(QPrintDialog::CurrentPage) > 0) + rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::CurrentPage)); switch (q->printRange()) { case QPrintDialog::AllPages: @@ -501,6 +509,9 @@ void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings) case QPrintDialog::PageRange: rangeCombo->setCurrentIndex((int)(QPrintDialog::PageRange)); break; + case QPrintDialog::CurrentPage: + rangeCombo->setCurrentIndex((int)(QPrintDialog::CurrentPage)); + break; } } diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 2d169cf..0487f23 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -502,6 +502,9 @@ void QPrintDialogPrivate::setupPrinter() } else if (options.printSelection->isChecked()) { p->setPrintRange(QPrinter::Selection); p->setFromTo(0,0); + } else if (options.printCurrentPage->isChecked()) { + p->setPrintRange(QPrinter::CurrentPage); + p->setFromTo(0,0); } else if (options.printRange->isChecked()) { p->setPrintRange(QPrinter::PageRange); p->setFromTo(options.from->value(), qMax(options.from->value(), options.to->value())); @@ -518,10 +521,12 @@ void QPrintDialogPrivate::updateWidgets() { Q_Q(QPrintDialog); options.gbPrintRange->setVisible(q->isOptionEnabled(QPrintDialog::PrintPageRange) || - q->isOptionEnabled(QPrintDialog::PrintSelection)); + q->isOptionEnabled(QPrintDialog::PrintSelection) || + q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); options.printRange->setEnabled(q->isOptionEnabled(QPrintDialog::PrintPageRange)); options.printSelection->setVisible(q->isOptionEnabled(QPrintDialog::PrintSelection)); + options.printCurrentPage->setVisible(q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); options.collate->setVisible(q->isOptionEnabled(QPrintDialog::PrintCollateCopies)); switch (q->printRange()) { @@ -534,6 +539,10 @@ void QPrintDialogPrivate::updateWidgets() case QPrintDialog::PageRange: options.printRange->setChecked(true); break; + case QPrintDialog::CurrentPage: + if (q->isOptionEnabled(QPrintDialog::PrintCurrentPage)) + options.printCurrentPage->setChecked(true); + break; default: break; } diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index fa0c99f..1061660 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -128,11 +128,14 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, if (pd->nMinPage==0 && pd->nMaxPage==0) pd->Flags |= PD_NOPAGENUMS; - // we don't have a 'current page' notion in the QPrinter API yet. - // Neither do we support more than one page range, so limit those - // options - pd->Flags |= PD_NOCURRENTPAGE; + // Disable Current Page option if not required as default is Enabled + if (!pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage)) + pd->Flags |= PD_NOCURRENTPAGE; + + // Default to showing the General tab first pd->nStartPage = START_PAGE_GENERAL; + + // We don't support more than one page range in the QPrinter API yet. pd->nPageRanges = 1; pd->nMaxPageRanges = 1; @@ -153,7 +156,10 @@ static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPri } else if (pd->Flags & PD_PAGENUMS) { pdlg->setPrintRange(QPrintDialog::PageRange); pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); - } else { + } else if (pd->Flags & PD_CURRENTPAGE) { + pdlg->setPrintRange(QPrintDialog::CurrentPage); + pdlg->setFromTo(0, 0); + } else { // PD_ALLPAGES pdlg->setPrintRange(QPrintDialog::AllPages); pdlg->setFromTo(0, 0); } diff --git a/src/gui/dialogs/qprintsettingsoutput.ui b/src/gui/dialogs/qprintsettingsoutput.ui index fc57e86..be91679 100644 --- a/src/gui/dialogs/qprintsettingsoutput.ui +++ b/src/gui/dialogs/qprintsettingsoutput.ui @@ -1,121 +1,114 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>QPrintSettingsOutput</class> - <widget class="QWidget" name="QPrintSettingsOutput" > - <property name="geometry" > + <widget class="QWidget" name="QPrintSettingsOutput"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>416</width> - <height>166</height> + <width>426</width> + <height>171</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Form</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <property name="margin" > + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="margin"> <number>0</number> </property> <item> - <widget class="QTabWidget" name="tabs" > - <property name="currentIndex" > + <widget class="QTabWidget" name="tabs"> + <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="copiesTab" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>412</width> - <height>139</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="copiesTab"> + <attribute name="title"> <string>Copies</string> </attribute> - <layout class="QHBoxLayout" name="horizontalLayout" > + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QGroupBox" name="gbPrintRange" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Minimum" hsizetype="Preferred" > + <widget class="QGroupBox" name="gbPrintRange"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title" > + <property name="title"> <string>Print range</string> </property> - <layout class="QVBoxLayout" name="_3" > - <property name="spacing" > + <layout class="QVBoxLayout" name="_3"> + <property name="spacing"> <number>4</number> </property> - <property name="margin" > + <property name="margin"> <number>6</number> </property> <item> - <widget class="QRadioButton" name="printAll" > - <property name="text" > + <widget class="QRadioButton" name="printAll"> + <property name="text"> <string>Print all</string> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> </widget> </item> <item> - <layout class="QHBoxLayout" name="_4" > - <property name="spacing" > + <layout class="QHBoxLayout" name="_4"> + <property name="spacing"> <number>6</number> </property> - <property name="margin" > + <property name="margin"> <number>0</number> </property> <item> - <widget class="QRadioButton" name="printRange" > - <property name="text" > + <widget class="QRadioButton" name="printRange"> + <property name="text"> <string>Pages from</string> </property> </widget> </item> <item> - <widget class="QSpinBox" name="from" > - <property name="enabled" > + <widget class="QSpinBox" name="from"> + <property name="enabled"> <bool>false</bool> </property> - <property name="minimum" > + <property name="minimum"> <number>1</number> </property> - <property name="maximum" > + <property name="maximum"> <number>999</number> </property> </widget> </item> <item> - <widget class="QLabel" name="label_3" > - <property name="text" > + <widget class="QLabel" name="label_3"> + <property name="text"> <string>to</string> </property> </widget> </item> <item> - <widget class="QSpinBox" name="to" > - <property name="enabled" > + <widget class="QSpinBox" name="to"> + <property name="enabled"> <bool>false</bool> </property> - <property name="minimum" > + <property name="minimum"> <number>1</number> </property> - <property name="maximum" > + <property name="maximum"> <number>999</number> </property> </widget> </item> <item> <spacer> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>0</width> <height>20</height> @@ -126,18 +119,25 @@ </layout> </item> <item> - <widget class="QRadioButton" name="printSelection" > - <property name="text" > + <widget class="QRadioButton" name="printCurrentPage"> + <property name="text"> + <string>Current Page</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="printSelection"> + <property name="text"> <string>Selection</string> </property> </widget> </item> <item> - <spacer name="verticalSpacer" > - <property name="orientation" > + <spacer name="verticalSpacer"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>1</width> <height>1</height> @@ -149,37 +149,37 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > + <widget class="QGroupBox" name="groupBox"> + <property name="title"> <string>Output Settings</string> </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label" > - <property name="text" > + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> <string>Copies:</string> </property> - <property name="buddy" > + <property name="buddy"> <cstring>copies</cstring> </property> </widget> </item> - <item row="0" column="1" colspan="2" > - <widget class="QSpinBox" name="copies" > - <property name="minimum" > + <item row="0" column="1" colspan="2"> + <widget class="QSpinBox" name="copies"> + <property name="minimum"> <number>1</number> </property> - <property name="maximum" > + <property name="maximum"> <number>999</number> </property> </widget> </item> - <item row="0" column="3" > - <spacer name="horizontalSpacer" > - <property name="orientation" > + <item row="0" column="3"> + <spacer name="horizontalSpacer"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>91</width> <height>20</height> @@ -187,36 +187,36 @@ </property> </spacer> </item> - <item row="1" column="0" colspan="2" > - <widget class="QCheckBox" name="collate" > - <property name="text" > + <item row="1" column="0" colspan="2"> + <widget class="QCheckBox" name="collate"> + <property name="text"> <string>Collate</string> </property> </widget> </item> - <item rowspan="2" row="1" column="2" colspan="2" > - <widget class="QLabel" name="outputIcon" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Ignored" hsizetype="Ignored" > + <item row="1" column="2" rowspan="2" colspan="2"> + <widget class="QLabel" name="outputIcon"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Ignored" vsizetype="Ignored"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> </widget> </item> - <item row="2" column="0" colspan="2" > - <widget class="QCheckBox" name="reverse" > - <property name="text" > + <item row="2" column="0" colspan="2"> + <widget class="QCheckBox" name="reverse"> + <property name="text"> <string>Reverse</string> </property> </widget> </item> - <item row="3" column="0" colspan="4" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > + <item row="3" column="0" colspan="4"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>0</width> <height>1</height> @@ -229,31 +229,23 @@ </item> </layout> </widget> - <widget class="QWidget" name="optionsTab" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>412</width> - <height>139</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="optionsTab"> + <attribute name="title"> <string>Options</string> </attribute> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="0" column="1" > - <widget class="QGroupBox" name="colorMode" > - <property name="title" > + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="1"> + <widget class="QGroupBox" name="colorMode"> + <property name="title"> <string>Color Mode</string> </property> - <layout class="QGridLayout" name="gridLayout_4" > - <item row="2" column="0" > - <spacer name="verticalSpacer_6" > - <property name="orientation" > + <layout class="QGridLayout" name="gridLayout_4"> + <item row="2" column="0"> + <spacer name="verticalSpacer_6"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>1</width> <height>0</height> @@ -261,19 +253,19 @@ </property> </spacer> </item> - <item row="0" column="0" > - <widget class="QRadioButton" name="color" > - <property name="text" > + <item row="0" column="0"> + <widget class="QRadioButton" name="color"> + <property name="text"> <string>Color</string> </property> </widget> </item> - <item rowspan="3" row="0" column="1" > - <widget class="QLabel" name="colorIcon" /> + <item row="0" column="1" rowspan="3"> + <widget class="QLabel" name="colorIcon"/> </item> - <item row="1" column="0" > - <widget class="QRadioButton" name="grayscale" > - <property name="text" > + <item row="1" column="0"> + <widget class="QRadioButton" name="grayscale"> + <property name="text"> <string>Grayscale</string> </property> </widget> @@ -281,42 +273,42 @@ </layout> </widget> </item> - <item row="0" column="0" > - <widget class="QGroupBox" name="duplex" > - <property name="title" > + <item row="0" column="0"> + <widget class="QGroupBox" name="duplex"> + <property name="title"> <string>Duplex Printing</string> </property> - <layout class="QVBoxLayout" name="verticalLayout" > + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QRadioButton" name="noDuplex" > - <property name="text" > + <widget class="QRadioButton" name="noDuplex"> + <property name="text"> <string>None</string> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> </widget> </item> <item> - <widget class="QRadioButton" name="duplexLong" > - <property name="text" > + <widget class="QRadioButton" name="duplexLong"> + <property name="text"> <string>Long side</string> </property> </widget> </item> <item> - <widget class="QRadioButton" name="duplexShort" > - <property name="text" > + <widget class="QRadioButton" name="duplexShort"> + <property name="text"> <string>Short side</string> </property> </widget> </item> <item> - <spacer name="verticalSpacer_42" > - <property name="orientation" > + <spacer name="verticalSpacer_42"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>1</width> <height>0</height> @@ -341,11 +333,11 @@ <receiver>from</receiver> <slot>setEnabled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>76</x> <y>59</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>122</x> <y>57</y> </hint> @@ -357,11 +349,11 @@ <receiver>to</receiver> <slot>setEnabled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>69</x> <y>67</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>215</x> <y>67</y> </hint> diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index aa89772..ffb45aa 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -77,6 +77,8 @@ QT_BEGIN_INCLUDE_NAMESPACE #undef Type #undef FontChange #undef CursorShape +#undef Unsorted +#undef GrayScale #endif // Internally we use the EGL-prefixed native types which are used in EGL >= 1.3. diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 339bd57..483c01d 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -149,6 +149,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) eglGetConfigAttrib(display(), config, EGL_BUFFER_SIZE, &eglValue); int configBitDepth = eglValue; + eglGetConfigAttrib(display(), config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + // See if EGL provided a valid VisualID: eglGetConfigAttrib(display(), config, EGL_NATIVE_VISUAL_ID, &eglValue); visualId = (VisualID)eglValue; @@ -170,14 +173,14 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual); if (!format || (format->type != PictTypeDirect) || (!format->direct.alphaMask)) { qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this is not ARGB", - (int)visualId, (int)config); + (int)visualId, configId); visualId = 0; } } #endif } else { qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!", - (int)visualId, chosenVisualInfo->depth, (int)config, configBitDepth); + (int)visualId, chosenVisualInfo->depth, configId, configBitDepth); visualId = 0; } } @@ -187,9 +190,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); #endif return visualId; } @@ -232,9 +235,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { # ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); + qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, configId); else - qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); + qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, configId); # endif // QT_DEBUG_X11_VISUAL_SELECTION return visualId; } @@ -263,12 +266,12 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, (int)config); + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); #endif return visualId; } - qWarning("Unable to find an X11 visual which matches EGL config %d", (int)config); + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); return (VisualID)0; } diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 5128b64..eb3db21 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -2037,7 +2037,7 @@ bool QHeaderView::event(QEvent *e) updateSection(d->hover); } break; } - case QEvent::Timer: { // ### reimplement timerEvent() instead ? + case QEvent::Timer: { QTimerEvent *te = static_cast<QTimerEvent*>(e); if (te->timerId() == d->delayedResize.timerId()) { d->delayedResize.stop(); @@ -2610,7 +2610,7 @@ void QHeaderView::updateGeometries() Q_D(QHeaderView); d->layoutChildren(); if (d->hasAutoResizeSections()) - resizeSections(); + d->doDelayedResizeSections(); } /*! diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 3111896..bdc1205 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1960,12 +1960,7 @@ QModelIndexList QTableView::selectedIndexes() const void QTableView::rowCountChanged(int /*oldCount*/, int /*newCount*/ ) { Q_D(QTableView); - updateGeometries(); - if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) - d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); - else - d->verticalHeader->setOffset(verticalScrollBar()->value()); - d->viewport->update(); + d->doDelayedItemsLayout(); } /*! diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 37168eb..1145235 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2524,8 +2524,7 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) d->viewItems[parentItem].hasChildren = true; d->updateChildCount(parentItem, delta); - updateGeometries(); - viewport()->update(); + d->doDelayedItemsLayout(); } else if ((parentItem != -1) && d->viewItems.at(parentItem).expanded) { d->doDelayedItemsLayout(); } else if (parentItem != -1 && (d->model->rowCount(parent) == end - start + 1)) { @@ -3780,8 +3779,7 @@ void QTreeViewPrivate::rowsRemoved(const QModelIndex &parent, } } if (after) { - q->updateGeometries(); - viewport->update(); + doDelayedItemsLayout(); } else { //we have removed items: we should at least update the scroll bar values. // They are used to determine the item geometry. diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index edf224d..ae21416 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -382,6 +382,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value AllPages All pages should be printed. \value Selection Only the selection should be printed. \value PageRange The specified page range should be printed. + \value CurrentPage Only the current page should be printed. \sa QAbstractPrintDialog::PrintRange */ @@ -571,6 +572,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value AllPages All the pages should be printed. \value Selection Only the selection should be printed. \value PageRange Print according to the from page and to page options. + \value CurrentPage Only the current page should be printed. \sa setPrintRange(), printRange() */ @@ -586,6 +588,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value PrintSelection Describes if printing selections should be enabled. \value PrintPageRange Describes if printing page ranges (from, to) should be enabled + \value PrintCurrentPage if Print Current Page option should be enabled \sa setOptionEnabled(), isOptionEnabled() */ diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h index 6636179..996a954 100644 --- a/src/gui/painting/qprinter.h +++ b/src/gui/painting/qprinter.h @@ -124,7 +124,7 @@ public: enum OutputFormat { NativeFormat, PdfFormat, PostScriptFormat }; // ### Qt 5: Merge with QAbstractPrintDialog::PrintRange - enum PrintRange { AllPages, Selection, PageRange }; + enum PrintRange { AllPages, Selection, PageRange, CurrentPage }; enum Unit { Millimeter, diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 9b19a66..fb9af9f 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -111,10 +111,10 @@ public: bool hasFrame() const; inline int findText(const QString &text, - Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const + Qt::MatchFlags flags = static_cast<Qt::MatchFlags>(Qt::MatchExactly|Qt::MatchCaseSensitive)) const { return findData(text, Qt::DisplayRole, flags); } int findData(const QVariant &data, int role = Qt::UserRole, - Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const; + Qt::MatchFlags flags = static_cast<Qt::MatchFlags>(Qt::MatchExactly|Qt::MatchCaseSensitive)) const; enum InsertPolicy { NoInsert, diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp index d51d682..6e11079 100644 --- a/src/multimedia/base/qmediaserviceprovider.cpp +++ b/src/multimedia/base/qmediaserviceprovider.cpp @@ -102,6 +102,9 @@ public: \value RecordingSupport The service provides audio or video recording functions. + + \value StreamPlayback + The service is capable of playing QIODevice based streams. */ /*! @@ -396,14 +399,25 @@ public: QMediaServiceSupportedFormatsInterface *iface = qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj); - //if low latency playback was asked, skip services known - //not to provide low latency playback - if (flags & QMediaPlayer::LowLatency) { + + if (flags) { QMediaServiceFeaturesInterface *iface = qobject_cast<QMediaServiceFeaturesInterface*>(obj); - if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback)) - continue; + if (iface) { + QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType); + + //if low latency playback was asked, skip services known + //not to provide low latency playback + if ((flags & QMediaPlayer::LowLatency) && + !(features & QMediaServiceProviderHint::LowLatencyPlayback)) + continue; + + //the same for QIODevice based streams support + if ((flags & QMediaPlayer::StreamPlayback) && + !(features & QMediaServiceProviderHint::StreamPlayback)) + continue; + } } if (iface) @@ -434,14 +448,25 @@ public: QMediaServiceSupportedFormatsInterface *iface = qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj); - // If low latency playback was asked for, skip MIME types from services known - // not to provide low latency playback + if (flags & QMediaPlayer::LowLatency) { QMediaServiceFeaturesInterface *iface = qobject_cast<QMediaServiceFeaturesInterface*>(obj); - if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback)) - continue; + if (iface) { + QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType); + + // If low latency playback was asked for, skip MIME types from services known + // not to provide low latency playback + if ((flags & QMediaPlayer::LowLatency) && + !(features & QMediaServiceProviderHint::LowLatencyPlayback)) + continue; + + //the same for QIODevice based streams support + if ((flags & QMediaPlayer::StreamPlayback) && + !(features & QMediaServiceProviderHint::StreamPlayback)) + continue; + } } if (iface) { diff --git a/src/multimedia/base/qmediaserviceprovider.h b/src/multimedia/base/qmediaserviceprovider.h index 2ee0ae4..6e31493 100644 --- a/src/multimedia/base/qmediaserviceprovider.h +++ b/src/multimedia/base/qmediaserviceprovider.h @@ -64,7 +64,8 @@ public: enum Feature { LowLatencyPlayback = 0x01, - RecordingSupport = 0x02 + RecordingSupport = 0x02, + StreamPlayback = 0x04 }; Q_DECLARE_FLAGS(Features, Feature) diff --git a/src/multimedia/effects/wavedecoder_p.cpp b/src/multimedia/effects/wavedecoder_p.cpp index f2277ae..b534ded 100644 --- a/src/multimedia/effects/wavedecoder_p.cpp +++ b/src/multimedia/effects/wavedecoder_p.cpp @@ -55,7 +55,7 @@ WaveDecoder::WaveDecoder(QIODevice *s, QObject *parent): { open(QIODevice::ReadOnly | QIODevice::Unbuffered); - if (source->bytesAvailable() >= sizeof(CombinedHeader)) + if (source->bytesAvailable() >= qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16))) QTimer::singleShot(0, this, SLOT(handleData())); else connect(source, SIGNAL(readyRead()), SLOT(handleData())); @@ -105,7 +105,7 @@ qint64 WaveDecoder::writeData(const char *data, qint64 len) void WaveDecoder::handleData() { - if (source->bytesAvailable() < sizeof(CombinedHeader)) + if (source->bytesAvailable() < qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16))) return; source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); @@ -114,12 +114,23 @@ void WaveDecoder::handleData() if (qstrncmp(header.riff.descriptor.id, "RIFF", 4) != 0 || qstrncmp(header.riff.type, "WAVE", 4) != 0 || qstrncmp(header.wave.descriptor.id, "fmt ", 4) != 0 || - (header.wave.audioFormat != 0 && header.wave.audioFormat != 1) || - qstrncmp(header.data.descriptor.id, "data", 4) != 0) { + (header.wave.audioFormat != 0 && header.wave.audioFormat != 1)) { emit invalidFormat(); } else { + DATAHeader dataHeader; + + if (qFromLittleEndian<quint32>(header.wave.descriptor.size) > sizeof(WAVEHeader)) { + // Extended data available + quint16 extraFormatBytes; + source->peek((char*)&extraFormatBytes, sizeof(quint16)); + extraFormatBytes = qFromLittleEndian<quint16>(extraFormatBytes); + source->read(sizeof(quint16) + extraFormatBytes); // dump it all + } + + source->read((char*)&dataHeader, sizeof(DATAHeader)); + int bps = qFromLittleEndian<quint16>(header.wave.bitsPerSample); format.setCodec(QLatin1String("audio/pcm")); @@ -129,7 +140,7 @@ void WaveDecoder::handleData() format.setSampleSize(bps); format.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels)); - dataSize = qFromLittleEndian<quint32>(header.data.descriptor.size); + dataSize = qFromLittleEndian<quint32>(dataHeader.descriptor.size); haveFormat = true; connect(source, SIGNAL(readyRead()), SIGNAL(readyRead())); diff --git a/src/multimedia/effects/wavedecoder_p.h b/src/multimedia/effects/wavedecoder_p.h index 00aa14e..fa1f77e 100644 --- a/src/multimedia/effects/wavedecoder_p.h +++ b/src/multimedia/effects/wavedecoder_p.h @@ -116,7 +116,6 @@ private: { RIFFHeader riff; WAVEHeader wave; - DATAHeader data; }; bool haveFormat; diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 27bff02..9466cad 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -43,6 +43,7 @@ #include <QtCore/qmetaobject.h> #include <QtCore/qtimer.h> #include <QtCore/qpointer.h> +#include <QtCore/qdebug.h> #include <QtMultimedia/qmediaplayer.h> @@ -55,6 +56,7 @@ #include <QtMultimedia/qvideowidget.h> #include <QtMultimedia/qgraphicsvideoitem.h> +//#define DEBUG_PLAYER_STATE QT_BEGIN_HEADER @@ -152,10 +154,16 @@ public: void _q_playlistDestroyed(); }; +#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v))) + void QMediaPlayerPrivate::_q_stateChanged(QMediaPlayer::State ps) { Q_Q(QMediaPlayer); +#ifdef DEBUG_PLAYER_STATE + qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", ps) << (filterStates ? "(filtered)" : ""); +#endif + if (filterStates) return; @@ -183,6 +191,10 @@ void QMediaPlayerPrivate::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status { Q_Q(QMediaPlayer); +#ifdef DEBUG_PLAYER_STATE + qDebug() << "MediaStatus changed:" << ENUM_NAME(QMediaPlayer, "MediaStatus", status); +#endif + switch (status) { case QMediaPlayer::StalledMedia: case QMediaPlayer::BufferingMedia: @@ -230,8 +242,12 @@ void QMediaPlayerPrivate::_q_updateMedia(const QMediaContent &media) state = control->state(); - if (state != currentState) + if (state != currentState) { +#ifdef DEBUG_PLAYER_STATE + qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", state); +#endif emit q_func()->stateChanged(state); + } } void QMediaPlayerPrivate::_q_playlistDestroyed() @@ -243,10 +259,17 @@ void QMediaPlayerPrivate::_q_playlistDestroyed() static QMediaService *playerService(QMediaPlayer::Flags flags, QMediaServiceProvider *provider) { - if (flags && QMediaPlayer::LowLatency) + if (flags) { + QMediaServiceProviderHint::Features features = 0; + if (flags & QMediaPlayer::LowLatency) + features |= QMediaServiceProviderHint::LowLatencyPlayback; + + if (flags & QMediaPlayer::StreamPlayback) + features |= QMediaServiceProviderHint::StreamPlayback; + return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER, - QMediaServiceProviderHint(QMediaServiceProviderHint::LowLatencyPlayback)); - else + QMediaServiceProviderHint(features)); + } else return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER); } @@ -945,6 +968,11 @@ QStringList QMediaPlayer::supportedMimeTypes(Flags flags) The player is expected to be used with simple audio formats, but playback should start without significant delay. Such playback service can be used for beeps, ringtones, etc. + + \value StreamPlayback + The player is expected to play QIODevice based streams. + If passed to QMediaPlayer constructor, the service supporting + streams playback will be choosen. */ QT_END_NAMESPACE diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h index 1b761ce..129b244 100644 --- a/src/multimedia/playback/qmediaplayer.h +++ b/src/multimedia/playback/qmediaplayer.h @@ -99,7 +99,8 @@ public: enum Flag { - LowLatency = 0x01 + LowLatency = 0x01, + StreamPlayback = 0x02 }; Q_DECLARE_FLAGS(Flags, Flag) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index b828bea..c142715 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -65,13 +65,7 @@ #include "qglpaintdevice_p.h" #ifdef QT_OPENGL_ES -QT_BEGIN_INCLUDE_NAMESPACE -#if defined(QT_OPENGL_ES_2) -#include <EGL/egl.h> -#else -#include <GLES/egl.h> -#endif -QT_END_INCLUDE_NAMESPACE +#include <QtGui/private/qegl_p.h> #endif QT_BEGIN_NAMESPACE diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index ba05e72..123bbdd 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -404,7 +404,7 @@ EGLConfig Q_OPENGL_EXPORT qt_chooseEGLConfigForPixmap(bool hasAlpha, bool readOn if (configCount > 0) { // Got one qDebug() << "Found an" << (hasAlpha ? "ARGB" : "RGB") << (readOnly ? "readonly" : "target" ) - << "config (" << int(*targetConfig) << ") to create a pixmap surface:"; + << "config to create a pixmap surface:"; // QEglProperties configProps(*targetConfig); // qDebug() << configProps.toString(); @@ -446,8 +446,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl // qDebug("qt_createEGLSurfaceForPixmap() created surface 0x%x for pixmap 0x%x", // pixmapSurface, pixmapData->handle()); if (pixmapSurface == EGL_NO_SURFACE) { - qWarning() << "Failed to create a pixmap surface using config" << (int)pixmapConfig - << ":" << QEgl::errorString(); + qWarning() << "Failed to create a pixmap surface:" << QEgl::errorString(); return false; } diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 47c5262..024b4d0 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1591,7 +1591,9 @@ QRegExp QScriptEnginePrivate::toRegExp(JSC::ExecState *exec, JSC::JSValue value) QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue value) { - if (isObject(value)) { + if (!value) { + return QVariant(); + } else if (isObject(value)) { if (isVariant(value)) return variantValue(value); #ifndef QT_NO_QOBJECT |