diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-10-19 09:59:16 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-19 10:12:29 +0200 |
commit | 8dae626b2ffbe87c4ca023fdfb8094260f64a50e (patch) | |
tree | 4d5c660c490398aa045d0ba8f481c72794749be8 | |
parent | e72c0afcfb35de5225a6b4a7fb04c546baa93b07 (diff) |
QtTools/Designer/shared: Replace Q_WS_ by Q_OS_ where appropriate.
Change-Id: I166d859f8f446fb4bd08ed05aae1e3db0346b263
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
19 files changed, 48 insertions, 51 deletions
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp index 83d4c0051..848ecd63b 100644 --- a/src/designer/src/components/formeditor/formwindow.cpp +++ b/src/designer/src/components/formeditor/formwindow.cpp @@ -537,7 +537,7 @@ static inline unsigned mouseFlags(Qt::KeyboardModifiers mod) case Qt::ShiftModifier: return CycleParentModifier; break; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC case Qt::AltModifier: // "Alt" or "option" key on Mac means copy return CopyDragModifier; #endif diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp index d324c9362..93b9a9651 100644 --- a/src/designer/src/components/formeditor/formwindowmanager.cpp +++ b/src/designer/src/components/formeditor/formwindowmanager.cpp @@ -522,20 +522,20 @@ void FormWindowManager::setupActions() connect(m_actionShowFormWindowSettingsDialog, SIGNAL(triggered()), this, SLOT(slotActionShowFormWindowSettingsDialog())); m_actionShowFormWindowSettingsDialog->setEnabled(false); -#ifdef Q_WS_X11 - m_actionCopy->setIcon(QIcon::fromTheme("edit-copy", m_actionCopy->icon())); - m_actionCut->setIcon(QIcon::fromTheme("edit-cut", m_actionCut->icon())); - m_actionPaste->setIcon(QIcon::fromTheme("edit-paste", m_actionPaste->icon())); - m_actionDelete->setIcon(QIcon::fromTheme("edit-delete", m_actionDelete->icon())); +#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) + m_actionCopy->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy"), m_actionCopy->icon())); + m_actionCut->setIcon(QIcon::fromTheme(QStringLiteral("edit-cut"), m_actionCut->icon())); + m_actionPaste->setIcon(QIcon::fromTheme(QStringLiteral("edit-paste"), m_actionPaste->icon())); + m_actionDelete->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"), m_actionDelete->icon())); // These do not currently exist, but will allow theme authors to fill in the gaps - m_actionBreakLayout->setIcon(QIcon::fromTheme("designer-break-layout", m_actionBreakLayout->icon())); - m_actionGridLayout->setIcon(QIcon::fromTheme("designer-grid-layout", m_actionGridLayout->icon())); - m_actionHorizontalLayout->setIcon(QIcon::fromTheme("designer-horizontal-layout", m_actionHorizontalLayout->icon())); - m_actionVerticalLayout->setIcon(QIcon::fromTheme("designer-vertical-layout", m_actionVerticalLayout->icon())); - m_actionSplitHorizontal->setIcon(QIcon::fromTheme("designer-split-horizontal", m_actionSplitHorizontal->icon())); - m_actionSplitVertical->setIcon(QIcon::fromTheme("designer-split-vertical", m_actionSplitVertical->icon())); - m_actionAdjustSize->setIcon(QIcon::fromTheme("designer-adjust-size", m_actionAdjustSize->icon())); + m_actionBreakLayout->setIcon(QIcon::fromTheme(QStringLiteral("designer-break-layout"), m_actionBreakLayout->icon())); + m_actionGridLayout->setIcon(QIcon::fromTheme(QStringLiteral("designer-grid-layout"), m_actionGridLayout->icon())); + m_actionHorizontalLayout->setIcon(QIcon::fromTheme(QStringLiteral("designer-horizontal-layout"), m_actionHorizontalLayout->icon())); + m_actionVerticalLayout->setIcon(QIcon::fromTheme(QStringLiteral("designer-vertical-layout"), m_actionVerticalLayout->icon())); + m_actionSplitHorizontal->setIcon(QIcon::fromTheme(QStringLiteral("designer-split-horizontal"), m_actionSplitHorizontal->icon())); + m_actionSplitVertical->setIcon(QIcon::fromTheme(QStringLiteral("designer-split-vertical"), m_actionSplitVertical->icon())); + m_actionAdjustSize->setIcon(QIcon::fromTheme(QStringLiteral("designer-adjust-size"), m_actionAdjustSize->icon())); #endif } diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp index 3fd10139d..4ee93387c 100644 --- a/src/designer/src/designer/mainwindow.cpp +++ b/src/designer/src/designer/mainwindow.cpp @@ -95,7 +95,7 @@ MainWindowBase::MainWindowBase(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), m_policy(AcceptCloseEvents) { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC setWindowIcon(qDesigner->windowIcon()); #endif } diff --git a/src/designer/src/designer/newform.cpp b/src/designer/src/designer/newform.cpp index 27b07523b..4728188b0 100644 --- a/src/designer/src/designer/newform.cpp +++ b/src/designer/src/designer/newform.cpp @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE NewForm::NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget, const QString &fileName) : QDialog(parentWidget, -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC Qt::Tool | #endif Qt::WindowTitleHint | Qt::WindowSystemMenuHint), diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp index 282dcaac3..5ba110a9e 100644 --- a/src/designer/src/designer/qdesigner.cpp +++ b/src/designer/src/designer/qdesigner.cpp @@ -93,7 +93,7 @@ QDesigner::QDesigner(int &argc, char **argv) setApplicationName(QLatin1String(designerApplicationName)); QDesignerComponents::initializeResources(); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC setWindowIcon(QIcon(QStringLiteral(":/trolltech/designer/images/designer.png"))); #endif initialize(); diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp index 1bd06a6e3..d01255642 100644 --- a/src/designer/src/designer/qdesigner_actions.cpp +++ b/src/designer/src/designer/qdesigner_actions.cpp @@ -108,7 +108,7 @@ using namespace qdesigner_internal; const char *QDesignerActions::defaultToolbarPropertyName = "__qt_defaultToolBarAction"; -//#ifdef Q_WS_MAC +//#ifdef Q_OS_MAC # define NONMODAL_PREVIEW //#endif @@ -201,14 +201,14 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) #endif m_previewManager(0) { -#ifdef Q_WS_X11 - m_newFormAction->setIcon(QIcon::fromTheme("document-new", m_newFormAction->icon())); - m_openFormAction->setIcon(QIcon::fromTheme("document-open", m_openFormAction->icon())); - m_saveFormAction->setIcon(QIcon::fromTheme("document-save", m_saveFormAction->icon())); - m_saveFormAsAction->setIcon(QIcon::fromTheme("document-save-as", m_saveFormAsAction->icon())); - m_printPreviewAction->setIcon(QIcon::fromTheme("document-print", m_printPreviewAction->icon())); - m_closeFormAction->setIcon(QIcon::fromTheme("window-close", m_closeFormAction->icon())); - m_quitAction->setIcon(QIcon::fromTheme("application-exit", m_quitAction->icon())); +#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) + m_newFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-new"), m_newFormAction->icon())); + m_openFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-open"), m_openFormAction->icon())); + m_saveFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-save"), m_saveFormAction->icon())); + m_saveFormAsAction->setIcon(QIcon::fromTheme(QStringLiteral("document-save-as"), m_saveFormAsAction->icon())); + m_printPreviewAction->setIcon(QIcon::fromTheme(QStringLiteral("document-print"), m_printPreviewAction->icon())); + m_closeFormAction->setIcon(QIcon::fromTheme(QStringLiteral("window-close"), m_closeFormAction->icon())); + m_quitAction->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"), m_quitAction->icon())); #endif Q_ASSERT(m_core != 0); diff --git a/src/designer/src/designer/qdesigner_settings.cpp b/src/designer/src/designer/qdesigner_settings.cpp index 69a7e25d4..3f2b70379 100644 --- a/src/designer/src/designer/qdesigner_settings.cpp +++ b/src/designer/src/designer/qdesigner_settings.cpp @@ -217,7 +217,7 @@ void QDesignerSettings::setUiMode(UIMode mode) UIMode QDesignerSettings::uiMode() const { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC const UIMode defaultMode = TopLevelMode; #else const UIMode defaultMode = DockedMode; diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp index 52b0cdc3f..b4824ecc3 100644 --- a/src/designer/src/designer/qdesigner_workbench.cpp +++ b/src/designer/src/designer/qdesigner_workbench.cpp @@ -330,7 +330,7 @@ Qt::WindowFlags QDesignerWorkbench::magicalWindowFlags(const QWidget *widgetForF { switch (m_mode) { case TopLevelMode: { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (qobject_cast<const QDesignerToolWindow *>(widgetForFlags)) return Qt::Tool; #else @@ -392,7 +392,7 @@ void QDesignerWorkbench::switchToNeutralMode() fw->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); } -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC m_globalMenuBar->setParent(0); #endif @@ -410,14 +410,14 @@ void QDesignerWorkbench::switchToDockedMode() switchToNeutralMode(); -#ifdef Q_WS_X11 +#if !defined(Q_OS_MAC) +# if defined(Q_OS_UNIX) QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false); -#endif -#ifndef Q_WS_MAC +# endif // Q_OS_UNIX QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow(); widgetBoxWrapper->action()->setVisible(true); widgetBoxWrapper->setWindowTitle(tr("Widget Box")); -#endif +#endif // !Q_OS_MAC m_mode = DockedMode; const QDesignerSettings settings(m_core); @@ -431,7 +431,7 @@ void QDesignerWorkbench::switchToDockedMode() m_core->setTopLevel(m_dockedMainWindow); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC m_dockedMainWindow->setMenuBar(m_globalMenuBar); m_globalMenuBar->show(); #endif @@ -480,21 +480,21 @@ void QDesignerWorkbench::switchToTopLevelMode() // The widget box is special, it gets the menubar and gets to be the main widget. m_core->setTopLevel(widgetBoxWrapper); -#ifdef Q_WS_X11 +#if !defined(Q_OS_MAC) +# if defined(Q_OS_UNIX) // For now the appmenu protocol does not make it possible to associate a // menubar with all application windows. This means in top level mode you // can only reach the menubar when the widgetbox window is active. Since // this is quite inconvenient, better not use the native menubar in this // configuration and keep the menubar in the widgetbox window. QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); -#endif -#ifndef Q_WS_MAC +# endif // Q_OS_UNIX widgetBoxWrapper->setMenuBar(m_globalMenuBar); widgetBoxWrapper->action()->setVisible(false); widgetBoxWrapper->setCloseEventPolicy(MainWindowBase::EmitCloseEventSignal); qDesigner->setMainWindow(widgetBoxWrapper); widgetBoxWrapper->setWindowTitle(MainWindowBase::mainWindowTitle()); -#endif +#endif // !Q_OS_MAC const QDesignerSettings settings(m_core); m_topLevelData.toolbars = MainWindowBase::createToolBars(m_actionManager, false); diff --git a/src/designer/src/designer/versiondialog.cpp b/src/designer/src/designer/versiondialog.cpp index 2b3a0e7ce..4da199628 100644 --- a/src/designer/src/designer/versiondialog.cpp +++ b/src/designer/src/designer/versiondialog.cpp @@ -158,7 +158,7 @@ void VersionLabel::paintEvent(QPaintEvent *pe) VersionDialog::VersionDialog(QWidget *parent) : QDialog(parent -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC , Qt::Tool #endif ) diff --git a/src/designer/src/lib/sdk/abstractformeditor.cpp b/src/designer/src/lib/sdk/abstractformeditor.cpp index ca41fd5e3..cfbf5c975 100644 --- a/src/designer/src/lib/sdk/abstractformeditor.cpp +++ b/src/designer/src/lib/sdk/abstractformeditor.cpp @@ -559,7 +559,7 @@ void QDesignerFormEditorInterface::setIntrospection(QDesignerIntrospectionInterf */ QString QDesignerFormEditorInterface::resourceLocation() const { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC return QStringLiteral(":/trolltech/formeditor/images/mac"); #else return QStringLiteral(":/trolltech/formeditor/images/win"); diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp index 977d57ddb..4609a2795 100644 --- a/src/designer/src/lib/shared/actionrepository.cpp +++ b/src/designer/src/lib/shared/actionrepository.cpp @@ -641,9 +641,6 @@ QPixmap ActionRepositoryMimeData::actionDragPixmap(const QAction *action) QToolButton *tb = new QToolButton; tb->setText(action->text()); tb->setToolButtonStyle(Qt::ToolButtonTextOnly); -#ifdef Q_WS_WIN // Force alien off to make adjustSize() take the system minimumsize into account. - tb->createWinId(); -#endif tb->adjustSize(); const QPixmap rc = QPixmap::grabWidget(tb); tb->deleteLater(); diff --git a/src/designer/src/lib/shared/dialoggui.cpp b/src/designer/src/lib/shared/dialoggui.cpp index 5cb9502e5..ded7327be 100644 --- a/src/designer/src/lib/shared/dialoggui.cpp +++ b/src/designer/src/lib/shared/dialoggui.cpp @@ -52,7 +52,7 @@ #include <QtCore/QSet> // QFileDialog on X11 does not provide an image preview. Display icons. -#ifdef Q_WS_X11 +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) # define IMAGE_PREVIEW #endif diff --git a/src/designer/src/lib/shared/iconloader.cpp b/src/designer/src/lib/shared/iconloader.cpp index 009c0064a..02db6183b 100644 --- a/src/designer/src/lib/shared/iconloader.cpp +++ b/src/designer/src/lib/shared/iconloader.cpp @@ -53,7 +53,7 @@ QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name) { QStringList candidates = QStringList() << (QString::fromUtf8(":/trolltech/formeditor/images/") + name) -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC << (QString::fromUtf8(":/trolltech/formeditor/images/mac/") + name) #else << (QString::fromUtf8(":/trolltech/formeditor/images/win/") + name) diff --git a/src/designer/src/lib/shared/plugindialog.cpp b/src/designer/src/lib/shared/plugindialog.cpp index 1b62d3870..e841fc8e9 100644 --- a/src/designer/src/lib/shared/plugindialog.cpp +++ b/src/designer/src/lib/shared/plugindialog.cpp @@ -60,7 +60,7 @@ namespace qdesigner_internal { PluginDialog::PluginDialog(QDesignerFormEditorInterface *core, QWidget *parent) : QDialog(parent -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC , Qt::Tool #endif ), m_core(core) diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp index d9c85d363..852823a11 100644 --- a/src/designer/src/lib/shared/previewmanager.cpp +++ b/src/designer/src/lib/shared/previewmanager.cpp @@ -603,7 +603,7 @@ PreviewManager:: ~PreviewManager() Qt::WindowFlags PreviewManager::previewWindowFlags(const QWidget *widget) const { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN Qt::WindowFlags windowFlags = (widget->windowType() == Qt::Window) ? Qt::Window | Qt::WindowMaximizeButtonHint : Qt::WindowFlags(Qt::Dialog); #else Q_UNUSED(widget) @@ -875,7 +875,7 @@ bool PreviewManager::eventFilter(QObject *watched, QEvent *event) const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event); const int key = keyEvent->key(); if ((key == Qt::Key_Escape -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC || (keyEvent->modifiers() == Qt::ControlModifier && key == Qt::Key_Period) #endif )) { diff --git a/src/designer/src/lib/shared/qdesigner_dnditem.cpp b/src/designer/src/lib/shared/qdesigner_dnditem.cpp index ade95695e..239298018 100644 --- a/src/designer/src/lib/shared/qdesigner_dnditem.cpp +++ b/src/designer/src/lib/shared/qdesigner_dnditem.cpp @@ -128,7 +128,7 @@ void QDesignerDnDItem::setDomUi(DomUI *dom_ui) // ---------- QDesignerMimeData // Make pixmap transparent on Windows only. Mac is transparent by default, Unix usually does not work. -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # define TRANSPARENT_DRAG_PIXMAP #endif diff --git a/src/designer/src/lib/shared/sheet_delegate.cpp b/src/designer/src/lib/shared/sheet_delegate.cpp index 94fbdf4cd..12b496e01 100644 --- a/src/designer/src/lib/shared/sheet_delegate.cpp +++ b/src/designer/src/lib/shared/sheet_delegate.cpp @@ -66,7 +66,7 @@ void SheetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, QStyleOptionButton buttonOption; buttonOption.state = option.state; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC buttonOption.state |= QStyle::State_Raised; #endif buttonOption.state &= ~QStyle::State_HasFocus; diff --git a/src/qdbus/qdbusviewer/main.cpp b/src/qdbus/qdbusviewer/main.cpp index 00744d260..afd5f8c36 100644 --- a/src/qdbus/qdbusviewer/main.cpp +++ b/src/qdbus/qdbusviewer/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow mw; -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC app.setWindowIcon(QIcon(QLatin1String(":/trolltech/qdbusviewer/images/qdbusviewer.png"))); #else mw.setWindowTitle(qApp->translate("QtDBusViewer", "Qt D-Bus Viewer")); diff --git a/src/shared/findwidget/abstractfindwidget.cpp b/src/shared/findwidget/abstractfindwidget.cpp index 119443bdd..79764e3fd 100644 --- a/src/shared/findwidget/abstractfindwidget.cpp +++ b/src/shared/findwidget/abstractfindwidget.cpp @@ -73,7 +73,7 @@ static QIcon createIconSet(const QString &name) { QStringList candidates = QStringList() << (QString::fromUtf8(":/trolltech/shared/images/") + name) -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC << (QString::fromUtf8(":/trolltech/shared/images/mac/") + name); #else << (QString::fromUtf8(":/trolltech/shared/images/win/") + name); |