summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/filelist.cc1
-rw-r--r--src/mainwindow.cc32
-rw-r--r--src/mainwindow.h3
-rw-r--r--src/project.cc1
4 files changed, 32 insertions, 5 deletions
diff --git a/src/filelist.cc b/src/filelist.cc
index 4df69c3..21b843e 100644
--- a/src/filelist.cc
+++ b/src/filelist.cc
@@ -57,7 +57,6 @@ FileList::FileList(Instrument& instrument)
//item->setIcon(QPixmap(":icons/instrument.png"));
setItemFile(item, file.first);
setItemName(item, file.second);
- std::cout << file.first.toStdString() << " ?= " << master_file.toStdString() << std::endl;
setItemMaster(item, file.first == master_file);
addItem(item);
}
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 6238a18..61ea9bb 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -98,7 +98,7 @@ MainWindow::MainWindow(Settings& settings)
tools->addWidget(rem);
instrument_list = new QListWidget();
connect(instrument_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
- this, SLOT(itemDoubleClicked(QListWidgetItem*)));
+ this, SLOT(instrumentDoubleClicked(QListWidgetItem*)));
l->addWidget(tools);
l->addWidget(instrument_list);
@@ -125,6 +125,8 @@ MainWindow::MainWindow(Settings& settings)
tools->addWidget(add);
tools->addWidget(rem);
channel_list = new QListWidget();
+ connect(channel_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
+ this, SLOT(channelDoubleClicked(QListWidgetItem*)));
channel_list->addItems({"AmbL", "AmbR", "Kdrum_back", "Kdrum_front",
"Hihat", "OHL", "OHR", "Ride","Snare_bottom",
"Snare_top", "Tom1", "Tom2", "Tom3"});
@@ -167,9 +169,25 @@ void MainWindow::addInstrument()
void MainWindow::removeInstrument()
{
+ auto items = instrument_list->selectedItems();
+ for(auto item : items)
+ {
+ auto id = item->data(Qt::UserRole).toInt();
+
+ for(int i = 0; i < tab_widget->count(); ++i)
+ {
+ if(tab_widget->widget(i)->property("id").toInt() == id)
+ {
+ tab_widget->removeTab(i);
+ }
+ }
+
+ project.deleteInstrument(id);
+ delete item;
+ }
}
-void MainWindow::itemDoubleClicked(QListWidgetItem *item)
+void MainWindow::instrumentDoubleClicked(QListWidgetItem *item)
{
int id = item->data(Qt::UserRole).toInt();
auto& instr = project.getInstrument(id);
@@ -196,11 +214,21 @@ void MainWindow::addChannel()
auto item = new QListWidgetItem();
item->setIcon(QPixmap(":icons/channel.png"));
item->setText("New Channel");
+ //item->setData(Qt::UserRole, id);
channel_list->addItem(item);
}
void MainWindow::removeChannel()
{
+ auto items = channel_list->selectedItems();
+ for(auto item : items)
+ {
+ delete item;
+ }
+}
+
+void MainWindow::channelDoubleClicked(QListWidgetItem *item)
+{
}
void MainWindow::updateWindowTitle()
diff --git a/src/mainwindow.h b/src/mainwindow.h
index fcff476..79cb5ad 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -47,10 +47,11 @@ public:
public slots:
void addInstrument();
void removeInstrument();
- void itemDoubleClicked(QListWidgetItem *item);
+ void instrumentDoubleClicked(QListWidgetItem *item);
void addChannel();
void removeChannel();
+ void channelDoubleClicked(QListWidgetItem *item);
void updateWindowTitle();
diff --git a/src/project.cc b/src/project.cc
index df1d266..727673a 100644
--- a/src/project.cc
+++ b/src/project.cc
@@ -159,7 +159,6 @@ void Project::setRawFileRoot(const QString& raw_file_root)
Instrument& Project::getInstrument(int id)
{
- std::cout << "get " << id << std::endl;
for(auto& instrument : instruments)
{
if(instrument.getId() == id)