diff options
Diffstat (limited to 'Slimber')
-rw-r--r-- | Slimber/Cocoa/CocoaController.h | 5 | ||||
-rw-r--r-- | Slimber/Cocoa/CocoaController.mm | 5 | ||||
-rw-r--r-- | Slimber/Cocoa/CocoaMenulet.mm | 8 | ||||
-rw-r--r-- | Slimber/UnitTest/MenuletControllerTest.cpp | 12 |
4 files changed, 18 insertions, 12 deletions
diff --git a/Slimber/Cocoa/CocoaController.h b/Slimber/Cocoa/CocoaController.h index 24070c6..c8287b7 100644 --- a/Slimber/Cocoa/CocoaController.h +++ b/Slimber/Cocoa/CocoaController.h @@ -11,9 +11,6 @@ class MainController; class CocoaMenulet; -@interface CocoaController : NSObject { - CocoaMenulet* menulet; - MainController* main; -} +@interface CocoaController : NSObject @end diff --git a/Slimber/Cocoa/CocoaController.mm b/Slimber/Cocoa/CocoaController.mm index a0c4ef4..2ee350d 100644 --- a/Slimber/Cocoa/CocoaController.mm +++ b/Slimber/Cocoa/CocoaController.mm @@ -4,7 +4,10 @@ #include "Slimber/Cocoa/CocoaMenulet.h" #include "Slimber/Cocoa/main.h" -@implementation CocoaController +@implementation CocoaController { + CocoaMenulet* menulet; + MainController* main; +} - (void) dealloc { delete main; diff --git a/Slimber/Cocoa/CocoaMenulet.mm b/Slimber/Cocoa/CocoaMenulet.mm index de9e9e9..c739fb4 100644 --- a/Slimber/Cocoa/CocoaMenulet.mm +++ b/Slimber/Cocoa/CocoaMenulet.mm @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2012-2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + #include "Slimber/Cocoa/CocoaMenulet.h" #pragma GCC diagnostic ignored "-Wold-style-cast" @@ -45,7 +51,7 @@ void CocoaMenulet::addItem(const std::string& name, const std::string& icon) { NSString* path = [[NSBundle mainBundle] pathForResource: [NSString stringWithUTF8String: icon.c_str()] ofType:@"png"]; NSImage* image = [[NSImage alloc] initWithContentsOfFile: path]; - [item setImage: [[NSImage alloc] initWithContentsOfFile: path]]; + [item setImage: image]; [image release]; } [menu addItem: item]; diff --git a/Slimber/UnitTest/MenuletControllerTest.cpp b/Slimber/UnitTest/MenuletControllerTest.cpp index 092a886..b18a37f 100644 --- a/Slimber/UnitTest/MenuletControllerTest.cpp +++ b/Slimber/UnitTest/MenuletControllerTest.cpp @@ -33,7 +33,7 @@ class MenuletControllerTest : public CppUnit::TestFixture { MenuletController testling(menulet); CPPUNIT_ASSERT_EQUAL(8, static_cast<int>(menulet->items.size())); - int i = 0; + size_t i = 0; CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("[Offline] "), menulet->items[i++]); @@ -50,7 +50,7 @@ class MenuletControllerTest : public CppUnit::TestFixture { testling.setXMPPStatus("You are connected", MenuletController::Online); CPPUNIT_ASSERT_EQUAL(8, static_cast<int>(menulet->items.size())); - int i = 0; + size_t i = 0; CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("[Online] You are connected"), menulet->items[i++]); @@ -66,7 +66,7 @@ class MenuletControllerTest : public CppUnit::TestFixture { testling.setXMPPStatus("You are connected", MenuletController::Online); - int i = 0; + size_t i = 0; CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("[Online] You are connected"), menulet->items[i++]); @@ -78,7 +78,7 @@ class MenuletControllerTest : public CppUnit::TestFixture { testling.setXMPPStatus("You are not connected", MenuletController::Offline); - int i = 0; + size_t i = 0; CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("[Offline] You are not connected"), menulet->items[i++]); @@ -92,7 +92,7 @@ class MenuletControllerTest : public CppUnit::TestFixture { users.push_back("The Mad Hatter"); testling.setUserNames(users); - int i = 0; + size_t i = 0; CPPUNIT_ASSERT_EQUAL(std::string("Online users:"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string(" Alice In Wonderland"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string(" The Mad Hatter"), menulet->items[i++]); @@ -105,7 +105,7 @@ class MenuletControllerTest : public CppUnit::TestFixture { std::vector<std::string> users; testling.setUserNames(users); - int i = 0; + size_t i = 0; CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); } |