summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/instrumentwidget.cc16
-rw-r--r--src/instrumentwidget.h2
-rw-r--r--src/project.cc40
-rw-r--r--src/project.h10
-rw-r--r--src/projectserialiser.cc8
5 files changed, 76 insertions, 0 deletions
diff --git a/src/instrumentwidget.cc b/src/instrumentwidget.cc
index f8b4046..0058f93 100644
--- a/src/instrumentwidget.cc
+++ b/src/instrumentwidget.cc
@@ -364,15 +364,21 @@ QWidget* InstrumentWidget::createExportTab()
l->addWidget(new QLabel(tr("Prefix:")));
prefix = new QLineEdit();
+ prefix->setText(instrument.getPrefix());
connect(prefix, SIGNAL(textChanged(const QString &)),
extractor, SLOT(setOutputPrefix(const QString &)));
+ connect(prefix, SIGNAL(textChanged(const QString &)),
+ this, SLOT(prefixChanged()));
l->addWidget(prefix);
l->addWidget(new QLabel(tr("Export path:")));
QHBoxLayout* lo_exportp = new QHBoxLayout();
lineed_exportp = new QLineEdit();
+ lineed_exportp->setText(instrument.getExportPath());
connect(lineed_exportp, SIGNAL(textChanged(const QString &)),
extractor, SLOT(setExportPath(const QString &)));
+ connect(lineed_exportp, SIGNAL(textChanged(const QString &)),
+ this, SLOT(exportPathChanged()));
lo_exportp->addWidget(lineed_exportp);
QPushButton* btn_browse = new QPushButton(tr("..."));
connect(btn_browse, SIGNAL(clicked()), this, SLOT(browse()));
@@ -396,6 +402,16 @@ QWidget* InstrumentWidget::createExportTab()
return w;
}
+void InstrumentWidget::prefixChanged()
+{
+ instrument.setPrefix(prefix->text());
+}
+
+void InstrumentWidget::exportPathChanged()
+{
+ instrument.setExportPath(lineed_exportp->text());
+}
+
void InstrumentWidget::playSamples()
{
Selections* sels = &selections;
diff --git a/src/instrumentwidget.h b/src/instrumentwidget.h
index 2a5b3c5..721b829 100644
--- a/src/instrumentwidget.h
+++ b/src/instrumentwidget.h
@@ -75,6 +75,8 @@ public slots:
void tabChanged(int tabid);
void generateSlidersChanged();
void selectionChanged();
+ void prefixChanged();
+ void exportPathChanged();
private:
QWidget* createFilesTab();
diff --git a/src/project.cc b/src/project.cc
index 5c45973..5ad809b 100644
--- a/src/project.cc
+++ b/src/project.cc
@@ -56,6 +56,10 @@ void Instrument::setInstrumentName(const QString& instrument_name)
{
Project::RAIIBulkUpdate bulkUpdate(project);
this->instrument_name = instrument_name;
+ if(prefix.isEmpty())
+ {
+ setPrefix(instrument_name); // replicate name to prefix
+ }
}
}
@@ -216,6 +220,42 @@ void Instrument::setSelections(const Selections& selections)
}
}
+QString Instrument::getPrefix() const
+{
+ return prefix;
+}
+
+void Instrument::setPrefix(const QString& prefix)
+{
+ if(this->prefix == prefix)
+ {
+ return;
+ }
+
+ {
+ Project::RAIIBulkUpdate bulkUpdate(project);
+ this->prefix = prefix;
+ }
+}
+
+QString Instrument::getExportPath() const
+{
+ return export_path;
+}
+
+void Instrument::setExportPath(const QString& export_path)
+{
+ if(this->export_path == export_path)
+ {
+ return;
+ }
+
+ {
+ Project::RAIIBulkUpdate bulkUpdate(project);
+ this->export_path = export_path;
+ }
+}
+
Project& Instrument::getProject()
{
return project;
diff --git a/src/project.h b/src/project.h
index 725e936..98be92a 100644
--- a/src/project.h
+++ b/src/project.h
@@ -73,6 +73,12 @@ public:
Selections getSelections() const;
void setSelections(const Selections& selectios);
+ QString getPrefix() const;
+ void setPrefix(const QString& prefix);
+
+ QString getExportPath() const;
+ void setExportPath(const QString& prefix);
+
Project& getProject();
private:
@@ -98,6 +104,10 @@ private:
// Edit tab
Selections selections;
+ // Export tab
+ QString prefix;
+ QString export_path;
+
Project& project;
};
diff --git a/src/projectserialiser.cc b/src/projectserialiser.cc
index f70e6dd..f80fa36 100644
--- a/src/projectserialiser.cc
+++ b/src/projectserialiser.cc
@@ -139,6 +139,11 @@ QString ProjectSerialiser::serialise(const Project& project)
instruments.appendChild(instrument);
+ auto export_path = doc.createElement("export_path");
+ export_path.setAttribute("prefix", i.getPrefix());
+ export_path.appendChild(doc.createTextNode(i.export_path));
+ instrument.appendChild(export_path);
+
auto instrument_name = doc.createElement("instrument_name");
instrument_name.appendChild(doc.createTextNode(i.instrument_name));
instrument.appendChild(instrument_name);
@@ -231,6 +236,9 @@ bool ProjectSerialiser::deserialise(const QString& data, Project& project)
instr.threshold = instrument["threshold"].toFloat();
+ instr.export_path = instrument("export_path").text();
+ instr.prefix = instrument("export_path")["prefix"];
+
auto selections = instrument("regions");
instr.selections.nextid = selections["nextid"].toInt();
instr.selections.act = selections["act"].toInt();