]> granicus.if.org Git - transmission/commitdiff
(trunk) consistency tweaks between the GTK+ and Qt client:
authorCharles Kerr <charles@transmissionbt.com>
Mon, 2 Aug 2010 03:07:42 +0000 (03:07 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Mon, 2 Aug 2010 03:07:42 +0000 (03:07 +0000)
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
gtk/tr-prefs.c
qt/app.cc
qt/app.h
qt/mainwin.cc
qt/mainwin.h
qt/mainwin.ui
qt/prefs-dialog.cc
qt/prefs-dialog.h

index cd8aba45c039ffd8d49d68445ffef18b9abbf5cc..aca89dd62a64f948b125626b5fb8b73107b6a4a1 100644 (file)
@@ -120,7 +120,7 @@ static GtkActionEntry entries[] =
     { "pause-torrent", GTK_STOCK_MEDIA_PAUSE, N_( "_Pause" ), "<control>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" ), "<shift>Delete", NULL, G_CALLBACK( action_cb ) },
     { "new-torrent", GTK_STOCK_NEW, N_( "_New..." ), NULL, N_( "Create a torrent" ), G_CALLBACK( action_cb ) },
index 8b3f0722df2c0cc5b4fa1e31f53811d0ed3ee728..c999c0ae21447e4a3897d23bc1a88ee4ae9f3ae1 100644 (file)
@@ -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 );
 
index 2f3ff5664949fc1417a8e280636929362463bc30..9374706283de1650de3c525a7d97dbbb7251baef 100644 (file)
--- 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<int>)), mySession, SLOT(initTorrents(QSet<int>)) );
-    connect( myModel, SIGNAL(torrentsAdded(QSet<int>)), this, SLOT(torrentsAdded(QSet<int>)) );
+    connect( myModel, SIGNAL(torrentsAdded(QSet<int>)), this, SLOT(onTorrentsAdded(QSet<int>)) );
 
     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<int> torrents )
+MyApp :: onTorrentsAdded( QSet<int> 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)) );
     }
 }
 
index eb6867f305a9d2653296d091b8d00afe60b4d574..3e4df0d3d59e6d04f31d7afe22720937b4b4fb05 100644 (file)
--- 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<int> );
-        void torrentChanged( int );
+        void onTorrentsAdded( QSet<int> );
+        void onNewTorrentChanged( int );
 
     public slots:
         void addTorrent( const QString& );
index 189a37c86825ab4d94ac28a1b09d85c3f22edbec..846c98b632e41fc8210c2e267e17378f1a6cb6d3 100644 (file)
@@ -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 );
index c699f7aaf6a48c4b4fe49430f1dc63abdf737841..39815b172b15a3cce0bb0407246f59fb6b631975 100644 (file)
@@ -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( );
index 8cb0bfbb0f3c51cfa4703edc63a42bd7b0402ea1..802ff8cd768dff9f3b4fee0fd394b0216476785f 100644 (file)
@@ -96,6 +96,8 @@
     </property>
     <addaction name="action_Statistics"/>
     <addaction name="separator"/>
+    <addaction name="action_Donate"/>
+    <addaction name="separator"/>
     <addaction name="action_Contents"/>
     <addaction name="action_About"/>
    </widget>
     <addaction name="action_Toolbar"/>
     <addaction name="action_Filterbar"/>
     <addaction name="action_Statusbar"/>
-    <addaction name="action_TrayIcon"/>
     <addaction name="separator"/>
     <addaction name="action_SortByActivity"/>
     <addaction name="action_SortByAge"/>
    <property name="text">
     <string>&amp;Contents</string>
    </property>
+   <property name="shortcut">
+    <string>F1</string>
+   </property>
   </action>
   <action name="action_About">
    <property name="text">
     <string>Add &amp;URL...</string>
    </property>
   </action>
+  <action name="action_Donate">
+   <property name="text">
+    <string>&amp;Donate</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="application.qrc"/>
index 1b0b3442d07db002bebc81ceaa031d4f3832497e..b715626fedac6ee040c630a6b3395c791f7b1bac 100644 (file)
@@ -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( "<small>Override normal speed limits manually or at scheduled times</small>" );
         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 &notification 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<QCheckBox*>(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<QCheckBox*>(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 );
index 82f9492f57f03d3e5e832b97035357639ad0bc33..394b47cbc4dedb8c8473a239d1cbeadb315b39d0 100644 (file)
@@ -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( );