Added simple settings

This commit is contained in:
michael starke
2012-07-23 00:54:44 +02:00
parent 957b91cceb
commit 588f0c75c0
12 changed files with 914 additions and 28 deletions

View File

@@ -11,16 +11,19 @@
#import "MPDatabaseDocument.h"
#import "MPOutlineDataSource.h"
#import "MPOutlineViewDelegate.h"
#import "MPSettingsController.h"
NSString *const kColumnIdentifier = @"OutlineColumn";
NSString *const kOutlineViewIdentifier = @"OutlineView";
@interface MPAppDelegate ()
@property (assign) IBOutlet NSOutlineView *outlineView;
@property (retain) MPSettingsController *settingsController;
@property (retain) MPOutlineDataSource *datasource;
@property (retain) MPOutlineViewDelegate *outlineDelegate;
@property (retain) MPDatabaseDocument *database;
- (void)updateData;
- (IBAction)showPreferences:(id)sender;
@end
@implementation MPAppDelegate
@@ -30,6 +33,7 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
@synthesize database = _database;
@synthesize outlineDelegate = _outlineDelegate;
@synthesize datasource = _datasource;
@synthesize settingsController = _settingsController;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
@@ -37,8 +41,7 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
_datasource = [[MPOutlineDataSource alloc] init];
[[_outlineView outlineTableColumn] setIdentifier:kColumnIdentifier];
[_outlineView setDelegate:_outlineDelegate];
[_outlineView setDataSource:_datasource];
[_outlineView setDataSource:_datasource];
// register for sucessfull document loads
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateData) name:MPDidLoadDataBaseNotification object:_database];
}
@@ -47,4 +50,13 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
[_outlineView reloadData];
}
#pragma mark IBActions
- (void)showPreferences:(id)sender {
if(_settingsController == nil) {
_settingsController = [[MPSettingsController alloc] init];
}
[_settingsController showWindow:_settingsController.window];
}
@end