From 2d833f47171ad6ed35da3aeb34d753ff1f2a34ca Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 4 Mar 2010 16:31:05 +0000 Subject: added seek support for command line interface (Closes issue 121) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1598 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/CommandLineOptions/CMakeLists.txt | 2 +- .../CommandLineOptions/CommandLineOptions.pro | 4 +- .../CommandLineOptions/SeekOption/CMakeLists.txt | 52 +++++++++++++ .../CommandLineOptions/SeekOption/SeekOption.pro | 39 ++++++++++ .../CommandLineOptions/SeekOption/seekoption.cpp | 89 ++++++++++++++++++++++ .../CommandLineOptions/SeekOption/seekoption.h | 44 +++++++++++ .../SeekOption/translations/seek_plugin_cs.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_de.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_it.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_lt.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_pl.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_ru.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_tr.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_uk_UA.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_zh_CN.ts | 22 ++++++ .../SeekOption/translations/seek_plugin_zh_TW.ts | 22 ++++++ .../SeekOption/translations/translations.qrc | 15 ++++ src/ui/translations/qmmp_ru.ts | 2 +- 18 files changed, 464 insertions(+), 3 deletions(-) create mode 100644 src/plugins/CommandLineOptions/SeekOption/CMakeLists.txt create mode 100644 src/plugins/CommandLineOptions/SeekOption/SeekOption.pro create mode 100644 src/plugins/CommandLineOptions/SeekOption/seekoption.cpp create mode 100644 src/plugins/CommandLineOptions/SeekOption/seekoption.h create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_cs.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_de.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_it.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_lt.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_pl.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_ru.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_tr.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_uk_UA.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_zh_CN.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/seek_plugin_zh_TW.ts create mode 100644 src/plugins/CommandLineOptions/SeekOption/translations/translations.qrc (limited to 'src') diff --git a/src/plugins/CommandLineOptions/CMakeLists.txt b/src/plugins/CommandLineOptions/CMakeLists.txt index 594671745..558dfd0ea 100644 --- a/src/plugins/CommandLineOptions/CMakeLists.txt +++ b/src/plugins/CommandLineOptions/CMakeLists.txt @@ -1,2 +1,2 @@ add_subdirectory(IncDecVolumeOption) - +add_subdirectory(SeekOption) diff --git a/src/plugins/CommandLineOptions/CommandLineOptions.pro b/src/plugins/CommandLineOptions/CommandLineOptions.pro index 1832a0166..1f4ed9c33 100644 --- a/src/plugins/CommandLineOptions/CommandLineOptions.pro +++ b/src/plugins/CommandLineOptions/CommandLineOptions.pro @@ -1,2 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = IncDecVolumeOption +SUBDIRS = IncDecVolumeOption \ + SeekOption + diff --git a/src/plugins/CommandLineOptions/SeekOption/CMakeLists.txt b/src/plugins/CommandLineOptions/SeekOption/CMakeLists.txt new file mode 100644 index 000000000..6fdfdc123 --- /dev/null +++ b/src/plugins/CommandLineOptions/SeekOption/CMakeLists.txt @@ -0,0 +1,52 @@ +project(seekoption) + +cmake_minimum_required(VERSION 2.4.7) + +if(COMMAND cmake_policy) +cmake_policy(SET CMP0003 NEW) +endif(COMMAND cmake_policy) + + +# qt plugin +ADD_DEFINITIONS( -Wall ) +ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(-DQT_PLUGIN) +ADD_DEFINITIONS(-DQT_NO_DEBUG) +ADD_DEFINITIONS(-DQT_SHARED) +ADD_DEFINITIONS(-DQT_THREAD) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +SET(QT_INCLUDES + ${QT_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../ +) + +# libqmmpui +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmpui) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp) + +SET(seekoption_SRCS + seekoption.cpp +) + +SET(seekoption_MOC_HDRS + seekoption.h +) + +SET(seekoption_RCCS translations/translations.qrc) + +QT4_ADD_RESOURCES(seekoption_RCC_SRCS ${seekoption_RCCS}) + +QT4_WRAP_CPP(seekoption_MOC_SRCS ${seekoption_MOC_HDRS}) + + +# Don't forget to include output directory, otherwise +# the UI file won't be wrapped! +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +ADD_LIBRARY(seekoption MODULE ${seekoption_SRCS} ${seekoption_MOC_SRCS} ${seekoption_RCC_SRCS}) +add_dependencies(seekoption qmmpui) +target_link_libraries(seekoption ${QT_LIBRARIES} -lqmmpui -lqmmp) +install(TARGETS seekoption DESTINATION ${LIB_DIR}/qmmp/CommandLineOptions) diff --git a/src/plugins/CommandLineOptions/SeekOption/SeekOption.pro b/src/plugins/CommandLineOptions/SeekOption/SeekOption.pro new file mode 100644 index 000000000..617b91124 --- /dev/null +++ b/src/plugins/CommandLineOptions/SeekOption/SeekOption.pro @@ -0,0 +1,39 @@ +include(../../plugins.pri) + +CONFIG += release \ +warn_on \ +plugin \ + lib + +TARGET = $$PLUGINS_PREFIX/CommandLineOptions/seekoption +QMAKE_CLEAN = $$PLUGINS_PREFIX/CommandLineOptions/libseekoption.so + +TEMPLATE = lib +QMAKE_LIBDIR += ../../../../lib + +TRANSLATIONS = translations/seek_plugin_cs.ts \ + translations/seek_plugin_de.ts \ + translations/seek_plugin_pl.ts \ + translations/seek_plugin_ru.ts \ + translations/seek_plugin_uk_UA.ts \ + translations/seek_plugin_zh_TW.ts \ + translations/seek_plugin_zh_CN.ts \ + translations/seek_plugin_it.ts \ + translations/seek_plugin_tr.ts \ + translations/seek_plugin_lt.ts + +RESOURCES = translations/translations.qrc + +isEmpty(LIB_DIR){ + LIB_DIR = /lib +} +target.path = $$LIB_DIR/qmmp/CommandLineOptions +INSTALLS += target + +INCLUDEPATH += ../../../../src + +LIBS += -lqmmpui -lqmmp + +HEADERS += seekoption.h + +SOURCES += seekoption.cpp diff --git a/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp b/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp new file mode 100644 index 000000000..444bc73be --- /dev/null +++ b/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp @@ -0,0 +1,89 @@ +/*************************************************************************** + * Copyright (C) 2010 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include "seekoption.h" + +bool SeekOption::identify(const QString &str) const +{ + QStringList opts; + opts << "--seek" << "--seek-fwd" << "--seek-bwd"; + return opts.contains(str); +} + +const QString SeekOption::helpString() const +{ + QString help; + help += QString("--seek