(trunk) #3926: use "Open Torrent" instead of "Add Torrent" in GTK+ and Qt clients -- text changed.

This commit is contained in:
Jordan Lee 2011-01-20 19:48:13 +00:00
parent bcb83b4577
commit 131afcc3a4
10 changed files with 59 additions and 56 deletions

View File

@ -107,9 +107,9 @@ static GtkActionEntry entries[] =
{ "edit-menu", NULL, N_( "_Edit" ), NULL, NULL, NULL },
{ "help-menu", NULL, N_( "_Help" ), NULL, NULL, NULL },
{ "copy-magnet-link-to-clipboard", GTK_STOCK_COPY, N_("Copy _Magnet Link to Clipboard" ), "<control>M", NULL, G_CALLBACK( action_cb ) },
{ "add-torrent-from-url", GTK_STOCK_ADD, N_("Add _URL..." ), NULL, N_( "Add URL..." ), G_CALLBACK( action_cb ) },
{ "add-torrent-toolbar", GTK_STOCK_ADD, NULL, NULL, N_( "Add a torrent" ), G_CALLBACK( action_cb ) },
{ "add-torrent-menu", GTK_STOCK_ADD, N_( "_Add File..." ), "<control>D", N_( "Add a torrent" ), G_CALLBACK( action_cb ) },
{ "open-torrent-from-url", GTK_STOCK_OPEN, N_("Open _URL..." ), "<control>U", N_( "Open URL..." ), G_CALLBACK( action_cb ) },
{ "open-torrent-toolbar", GTK_STOCK_OPEN, NULL, NULL, N_( "Open a torrent" ), G_CALLBACK( action_cb ) },
{ "open-torrent-menu", GTK_STOCK_OPEN, NULL, NULL, N_( "Open a torrent" ), G_CALLBACK( action_cb ) },
{ "start-torrent", GTK_STOCK_MEDIA_PLAY, N_( "_Start" ), "<control>S", N_( "Start torrent" ), G_CALLBACK( action_cb ) },
{ "show-stats", NULL, N_( "_Statistics" ), NULL, NULL, G_CALLBACK( action_cb ) },
{ "donate", NULL, N_( "_Donate" ), NULL, NULL, G_CALLBACK( action_cb ) },

View File

@ -86,7 +86,7 @@ save_recent_destination( TrCore * core, const char * dir )
*****
****/
struct AddData
struct OpenData
{
TrCore * core;
GtkWidget * file_list;
@ -100,7 +100,7 @@ struct AddData
};
static void
removeOldTorrent( struct AddData * data )
removeOldTorrent( struct OpenData * data )
{
if( data->gtor )
{
@ -116,7 +116,7 @@ addResponseCB( GtkDialog * dialog,
gint response,
gpointer gdata )
{
struct AddData * data = gdata;
struct OpenData * data = gdata;
if( data->gtor )
{
@ -150,7 +150,7 @@ addResponseCB( GtkDialog * dialog,
}
static void
updateTorrent( struct AddData * o )
updateTorrent( struct OpenData * o )
{
const gboolean isLocalFile = tr_ctorGetSourceFile( o->ctor ) != NULL;
gtk_widget_set_sensitive( o->trash_check, isLocalFile );
@ -180,7 +180,7 @@ updateTorrent( struct AddData * o )
static void
sourceChanged( GtkFileChooserButton * b, gpointer gdata )
{
struct AddData * data = gdata;
struct OpenData * data = gdata;
char * filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( b ) );
/* maybe instantiate a torrent */
@ -221,7 +221,7 @@ sourceChanged( GtkFileChooserButton * b, gpointer gdata )
static void
downloadDirChanged( GtkFileChooserButton * b, gpointer gdata )
{
struct AddData * data = gdata;
struct OpenData * data = gdata;
char * fname = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( b ) );
if( fname && ( !data->downloadDir || !tr_is_same_file( fname, data->downloadDir ) ) )
@ -266,7 +266,7 @@ gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * cto
GtkWidget * l;
GtkWidget * grab;
GtkWidget * source_chooser;
struct AddData * data;
struct OpenData * data;
uint8_t flag;
GSList * list;
GSList * walk;
@ -276,7 +276,7 @@ gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * cto
GTK_DIALOG_DESTROY_WITH_PARENT,
NULL );
gtk_dialog_add_button( GTK_DIALOG( d ), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL );
grab = gtk_dialog_add_button( GTK_DIALOG( d ), GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT );
grab = gtk_dialog_add_button( GTK_DIALOG( d ), GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT );
gtk_dialog_set_default_response( GTK_DIALOG( d ),
GTK_RESPONSE_ACCEPT );
gtk_dialog_set_alternative_button_order( GTK_DIALOG( d ),
@ -288,7 +288,7 @@ gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * cto
g_assert_not_reached( );
g_assert( str );
data = g_new0( struct AddData, 1 );
data = g_new0( struct OpenData, 1 );
data->core = core;
data->ctor = ctor;
data->filename = g_strdup( tr_ctorGetSourceFile( ctor ) );
@ -393,9 +393,7 @@ gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * cto
****/
static void
onAddDialogResponse( GtkDialog * dialog,
int response,
gpointer core )
onOpenDialogResponse( GtkDialog * dialog, int response, gpointer core )
{
char * folder;
@ -421,16 +419,16 @@ onAddDialogResponse( GtkDialog * dialog,
}
GtkWidget*
gtr_torrent_add_from_file_dialog_new( GtkWindow * parent, TrCore * core )
gtr_torrent_open_from_file_dialog_new( GtkWindow * parent, TrCore * core )
{
GtkWidget * w;
GtkWidget * c;
const char * folder;
w = gtk_file_chooser_dialog_new( _( "Add a Torrent" ), parent,
w = gtk_file_chooser_dialog_new( _( "Open a Torrent" ), parent,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL );
gtk_dialog_set_alternative_button_order( GTK_DIALOG( w ),
GTK_RESPONSE_ACCEPT,
@ -438,8 +436,7 @@ gtr_torrent_add_from_file_dialog_new( GtkWindow * parent, TrCore * core )
-1 );
gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( w ), TRUE );
addTorrentFilters( GTK_FILE_CHOOSER( w ) );
g_signal_connect( w, "response", G_CALLBACK(
onAddDialogResponse ), core );
g_signal_connect( w, "response", G_CALLBACK( onOpenDialogResponse ), core );
if( ( folder = gtr_pref_string_get( PREF_KEY_OPEN_DIALOG_FOLDER ) ) )
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( w ), folder );
@ -458,7 +455,7 @@ gtr_torrent_add_from_file_dialog_new( GtkWindow * parent, TrCore * core )
***/
static void
onAddURLResponse( GtkDialog * dialog, int response, gpointer user_data )
onOpenURLResponse( GtkDialog * dialog, int response, gpointer user_data )
{
gboolean destroy = TRUE;
@ -492,27 +489,27 @@ onAddURLResponse( GtkDialog * dialog, int response, gpointer user_data )
}
GtkWidget*
gtr_torrent_add_from_url_dialog_new( GtkWindow * parent, TrCore * core )
gtr_torrent_open_from_url_dialog_new( GtkWindow * parent, TrCore * core )
{
int row;
GtkWidget * e;
GtkWidget * t;
GtkWidget * w;
w = gtk_dialog_new_with_buttons( _( "Add URL" ), parent,
w = gtk_dialog_new_with_buttons( _( "Open URL" ), parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL );
gtk_dialog_set_alternative_button_order( GTK_DIALOG( w ),
GTK_RESPONSE_ACCEPT,
GTK_RESPONSE_CANCEL,
-1 );
g_signal_connect( w, "response", G_CALLBACK( onAddURLResponse ), core );
g_signal_connect( w, "response", G_CALLBACK( onOpenURLResponse ), core );
row = 0;
t = hig_workarea_create( );
hig_workarea_add_section_title( t, &row, _( "Add torrent from URL" ) );
hig_workarea_add_section_title( t, &row, _( "Open torrent from URL" ) );
e = gtk_entry_new( );
gtk_widget_set_size_request( e, 400, -1 );
gtr_paste_clipboard_url_into_entry( e );

View File

@ -10,14 +10,14 @@
* $Id$
*/
#ifndef GTR_ADD_DIALOG_H
#define GTR_ADD_DIALOG_H
#ifndef GTR_OPEN_DIALOG_H
#define GTR_OPEN_DIALOG_H
#include <gtk/gtk.h>
#include "tr-core.h"
GtkWidget* gtr_torrent_add_from_url_dialog_new ( GtkWindow * parent, TrCore * core );
GtkWidget* gtr_torrent_add_from_file_dialog_new( GtkWindow * parent, TrCore * core );
GtkWidget* gtr_torrent_open_from_url_dialog_new ( GtkWindow * parent, TrCore * core );
GtkWidget* gtr_torrent_open_from_file_dialog_new( GtkWindow * parent, TrCore * core );
/* This dialog assumes ownership of the ctor */
GtkWidget* gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * ctor );

View File

@ -1702,15 +1702,15 @@ gtr_actions_handler( const char * action_name, gpointer user_data )
struct cbdata * data = user_data;
gboolean changed = FALSE;
if( !strcmp( action_name, "add-torrent-from-url" ) )
if( !strcmp( action_name, "open-torrent-from-url" ) )
{
GtkWidget * w = gtr_torrent_add_from_url_dialog_new( data->wind, data->core );
GtkWidget * w = gtr_torrent_open_from_url_dialog_new( data->wind, data->core );
gtk_widget_show( w );
}
else if( !strcmp( action_name, "add-torrent-menu" )
|| !strcmp( action_name, "add-torrent-toolbar" ) )
else if( !strcmp( action_name, "open-torrent-menu" )
|| !strcmp( action_name, "open-torrent-toolbar" ) )
{
GtkWidget * w = gtr_torrent_add_from_file_dialog_new( data->wind, data->core );
GtkWidget * w = gtr_torrent_open_from_file_dialog_new( data->wind, data->core );
gtk_widget_show( w );
}
else if( !strcmp( action_name, "show-stats" ) )

View File

@ -607,7 +607,7 @@ gtr_window_new( GtkUIManager * ui_mgr, TrCore * core )
/* toolbar */
toolbar = p->toolbar = gtr_action_get_widget( "/main-window-toolbar" );
gtr_action_set_important( "add-torrent-toolbar", TRUE );
gtr_action_set_important( "open-torrent-toolbar", TRUE );
gtr_action_set_important( "show-torrent-properties", TRUE );
/* filter */

View File

@ -2,8 +2,8 @@ static const char * fallback_ui_file =
"<ui>\n"
" <menubar name='main-window-menu'>\n"
" <menu action='file-menu'>\n"
" <menuitem action='add-torrent-menu'/>\n"
" <menuitem action='add-torrent-from-url'/>\n"
" <menuitem action='open-torrent-menu'/>\n"
" <menuitem action='open-torrent-from-url'/>\n"
" <menuitem action='new-torrent'/>\n"
" <separator/>\n"
" <menuitem action='start-all-torrents'/>\n"
@ -62,7 +62,7 @@ static const char * fallback_ui_file =
" </menubar>\n"
"\n"
" <toolbar name='main-window-toolbar'>\n"
" <toolitem action='add-torrent-toolbar'/>\n"
" <toolitem action='open-torrent-toolbar'/>\n"
" <toolitem action='start-torrent'/>\n"
" <toolitem action='pause-torrent'/>\n"
" <toolitem action='remove-torrent'/>\n"
@ -102,8 +102,8 @@ static const char * fallback_ui_file =
" <popup name='icon-popup'>\n"
" <menuitem action='toggle-main-window'/>\n"
" <separator/>\n"
" <menuitem action='add-torrent-menu'/>\n"
" <menuitem action='add-torrent-from-url'/>\n"
" <menuitem action='open-torrent-menu'/>\n"
" <menuitem action='open-torrent-from-url'/>\n"
" <separator/>\n"
" <menuitem action='pause-all-torrents'/>\n"
" <menuitem action='start-all-torrents'/>\n"

View File

@ -104,7 +104,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
const QSize smallIconSize( i, i );
// icons
ui.action_AddFile->setIcon( getStockIcon( "list-add", QStyle::SP_DialogOpenButton ) );
ui.action_OpenFile->setIcon( getStockIcon( "folder-open", QStyle::SP_DialogOpenButton ) );
ui.action_New->setIcon( getStockIcon( "document-new", QStyle::SP_DesktopIcon ) );
ui.action_Properties->setIcon( getStockIcon( "document-properties", QStyle::SP_DesktopIcon ) );
ui.action_OpenFolder->setIcon( getStockIcon( "folder-open", QStyle::SP_DirOpenIcon ) );
@ -144,7 +144,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
connect( ui.action_Announce, SIGNAL(triggered()), this, SLOT(reannounceSelected()) );
connect( ui.action_StartAll, SIGNAL(triggered()), this, SLOT(startAll()));
connect( ui.action_PauseAll, SIGNAL(triggered()), this, SLOT(pauseAll()));
connect( ui.action_AddFile, SIGNAL(triggered()), this, SLOT(openTorrent()));
connect( ui.action_OpenFile, SIGNAL(triggered()), this, SLOT(openTorrent()));
connect( ui.action_AddURL, SIGNAL(triggered()), this, SLOT(openURL()));
connect( ui.action_New, SIGNAL(triggered()), this, SLOT(newTorrent()));
connect( ui.action_Preferences, SIGNAL(triggered()), this, SLOT(openPreferences()));
@ -214,7 +214,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
actionGroup->addAction( ui.action_SortByState );
QMenu * menu = new QMenu( );
menu->addAction( ui.action_AddFile );
menu->addAction( ui.action_OpenFile );
menu->addAction( ui.action_AddURL );
menu->addSeparator( );
menu->addAction( ui.action_ShowMainWindow );
@ -1027,7 +1027,7 @@ TrMainWindow :: openTorrent( )
{
QFileDialog * myFileDialog;
myFileDialog = new QFileDialog( this,
tr( "Add Torrent" ),
tr( "Open Torrent" ),
myPrefs.getString( Prefs::OPEN_DIALOG_FOLDER ),
tr( "Torrent Files (*.torrent);;All Files (*.*)" ) );
myFileDialog->setFileMode( QFileDialog::ExistingFiles );

View File

@ -126,7 +126,7 @@
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="action_AddFile"/>
<addaction name="action_OpenFile"/>
<addaction name="action_AddURL"/>
<addaction name="action_New"/>
<addaction name="separator"/>
@ -169,22 +169,22 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="action_AddFile"/>
<addaction name="action_OpenFile"/>
<addaction name="action_Start"/>
<addaction name="action_Pause"/>
<addaction name="action_Remove"/>
<addaction name="separator"/>
<addaction name="action_Properties"/>
</widget>
<action name="action_AddFile">
<action name="action_OpenFile">
<property name="text">
<string>&amp;Add File...</string>
<string>&amp;Open...</string>
</property>
<property name="iconText">
<string>Add</string>
<string>Open</string>
</property>
<property name="toolTip">
<string>Add a torrent</string>
<string>Open a torrent</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
@ -266,6 +266,9 @@
<property name="toolTip">
<string>Verify local data</string>
</property>
<property name="shortcut">
<string>Ctrl+V</string>
</property>
</action>
<action name="action_Remove">
<property name="text">
@ -573,7 +576,10 @@
</action>
<action name="action_AddURL">
<property name="text">
<string>Add &amp;URL...</string>
<string>Open &amp;URL...</string>
</property>
<property name="shortcut">
<string>Ctrl+U</string>
</property>
</action>
<action name="action_Donate">

View File

@ -87,7 +87,7 @@ Options :: Options( Session& session, const Prefs& prefs, const AddData& addme,
myVerifyHash( QCryptographicHash::Sha1 )
{
setWindowTitle( tr( "Add Torrent" ) );
setWindowTitle( tr( "Open Torrent" ) );
QFontMetrics fontMetrics( font( ) );
QGridLayout * layout = new QGridLayout( this );
int row = 0;
@ -159,7 +159,7 @@ Options :: Options( Session& session, const Prefs& prefs, const AddData& addme,
c->setChecked( prefs.getBool( Prefs :: TRASH_ORIGINAL ) );
layout->addWidget( c, ++row, 0, 1, 2, Qt::AlignLeft );
QDialogButtonBox * b = new QDialogButtonBox( QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, this );
QDialogButtonBox * b = new QDialogButtonBox( QDialogButtonBox::Open|QDialogButtonBox::Cancel, Qt::Horizontal, this );
connect( b, SIGNAL(rejected()), this, SLOT(deleteLater()) );
connect( b, SIGNAL(accepted()), this, SLOT(onAccepted()) );
layout->addWidget( b, ++row, 0, 1, 2 );
@ -401,7 +401,7 @@ Options :: onFilenameClicked( )
if( myAdd.type == AddData::FILENAME )
{
QFileDialog * d = new QFileDialog( this,
tr( "Add Torrent" ),
tr( "Open Torrent" ),
QFileInfo(myAdd.filename).absolutePath(),
tr( "Torrent Files (*.torrent);;All Files (*.*)" ) );
d->setFileMode( QFileDialog::ExistingFile );

View File

@ -16,7 +16,7 @@ QT += network
PKGCONFIG = fontconfig libcurl openssl dbus-1
# if you have libevent2 installed in a custom path, specify it here
EVENT_TOP = /usr
EVENT_TOP = /home/charles/opt/libevent
INCLUDEPATH = $${EVENT_TOP}/include $${INCLUDEPATH}
TRANSMISSION_TOP = ..