From 7c6e2dd399925d6c82ec3d55e6dc9e787cb252e6 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 11 May 2009 12:31:48 +0000 Subject: enabled file operations plugin git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@936 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/CMakeLists.txt | 5 + src/plugins/General/General.pro | 3 +- src/plugins/General/fileops/CMakeLists.txt | 44 ++--- src/plugins/General/fileops/fileops.cpp | 106 ++++++++++- src/plugins/General/fileops/fileops.h | 8 +- src/plugins/General/fileops/fileops.pro | 53 +++--- src/plugins/General/fileops/fileopsfactory.cpp | 9 +- src/plugins/General/fileops/hotkeydialog.cpp | 63 ++++++ src/plugins/General/fileops/hotkeydialog.h | 50 +++++ src/plugins/General/fileops/hotkeydialog.ui | 120 ++++++++++++ src/plugins/General/fileops/settingsdialog.cpp | 24 ++- src/plugins/General/fileops/settingsdialog.h | 1 + src/plugins/General/fileops/settingsdialog.ui | 9 +- .../fileops/translations/fileops_plugin_cs.ts | 212 +++++++++++++++++++++ .../fileops/translations/fileops_plugin_de.ts | 212 +++++++++++++++++++++ .../fileops/translations/fileops_plugin_pl.ts | 212 +++++++++++++++++++++ .../fileops/translations/fileops_plugin_ru.ts | 212 +++++++++++++++++++++ .../fileops/translations/fileops_plugin_uk_UA.ts | 212 +++++++++++++++++++++ .../fileops/translations/fileops_plugin_zh_CN.ts | 212 +++++++++++++++++++++ .../fileops/translations/fileops_plugin_zh_TW.ts | 212 +++++++++++++++++++++ .../General/fileops/translations/translations.qrc | 12 ++ 21 files changed, 1924 insertions(+), 67 deletions(-) create mode 100644 src/plugins/General/fileops/hotkeydialog.cpp create mode 100644 src/plugins/General/fileops/hotkeydialog.h create mode 100644 src/plugins/General/fileops/hotkeydialog.ui create mode 100644 src/plugins/General/fileops/translations/fileops_plugin_cs.ts create mode 100644 src/plugins/General/fileops/translations/fileops_plugin_de.ts create mode 100644 src/plugins/General/fileops/translations/fileops_plugin_pl.ts create mode 100644 src/plugins/General/fileops/translations/fileops_plugin_ru.ts create mode 100644 src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts create mode 100644 src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts create mode 100644 src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts create mode 100644 src/plugins/General/fileops/translations/translations.qrc (limited to 'src') diff --git a/src/plugins/General/CMakeLists.txt b/src/plugins/General/CMakeLists.txt index 8b428c008..fea4bf984 100644 --- a/src/plugins/General/CMakeLists.txt +++ b/src/plugins/General/CMakeLists.txt @@ -5,6 +5,7 @@ SET(USE_NOTIFIER TRUE CACHE BOOL "enable/disable notifier plugin") SET(USE_LYRICS TRUE CACHE BOOL "enable/disable lyrics version") SET(USE_HAL TRUE CACHE BOOL "enable/disable hal plugin") SET(USE_HOTKEY TRUE CACHE BOOL "enable/disable global hotkey plugin") +SET(USE_FILEOPS TRUE CACHE BOOL "enable/disable fileops plugin") IF(USE_MPRIS) add_subdirectory(mpris) @@ -33,3 +34,7 @@ ENDIF(USE_HAL) IF(USE_HOTKEY) add_subdirectory(hotkey) ENDIF(USE_HOTKEY) + +IF(USE_FILEOPS) +add_subdirectory(fileops) +ENDIF(USE_FILEOPS) diff --git a/src/plugins/General/General.pro b/src/plugins/General/General.pro index c7db7aa8e..b05d12287 100644 --- a/src/plugins/General/General.pro +++ b/src/plugins/General/General.pro @@ -1,7 +1,8 @@ SUBDIRS += statusicon \ notifier \ lyrics \ - scrobbler + scrobbler \ + fileops unix:SUBDIRS += mpris \ hal \ hotkey diff --git a/src/plugins/General/fileops/CMakeLists.txt b/src/plugins/General/fileops/CMakeLists.txt index 811f87031..66a4b2a9a 100644 --- a/src/plugins/General/fileops/CMakeLists.txt +++ b/src/plugins/General/fileops/CMakeLists.txt @@ -1,10 +1,7 @@ -project(liblyrics) +project(libfileops) cmake_minimum_required(VERSION 2.4.7) -SET(QT_USE_QTNETWORK TRUE) -INCLUDE(FindQt4) - include(${QT_USE_FILE}) if(COMMAND cmake_policy) @@ -32,37 +29,40 @@ 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(libfileops_SRCS + fileops.cpp + fileopsfactory.cpp + settingsdialog.cpp + hotkeydialog.cpp ) -SET(liblyrics_MOC_HDRS - lyricsfactory.h - lyrics.h - lyricswindow.h +SET(libfileops_MOC_HDRS + fileopsfactory.h + fileops.h + settingsdialog.h + hotkeydialog.h ) -SET(liblyrics_RCCS +SET(libfileops_RCCS translations/translations.qrc) -QT4_ADD_RESOURCES(liblyrics_RCC_SRCS ${liblyrics_RCCS}) +QT4_ADD_RESOURCES(libfileops_RCC_SRCS ${libfileops_RCCS}) -QT4_WRAP_CPP(liblyrics_MOC_SRCS ${liblyrics_MOC_HDRS}) +QT4_WRAP_CPP(libfileops_MOC_SRCS ${libfileops_MOC_HDRS}) # user interface -SET(liblyrics_UIS - lyricswindow.ui +SET(libfileops_UIS + settingsdialog.ui + hotkeydialog.ui ) -QT4_WRAP_UI(liblyrics_UIS_H ${liblyrics_UIS}) +QT4_WRAP_UI(libfileops_UIS_H ${libfileops_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) +ADD_LIBRARY(fileops SHARED ${libfileops_SRCS} ${libfileops_MOC_SRCS} ${libfileops_UIS_H} ${libfileops_RCC_SRCS}) +add_dependencies(fileops qmmpui) +target_link_libraries(fileops ${QT_LIBRARIES} -lqmmpui -lqmmp) +install(TARGETS fileops DESTINATION ${LIB_DIR}/qmmp/General) diff --git a/src/plugins/General/fileops/fileops.cpp b/src/plugins/General/fileops/fileops.cpp index 3bb32b1e4..f116f7602 100644 --- a/src/plugins/General/fileops/fileops.cpp +++ b/src/plugins/General/fileops/fileops.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,7 @@ FileOps::FileOps(QObject *parent) m_patterns << settings.value(QString("pattern_%1").arg(i)).toString(); m_destinations << settings.value(QString("destination_%1").arg(i)).toString(); QAction *action = new QAction(name, this); + action->setShortcut(settings.value(QString("hotkey_%1").arg(i)).toString()); connect (action, SIGNAL (triggered (bool)), mapper, SLOT (map())); mapper->setMapping(action, i); GeneralHandler::instance()->addAction(action, GeneralHandler::PLAYLIST_MENU); @@ -89,6 +91,13 @@ void FileOps::execAction(int n) { case COPY: { + qDebug("FileOps: copy"); + if (!QDir(destination).exists ()) + { + QMessageBox::critical (qApp->activeWindow (), tr("Error"), + tr("Destination directory doesn't exist")); + break; + } QProgressDialog progress(qApp->activeWindow ()); progress.setWindowModality(Qt::WindowModal); progress.setWindowTitle(tr("Copying")); @@ -100,11 +109,25 @@ void FileOps::execAction(int n) { if (!QFile::exists(item->url())) continue; - + //generate file name + QString fname = generateFileName(item, pattern); + //append extension + QString ext = QString(".") + item->url().split('.',QString::SkipEmptyParts).takeLast (); + if (!fname.endsWith(ext)) + fname += ext; + //copy file QFile in(item->url()); - QFile out(destination + "/" + pattern); - in.open(QIODevice::ReadOnly); - out.open(QIODevice::WriteOnly); + QFile out(destination + "/" + fname); + if (!in.open(QIODevice::ReadOnly)) + { + qDebug("FileOps: %s", qPrintable(in.errorString ())); + continue; + } + if (!out.open(QIODevice::WriteOnly)) + { + qDebug("FileOps: %s", qPrintable(out.errorString ())); + continue; + } progress.setMaximum(int(in.size()/COPY_BLOCK_SIZE)); progress.setValue(0); @@ -123,10 +146,32 @@ void FileOps::execAction(int n) break; } case RENAME: + qDebug("FileOps: rename"); + foreach(PlayListItem *item, items) + { + if (!QFile::exists(item->url())) + continue; + //generate file name + QString fname = generateFileName(item, pattern); + //append extension + QString ext = QString(".") + item->url().split('.',QString::SkipEmptyParts).takeLast (); + if (!fname.endsWith(ext)) + fname += ext; + //rename file + QFile file(item->url()); + if (file.rename(destination + "/" + fname)) + { + item->setMetaData(Qmmp::URL, destination + "/" + fname); + model->doCurrentVisibleRequest(); + } + else + continue; + } break; - case MOVE: - break; + /*case MOVE: + break;*/ case REMOVE: + qDebug("FileOps: remove"); if (QMessageBox::question (qApp->activeWindow (), tr("Remove files"), QString(tr("Are you sure you want to remove %1 file(s) from disk")) .arg(items.size()), @@ -140,3 +185,52 @@ void FileOps::execAction(int n) } } } +//generate file name from tags using given pattern +QString FileOps::generateFileName(PlayListItem *item, QString pattern) +{ + QString fname = pattern; + fname = printTag(fname, "%p", item->artist(), pattern); + fname = printTag(fname, "%a", item->album(), pattern); + fname = printTag(fname, "%t", item->title(), pattern); + fname = printTag(fname, "%n", QString("%1").arg(item->track()), pattern); + fname = printTag(fname, "%g", item->genre(), pattern); + fname = printTag(fname, "%f", item->url().section('/',-1), pattern); + fname = printTag(fname, "%F", item->url(), pattern); + fname = printTag(fname, "%y", QString("%1").arg(item->year ()), pattern); + fname.replace(" ", "_"); + if (fname.isEmpty()) + { + if (item->url().contains('/')) + fname = item->url().split('/',QString::SkipEmptyParts).takeLast (); + } + return fname; + +} + + +QString FileOps::printTag(QString str, QString regExp, QString tagStr, QString fmt) +{ + QString format = fmt; + if (!tagStr.isEmpty()) + str.replace(regExp, tagStr); + else + { + //remove unused separators + int regExpPos = str.indexOf(regExp); + if (regExpPos < 0) + return str; + int nextPos = str.indexOf("%", regExpPos + 1); + if (nextPos < 0) + { + //last separator + regExpPos = format.lastIndexOf(regExp); + nextPos = format.lastIndexOf("%", regExpPos - 1); + QString lastSep = format.right (format.size() - nextPos - 2); + str.remove(lastSep); + str.remove(regExp); + } + else + str.remove ( regExpPos, nextPos - regExpPos); + } + return str; +} diff --git a/src/plugins/General/fileops/fileops.h b/src/plugins/General/fileops/fileops.h index 946071e47..cd84e1d4b 100644 --- a/src/plugins/General/fileops/fileops.h +++ b/src/plugins/General/fileops/fileops.h @@ -25,14 +25,15 @@ class QAction; class SoundCore; +class PlayListItem; /** - @author Ilya Kotov + @author Ilya Kotov */ class FileOps : public General { -Q_OBJECT + Q_OBJECT public: FileOps(QObject *parent = 0); @@ -42,7 +43,6 @@ public: { COPY = 0, RENAME, - MOVE, REMOVE }; @@ -50,6 +50,8 @@ private slots: void execAction(int n); private: + QString generateFileName(PlayListItem *item, QString pattern); + QString printTag(QString str, QString regExp, QString tagStr, QString fmt); QList m_types; QStringList m_patterns; QStringList m_destinations; diff --git a/src/plugins/General/fileops/fileops.pro b/src/plugins/General/fileops/fileops.pro index 90271d644..c9d6f6cc3 100644 --- a/src/plugins/General/fileops/fileops.pro +++ b/src/plugins/General/fileops/fileops.pro @@ -6,39 +6,42 @@ warn_on \ plugin TARGET =$$PLUGINS_PREFIX/General/fileops -unix:QMAKE_CLEAN = $$PLUGINS_PREFIX/General/libfileops.so +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 +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 + settingsdialog.h \ + hotkeydialog.h +win32 : HEADERS += ../../../../src/qmmpui/general.h SOURCES += fileopsfactory.cpp \ fileops.cpp \ - settingsdialog.cpp + settingsdialog.cpp \ + hotkeydialog.cpp -FORMS += settingsdialog.ui +FORMS += settingsdialog.ui \ + hotkeydialog.ui diff --git a/src/plugins/General/fileops/fileopsfactory.cpp b/src/plugins/General/fileops/fileopsfactory.cpp index 38c205b5f..09bf0d919 100644 --- a/src/plugins/General/fileops/fileopsfactory.cpp +++ b/src/plugins/General/fileops/fileopsfactory.cpp @@ -29,7 +29,7 @@ const GeneralProperties FileOpsFactory::properties() const GeneralProperties properties; properties.name = tr("File Operations Plugin"); properties.shortName = "fileops"; - properties.hasAbout = FALSE; + properties.hasAbout = TRUE; properties.hasSettings = TRUE; properties.visibilityControl = FALSE; return properties; @@ -47,10 +47,9 @@ QDialog *FileOpsFactory::createConfigDialog(QWidget *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 "));*/ + QMessageBox::about (parent, tr("About File Operations Plugin"), + tr("Qmmp File Operations Plugin")+"\n"+ + tr("Writen by: Ilya Kotov ")); } QTranslator *FileOpsFactory::createTranslator(QObject *parent) diff --git a/src/plugins/General/fileops/hotkeydialog.cpp b/src/plugins/General/fileops/hotkeydialog.cpp new file mode 100644 index 000000000..40639e073 --- /dev/null +++ b/src/plugins/General/fileops/hotkeydialog.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** + * 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 +#include "hotkeydialog.h" + +HotkeyDialog::HotkeyDialog(const QString &key, QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + ui.keyLineEdit->setText(key); +} + +HotkeyDialog::~HotkeyDialog() +{ +} + +void HotkeyDialog::keyPressEvent (QKeyEvent *event) +{ + int key = event->key(); + switch (key) + { + case Qt::Key_Shift: + case Qt::Key_Control: + case Qt::Key_Meta: + case Qt::Key_Alt: + case Qt::Key_AltGr: + case Qt::Key_Super_L: + case Qt::Key_Super_R: + case Qt::Key_Menu: + case 0: + case Qt::Key_unknown: + key = 0; + ui.keyLineEdit->clear(); + QWidget::keyPressEvent(event); + return; + } + QKeySequence seq(event->modifiers() + event->key()); + ui.keyLineEdit->setText(seq.toString()); + QWidget::keyPressEvent(event); +} + +const QString HotkeyDialog::key() +{ + return ui.keyLineEdit->text(); +} diff --git a/src/plugins/General/fileops/hotkeydialog.h b/src/plugins/General/fileops/hotkeydialog.h new file mode 100644 index 000000000..9683a2279 --- /dev/null +++ b/src/plugins/General/fileops/hotkeydialog.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * 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 HOTKEYDIALOG_H +#define HOTKEYDIALOG_H + +#include + +#include "ui_hotkeydialog.h" + +class QKeyEvent; + +/** + @author Ilya Kotov +*/ +class HotkeyDialog : public QDialog +{ + Q_OBJECT +public: + HotkeyDialog(const QString &key, QWidget *parent = 0); + + ~HotkeyDialog(); + + const QString key(); + +protected: + virtual void keyPressEvent (QKeyEvent *event); + +private: + Ui::HotkeyDialog ui; + +}; + +#endif diff --git a/src/plugins/General/fileops/hotkeydialog.ui b/src/plugins/General/fileops/hotkeydialog.ui new file mode 100644 index 000000000..fff3429bd --- /dev/null +++ b/src/plugins/General/fileops/hotkeydialog.ui @@ -0,0 +1,120 @@ + + + HotkeyDialog + + + + 0 + 0 + 310 + 89 + + + + Modify Shortcut + + + + 6 + + + 6 + + + 6 + + + + + Press the key combination you want to assign + + + + + + + true + + + + + + + Clear + + + + + + + Qt::Horizontal + + + + 106 + 20 + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + HotkeyDialog + accept() + + + 212 + 70 + + + 192 + 269 + + + + + buttonBox + rejected() + HotkeyDialog + reject() + + + 212 + 70 + + + 246 + 214 + + + + + clearButton + clicked() + keyLineEdit + clear() + + + 195 + 22 + + + 113 + 25 + + + + + diff --git a/src/plugins/General/fileops/settingsdialog.cpp b/src/plugins/General/fileops/settingsdialog.cpp index 92c221497..b8604f290 100644 --- a/src/plugins/General/fileops/settingsdialog.cpp +++ b/src/plugins/General/fileops/settingsdialog.cpp @@ -26,6 +26,7 @@ #include #include #include "fileops.h" +#include "hotkeydialog.h" #include "settingsdialog.h" SettingsDialog::SettingsDialog(QWidget *parent) @@ -34,6 +35,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) ui.setupUi(this); ui.tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); ui.tableWidget->verticalHeader()->hide(); + ui.tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); connect (ui.newButton,SIGNAL(pressed()), SLOT(createAction())); connect (ui.deleteButton,SIGNAL(pressed()), SLOT(deleteAction())); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); @@ -48,7 +50,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) 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("Move"), FileOps::MOVE); comboBox->addItem (tr("Remove"), FileOps::REMOVE); comboBox->setFocusPolicy (Qt::NoFocus); @@ -64,6 +66,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) ui.tableWidget->setCellWidget (i, 0, checkBox); ui.tableWidget->setCellWidget (i, 1, comboBox); ui.tableWidget->setItem (i, 2, item); + QTableWidgetItem *item2 = new QTableWidgetItem(); + item2->setText(settings.value(QString("hotkey_%1").arg(i)).toString()); + ui.tableWidget->setItem (i, 3, item2); + ui.tableWidget->item (i, 3)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); } settings.endGroup(); connect (ui.tableWidget, SIGNAL(currentItemChanged (QTableWidgetItem *, QTableWidgetItem *)), @@ -107,6 +113,7 @@ void SettingsDialog::accept() settings.setValue (QString("name_%1").arg(i), item->text()); settings.setValue (QString("pattern_%1").arg(i), item->pattern()); settings.setValue (QString("destination_%1").arg(i), item->destination()); + settings.setValue (QString("hotkey_%1").arg(i), ui.tableWidget->item(i,3)->text()); } settings.endGroup(); QDialog::accept(); @@ -123,7 +130,7 @@ void SettingsDialog::createAction() 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("Move"), FileOps::MOVE); comboBox->addItem (tr("Remove"), FileOps::REMOVE); comboBox->setFocusPolicy (Qt::NoFocus); @@ -134,6 +141,9 @@ void SettingsDialog::createAction() ui.tableWidget->setCellWidget (row, 0, checkBox); ui.tableWidget->setCellWidget (row, 1, comboBox); ui.tableWidget->setItem (row, 2, item); + QTableWidgetItem *item2 = new QTableWidgetItem(); + ui.tableWidget->setItem (row, 3, item2); + ui.tableWidget->item (row, 3)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); } void SettingsDialog::deleteAction() @@ -198,7 +208,7 @@ void SettingsDialog::addTitleString(QAction *a) if (ui.patternEdit->cursorPosition () < 1) ui.patternEdit->insert(a->data().toString()); else - ui.patternEdit->insert("_"+a->data().toString()); + ui.patternEdit->insert(" - "+a->data().toString()); } void SettingsDialog::selectDirectory() @@ -208,3 +218,11 @@ void SettingsDialog::selectDirectory() if(!dir.isEmpty()) ui.destinationEdit->setText(dir); } + +void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item) +{ + HotkeyDialog *dialog = new HotkeyDialog(item->text(), this); + if (ui.tableWidget->column (item) == 3 && dialog->exec() == QDialog::Accepted) + item->setText(dialog->key()); + delete dialog; +} diff --git a/src/plugins/General/fileops/settingsdialog.h b/src/plugins/General/fileops/settingsdialog.h index f6e4d0def..5c7b0865c 100644 --- a/src/plugins/General/fileops/settingsdialog.h +++ b/src/plugins/General/fileops/settingsdialog.h @@ -49,6 +49,7 @@ private slots: void changePattern(const QString &pattern); void addTitleString(QAction *action); void selectDirectory(); + void on_tableWidget_itemDoubleClicked (QTableWidgetItem *item); private: void createMenus(); diff --git a/src/plugins/General/fileops/settingsdialog.ui b/src/plugins/General/fileops/settingsdialog.ui index 2e43334f5..8e1d5c5f0 100644 --- a/src/plugins/General/fileops/settingsdialog.ui +++ b/src/plugins/General/fileops/settingsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 389 - 287 + 425 + 308 @@ -58,6 +58,11 @@ Menu text + + + Shortcut + + diff --git a/src/plugins/General/fileops/translations/fileops_plugin_cs.ts b/src/plugins/General/fileops/translations/fileops_plugin_cs.ts new file mode 100644 index 000000000..51843a1a5 --- /dev/null +++ b/src/plugins/General/fileops/translations/fileops_plugin_cs.ts @@ -0,0 +1,212 @@ + + + + + FileOps + + + Error + + + + + Destination directory doesn't exist + + + + + Copying + + + + + Stop + + + + + Copying file %1/%2 + + + + + Remove files + + + + + Are you sure you want to remove %1 file(s) from disk + + + + + FileOpsFactory + + + File Operations Plugin + + + + + About File Operations Plugin + + + + + Qmmp File Operations Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + HotkeyDialog + + + Modify Shortcut + + + + + Press the key combination you want to assign + + + + + Clear + + + + + SettingsDialog + + + + Copy + + + + + + Rename + + + + + + Remove + + + + + Artist + + + + + Album + + + + + Title + + + + + Tracknumber + + + + + Genre + + + + + Filename + + + + + Filepath + + + + + Date + + + + + Year + + + + + Comment + + + + + Choose a directory + + + + + File Operations Settings + + + + + Enabled + + + + + Operation + + + + + Menu text + + + + + Shortcut + + + + + + + + + + + - + + + + + + + + ... + + + + + Destination: + + + + + File name pattern: + + + + diff --git a/src/plugins/General/fileops/translations/fileops_plugin_de.ts b/src/plugins/General/fileops/translations/fileops_plugin_de.ts new file mode 100644 index 000000000..51843a1a5 --- /dev/null +++ b/src/plugins/General/fileops/translations/fileops_plugin_de.ts @@ -0,0 +1,212 @@ + + + + + FileOps + + + Error + + + + + Destination directory doesn't exist + + + + + Copying + + + + + Stop + + + + + Copying file %1/%2 + + + + + Remove files + + + + + Are you sure you want to remove %1 file(s) from disk + + + + + FileOpsFactory + + + File Operations Plugin + + + + + About File Operations Plugin + + + + + Qmmp File Operations Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + HotkeyDialog + + + Modify Shortcut + + + + + Press the key combination you want to assign + + + + + Clear + + + + + SettingsDialog + + + + Copy + + + + + + Rename + + + + + + Remove + + + + + Artist + + + + + Album + + + + + Title + + + + + Tracknumber + + + + + Genre + + + + + Filename + + + + + Filepath + + + + + Date + + + + + Year + + + + + Comment + + + + + Choose a directory + + + + + File Operations Settings + + + + + Enabled + + + + + Operation + + + + + Menu text + + + + + Shortcut + + + + + + + + + + + - + + + + + + + + ... + + + + + Destination: + + + + + File name pattern: + + + + diff --git a/src/plugins/General/fileops/translations/fileops_plugin_pl.ts b/src/plugins/General/fileops/translations/fileops_plugin_pl.ts new file mode 100644 index 000000000..51843a1a5 --- /dev/null +++ b/src/plugins/General/fileops/translations/fileops_plugin_pl.ts @@ -0,0 +1,212 @@ + + + + + FileOps + + + Error + + + + + Destination directory doesn't exist + + + + + Copying + + + + + Stop + + + + + Copying file %1/%2 + + + + + Remove files + + + + + Are you sure you want to remove %1 file(s) from disk + + + + + FileOpsFactory + + + File Operations Plugin + + + + + About File Operations Plugin + + + + + Qmmp File Operations Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + HotkeyDialog + + + Modify Shortcut + + + + + Press the key combination you want to assign + + + + + Clear + + + + + SettingsDialog + + + + Copy + + + + + + Rename + + + + + + Remove + + + + + Artist + + + + + Album + + + + + Title + + + + + Tracknumber + + + + + Genre + + + + + Filename + + + + + Filepath + + + + + Date + + + + + Year + + + + + Comment + + + + + Choose a directory + + + + + File Operations Settings + + + + + Enabled + + + + + Operation + + + + + Menu text + + + + + Shortcut + + + + + + + + + + + - + + + + + + + + ... + + + + + Destination: + + + + + File name pattern: + + + + diff --git a/src/plugins/General/fileops/translations/fileops_plugin_ru.ts b/src/plugins/General/fileops/translations/fileops_plugin_ru.ts new file mode 100644 index 000000000..d9a432288 --- /dev/null +++ b/src/plugins/General/fileops/translations/fileops_plugin_ru.ts @@ -0,0 +1,212 @@ + + + + + FileOps + + + Error + Ошибка + + + + Destination directory doesn't exist + Директория назначения не существует + + + + Copying + Копирование + + + + Stop + Остановить + + + + Copying file %1/%2 + Копирование файла %1/%2 + + + + Remove files + Удалить файлы + + + + Are you sure you want to remove %1 file(s) from disk + Вы уверены, что хотите удалить %1 файл(ов) с диска + + + + FileOpsFactory + + + File Operations Plugin + Модуль файловых операций + + + + About File Operations Plugin + О модуле файловых операций + + + + Qmmp File Operations Plugin + Модуль работы с файлами для Qmmp + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Разработчик: Илья Котов <forkotov02@hotmail.ru> + + + + HotkeyDialog + + + Modify Shortcut + Изменить сочетание клавиш + + + + Press the key combination you want to assign + Нажмите клавиши, сочетание которых вы хотите использовать + + + + Clear + Очистить + + + + SettingsDialog + + + + Copy + Копировать + + + + + Rename + Переименовать + + + + + Remove + Удалить + + + + Artist + Исполнитель + + + + Album + Альбом + + + + Title + Название + + + + Tracknumber + Номер трека + + + + Genre + Жанр + + + + Filename + Имя файла + + + + Filepath + Путь к файлу + + + + Date + Дата + + + + Year + Год + + + + Comment + Комментарий + + + + Choose a directory + Выберите директорию + + + + File Operations Settings + Настройки файловых операций + + + + Enabled + Включён + + + + Operation + Операция + + + + Menu text + Текст меню + + + + Shortcut + Сочетание клавиш + + + + + + + + + + - + + + + + + + + ... + + + + + Destination: + Назначение: + + + + File name pattern: + Формат имени файла: + + + diff --git a/src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts b/src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts new file mode 100644 index 000000000..51843a1a5 --- /dev/null +++ b/src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts @@ -0,0 +1,212 @@ + + + + + FileOps + + + Error + + + + + Destination directory doesn't exist + + + + + Copying + + + + + Stop + + + + + Copying file %1/%2 + + + + + Remove files + + + + + Are you sure you want to remove %1 file(s) from disk + + + + + FileOpsFactory + + + File Operations Plugin + + + + + About File Operations Plugin + + + + + Qmmp File Operations Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + HotkeyDialog + + + Modify Shortcut + + + + + Press the key combination you want to assign + + + + + Clear + + + + + SettingsDialog + + + + Copy + + + + + + Rename + + + + + + Remove + + + + + Artist + + + + + Album + + + + + Title + + + + + Tracknumber + + + + + Genre + + + + + Filename + + + + + Filepath + + + + + Date + + + + + Year + + + + + Comment + + + + + Choose a directory + + + + + File Operations Settings + + + + + Enabled + + + + + Operation + + + + + Menu text + + + + + Shortcut + + + + + + + + + + + - + + + + + + + + ... + + + + + Destination: + + + + + File name pattern: + + + + diff --git a/src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts b/src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts new file mode 100644 index 000000000..51843a1a5 --- /dev/null +++ b/src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts @@ -0,0 +1,212 @@ + + + + + FileOps + + + Error + + + + + Destination directory doesn't exist + + + + + Copying + + + + + Stop + + + + + Copying file %1/%2 + + + + + Remove files + + + + + Are you sure you want to remove %1 file(s) from disk + + + + + FileOpsFactory + + + File Operations Plugin + + + + + About File Operations Plugin + + + + + Qmmp File Operations Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + HotkeyDialog + + + Modify Shortcut + + + + + Press the key combination you want to assign + + + + + Clear + + + + + SettingsDialog + + + + Copy + + + + + + Rename + + + + + + Remove + + + + + Artist + + + + + Album + + + + + Title + + + + + Tracknumber + + + + + Genre + + + + + Filename + + + + + Filepath + + + + + Date + + + + + Year + + + + + Comment + + + + + Choose a directory + + + + + File Operations Settings + + + + + Enabled + + + + + Operation + + + + + Menu text + + + + + Shortcut + + + + + + + + + + + - + + + + + + + + ... + + + + + Destination: + + + + + File name pattern: + + + + diff --git a/src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts b/src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts new file mode 100644 index 000000000..51843a1a5 --- /dev/null +++ b/src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts @@ -0,0 +1,212 @@ + + + + + FileOps + + + Error + + + + + Destination directory doesn't exist + + + + + Copying + + + + + Stop + + + + + Copying file %1/%2 + + + + + Remove files + + + + + Are you sure you want to remove %1 file(s) from disk + + + + + FileOpsFactory + + + File Operations Plugin + + + + + About File Operations Plugin + + + + + Qmmp File Operations Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + HotkeyDialog + + + Modify Shortcut + + + + + Press the key combination you want to assign + + + + + Clear + + + + + SettingsDialog + + + + Copy + + + + + + Rename + + + + + + Remove + + + + + Artist + + + + + Album + + + + + Title + + + + + Tracknumber + + + + + Genre + + + + + Filename + + + + + Filepath + + + + + Date + + + + + Year + + + + + Comment + + + + + Choose a directory + + + + + File Operations Settings + + + + + Enabled + + + + + Operation + + + + + Menu text + + + + + Shortcut + + + + + + + + + + + - + + + + + + + + ... + + + + + Destination: + + + + + File name pattern: + + + + diff --git a/src/plugins/General/fileops/translations/translations.qrc b/src/plugins/General/fileops/translations/translations.qrc new file mode 100644 index 000000000..f1a8be99b --- /dev/null +++ b/src/plugins/General/fileops/translations/translations.qrc @@ -0,0 +1,12 @@ + + + + fileops_plugin_ru.qm + fileops_plugin_uk_UA.qm + fileops_plugin_zh_CN.qm + fileops_plugin_zh_TW.qm + fileops_plugin_cs.qm + fileops_plugin_de.qm + fileops_plugin_pl.qm + + -- cgit v1.2.3-13-gbd6f