Changeset 329 for trunk/Cocoa/AntiRSI


Ignore:
Timestamp:
08/05/07 00:15:30 (17 years ago)
Author:
Nicholas Riley
Message:

AntiRSI changes for "something" called 1.4, with much of the code but not the same UI as Onne Gorter's released 1.4.

Info.plist, English.lproj/InfoPlist.strings: Updated for 1.4.

AntiRSI.[hm]: Some of Onne Gorter's changes, update checking, "go to Web site" and crediting idle time to work break, and "AntiRSI Help". Most of these are not hooked up in the UI as above. Default to smooth sampling.

AntiRSI.xcodeproj: Build fat (i386/ppc).

English.lproj/MainMenu.nib: Some changes...

Location:
trunk/Cocoa/AntiRSI
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/AntiRSI/AntiRSI.h

    r327 r329  
    2222#import "AntiRSIView.h"
    2323
     24#define sLatestVersionURL @"http://tech.inhelsinki.nl/antirsi/antirsi_version.txt"
     25#define sURL @"http://tech.inhelsinki.nl/antirsi/"
     26#define sVersion @"1.4"
     27
    2428typedef enum _AntiRSIState {
    2529        s_normal = 0,
     
    3741        IBOutlet NSTextField *next_break;
    3842    IBOutlet NSTextField *status;
     43        IBOutlet NSTextField *version;
    3944   
    4045        // dock icon image
     
    5358        double micro_pause_taking_t;
    5459        double work_break_taking_t;
     60        double work_break_taking_cached_t;
     61        double work_break_taking_cached_date;
    5562        double date;
    5663               
     
    9299- (void)setBackground:(NSColor *)c;
    93100
     101// goto website button
     102- (IBAction)gotoWebsite:(id)sender;
     103
     104// check updates
     105- (IBAction)checkForUpdate:(id)sender;
    94106
    95107// postpone button
  • trunk/Cocoa/AntiRSI/AntiRSI.m

    r328 r329  
    139139        micro_pause_taking_t = 0;
    140140        work_break_taking_t = 0;
     141        work_break_taking_cached_t = 0;
     142        work_break_taking_cached_date = 0;
    141143       
    142144        // initialize dock image
     
    177179        [initial setObject:[NSNumber numberWithFloat:50] forKey:@"work_break_period"];
    178180        [initial setObject:[NSNumber numberWithFloat:8] forKey:@"work_break_duration"];
    179         [initial setObject:@"Normal" forKey:@"sample_interval"];
     181        [initial setObject:@"Smooth" forKey:@"sample_interval"];
    180182        [initial setObject:[NSNumber numberWithBool:YES] forKey:@"draw_dock_image"];
    181183        [initial setObject:[NSNumber numberWithBool:NO] forKey:@"lock_focus"];
     
    204206        // start the timer
    205207        [self installTimer:sample_interval];
     208       
     209        // about dialog
     210        [version setStringValue:[NSString stringWithFormat:@"Version %@", sVersion]];
    206211}
    207212
     
    228233        }
    229234       
     235        // just did a whole micropause beyond normal time
    230236        if (tick_time > micro_pause_duration && s_taking_work_break != state) {
    231237                // set micro_pause timers to 0
     
    274280                                work_break_t += tick_time;
    275281                                micro_pause_taking_t = 0;
     282                                if (work_break_taking_t > 0) {
     283                                        work_break_taking_cached_t = work_break_taking_t;
     284                                        work_break_taking_cached_date = date;
     285                                }
    276286                                work_break_taking_t = 0;
    277287                        } else if (micro_pause_t > 0) {
     
    294304                                micro_pause_t = 0;
    295305                                work_break_t = 0;
    296                                 //micro_pause_taking_t stays put
     306                                // micro_pause_taking_t stays put
    297307                                // work_break_taking_t stays put
    298308                        }
     
    495505{
    496506        work_break_taking_t = 0;
     507        // incase you were already having an implicit work break and clicked the take work break now button
     508        // not more then 20 seconds ago we took a natural break longer then 0.2 * normal work break duration
     509        if (date - work_break_taking_cached_date < 20 && work_break_taking_cached_t > work_break_duration * 0.2) {
     510                work_break_taking_t = work_break_taking_cached_t;
     511        }
    497512        [status setStringValue:@"Work Break"];
    498513        [progress setMaxValue:work_break_duration / 60];
     
    527542}
    528543
     544// goto website
     545- (IBAction)gotoWebsite:(id)sender
     546{
     547        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:sURL]];
     548}
     549
     550// check for update
     551- (IBAction)checkForUpdate:(id)sender
     552{
     553        NSString *latest_version =
     554        [NSString stringWithContentsOfURL: [NSURL URLWithString:sLatestVersionURL]];
     555       
     556        if (latest_version == Nil) latest_version = @"";
     557        latest_version = [latest_version stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
     558       
     559        if ([latest_version length] == 0) {
     560                NSRunInformationalAlertPanel(
     561                        @"Unable to Determine",
     562                        @"Unable to determine the latest AntiRSI version number.",
     563                        @"Ok", nil, nil);
     564        } else if ([latest_version compare:sVersion] == NSOrderedDescending) {
     565                int r = NSRunInformationalAlertPanel(
     566                        @"New Version",
     567                        [NSString stringWithFormat:@"A new version (%@) of AntiRSI is available; would you like to go to the website now?", latest_version],
     568                        @"Goto Website", @"Cancel", nil);
     569                if (r == NSOKButton) {
     570                        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:sURL]];
     571                }
     572    } else {
     573        NSRunInformationalAlertPanel(
     574                        @"No Update Available",
     575                        @"This is the latest version of AntiRSI.",
     576                        @"OK", nil, nil);
     577    }
     578}
     579
    529580// stop work break and postpone by 10 minutes
    530581- (IBAction)postpone:(id)sender
     
    534585                micro_pause_taking_t = 0;
    535586                work_break_taking_t = 0;
     587                work_break_taking_cached_t = 0;
    536588                work_break_t -= 10*60; // decrease with 10 minutes
    537589                if (work_break_t < 0) work_break_t = 0;
     
    553605       
    554606        if ([[anItem title] isEqualToString:@"Postpone Break"] && state == s_taking_work_break) {
     607                return YES;
     608        }
     609       
     610        if ([[anItem title] isEqualToString:@"AntiRSI Help"]) {
    555611                return YES;
    556612        }
  • trunk/Cocoa/AntiRSI/AntiRSI.xcodeproj

    • Property svn:ignore set to
      *.mode1
      *.mode2
      *.pbxuser
      *.perspective
  • trunk/Cocoa/AntiRSI/AntiRSI.xcodeproj/project.pbxproj

    r325 r329  
    244244                        isa = XCBuildConfiguration;
    245245                        buildSettings = {
    246                                 ARCHS = (
    247                                         ppc,
    248                                         i386,
    249                                 );
    250246                                COPY_PHASE_STRIP = NO;
    251247                                DEBUGGING_SYMBOLS = YES;
     
    284280                        isa = XCBuildConfiguration;
    285281                        buildSettings = {
    286                                 ARCHS = (
    287                                         ppc,
    288                                         i386,
    289                                 );
    290282                                COPY_PHASE_STRIP = YES;
    291283                                DEPLOYMENT_LOCATION = NO;
     
    320312                        isa = XCBuildConfiguration;
    321313                        buildSettings = {
    322                                 ARCHS = (
    323                                         ppc,
    324                                         i386,
    325                                 );
    326314                                DEPLOYMENT_LOCATION = NO;
    327315                                FRAMEWORK_SEARCH_PATHS = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Versions/A/Frameworks\"";
     
    360348                        isa = XCBuildConfiguration;
    361349                        buildSettings = {
     350                                ARCHS = (
     351                                        ppc,
     352                                        i386,
     353                                );
    362354                                GCC_C_LANGUAGE_STANDARD = c99;
    363355                        };
  • trunk/Cocoa/AntiRSI/AntiRSIView.m

    r327 r329  
    2626{
    2727    NSColor *bgColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.90];
    28     NSRect bgRect = [self bounds];
     28    NSRect bgRect = [self frame];
    2929    int minX = NSMinX(bgRect);
    3030    int midX = NSMidX(bgRect);
  • trunk/Cocoa/AntiRSI/English.lproj/MainMenu.nib/info.nib

    r325 r329  
    44<dict>
    55        <key>IBDocumentLocation</key>
    6         <string>35 305 441 309 0 0 1680 1028 </string>
     6        <string>35 23 441 309 0 0 1024 746 </string>
    77        <key>IBEditorPositions</key>
    88        <dict>
    99                <key>259</key>
    10                 <string>340 618 300 322 0 0 1680 1028 </string>
     10                <string>490 507 300 322 0 0 1280 1002 </string>
    1111                <key>29</key>
    12                 <string>142 885 330 44 0 0 1680 1028 </string>
     12                <string>194 823 330 44 0 0 1280 1002 </string>
    1313                <key>343</key>
    14                 <string>64 674 189 68 0 0 1680 1028 </string>
     14                <string>84 540 189 68 0 0 1280 1002 </string>
    1515        </dict>
    1616        <key>IBFramework Version</key>
     
    1818        <key>IBOpenObjects</key>
    1919        <array>
    20                 <integer>438</integer>
    2120                <integer>343</integer>
    2221                <integer>259</integer>
     
    2423        </array>
    2524        <key>IBSystem Version</key>
    26         <string>8I127</string>
     25        <string>8G32</string>
    2726</dict>
    2827</plist>
  • trunk/Cocoa/AntiRSI/Info.plist

    r327 r329  
    1818        <string>ONNE</string>
    1919        <key>CFBundleVersion</key>
    20         <string>1.3</string>
     20        <string>1.4</string>
    2121        <key>NSMainNibFile</key>
    2222        <string>MainMenu</string>
Note: See TracChangeset for help on using the changeset viewer.