Commit 544625f1 authored by Jakob Leben's avatar Jakob Leben

a macro to automate the choice of "folder"/"directory" string version according to platform

parent b904c184
......@@ -29,13 +29,26 @@
* 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 *****************/
......@@ -54,10 +67,13 @@
#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...")
......
......@@ -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>
......@@ -47,7 +48,10 @@
#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" };
......
......@@ -42,9 +42,19 @@
#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;
......
......@@ -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 );
......
......@@ -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 );
}
......
......@@ -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() )
......
......@@ -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() )
{
......
......@@ -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() ) );
......
......@@ -31,13 +31,6 @@
#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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment