From fb03acbbc2bf089b265579f5e5e7708d43a9cefd Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 2 Aug 2010 03:07:42 +0000 Subject: [PATCH] (trunk) consistency tweaks between the GTK+ and Qt client: 1. synchronize some of the keyboard shortcuts 2. synchronize some text in the preferences dialog 3. add a "Desktop" tab in the Qt client's preferences dialog 4. add a "Donate" button to the Qt client's help menu --- gtk/actions.c | 2 +- gtk/tr-prefs.c | 4 ++-- qt/app.cc | 18 +++++++++++------- qt/app.h | 4 ++-- qt/mainwin.cc | 15 ++++++++------- qt/mainwin.h | 2 +- qt/mainwin.ui | 11 ++++++++++- qt/prefs-dialog.cc | 44 ++++++++++++++++++++++++++++++-------------- qt/prefs-dialog.h | 5 +++-- 9 files changed, 68 insertions(+), 37 deletions(-) diff --git a/gtk/actions.c b/gtk/actions.c index cd8aba45c..aca89dd62 100644 --- a/gtk/actions.c +++ b/gtk/actions.c @@ -120,7 +120,7 @@ static GtkActionEntry entries[] = { "pause-torrent", GTK_STOCK_MEDIA_PAUSE, N_( "_Pause" ), "P", N_( "Pause torrent" ), G_CALLBACK( action_cb ) }, { "pause-all-torrents", GTK_STOCK_MEDIA_PAUSE, N_( "_Pause All" ), NULL, N_( "Pause all torrents" ), G_CALLBACK( action_cb ) }, { "start-all-torrents", GTK_STOCK_MEDIA_PLAY, N_( "_Start All" ), NULL, N_( "Start all torrents" ), G_CALLBACK( action_cb ) }, - { "relocate-torrent", NULL, N_("Set _Location" ), NULL, NULL, G_CALLBACK( action_cb ) }, + { "relocate-torrent", NULL, N_("Set _Location..." ), NULL, NULL, G_CALLBACK( action_cb ) }, { "remove-torrent", GTK_STOCK_REMOVE, NULL, "Delete", N_( "Remove torrent" ), G_CALLBACK( action_cb ) }, { "delete-torrent", GTK_STOCK_DELETE, N_( "_Delete Files and Remove" ), "Delete", NULL, G_CALLBACK( action_cb ) }, { "new-torrent", GTK_STOCK_NEW, N_( "_New..." ), NULL, N_( "Create a torrent" ), G_CALLBACK( action_cb ) }, diff --git a/gtk/tr-prefs.c b/gtk/tr-prefs.c index 8b3f0722d..c999c0ae2 100644 --- a/gtk/tr-prefs.c +++ b/gtk/tr-prefs.c @@ -531,7 +531,7 @@ privacyPage( GObject * core ) gtr_widget_set_tooltip_text( w, s ); hig_workarea_add_wide_control( t, &row, w ); - s = _( "Use Local Peer Discovery to find more peers" ); + s = _( "Use _Local Peer Discovery to find more peers" ); w = new_check_button( s, TR_PREFS_KEY_LPD_ENABLED, core ); s = _( "LPD is a tool for finding peers on your local network." ); gtr_widget_set_tooltip_text( w, s ); @@ -1287,7 +1287,7 @@ peerPage( GObject * core ) data->prefsTag = g_signal_connect( TR_CORE( core ), "prefs-changed", G_CALLBACK( onCorePrefsChanged ), data ); g_object_weak_ref( G_OBJECT( t ), peerPageDestroyed, data ); - s = _( "Pick a _random port on startup" ); + s = _( "Pick a _random port every time Transmission is started" ); w = new_check_button( s, TR_PREFS_KEY_PEER_PORT_RANDOM_ON_START, core ); hig_workarea_add_wide_control( t, &row, w ); diff --git a/qt/app.cc b/qt/app.cc index 2f3ff5664..937470628 100644 --- a/qt/app.cc +++ b/qt/app.cc @@ -169,7 +169,7 @@ MyApp :: MyApp( int& argc, char ** argv ): connect( mySession, SIGNAL(sourceChanged()), this, SLOT(onSessionSourceChanged()) ); // when the model sees a torrent for the first time, ask the session for full info on it connect( myModel, SIGNAL(torrentsAdded(QSet)), mySession, SLOT(initTorrents(QSet)) ); - connect( myModel, SIGNAL(torrentsAdded(QSet)), this, SLOT(torrentsAdded(QSet)) ); + connect( myModel, SIGNAL(torrentsAdded(QSet)), this, SLOT(onTorrentsAdded(QSet)) ); mySession->initTorrents( ); mySession->refreshSessionStats( ); @@ -245,21 +245,25 @@ MyApp :: MyApp( int& argc, char ** argv ): std::cerr << "couldn't register " << DBUS_OBJECT_PATH << std::endl; } +/* these two functions are for popping up desktop notification + * when new torrents are added */ void -MyApp :: torrentsAdded( QSet torrents ) +MyApp :: onTorrentsAdded( QSet torrents ) { + if( !myPrefs->getBool( Prefs::SHOW_DESKTOP_NOTIFICATION ) ) + return; + foreach( int id, torrents ) { Torrent * tor = myModel->getTorrentFromId( id ); if( !tor->name().isEmpty( ) ) - torrentChanged( id ); + onNewTorrentChanged( id ); else // wait until the torrent's INFO fields are loaded - connect( tor, SIGNAL(torrentChanged(int)), this, SLOT(torrentChanged(int)) ); + connect( tor, SIGNAL(torrentChanged(int)), this, SLOT(onNewTorrentChanged(int)) ); } } - void -MyApp :: torrentChanged( int id ) +MyApp :: onNewTorrentChanged( int id ) { Torrent * tor = myModel->getTorrentFromId( id ); @@ -269,7 +273,7 @@ MyApp :: torrentChanged( int id ) if( age_secs < 30 ) notify( tr( "Torrent Added" ), tor->name( ) ); - disconnect( tor, SIGNAL(torrentChanged(int)), this, SLOT(torrentChanged(int)) ); + disconnect( tor, SIGNAL(torrentChanged(int)), this, SLOT(onNewTorrentChanged(int)) ); } } diff --git a/qt/app.h b/qt/app.h index eb6867f30..3e4df0d3d 100644 --- a/qt/app.h +++ b/qt/app.h @@ -57,8 +57,8 @@ class MyApp: public QApplication void onSessionSourceChanged( ); void refreshPref( int key ); void refreshTorrents( ); - void torrentsAdded( QSet ); - void torrentChanged( int ); + void onTorrentsAdded( QSet ); + void onNewTorrentChanged( int ); public slots: void addTorrent( const QString& ); diff --git a/qt/mainwin.cc b/qt/mainwin.cc index 189a37c86..846c98b63 100644 --- a/qt/mainwin.cc +++ b/qt/mainwin.cc @@ -125,7 +125,6 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode // ui signals connect( ui.action_Toolbar, SIGNAL(toggled(bool)), this, SLOT(setToolbarVisible(bool))); - connect( ui.action_TrayIcon, SIGNAL(toggled(bool)), this, SLOT(setTrayIconVisible(bool))); connect( ui.action_Filterbar, SIGNAL(toggled(bool)), this, SLOT(setFilterbarVisible(bool))); connect( ui.action_Statusbar, SIGNAL(toggled(bool)), this, SLOT(setStatusbarVisible(bool))); connect( ui.action_CompactView, SIGNAL(toggled(bool)), this, SLOT(setCompactView(bool))); @@ -152,6 +151,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode connect( ui.action_New, SIGNAL(triggered()), this, SLOT(newTorrent())); connect( ui.action_Preferences, SIGNAL(triggered()), this, SLOT(openPreferences())); connect( ui.action_Statistics, SIGNAL(triggered()), myStatsDialog, SLOT(show())); + connect( ui.action_Donate, SIGNAL(triggered()), this, SLOT(openDonate())); connect( ui.action_About, SIGNAL(triggered()), myAboutDialog, SLOT(show())); connect( ui.action_Contents, SIGNAL(triggered()), this, SLOT(openHelp())); connect( ui.action_OpenFolder, SIGNAL(triggered()), this, SLOT(openFolder())); @@ -607,6 +607,12 @@ TrMainWindow :: copyMagnetLinkToClipboard( ) mySession.copyMagnetLinkToClipboard( id ); } +void +TrMainWindow :: openDonate( ) +{ + QDesktopServices :: openUrl( QUrl( "http://www.transmissionbt.com/donate.php" ) ); +} + void TrMainWindow :: openHelp( ) { @@ -615,7 +621,7 @@ TrMainWindow :: openHelp( ) sscanf( SHORT_VERSION_STRING, "%d.%d", &major, &minor ); char url[128]; tr_snprintf( url, sizeof( url ), fmt, major, minor/10 ); - QDesktopServices :: openUrl( QUrl( QString( url ) ) ); + QDesktopServices :: openUrl( QUrl( url ) ); } void @@ -816,11 +822,6 @@ TrMainWindow :: setCompactView( bool visible ) myPrefs.set( Prefs :: COMPACT_VIEW, visible ); } void -TrMainWindow :: setTrayIconVisible( bool visible ) -{ - myPrefs.set( Prefs :: SHOW_TRAY_ICON, visible ); -} -void TrMainWindow :: toggleSpeedMode( ) { myPrefs.toggleBool( Prefs :: ALT_SPEED_LIMIT_ENABLED ); diff --git a/qt/mainwin.h b/qt/mainwin.h index c699f7aaf..39815b172 100644 --- a/qt/mainwin.h +++ b/qt/mainwin.h @@ -111,6 +111,7 @@ class TrMainWindow: public QMainWindow void refreshPref( int key ); void addTorrents( const QStringList& filenames ); void removeTorrents( const bool deleteFiles ); + void openDonate( ); void openHelp( ); void openFolder( ); void copyMagnetLinkToClipboard( ); @@ -173,7 +174,6 @@ class TrMainWindow: public QMainWindow void setToolbarVisible( bool ); void setFilterbarVisible( bool ); void setStatusbarVisible( bool ); - void setTrayIconVisible( bool ); void setCompactView( bool ); void refreshActionSensitivity( ); void wrongAuthentication( ); diff --git a/qt/mainwin.ui b/qt/mainwin.ui index 8cb0bfbb0..802ff8cd7 100644 --- a/qt/mainwin.ui +++ b/qt/mainwin.ui @@ -96,6 +96,8 @@ + + @@ -108,7 +110,6 @@ - @@ -464,6 +465,9 @@ &Contents + + F1 + @@ -573,6 +577,11 @@ Add &URL... + + + &Donate + + diff --git a/qt/prefs-dialog.cc b/qt/prefs-dialog.cc index 1b0b3442d..b715626fe 100644 --- a/qt/prefs-dialog.cc +++ b/qt/prefs-dialog.cc @@ -224,8 +224,7 @@ PrefsDialog :: createWebTab( Session& session ) hig->addSectionTitle( tr( "Web Client" ) ); QWidget * w; QHBoxLayout * h = new QHBoxLayout( ); - QIcon i( style()->standardIcon( QStyle::StandardPixmap( QStyle::SP_DirOpenIcon ) ) ); - QPushButton * b = new QPushButton( i, tr( "&Open web client" ) ); + QPushButton * b = new QPushButton( tr( "&Open web client" ) ); connect( b, SIGNAL(clicked()), &session, SLOT(launchWebInterface()) ); h->addWidget( b, 0, Qt::AlignRight ); QWidget * l = checkBoxNew( tr( "&Enable web client" ), Prefs::RPC_ENABLED ); @@ -294,7 +293,7 @@ PrefsDialog :: createSpeedTab( ) QString s = tr( "Override normal speed limits manually or at scheduled times" ); hig->addWideControl( new QLabel( s ) ); - s = tr( "Limit d&ownload speed (%1):" ).arg( speed_K_str ); + s = tr( "Limit do&wnload speed (%1):" ).arg( speed_K_str ); r = spinBoxNew( Prefs :: ALT_SPEED_LIMIT_DOWN, 0, INT_MAX, 5 ); hig->addRow( s, r ); @@ -343,6 +342,23 @@ PrefsDialog :: createSpeedTab( ) **** ***/ +QWidget * +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( "Show &popup notifications" ), Prefs::SHOW_DESKTOP_NOTIFICATION ) ); + + hig->finish( ); + return hig; +} + +/*** +**** +***/ + void PrefsDialog :: onPortTested( bool isOpen ) { @@ -369,7 +385,7 @@ PrefsDialog :: createNetworkTab( ) QSpinBox * s = spinBoxNew( Prefs::PEER_PORT, 1, 65535, 1 ); QHBoxLayout * h = new QHBoxLayout( ); - QPushButton * b = myPortButton = new QPushButton( tr( "&Test Port" ) ); + QPushButton * b = myPortButton = new QPushButton( tr( "Te&st Port" ) ); QLabel * l = myPortLabel = new QLabel( tr( "Status unknown" ) ); h->addWidget( l ); h->addSpacing( HIG :: PAD_BIG ); @@ -380,8 +396,8 @@ PrefsDialog :: createNetworkTab( ) hig->addRow( tr( "&Port for incoming connections:" ), s ); hig->addRow( "", h, 0 ); - hig->addWideControl( checkBoxNew( tr( "Use UPnP or NAT-PMP port &forwarding from my router" ), Prefs::PORT_FORWARDING ) ); hig->addWideControl( checkBoxNew( tr( "Pick a &random port every time Transmission is started" ), Prefs :: PEER_PORT_RANDOM_ON_START ) ); + hig->addWideControl( checkBoxNew( tr( "Use UPnP or NAT-PMP port &forwarding from my router" ), Prefs::PORT_FORWARDING ) ); hig->addSectionDivider( ); hig->addSectionTitle( tr( "Limits" ) ); @@ -451,8 +467,7 @@ PrefsDialog :: createPrivacyTab( ) HIG * hig = new HIG( this ); hig->addSectionTitle( tr( "Blocklist" ) ); QHBoxLayout * h = new QHBoxLayout( ); - QIcon i( style()->standardIcon( QStyle::StandardPixmap( QStyle::SP_BrowserReload ) ) ); - QWidget * w = new QPushButton( i, tr( "&Update blocklist" ) ); + QWidget * w = new QPushButton( tr( "&Update" ) ); connect( w, SIGNAL(clicked(bool)), this, SLOT(onUpdateBlocklistClicked())); myBlockWidgets << w; QWidget * l = checkBoxNew( "", Prefs::BLOCKLIST_ENABLED ); @@ -572,6 +587,12 @@ PrefsDialog :: createTorrentsTab( ) hig->addWideControl( checkBoxNew( tr( "Append \".&part\" to incomplete files' names" ), Prefs::RENAME_PARTIAL_FILES ) ); + b = myDestinationButton = new QPushButton; + b->setIcon( folderPixmap ); + b->setStyleSheet( "text-align: left; padding-left: 5; padding-right: 5" ); + connect( b, SIGNAL(clicked(bool)), this, SLOT(onDestinationClicked(void)) ); + hig->addRow( tr( "Save to &Location:" ), b ); + l = myIncompleteCheckbox = checkBoxNew( tr( "Keep &incomplete files in:" ), Prefs::INCOMPLETE_DIR_ENABLED ); b = myIncompleteButton = new QPushButton; b->setIcon( folderPixmap ); @@ -580,7 +601,7 @@ PrefsDialog :: createTorrentsTab( ) hig->addRow( myIncompleteCheckbox, b ); enableBuddyWhenChecked( qobject_cast(l), b ); - l = myTorrentDoneScriptCheckbox = checkBoxNew( tr( "Call scrip&t when torrent is completed" ), Prefs::SCRIPT_TORRENT_DONE_ENABLED ); + l = myTorrentDoneScriptCheckbox = checkBoxNew( tr( "Call scrip&t when torrent is completed:" ), Prefs::SCRIPT_TORRENT_DONE_ENABLED ); b = myTorrentDoneScriptButton = new QPushButton; b->setIcon( filePixmap ); b->setStyleSheet( "text-align: left; padding-left: 5; padding-right: 5" ); @@ -588,12 +609,6 @@ PrefsDialog :: createTorrentsTab( ) hig->addRow( myTorrentDoneScriptCheckbox, b ); enableBuddyWhenChecked( qobject_cast(l), b ); - b = myDestinationButton = new QPushButton; - b->setIcon( folderPixmap ); - b->setStyleSheet( "text-align: left; padding-left: 5; padding-right: 5" ); - connect( b, SIGNAL(clicked(bool)), this, SLOT(onDestinationClicked(void)) ); - hig->addRow( tr( "Save to &Location:" ), b ); - hig->addSectionDivider( ); hig->addSectionTitle( tr( "Seeding Limits" ) ); @@ -629,6 +644,7 @@ PrefsDialog :: PrefsDialog( Session& session, Prefs& prefs, QWidget * parent ): t->addTab( createSpeedTab( ), tr( "Speed" ) ); t->addTab( createPrivacyTab( ), tr( "Privacy" ) ); t->addTab( createNetworkTab( ), tr( "Network" ) ); + t->addTab( createDesktopTab( ), tr( "Desktop" ) ); t->addTab( createWebTab( session ), tr( "Web" ) ); //t->addTab( createTrackerTab( ), tr( "Trackers" ) ); myLayout->addWidget( t ); diff --git a/qt/prefs-dialog.h b/qt/prefs-dialog.h index 82f9492f5..394b47cbc 100644 --- a/qt/prefs-dialog.h +++ b/qt/prefs-dialog.h @@ -79,9 +79,10 @@ class PrefsDialog: public QDialog private: bool isAllowed( int key ) const; QWidget * createTorrentsTab( ); - QWidget * createNetworkTab( ); - QWidget * createPrivacyTab( ); QWidget * createSpeedTab( ); + QWidget * createPrivacyTab( ); + QWidget * createNetworkTab( ); + QWidget * createDesktopTab( ); QWidget * createWebTab( Session& ); QWidget * createTrackerTab( ); -- 2.40.0