Changeset 13813


Ignore:
Timestamp:
Jan 20, 2013, 11:57:09 PM (8 years ago)
Author:
jordan
Message:

(qt) Qt client should have the option to play a sound when the download completes, as the Mac and GTK+ clients do -- implemented.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/quark.c

    r13791 r13813  
    310310  { "sessionCount", 12 },
    311311  { "show-backup-trackers", 20 },
    312   { "show-desktop-notification", 25 },
    313312  { "show-extra-peer-details", 23 },
    314313  { "show-filterbar", 14 },
  • trunk/libtransmission/quark.h

    r13791 r13813  
    320320  TR_KEY_sessionCount,
    321321  TR_KEY_show_backup_trackers,
    322   TR_KEY_show_desktop_notification,
    323322  TR_KEY_show_extra_peer_details,
    324323  TR_KEY_show_filterbar,
  • trunk/qt/app.cc

    r13795 r13813  
    2323#include <QLabel>
    2424#include <QLibraryInfo>
     25#include <QProcess>
    2526#include <QRect>
    2627
     
    260261MyApp :: onTorrentsAdded( QSet<int> torrents )
    261262{
    262     if( !myPrefs->getBool( Prefs::SHOW_DESKTOP_NOTIFICATION ) )
     263    if( !myPrefs->getBool( Prefs::SHOW_NOTIFICATION_ON_ADD ) )
    263264        return;
    264265
     
    280281MyApp :: onTorrentCompleted( int id )
    281282{
    282     Torrent * tor = myModel->getTorrentFromId( id );
    283 
    284     if( tor && !tor->name().isEmpty() )
    285     {
    286         notify( tr( "Torrent Completed" ), tor->name( ) );
    287 
    288         disconnect( tor, SIGNAL(torrentCompleted(int)), this, SLOT(onTorrentCompleted(int)) );
     283  Torrent * tor = myModel->getTorrentFromId (id);
     284
     285  if (tor)
     286    {
     287      if (myPrefs->getBool (Prefs::SHOW_NOTIFICATION_ON_COMPLETE))
     288        notify (tr("Torrent Completed"), tor->name());
     289
     290      if (myPrefs->getBool (Prefs::COMPLETE_SOUND_ENABLED))
     291        QProcess::execute (myPrefs->getString(Prefs::COMPLETE_SOUND_COMMAND));
     292
     293      disconnect( tor, SIGNAL(torrentCompleted(int)), this, SLOT(onTorrentCompleted(int)) );
    289294    }
    290295}
  • trunk/qt/prefs-dialog.cc

    r13796 r13813  
    300300    hig->addSectionTitle( tr( "Desktop" ) );
    301301
    302     hig->addWideControl( checkBoxNew( tr( "Show Transmission icon in the &notification area" ), Prefs::SHOW_TRAY_ICON ) );
    303     hig->addWideControl( checkBoxNew( tr( "Start &minimized in notification area" ), Prefs::START_MINIMIZED ) );
    304     hig->addWideControl( checkBoxNew( tr( "Show &popup notifications" ), Prefs::SHOW_DESKTOP_NOTIFICATION ) );
     302      hig->addWideControl( checkBoxNew( tr( "Show Transmission icon in the &notification area" ), Prefs::SHOW_TRAY_ICON ) );
     303      hig->addWideControl( checkBoxNew( tr( "Start &minimized in notification area" ), Prefs::START_MINIMIZED ) );
     304
     305    hig->addSectionDivider( );
     306    hig->addSectionTitle( tr ("Notification") );
     307
     308      hig->addWideControl( checkBoxNew( tr( "Show a notification when torrents are a&dded" ), Prefs::SHOW_NOTIFICATION_ON_ADD ) );
     309      hig->addWideControl( checkBoxNew( tr( "Show a notification when torrents &finish" ), Prefs::SHOW_NOTIFICATION_ON_COMPLETE ) );
     310      hig->addWideControl( checkBoxNew( tr( "Play a &sound when torrents finish" ), Prefs::COMPLETE_SOUND_ENABLED ) );
    305311
    306312    hig->finish( );
  • trunk/qt/prefs.cc

    r13724 r13813  
    3939  { SHOW_TRAY_ICON, TR_KEY_show_notification_area_icon, QVariant::Bool },
    4040  { START_MINIMIZED, TR_KEY_start_minimized, QVariant::Bool },
    41   { SHOW_DESKTOP_NOTIFICATION, TR_KEY_show_desktop_notification, QVariant::Bool },
     41  { SHOW_NOTIFICATION_ON_ADD, TR_KEY_torrent_added_notification_enabled, QVariant::Bool },
     42  { SHOW_NOTIFICATION_ON_COMPLETE, TR_KEY_torrent_complete_notification_enabled, QVariant::Bool },
    4243  { ASKQUIT, TR_KEY_prompt_before_exit, QVariant::Bool },
    4344  { SORT_MODE, TR_KEY_sort_mode, TrTypes::SortModeType },
     
    6667  { SESSION_REMOTE_USERNAME, TR_KEY_remote_session_username, QVariant::String },
    6768  { SESSION_REMOTE_PASSWORD, TR_KEY_remote_session_password, QVariant::String },
     69  { COMPLETE_SOUND_COMMAND, TR_KEY_torrent_complete_sound_command, QVariant::String },
     70  { COMPLETE_SOUND_ENABLED, TR_KEY_torrent_complete_sound_enabled, QVariant::Bool },
    6871  { USER_HAS_GIVEN_INFORMED_CONSENT, TR_KEY_user_has_given_informed_consent, QVariant::Bool },
    6972
     
    276279Prefs :: initDefaults (tr_variant * d)
    277280{
    278   tr_variantDictReserve (d, 35);
     281  tr_variantDictReserve (d, 38);
    279282  tr_variantDictAddBool (d, TR_KEY_blocklist_updates_enabled, true);
    280283  tr_variantDictAddBool (d, TR_KEY_compact_view, false);
     
    284287  tr_variantDictAddBool (d, TR_KEY_remote_session_requres_authentication, false);
    285288  tr_variantDictAddBool (d, TR_KEY_show_backup_trackers, false);
    286   tr_variantDictAddBool (d, TR_KEY_show_desktop_notification, true);
    287289  tr_variantDictAddBool (d, TR_KEY_show_extra_peer_details, false),
    288290  tr_variantDictAddBool (d, TR_KEY_show_filterbar, true);
     
    294296  tr_variantDictAddBool (d, TR_KEY_show_tracker_scrapes, false);
    295297  tr_variantDictAddBool (d, TR_KEY_sort_reversed, false);
     298  tr_variantDictAddBool (d, TR_KEY_torrent_added_notification_enabled, true);
     299  tr_variantDictAddBool (d, TR_KEY_torrent_complete_notification_enabled, true);
     300  tr_variantDictAddStr  (d, TR_KEY_torrent_complete_sound_command, "canberra-gtk-play -i complete-download -d 'transmission torrent downloaded'");
     301  tr_variantDictAddBool (d, TR_KEY_torrent_complete_sound_enabled, true);
    296302  tr_variantDictAddBool (d, TR_KEY_user_has_given_informed_consent, false);
    297303  tr_variantDictAddBool (d, TR_KEY_watch_dir_enabled, false);
  • trunk/qt/prefs.h

    r13724 r13813  
    4545            SHOW_TRAY_ICON,
    4646            START_MINIMIZED,
    47             SHOW_DESKTOP_NOTIFICATION,
     47            SHOW_NOTIFICATION_ON_ADD,
     48            SHOW_NOTIFICATION_ON_COMPLETE,
    4849            ASKQUIT,
    4950            SORT_MODE,
     
    7273            SESSION_REMOTE_USERNAME,
    7374            SESSION_REMOTE_PASSWORD,
     75            COMPLETE_SOUND_COMMAND,
     76            COMPLETE_SOUND_ENABLED,
    7477            USER_HAS_GIVEN_INFORMED_CONSENT,
    7578
Note: See TracChangeset for help on using the changeset viewer.