| 1 | /* |
|---|
| 2 | * QEMU Cocoa Control Controller |
|---|
| 3 | * |
|---|
| 4 | * Copyright (c) 2005 - 2007 Mike Kronenberg |
|---|
| 5 | * |
|---|
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 7 | * of this software and associated documentation files (the "Software"), to deal |
|---|
| 8 | * in the Software without restriction, including without limitation the rights |
|---|
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 10 | * copies of the Software, and to permit persons to whom the Software is |
|---|
| 11 | * furnished to do so, subject to the following conditions: |
|---|
| 12 | * |
|---|
| 13 | * The above copyright notice and this permission notice shall be included in |
|---|
| 14 | * all copies or substantial portions of the Software. |
|---|
| 15 | * |
|---|
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|---|
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 22 | * THE SOFTWARE. |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | #import <Cocoa/Cocoa.h> |
|---|
| 26 | |
|---|
| 27 | #import "cocoaControlDOServer.h" |
|---|
| 28 | #import "cocoaControlEditPC.h" |
|---|
| 29 | #import "cocoaControlPreferences.h" |
|---|
| 30 | #import "cocoaDownloadController.h" |
|---|
| 31 | #import "QControlTableView.h" |
|---|
| 32 | |
|---|
| 33 | #define FILE_TYPES [NSArray arrayWithObjects:@"qcow2", @"qcow", @"raw", @"cow", @"vmdk", @"cloop", @"img", @"iso", @"dsk", @"dmg", @"cdr", @"toast", @"flp", @"fs", nil] |
|---|
| 34 | |
|---|
| 35 | @interface cocoaControlController : NSObject |
|---|
| 36 | { |
|---|
| 37 | /* preferences */ |
|---|
| 38 | NSUserDefaults *userDefaults; |
|---|
| 39 | |
|---|
| 40 | /* distributed object server */ |
|---|
| 41 | cocoaControlDOServer *qdoserver; |
|---|
| 42 | |
|---|
| 43 | /* mainMenu */ |
|---|
| 44 | IBOutlet id windowMenu; |
|---|
| 45 | |
|---|
| 46 | /* controlWindow */ |
|---|
| 47 | NSMutableArray *pcs; |
|---|
| 48 | NSMutableArray *pcsImages; |
|---|
| 49 | NSMutableArray *pcsWindows; |
|---|
| 50 | NSDictionary *cpuTypes; |
|---|
| 51 | NSMutableDictionary *pcsTasks; |
|---|
| 52 | NSMutableDictionary *pcsPIDs; |
|---|
| 53 | NSString *dataPath; |
|---|
| 54 | IBOutlet id mainWindow; |
|---|
| 55 | IBOutlet QControlTableView *table; |
|---|
| 56 | |
|---|
| 57 | NSTimer *timer; //to update Table Thumbnails |
|---|
| 58 | |
|---|
| 59 | /* progressPanel */ |
|---|
| 60 | IBOutlet id progressPanel; |
|---|
| 61 | IBOutlet NSProgressIndicator *progressIndicator; |
|---|
| 62 | IBOutlet NSTextField *progressTitle; |
|---|
| 63 | IBOutlet NSTextField *progressText; |
|---|
| 64 | IBOutlet NSTextField *progressStatusText; |
|---|
| 65 | |
|---|
| 66 | /* editPCPanel */ |
|---|
| 67 | cocoaControlEditPC *editPC; |
|---|
| 68 | |
|---|
| 69 | /* preferences */ |
|---|
| 70 | cocoaControlPreferences *preferences; |
|---|
| 71 | |
|---|
| 72 | /* FreeOSDownloader */ |
|---|
| 73 | cocoaDownloadController *downloader; |
|---|
| 74 | |
|---|
| 75 | /* newImage */ |
|---|
| 76 | |
|---|
| 77 | } |
|---|
| 78 | /* init & dealloc */ |
|---|
| 79 | - (id) init; |
|---|
| 80 | |
|---|
| 81 | /* mainMenu */ |
|---|
| 82 | - (IBAction)showPreferences:(id)sender; |
|---|
| 83 | |
|---|
| 84 | /* getter & setter */ |
|---|
| 85 | - (id)pcs; |
|---|
| 86 | - (id)pcsTasks; |
|---|
| 87 | |
|---|
| 88 | /* controlWindow */ |
|---|
| 89 | - (id) mainWindow; |
|---|
| 90 | - (IBAction) cycleWindows:(id)sender; |
|---|
| 91 | - (IBAction) cycleWindowsBack:(id)sender; |
|---|
| 92 | - (IBAction) activateApp:(id)sender; |
|---|
| 93 | - (void) loadConfigurations; |
|---|
| 94 | - (void) savePCConfiguration:(id)thisPC; |
|---|
| 95 | - (void) updateThumbnails; |
|---|
| 96 | - (IBAction) addPC:(id)sender; |
|---|
| 97 | - (void) addPCFromDragDrop:(NSString *)path; |
|---|
| 98 | - (IBAction) addPCFromAssistant:(NSMutableDictionary *)thisPC; |
|---|
| 99 | - (void) deleteThisPC:(id)pc; |
|---|
| 100 | - (IBAction) deletePC:(id)sender; |
|---|
| 101 | - (void) editThisPC:(id)pc; |
|---|
| 102 | - (IBAction) editPC:(id)sender; |
|---|
| 103 | - (BOOL) importFreeOSZooPC:(NSString *)name withPath:(NSString *)path; |
|---|
| 104 | - (IBAction) importVPC7PC:(id)sender; |
|---|
| 105 | - (IBAction) importQemuXPCs:(id)sender; |
|---|
| 106 | - (void) updatePC:(id)thisPC; |
|---|
| 107 | - (void) updatePCAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(id)contextInfo; |
|---|
| 108 | - (IBAction) updateThisPC:(id)sender; |
|---|
| 109 | - (void) exportPCToFlashDrive:(id)pc; |
|---|
| 110 | - (IBAction) exportThisPCToFlashDrive:(id)sender; |
|---|
| 111 | - (void) importPCFromFlashDrive:(NSString *)filename; |
|---|
| 112 | - (IBAction) importThisPCFromFlashDrive:(id)sender; |
|---|
| 113 | - (void) startThisPC:(id)pc; |
|---|
| 114 | - (void) startPC:(NSString *)filename; |
|---|
| 115 | - (void) tableDoubleClick:(id)sender; |
|---|
| 116 | - (void) pauseThisPC:(id)pc; |
|---|
| 117 | - (void) playThisPC:(id)pc; |
|---|
| 118 | - (void) stopThisPC:(id)pc; |
|---|
| 119 | |
|---|
| 120 | /* editPCPanel */ |
|---|
| 121 | -(BOOL) checkPC:(id)thisPC name:(NSString *)name create:(BOOL)create; |
|---|
| 122 | |
|---|
| 123 | /* dIWindow */ |
|---|
| 124 | - (IBAction) openDIWindow:(id)sender; |
|---|
| 125 | |
|---|
| 126 | /* freeOSDownloader */ |
|---|
| 127 | - (IBAction)openFreeOSDownloader:(id)sender; |
|---|
| 128 | |
|---|
| 129 | /* standardAlert */ |
|---|
| 130 | - (void)standardAlert:(NSString *)messageText informativeText:(NSString *)informativeText; |
|---|
| 131 | |
|---|
| 132 | /* check for update */ |
|---|
| 133 | - (void)getLatestVersion; |
|---|
| 134 | - (void)updateAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo; |
|---|
| 135 | @end |
|---|