kwave
18.07.70
|
#include <SaveBlocksPlugin.h>
Classes | |
struct | BlockInfo |
Public Types | |
enum | numbering_mode_t { CONTINUE = 0, START_AT_ONE = 1 } |
Signals | |
void | sigNewExample (const QString &example) |
![]() | |
void | sigRunning (Kwave::Plugin *plugin) |
void | sigDone (Kwave::Plugin *plugin) |
void | sigClosed (Kwave::Plugin *p) |
void | sigCommand (const QString &command) |
void | setProgressText (const QString &text) |
Public Member Functions | |
SaveBlocksPlugin (QObject *parent, const QVariantList &args) | |
virtual | ~SaveBlocksPlugin () Q_DECL_OVERRIDE |
virtual QStringList * | setup (QStringList &previous_params) Q_DECL_OVERRIDE |
virtual int | start (QStringList ¶ms) Q_DECL_OVERRIDE |
![]() | |
Plugin (QObject *parent, const QVariantList &args) | |
virtual | ~Plugin () Q_DECL_OVERRIDE |
virtual QString | name () const |
virtual QString | description () const |
virtual QString | progressText () |
virtual bool | canClose () const |
bool | isRunning () const |
bool | shouldStop () const |
virtual void | load (QStringList ¶ms) |
virtual void | unload () |
virtual int | stop () |
virtual void | run (QStringList params) |
Kwave::PluginManager & | manager () const |
Kwave::SignalManager & | signalManager () |
QWidget * | parentWidget () const |
QString | signalName () |
virtual sample_index_t | signalLength () |
virtual double | signalRate () |
virtual const QList< unsigned int > | selectedTracks () |
virtual sample_index_t | selection (QList< unsigned int > *tracks=Q_NULLPTR, sample_index_t *left=Q_NULLPTR, sample_index_t *right=Q_NULLPTR, bool expand_if_empty=false) |
virtual void | selectRange (sample_index_t offset, sample_index_t length) |
virtual void | migrateToActiveContext () |
![]() | |
virtual | ~Runnable () |
Protected Member Functions | |
int | interpreteParameters (QStringList ¶ms) |
void | scanBlocksToSave (const QString &base, bool selection_only) |
QString | createFileName (const QString &base, const QString &ext, const QString &pattern, unsigned int index, int count, int total) |
unsigned int | firstIndex (const QString &path, const QString &base, const QString &ext, const QString &pattern, Kwave::SaveBlocksPlugin::numbering_mode_t mode, unsigned int count) |
QString | findBase (const QString &filename, const QString &pattern) |
QString | firstFileName (const QString &filename, const QString &pattern, numbering_mode_t mode, bool selection_only) |
![]() | |
int | execute (QStringList ¶ms) |
void | emitCommand (const QString &command) |
void | use () |
void | setPluginManager (Kwave::PluginManager *new_plugin_manager) |
virtual void | run_wrapper (const QVariant ¶ms) Q_DECL_OVERRIDE |
Private Slots | |
void | updateExample (const QString &filename, const QString &pattern, Kwave::SaveBlocksPlugin::numbering_mode_t mode, bool selection_only) |
Private Member Functions | |
QString | createDisplayList (const QStringList &list, unsigned int max_entries) const |
Private Attributes | |
QUrl | m_url |
QString | m_pattern |
numbering_mode_t | m_numbering_mode |
bool | m_selection_only |
QList< BlockInfo > | m_block_info |
Additional Inherited Members | |
![]() | |
virtual void | setProgressDialogEnabled (bool enable) |
virtual void | updateProgress (qreal progress) |
virtual void | cancel () |
virtual void | close () |
void | release () |
Definition at line 33 of file SaveBlocksPlugin.h.
mode for numbering the output files
Enumerator | |
---|---|
CONTINUE | |
START_AT_ONE |
Definition at line 64 of file SaveBlocksPlugin.h.
Kwave::SaveBlocksPlugin::SaveBlocksPlugin | ( | QObject * | parent, |
const QVariantList & | args | ||
) |
Constructor
parent | reference to our plugin manager |
args | argument list [unused] |
Definition at line 47 of file SaveBlocksPlugin.cpp.
|
virtual |
|
private |
internal helper to create a string that contains a HTML formated list of file names or directories
list | a list of file names or directories |
max_entries | maximum number of entries to render |
Definition at line 159 of file SaveBlocksPlugin.cpp.
References _.
Referenced by start().
|
protected |
create a filename (without extension) out of a given base name, pattern, index and count
base | the base name, without indices, extension etc... |
ext | the extension (zero-length is allowed) |
pattern | the pattern for creating the filename |
index | the index of the current file |
count | the number of files to save |
total | the highest index to save (first + count - 1) |
Definition at line 497 of file SaveBlocksPlugin.cpp.
References _, Kwave::Parser::escapeForFileName(), Kwave::FileInfo::flags(), Kwave::FileInfo::FP_FORMAT_NUMERIC, Kwave::FileInfo::fromName(), Kwave::FileInfo::get(), Kwave::INF_UNKNOWN, m_block_info, and Kwave::Plugin::signalManager().
Referenced by firstFileName(), firstIndex(), and start().
|
protected |
Find out the base name out of a given file name, using a given filename pattern. If the given file name is already produced (matched) by this pattern, the base name will be cut out of the file name.
filename | the file name to check |
pattern | the selected filename pattern |
Definition at line 648 of file SaveBlocksPlugin.cpp.
References _, and Kwave::Plugin::name().
Referenced by firstFileName(), setup(), and start().
|
protected |
determines the first file name that matches the given filename, pattern, mode and selection
filename | the currently selected filename |
pattern | the selected filename pattern |
mode | the numbering mode |
selection_only | if true: save only the selection |
Definition at line 713 of file SaveBlocksPlugin.cpp.
References createFileName(), findBase(), firstIndex(), m_block_info, and scanBlocksToSave().
Referenced by updateExample().
|
protected |
determines the index of the first file name that matches the given filename, pattern and mode
path | the directory for saving |
base | the base name, without indices, extension etc... |
ext | the extension (zero-length is allowed) |
pattern | the pattern for creating the filename |
mode | the numbering mode |
count | the total number of files |
Definition at line 620 of file SaveBlocksPlugin.cpp.
References _, CONTINUE, createFileName(), Kwave::Plugin::name(), and START_AT_ONE.
Referenced by firstFileName(), and start().
|
protected |
reads values from the parameter list
Definition at line 409 of file SaveBlocksPlugin.cpp.
References CONTINUE, m_numbering_mode, m_pattern, m_selection_only, m_url, START_AT_ONE, and Kwave::Parser::unescape().
Referenced by setup(), and start().
|
protected |
determines the blocks which should be saved, including start position, length and title.
base | the base name, without indices, extension etc... |
selection_only | if true, save only selected blocks |
Definition at line 446 of file SaveBlocksPlugin.cpp.
References Kwave::FileInfo::get(), Kwave::INF_NAME, Kwave::MetaData::isNull(), m_block_info, Kwave::SaveBlocksPlugin::BlockInfo::m_length, Kwave::SaveBlocksPlugin::BlockInfo::m_start, Kwave::SaveBlocksPlugin::BlockInfo::m_title, Kwave::Label::name(), Kwave::Label::pos(), Kwave::Plugin::selection(), Kwave::Plugin::signalLength(), and Kwave::Plugin::signalManager().
Referenced by firstFileName(), setup(), and start().
|
virtual |
Shows a file saving dialog and emits a command for saving the blocks when OK has been pressed.
Reimplemented from Kwave::Plugin.
Definition at line 61 of file SaveBlocksPlugin.cpp.
References _, Kwave::connect(), Kwave::Plugin::description(), Kwave::Plugin::emitCommand(), Kwave::CodecManager::encodingFilter(), Kwave::Parser::escape(), findBase(), interpreteParameters(), m_numbering_mode, m_pattern, m_selection_only, m_url, Kwave::Plugin::name(), Kwave::Plugin::parentWidget(), scanBlocksToSave(), Kwave::Plugin::selection(), Kwave::Plugin::signalLength(), Kwave::Plugin::signalName(), sigNewExample(), and updateExample().
|
signal |
emitted by updateExample to update the filename preview
Referenced by setup(), and updateExample().
|
virtual |
Saves the files, using the settings made in "setup()"
Reimplemented from Kwave::Plugin.
Definition at line 184 of file SaveBlocksPlugin.cpp.
References _, createDisplayList(), createFileName(), DBG, Kwave::CodecManager::encoder(), findBase(), firstIndex(), Kwave::FileInfo::get(), Kwave::INF_NAME, interpreteParameters(), Kwave::MetaData::isNull(), m_block_info, m_numbering_mode, m_pattern, m_selection_only, m_url, Kwave::SignalManager::metaData(), Kwave::CodecManager::mimeTypeOf(), Kwave::Plugin::name(), Kwave::Plugin::parentWidget(), Kwave::Label::pos(), Kwave::FileInfo::properties(), Kwave::MetaDataList::replace(), scanBlocksToSave(), Kwave::Plugin::selection(), Kwave::Plugin::selectRange(), Kwave::FileInfo::set(), Kwave::Plugin::signalLength(), Kwave::Plugin::signalManager(), Kwave::Parser::unescape(), Kwave::Encoder::unsupportedProperties(), Kwave::MessageBox::warningContinueCancel(), and Kwave::MessageBox::warningYesNo().
|
privateslot |
called whenever the selection has changed and a new example has to be shown.
filename | the currently selected filename, including path |
pattern | the selected filename pattern |
mode | the numbering mode |
selection_only | if true: save only the selection |
Definition at line 734 of file SaveBlocksPlugin.cpp.
References firstFileName(), sigNewExample(), and Kwave::Parser::unescape().
Referenced by setup().
|
private |
list of all blocks to save
Definition at line 192 of file SaveBlocksPlugin.h.
Referenced by createFileName(), firstFileName(), scanBlocksToSave(), and start().
|
private |
mode for numbering the output files
Definition at line 186 of file SaveBlocksPlugin.h.
Referenced by interpreteParameters(), setup(), and start().
|
private |
expression with the filename pattern
Definition at line 183 of file SaveBlocksPlugin.h.
Referenced by interpreteParameters(), setup(), and start().
|
private |
if true, only save stuff within the selection
Definition at line 189 of file SaveBlocksPlugin.h.
Referenced by interpreteParameters(), setup(), and start().
|
private |
the URL of the first file (user selection)
Definition at line 180 of file SaveBlocksPlugin.h.
Referenced by interpreteParameters(), setup(), and start().