(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
This commit is contained in:
Charles Kerr 2010-08-02 03:07:42 +00:00
parent 068cc733df
commit fb03acbbc2
9 changed files with 68 additions and 37 deletions

View 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 ) },

View 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 );

View File

@ -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)) );
}
}

View File

@ -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& );

View 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 );

View 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( );

View 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>
@ -108,7 +110,6 @@
<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"/>
@ -464,6 +465,9 @@
<property name="text">
<string>&amp;Contents</string>
</property>
<property name="shortcut">
<string>F1</string>
</property>
</action>
<action name="action_About">
<property name="text">
@ -573,6 +577,11 @@
<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"/>

View 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 );

View 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( );