Added a log window to show the mp4v2 log messages.

This commit is contained in:
Damiano Galassi committed 2014-10-24 09:07:58 +02:00
1 parent 28c89d2da7
commit 84ad50a434
7 files changed
+178 -4

No files matched your search

+2
View File
@@ -9,6 +9,7 @@
#import <Cocoa/Cocoa.h>
@class SBPrefsController;
@class SBDebugLogController;
@interface SBDocumentController : NSDocumentController
@@ -16,6 +17,7 @@
@interface SBAppDelegate : NSObject {
SBPrefsController *prefController;
SBDebugLogController *debugLogController;
SBDocumentController *documentController;
}
+14
View File
@@ -11,6 +11,9 @@
#import "SBPresetManager.h"
#import "SBQueueController.h"
#import "SBPrefsController.h"
#import "SBDebugLogController.h"
#import <MP42Foundation/MP42File.h>
#define DONATE_NAG_TIME (60 * 60 * 24 * 7)
@@ -22,6 +25,12 @@
[SBPrefsController registerUserDefaults];
debugLogController = [[SBDebugLogController alloc] init];
[MP42File redirectLogUsingBlock:^(NSString *text) {
[debugLogController log:text];
}];
if ([[NSUserDefaults standardUserDefaults] valueForKey:@"SBShowQueueWindow"])
[[SBQueueController sharedManager] showWindow:self];
}
@@ -127,6 +136,11 @@
[prefController showWindow:self];
}
- (IBAction) showDebugLog:(id)sender
{
[debugLogController showWindow:self];
}
- (IBAction) donate:(id)sender
{
[self linkDonate:sender];
+17
View File
@@ -0,0 +1,17 @@
//
// SBDebugLogController.h
// Subler
//
// Created by Damiano Galassi on 24/10/14.
//
//
#import <Cocoa/Cocoa.h>
@interface SBDebugLogController : NSWindowController {
NSTextView *logView;
}
- (void)log:(NSString *)string;
@end
+44
View File
@@ -0,0 +1,44 @@
//
// SBDebugLogController.m
// Subler
//
// Created by Damiano Galassi on 24/10/14.
//
//
#import "SBDebugLogController.h"
@interface SBDebugLogController ()
@property (assign) IBOutlet NSTextView *logView;
@end
@implementation SBDebugLogController
@synthesize logView;
- (instancetype)init
{
if ((self = [super initWithWindowNibName:@"SBDebugLogWindow"])) {
[self window];
}
return self;
}
- (void)windowDidLoad {
[super windowDidLoad];
}
- (void)log:(NSString *)string {
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string];
[[self.logView textStorage] appendAttributedString:attributedString];
[attributedString release];
}
- (IBAction)clearLog:(id)sender {
[[self.logView textStorage] deleteCharactersInRange:NSMakeRange(0, [[self.logView textStorage] length])];
}
@end