summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/midiplugins/drumglue/drumgluegui.cpp
blob: 562adf2c06f0602ca3664cd62b95e0de91c9bcca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//=========================================================
//  MusE
//  Linux Music Editor
//
//  (C) Copyright 2008 Robert Jonsson (rj@spamatica.se)
//  (C) Copyright 2005- Werner Schweer (ws@seh.de)
// Copyright: See COPYING file that comes with this distribution
//=========================================================

#include "drumgluegui.h"
#include "drumglue.h"
#include "globalinstrumentview.h"

//---------------------------------------------------------
//   DrumGlueGui
//---------------------------------------------------------

DrumGlueGui::DrumGlueGui(DrumGlue* f, QWidget* parent)
  : QDialog(parent)
      {
      drumGlue = f;
      setupUi(this);
      instrumentsTabWidget->clear();
      
      connect (addInstrumentButton, SIGNAL(clicked()), this, SLOT(addInstrument()));
      }

//---------------------------------------------------------
//   init
//---------------------------------------------------------
void DrumGlueGui::init()
      {
      foreach(DrumInstrument *di, drumGlue->drumInstruments) {
			GlobalInstrumentView *giView = new GlobalInstrumentView(drumGlue,this, di->name);
      		instrumentsTabWidget->addTab(giView, di->name);
      		}
      }

//---------------------------------------------------------
//   addInstrument
//---------------------------------------------------------
void DrumGlueGui::addInstrument()
	  {
		bool ok;
		QString text = QInputDialog::getText(this, tr("Instrument name"),
											tr("Name of instrument:"), QLineEdit::Normal,
											"", &ok);
		if (ok && !text.isEmpty()) {
				DrumInstrument *di = new DrumInstrument();
				di->name = text;
				drumGlue->drumInstruments.append(di);
				GlobalInstrumentView *giView = new GlobalInstrumentView(drumGlue,this, text);
				instrumentsTabWidget->addTab(giView, text);
			}
	  }

//---------------------------------------------------------
//   removeInstrument
//---------------------------------------------------------
void DrumGlueGui::removeInstrument()
	  {
 		int ret = QMessageBox::warning(this, tr("Remove instrument"),
					tr("Are you sure you want to remove current instrument?"),
					QMessageBox::No,
					QMessageBox::Yes);
		if (ret == QMessageBox::Yes)
			instrumentsTabWidget->removeTab(instrumentsTabWidget->currentIndex());
	  }