Changeset 8924


Ignore:
Timestamp:
Aug 14, 2009, 1:11:13 AM (13 years ago)
Author:
livings124
Message:

Add a window to the Mac interface to ask for a donation.

A lot of discussion has gone into the merits of such a feature, and as a result it has been designed to be as unobtrusive as possible. It will appear on second launch, and once a week after that. If the "don't ask again" check is checked, then it will never appear again. No matter what option is chosen, there will be no impact on any functionality of the program.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r8883 r8924  
    145145#define DONATE_URL  @"http://www.transmissionbt.com/donate.php"
    146146
     147#define DONATE_NAG_TIME (60 * 60 * 24 * 7)
     148
    147149static void altSpeedToggledCallback(tr_session * handle UNUSED, tr_bool active, tr_bool byUser, void * controller)
    148150{
     
    517519    if ([fDefaults boolForKey: @"InfoVisible"])
    518520        [self showInfo: nil];
     521   
     522    //shamelessly ask for donations
     523    NSDate * lastDonateDate = [fDefaults objectForKey: @"DonateAskDate"];
     524    if (YES ||( [fDefaults boolForKey: @"WarningDonate"] && (!lastDonateDate || [lastDonateDate timeIntervalSinceNow] < -1 * DONATE_NAG_TIME)))
     525    {
     526        if (lastDonateDate) //don't show on the first launch
     527        {
     528            NSAlert * alert = [[NSAlert alloc] init];
     529            [alert setMessageText: NSLocalizedString(@"Support open-source indie software", "Donation beg -> title")];
     530           
     531            NSString * donateMessage = [NSString stringWithFormat: @"%@\n\n%@",
     532                NSLocalizedString(@"Transmission is a full-featured torrent application. A lot of time and effort have gone into development, coding, and refinement."
     533                    " If you enjoy using it, please consider showing your love with a donation.", "Donation beg -> message"),
     534                NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
     535           
     536            [alert setInformativeText: donateMessage];
     537            [alert setAlertStyle: NSInformationalAlertStyle];
     538           
     539            [alert addButtonWithTitle: [NSLocalizedString(@"Donate", "Donation beg -> button") stringByAppendingEllipsis]];
     540            NSButton * noDonateButton = [alert addButtonWithTitle: NSLocalizedString(@"Nope", "Donation beg -> button")];
     541            [noDonateButton setKeyEquivalent: @"\e"]; //escape key
     542           
     543            [[alert suppressionButton] setTitle: NSLocalizedString(@"Don't bug me about this ever again.", "Donation beg -> button")];
     544            [alert setShowsSuppressionButton: YES];
     545           
     546            const NSInteger donateResult = [alert runModal];
     547            if (donateResult == NSAlertFirstButtonReturn)
     548                [self linkDonate: self];
     549           
     550            if ([[alert suppressionButton] state] == NSOnState)
     551                [fDefaults setBool: NO forKey: @"WarningDonate"];
     552           
     553            [alert release];
     554        }
     555       
     556        [fDefaults setObject: [NSDate date] forKey: @"DonateAskDate"];
     557    }
    519558}
    520559
  • trunk/macosx/Defaults.plist

    r8461 r8924  
    183183        <key>WarningCreatorBlankAddress</key>
    184184        <true/>
     185        <key>WarningDonate</key>
     186        <true/>
    185187        <key>WarningDuplicate</key>
    186188        <true/>
Note: See TracChangeset for help on using the changeset viewer.