diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-05-02 18:17:00 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-05-02 18:17:00 +0000 |
| commit | 2e2a47aa3d46cacf42f776138429fc2855874739 (patch) | |
| tree | 6b294dd8d7a8aad36884af8c6ba01c76ba9c6021 | |
| parent | d25fdc99931a393a19a78d8fdc6638322d3ca580 (diff) | |
| download | qmmp-2e2a47aa3d46cacf42f776138429fc2855874739.tar.gz qmmp-2e2a47aa3d46cacf42f776138429fc2855874739.tar.bz2 qmmp-2e2a47aa3d46cacf42f776138429fc2855874739.zip | |
creating file operations plugin structure
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@927 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | src/plugins/General/fileops/CMakeLists.txt | 68 | ||||
| -rw-r--r-- | src/plugins/General/fileops/Makefile | 247 | ||||
| -rw-r--r-- | src/plugins/General/fileops/fileops.cpp | 52 | ||||
| -rw-r--r-- | src/plugins/General/fileops/fileops.h | 57 | ||||
| -rw-r--r-- | src/plugins/General/fileops/fileops.pro | 44 | ||||
| -rw-r--r-- | src/plugins/General/fileops/fileopsfactory.cpp | 64 | ||||
| -rw-r--r-- | src/plugins/General/fileops/fileopsfactory.h | 45 | ||||
| -rw-r--r-- | src/plugins/General/fileops/settingsdialog.cpp | 110 | ||||
| -rw-r--r-- | src/plugins/General/fileops/settingsdialog.h | 82 | ||||
| -rw-r--r-- | src/plugins/General/fileops/settingsdialog.ui | 203 | ||||
| -rw-r--r-- | src/plugins/Input/cue/decoder_cue.cpp | 2 |
11 files changed, 973 insertions, 1 deletions
diff --git a/src/plugins/General/fileops/CMakeLists.txt b/src/plugins/General/fileops/CMakeLists.txt new file mode 100644 index 000000000..811f87031 --- /dev/null +++ b/src/plugins/General/fileops/CMakeLists.txt @@ -0,0 +1,68 @@ +project(liblyrics) + +cmake_minimum_required(VERSION 2.4.7) + +SET(QT_USE_QTNETWORK TRUE) +INCLUDE(FindQt4) + +include(${QT_USE_FILE}) + +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 & libqmmp +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmpui) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp) + +SET(liblyrics_SRCS + lyrics.cpp + lyricsfactory.cpp + lyricswindow.cpp +) + +SET(liblyrics_MOC_HDRS + lyricsfactory.h + lyrics.h + lyricswindow.h +) + +SET(liblyrics_RCCS + translations/translations.qrc) + +QT4_ADD_RESOURCES(liblyrics_RCC_SRCS ${liblyrics_RCCS}) + +QT4_WRAP_CPP(liblyrics_MOC_SRCS ${liblyrics_MOC_HDRS}) + +# user interface + +SET(liblyrics_UIS + lyricswindow.ui +) + +QT4_WRAP_UI(liblyrics_UIS_H ${liblyrics_UIS}) +# Don't forget to include output directory, otherwise +# the UI file won't be wrapped! +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +ADD_LIBRARY(lyrics SHARED ${liblyrics_SRCS} ${liblyrics_MOC_SRCS} ${liblyrics_UIS_H} ${liblyrics_RCC_SRCS}) +add_dependencies(lyrics qmmpui) +target_link_libraries(lyrics ${QT_LIBRARIES} -lqmmpui -lqmmp) +install(TARGETS lyrics DESTINATION ${LIB_DIR}/qmmp/General) diff --git a/src/plugins/General/fileops/Makefile b/src/plugins/General/fileops/Makefile new file mode 100644 index 000000000..e2b8004e0 --- /dev/null +++ b/src/plugins/General/fileops/Makefile @@ -0,0 +1,247 @@ +############################################################################# +# Makefile for building: libfileops.so +# Generated by qmake (2.01a) (Qt 4.5.1) on: ?? ??? 1 19:19:09 2009 +# Project: fileops.pro +# Template: lib +# Command: /usr/bin/qmake -unix -o Makefile fileops.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -pipe -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/lib/qt4/include/QtCore -I/usr/lib/qt4/include/QtGui -I/usr/lib/qt4/include -I../../../../src -I.build/moc -I.build/ui +LINK = g++ +LFLAGS = -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared +LIBS = $(SUBLIBS) -L../../../../lib -L/usr/lib -lqmmpui -lqmmp -lQtGui -L/usr/lib -lpng -lfreetype -lSM -lICE -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm -lrt -ldl -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = .build/obj/ + +####### Files + +SOURCES = fileopsfactory.cpp \ + fileops.cpp \ + settingsdialog.cpp .build/moc/moc_fileopsfactory.cpp \ + .build/moc/moc_fileops.cpp \ + .build/moc/moc_settingsdialog.cpp +OBJECTS = .build/obj/fileopsfactory.o \ + .build/obj/fileops.o \ + .build/obj/settingsdialog.o \ + .build/obj/moc_fileopsfactory.o \ + .build/obj/moc_fileops.o \ + .build/obj/moc_settingsdialog.o +DIST = /usr/lib/qt4/mkspecs/common/g++.conf \ + /usr/lib/qt4/mkspecs/common/unix.conf \ + /usr/lib/qt4/mkspecs/common/linux.conf \ + /usr/lib/qt4/mkspecs/qconfig.pri \ + /usr/lib/qt4/mkspecs/features/qt_functions.prf \ + /usr/lib/qt4/mkspecs/features/qt_config.prf \ + /usr/lib/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/lib/qt4/mkspecs/features/default_pre.prf \ + ../../../../qmmp.pri \ + ../../plugins.pri \ + /usr/lib/qt4/mkspecs/features/release.prf \ + /usr/lib/qt4/mkspecs/features/default_post.prf \ + /usr/lib/qt4/mkspecs/features/warn_on.prf \ + /usr/lib/qt4/mkspecs/features/qt.prf \ + /usr/lib/qt4/mkspecs/features/unix/thread.prf \ + /usr/lib/qt4/mkspecs/features/moc.prf \ + /usr/lib/qt4/mkspecs/features/resources.prf \ + /usr/lib/qt4/mkspecs/features/uic.prf \ + /usr/lib/qt4/mkspecs/features/yacc.prf \ + /usr/lib/qt4/mkspecs/features/lex.prf \ + fileops.pro +QMAKE_TARGET = fileops +DESTDIR = ../../../../lib/qmmp/General/ +TARGET = libfileops.so +TARGETD = libfileops.so + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile ../../../../lib/qmmp/General/$(TARGET) + +../../../../lib/qmmp/General/$(TARGET): .build/ui/ui_settingsdialog.h $(OBJECTS) $(SUBLIBS) $(OBJCOMP) + @$(CHK_DIR_EXISTS) ../../../../lib/qmmp/General/ || $(MKDIR) ../../../../lib/qmmp/General/ + -$(DEL_FILE) $(TARGET) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) + -$(MOVE) $(TARGET) ../../../../lib/qmmp/General/ + + + +Makefile: fileops.pro /usr/lib/qt4/mkspecs/linux-g++/qmake.conf /usr/lib/qt4/mkspecs/common/g++.conf \ + /usr/lib/qt4/mkspecs/common/unix.conf \ + /usr/lib/qt4/mkspecs/common/linux.conf \ + /usr/lib/qt4/mkspecs/qconfig.pri \ + /usr/lib/qt4/mkspecs/features/qt_functions.prf \ + /usr/lib/qt4/mkspecs/features/qt_config.prf \ + /usr/lib/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/lib/qt4/mkspecs/features/default_pre.prf \ + ../../../../qmmp.pri \ + ../../plugins.pri \ + /usr/lib/qt4/mkspecs/features/release.prf \ + /usr/lib/qt4/mkspecs/features/default_post.prf \ + /usr/lib/qt4/mkspecs/features/warn_on.prf \ + /usr/lib/qt4/mkspecs/features/qt.prf \ + /usr/lib/qt4/mkspecs/features/unix/thread.prf \ + /usr/lib/qt4/mkspecs/features/moc.prf \ + /usr/lib/qt4/mkspecs/features/resources.prf \ + /usr/lib/qt4/mkspecs/features/uic.prf \ + /usr/lib/qt4/mkspecs/features/yacc.prf \ + /usr/lib/qt4/mkspecs/features/lex.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) -unix -o Makefile fileops.pro +/usr/lib/qt4/mkspecs/common/g++.conf: +/usr/lib/qt4/mkspecs/common/unix.conf: +/usr/lib/qt4/mkspecs/common/linux.conf: +/usr/lib/qt4/mkspecs/qconfig.pri: +/usr/lib/qt4/mkspecs/features/qt_functions.prf: +/usr/lib/qt4/mkspecs/features/qt_config.prf: +/usr/lib/qt4/mkspecs/features/exclusive_builds.prf: +/usr/lib/qt4/mkspecs/features/default_pre.prf: +../../../../qmmp.pri: +../../plugins.pri: +/usr/lib/qt4/mkspecs/features/release.prf: +/usr/lib/qt4/mkspecs/features/default_post.prf: +/usr/lib/qt4/mkspecs/features/warn_on.prf: +/usr/lib/qt4/mkspecs/features/qt.prf: +/usr/lib/qt4/mkspecs/features/unix/thread.prf: +/usr/lib/qt4/mkspecs/features/moc.prf: +/usr/lib/qt4/mkspecs/features/resources.prf: +/usr/lib/qt4/mkspecs/features/uic.prf: +/usr/lib/qt4/mkspecs/features/yacc.prf: +/usr/lib/qt4/mkspecs/features/lex.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -unix -o Makefile fileops.pro + +dist: + @$(CHK_DIR_EXISTS) .build/obj/fileops1.0.0 || $(MKDIR) .build/obj/fileops1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .build/obj/fileops1.0.0/ && $(COPY_FILE) --parents fileopsfactory.h fileops.h settingsdialog.h .build/obj/fileops1.0.0/ && $(COPY_FILE) --parents fileopsfactory.cpp fileops.cpp settingsdialog.cpp .build/obj/fileops1.0.0/ && $(COPY_FILE) --parents settingsdialog.ui .build/obj/fileops1.0.0/ && (cd `dirname .build/obj/fileops1.0.0` && $(TAR) fileops1.0.0.tar fileops1.0.0 && $(COMPRESS) fileops1.0.0.tar) && $(MOVE) `dirname .build/obj/fileops1.0.0`/fileops1.0.0.tar.gz . && $(DEL_FILE) -r .build/obj/fileops1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) ../../../../lib/qmmp/General/libfileops.so + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: .build/moc/moc_fileopsfactory.cpp .build/moc/moc_fileops.cpp .build/moc/moc_settingsdialog.cpp +compiler_moc_header_clean: + -$(DEL_FILE) .build/moc/moc_fileopsfactory.cpp .build/moc/moc_fileops.cpp .build/moc/moc_settingsdialog.cpp +.build/moc/moc_fileopsfactory.cpp: fileopsfactory.h + /usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) fileopsfactory.h -o .build/moc/moc_fileopsfactory.cpp + +.build/moc/moc_fileops.cpp: fileops.h + /usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) fileops.h -o .build/moc/moc_fileops.cpp + +.build/moc/moc_settingsdialog.cpp: .build/ui/ui_settingsdialog.h \ + settingsdialog.h + /usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) settingsdialog.h -o .build/moc/moc_settingsdialog.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: .build/ui/ui_settingsdialog.h +compiler_uic_clean: + -$(DEL_FILE) .build/ui/ui_settingsdialog.h +.build/ui/ui_settingsdialog.h: settingsdialog.ui + /usr/lib/qt4/bin/uic settingsdialog.ui -o .build/ui/ui_settingsdialog.h + +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean compiler_uic_clean + +####### Compile + +.build/obj/fileopsfactory.o: fileopsfactory.cpp fileops.h \ + fileopsfactory.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/fileopsfactory.o fileopsfactory.cpp + +.build/obj/fileops.o: fileops.cpp fileops.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/fileops.o fileops.cpp + +.build/obj/settingsdialog.o: settingsdialog.cpp settingsdialog.h \ + .build/ui/ui_settingsdialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/settingsdialog.o settingsdialog.cpp + +.build/obj/moc_fileopsfactory.o: .build/moc/moc_fileopsfactory.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/moc_fileopsfactory.o .build/moc/moc_fileopsfactory.cpp + +.build/obj/moc_fileops.o: .build/moc/moc_fileops.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/moc_fileops.o .build/moc/moc_fileops.cpp + +.build/obj/moc_settingsdialog.o: .build/moc/moc_settingsdialog.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/moc_settingsdialog.o .build/moc/moc_settingsdialog.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/src/plugins/General/fileops/fileops.cpp b/src/plugins/General/fileops/fileops.cpp new file mode 100644 index 000000000..86122b127 --- /dev/null +++ b/src/plugins/General/fileops/fileops.cpp @@ -0,0 +1,52 @@ +/*************************************************************************** + * Copyright (C) 2009 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 <QAction> +#include <QApplication> + +#include <qmmp/soundcore.h> +#include <qmmpui/generalhandler.h> +#include <qmmpui/playlistmodel.h> +#include <qmmpui/playlistitem.h> +#include <qmmpui/mediaplayer.h> +#include "fileops.h" + +FileOps::FileOps(QObject *parent) + : General(parent) +{ + m_copyAction = new QAction(tr("Copy"), this); + m_moveAction = new QAction(tr("Move"), this); + m_removeAction = new QAction(tr("Remove"), this); + //separators + QAction *separator1 = new QAction(this); + separator1->setSeparator (TRUE); + QAction *separator2 = new QAction(this); + separator2->setSeparator (TRUE); + + GeneralHandler::instance()->addAction(separator1, GeneralHandler::PLAYLIST_MENU); + GeneralHandler::instance()->addAction(m_copyAction, GeneralHandler::PLAYLIST_MENU); + GeneralHandler::instance()->addAction(m_moveAction, GeneralHandler::PLAYLIST_MENU); + GeneralHandler::instance()->addAction(m_removeAction, GeneralHandler::PLAYLIST_MENU); + GeneralHandler::instance()->addAction(separator2, GeneralHandler::PLAYLIST_MENU); +} + +FileOps::~FileOps() +{} + diff --git a/src/plugins/General/fileops/fileops.h b/src/plugins/General/fileops/fileops.h new file mode 100644 index 000000000..7ff3d570f --- /dev/null +++ b/src/plugins/General/fileops/fileops.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2009 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. * + ***************************************************************************/ +#ifndef FILEOPS_H +#define FILEOPS_H + +#include <qmmpui/general.h> +#include <qmmp/qmmp.h> + +class QAction; +class SoundCore; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ + +class FileOps : public General +{ +Q_OBJECT +public: + FileOps(QObject *parent = 0); + + ~FileOps(); + + enum ActionType + { + COPY = 0, + RENAME, + MOVE, + REMOVE + }; + + +private: + QAction *m_copyAction; + QAction *m_moveAction; + QAction *m_removeAction; + QString m_copyDestination; +}; + +#endif diff --git a/src/plugins/General/fileops/fileops.pro b/src/plugins/General/fileops/fileops.pro new file mode 100644 index 000000000..90271d644 --- /dev/null +++ b/src/plugins/General/fileops/fileops.pro @@ -0,0 +1,44 @@ +include(../../plugins.pri) + +INCLUDEPATH += ../../../../src +CONFIG += release \ +warn_on \ +plugin + +TARGET =$$PLUGINS_PREFIX/General/fileops +unix:QMAKE_CLEAN = $$PLUGINS_PREFIX/General/libfileops.so + + +TEMPLATE = lib +unix:QMAKE_LIBDIR += ../../../../lib +unix:LIBS += -lqmmpui -lqmmp + +win32:QMAKE_LIBDIR += ../../../../bin +win32:LIBS += -lqmmpui0 -lqmmp0 + +#TRANSLATIONS = translations/fileops_plugin_cs.ts +# translations/fileops_plugin_de.ts +# translations/fileops_plugin_zh_CN.ts +# translations/fileops_plugin_zh_TW.ts +# translations/fileops_plugin_ru.ts +# translations/fileops_plugin_pl.ts +# translations/fileops_plugin_uk_UA.ts +#RESOURCES = translations/translations.qrc +wnix{ +isEmpty(LIB_DIR){ + LIB_DIR = /lib +} +target.path = $$LIB_DIR/qmmp/General +INSTALLS += target +} +HEADERS += fileopsfactory.h \ + fileops.h \ + settingsdialog.h +win32:HEADERS += ../../../../src/qmmpui/general.h +SOURCES += fileopsfactory.cpp \ + fileops.cpp \ + settingsdialog.cpp + +FORMS += settingsdialog.ui + + diff --git a/src/plugins/General/fileops/fileopsfactory.cpp b/src/plugins/General/fileops/fileopsfactory.cpp new file mode 100644 index 000000000..38c205b5f --- /dev/null +++ b/src/plugins/General/fileops/fileopsfactory.cpp @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (C) 2009 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 <QtGui> + +#include "fileops.h" +#include "settingsdialog.h" +#include "fileopsfactory.h" + +const GeneralProperties FileOpsFactory::properties() const +{ + GeneralProperties properties; + properties.name = tr("File Operations Plugin"); + properties.shortName = "fileops"; + properties.hasAbout = FALSE; + properties.hasSettings = TRUE; + properties.visibilityControl = FALSE; + return properties; +} + +General *FileOpsFactory::create(QObject *parent) +{ + return new FileOps(parent); +} + +QDialog *FileOpsFactory::createConfigDialog(QWidget *parent) +{ + return new SettingsDialog(parent); +} + +void FileOpsFactory::showAbout(QWidget *parent) +{ + /*QMessageBox::about (parent, tr("About Lyrics Plugin"), + tr("Qmmp Lyrics Plugin")+"\n"+ + tr("This plugin retrieves lyrics from LyricWiki.org")+"\n"+ + tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>"));*/ +} + +QTranslator *FileOpsFactory::createTranslator(QObject *parent) +{ + QTranslator *translator = new QTranslator(parent); + QString locale = QLocale::system().name(); + translator->load(QString(":/fileops_plugin_") + locale); + return translator; +} + +Q_EXPORT_PLUGIN(FileOpsFactory) diff --git a/src/plugins/General/fileops/fileopsfactory.h b/src/plugins/General/fileops/fileopsfactory.h new file mode 100644 index 000000000..6b0665be3 --- /dev/null +++ b/src/plugins/General/fileops/fileopsfactory.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2009 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. * + ***************************************************************************/ +#ifndef FILEOPSFACTORY_H +#define FILEOPSFACTORY_H + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +#include <QObject> +#include <QTranslator> +#include <QDialog> + +#include <qmmpui/general.h> +#include <qmmpui/generalfactory.h> + +class FileOpsFactory : public QObject, public GeneralFactory +{ +Q_OBJECT +Q_INTERFACES(GeneralFactory); +public: + const GeneralProperties properties() const; + General *create(QObject *parent); + QDialog *createConfigDialog(QWidget *parent); + void showAbout(QWidget *parent); + QTranslator *createTranslator(QObject *parent); +}; + +#endif diff --git a/src/plugins/General/fileops/settingsdialog.cpp b/src/plugins/General/fileops/settingsdialog.cpp new file mode 100644 index 000000000..57872e7b7 --- /dev/null +++ b/src/plugins/General/fileops/settingsdialog.cpp @@ -0,0 +1,110 @@ +/*************************************************************************** + * Copyright (C) 2009 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 <QTextCodec> +#include <QSettings> +#include <QCheckBox> +#include <QComboBox> + +#include <qmmp/qmmp.h> +#include "fileops.h" +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog(QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + ui.tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); + ui.tableWidget->verticalHeader()->hide(); + connect (ui.newButton,SIGNAL(pressed()), SLOT(createAction())); + connect (ui.deleteButton,SIGNAL(pressed()), SLOT(deleteAction())); + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("FileOps"); + int count = settings.value("count", 0).toInt(); + for (int i = 0; i < count; ++i) + { + ui.tableWidget->insertRow (i); + QCheckBox *checkBox = new QCheckBox; + checkBox->setFocusPolicy (Qt::NoFocus); + + QComboBox *comboBox = new QComboBox; + comboBox->addItem (tr("Copy"), FileOps::COPY); + comboBox->addItem (tr("Rename"), FileOps::RENAME); + comboBox->addItem (tr("Move"), FileOps::MOVE); + comboBox->addItem (tr("Remove"), FileOps::REMOVE); + comboBox->setFocusPolicy (Qt::NoFocus); + + checkBox->setChecked(settings.value(QString("enabled_%1").arg(i), TRUE).toBool()); + int ci = comboBox->findData (settings.value(QString("action_%1").arg(i), FileOps::COPY).toInt()); + if (ci >= 0) + comboBox->setCurrentIndex(ci); + + ActionItem *item = new ActionItem(settings.value(QString("name_%1").arg(i), "Action").toString()); + item->setPattern(settings.value(QString("pattern_%1").arg(i)).toString()); + item->setDestination(settings.value(QString("destination_%1").arg(i)).toString()); + + ui.tableWidget->setCellWidget (i, 0, checkBox); + ui.tableWidget->setCellWidget (i, 1, comboBox); + ui.tableWidget->setItem (i, 2, item); + } + settings.endGroup(); +} + + +SettingsDialog::~SettingsDialog() +{} + +void SettingsDialog::accept() +{ + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + //settings.beginGroup("CUE"); + //settings.setValue("encoding", ui.cueEncComboBox->currentText()); + settings.endGroup(); + QDialog::accept(); +} + +void SettingsDialog::createAction() +{ + int row = ui.tableWidget->rowCount (); + ui.tableWidget->insertRow (row); + QCheckBox *checkBox = new QCheckBox; + checkBox->setFocusPolicy (Qt::NoFocus); + checkBox->setChecked(TRUE); + + QComboBox *comboBox = new QComboBox; + comboBox->addItem (tr("Copy"), FileOps::COPY); + comboBox->addItem (tr("Rename"), FileOps::RENAME); + comboBox->addItem (tr("Move"), FileOps::MOVE); + comboBox->addItem (tr("Remove"), FileOps::REMOVE); + comboBox->setFocusPolicy (Qt::NoFocus); + + ActionItem *item = new ActionItem("New action"); + //item->setPattern(settings.value(QString("pattern_%1").arg(i)).toString()); + //item->setDestination(settings.value(QString("destination_%1").arg(i)).toString()); + + ui.tableWidget->setCellWidget (row, 0, checkBox); + ui.tableWidget->setCellWidget (row, 1, comboBox); + ui.tableWidget->setItem (row, 2, item); +} + +void SettingsDialog::deleteAction() +{ + if (ui.tableWidget->currentRow () >= 0) + ui.tableWidget->removeRow (ui.tableWidget->currentRow ()); +} diff --git a/src/plugins/General/fileops/settingsdialog.h b/src/plugins/General/fileops/settingsdialog.h new file mode 100644 index 000000000..1920739c4 --- /dev/null +++ b/src/plugins/General/fileops/settingsdialog.h @@ -0,0 +1,82 @@ +/*************************************************************************** + * Copyright (C) 2009 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. * + ***************************************************************************/ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include <QDialog> + +#include "ui_settingsdialog.h" + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class ActionItem; + +class SettingsDialog : public QDialog +{ + Q_OBJECT +public: + SettingsDialog(QWidget *parent = 0); + + ~SettingsDialog(); + + +public slots: + virtual void accept(); + +private slots: + void createAction(); + void deleteAction(); + +private: + Ui::SettingsDialog ui; +}; + +class ActionItem: public QTableWidgetItem +{ +public: + ActionItem (const QString &text): QTableWidgetItem(text){}; + + QString pattern() + { + return m_pattern; + }; + + QString destination() + { + return m_destination; + }; + + void setPattern(const QString &pattern) + { + m_pattern = pattern; + }; + + void setDestination(const QString &dest) + { + m_destination = dest; + }; + +private: + QString m_pattern, m_destination; +}; + + +#endif diff --git a/src/plugins/General/fileops/settingsdialog.ui b/src/plugins/General/fileops/settingsdialog.ui new file mode 100644 index 000000000..237068aef --- /dev/null +++ b/src/plugins/General/fileops/settingsdialog.ui @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SettingsDialog</class> + <widget class="QDialog" name="SettingsDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>389</width> + <height>293</height> + </rect> + </property> + <property name="windowTitle"> + <string>File Operations Settings</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item row="0" column="0" colspan="2"> + <widget class="QTableWidget" name="tableWidget"> + <property name="selectionMode"> + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> + </property> + <property name="showGrid"> + <bool>true</bool> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="cornerButtonEnabled"> + <bool>true</bool> + </property> + <column> + <property name="text"> + <string>Enabled</string> + </property> + </column> + <column> + <property name="text"> + <string>Operation</string> + </property> + </column> + <column> + <property name="text"> + <string>Menu text</string> + </property> + </column> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <widget class="QPushButton" name="newButton"> + <property name="text"> + <string>New</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="deleteButton"> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_2"> + <property name="text"> + <string>Move up</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_3"> + <property name="text"> + <string>Move down</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>198</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="2" column="0" colspan="2"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Destination:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="lineEdit_2"/> + </item> + <item row="0" column="2"> + <widget class="QToolButton" name="toolButton_2"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>File name pattern:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lineEdit"/> + </item> + <item row="1" column="2"> + <widget class="QToolButton" name="toolButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="0"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>267</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="3" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>SettingsDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>431</x> + <y>376</y> + </hint> + <hint type="destinationlabel"> + <x>155</x> + <y>378</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>SettingsDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>433</x> + <y>381</y> + </hint> + <hint type="destinationlabel"> + <x>28</x> + <y>375</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/plugins/Input/cue/decoder_cue.cpp b/src/plugins/Input/cue/decoder_cue.cpp index 3e758d459..257d6c491 100644 --- a/src/plugins/Input/cue/decoder_cue.cpp +++ b/src/plugins/Input/cue/decoder_cue.cpp @@ -63,7 +63,7 @@ bool DecoderCUE::initialize() } int track = path.section("#", -1).toInt(); path = parser.filePath(track); - qDebug(qPrintable(path)); + if (!QFile::exists(path)) { qWarning("DecoderCUE: file \"%s\" doesn't exist", qPrintable(path)); |
