diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-01-08 15:12:43 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-18 09:23:38 +0100 |
commit | ab2c90cc525f499f0061a5042e7370bb8db2af94 (patch) | |
tree | 7f18fc9f88364b56ddc8de6bee055cd124ebcadf /src/gui/kernel | |
parent | d5912b2a475f6d947fc11c754504afcf3aaddf31 (diff) |
Introduce function for standard button texts to QPlatformTheme.
Change-Id: I91eec04a95b5047d893490a70152237b2991f662
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qplatformtheme.cpp | 58 | ||||
-rw-r--r-- | src/gui/kernel/qplatformtheme.h | 3 |
2 files changed, 61 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 628b2c9d12..90edf4c49f 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -51,6 +51,7 @@ #include <private/qiconloader_p.h> #include <private/qguiapplication_p.h> #include <qpa/qplatformintegration.h> +#include <qpa/qplatformdialoghelper.h> QT_BEGIN_NAMESPACE @@ -627,6 +628,63 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c return list; } +/*! + Returns the text of a standard \a button. + + \since 5.3 + \sa QMessageDialogOptions::StandardButton + */ + +QString QPlatformTheme::standardButtonText(int button) const +{ + return QPlatformTheme::defaultStandardButtonText(button); +} + +QString QPlatformTheme::defaultStandardButtonText(int button) +{ + switch (button) { + case QMessageDialogOptions::Ok: + return QCoreApplication::translate("QPlatformTheme", "OK"); + case QMessageDialogOptions::Save: + return QCoreApplication::translate("QPlatformTheme", "Save"); + case QMessageDialogOptions::SaveAll: + return QCoreApplication::translate("QPlatformTheme", "Save All"); + case QMessageDialogOptions::Open: + return QCoreApplication::translate("QPlatformTheme", "Open"); + case QMessageDialogOptions::Yes: + return QCoreApplication::translate("QPlatformTheme", "&Yes"); + case QMessageDialogOptions::YesToAll: + return QCoreApplication::translate("QPlatformTheme", "Yes to &All"); + case QMessageDialogOptions::No: + return QCoreApplication::translate("QPlatformTheme", "&No"); + case QMessageDialogOptions::NoToAll: + return QCoreApplication::translate("QPlatformTheme", "N&o to All"); + case QMessageDialogOptions::Abort: + return QCoreApplication::translate("QPlatformTheme", "Abort"); + case QMessageDialogOptions::Retry: + return QCoreApplication::translate("QPlatformTheme", "Retry"); + case QMessageDialogOptions::Ignore: + return QCoreApplication::translate("QPlatformTheme", "Ignore"); + case QMessageDialogOptions::Close: + return QCoreApplication::translate("QPlatformTheme", "Close"); + case QMessageDialogOptions::Cancel: + return QCoreApplication::translate("QPlatformTheme", "Cancel"); + case QMessageDialogOptions::Discard: + return QCoreApplication::translate("QPlatformTheme", "Discard"); + case QMessageDialogOptions::Help: + return QCoreApplication::translate("QPlatformTheme", "Help"); + case QMessageDialogOptions::Apply: + return QCoreApplication::translate("QPlatformTheme", "Apply"); + case QMessageDialogOptions::Reset: + return QCoreApplication::translate("QPlatformTheme", "Reset"); + case QMessageDialogOptions::RestoreDefaults: + return QCoreApplication::translate("QPlatformTheme", "Restore Defaults"); + default: + break; + } + return QString(); +} + unsigned QPlatformThemePrivate::currentKeyPlatforms() { const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt(); diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index 2ab8cef760..205a5bab69 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -296,7 +296,10 @@ public: virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const; + virtual QString standardButtonText(int button) const; + static QVariant defaultThemeHint(ThemeHint hint); + static QString defaultStandardButtonText(int button); protected: explicit QPlatformTheme(QPlatformThemePrivate *priv); |