diff options
32 files changed, 2095 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b02bbeb85..2ee2fdf60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,7 @@ PRINT_SUMMARY ("Tray support ......................" USE_STATICON 1) PRINT_SUMMARY ("Notifier support .................." USE_NOTIFIER 1) PRINT_SUMMARY ("Lyrics support ...................." USE_LYRICS 1) PRINT_SUMMARY ("HAL support ......................." USE_HAL 1) +PRINT_SUMMARY ("UDisks support ...................." USE_UDISKS 1) PRINT_SUMMARY ("Global hotkey support ............." USE_HOTKEY X11_FOUND) PRINT_SUMMARY ("File operations ..................." USE_FILEOPS 1) PRINT_SUMMARY ("Cover manager ....................." USE_COVER 1) @@ -38,7 +38,7 @@ Other features: - MP3, Vorbis, AAC, AAC+ streams support - mms support (experimental) - MPRIS -- Removable device detection (via HAL) +- Removable device detection (via HAL or UDisks) - Video playback via Mplayer - Lyrics (using lyricsplugin.com) - Cover art support @@ -105,7 +105,7 @@ Available options: - USE_SRC, USE_BS2B, USE_LADSPA (effects); - USE_ANALYZER, USE_PROJECTM (visualization); - USE_MPRIS, USE_SCROBBLER, USE_STATICON, USE_NOTIFIER, USE_LYRICS, USE_HAL, USE_HOTKEY, USE_FILEOPS, USE_COVER, - USE_KDENOTIFY (general plugins); + USE_KDENOTIFY, USE_UDISKS (general plugins); - USE_QMMP_DIALOG (file dialog); - USE_ENCA (automatic charset detection); - USE_SKINNED (standard skinned UI) diff --git a/README.RUS b/README.RUS index ff58ee316..99641a6df 100644 --- a/README.RUS +++ b/README.RUS @@ -38,7 +38,7 @@ Qmmp - Qt-based multimedia player - поддержка потоков MP3, Vorbis, AAC, AAC+ - поддержка протокола MMS (экспериментальная) - MPRIS -- автоопределение съёмных устройств (с помощью HAL) +- автоопределение съёмных устройств (с помощью HAL или UDisks) - воспроизведение видео с помощью Mplayer-а - получение текстов песен с lyricsplugin.com - просмотр обложек @@ -104,7 +104,7 @@ cmake ./ -DUSE_JACK:BOOL=FALSE - USE_SRC, USE_BS2B, USE_LADSPA (эффекты); - USE_ANALYZER, USE_PROJECTM (визуализация); - USE_MPRIS, USE_SCROBBLER, USE_STATICON, USE_NOTIFIER, USE_LYRICS, USE_HAL, USE_HOTKEY, USE_FILEOPS, USE_COVER, - USE_KDENOTIFY (модули общего назначения); + USE_KDENOTIFY, USE_UDISKS (модули общего назначения); - USE_QMMP_DIALOG (файловый диалог); - USE_ENCA (автоматическое определение кодировки); - USE_SKINNED (стандартный пользовательский интерфейс) diff --git a/src/plugins/General/CMakeLists.txt b/src/plugins/General/CMakeLists.txt index 629c741a8..cb8931cc0 100644 --- a/src/plugins/General/CMakeLists.txt +++ b/src/plugins/General/CMakeLists.txt @@ -4,6 +4,7 @@ SET(USE_STATICON TRUE CACHE BOOL "enable/disable status icon plugin") 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_UDISKS TRUE CACHE BOOL "enable/disable udisks plugin") SET(USE_HOTKEY TRUE CACHE BOOL "enable/disable global hotkey plugin") SET(USE_FILEOPS TRUE CACHE BOOL "enable/disable fileops plugin") SET(USE_COVER TRUE CACHE BOOL "enable/disable cover manager plugin") @@ -33,6 +34,10 @@ IF(USE_HAL) add_subdirectory(hal) ENDIF(USE_HAL) +IF(USE_UDISKS) +add_subdirectory(udisks) +ENDIF(USE_UDISKS) + IF(USE_HOTKEY) add_subdirectory(hotkey) ENDIF(USE_HOTKEY) diff --git a/src/plugins/General/General.pro b/src/plugins/General/General.pro index 4c935d9a2..4fb1e2f19 100644 --- a/src/plugins/General/General.pro +++ b/src/plugins/General/General.pro @@ -3,8 +3,9 @@ SUBDIRS += statusicon \ lyrics \ scrobbler \ fileops -unix:SUBDIRS += mpris \ +unix:SUBDIRS += mpris \ hal \ + udisks \ hotkey \ covermanager \ kdenotify diff --git a/src/plugins/General/udisks/CMakeLists.txt b/src/plugins/General/udisks/CMakeLists.txt new file mode 100644 index 000000000..186c3ed5e --- /dev/null +++ b/src/plugins/General/udisks/CMakeLists.txt @@ -0,0 +1,66 @@ +project(libudisks) + +cmake_minimum_required(VERSION 2.4.8 FATAL_ERROR) + +SET (QT_USE_QTDBUS 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}) + +# libqmmpui & libqmmp +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmpui) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp) + +SET(libudisks_SRCS + udisksfactory.cpp + udisksmanager.cpp + udisksplugin.cpp + udisksdevice.cpp + settingsdialog.cpp +) + +SET(libudisks_MOC_HDRS + udisksfactory.h + udisksmanager.h + udisksplugin.h + udisksdevice.h + settingsdialog.h +) + +SET(libudisks_RCCS translations/translations.qrc) + +QT4_ADD_RESOURCES(libudisks_RCC_SRCS ${libudisks_RCCS}) + +QT4_WRAP_CPP(libudisks_MOC_SRCS ${libudisks_MOC_HDRS}) + +# user interface + +SET(libudisks_UIS + settingsdialog.ui +) + +QT4_WRAP_UI(libudisks_UIS_H ${libudisks_UIS}) +# Don't forget to include output directory, otherwise +# the UI file won't be wrapped! +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +ADD_LIBRARY(udisks MODULE ${libudisks_SRCS} ${libudisks_MOC_SRCS} ${libudisks_UIS_H} ${libudisks_RCC_SRCS}) +add_dependencies(udisks qmmpui) +target_link_libraries(udisks ${QT_LIBRARIES} -lqmmpui -lqmmp) +install(TARGETS udisks DESTINATION ${LIB_DIR}/qmmp/General) diff --git a/src/plugins/General/udisks/settingsdialog.cpp b/src/plugins/General/udisks/settingsdialog.cpp new file mode 100644 index 000000000..3e9b99cfd --- /dev/null +++ b/src/plugins/General/udisks/settingsdialog.cpp @@ -0,0 +1,58 @@ +/*************************************************************************** + * 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 <QTextCodec> +#include <QSettings> + +#include <qmmp/qmmp.h> + +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog(QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("UDisks"); + ui.cdGroupBox->setChecked(settings.value("cda", true).toBool()); + ui.addTracksCheckBox->setChecked(settings.value("add_tracks", false).toBool()); + ui.removeTracksCheckBox->setChecked(settings.value("remove_tracks", false).toBool()); + ui.removableGroupBox->setChecked(settings.value("removable", true).toBool()); + ui.addFilesCheckBox->setChecked(settings.value("add_files", false).toBool()); + ui.removeFilesCheckBox->setChecked(settings.value("remove_files", false).toBool()); + settings.endGroup(); +} + + +SettingsDialog::~SettingsDialog() +{} + +void SettingsDialog::accept() +{ + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("UDisks"); + settings.setValue("cda", ui.cdGroupBox->isChecked()); + settings.setValue("add_tracks", ui.addTracksCheckBox->isChecked()); + settings.setValue("remove_tracks", ui.removeTracksCheckBox->isChecked()); + settings.setValue("removable", ui.removableGroupBox->isChecked()); + settings.setValue("add_files", ui.addFilesCheckBox->isChecked()); + settings.setValue("remove_files", ui.removeFilesCheckBox->isChecked()); + settings.endGroup(); + QDialog::accept(); +} diff --git a/src/plugins/General/udisks/settingsdialog.h b/src/plugins/General/udisks/settingsdialog.h new file mode 100644 index 000000000..c2dc37d8c --- /dev/null +++ b/src/plugins/General/udisks/settingsdialog.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include <QDialog> + +#include "ui_settingsdialog.h" + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class SettingsDialog : public QDialog +{ +Q_OBJECT +public: + SettingsDialog(QWidget *parent = 0); + + ~SettingsDialog(); + + +public slots: + virtual void accept(); + +private: + Ui::SettingsDialog ui; +}; + +#endif diff --git a/src/plugins/General/udisks/settingsdialog.ui b/src/plugins/General/udisks/settingsdialog.ui new file mode 100644 index 000000000..62ef465f4 --- /dev/null +++ b/src/plugins/General/udisks/settingsdialog.ui @@ -0,0 +1,121 @@ +<ui version="4.0" > + <class>SettingsDialog</class> + <widget class="QDialog" name="SettingsDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>348</width> + <height>247</height> + </rect> + </property> + <property name="windowTitle" > + <string>HAL Plugin Settings</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3" > + <property name="leftMargin" > + <number>6</number> + </property> + <property name="rightMargin" > + <number>6</number> + </property> + <property name="bottomMargin" > + <number>6</number> + </property> + <item> + <widget class="QGroupBox" name="cdGroupBox" > + <property name="title" > + <string>CD Audio Detection</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <widget class="QCheckBox" name="addTracksCheckBox" > + <property name="text" > + <string>Add tracks to playlist automatically</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="removeTracksCheckBox" > + <property name="text" > + <string>Remove tracks from playlist automatically</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="removableGroupBox" > + <property name="title" > + <string>Removable Device Detection</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QCheckBox" name="addFilesCheckBox" > + <property name="text" > + <string>Add files to playlist automatically</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="removeFilesCheckBox" > + <property name="text" > + <string>Remove files from playlist automatically</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <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>199</x> + <y>221</y> + </hint> + <hint type="destinationlabel" > + <x>22</x> + <y>242</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>SettingsDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>247</x> + <y>225</y> + </hint> + <hint type="destinationlabel" > + <x>273</x> + <y>229</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/plugins/General/udisks/translations/translations.qrc b/src/plugins/General/udisks/translations/translations.qrc new file mode 100644 index 000000000..03690dedf --- /dev/null +++ b/src/plugins/General/udisks/translations/translations.qrc @@ -0,0 +1,18 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> + <qresource> + <file>udisks_plugin_it.qm</file> + <file>udisks_plugin_ru.qm</file> + <file>udisks_plugin_uk_UA.qm</file> + <file>udisks_plugin_zh_CN.qm</file> + <file>udisks_plugin_zh_TW.qm</file> + <file>udisks_plugin_cs.qm</file> + <file>udisks_plugin_de.qm</file> + <file>udisks_plugin_pl.qm</file> + <file>udisks_plugin_tr.qm</file> + <file>udisks_plugin_lt.qm</file> + <file>udisks_plugin_nl.qm</file> + <file>udisks_plugin_ja.qm</file> + <file>udisks_plugin_es.qm</file> + </qresource> +</RCC> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_cs.ts b/src/plugins/General/udisks/translations/udisks_plugin_cs.ts new file mode 100644 index 000000000..8c09baf6a --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_cs.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="cs"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>Nastavení modulu HAL</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Detekce zvukových CD</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Automaticky přidat stopy do seznamu skladeb</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Automaticky odebrat stopy ze seznamu skladeb</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Detekce odpojitelných zařízení</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Automaticky přidat soubory do seznamu skladeb</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Automaticky odebrat stopy ze seznamu skladeb</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Autor: Ilja Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Přidat CD „%1“</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Přidat svazek „%1“</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_de.ts b/src/plugins/General/udisks/translations/udisks_plugin_de.ts new file mode 100644 index 000000000..3f83b44d5 --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_de.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="de_DE"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>Einstellungen HAL-Modul</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Erkennung von Audio-CDs</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Titel automatisch zur Wiedergabeliste hinzufügen</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Titel automatisch von der Wiedergabeliste entfernen</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Erkennung von Wechseldatenträgern</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Dateien automatisch zur Wiedergabeliste hinzufügen</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Dateien automatisch von der Wiedergabeliste entfernen</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Autor: Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">CD „%1“ hinzufügen</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_es.ts b/src/plugins/General/udisks/translations/udisks_plugin_es.ts new file mode 100644 index 000000000..fd34828c4 --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_es.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="es"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>Configuración del módulo HAL</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Detección de audio CD</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Añadir pistas a la lista de reproducción automáticamente</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Eliminar pistas de la lista de reproducción automáticamente</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Detectar dispositivos extraibles</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Añadir archivos a la lista de reproducción automáticamente</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Eliminar archivos de la lista de reproducción automáticamente</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Escrito por: Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Añadir CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Añadir volumen "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_it.ts b/src/plugins/General/udisks/translations/udisks_plugin_it.ts new file mode 100644 index 000000000..41e58e207 --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_it.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="it"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>Impostazioni modulo HAL</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Rilevamento CD Audio</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Aggiungi automaticamente i titoli alla lista dei brani</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Rimuovi automaticamente i titoli dalla lista dei brani</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Rilevamento dispositivi rimovibili</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Aggiungi brani automaticamente alla lista</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Rimuovi automaticamente i brani dalla lista</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Autore: Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Aggiungi CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Aggiungi libreria "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_ja.ts b/src/plugins/General/udisks/translations/udisks_plugin_ja.ts new file mode 100644 index 000000000..297b80532 --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_ja.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="ja_JP"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>HAL プラグイン設定</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>音楽 CD 検知</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>プレイリストにトラックを自動追加</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>プレイリストからトラックを自動除去</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>着脱可能なデバイスの検知</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>プレイリストにファイルを自動追加</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>プレイリストからファイルを自動除去</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">制作: Илья Котов (Ilya Kotov) <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Cd "%1" を追加</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">量目 "%1" を追加</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_lt.ts b/src/plugins/General/udisks/translations/udisks_plugin_lt.ts new file mode 100644 index 000000000..4c957514f --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_lt.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="lt"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>HAL įskiepio nustatymai</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Audio CD aptikimas</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Įdėti takelius į grojaraštį automatiškai</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Pašalinti takelius iš grojaraščio automatiškai</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Išorinių įrenginių aptikimas</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Įdėti takelius į grojaratį automatiškai</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Pašalinti takelius iš grojaraščio automatiškai</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Sukūrė: Ilya Kotov</translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Pridėti CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Pridėti tomą "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_nl.ts b/src/plugins/General/udisks/translations/udisks_plugin_nl.ts new file mode 100644 index 000000000..1e226aca0 --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_nl.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="nl"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>HAL Module Instellingen</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>CD Audio Detectie</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Voeg nummers automatisch toe aan speellijst</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Verwijder nummers automatisch van speellijst</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Detectie van Verwisselbare Stations</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Voeg bestanden automatisch toe aan afspeellijst</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Verwijder bestanden automatisch van afspeellijst</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Auteur: Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Voeg CD "%1" toe</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Voeg Station "%1" toe</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_pl.ts b/src/plugins/General/udisks/translations/udisks_plugin_pl.ts new file mode 100644 index 000000000..e2ea43ba5 --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_pl.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="pl"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>Ustawienia wtyczki HAL</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Detekcja płyt CD Audio</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Automatycznie dodaj utwory do listy</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Automatycznie usuń utwory z listy</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Detekcja urządzeń przenośnych</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Automatycznie dodaj pliki do listy</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Automatycznie usuń pliki z listy</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Autor: Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Dodaj CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Dodaj urządzenie "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_ru.ts b/src/plugins/General/udisks/translations/udisks_plugin_ru.ts new file mode 100644 index 000000000..d4051be29 --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_ru.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="ru_RU"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>Настройки модуля HAL</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Автоопределение аудио-CD</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Автоматически добавлять треки в список</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Автоматически удалять треки из списка</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Автоопределение съёмных устройств</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Автоматически добавлять треки в список</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Автоматически удалять треки из списка </translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Разработчик: Илья Котов</translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Добавить CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Добавить том "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_tr.ts b/src/plugins/General/udisks/translations/udisks_plugin_tr.ts new file mode 100644 index 000000000..9598d418f --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_tr.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="tr_TR"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>HAL Eklentis Ayarları</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>CD Ses Algılama</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Parçaları listeye otomatik olarka ekle</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Parçaları listeden otomatik olarak kaldır</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Çıkarılabilir Aygıt Algılama</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Dosyaları listeye otomatik olarak ekle</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Dosyaları listeden otomatik olarak kaldır</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Yazan: Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">CD "%1" Ekle</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">"%1" Aygıtını Ekle</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_uk_UA.ts b/src/plugins/General/udisks/translations/udisks_plugin_uk_UA.ts new file mode 100644 index 000000000..555eb6d9f --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_uk_UA.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="uk"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>Налаштування модуля HAL</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>Автовизначення аудіо-CD</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>Автоматично додавати треки до списку</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>Автоматично видаляти треки зі списку</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>Виявлення змінних пристроїв</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>Автоматично додавати файли до списку</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>Автоматично видаляти файли зі списку</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">Розробник: Ілля Котов <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">Додати CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">Додати том "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_zh_CN.ts b/src/plugins/General/udisks/translations/udisks_plugin_zh_CN.ts new file mode 100644 index 000000000..64a4f47dd --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_zh_CN.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="zh_CN"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>HAL 插件设置</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>CD 音频检测</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>自动添加音轨到播放列表</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>自动从播放列表删除音轨</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>可移动设备检测</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>自动添加文件到播放列表</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>自动从播放列表删除文件</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">作者:Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">添加 CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">添加卷 "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/translations/udisks_plugin_zh_TW.ts b/src/plugins/General/udisks/translations/udisks_plugin_zh_TW.ts new file mode 100644 index 000000000..a51f00fbe --- /dev/null +++ b/src/plugins/General/udisks/translations/udisks_plugin_zh_TW.ts @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="zh_TW"> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.ui" line="13"/> + <source>HAL Plugin Settings</source> + <translation>HAL 插件設置</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="28"/> + <source>CD Audio Detection</source> + <translation>CD 音頻檢測</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="37"/> + <source>Add tracks to playlist automatically</source> + <translation>自動添加音軌到播放清單</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="44"/> + <source>Remove tracks from playlist automatically</source> + <translation>自動從播放清單刪除音軌</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="54"/> + <source>Removable Device Detection</source> + <translation>可移動設備檢測</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="63"/> + <source>Add files to playlist automatically</source> + <translation>自動添加檔案到播放清單</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="70"/> + <source>Remove files from playlist automatically</source> + <translation>自動從播放清單刪除檔案</translation> + </message> +</context> +<context> + <name>UDisksFactory</name> + <message> + <location filename="../udisksfactory.cpp" line="30"/> + <source>UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="50"/> + <source>About UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="51"/> + <source>Qmmp UDisks Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="52"/> + <source>This plugin provides removable devices detection using UDisks</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../udisksfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished">作者:Ilya Kotov <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>UDisksPlugin</name> + <message> + <location filename="../udisksplugin.cpp" line="152"/> + <source>Add CD "%1"</source> + <translation type="unfinished">添加 CD "%1"</translation> + </message> + <message> + <location filename="../udisksplugin.cpp" line="158"/> + <source>Add Volume "%1"</source> + <translation type="unfinished">添加卷 "%1"</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/udisks/udisks.pro b/src/plugins/General/udisks/udisks.pro new file mode 100644 index 000000000..90d9a5ad6 --- /dev/null +++ b/src/plugins/General/udisks/udisks.pro @@ -0,0 +1,54 @@ +include(../../plugins.pri) + +CONFIG += release \ +warn_on \ +plugin \ + lib \ + qdbus + +TARGET = $$PLUGINS_PREFIX/General/udisks +QMAKE_CLEAN = $$PLUGINS_PREFIX/General/libudisks.so + +TEMPLATE = lib +QMAKE_LIBDIR += ../../../../lib + +TRANSLATIONS = translations/udisks_plugin_cs.ts \ + translations/udisks_plugin_de.ts \ + translations/udisks_plugin_zh_CN.ts \ + translations/udisks_plugin_zh_TW.ts \ + translations/udisks_plugin_ru.ts \ + translations/udisks_plugin_pl.ts \ + translations/udisks_plugin_uk_UA.ts \ + translations/udisks_plugin_it.ts \ + translations/udisks_plugin_tr.ts \ + translations/udisks_plugin_lt.ts \ + translations/udisks_plugin_nl.ts \ + translations/udisks_plugin_ja.ts \ + translations/udisks_plugin_es.ts + +RESOURCES = translations/translations.qrc + +isEmpty(LIB_DIR){ + LIB_DIR = /lib +} +target.path = $$LIB_DIR/qmmp/General +INSTALLS += target + + +HEADERS += udisksfactory.h \ + udisksplugin.h \ + udisksmanager.h \ + udisksdevice.h \ + settingsdialog.h + +SOURCES += udisksfactory.cpp \ + udisksplugin.cpp \ + udisksmanager.cpp \ + udisksdevice.cpp \ + settingsdialog.cpp + +INCLUDEPATH += ../../../../src + +LIBS += -lqmmpui -lqmmp + +FORMS += settingsdialog.ui diff --git a/src/plugins/General/udisks/udisksdevice.cpp b/src/plugins/General/udisks/udisksdevice.cpp new file mode 100644 index 000000000..d9863bb39 --- /dev/null +++ b/src/plugins/General/udisks/udisksdevice.cpp @@ -0,0 +1,50 @@ +/*************************************************************************** + * 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 <QDBusInterface> +#include <QDBusConnection> + +#include "udisksdevice.h" + + +UDisksDevice::UDisksDevice(QDBusObjectPath o, QObject *parent) + : QObject(parent) +{ + m_interface = new QDBusInterface("org.freedesktop.UDisks", o.path(), + "org.freedesktop.UDisks.Device", QDBusConnection::systemBus(), this); + m_interface->connection().connect("org.freedesktop.UDisks", o.path(), + "org.freedesktop.UDisks.Device","Changed", + this, SIGNAL(changed())); + m_path = o; +} + +QVariant UDisksDevice::property (const QString &key) +{ + return m_interface->property(key.toAscii().data()); +} + +UDisksDevice::~UDisksDevice() +{ +} + +QDBusObjectPath UDisksDevice::objectPath() const +{ + return m_path; +} diff --git a/src/plugins/General/udisks/udisksdevice.h b/src/plugins/General/udisks/udisksdevice.h new file mode 100644 index 000000000..59a1387c8 --- /dev/null +++ b/src/plugins/General/udisks/udisksdevice.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef UDISKSDEVICE_H +#define UDISKSDEVICE_H + +#include <QObject> +#include <QDBusObjectPath> +#include <QDBusMetaType> +#include <QList> +#include <QVariant> + +class QDBusInterface; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class UDisksDevice : public QObject +{ + Q_OBJECT +public: + UDisksDevice(QDBusObjectPath o, QObject *parent = 0); + + ~UDisksDevice(); + + QVariant property (const QString &key); + QDBusObjectPath objectPath() const; + +signals: + void changed(); + + +private: + QDBusInterface *m_interface; + QDBusObjectPath m_path; +}; + +#endif diff --git a/src/plugins/General/udisks/udisksfactory.cpp b/src/plugins/General/udisks/udisksfactory.cpp new file mode 100644 index 000000000..89fcb5e5b --- /dev/null +++ b/src/plugins/General/udisks/udisksfactory.cpp @@ -0,0 +1,64 @@ +/*************************************************************************** + * 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 <QtGui> +#include <qmmp/qmmp.h> +#include "settingsdialog.h" +#include "udisksplugin.h" +#include "udisksfactory.h" + +const GeneralProperties UDisksFactory::properties() const +{ + GeneralProperties properties; + properties.name = tr("UDisks Plugin"); + properties.shortName = "udisks"; + properties.hasAbout = true; + properties.hasSettings = true; + properties.visibilityControl = false; + return properties; +} + +General *UDisksFactory::create(QObject *parent) +{ + return new UDisksPlugin(parent); +} + +QDialog *UDisksFactory::createConfigDialog(QWidget *parent) +{ + return new SettingsDialog(parent); +} + +void UDisksFactory::showAbout(QWidget *parent) +{ + QMessageBox::about (parent, tr("About UDisks Plugin"), + tr("Qmmp UDisks Plugin") + "\n" + + tr("This plugin provides removable devices detection using UDisks") + "\n" + + tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>")); +} + +QTranslator *UDisksFactory::createTranslator(QObject *parent) +{ + QTranslator *translator = new QTranslator(parent); + QString locale = Qmmp::systemLanguageID(); + translator->load(QString(":/udisks_plugin_") + locale); + return translator; +} + +Q_EXPORT_PLUGIN2(udisks, UDisksFactory) diff --git a/src/plugins/General/udisks/udisksfactory.h b/src/plugins/General/udisks/udisksfactory.h new file mode 100644 index 000000000..73e7195ce --- /dev/null +++ b/src/plugins/General/udisks/udisksfactory.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef DEVDETECTFACTORY_H +#define DEVDETECTFACTORY_H + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +#include <QObject> +#include <QTranslator> + +#include <qmmpui/general.h> +#include <qmmpui/generalfactory.h> + +class UDisksFactory : 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/udisks/udisksmanager.cpp b/src/plugins/General/udisks/udisksmanager.cpp new file mode 100644 index 000000000..a05b4d0ad --- /dev/null +++ b/src/plugins/General/udisks/udisksmanager.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * 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 <QDBusInterface> +#include <QDBusConnection> +#include <QDBusReply> + +#include "udisksmanager.h" + +UDisksManager::UDisksManager(QObject *parent) + : QObject(parent) +{ + m_interface = new QDBusInterface("org.freedesktop.UDisks", "/org/freedesktop/UDisks", + "org.freedesktop.UDisks", QDBusConnection::systemBus(), this); + + m_interface->connection().connect("org.freedesktop.UDisks", "/org/freedesktop/UDisks", + "org.freedesktop.UDisks", "DeviceAdded", + this, SIGNAL(deviceAdded(QDBusObjectPath))); + + m_interface->connection().connect("org.freedesktop.UDisks", "/org/freedesktop/UDisks", + "org.freedesktop.UDisks", "DeviceRemoved", + this, SIGNAL(deviceRemoved(QDBusObjectPath))); + +} + + +UDisksManager::~UDisksManager() +{ +} + +QList<QDBusObjectPath> UDisksManager::findAllDevices() +{ + QDBusReply <QList<QDBusObjectPath> > reply = m_interface->call("EnumerateDevices"); + if (!reply.isValid()) + { + qWarning("UDisksManager: error: %s", qPrintable(reply.error().name())); + return QList<QDBusObjectPath>(); + } + return reply.value(); +} diff --git a/src/plugins/General/udisks/udisksmanager.h b/src/plugins/General/udisks/udisksmanager.h new file mode 100644 index 000000000..fb6795b1d --- /dev/null +++ b/src/plugins/General/udisks/udisksmanager.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef UDISKSMANAGER_H +#define UDISKSMANAGER_H + +#include <QObject> +#include <QList> +#include <QDBusObjectPath> + +class QDBusInterface; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class UDisksManager : public QObject +{ +Q_OBJECT +public: + UDisksManager(QObject *parent = 0); + + ~UDisksManager(); + + QList<QDBusObjectPath> findAllDevices(); + +signals: + void deviceAdded(QDBusObjectPath); + void deviceRemoved(QDBusObjectPath); + +private: + QDBusInterface *m_interface; + +}; + +#endif diff --git a/src/plugins/General/udisks/udisksplugin.cpp b/src/plugins/General/udisks/udisksplugin.cpp new file mode 100644 index 000000000..1683f095b --- /dev/null +++ b/src/plugins/General/udisks/udisksplugin.cpp @@ -0,0 +1,255 @@ +/*************************************************************************** + * 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 <QtDBus> +#include <QActionGroup> +#include <qmmpui/generalhandler.h> +#include <qmmpui/mediaplayer.h> +#include <qmmpui/playlistmanager.h> +#include <qmmpui/playlistitem.h> +#include <qmmp/qmmp.h> +#include "udisksdevice.h" +#include "udisksmanager.h" +#include "udisksplugin.h" + +UDisksPlugin::UDisksPlugin(QObject *parent) + : General(parent) +{ + m_manager = new UDisksManager(this); + m_actions = new QActionGroup(this); + connect(m_manager,SIGNAL(deviceAdded(QDBusObjectPath)), SLOT(addDevice(QDBusObjectPath))); + connect(m_manager,SIGNAL(deviceRemoved(QDBusObjectPath)), SLOT(removeDevice(QDBusObjectPath))); + connect(m_actions,SIGNAL(triggered (QAction *)), SLOT(processAction(QAction *))); + //load settings + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("UDisks"); + m_detectCDA = settings.value("cda", true).toBool(); + m_detectRemovable = settings.value("removable", true).toBool(); + m_addTracks = false; //do not load tracks on startup + m_addFiles = false; + //find existing devices + QList<QDBusObjectPath> devs = m_manager->findAllDevices(); + foreach(QDBusObjectPath o, devs) + addDevice(o); + //load remaining settings + m_addTracks = settings.value("add_tracks", false).toBool(); + m_removeTracks = settings.value("remove_tracks", false).toBool(); + m_addFiles = settings.value("add_files", false).toBool(); + m_removeFiles = settings.value("remove_files", false).toBool(); + settings.endGroup(); +} + + +UDisksPlugin::~UDisksPlugin() +{ +} + +void UDisksPlugin::removeDevice(QDBusObjectPath o) +{ + foreach(UDisksDevice *device, m_devices) + { + if (device->objectPath() == o) + { + m_devices.removeAll(device); + delete device; + qDebug("UDisksPlugin: device \"%s\" removed", qPrintable(o.path())); + updateActions(); + break; + } + } +} + +void UDisksPlugin::addDevice(QDBusObjectPath o) +{ + foreach(UDisksDevice *device, m_devices) //is it already exists? + { + if (device->objectPath() == o) + return; + } + UDisksDevice *device = new UDisksDevice(o, this); + + //audio cd + if (device->property("DeviceIsOpticalDisc").toBool() && + device->property("OpticalDiscNumAudioTracks").toInt()) + { + if (m_detectCDA) + { + qDebug("UDisksPlugin: device \"%s\" added (cd audio)", qPrintable(o.path())); + m_devices << device; + connect(device, SIGNAL(changed()), SLOT(updateActions())); + updateActions(); + } + else + delete device; + return; + } + + // filter mounted partitions + if ((!device->property("DeviceIsPartition").toBool() || + device->property("DeviceIsSystemInternal").toBool()) && + !device->property("DeviceIsOpticalDisc").toBool()) + { + delete device; + return; + } + if (device->property("PartitionSize").toLongLong() < 17000000000LL && + (device->property("IdType").toString() == "vfat" || + device->property("IdType").toString() == "iso9660" || + device->property("IdType").toString() == "udf" || + device->property("IdType").toString() == "ext2")) + { + if (m_detectRemovable) + { + qDebug("UDisksPlugin: device \"%s\" added (removable)", qPrintable(o.path())); + m_devices << device; + updateActions(); + connect(device, SIGNAL(changed()), SLOT(updateActions())); + } + else + delete device; + return; + } + delete device; +} + +void UDisksPlugin::updateActions() +{ + // add action for cd audio or mounted volume + foreach(UDisksDevice *device, m_devices) + { + QString dev_path; + if (device->property("DeviceIsOpticalDisc").toBool() && + device->property("OpticalDiscNumAudioTracks").toInt()) //cd audio + dev_path = "cdda://" + device->property("block.device").toString(); + else if (device->property("DeviceIsMounted").toBool()) //mounted volume + dev_path = device->property("DeviceMountPaths").toStringList()[0]; + else + continue; + + if (!findAction(dev_path)) + { + QAction *action = new QAction(this); + QString actionText; + if (device->property("DeviceIsOpticalDisc").toBool() + && device->property("OpticalDiscNumAudioTracks").toInt()) + actionText = QString(tr("Add CD \"%1\"")).arg(device->property("DeviceFile").toString()); + else + { + QString name = device->property("IdLabel").toString(); + if (name.isEmpty()) + name = dev_path; + actionText = QString(tr("Add Volume \"%1\"")).arg(name); + } + action->setText(actionText); + action->setData(dev_path); + m_actions->addAction(action); + GeneralHandler::instance()->addAction(action, GeneralHandler::TOOLS_MENU); + addPath(dev_path); + } + } + // remove action if device is unmounted/removed + foreach(QAction *action, m_actions->actions ()) + { + if (!findDevice(action)) + { + m_actions->removeAction(action); + GeneralHandler::instance()->removeAction(action); + removePath(action->data().toString()); + action->deleteLater(); + } + } +} + +void UDisksPlugin::processAction(QAction *action) +{ + qDebug("UDisksPlugin: action triggered: %s", qPrintable(action->data().toString())); + QString path = action->data().toString(); + if (path.startsWith("cdda://")) + MediaPlayer::instance()->playListManager()->selectedPlayList()->addFile(path); + else + MediaPlayer::instance()->playListManager()->selectedPlayList()->addDirectory(path); +} + +QAction *UDisksPlugin::findAction(const QString &dev_path) +{ + foreach(QAction *action, m_actions->actions ()) + { + if (action->data().toString() == dev_path) + return action; + } + return 0; +} + +UDisksDevice *UDisksPlugin::findDevice(QAction *action) +{ + foreach(UDisksDevice *device, m_devices) + { + QString dev_path; + if (device->property("DeviceIsOpticalDisc").toBool() && + device->property("OpticalDiscNumAudioTracks").toInt()) + { + dev_path = "cdda://" + device->property("DeviceFile").toString(); + if (dev_path == action->data().toString()) + return device; + } + if (device->property("DeviceIsMounted").toBool()) + { + dev_path = device->property("DeviceMountPaths").toStringList()[0]; + if (dev_path == action->data().toString()) + return device; + } + } + return 0; +} + +void UDisksPlugin::addPath(const QString &path) +{ + foreach(PlayListItem *item, MediaPlayer::instance()->playListManager()->selectedPlayList()->items()) // Is it already exist? + { + if (item->url().startsWith(path)) + return; + } + + if (path.startsWith("cdda://") && m_addTracks) + { + MediaPlayer::instance()->playListManager()->selectedPlayList()->addFile(path); + return; + } + else if (!path.startsWith("cdda://") && m_addFiles) + MediaPlayer::instance()->playListManager()->selectedPlayList()->addDirectory(path); +} + +void UDisksPlugin::removePath(const QString &path) +{ + if ((path.startsWith("cdda://") && !m_removeTracks) || + (!path.startsWith("cdda://") && !m_removeFiles)) //process settings + return; + + PlayListModel *model = MediaPlayer::instance()->playListManager()->selectedPlayList(); + + int i = 0; + while (model->count() > 0 && i < model->count()) + { + if (model->item(i)->url ().startsWith(path)) + model->removeAt (i); + else + ++i; + } +} diff --git a/src/plugins/General/udisks/udisksplugin.h b/src/plugins/General/udisks/udisksplugin.h new file mode 100644 index 000000000..b42f012c6 --- /dev/null +++ b/src/plugins/General/udisks/udisksplugin.h @@ -0,0 +1,65 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef UDISKSPLUGIN_H +#define UDISKSPLUGIN_H + +#include <QDBusObjectPath> +#include <qmmpui/general.h> + +class UDisksManager; +class UDisksDevice; +class QActionGroup; +class QAction; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ + +class UDisksPlugin : public General +{ +Q_OBJECT +public: + UDisksPlugin(QObject *parent = 0); + + ~UDisksPlugin(); + +private slots: + void removeDevice(QDBusObjectPath); + void addDevice(QDBusObjectPath); + void processAction(QAction *action); + void updateActions(); + +private: + QAction *findAction(const QString &dev_path); + UDisksDevice *findDevice(QAction *action); + void addPath(const QString &path); + void removePath(const QString &path); + UDisksManager *m_manager; + QList <UDisksDevice *> m_devices; + QActionGroup *m_actions; + bool m_detectCDA; + bool m_addTracks; + bool m_removeTracks; + bool m_detectRemovable; + bool m_addFiles; + bool m_removeFiles; +}; + +#endif |
