summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cc11
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/project.cc18
-rw-r--r--src/project.h4
-rw-r--r--src/projectdialog.cc13
-rw-r--r--src/projectdialog.h5
-rw-r--r--src/projectrenderer.cc2
-rw-r--r--src/projectserialiser.cc5
8 files changed, 56 insertions, 3 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 0ed2f38..8cd34ba 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -91,6 +91,10 @@ MainWindow::MainWindow(Settings& settings)
projectMenu->addAction(act_render);
connect(act_render, SIGNAL(triggered()), this, SLOT(render()));
+ QAction* act_edit_project = new QAction(tr("&Edit Project..."), this);
+ projectMenu->addAction(act_edit_project);
+ connect(act_edit_project, SIGNAL(triggered()), this, SLOT(editProject()));
+
QMenu* testMenu = menuBar()->addMenu(tr("Test"));
QAction* act_test = new QAction(tr("Test"), this);
testMenu->addAction(act_test);
@@ -588,3 +592,10 @@ void MainWindow::render()
RenderDialog renderDialog(this, project);
renderDialog.exec();
}
+
+void MainWindow::editProject()
+{
+ ProjectDialog dlg(this, project);
+ dlg.show();
+ dlg.exec();
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index a9b27ee..067ac0f 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -68,6 +68,7 @@ public slots:
private slots:
void test();
void render();
+ void editProject();
protected:
void closeEvent(QCloseEvent*);
diff --git a/src/project.cc b/src/project.cc
index 318898b..5cadcd4 100644
--- a/src/project.cc
+++ b/src/project.cc
@@ -483,6 +483,24 @@ void Project::setExportPath(const QString& export_path)
}
}
+QString Project::getProjectDescription() const
+{
+ return description;
+}
+
+void Project::setProjectDescription(const QString& description)
+{
+ if(this->description == description)
+ {
+ return;
+ }
+
+ {
+ Project::RAIIBulkUpdate bulkUpdate(*this);
+ this->description = description;
+ }
+}
+
Instrument& Project::getInstrument(int id)
{
for(auto& instrument : instruments)
diff --git a/src/project.h b/src/project.h
index a6593d8..b3456f6 100644
--- a/src/project.h
+++ b/src/project.h
@@ -201,6 +201,9 @@ public:
QString getExportPath() const;
void setExportPath(const QString& prefix);
+ QString getProjectDescription() const;
+ void setProjectDescription(const QString& prefix);
+
Instrument& getInstrument(int id);
int createInstrument();
void deleteInstrument(int id);
@@ -224,6 +227,7 @@ private:
QString project_name;
QString raw_file_root;
QString export_path;
+ QString description;
std::list<Instrument> instruments;
std::list<Channel> channels;
diff --git a/src/projectdialog.cc b/src/projectdialog.cc
index c52d110..b5fb87d 100644
--- a/src/projectdialog.cc
+++ b/src/projectdialog.cc
@@ -30,6 +30,7 @@
#include <QLabel>
#include <QLineEdit>
+#include <QTextEdit>
#include <QPushButton>
#include <QFileDialog>
@@ -51,12 +52,14 @@ ProjectDialog::ProjectDialog(QWidget* parent, Project& project)
int idx = 0;
name = new QLineEdit();
+ name->setText(project.getProjectName());
layout->addWidget(new QLabel(tr("Name of the project:")), idx, 0, 1, 2);
idx++;
- layout->addWidget(name, idx, 0);
+ layout->addWidget(name, idx, 0, 1, 2);
idx++;
raw_dir = new QLineEdit();
+ raw_dir->setText(project.getRawFileRoot());
auto btn = new QPushButton(tr("..."));
btn->setMaximumWidth(32);
connect(btn, SIGNAL(clicked()), this, SLOT(chooseRawFilesDir()));
@@ -66,6 +69,13 @@ ProjectDialog::ProjectDialog(QWidget* parent, Project& project)
layout->addWidget(btn, idx, 1);
idx++;
+ description = new QTextEdit();
+ description->setText(project.getProjectDescription());
+ layout->addWidget(new QLabel(tr("Description of the project:")), idx, 0, 1, 2);
+ idx++;
+ layout->addWidget(description, idx, 0, 1, 2);
+ idx++;
+
auto buttons =
new QDialogButtonBox(QDialogButtonBox::Ok |
QDialogButtonBox::Cancel |
@@ -97,4 +107,5 @@ void ProjectDialog::apply()
Project::RAIIBulkUpdate bulkUpdate(project);
project.setProjectName(name->text());
project.setRawFileRoot(raw_dir->text());
+ project.setProjectDescription(description->toPlainText());
}
diff --git a/src/projectdialog.h b/src/projectdialog.h
index a6fc646..e84b1d6 100644
--- a/src/projectdialog.h
+++ b/src/projectdialog.h
@@ -27,7 +27,9 @@
#pragma once
#include <QDialog>
-#include <QLineEdit>
+
+class QLineEdit;
+class QTextEdit;
class Project;
@@ -46,6 +48,7 @@ private slots:
private:
QLineEdit* name{nullptr};
QLineEdit* raw_dir{nullptr};
+ QTextEdit* description{nullptr};
Project& project;
};
diff --git a/src/projectrenderer.cc b/src/projectrenderer.cc
index 885b9f1..d266fef 100644
--- a/src/projectrenderer.cc
+++ b/src/projectrenderer.cc
@@ -54,7 +54,7 @@ void ProjectRenderer::render()
QDomElement drumkit = doc.createElement("drumkit");
drumkit.setAttribute("version", "1.0");
drumkit.setAttribute("name", project.getProjectName());
-// drumkit.setAttribute("description", project.getProjectDescription());
+ drumkit.setAttribute("description", project.getProjectDescription());
doc.appendChild(drumkit);
QDomElement channels = doc.createElement("channels");
diff --git a/src/projectserialiser.cc b/src/projectserialiser.cc
index ac872c7..8985daa 100644
--- a/src/projectserialiser.cc
+++ b/src/projectserialiser.cc
@@ -128,6 +128,10 @@ QString ProjectSerialiser::serialise(const Project& project)
raw_file_root.appendChild(doc.createTextNode(project.raw_file_root));
dgedit.appendChild(raw_file_root);
+ auto description = doc.createElement("description");
+ description.appendChild(doc.createTextNode(project.description));
+ dgedit.appendChild(description);
+
auto export_path = doc.createElement("export_path");
export_path.appendChild(doc.createTextNode(project.export_path));
dgedit.appendChild(export_path);
@@ -235,6 +239,7 @@ bool ProjectSerialiser::deserialise(const QString& data, Project& project)
project.next_id = dom["next_id"].toInt();
project.project_name = dom("project_name").text();
project.raw_file_root = dom("raw_file_root").text();
+ project.description = dom("description").text();
project.export_path = dom("export_path").text();
auto channels = dom("channels").children("channel");