summaryrefslogtreecommitdiff
path: root/src/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r--src/mainwindow.cc89
1 files changed, 79 insertions, 10 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index b9cf800..6238a18 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -35,6 +35,8 @@
#include <QApplication>
#include <QMenuBar>
#include <QFileDialog>
+#include <QToolBar>
+#include <QToolButton>
#include "settings.h"
#include "projectdialog.h"
@@ -81,23 +83,61 @@ MainWindow::MainWindow(Settings& settings)
instruments_dock->setObjectName("instruments_dock");
instruments_dock->setAllowedAreas(Qt::LeftDockWidgetArea);
instruments_dock->setFeatures(QDockWidget::DockWidgetMovable);
- instrument_list = new QListWidget();
- connect(instrument_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
- this, SLOT(itemDoubleClicked(QListWidgetItem*)));
- instruments_dock->setWidget(instrument_list);
+ {
+ auto w = new QWidget();
+ auto l = new QVBoxLayout();
+ w->setLayout(l);
+ auto tools = new QToolBar();
+ auto add = new QToolButton();
+ add->setIcon(QPixmap(":icons/add_instrument.png"));
+ connect(add, SIGNAL(clicked()), this, SLOT(addInstrument()));
+ auto rem = new QToolButton();
+ rem->setIcon(QPixmap(":icons/remove_instrument.png"));
+ connect(rem, SIGNAL(clicked()), this, SLOT(removeInstrument()));
+ tools->addWidget(add);
+ tools->addWidget(rem);
+ instrument_list = new QListWidget();
+ connect(instrument_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
+ this, SLOT(itemDoubleClicked(QListWidgetItem*)));
+
+ l->addWidget(tools);
+ l->addWidget(instrument_list);
+
+ instruments_dock->setWidget(w);
+ }
addDockWidget(Qt::LeftDockWidgetArea, instruments_dock);
channels_dock = new QDockWidget(tr("Channels:"), this);
channels_dock->setObjectName("channels_dock");
channels_dock->setAllowedAreas(Qt::LeftDockWidgetArea);
channels_dock->setFeatures(QDockWidget::DockWidgetMovable);
- QListWidget* channel_list = new QListWidget();
- channel_list->addItems({"AmbL", "AmbR", "Kdrum_back", "Kdrum_front", "Hihat",
- "OHL", "OHR", "Ride","Snare_bottom", "Snare_top",
- "Tom1", "Tom2", "Tom3"});
+ {
+ auto w = new QWidget();
+ auto l = new QVBoxLayout();
+ w->setLayout(l);
+ auto tools = new QToolBar();
+ auto add = new QToolButton();
+ add->setIcon(QPixmap(":icons/add_channel.png"));
+ connect(add, SIGNAL(clicked()), this, SLOT(addChannel()));
+ auto rem = new QToolButton();
+ rem->setIcon(QPixmap(":icons/remove_channel.png"));
+ connect(rem, SIGNAL(clicked()), this, SLOT(removeChannel()));
+ tools->addWidget(add);
+ tools->addWidget(rem);
+ channel_list = new QListWidget();
+ channel_list->addItems({"AmbL", "AmbR", "Kdrum_back", "Kdrum_front",
+ "Hihat", "OHL", "OHR", "Ride","Snare_bottom",
+ "Snare_top", "Tom1", "Tom2", "Tom3"});
+ for(int i = 0; i < channel_list->count(); ++i)
+ {
+ channel_list->item(i)->setIcon(QPixmap(":icons/channel.png"));
+ }
- channels_dock->setWidget(channel_list);
- addDockWidget(Qt::LeftDockWidgetArea, channels_dock);
+ l->addWidget(tools);
+ l->addWidget(channel_list);
+ channels_dock->setWidget(w);
+ addDockWidget(Qt::LeftDockWidgetArea, channels_dock);
+ }
loadSettings();
@@ -112,6 +152,23 @@ MainWindow::~MainWindow()
{
}
+void MainWindow::addInstrument()
+{
+ auto id = project.createInstrument();
+ auto& instrument = project.getInstrument(id);
+ instrument.setInstrumentName(tr("New instrument"));
+
+ auto item = new QListWidgetItem();
+ item->setIcon(QPixmap(":icons/instrument.png"));
+ item->setText(instrument.getInstrumentName());
+ item->setData(Qt::UserRole, id);
+ instrument_list->addItem(item);
+}
+
+void MainWindow::removeInstrument()
+{
+}
+
void MainWindow::itemDoubleClicked(QListWidgetItem *item)
{
int id = item->data(Qt::UserRole).toInt();
@@ -134,6 +191,18 @@ void MainWindow::itemDoubleClicked(QListWidgetItem *item)
tab_widget->setCurrentIndex(tab_widget->count() - 1);
}
+void MainWindow::addChannel()
+{
+ auto item = new QListWidgetItem();
+ item->setIcon(QPixmap(":icons/channel.png"));
+ item->setText("New Channel");
+ channel_list->addItem(item);
+}
+
+void MainWindow::removeChannel()
+{
+}
+
void MainWindow::updateWindowTitle()
{
auto project_string = project.getProjectName();