kwave  18.07.70
Kwave::K3BExportWidget Class Reference

#include <K3BExportWidget.h>

Inheritance diagram for Kwave::K3BExportWidget:
Inheritance graph
Collaboration diagram for Kwave::K3BExportWidget:
Collaboration graph

Public Member Functions

 K3BExportWidget (QWidget *widget, QString &pattern, bool selection_only, bool have_selection, Kwave::K3BExportPlugin::export_location_t export_location, Kwave::K3BExportPlugin::overwrite_policy_t overwrite_policy)
 
virtual ~K3BExportWidget ()
 
virtual void showPreview (const QUrl &url)
 
virtual void clearPreview ()
 
QString pattern () const
 
bool selectionOnly () const
 
Kwave::K3BExportPlugin::export_location_t exportLocation () const
 
Kwave::K3BExportPlugin::overwrite_policy_t overwritePolicy () const
 

Detailed Description

Definition at line 28 of file K3BExportWidget.h.

Constructor & Destructor Documentation

◆ K3BExportWidget()

Kwave::K3BExportWidget::K3BExportWidget ( QWidget *  widget,
QString &  pattern,
bool  selection_only,
bool  have_selection,
Kwave::K3BExportPlugin::export_location_t  export_location,
Kwave::K3BExportPlugin::overwrite_policy_t  overwrite_policy 
)

Constructor

Parameters
widgetpointer to the parent widget
patternthe pattern used for detecting title and artist
selection_onlyif true, save only the selection
have_selectionif true, there is a selection
export_locationwhere to export files with tracks
overwrite_policyoverwrite existing files or use a new name

Definition at line 30 of file K3BExportWidget.cpp.

References Kwave::K3BExportPlugin::knownPatterns().

38  :QWidget(parent), Ui::K3BExportWidgetBase()
39 {
40  setupUi(this);
41 
42  cbLabelPattern->addItem(i18nc(
43  "default entry of the list of placeholder patterns in "
44  "the K3b export plugin (used for detecting title and artist "
45  "from a label description)",
46  "(auto detect)"
47  ));
48  foreach (const QString &p, Kwave::K3BExportPlugin::knownPatterns())
49  cbLabelPattern->addItem(p);
50 
51  Q_ASSERT(cbLabelPattern);
52  if (pattern.trimmed().length())
53  cbLabelPattern->setCurrentText(pattern.trimmed());
54  else
55  cbLabelPattern->setCurrentIndex(0);
56 
57  // the "selection only" checkbox
58  Q_ASSERT(chkSelectionOnly);
59  if (have_selection) {
60  // we have a selection
61  chkSelectionOnly->setEnabled(true);
62  chkSelectionOnly->setChecked(selection_only);
63  } else {
64  // no selection -> force it to "off"
65  chkSelectionOnly->setEnabled(false);
66  chkSelectionOnly->setChecked(false);
67  }
68 
69  Q_ASSERT(cbExportLocation);
70  cbExportLocation->setCurrentIndex(static_cast<int>(export_location));
71 
72  Q_ASSERT(cbOverwritePolicy);
73  cbOverwritePolicy->setCurrentIndex(static_cast<int>(overwrite_policy));
74 }
static QStringList knownPatterns()
Here is the call graph for this function:

◆ ~K3BExportWidget()

Kwave::K3BExportWidget::~K3BExportWidget ( )
virtual

Destructor

Definition at line 77 of file K3BExportWidget.cpp.

78 {
79 }

Member Function Documentation

◆ clearPreview()

virtual void Kwave::K3BExportWidget::clearPreview ( )
inlinevirtual
See also
KPreviewWidgetBase::clearPreview

Definition at line 61 of file K3BExportWidget.h.

References exportLocation(), overwritePolicy(), pattern(), and selectionOnly().

62  {
63  }
Here is the call graph for this function:

◆ exportLocation()

Kwave::K3BExportPlugin::export_location_t Kwave::K3BExportWidget::exportLocation ( ) const

returns export location of the files of the tracks

Definition at line 104 of file K3BExportWidget.cpp.

Referenced by clearPreview(), and Kwave::K3BExportDialog::exportLocation().

105 {
106  Q_ASSERT(cbExportLocation);
107  return static_cast<Kwave::K3BExportPlugin::export_location_t>(
108  (cbExportLocation) ?
109  cbExportLocation->currentIndex() : 0
110  );
111 }
Here is the caller graph for this function:

◆ overwritePolicy()

Kwave::K3BExportPlugin::overwrite_policy_t Kwave::K3BExportWidget::overwritePolicy ( ) const

returns the file overwrite policy

Definition at line 115 of file K3BExportWidget.cpp.

Referenced by clearPreview(), and Kwave::K3BExportDialog::overwritePolicy().

116 {
117  Q_ASSERT(cbOverwritePolicy);
118  return static_cast<Kwave::K3BExportPlugin::overwrite_policy_t>(
119  (cbOverwritePolicy) ?
120  cbOverwritePolicy->currentIndex() : 0
121  );
122 }
Here is the caller graph for this function:

◆ pattern()

QString Kwave::K3BExportWidget::pattern ( ) const

returns the title/artist detection pattern (as is, not escaped)

Definition at line 82 of file K3BExportWidget.cpp.

Referenced by clearPreview(), and Kwave::K3BExportDialog::pattern().

83 {
84  Q_ASSERT(cbLabelPattern);
85  if (!cbLabelPattern) return QString();
86 
87  // special handling: the first entry in the list is the default pattern
88  // (which is "auto-detect") -> map this to empty pattern
89  QString p = cbLabelPattern->currentText().trimmed();
90  if (p == cbLabelPattern->itemText(0)) return QString();
91 
92  return p;
93 }
Here is the caller graph for this function:

◆ selectionOnly()

bool Kwave::K3BExportWidget::selectionOnly ( ) const

returns true if only the selection should be saved

Definition at line 96 of file K3BExportWidget.cpp.

Referenced by clearPreview(), and Kwave::K3BExportDialog::selectionOnly().

97 {
98  Q_ASSERT(chkSelectionOnly);
99  return (chkSelectionOnly) ? chkSelectionOnly->isChecked() : false;
100 }
Here is the caller graph for this function:

◆ showPreview()

virtual void Kwave::K3BExportWidget::showPreview ( const QUrl &  url)
inlinevirtual
See also
KPreviewWidgetBase::showPreview()

Definition at line 55 of file K3BExportWidget.h.

56  {
57  Q_UNUSED(url);
58  }

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