Skip to content
This repository has been archived by the owner on Oct 4, 2018. It is now read-only.

Commit

Permalink
to use a twitter like UI. (working in progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashchan committed Mar 11, 2012
1 parent 7321f25 commit e6e0ff0
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 12 deletions.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -12,6 +12,7 @@ task :install do
[
["https://github.com/kgn/DBPrefsWindowController.git", "master"],
["https://github.com/RestKit/RestKit.git", "development"],
["https://github.com/erndev/EDSidebar.git", "master"]
].each do |lib|
`git clone #{lib[0]} -b #{lib[1]} --recursive`
end
Expand Down
14 changes: 14 additions & 0 deletions RubyChinaReader.xcodeproj/project.pbxproj
Expand Up @@ -37,6 +37,7 @@
1AB3322115037734000D9DEA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AB3322015037734000D9DEA /* QuartzCore.framework */; };
1AB3323315039034000D9DEA /* RestKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6AB5411502037C00CC0516 /* RestKit.framework */; };
1AB3323A150393C8000D9DEA /* RestKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1A6AB5411502037C00CC0516 /* RestKit.framework */; };
1ADBFE43150CC7520092B1E2 /* EDSideBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ADBFE42150CC7520092B1E2 /* EDSideBar.m */; };
1AFC258014FCDF1100443426 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AFC257F14FCDF1100443426 /* Cocoa.framework */; };
1AFC258A14FCDF1100443426 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1AFC258814FCDF1100443426 /* InfoPlist.strings */; };
1AFC258C14FCDF1100443426 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AFC258B14FCDF1100443426 /* main.m */; };
Expand Down Expand Up @@ -151,6 +152,8 @@
1A9488251506EBE2004B83CA /* RCRUserDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCRUserDetailViewController.m; sourceTree = "<group>"; };
1A9488261506EBE2004B83CA /* RCRUserDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RCRUserDetailViewController.xib; sourceTree = "<group>"; };
1AB3322015037734000D9DEA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
1ADBFE41150CC7520092B1E2 /* EDSideBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EDSideBar.h; path = SharedLib/EDSidebar/EDSideBar/EDSideBar.h; sourceTree = SOURCE_ROOT; };
1ADBFE42150CC7520092B1E2 /* EDSideBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDSideBar.m; path = SharedLib/EDSidebar/EDSideBar/EDSideBar.m; sourceTree = SOURCE_ROOT; };
1AFC257B14FCDF1100443426 /* RubyChinaReader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RubyChinaReader.app; sourceTree = BUILT_PRODUCTS_DIR; };
1AFC257F14FCDF1100443426 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
1AFC258214FCDF1100443426 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -249,6 +252,7 @@
1A6EC9AE14FD0BE700A91FEF /* SharedLib */ = {
isa = PBXGroup;
children = (
1ADBFE40150CC73C0092B1E2 /* EDSidebar */,
1A6AB5321502037C00CC0516 /* RestKit.xcodeproj */,
1A6ECA3F14FD0C3300A91FEF /* DBPrefsWindowController */,
);
Expand Down Expand Up @@ -314,6 +318,15 @@
name = Resources;
sourceTree = "<group>";
};
1ADBFE40150CC73C0092B1E2 /* EDSidebar */ = {
isa = PBXGroup;
children = (
1ADBFE41150CC7520092B1E2 /* EDSideBar.h */,
1ADBFE42150CC7520092B1E2 /* EDSideBar.m */,
);
name = EDSidebar;
sourceTree = "<group>";
};
1AFC257014FCDF1100443426 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -573,6 +586,7 @@
9612CE5A1507806700380187 /* NSDate+TimeAgo.m in Sources */,
1A6546B1150789F40030C113 /* RCRTopicDetailController.m in Sources */,
1A29596A15079D2700D397E5 /* RCRUrlBuilder.m in Sources */,
1ADBFE43150CC7520092B1E2 /* EDSideBar.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
5 changes: 4 additions & 1 deletion RubyChinaReader/RCRAppDelegate.h
Expand Up @@ -7,8 +7,11 @@
//

#import <Cocoa/Cocoa.h>
#import "EDSideBar.h"

@interface RCRAppDelegate : NSObject <NSApplicationDelegate>
@interface RCRAppDelegate : NSObject <NSApplicationDelegate, EDSideBarDelegate>

@property (assign) IBOutlet NSWindow *window;

- (IBAction)aboutClicked:(id)sender;
- (IBAction)preferencesClicked:(id)sender;
Expand Down
41 changes: 39 additions & 2 deletions RubyChinaReader/RCRAppDelegate.m
Expand Up @@ -11,23 +11,55 @@
#import "RCRAppController.h"
#import "RCRUser.h"
#import "RCRTopic.h"
#import "RCRTopicsViewController.h"
#import "RCRAccountViewController.h"
#import "RCROptionsViewController.h"
#import "RCRInfoViewController.h"

/*#ifdef DEBUG
static NSString * API_ENDPOINT = @"http://localhost:3000";
#else*/
static NSString * API_ENDPOINT = @"http://ruby-china.org";
//#endif

@interface RCRAppDelegate ()
@interface RCRAppDelegate () {
RCRTopicsViewController *topicsViewController;
RCRAccountViewController *accountViewController;
RCROptionsViewController *optionsViewController;
RCRInfoViewController *infoViewController;
IBOutlet NSView *contentSubview;
IBOutlet EDSideBar *sideBar;
}

- (void)mapObjects;
@end

@implementation RCRAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[self mapObjects];
[[RCRAppController sharedPrefsWindowController] showWindow:nil];

sideBar.sidebarDelegate = self;

topicsViewController = [[RCRTopicsViewController alloc] init];
[contentSubview addSubview:topicsViewController.view];
[topicsViewController start];
}

- (void)awakeFromNib {
[sideBar setTranslatesAutoresizingMaskIntoConstraints:NO];
NSDictionary *views = NSDictionaryOfVariableBindings(sideBar);
[window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[sideBar(==65)]-(>=0)-|" options:0 metrics:nil views:views]];
[window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[sideBar]-0-|" options:0 metrics:nil views:views]];

views = NSDictionaryOfVariableBindings(contentSubview);
[window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(==65)-[contentSubview]-(0)-|" options:0 metrics:nil views:views]];
[window.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[contentSubview]-0-|" options:0 metrics:nil views:views]];

[super awakeFromNib];
}

#pragma mark - Actions
Expand All @@ -44,6 +76,11 @@ - (IBAction)showMainWindow:(id)sender {
[(RCRAppController *)[RCRAppController sharedPrefsWindowController] showMainWindow];
}

#pragma mark - EDSlidebarDelegate

- (void)sideBar:(EDSideBar*)tabBar didSelectButton:(NSInteger)index {
}

#pragma mark - Private Methods

- (void)mapObjects {
Expand Down
1 change: 1 addition & 0 deletions RubyChinaReader/RCRTopicsViewController.m
Expand Up @@ -45,6 +45,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
_userPopover.behavior = NSPopoverBehaviorApplicationDefined;
_userDetailViewController = [[RCRUserDetailViewController alloc] init];
_userPopover.contentViewController = _userDetailViewController;
[self.view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
}

return self;
Expand Down
5 changes: 4 additions & 1 deletion RubyChinaReader/RCRTopicsViewController.xib
Expand Up @@ -188,7 +188,6 @@
<string key="NSFrame">{{1, 119}, {223, 15}}</string>
<reference key="NSSuperview" ref="515144670"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:60</string>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="515144670"/>
Expand Down Expand Up @@ -1716,6 +1715,10 @@
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1070" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<real value="4300" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
Expand Down
2 changes: 1 addition & 1 deletion RubyChinaReader/RubyChinaReader-Info.plist
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>8</string>
<string>9</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>LSHasLocalizedDisplayName</key>
Expand Down
144 changes: 137 additions & 7 deletions RubyChinaReader/en.lproj/MainMenu.xib
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11D50</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
Expand All @@ -11,6 +11,9 @@
<string key="NS.object.0">2182</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSCustomView</string>
<string>NSWindowTemplate</string>
<string>NSView</string>
<string>NSMenu</string>
<string>NSMenuItem</string>
<string>NSCustomObject</string>
Expand Down Expand Up @@ -711,6 +714,53 @@
<object class="NSCustomObject" id="60892837">
<string key="NSClassName">SUUpdater</string>
</object>
<object class="NSWindowTemplate" id="30747921">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{96, 286}, {465, 592}}</string>
<int key="NSWTFlags">611845120</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{600, 700}</string>
<string key="NSWindowContentMinSize">{465, 400}</string>
<object class="NSView" key="NSWindowView" id="621198104">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSCustomView" id="190576477">
<reference key="NSNextResponder" ref="621198104"/>
<int key="NSvFlags">268</int>
<string key="NSFrameSize">{77, 592}</string>
<reference key="NSSuperview" ref="621198104"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="502981782"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSClassName">EDSideBar</string>
</object>
<object class="NSCustomView" id="502981782">
<reference key="NSNextResponder" ref="621198104"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{74, 0}, {391, 592}}</string>
<reference key="NSSuperview" ref="621198104"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSClassName">NSView</string>
</object>
</array>
<string key="NSFrameSize">{465, 592}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="190576477"/>
<string key="NSReuseIdentifierKey">_NS:20</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{465, 422}</string>
<string key="NSMaxSize">{600, 722}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
Expand Down Expand Up @@ -1066,6 +1116,30 @@
</object>
<int key="connectionID">542</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="30747921"/>
</object>
<int key="connectionID">546</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">contentSubview</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="502981782"/>
</object>
<int key="connectionID">563</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">sideBar</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="190576477"/>
</object>
<int key="connectionID">564</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">checkForUpdates:</string>
Expand Down Expand Up @@ -1615,6 +1689,35 @@
<reference key="object" ref="38304336"/>
<reference key="parent" ref="835318025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">544</int>
<reference key="object" ref="30747921"/>
<array class="NSMutableArray" key="children">
<reference ref="621198104"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">545</int>
<reference key="object" ref="621198104"/>
<array class="NSMutableArray" key="children">
<reference ref="190576477"/>
<reference ref="502981782"/>
</array>
<reference key="parent" ref="30747921"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">547</int>
<reference key="object" ref="190576477"/>
<reference key="parent" ref="621198104"/>
<string key="objectName">SideBar</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">555</int>
<reference key="object" ref="502981782"/>
<reference key="parent" ref="621198104"/>
<string key="objectName">Content View</string>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
Expand Down Expand Up @@ -1695,6 +1798,11 @@
<string key="539.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="541.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="543.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="544.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES" key="544.NSWindowTemplate.visibleAtLaunch"/>
<string key="545.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="547.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="555.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
Expand All @@ -1705,10 +1813,18 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">543</int>
<int key="maxID">564</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">EDSideBar</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/EDSideBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">RCRAppDelegate</string>
<string key="superclassName">NSObject</string>
Expand All @@ -1731,6 +1847,25 @@
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="contentSubview">NSView</string>
<string key="sideBar">EDSideBar</string>
<string key="window">NSWindow</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="contentSubview">
<string key="name">contentSubview</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="sideBar">
<string key="name">sideBar</string>
<string key="candidateClassName">EDSideBar</string>
</object>
<object class="IBToOneOutletInfo" key="window">
<string key="name">window</string>
<string key="candidateClassName">NSWindow</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/RCRAppDelegate.h</string>
Expand Down Expand Up @@ -1770,16 +1905,11 @@
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1060" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NSMenuCheckmark">{11, 11}</string>
<string key="NSMenuMixedState">{10, 3}</string>
</dictionary>
<bool key="IBDocument.UseAutolayout">YES</bool>
</data>
</archive>

0 comments on commit e6e0ff0

Please sign in to comment.