aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2013-04-12 21:05:13 -0400
committerJake Petroules <jake.petroules@petroules.com>2013-04-15 14:50:57 +0200
commit5f3ce05b45f31e1175e5c9874965785a9f670bda (patch)
treec9461aa1b327a9a6c4f58911946ff7c4396567fd
parent94d81270509dbb438bf21790f9932123a77a8c3c (diff)
Rename and namespace setUnifiedTitleAndToolBarOnMac.
Change-Id: I30babc76d5b35f7834752d88b40c7f8af8ba6a2d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--examples/macunifiedtoolbar/preferenceswindow.cpp8
-rw-r--r--src/macextras/macextras-lib.pri46
-rw-r--r--src/macextras/qmacunifiedtoolbar.cpp55
-rw-r--r--src/macextras/qmacunifiedtoolbar.h7
-rw-r--r--src/macextras/qmacunifiedtoolbar.mm8
5 files changed, 34 insertions, 90 deletions
diff --git a/examples/macunifiedtoolbar/preferenceswindow.cpp b/examples/macunifiedtoolbar/preferenceswindow.cpp
index 28bd7d0..a3cc04a 100644
--- a/examples/macunifiedtoolbar/preferenceswindow.cpp
+++ b/examples/macunifiedtoolbar/preferenceswindow.cpp
@@ -55,10 +55,8 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) :
foreach (QAction *action, ui->toolBar->actions())
items->addAction(action);
- // This single line of code is all that's needed to transform a QToolBar into
- // a QMacUnifiedToolBar. It is available on all platforms and is simply a no-op
- // on platforms other than OS X.
- ::setUnifiedTitleAndToolBarOnMac(ui->toolBar, ui->useNativeToolbarCheckBox->isChecked());
+ // This single line of code is all that's needed to transform a QToolBar into a native toolbar!
+ QtMacExtras::setNativeToolBar(ui->toolBar, ui->useNativeToolbarCheckBox->isChecked());
QTimer::singleShot(0, this, SLOT(pack()));
}
@@ -94,7 +92,7 @@ void PreferencesWindow::toolbarItemTriggered()
void PreferencesWindow::useNativeToolBarToggled(bool on)
{
- ::setUnifiedTitleAndToolBarOnMac(ui->toolBar, on);
+ QtMacExtras::setNativeToolBar(ui->toolBar, on);
QTimer::singleShot(0, this, SLOT(pack()));
}
diff --git a/src/macextras/macextras-lib.pri b/src/macextras/macextras-lib.pri
index 2c2f5ef..709eaa7 100644
--- a/src/macextras/macextras-lib.pri
+++ b/src/macextras/macextras-lib.pri
@@ -3,35 +3,33 @@ INCLUDEPATH += $$PWD
mac {
PUBLIC_HEADERS += $$PWD/qmacfunctions.h
OBJECTIVE_SOURCES += $$PWD/qmacfunctions.mm
-}
-macx:!ios {
- PUBLIC_HEADERS += \
- $$PWD/qmaccocoaviewcontainer.h \
- $$PWD/qmacnativewidget.h \
- $$PWD/qmactoolbutton.h \
- $$PWD/qmacunifiedtoolbar.h
+ !ios {
+ PUBLIC_HEADERS += \
+ $$PWD/qmaccocoaviewcontainer.h \
+ $$PWD/qmacnativewidget.h \
+ $$PWD/qmactoolbutton.h \
+ $$PWD/qmacunifiedtoolbar.h
- PRIVATE_HEADERS += \
- $$PWD/qmactoolbardelegate.h \
- $$PWD/qnstoolbar.h
+ PRIVATE_HEADERS += \
+ $$PWD/qmactoolbardelegate.h \
+ $$PWD/qnstoolbar.h
- OBJECTIVE_SOURCES += \
- $$PWD/qmaccocoaviewcontainer.mm \
- $$PWD/qmacnativewidget.mm \
- $$PWD/qmactoolbardelegate.mm \
- $$PWD/qmactoolbutton.mm \
- $$PWD/qmacunifiedtoolbar.mm \
- $$PWD/qnstoolbar.mm
+ OBJECTIVE_SOURCES += \
+ $$PWD/qmaccocoaviewcontainer.mm \
+ $$PWD/qmacnativewidget.mm \
+ $$PWD/qmactoolbardelegate.mm \
+ $$PWD/qmactoolbutton.mm \
+ $$PWD/qmacunifiedtoolbar.mm \
+ $$PWD/qnstoolbar.mm
- greaterThan(QT_MAJOR_VERSION, 4) {
- PUBLIC_HEADERS += $$PWD/qmacpasteboardmime.h
- OBJECTIVE_SOURCES += $$PWD/qmacpasteboardmime.mm
- }
+ greaterThan(QT_MAJOR_VERSION, 4) {
+ PUBLIC_HEADERS += $$PWD/qmacpasteboardmime.h
+ OBJECTIVE_SOURCES += $$PWD/qmacpasteboardmime.mm
+ }
- LIBS *= -framework AppKit
-} else {
- SOURCES += $$PWD/qmacunifiedtoolbar.cpp
+ LIBS *= -framework AppKit
+ }
}
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
diff --git a/src/macextras/qmacunifiedtoolbar.cpp b/src/macextras/qmacunifiedtoolbar.cpp
deleted file mode 100644
index 06b815a..0000000
--- a/src/macextras/qmacunifiedtoolbar.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtMacExtras module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QString>
-
-class QToolBar;
-class QMacUnifiedToolBar;
-
-QMacUnifiedToolBar* setUnifiedTitleAndToolBarOnMac(QToolBar*, bool)
-{
- return 0;
-}
-
-QMacUnifiedToolBar* setUnifiedTitleAndToolBarOnMac(QToolBar*, const QString&, bool)
-{
- return NULL;
-}
diff --git a/src/macextras/qmacunifiedtoolbar.h b/src/macextras/qmacunifiedtoolbar.h
index 9eaf77a..c084d5e 100644
--- a/src/macextras/qmacunifiedtoolbar.h
+++ b/src/macextras/qmacunifiedtoolbar.h
@@ -50,8 +50,11 @@ class QToolBar;
class QWidget;
class QMacUnifiedToolBar;
-Q_MACEXTRAS_EXPORT QMacUnifiedToolBar* setUnifiedTitleAndToolBarOnMac(QToolBar *toolbar, bool on = true);
-Q_MACEXTRAS_EXPORT QMacUnifiedToolBar* setUnifiedTitleAndToolBarOnMac(QToolBar *toolbar, const QString &identifier, bool on = true);
+namespace QtMacExtras
+{
+Q_MACEXTRAS_EXPORT QMacUnifiedToolBar* setNativeToolBar(QToolBar *toolbar, bool on = true);
+Q_MACEXTRAS_EXPORT QMacUnifiedToolBar* setNativeToolBar(QToolBar *toolbar, const QString &identifier, bool on = true);
+}
#include "qmactoolbutton.h"
#include <QObject>
diff --git a/src/macextras/qmacunifiedtoolbar.mm b/src/macextras/qmacunifiedtoolbar.mm
index a6b667e..eb47934 100644
--- a/src/macextras/qmacunifiedtoolbar.mm
+++ b/src/macextras/qmacunifiedtoolbar.mm
@@ -199,16 +199,16 @@ public:
@end
-QMacUnifiedToolBar* setUnifiedTitleAndToolBarOnMac(QToolBar *toolbar, bool on)
+QMacUnifiedToolBar* QtMacExtras::setNativeToolBar(QToolBar *toolbar, bool on)
{
- return setUnifiedTitleAndToolBarOnMac(toolbar, QString(), on);
+ return QtMacExtras::setNativeToolBar(toolbar, QString(), on);
}
-QMacUnifiedToolBar* setUnifiedTitleAndToolBarOnMac(QToolBar *toolbar, const QString &identifier, bool on)
+QMacUnifiedToolBar* QtMacExtras::setNativeToolBar(QToolBar *toolbar, const QString &identifier, bool on)
{
if (!toolbar)
{
- qWarning() << "setNativeToolBarOnMac: toolbar was NULL";
+ qWarning() << "setNativeToolBar: toolbar was NULL";
return NULL;
}