Widgets: Remove dialog functionality from QGuiPlatformPlugin.
(as QGuiPlatformPlugin is deprecated) Clean up qdialog.cpp. Acked-by: Morten Johan Sorvig <morten.sorvig@nokia.com> Change-Id: Id49d6cfe235d5afb4c89b0697c6b3980130a5299 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>bb10
parent
ca26fefc06
commit
260416393e
|
|
@ -63,13 +63,8 @@
|
|||
#include "qmimedata.h"
|
||||
#include "qspinbox.h"
|
||||
#include "qdialogbuttonbox.h"
|
||||
#include "private/qguiplatformplugin_p.h"
|
||||
|
||||
#ifdef Q_WS_S60
|
||||
#include "private/qt_s60_p.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
|
||||
#ifdef MAEMO_UI
|
||||
# define QT_SMALL_COLORDIALOG
|
||||
#endif
|
||||
|
||||
|
|
@ -1762,8 +1757,9 @@ void QColorDialog::setCurrentColor(const QColor &color)
|
|||
d->setCurrentQColor(color);
|
||||
d->setCocoaPanelColor(color);
|
||||
#endif
|
||||
if (d->nativeDialogInUse)
|
||||
qt_guiPlatformPlugin()->colorDialogSetCurrentColor(this, color);
|
||||
// ### fixme: Call helper
|
||||
// if (d->nativeDialogInUse)
|
||||
// qt_guiPlatformPlugin()->colorDialogSetCurrentColor(this, color);
|
||||
}
|
||||
|
||||
QColor QColorDialog::currentColor() const
|
||||
|
|
@ -2050,8 +2046,8 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
|
|||
|
||||
QColorDialog::~QColorDialog()
|
||||
{
|
||||
Q_D(QColorDialog);
|
||||
#if defined(Q_WS_MAC)
|
||||
Q_D(QColorDialog);
|
||||
if (d->delegate) {
|
||||
d->releaseCocoaColorPanelDelegate();
|
||||
QColorDialogPrivate::sharedColorPanelAvailable = true;
|
||||
|
|
@ -2065,12 +2061,8 @@ QColorDialog::~QColorDialog()
|
|||
settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), cusrgb[i]);
|
||||
}
|
||||
#endif
|
||||
if (d->nativeDialogInUse)
|
||||
qt_guiPlatformPlugin()->colorDialogDelete(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -56,20 +56,6 @@
|
|||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include "qaccessible.h"
|
||||
#endif
|
||||
#if defined(Q_WS_WINCE)
|
||||
#include "qt_windows.h"
|
||||
#include "qmenubar.h"
|
||||
#include "qpointer.h"
|
||||
#include "qguifunctions_wince.h"
|
||||
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
|
||||
extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp
|
||||
#elif defined(Q_WS_X11)
|
||||
# include "../kernel/qt_x11_p.h"
|
||||
#endif
|
||||
|
||||
#ifndef SPI_GETSNAPTODEFBUTTON
|
||||
# define SPI_GETSNAPTODEFBUTTON 95
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -267,18 +253,6 @@ QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
|
|||
: QWidget(*new QDialogPrivate, parent,
|
||||
f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
|
||||
{
|
||||
#ifdef Q_WS_WINCE
|
||||
if (!qt_wince_is_smartphone())
|
||||
setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_S60
|
||||
if (S60->avkonComponentsSupportTransparency) {
|
||||
bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
|
||||
setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground
|
||||
setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -288,18 +262,6 @@ QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
|
|||
QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f)
|
||||
: QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
|
||||
{
|
||||
#ifdef Q_WS_WINCE
|
||||
if (!qt_wince_is_smartphone())
|
||||
setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_S60
|
||||
if (S60->avkonComponentsSupportTransparency) {
|
||||
bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
|
||||
setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground
|
||||
setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -404,17 +366,6 @@ bool QDialog::event(QEvent *e)
|
|||
accept();
|
||||
result = true;
|
||||
}
|
||||
#elif defined(Q_WS_S60)
|
||||
if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) {
|
||||
if (!testAttribute(Qt::WA_Moved)) {
|
||||
Qt::WindowStates state = windowState();
|
||||
adjustPosition(parentWidget());
|
||||
setAttribute(Qt::WA_Moved, false); // not really an explicit position
|
||||
if (state != windowState())
|
||||
setWindowState(state);
|
||||
}
|
||||
}
|
||||
// TODO is Symbian, non-S60 behaviour required?
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
|
@ -505,20 +456,6 @@ int QDialog::exec()
|
|||
setAttribute(Qt::WA_ShowModal, true);
|
||||
setResult(0);
|
||||
|
||||
//On Windows Mobile we create an empty menu to hide the current menu
|
||||
#ifdef Q_WS_WINCE_WM
|
||||
#ifndef QT_NO_MENUBAR
|
||||
QMenuBar *menuBar = 0;
|
||||
if (!findChild<QMenuBar *>())
|
||||
menuBar = new QMenuBar(this);
|
||||
if (qt_wince_is_smartphone()) {
|
||||
QAction *doneAction = new QAction(tr("Done"), this);
|
||||
menuBar->setDefaultAction(doneAction);
|
||||
connect(doneAction, SIGNAL(triggered()), this, SLOT(_q_doneAction()));
|
||||
}
|
||||
#endif //QT_NO_MENUBAR
|
||||
#endif //Q_WS_WINCE_WM
|
||||
|
||||
bool showSystemDialogFullScreen = false;
|
||||
if (showSystemDialogFullScreen) {
|
||||
setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
|
||||
|
|
@ -542,16 +479,9 @@ int QDialog::exec()
|
|||
int res = result();
|
||||
if (deleteOnClose)
|
||||
delete this;
|
||||
#ifdef Q_WS_WINCE_WM
|
||||
#ifndef QT_NO_MENUBAR
|
||||
else if (menuBar)
|
||||
delete menuBar;
|
||||
#endif //QT_NO_MENUBAR
|
||||
#endif //Q_WS_WINCE_WM
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Closes the dialog and sets its result code to \a r. If this dialog
|
||||
is shown with exec(), done() causes the local event loop to finish,
|
||||
|
|
@ -1027,17 +957,7 @@ QSize QDialog::sizeHint() const
|
|||
return QSize(qMax(QWidget::sizeHint().width(), d->extension->sizeHint().width()),
|
||||
QWidget::sizeHint().height());
|
||||
}
|
||||
#if defined(Q_WS_S60)
|
||||
// if size is not fixed, try to adjust it according to S60 layoutting
|
||||
if (minimumSize() != maximumSize()) {
|
||||
// In S60, dialogs are always the width of screen (in portrait, regardless of current layout)
|
||||
return QSize(qMin(S60->screenHeightInPixels, S60->screenWidthInPixels), QWidget::sizeHint().height());
|
||||
} else {
|
||||
return QWidget::sizeHint();
|
||||
}
|
||||
#else
|
||||
return QWidget::sizeHint();
|
||||
#endif //Q_WS_S60
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@
|
|||
#include <qdebug.h>
|
||||
#include "qsidebar_p.h"
|
||||
#include "qfscompleter_p.h"
|
||||
#include "private/qguiplatformplugin_p.h"
|
||||
|
||||
|
||||
#if defined (Q_OS_UNIX)
|
||||
#include <unistd.h>
|
||||
|
|
@ -370,83 +368,71 @@ inline void QFileDialogPrivate::deleteNativeDialog_sys()
|
|||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
helper->deleteNativeDialog_sys();
|
||||
else
|
||||
qt_guiPlatformPlugin()->fileDialogDelete(q_func());
|
||||
}
|
||||
|
||||
inline bool QFileDialogPrivate::setVisible_sys(bool visible)
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
return helper->setVisible_sys(visible);
|
||||
return qt_guiPlatformPlugin()->fileDialogSetVisible(q_func(), visible);
|
||||
return false;
|
||||
}
|
||||
|
||||
inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys()
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
return helper->dialogResultCode_sys();
|
||||
return qt_guiPlatformPlugin()->fileDialogResultCode(q_func());
|
||||
return QDialog::Rejected;
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::setDirectory_sys(const QString &directory)
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
helper->setDirectory_sys(directory);
|
||||
else
|
||||
qt_guiPlatformPlugin()->fileDialogSetDirectory(q_func(), directory);
|
||||
}
|
||||
|
||||
inline QString QFileDialogPrivate::directory_sys() const
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
return helper->directory_sys();
|
||||
return qt_guiPlatformPlugin()->fileDialogDirectory(q_func());
|
||||
return QString();
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::selectFile_sys(const QString &filename)
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
helper->selectFile_sys(filename);
|
||||
else
|
||||
qt_guiPlatformPlugin()->fileDialogSelectFile(q_func(), filename);
|
||||
}
|
||||
|
||||
inline QStringList QFileDialogPrivate::selectedFiles_sys() const
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
return helper->selectedFiles_sys();
|
||||
return qt_guiPlatformPlugin()->fileDialogSelectedFiles(q_func());
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::setFilter_sys()
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
helper->setFilter_sys();
|
||||
else
|
||||
qt_guiPlatformPlugin()->fileDialogSetFilter(q_func());
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters)
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
helper->setNameFilters_sys(filters);
|
||||
else
|
||||
qt_guiPlatformPlugin()->fileDialogSetNameFilters(q_func(), filters);
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
helper->selectNameFilter_sys(filter);
|
||||
else
|
||||
qt_guiPlatformPlugin()->fileDialogSelectNameFilter(q_func(), filter);
|
||||
}
|
||||
|
||||
inline QString QFileDialogPrivate::selectedNameFilter_sys() const
|
||||
{
|
||||
if (QPlatformDialogHelper *helper = platformHelper())
|
||||
return helper->selectedNameFilter_sys();
|
||||
return qt_guiPlatformPlugin()->fileDialogSelectedNameFilter(q_func());
|
||||
return QString();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -96,23 +96,6 @@ class Q_WIDGETS_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformP
|
|||
|
||||
enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize, PH_ItemView_ActivateItemOnSingleClick };
|
||||
virtual int platformHint(PlatformHint hint);
|
||||
|
||||
|
||||
virtual void fileDialogDelete(QFileDialog *) {}
|
||||
virtual bool fileDialogSetVisible(QFileDialog *, bool) { return false; }
|
||||
virtual QDialog::DialogCode fileDialogResultCode(QFileDialog *) { return QDialog::Rejected; }
|
||||
virtual void fileDialogSetDirectory(QFileDialog *, const QString &) {}
|
||||
virtual QString fileDialogDirectory(const QFileDialog *) const { return QString(); }
|
||||
virtual void fileDialogSelectFile(QFileDialog *, const QString &) {}
|
||||
virtual QStringList fileDialogSelectedFiles(const QFileDialog *) const { return QStringList(); }
|
||||
virtual void fileDialogSetFilter(QFileDialog *) {}
|
||||
virtual void fileDialogSetNameFilters(QFileDialog *, const QStringList &) {}
|
||||
virtual void fileDialogSelectNameFilter(QFileDialog *, const QString &) {}
|
||||
virtual QString fileDialogSelectedNameFilter(const QFileDialog *) const { return QString(); }
|
||||
|
||||
virtual void colorDialogDelete(QColorDialog *) {}
|
||||
virtual bool colorDialogSetVisible(QColorDialog *, bool) { return false; }
|
||||
virtual void colorDialogSetCurrentColor(QColorDialog *, const QColor &) {}
|
||||
};
|
||||
|
||||
//internal
|
||||
|
|
|
|||
Loading…
Reference in New Issue