Skip to content

Commit

Permalink
Q_WS_* macros removed from Qt5, to determine platform use Q_OS_* macr…
Browse files Browse the repository at this point in the history
…oses which exists in Qt4 and Qt5
  • Loading branch information
naihil committed Dec 23, 2014
1 parent a4aaff5 commit d5d4a5a
Show file tree
Hide file tree
Showing 40 changed files with 86 additions and 86 deletions.
10 changes: 5 additions & 5 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -195,7 +195,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )

mActionAtlasPreview->setCheckable( true );

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
mActionQuit->setText( tr( "Close" ) );
mActionQuit->setShortcut( QKeySequence::Close );
QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) );
Expand Down Expand Up @@ -307,7 +307,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
QShortcut* ctrlEquals = new QShortcut( QKeySequence( "Ctrl+=" ), this );
connect( ctrlEquals, SIGNAL( activated() ), mActionZoomIn, SLOT( trigger() ) );

#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
//disabled for OSX - see #10761
//also see http://qt-project.org/forums/viewthread/3630 QGraphicsEffects are not well supported on OSX
QMenu *previewMenu = viewMenu->addMenu( "&Preview" );
Expand Down Expand Up @@ -404,7 +404,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ) );
settingsMenu->addAction( mActionOptions );

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// this doesn't work on Mac anymore: menuBar()->addMenu( mQgis->windowMenu() );
// QgsComposer::populateWithOtherMenu should work recursively with submenus and regardless of Qt version
mWindowMenu = new QMenu( tr( "Window" ), this );
Expand Down Expand Up @@ -802,7 +802,7 @@ void QgsComposer::activate()
}
}

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
void QgsComposer::changeEvent( QEvent* event )
{
QMainWindow::changeEvent( event );
Expand Down Expand Up @@ -2950,7 +2950,7 @@ void QgsComposer::showEvent( QShowEvent* event )
restoreComposerMapStates();
}

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// add to menu if (re)opening window (event not due to unminimize)
if ( !event->spontaneous() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposer.h
Expand Up @@ -114,7 +114,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase

virtual void showEvent( QShowEvent* event );

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
//! Change event (update window menu on ActivationChange)
virtual void changeEvent( QEvent * );
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposerattributetablewidget.cpp
Expand Up @@ -288,7 +288,7 @@ void QgsComposerAttributeTableWidget::on_mHeaderFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->headerFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
Expand Down Expand Up @@ -336,7 +336,7 @@ void QgsComposerAttributeTableWidget::on_mContentFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->contentFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposerlabelwidget.cpp
Expand Up @@ -91,7 +91,7 @@ void QgsComposerLabelWidget::on_mFontButton_clicked()
if ( mComposerLabel )
{
bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerLabel->font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
8 changes: 4 additions & 4 deletions src/app/composer/qgscomposerlegendwidget.cpp
Expand Up @@ -368,7 +368,7 @@ void QgsComposerLegendWidget::on_mTitleFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::Title ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand All @@ -390,7 +390,7 @@ void QgsComposerLegendWidget::on_mGroupFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::Group ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand All @@ -412,7 +412,7 @@ void QgsComposerLegendWidget::on_mLayerFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::Subgroup ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand All @@ -434,7 +434,7 @@ void QgsComposerLegendWidget::on_mItemFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::SymbolLabel ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposermanager.cpp
Expand Up @@ -63,7 +63,7 @@ QgsComposerManager::QgsComposerManager( QWidget * parent, Qt::WindowFlags f ): Q
mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
connect( pb, SIGNAL( clicked() ), this, SLOT( rename_clicked() ) );

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Create action to select this window
mWindowAction = new QAction( windowTitle(), this );
connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
Expand Down Expand Up @@ -285,7 +285,7 @@ void QgsComposerManager::openLocalDirectory( const QString& localDirPath )
QDesktopServices::openUrl( QUrl::fromLocalFile( localDirPath ) );
}

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
void QgsComposerManager::showEvent( QShowEvent* event )
{
if ( !event->spontaneous() )
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposermanager.h
Expand Up @@ -73,7 +73,7 @@ class QgsComposerManager: public QDialog, private Ui::QgsComposerManagerBase
QString mDefaultTemplatesDir;
QString mUserTemplatesDir;

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
void showEvent( QShowEvent *event );
void changeEvent( QEvent * );

Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -2055,7 +2055,7 @@ void QgsComposerMapWidget::on_mAnnotationFontButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, grid->annotationFont(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposerscalebarwidget.cpp
Expand Up @@ -311,7 +311,7 @@ void QgsComposerScaleBarWidget::on_mFontButton_clicked()

bool dialogAccepted;
QFont oldFont = mComposerScaleBar->font();
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &dialogAccepted, oldFont, 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposertablewidget.cpp
Expand Up @@ -215,7 +215,7 @@ void QgsComposerTableWidget::on_mHeaderFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->headerFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
Expand Down Expand Up @@ -250,7 +250,7 @@ void QgsComposerTableWidget::on_mContentFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->contentFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
Expand Down
4 changes: 2 additions & 2 deletions src/app/gps/qwtpolar-1.0/qwt_polar_global.h
Expand Up @@ -16,7 +16,7 @@
#define QWT_POLAR_VERSION 0x010000
#define QWT_POLAR_VERSION_STR "1.0.0"

#if defined(Q_WS_WIN) || defined(Q_WS_S60)
#if defined(Q_OS_WIN) || defined(Q_WS_S60)

#if defined(_MSC_VER) /* MSVC Compiler */
/* template-class specialization 'identifier' is already instantiated */
Expand All @@ -34,7 +34,7 @@

#endif // QWT_POLAR_MAKEDLL

#endif // Q_WS_WIN
#endif // Q_OS_WIN

#ifndef QWT_POLAR_EXPORT
#define QWT_POLAR_EXPORT
Expand Down
12 changes: 6 additions & 6 deletions src/app/main.cpp
Expand Up @@ -631,7 +631,7 @@ int main( int argc, char *argv[] )
QgsApplication myApp( argc, argv, myUseGuiFlag, configpath );

// (if Windows/Mac, use icon from resource)
#if !defined(Q_WS_WIN) && !defined(Q_WS_MAC)
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
myApp.setWindowIcon( QIcon( QgsApplication::iconsPath() + "qgis-icon-60x60.png" ) );
#endif

Expand Down Expand Up @@ -727,15 +727,15 @@ int main( int argc, char *argv[] )

if ( systemEnvVars.contains( envVarName ) && envVarApply == "unset" )
{
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
putenv( envVarName.toUtf8().constData() );
#else
unsetenv( envVarName.toUtf8().constData() );
#endif
}
else
{
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
if ( envVarApply != "undefined" || !getenv( envVarName.toUtf8().constData() ) )
putenv( QString( "%1=%2" ).arg( envVarName ).arg( envVarValue ).toUtf8().constData() );
#else
Expand All @@ -755,7 +755,7 @@ int main( int argc, char *argv[] )
QString style = mySettings.value( "/qgis/style" ).toString();
if ( !style.isNull() )
QApplication::setStyle( style );
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
#if QT_VERSION < 0x050000
else
QApplication::setStyle( new QPlastiqueStyle );
Expand Down Expand Up @@ -828,7 +828,7 @@ int main( int argc, char *argv[] )
// we need to be sure we can find the qt image
// plugins. In mac be sure to look in the
// application bundle...
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
QCoreApplication::addLibraryPath( QApplication::applicationDirPath()
+ QDir::separator() + "qtplugins" );
#endif
Expand Down Expand Up @@ -967,7 +967,7 @@ int main( int argc, char *argv[] )

if ( !pythonfile.isEmpty() )
{
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
//replace backslashes with forward slashes
pythonfile.replace( "\\", "/" );
#endif
Expand Down
32 changes: 16 additions & 16 deletions src/app/qgisapp.cpp
Expand Up @@ -664,7 +664,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
connect( mInternalClipboard, SIGNAL( changed() ), this, SLOT( clipboardChanged() ) );
mQgisInterface = new QgisAppInterface( this ); // create the interfce

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// action for Window menu (create before generating WindowTitleChange event))
mWindowAction = new QAction( this );
connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
Expand Down Expand Up @@ -1172,7 +1172,7 @@ void QgisApp::createActions()
connect( mActionStyleManagerV2, SIGNAL( triggered() ), this, SLOT( showStyleManagerV2() ) );
connect( mActionCustomization, SIGNAL( triggered() ), this, SLOT( customize() ) );

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Window Menu Items

mActionWindowMinimize = new QAction( tr( "Minimize" ), this );
Expand Down Expand Up @@ -1220,7 +1220,7 @@ void QgisApp::createActions()

// Help Menu Items

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
mActionHelpContents->setShortcut( QString( "Ctrl+?" ) );
mActionQgisHomePage->setShortcut( QString() );
#endif
Expand Down Expand Up @@ -1297,7 +1297,7 @@ void QgisApp::showPythonDialog()
mPythonUtils->getError( className, text );
messageBar()->pushMessage( tr( "Error" ), tr( "Failed to open Python console:" ) + "\n" + className + ": " + text, QgsMessageBar::WARNING );
}
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
else
{
addWindow( mActionShowPythonDialog );
Expand Down Expand Up @@ -1449,14 +1449,14 @@ void QgisApp::createMenus()
}


#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
//disabled for OSX - see #10761
//also see http://qt-project.org/forums/viewthread/3630 QGraphicsEffects are not well supported on OSX
mMenuPreviewMode->menuAction()->setVisible( false );
#endif


#ifdef Q_WS_MAC
#ifdef Q_OS_MAC

// keep plugins from hijacking About and Preferences application menus
// these duplicate actions will be moved to application menus by Qt
Expand Down Expand Up @@ -4460,7 +4460,7 @@ void QgisApp::activate()

void QgisApp::bringAllToFront()
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Bring forward all open windows while maintaining layering order
ProcessSerialNumber psn;
GetCurrentProcess( &psn );
Expand All @@ -4470,7 +4470,7 @@ void QgisApp::bringAllToFront()

void QgisApp::addWindow( QAction *action )
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
mWindowActions->addAction( action );
mWindowMenu->addAction( action );
action->setCheckable( true );
Expand All @@ -4482,7 +4482,7 @@ void QgisApp::addWindow( QAction *action )

void QgisApp::removeWindow( QAction *action )
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
mWindowActions->removeAction( action );
mWindowMenu->removeAction( action );
#else
Expand Down Expand Up @@ -7368,7 +7368,7 @@ class QgsPythonRunnerImpl : public QgsPythonRunner
void QgisApp::loadPythonSupport()
{
QString pythonlibName( "qgispython" );
#if defined(Q_WS_MAC) || defined(Q_OS_LINUX)
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
pythonlibName.prepend( QgsApplication::libraryPath() );
#endif
#ifdef __MINGW32__
Expand Down Expand Up @@ -8072,7 +8072,7 @@ void QgisApp::closeProject()
void QgisApp::changeEvent( QEvent* event )
{
QMainWindow::changeEvent( event );
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
switch ( event->type() )
{
case QEvent::ActivationChange:
Expand Down Expand Up @@ -8120,7 +8120,7 @@ QMenu* QgisApp::getPluginMenu( QString menuName )
* of the menu.
*/

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Mac doesn't have '&' keyboard shortcuts.
menuName.remove( QChar( '&' ) );
#endif
Expand Down Expand Up @@ -8192,7 +8192,7 @@ void QgisApp::removePluginMenu( QString name, QAction* action )

QMenu* QgisApp::getDatabaseMenu( QString menuName )
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Mac doesn't have '&' keyboard shortcuts.
menuName.remove( QChar( '&' ) );
#endif
Expand Down Expand Up @@ -8232,7 +8232,7 @@ QMenu* QgisApp::getDatabaseMenu( QString menuName )

QMenu* QgisApp::getRasterMenu( QString menuName )
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Mac doesn't have '&' keyboard shortcuts.
menuName.remove( QChar( '&' ) );
#endif
Expand Down Expand Up @@ -8282,7 +8282,7 @@ QMenu* QgisApp::getRasterMenu( QString menuName )

QMenu* QgisApp::getVectorMenu( QString menuName )
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Mac doesn't have '&' keyboard shortcuts.
menuName.remove( QChar( '&' ) );
#endif
Expand Down Expand Up @@ -8322,7 +8322,7 @@ QMenu* QgisApp::getVectorMenu( QString menuName )

QMenu* QgisApp::getWebMenu( QString menuName )
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// Mac doesn't have '&' keyboard shortcuts.
menuName.remove( QChar( '&' ) );
#endif
Expand Down

0 comments on commit d5d4a5a

Please sign in to comment.