kwave  18.07.70
Kwave::SaveBlocksDialog Class Reference

#include <SaveBlocksDialog.h>

Inheritance diagram for Kwave::SaveBlocksDialog:
Inheritance graph
Collaboration diagram for Kwave::SaveBlocksDialog:
Collaboration graph

Public Slots

void setNewExample (const QString &example)
 
void emitUpdate ()
 

Signals

void sigSelectionChanged (const QString &filename, const QString &pattern, Kwave::SaveBlocksPlugin::numbering_mode_t mode, bool selection_only)
 
- Signals inherited from Kwave::FileDialog
void filterChanged (const QString &filter)
 

Public Member Functions

 SaveBlocksDialog (const QString &startDir, const QString &filter, QWidget *parent, const QUrl &last_url, const QString &last_ext, QString &filename_pattern, Kwave::SaveBlocksPlugin::numbering_mode_t numbering_mode, bool selection_only, bool have_selection)
 
virtual ~SaveBlocksDialog ()
 
QString pattern ()
 
Kwave::SaveBlocksPlugin::numbering_mode_t numberingMode ()
 
bool selectionOnly ()
 
- Public Member Functions inherited from Kwave::FileDialog
 FileDialog (const QString &startDir, OperationMode mode, const QString &filter, QWidget *parent, const QUrl last_url=QUrl(), const QString last_ext=QString())
 
virtual ~FileDialog () Q_DECL_OVERRIDE
 
QString selectedExtension ()
 
QUrl selectedUrl () const
 
QUrl baseUrl () const
 
void setDirectory (const QString &directory)
 
void selectUrl (const QUrl &url)
 
void setCustomWidget (QWidget *widget)
 
KUrlComboBox * locationEdit () const
 

Private Attributes

Kwave::SaveBlocksWidgetm_widget
 

Additional Inherited Members

- Public Types inherited from Kwave::FileDialog
enum  OperationMode { SaveFile = 0, OpenFile, SelectDir }
 
- Protected Slots inherited from Kwave::FileDialog
virtual void accept () Q_DECL_OVERRIDE
 
void saveConfig ()
 
- Protected Member Functions inherited from Kwave::FileDialog
void loadConfig (const QString &section)
 

Detailed Description

Definition at line 37 of file SaveBlocksDialog.h.

Constructor & Destructor Documentation

◆ SaveBlocksDialog()

Kwave::SaveBlocksDialog::SaveBlocksDialog ( const QString &  startDir,
const QString &  filter,
QWidget *  parent,
const QUrl &  last_url,
const QString &  last_ext,
QString &  filename_pattern,
Kwave::SaveBlocksPlugin::numbering_mode_t  numbering_mode,
bool  selection_only,
bool  have_selection 
)

Constructor.

See also
KFileFialog
Parameters
startDirthe start directory
filterstring with a file type filter
parentthe parent widget
last_urlthe last used URL
last_extthe last used extension (preset only)
filename_patternthe pattern used for generating the file names
numbering_modethe way the numbers are given
selection_onlyif true, save only the selection
have_selectionif true, there is a selection

Definition at line 32 of file SaveBlocksDialog.cpp.

References Kwave::connect(), emitUpdate(), Kwave::FileDialog::filterChanged(), Kwave::FileDialog::locationEdit(), m_widget, and Kwave::FileDialog::setCustomWidget().

42  :Kwave::FileDialog(startDir, Kwave::FileDialog::SaveFile, filter, parent,
43  last_url, last_ext),
44  m_widget(new(std::nothrow) Kwave::SaveBlocksWidget(this, filename_pattern,
45  numbering_mode, selection_only, have_selection))
46 {
47  Q_ASSERT(m_widget);
49  connect(m_widget, SIGNAL(somethingChanged()),
50  this, SLOT(emitUpdate()));
51 
52  // if something in the file selection changes
53  connect(this, SIGNAL(filterChanged(QString)),
54  this, SLOT(emitUpdate()));
55  connect(locationEdit(), SIGNAL(editTextChanged(QString)),
56  this, SLOT(emitUpdate()));
57 }
KUrlComboBox * locationEdit() const
Definition: FileDialog.cpp:346
void setCustomWidget(QWidget *widget)
Definition: FileDialog.cpp:340
bool connect(Kwave::StreamObject &source, const char *output, Kwave::StreamObject &sink, const char *input)
Definition: Connect.cpp:48
Kwave::SaveBlocksWidget * m_widget
void filterChanged(const QString &filter)
Here is the call graph for this function:

◆ ~SaveBlocksDialog()

Kwave::SaveBlocksDialog::~SaveBlocksDialog ( )
virtual

Destructor

Definition at line 60 of file SaveBlocksDialog.cpp.

References m_widget.

61 {
62  if (m_widget) delete m_widget;
63  m_widget = Q_NULLPTR;
64 }
Kwave::SaveBlocksWidget * m_widget

Member Function Documentation

◆ emitUpdate

void Kwave::SaveBlocksDialog::emitUpdate ( )
slot

collects all needed data and emits a sigSelectionChanged

Definition at line 96 of file SaveBlocksDialog.cpp.

References _, Kwave::FileDialog::baseUrl(), Kwave::FileDialog::locationEdit(), numberingMode(), pattern(), Kwave::FileDialog::selectedExtension(), selectionOnly(), and sigSelectionChanged().

Referenced by SaveBlocksDialog().

97 {
98  QString path = baseUrl().path() + QDir::separator();
99  QString filename = path + locationEdit()->currentText();
100  QFileInfo file(filename);
101 
102  if (!file.suffix().length()) {
103  // append the currently selected extension if missing
104  QString extension = selectedExtension();
105  if (extension.contains(_(" ")))
106  extension = extension.section(_(" "), 0, 0);
107  filename += extension.remove(0, 1);
108  }
109 
110  emit sigSelectionChanged(filename, pattern(),
112 }
KUrlComboBox * locationEdit() const
Definition: FileDialog.cpp:346
Kwave::SaveBlocksPlugin::numbering_mode_t numberingMode()
QString selectedExtension()
Definition: FileDialog.cpp:246
QUrl baseUrl() const
Definition: FileDialog.cpp:259
#define _(m)
Definition: memcpy.c:66
void sigSelectionChanged(const QString &filename, const QString &pattern, Kwave::SaveBlocksPlugin::numbering_mode_t mode, bool selection_only)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ numberingMode()

Kwave::SaveBlocksPlugin::numbering_mode_t Kwave::SaveBlocksDialog::numberingMode ( )

returns the numbering mode

Definition at line 74 of file SaveBlocksDialog.cpp.

References Kwave::SaveBlocksPlugin::CONTINUE, m_widget, and Kwave::SaveBlocksWidget::numberingMode().

Referenced by emitUpdate().

75 {
76  Q_ASSERT(m_widget);
77  return (m_widget) ? m_widget->numberingMode() :
79 }
Kwave::SaveBlocksPlugin::numbering_mode_t numberingMode()
Kwave::SaveBlocksWidget * m_widget
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pattern()

QString Kwave::SaveBlocksDialog::pattern ( )

returns the file name pattern (as is, not escaped)

Definition at line 67 of file SaveBlocksDialog.cpp.

References _, m_widget, and Kwave::SaveBlocksWidget::pattern().

Referenced by emitUpdate().

68 {
69  Q_ASSERT(m_widget);
70  return (m_widget) ? m_widget->pattern() : _("");
71 }
#define _(m)
Definition: memcpy.c:66
Kwave::SaveBlocksWidget * m_widget
Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectionOnly()

bool Kwave::SaveBlocksDialog::selectionOnly ( )

returns true if only the selection should be saved

Definition at line 82 of file SaveBlocksDialog.cpp.

References m_widget, and Kwave::SaveBlocksWidget::selectionOnly().

Referenced by emitUpdate().

83 {
84  Q_ASSERT(m_widget);
85  return (m_widget) ? m_widget->selectionOnly() : false;
86 }
Kwave::SaveBlocksWidget * m_widget
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNewExample

void Kwave::SaveBlocksDialog::setNewExample ( const QString &  example)
slot

update the filename preview

Parameters
examplethe example filename

Definition at line 89 of file SaveBlocksDialog.cpp.

References m_widget, and Kwave::SaveBlocksWidget::setNewExample().

90 {
91  Q_ASSERT(m_widget);
92  if (m_widget) m_widget->setNewExample(example);
93 }
void setNewExample(const QString &example)
Kwave::SaveBlocksWidget * m_widget
Here is the call graph for this function:

◆ sigSelectionChanged

void Kwave::SaveBlocksDialog::sigSelectionChanged ( const QString &  filename,
const QString &  pattern,
Kwave::SaveBlocksPlugin::numbering_mode_t  mode,
bool  selection_only 
)
signal

emitted whenever the selection has changed and a new example has to be shown.

Parameters
filenamethe currently selected filename
patternthe selected filename pattern
modethe numbering mode
selection_onlyif true: save only the selection

Referenced by emitUpdate().

Here is the caller graph for this function:

Member Data Documentation

◆ m_widget

Kwave::SaveBlocksWidget* Kwave::SaveBlocksDialog::m_widget
private

the widget with extra settings for saving the blocks

Definition at line 108 of file SaveBlocksDialog.h.

Referenced by numberingMode(), pattern(), SaveBlocksDialog(), selectionOnly(), setNewExample(), and ~SaveBlocksDialog().


The documentation for this class was generated from the following files: