]> git.sesse.net Git - vlc/commitdiff
a macro to automate the choice of "folder"/"directory" string version according to...
authorJakob Leben <jleben@videolan.org>
Tue, 23 Feb 2010 16:24:53 +0000 (17:24 +0100)
committerJakob Leben <jleben@videolan.org>
Tue, 23 Feb 2010 16:27:56 +0000 (17:27 +0100)
include/vlc_intf_strings.h
modules/gui/qt4/components/open_panels.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/sout/sout_widgets.cpp
modules/gui/qt4/dialogs/help.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.hpp

index 7609f95775062ee93f3e64505f3e4420715e6904..9f6367f7e345d90e34c7181ea379c2b6e22c3eef 100644 (file)
  * This file defines a number of strings used in user interfaces
  */
 
+/* A helper macro that will expand to either of the arguments
+   depanding on platform. The arguments are supposed to be:
+   1. dir: a string containing "directory"
+   2. folder: a string with the same meaning but with directory
+              substituted with "folder"
+*/
+#if defined( WIN32 ) || defined(__APPLE__)
+    #define I_DIR_OR_FOLDER( dir, folder ) folder
+#else
+    #define I_DIR_OR_FOLDER( dir, folder ) dir
+#endif
+
 /*************** Open dialogs **************/
 
 #define I_OP_OPF        N_("Quick &Open File...")
 #define I_OP_ADVOP      N_("&Advanced Open...")
-#define I_OP_OPDIR      N_("Open &Directory...")
-
+#define I_OP_OPDIR I_DIR_OR_FOLDER( N_("Open D&irectory..."), \
+                                    N_("Open &Folder...") )
 #define I_OP_SEL_FILES  N_("Select one or more files to open")
+#define I_OP_SEL_DIR   I_DIR_OR_FOLDER( N_("Select Directory"), N_("Select Folder") )
 
 /******************* Menus *****************/
 
 #define I_POP_DEL N_("Delete")
 #define I_POP_INFO N_("Information...")
 #define I_POP_SORT N_("Sort")
-#define I_POP_NEWFOLDER N_("Create Folder...")
+#define I_POP_NEWFOLDER I_DIR_OR_FOLDER( N_("Create Directory..."), \
+                                         N_("Create Folder...") )
+#define I_POP_EXPLORE I_DIR_OR_FOLDER( N_("Show Containing Directory..."), \
+                                       N_("Show Containing Folder...") )
 #define I_POP_STREAM N_("Stream...")
 #define I_POP_SAVE N_("Save...")
-#define I_POP_EXPLORE N_("Show Containing Folder...")
+
 
 /*************** Playlist *************/
 
@@ -73,7 +89,8 @@
 
 #define I_PL_ADDF       N_("Add File...")
 #define I_PL_ADVADD     N_("Advanced Open...")
-#define I_PL_ADDDIR     N_("Add Folder...")
+#define I_PL_ADDDIR     I_DIR_OR_FOLDER( N_("Add Directory..."), \
+                                         N_("Add Folder...") )
 
 #define I_PL_SAVE       N_("Save Playlist to &File...")
 #define I_PL_LOAD       N_("Open Play&list...")
index dea7827e2eea8a8587691fbe2c4a07a09430debb..7593a84e2ae6f407d94a7587ec16bec8b0b99f3c 100644 (file)
@@ -35,6 +35,7 @@
 #include "dialogs/open.hpp"
 #include "dialogs_provider.hpp" /* Open Subtitle file */
 #include "util/qt_dirs.hpp"
+#include <vlc_intf_strings.h>
 
 #include <QFileDialog>
 #include <QDialogButtonBox>
 #include <QUrl>
 #include <QStringListModel>
 
-#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory")
+
+#define I_DEVICE_TOOLTIP \
+    I_DIR_OR_FOLDER( N_("Select a device or a VIDEO_TS directory"), \
+                     N_("Select a device or a VIDEO_TS folder") )
 
 static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
                                        "dshow", "screen", "jack" };
index 8345c0e7227d3403f0736c9905f054a8e6426729..39f10343fe35effdd1942a5c1af3e5e48bf4049c 100644 (file)
 #include <QMenu>
 #include <QApplication>
 #include <QSettings>
+#include <QUrl>
+#include <QFileInfo>
+#include <QDesktopServices>
+#include <QInputDialog>
 
 #include "sorting.h"
 
+#define I_NEW_DIR \
+    I_DIR_OR_FOLDER( N_("Create Directory"), N_( "Create Folder" ) )
+#define I_NEW_DIR_NAME \
+    I_DIR_OR_FOLDER( N_( "Enter name for new directory:" ), \
+                     N_( "Enter name for new folder:" ) )
+
 QIcon PLModel::icons[ITEM_TYPE_NUMBER];
 
 /*************************************************************************
@@ -993,9 +1003,6 @@ void PLModel::popupSave()
         THEDP->streamingDialog( NULL, mrls[0] );
 }
 
-#include <QUrl>
-#include <QFileInfo>
-#include <QDesktopServices>
 void PLModel::popupExplore()
 {
     PL_LOCK;
@@ -1028,12 +1035,11 @@ void PLModel::popupExplore()
         PL_UNLOCK;
 }
 
-#include <QInputDialog>
 void PLModel::popupAddNode()
 {
     bool ok;
     QString name = QInputDialog::getText( PlaylistDialog::getInstance( p_intf ),
-        qtr( "Create Folder" ), qtr( "Enter name for new folder:" ),
+        qtr( I_NEW_DIR ), qtr( I_NEW_DIR_NAME ),
         QLineEdit::Normal, QString(), &ok);
     if( !ok || name.isEmpty() ) return;
     PL_LOCK;
index a7eac990b23c485752f69c84db317565d85fd0d1..4f9f21f999a26946852314967c622992cf222d94 100644 (file)
@@ -38,6 +38,7 @@
 #include "util/customwidgets.hpp"
 #include "util/qt_dirs.hpp"
 #include <vlc_keys.h>
+#include <vlc_intf_strings.h>
 
 #include <QString>
 #include <QVariant>
@@ -357,7 +358,7 @@ DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
 void DirectoryConfigControl::updateField()
 {
     QString dir = QFileDialog::getExistingDirectory( NULL,
-                      qtr( "Select Directory" ),
+                      qtr( I_OP_SEL_DIR ),
                       text->text().isEmpty() ?
                         QVLCUserDir( VLC_HOME_DIR ) : text->text(),
                   QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks );
index 799fc082a4578fd41bdbebd5486f69a128e58acc..3be195cedb0b6ccaa098f9bd639b68a654fb5e5e 100644 (file)
@@ -27,6 +27,7 @@
 #include "components/sout/sout_widgets.hpp"
 #include "dialogs/sout.hpp"
 #include "util/qt_dirs.hpp"
+#include <vlc_intf_strings.h>
 
 #include <QGroupBox>
 #include <QGridLayout>
@@ -34,6 +35,9 @@
 #include <QLineEdit>
 #include <QFileDialog>
 
+#define I_FILE_SLASH_DIR \
+    I_DIR_OR_FOLDER( N_("File/Directory"), N_("File/Folder") )
+
 SoutInputBox::SoutInputBox( QWidget *_parent, const QString& mrl ) : QGroupBox( _parent )
 {
     /**
@@ -72,7 +76,7 @@ void SoutInputBox::setMRL( const QString& mrl )
         type = mrl.left( i );
     }
     else
-        type = qtr( "File/Directory" );
+        type = qtr( I_FILE_SLASH_DIR );
     sourceValueLabel->setText( type );
 }
 
index 73cdf96aba42247ab1cbb498879bc34d0437807a..9a56d0e59981ab607d6f9296a47fcd91aabd3a8f 100644 (file)
@@ -268,7 +268,7 @@ void UpdateDialog::UpdateOrDownload()
     else
     {
         QString dest_dir = QFileDialog::getExistingDirectory( this,
-                                 qtr( "Select a directory..." ),
+                                 qtr( I_OP_SEL_DIR ),
                                  QVLCUserDir( VLC_DOWNLOAD_DIR ) );
 
         if( !dest_dir.isEmpty() )
index 815603999a423d7409b11ed91d8a72fb55e745e7..0c6cfdf81c2a1b347c6088d89523d9a09bc7c291 100644 (file)
@@ -61,6 +61,8 @@
 #include <QSignalMapper>
 #include <QFileDialog>
 
+#define I_OP_DIR_WINTITLE I_DIR_OR_FOLDER( N_("Open Directory"), \
+                                           N_("Open Folder") )
 
 DialogsProvider* DialogsProvider::instance = NULL;
 
@@ -488,7 +490,7 @@ void DialogsProvider::openUrlDialog()
  **/
 static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
 {
-    QString dir = QFileDialog::getExistingDirectory( NULL, qtr("Open Directory"), p_intf->p_sys->filepath );
+    QString dir = QFileDialog::getExistingDirectory( NULL, qtr( I_OP_DIR_WINTITLE ), p_intf->p_sys->filepath );
 
     if (!dir.isEmpty() )
     {
index 2f5a0168ec1e25a4e9c9f86a116d664e4ff6cf06..52264d5fdf7eb32c622d184cdcfc1bf738229b65 100644 (file)
@@ -313,7 +313,7 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf, QWidget *parent )
         ":/type/file-asym", SLOT( simpleOpenDialog() ), "Ctrl+O" );
     addDPStaticEntry( menu, qtr( "Advanced Open File..." ),
         ":/type/file-asym", SLOT( openFileDialog() ), "Ctrl+Shift+O" );
-    addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ),
+    addDPStaticEntry( menu, qtr( I_OP_OPDIR ),
         ":/type/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" );
     addDPStaticEntry( menu, qtr( "Open &Disc..." ),
         ":/type/disc", SLOT( openDiscDialog() ), "Ctrl+D" );
@@ -853,7 +853,7 @@ void QVLCMenu::PopupMenuStaticEntries( QMenu *menu )
     QMenu *openmenu = new QMenu( qtr( "Open Media" ), menu );
     addDPStaticEntry( openmenu, qtr( "&Open File..." ),
         ":/type/file-asym", SLOT( openFileDialog() ) );
-    addDPStaticEntry( openmenu, qtr( I_OPEN_FOLDER ),
+    addDPStaticEntry( openmenu, qtr( I_OP_OPDIR ),
         ":/type/folder-grey", SLOT( PLOpenDir() ) );
     addDPStaticEntry( openmenu, qtr( "Open &Disc..." ),
         ":/type/disc", SLOT( openDiscDialog() ) );
index 9fa4f587336f3afa37b9cb9419196b0775c72566..3d86a98c89ae6b3bdfa10b72724365111b6b37a2 100644 (file)
 #include <QAction>
 #include <vector>
 
-/* Folder vs. Directory */
-#if defined( WIN32 ) || defined(__APPLE__)
-#define I_OPEN_FOLDER N_("Open &Folder...")
-#else
-#define I_OPEN_FOLDER N_("Open D&irectory...")
-#endif //WIN32
-
 using namespace std;
 
 class QMenu;