diff --git a/src/plugins/projectexplorer/buildprogress.cpp b/src/plugins/projectexplorer/buildprogress.cpp index c97ce2c87ae81ca590a734f336ef771dcb2e2429..906a366634ed6f37966906152b4d2fa031f54a3d 100644 --- a/src/plugins/projectexplorer/buildprogress.cpp +++ b/src/plugins/projectexplorer/buildprogress.cpp @@ -35,6 +35,11 @@ #include <QtGui/QHBoxLayout> #include <QtGui/QFont> #include <QtGui/QPixmap> +#include <QtDebug> + +#ifdef Q_OS_MAC +#include "buildprogress_mac.h" +#endif using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; @@ -93,4 +98,10 @@ void BuildProgress::updateState() m_warningIcon->setEnabled(haveWarnings); m_warningLabel->setEnabled(haveWarnings); m_warningLabel->setText(QString("%1").arg(warnings)); +#ifdef Q_OS_MAC + if (haveErrors) + qtcShowDockTileBadgeLabel(QString("%1").arg(errors)); + else + qtcShowDockTileBadgeLabel(""); +#endif } diff --git a/src/plugins/projectexplorer/buildprogress_mac.h b/src/plugins/projectexplorer/buildprogress_mac.h new file mode 100644 index 0000000000000000000000000000000000000000..fa51dfa64805a381dfd92b85dba015aee29240f0 --- /dev/null +++ b/src/plugins/projectexplorer/buildprogress_mac.h @@ -0,0 +1,41 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#ifndef BUILDPROGRESS_MAC_H +#define BUILDPROGRESS_MAC_H + +#include <QtCore/QString> + +namespace ProjectExplorer { + namespace Internal { + void qtcShowDockTileBadgeLabel(const QString &text); + } +} + +#endif diff --git a/src/plugins/projectexplorer/buildprogress_mac.mm b/src/plugins/projectexplorer/buildprogress_mac.mm new file mode 100644 index 0000000000000000000000000000000000000000..049c06bcdef21005634b30750116d0aa9c59c3bc --- /dev/null +++ b/src/plugins/projectexplorer/buildprogress_mac.mm @@ -0,0 +1,47 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#include "buildprogress_mac.h" + +#include <AppKit/NSDockTile.h> +#include <AppKit/NSApplication.h> +#include <Foundation/NSString.h> + + +void ProjectExplorer::Internal::qtcShowDockTileBadgeLabel(const QString &text) +{ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + const char *utf8String = text.toUtf8().constData(); + NSString *cocoaString = [[NSString alloc] initWithUTF8String:utf8String]; + [[NSApp dockTile] setBadgeLabel:cocoaString]; + [cocoaString release]; +#else + Q_UNUSED(text) +#endif +} diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 54a631e837d5022bc42b65538817739a277e0d59..fbc3219b14fe3a825e1999ae1b20d5c7c8c669e0 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -135,9 +135,14 @@ win32 { HEADERS += winguiprocess.h } else:unix:SOURCES += applicationlauncher_x11.cpp + +macx { + HEADERS += buildprogress_mac.h + OBJECTIVE_SOURCES += buildprogress_mac.mm + LIBS += -framework Carbon -framework AppKit +} + RESOURCES += projectexplorer.qrc DEFINES += PROJECTEXPLORER_LIBRARY OTHER_FILES += ProjectExplorer.pluginspec -mac:LIBS += -framework Carbon -