Convert features.messagebox to QT_[REQUIRE_]CONFIG

Change-Id: Ie25dc672f8a675c06585c7757255f7dbadbfc5ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
bb10
Stephan Binner 2017-05-31 20:43:28 +02:00
parent 003dc8e29a
commit 63cc734abb
10 changed files with 45 additions and 38 deletions

View File

@ -94,9 +94,9 @@ private:
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool))
Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog())
# if !defined(QT_NO_MESSAGEBOX)
#if QT_CONFIG(messagebox)
Q_PRIVATE_SLOT(d_func(), void _q_checkFields())
# endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
friend class QUnixPrintWidget;
# endif // Q_OS_UNIX
};

View File

@ -41,7 +41,9 @@
#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include "private/qabstractprintdialog_p.h"
#if QT_CONFIG(messagebox)
#include <QtWidgets/qmessagebox.h>
#endif
#include "qprintdialog.h"
#if QT_CONFIG(filedialog)
#include "qfiledialog.h"
@ -203,7 +205,7 @@ public:
void selectPrinter(const QPrinter::OutputFormat outputFormat);
void _q_togglePageSetCombo(bool);
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
void _q_checkFields();
#endif
void _q_collapseOrExpandDialog();
@ -337,7 +339,7 @@ void QPrintDialogPrivate::init()
lay->addWidget(bottom);
lay->addWidget(buttons);
#ifdef QT_NO_MESSAGEBOX
#if !QT_CONFIG(messagebox)
QObject::connect(buttons, SIGNAL(accepted()), q, SLOT(accept()));
#else
QObject::connect(buttons, SIGNAL(accepted()), q, SLOT(_q_checkFields()));
@ -496,14 +498,14 @@ void QPrintDialogPrivate::_q_collapseOrExpandDialog()
}
}
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
void QPrintDialogPrivate::_q_checkFields()
{
Q_Q(QPrintDialog);
if (top->d->checkFields())
q->accept();
}
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
void QPrintDialogPrivate::updateWidgets()
@ -836,7 +838,7 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties()
propertiesDialog->applyPrinterProperties(printer);
}
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
bool QUnixPrintWidgetPrivate::checkFields()
{
if (widget.filename->isEnabled()) {
@ -887,7 +889,7 @@ bool QUnixPrintWidgetPrivate::checkFields()
// Every test passed. Accept the dialog.
return true;
}
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
void QUnixPrintWidgetPrivate::setupPrinterProperties()
{

View File

@ -6,7 +6,6 @@ HEADERS += \
dialogs/qerrormessage.h \
dialogs/qfontdialog.h \
dialogs/qfontdialog_p.h \
dialogs/qmessagebox.h \
dialogs/qfilesystemmodel.h \
dialogs/qfilesystemmodel_p.h \
dialogs/qfileinfogatherer_p.h \
@ -22,7 +21,6 @@ SOURCES += \
dialogs/qcolordialog.cpp \
dialogs/qerrormessage.cpp \
dialogs/qfontdialog.cpp \
dialogs/qmessagebox.cpp \
dialogs/qfilesystemmodel.cpp \
dialogs/qfileinfogatherer.cpp \
dialogs/qwizard.cpp \
@ -54,9 +52,13 @@ qtConfig(inputdialog) {
SOURCES += dialogs/qinputdialog.cpp
}
qtConfig(messagebox) {
HEADERS += dialogs/qmessagebox.h
SOURCES += dialogs/qmessagebox.cpp
RESOURCES += dialogs/qmessagebox.qrc
}
qtConfig(progressdialog) {
HEADERS += dialogs/qprogressdialog.h
SOURCES += dialogs/qprogressdialog.cpp
}
RESOURCES += dialogs/qmessagebox.qrc

View File

@ -53,7 +53,9 @@
#endif
#include "qmenu.h"
#include "qcursor.h"
#if QT_CONFIG(messagebox)
#include "qmessagebox.h"
#endif
#include "qerrormessage.h"
#include <qpa/qplatformtheme.h>
#include "private/qdialog_p.h"
@ -78,7 +80,7 @@ static inline int themeDialogType(const QDialog *dialog)
if (qobject_cast<const QFontDialog *>(dialog))
return QPlatformTheme::FontDialog;
#endif
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
if (qobject_cast<const QMessageBox *>(dialog))
return QPlatformTheme::MessageDialog;
#endif

View File

@ -45,7 +45,9 @@
#include "qcheckbox.h"
#include "qlabel.h"
#include "qlayout.h"
#if QT_CONFIG(messagebox)
#include "qmessagebox.h"
#endif
#include "qpushbutton.h"
#include "qstringlist.h"
#include "qtextedit.h"
@ -234,7 +236,7 @@ QErrorMessage::QErrorMessage(QWidget * parent)
grid->setColumnStretch(1, 42);
grid->setRowStretch(0, 42);
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information));
d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
#endif

View File

@ -51,7 +51,9 @@
#include <qshortcut.h>
#include <qgridlayout.h>
#include <qmenu.h>
#if QT_CONFIG(messagebox)
#include <qmessagebox.h>
#endif
#include <stdlib.h>
#include <qsettings.h>
#include <qdebug.h>
@ -2627,11 +2629,11 @@ void QFileDialog::accept()
if (!info.exists())
info = QFileInfo(d->getEnvironmentVariable(fn));
if (!info.exists()) {
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
QString message = tr("%1\nDirectory not found.\nPlease verify the "
"correct directory name was given.");
QMessageBox::warning(this, windowTitle(), message.arg(info.fileName()));
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
return;
}
if (info.isDir()) {
@ -2659,7 +2661,7 @@ void QFileDialog::accept()
if (!info.exists() || !confirmOverwrite() || acceptMode() == AcceptOpen) {
d->emitFilesSelected(QStringList(fn));
QDialog::accept();
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
} else {
if (QMessageBox::warning(this, windowTitle(),
tr("%1 already exists.\nDo you want to replace it?")
@ -2681,11 +2683,11 @@ void QFileDialog::accept()
if (!info.exists())
info = QFileInfo(d->getEnvironmentVariable(file));
if (!info.exists()) {
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
QString message = tr("%1\nFile not found.\nPlease verify the "
"correct file name was given.");
QMessageBox::warning(this, windowTitle(), message.arg(info.fileName()));
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
return;
}
if (info.isDir()) {
@ -3428,7 +3430,7 @@ void QFileDialogPrivate::_q_deleteCurrent()
bool isDir = model->isDir(index);
QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt());
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
Q_Q(QFileDialog);
if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"),
QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?")
@ -3444,12 +3446,12 @@ void QFileDialogPrivate::_q_deleteCurrent()
#else
if (!(p & QFile::WriteUser))
return;
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
// the event loop has run, we can NOT reuse index because the model might have removed it.
if (isDir) {
if (!removeDirectory(filePath)) {
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
QMessageBox::warning(q, q->windowTitle(),
QFileDialog::tr("Could not delete directory."));
#endif
@ -3630,7 +3632,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index)
*/
void QFileDialogPrivate::_q_goToDirectory(const QString &path)
{
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
Q_Q(QFileDialog);
#endif
QModelIndex index = qFileDialogUi->lookInCombo->model()->index(qFileDialogUi->lookInCombo->currentIndex(),
@ -3649,12 +3651,12 @@ void QFileDialogPrivate::_q_goToDirectory(const QString &path)
if (dir.exists() || path2.isEmpty() || path2 == model->myComputer().toString()) {
_q_enterDirectory(index);
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
} else {
QString message = QFileDialog::tr("%1\nDirectory not found.\nPlease verify the "
"correct directory name was given.");
QMessageBox::warning(q, q->windowTitle(), message.arg(path2));
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
}
}

View File

@ -43,7 +43,9 @@
#include <qmimedata.h>
#include <qurl.h>
#include <qdebug.h>
#if QT_CONFIG(messagebox)
#include <qmessagebox.h>
#endif
#include <qapplication.h>
#include <QtCore/qcollator.h>
@ -881,12 +883,12 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
if (newName.isEmpty()
|| QDir::toNativeSeparators(newName).contains(QDir::separator())
|| !QDir(parentPath).rename(oldName, newName)) {
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"),
QFileSystemModel::tr("<b>The name \"%1\" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks.")
.arg(newName),
QMessageBox::Ok);
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
return false;
} else {
/*

View File

@ -39,8 +39,6 @@
#include <QtWidgets/qmessagebox.h>
#ifndef QT_NO_MESSAGEBOX
#include <QtWidgets/qdialogbuttonbox.h>
#include "private/qlabel_p.h"
#include "private/qapplication_p.h"
@ -2737,5 +2735,3 @@ QT_END_NAMESPACE
#include "moc_qmessagebox.cpp"
#include "qmessagebox.moc"
#endif // QT_NO_MESSAGEBOX

View File

@ -42,12 +42,11 @@
#include <QtWidgets/qtwidgetsglobal.h>
#ifndef QT_NO_MESSAGEBOX
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(messagebox);
QT_BEGIN_NAMESPACE
class QLabel;
class QMessageBoxPrivate;
@ -325,6 +324,4 @@ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplicatio
QT_END_NAMESPACE
#endif // QT_NO_MESSAGEBOX
#endif // QMESSAGEBOX_H

View File

@ -65,7 +65,9 @@
#include "qdebug.h"
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#if QT_CONFIG(messagebox)
#include "qmessagebox.h"
#endif
#include "qwidgetwindow_p.h"
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtGui/qstylehints.h>
@ -1916,9 +1918,9 @@ void QApplication::closeAllWindows()
*/
void QApplication::aboutQt()
{
#ifndef QT_NO_MESSAGEBOX
#if QT_CONFIG(messagebox)
QMessageBox::aboutQt(activeWindow());
#endif // QT_NO_MESSAGEBOX
#endif // QT_CONFIG(messagebox)
}
/*!