aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-07-21 15:26:02 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-07-21 15:26:02 +0000
commitab49308ad778ddc4822cda48e218fbc06f7b8e34 (patch)
tree6a315cbb2b9dff0d5590d5d28ec4c3d6c9868b0d /src/qmmpui
parent0006966c0f307ec7dff51130ce26bbe3c7061418 (diff)
downloadqmmp-ab49308ad778ddc4822cda48e218fbc06f7b8e34.tar.gz
qmmp-ab49308ad778ddc4822cda48e218fbc06f7b8e34.tar.bz2
qmmp-ab49308ad778ddc4822cda48e218fbc06f7b8e34.zip
fixed command line translation
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8197 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui')
-rw-r--r--src/qmmpui/commandlinemanager.cpp10
-rw-r--r--src/qmmpui/commandlineoption.h25
2 files changed, 24 insertions, 11 deletions
diff --git a/src/qmmpui/commandlinemanager.cpp b/src/qmmpui/commandlinemanager.cpp
index fb672e335..08424fa41 100644
--- a/src/qmmpui/commandlinemanager.cpp
+++ b/src/qmmpui/commandlinemanager.cpp
@@ -23,6 +23,7 @@
#include <QObject>
#include <QList>
#include <QApplication>
+#include <QTranslator>
#include <cstdlib>
#include <iostream>
#include <qmmp/qmmp.h>
@@ -60,7 +61,12 @@ void CommandLineManager::checkOptions()
{
m_options->append(option);
m_files->insert(option, filePath);
- //qApp->installTranslator(option->createTranslator(qApp));
+ if(!option->properties().translation.isEmpty())
+ {
+ QTranslator *translator = new QTranslator(qApp);
+ translator->load(option->properties().translation + Qmmp::systemLanguageID());
+ qApp->installTranslator(translator);
+ }
}
}
}
@@ -100,7 +106,7 @@ void CommandLineManager::printUsage()
checkOptions();
foreach(CommandLineOption *opt, *m_options)
{
- foreach (QString line, opt->helpString())
+ foreach(QString line, opt->properties().helpString)
{
QString str = formatHelpString(line);
if(!str.isEmpty())
diff --git a/src/qmmpui/commandlineoption.h b/src/qmmpui/commandlineoption.h
index 6e1a52638..f6f67d5e5 100644
--- a/src/qmmpui/commandlineoption.h
+++ b/src/qmmpui/commandlineoption.h
@@ -27,6 +27,18 @@ class QString;
class QObject;
class QStringList;
+/*! @brief Helper class to store command line plugin properties.
+ * @author Ilya Kotov <forkotov02@ya.ru>
+ */
+class CommandLineProperties
+{
+public:
+ QString shortName; /*!< Input plugin short name for internal usage */
+ QString translation; /*!< Translation file path without locale code and extension */
+ QStringList helpString; /*!< A list of specially formatted help strings.
+ Example: "--help||Display this text and exit" */
+};
+
/*! @brief Abstract base class of the command line plugins.
* @author Vladimir Kuznetsov <vovanec@gmail.ru>
*/
@@ -34,20 +46,15 @@ class QMMPUI_EXPORT CommandLineOption
{
public:
/*!
+ * Returns command line plugin properties.
+ */
+ virtual const CommandLineProperties properties() const = 0;
+ /*!
* Returns \b true if \b opt_str string can be processed,
* otherise \b false
*/
virtual bool identify(const QString& opt_str) const = 0;
/*!
- * Command line option name
- */
- virtual const QString name() const = 0;
- /*!
- * A list of specially formatted help strings.
- * Example: "--help||Display this text and exit".
- */
- virtual const QStringList helpString() const = 0;
- /*!
* Parses \b opt_str args(if needed), executes command.
* @param opt_str Command to execute
* @param args Command arguments