(qt) Qt client should have the option to play a sound when the download completes, as the Mac and GTK+ clients do -- implemented.
This commit is contained in:
parent
ac28b6df6e
commit
b42a7ebdc3
|
@ -309,7 +309,6 @@ static const struct tr_key_struct my_static[] =
|
|||
{ "session-count", 13 },
|
||||
{ "sessionCount", 12 },
|
||||
{ "show-backup-trackers", 20 },
|
||||
{ "show-desktop-notification", 25 },
|
||||
{ "show-extra-peer-details", 23 },
|
||||
{ "show-filterbar", 14 },
|
||||
{ "show-notification-area-icon", 27 },
|
||||
|
|
|
@ -319,7 +319,6 @@ enum
|
|||
TR_KEY_session_count,
|
||||
TR_KEY_sessionCount,
|
||||
TR_KEY_show_backup_trackers,
|
||||
TR_KEY_show_desktop_notification,
|
||||
TR_KEY_show_extra_peer_details,
|
||||
TR_KEY_show_filterbar,
|
||||
TR_KEY_show_notification_area_icon,
|
||||
|
|
15
qt/app.cc
15
qt/app.cc
|
@ -22,6 +22,7 @@
|
|||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
#include <QLibraryInfo>
|
||||
#include <QProcess>
|
||||
#include <QRect>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
@ -259,7 +260,7 @@ MyApp :: MyApp( int& argc, char ** argv ):
|
|||
void
|
||||
MyApp :: onTorrentsAdded( QSet<int> torrents )
|
||||
{
|
||||
if( !myPrefs->getBool( Prefs::SHOW_DESKTOP_NOTIFICATION ) )
|
||||
if( !myPrefs->getBool( Prefs::SHOW_NOTIFICATION_ON_ADD ) )
|
||||
return;
|
||||
|
||||
foreach( int id, torrents )
|
||||
|
@ -279,13 +280,17 @@ MyApp :: onTorrentsAdded( QSet<int> torrents )
|
|||
void
|
||||
MyApp :: onTorrentCompleted( int id )
|
||||
{
|
||||
Torrent * tor = myModel->getTorrentFromId( id );
|
||||
Torrent * tor = myModel->getTorrentFromId (id);
|
||||
|
||||
if( tor && !tor->name().isEmpty() )
|
||||
if (tor)
|
||||
{
|
||||
notify( tr( "Torrent Completed" ), tor->name( ) );
|
||||
if (myPrefs->getBool (Prefs::SHOW_NOTIFICATION_ON_COMPLETE))
|
||||
notify (tr("Torrent Completed"), tor->name());
|
||||
|
||||
disconnect( tor, SIGNAL(torrentCompleted(int)), this, SLOT(onTorrentCompleted(int)) );
|
||||
if (myPrefs->getBool (Prefs::COMPLETE_SOUND_ENABLED))
|
||||
QProcess::execute (myPrefs->getString(Prefs::COMPLETE_SOUND_COMMAND));
|
||||
|
||||
disconnect( tor, SIGNAL(torrentCompleted(int)), this, SLOT(onTorrentCompleted(int)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -299,9 +299,15 @@ PrefsDialog :: createDesktopTab( )
|
|||
HIG * hig = new HIG( this );
|
||||
hig->addSectionTitle( tr( "Desktop" ) );
|
||||
|
||||
hig->addWideControl( checkBoxNew( tr( "Show Transmission icon in the ¬ification area" ), Prefs::SHOW_TRAY_ICON ) );
|
||||
hig->addWideControl( checkBoxNew( tr( "Start &minimized in notification area" ), Prefs::START_MINIMIZED ) );
|
||||
hig->addWideControl( checkBoxNew( tr( "Show &popup notifications" ), Prefs::SHOW_DESKTOP_NOTIFICATION ) );
|
||||
hig->addWideControl( checkBoxNew( tr( "Show Transmission icon in the ¬ification area" ), Prefs::SHOW_TRAY_ICON ) );
|
||||
hig->addWideControl( checkBoxNew( tr( "Start &minimized in notification area" ), Prefs::START_MINIMIZED ) );
|
||||
|
||||
hig->addSectionDivider( );
|
||||
hig->addSectionTitle( tr ("Notification") );
|
||||
|
||||
hig->addWideControl( checkBoxNew( tr( "Show a notification when torrents are a&dded" ), Prefs::SHOW_NOTIFICATION_ON_ADD ) );
|
||||
hig->addWideControl( checkBoxNew( tr( "Show a notification when torrents &finish" ), Prefs::SHOW_NOTIFICATION_ON_COMPLETE ) );
|
||||
hig->addWideControl( checkBoxNew( tr( "Play a &sound when torrents finish" ), Prefs::COMPLETE_SOUND_ENABLED ) );
|
||||
|
||||
hig->finish( );
|
||||
return hig;
|
||||
|
|
12
qt/prefs.cc
12
qt/prefs.cc
|
@ -38,7 +38,8 @@ Prefs::PrefItem Prefs::myItems[] =
|
|||
{ DIR_WATCH_ENABLED, TR_KEY_watch_dir_enabled, QVariant::Bool },
|
||||
{ SHOW_TRAY_ICON, TR_KEY_show_notification_area_icon, QVariant::Bool },
|
||||
{ START_MINIMIZED, TR_KEY_start_minimized, QVariant::Bool },
|
||||
{ SHOW_DESKTOP_NOTIFICATION, TR_KEY_show_desktop_notification, QVariant::Bool },
|
||||
{ SHOW_NOTIFICATION_ON_ADD, TR_KEY_torrent_added_notification_enabled, QVariant::Bool },
|
||||
{ SHOW_NOTIFICATION_ON_COMPLETE, TR_KEY_torrent_complete_notification_enabled, QVariant::Bool },
|
||||
{ ASKQUIT, TR_KEY_prompt_before_exit, QVariant::Bool },
|
||||
{ SORT_MODE, TR_KEY_sort_mode, TrTypes::SortModeType },
|
||||
{ SORT_REVERSED, TR_KEY_sort_reversed, QVariant::Bool },
|
||||
|
@ -65,6 +66,8 @@ Prefs::PrefItem Prefs::myItems[] =
|
|||
{ SESSION_REMOTE_AUTH, TR_KEY_remote_session_requres_authentication, QVariant::Bool },
|
||||
{ SESSION_REMOTE_USERNAME, TR_KEY_remote_session_username, QVariant::String },
|
||||
{ SESSION_REMOTE_PASSWORD, TR_KEY_remote_session_password, QVariant::String },
|
||||
{ COMPLETE_SOUND_COMMAND, TR_KEY_torrent_complete_sound_command, QVariant::String },
|
||||
{ COMPLETE_SOUND_ENABLED, TR_KEY_torrent_complete_sound_enabled, QVariant::Bool },
|
||||
{ USER_HAS_GIVEN_INFORMED_CONSENT, TR_KEY_user_has_given_informed_consent, QVariant::Bool },
|
||||
|
||||
/* libtransmission settings */
|
||||
|
@ -275,7 +278,7 @@ Prefs :: ~Prefs ()
|
|||
void
|
||||
Prefs :: initDefaults (tr_variant * d)
|
||||
{
|
||||
tr_variantDictReserve (d, 35);
|
||||
tr_variantDictReserve (d, 38);
|
||||
tr_variantDictAddBool (d, TR_KEY_blocklist_updates_enabled, true);
|
||||
tr_variantDictAddBool (d, TR_KEY_compact_view, false);
|
||||
tr_variantDictAddBool (d, TR_KEY_inhibit_desktop_hibernation, false);
|
||||
|
@ -283,7 +286,6 @@ Prefs :: initDefaults (tr_variant * d)
|
|||
tr_variantDictAddBool (d, TR_KEY_remote_session_enabled, false);
|
||||
tr_variantDictAddBool (d, TR_KEY_remote_session_requres_authentication, false);
|
||||
tr_variantDictAddBool (d, TR_KEY_show_backup_trackers, false);
|
||||
tr_variantDictAddBool (d, TR_KEY_show_desktop_notification, true);
|
||||
tr_variantDictAddBool (d, TR_KEY_show_extra_peer_details, false),
|
||||
tr_variantDictAddBool (d, TR_KEY_show_filterbar, true);
|
||||
tr_variantDictAddBool (d, TR_KEY_show_notification_area_icon, false);
|
||||
|
@ -293,6 +295,10 @@ Prefs :: initDefaults (tr_variant * d)
|
|||
tr_variantDictAddBool (d, TR_KEY_show_toolbar, true);
|
||||
tr_variantDictAddBool (d, TR_KEY_show_tracker_scrapes, false);
|
||||
tr_variantDictAddBool (d, TR_KEY_sort_reversed, false);
|
||||
tr_variantDictAddBool (d, TR_KEY_torrent_added_notification_enabled, true);
|
||||
tr_variantDictAddBool (d, TR_KEY_torrent_complete_notification_enabled, true);
|
||||
tr_variantDictAddStr (d, TR_KEY_torrent_complete_sound_command, "canberra-gtk-play -i complete-download -d 'transmission torrent downloaded'");
|
||||
tr_variantDictAddBool (d, TR_KEY_torrent_complete_sound_enabled, true);
|
||||
tr_variantDictAddBool (d, TR_KEY_user_has_given_informed_consent, false);
|
||||
tr_variantDictAddBool (d, TR_KEY_watch_dir_enabled, false);
|
||||
tr_variantDictAddInt (d, TR_KEY_blocklist_date, 0);
|
||||
|
|
|
@ -44,7 +44,8 @@ class Prefs: public QObject
|
|||
DIR_WATCH_ENABLED,
|
||||
SHOW_TRAY_ICON,
|
||||
START_MINIMIZED,
|
||||
SHOW_DESKTOP_NOTIFICATION,
|
||||
SHOW_NOTIFICATION_ON_ADD,
|
||||
SHOW_NOTIFICATION_ON_COMPLETE,
|
||||
ASKQUIT,
|
||||
SORT_MODE,
|
||||
SORT_REVERSED,
|
||||
|
@ -71,6 +72,8 @@ class Prefs: public QObject
|
|||
SESSION_REMOTE_AUTH,
|
||||
SESSION_REMOTE_USERNAME,
|
||||
SESSION_REMOTE_PASSWORD,
|
||||
COMPLETE_SOUND_COMMAND,
|
||||
COMPLETE_SOUND_ENABLED,
|
||||
USER_HAS_GIVEN_INFORMED_CONSENT,
|
||||
|
||||
/* core prefs */
|
||||
|
|
Loading…
Reference in New Issue