diff options
Diffstat (limited to 'SwifTools/Dock')
-rw-r--r-- | SwifTools/Dock/Dock.cpp | 6 | ||||
-rw-r--r-- | SwifTools/Dock/Dock.h | 20 | ||||
-rw-r--r-- | SwifTools/Dock/MacOSXDock.h | 20 | ||||
-rw-r--r-- | SwifTools/Dock/MacOSXDock.mm | 22 | ||||
-rw-r--r-- | SwifTools/Dock/NullDock.h | 20 | ||||
-rw-r--r-- | SwifTools/Dock/SConscript | 10 | ||||
-rw-r--r-- | SwifTools/Dock/WindowsDock.h | 61 |
7 files changed, 84 insertions, 75 deletions
diff --git a/SwifTools/Dock/Dock.cpp b/SwifTools/Dock/Dock.cpp index e159b8d..91e2ca3 100644 --- a/SwifTools/Dock/Dock.cpp +++ b/SwifTools/Dock/Dock.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2010 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. */ #include <SwifTools/Dock/Dock.h> diff --git a/SwifTools/Dock/Dock.h b/SwifTools/Dock/Dock.h index 1bd96fb..362aabc 100644 --- a/SwifTools/Dock/Dock.h +++ b/SwifTools/Dock/Dock.h @@ -1,18 +1,20 @@ /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2010-2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. */ #pragma once +#include <cstddef> + namespace Swift { - - class Dock { - public: - virtual ~Dock(); - virtual void setNumberOfPendingMessages(int i) = 0; - }; + class Dock { + public: + virtual ~Dock(); + + virtual void setNumberOfPendingMessages(size_t i) = 0; + }; } diff --git a/SwifTools/Dock/MacOSXDock.h b/SwifTools/Dock/MacOSXDock.h index df2686f..ef85a88 100644 --- a/SwifTools/Dock/MacOSXDock.h +++ b/SwifTools/Dock/MacOSXDock.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2010-2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. */ #pragma once @@ -9,13 +9,13 @@ #include <SwifTools/Dock/Dock.h> namespace Swift { - - class CocoaApplication; - class MacOSXDock : public Dock { - public: - MacOSXDock(CocoaApplication* application); + class CocoaApplication; - virtual void setNumberOfPendingMessages(int i); - }; + class MacOSXDock : public Dock { + public: + MacOSXDock(CocoaApplication* application); + + virtual void setNumberOfPendingMessages(size_t i); + }; } diff --git a/SwifTools/Dock/MacOSXDock.mm b/SwifTools/Dock/MacOSXDock.mm index 3164998..3935ac0 100644 --- a/SwifTools/Dock/MacOSXDock.mm +++ b/SwifTools/Dock/MacOSXDock.mm @@ -1,11 +1,15 @@ -// Fix Boost-Cocoa conflict -#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +/* + * Copyright (c) 2015-2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ #include <SwifTools/Dock/MacOSXDock.h> +#include <boost/lexical_cast.hpp> + #include <AppKit/AppKit.h> #include <Cocoa/Cocoa.h> -#include <boost/lexical_cast.hpp> #include <Swiften/Base/String.h> @@ -14,12 +18,12 @@ namespace Swift { MacOSXDock::MacOSXDock(CocoaApplication*) { } -void MacOSXDock::setNumberOfPendingMessages(int i) { - std::string label(i > 0 ? boost::lexical_cast<std::string>(i) : ""); - NSString *labelString = [[NSString alloc] initWithUTF8String: label.c_str()]; - [[NSApp dockTile] setBadgeLabel: labelString]; - [labelString release]; - [NSApp requestUserAttention: NSInformationalRequest]; +void MacOSXDock::setNumberOfPendingMessages(size_t i) { + std::string label(i > 0 ? boost::lexical_cast<std::string>(i) : ""); + NSString *labelString = [[NSString alloc] initWithUTF8String: label.c_str()]; + [[NSApp dockTile] setBadgeLabel: labelString]; + [labelString release]; + [NSApp requestUserAttention: NSInformationalRequest]; } } diff --git a/SwifTools/Dock/NullDock.h b/SwifTools/Dock/NullDock.h index b015770..137ba03 100644 --- a/SwifTools/Dock/NullDock.h +++ b/SwifTools/Dock/NullDock.h @@ -1,19 +1,21 @@ /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2010-2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. */ #pragma once +#include <cstddef> + #include <SwifTools/Dock/Dock.h> namespace Swift { - class NullDock : public Dock { - public: - NullDock() {} + class NullDock : public Dock { + public: + NullDock() {} - virtual void setNumberOfPendingMessages(int) { - } - }; + virtual void setNumberOfPendingMessages(size_t) { + } + }; } diff --git a/SwifTools/Dock/SConscript b/SwifTools/Dock/SConscript index 94797cb..3dbcf60 100644 --- a/SwifTools/Dock/SConscript +++ b/SwifTools/Dock/SConscript @@ -1,13 +1,13 @@ Import("swiftools_env") sources = [ - "Dock.cpp", - ] + "Dock.cpp", + ] if swiftools_env["PLATFORM"] == "darwin" and swiftools_env["target"] == "native" : - sources += [ - "MacOSXDock.mm", - ] + sources += [ + "MacOSXDock.mm", + ] objects = swiftools_env.StaticObject(sources) swiftools_env.Append(SWIFTOOLS_OBJECTS = objects) diff --git a/SwifTools/Dock/WindowsDock.h b/SwifTools/Dock/WindowsDock.h index 0254617..f9a9dae 100644 --- a/SwifTools/Dock/WindowsDock.h +++ b/SwifTools/Dock/WindowsDock.h @@ -1,42 +1,43 @@ /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2010-2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. */ #pragma once -#include <QSystemTrayIcon> #include <boost/lexical_cast.hpp> +#include <QSystemTrayIcon> + #include <SwifTools/Dock/Dock.h> #include <SwifTools/Notifier/Notifier.h> namespace Swift { - class WindowsDock : public Dock { - public: - WindowsDock(QSystemTrayIcon* tray, Notifier* notifier) : tray(tray), notifier(notifier) {} - - virtual void setNumberOfPendingMessages(int i) { - if (notifier->isAvailable()) { - return; - } - - if (i > 0) { - std::string message = boost::lexical_cast<std::string>(i) + " new message"; - if (i > 1) { - message += "s"; - } - message += " received."; - tray->showMessage("New messages", message.c_str(), QSystemTrayIcon::NoIcon); - } - else { - tray->showMessage("", "", QSystemTrayIcon::NoIcon, 0); - } - } - - private: - QSystemTrayIcon* tray; - Notifier* notifier; - }; + class WindowsDock : public Dock { + public: + WindowsDock(QSystemTrayIcon* tray, Notifier* notifier) : tray(tray), notifier(notifier) {} + + virtual void setNumberOfPendingMessages(size_t i) { + if (notifier->isAvailable()) { + return; + } + + if (i > 0) { + std::string message = boost::lexical_cast<std::string>(i) + " new message"; + if (i > 1) { + message += "s"; + } + message += " received."; + tray->showMessage("New messages", message.c_str(), QSystemTrayIcon::NoIcon); + } + else { + tray->showMessage("", "", QSystemTrayIcon::NoIcon, 0); + } + } + + private: + QSystemTrayIcon* tray; + Notifier* notifier; + }; } |