예제 #1
0
void CConfigInfo::removeInstrument( unsigned int nInstrumentID )
{
	QString strUserInstruemt;
	strUserInstruemt = QString("%1").arg(nInstrumentID);

	removeInstrument(strUserInstruemt);

}
예제 #2
0
	MainWindow::MainWindow(App *a)
		: m_close_shutdown(false), m_app(a)
	{
		setupUi(this);
		setDocumentName("");
		instruments->setIconSize(QSize(16,16));

		speed->setRange(MIN_SPEED, MAX_SPEED);
		tempo->setRange(MIN_TEMPO, MAX_TEMPO);
		rows->setRange(1, MAX_PATTERN_LENGTH);
		frames->setRange(1, MAX_FRAMES);

		title->setMaxLength(MAX_SONGINFO_LENGTH);
		author->setMaxLength(MAX_SONGINFO_LENGTH);
		copyright->setMaxLength(MAX_SONGINFO_LENGTH);
		instrumentName->setMaxLength(MAX_INSTRUMENT_NAME_LENGTH);

		QObject::connect(actionNew, SIGNAL(triggered()), this, SLOT(newDoc()));
		actionNew->setIcon(QIcon::fromTheme("document-new"));
		QObject::connect(action_Open, SIGNAL(triggered()), this, SLOT(open()));
		action_Open->setIcon(QIcon::fromTheme("document-open"));
		QObject::connect(action_Save, SIGNAL(triggered()), this, SLOT(save()));
		action_Save->setIcon(QIcon::fromTheme("document-save"));
		QObject::connect(actionSave_As, SIGNAL(triggered()), this, SLOT(saveAs()));
		QObject::connect(action_Create_NSF, SIGNAL(triggered()), this, SLOT(unimplemented()));
		QObject::connect(actionCreate_WAV, SIGNAL(triggered()), this, SLOT(createWAV()));
		QObject::connect(actionImport_MIDI, SIGNAL(triggered()), this, SLOT(unimplemented()));
		QObject::connect(action_Configuration, SIGNAL(triggered()), this, SLOT(unimplemented()));
		QObject::connect(actionE_xit, SIGNAL(triggered()), this, SLOT(quit()));

		QObject::connect(actionModule_Properties, SIGNAL(triggered()), this, SLOT(moduleProperties()));

		QObject::connect(action_ViewToolbar, SIGNAL(toggled(bool)), this, SLOT(viewToolbar(bool)));
		QObject::connect(action_ViewStatusBar, SIGNAL(toggled(bool)), this, SLOT(viewStatusBar(bool)));
		QObject::connect(action_ViewControlpanel, SIGNAL(toggled(bool)), this, SLOT(viewControlpanel(bool)));
		QObject::connect(toolBar, SIGNAL(visibilityChanged(bool)), action_ViewToolbar, SLOT(setChecked(bool)));
		QObject::connect(controlPanel, SIGNAL(visibilityChanged(bool)), this, SLOT(controlPanelVisibilityChanged()));

		QObject::connect(action_About, SIGNAL(triggered()), this, SLOT(about()));
		QObject::connect(actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

		QObject::connect(songs, SIGNAL(activated(int)), this, SLOT(setSong(int)));

		QObject::connect(incPattern, SIGNAL(clicked()), this, SLOT(incrementPattern()));
		QObject::connect(decPattern, SIGNAL(clicked()), this, SLOT(decrementPattern()));
		QObject::connect(instruments, SIGNAL(itemSelectionChanged()), this, SLOT(instrumentSelect()));
		QObject::connect(instrumentName, SIGNAL(textEdited(QString)), this, SLOT(instrumentNameChange(QString)));
		QObject::connect(instruments, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(instrumentDoubleClicked(QModelIndex)));

		QObject::connect(speed, SIGNAL(valueChanged(int)), this, SLOT(speedTempoChange(int)));
		QObject::connect(tempo, SIGNAL(valueChanged(int)), this, SLOT(speedTempoChange(int)));
		QObject::connect(rows, SIGNAL(valueChanged(int)), this, SLOT(rowsChange(int)));
		QObject::connect(frames, SIGNAL(valueChanged(int)), this, SLOT(framesChange(int)));

		QObject::connect(title, SIGNAL(editingFinished()), this, SLOT(changeSongTitle()));
		QObject::connect(author, SIGNAL(editingFinished()), this, SLOT(changeSongAuthor()));
		QObject::connect(copyright, SIGNAL(editingFinished()), this, SLOT(changeSongCopyright()));

		QObject::connect(action_Play, SIGNAL(triggered()), this, SLOT(play()));
		action_Play->setIcon(QIcon::fromTheme("media-playback-start"));
		QObject::connect(action_Stop, SIGNAL(triggered()), this, SLOT(stop()));
		action_Stop->setIcon(QIcon::fromTheme("media-playback-stop"));
		QObject::connect(actionToggle_edit_mode, SIGNAL(triggered()), this, SLOT(toggleEditMode()));
		actionToggle_edit_mode->setIcon(QIcon::fromTheme("media-record"));

		QObject::connect(addInstrument_button, SIGNAL(clicked()), this, SLOT(addInstrument_2A03()));
		addInstrument_button->setIcon(QIcon::fromTheme("list-add"));
		addInstrument_button->setText(tr("Add Instrument"));
		QObject::connect(removeInstrument_button, SIGNAL(clicked()), this, SLOT(removeInstrument()));
		removeInstrument_button->setIcon(QIcon::fromTheme("list-remove"));
		removeInstrument_button->setText(tr("Remove Instrument"));
		QObject::connect(editInstrument_button, SIGNAL(clicked()), this, SLOT(editInstrument()));
		editInstrument_button->setText(tr("Edit Instrument"));

		{
			QMenu *m = new QMenu(this);
			QAction *add2a03 = m->addAction(tr("New 2A03 Instrument"));
			QAction *addmmc5 = m->addAction(tr("New MMC5 Instrument"));
			QAction *addvrc6 = m->addAction(tr("New VRC6 Instrument"));
			QAction *addvrc7 = m->addAction(tr("New VRC7 Instrument"));
			QAction *addfds  = m->addAction(tr("New FDS Instrument"));

			QObject::connect(add2a03, SIGNAL(triggered()), this, SLOT(addInstrument_2A03()));
			QObject::connect(addvrc6, SIGNAL(triggered()), this, SLOT(addInstrument_VRC6()));
			QObject::connect(addvrc7, SIGNAL(triggered()), this, SLOT(addInstrument_VRC7()));
			QObject::connect(addmmc5, SIGNAL(triggered()), this, SLOT(addInstrument_MMC5()));
			QObject::connect(addfds , SIGNAL(triggered()), this, SLOT(addInstrument_FDS()));

			m->setDefaultAction(add2a03);
			addInstrument_button->setMenu(m);
		}

		QObject::connect(step, SIGNAL(valueChanged(int)), this, SLOT(changeEditSettings()));
		QObject::connect(keyRepetition, SIGNAL(stateChanged(int)), this, SLOT(changeEditSettings()));

		{
			// recent files
			int capacity = gui::recentFileCapacity();
			m_recentFiles = new QAction*[capacity];
			for (int i = 0; i < capacity; i++)
			{
				QAction *a = new QAction(this);
				a->setVisible(false);
				connect(a, SIGNAL(triggered()),
						this, SLOT(openRecentFile()));
				m_recentFiles[i] = a;
				menuRecent->addAction(a);
			}

			// end recent files
		}

		reloadRecentFiles();

		// the designer doesn't allow adding widgets

		{
			octave = new QComboBox;
			for (int i = 0; i < 8; i++)
			{
				octave->addItem(QString("%1").arg(i));
			}
			connect(octave, SIGNAL(currentIndexChanged(int)), this, SLOT(octaveChange()));
			toolBar->addWidget(new QLabel(tr("Octave")));
			toolBar->addWidget(octave);
		}

		// temporary style changing (for demonstration)
		{
			menu_View->addSeparator();
			QMenu *styles = new QMenu(tr("Styles"));
			QAction *style_default = styles->addAction(tr("Default"));
			QAction *style_monochrome = styles->addAction(tr("Monochrome"));
			menu_View->addMenu(styles);

			connect(style_default, SIGNAL(triggered()), this, SLOT(selectDefaultStyle()));
			connect(style_monochrome, SIGNAL(triggered()), this, SLOT(selectMonochromeStyle()));
		}

		QMenu *m = new QMenu;
		m->addAction(tr("New 2A03 instrument"));

		actionAdd_instrument->setMenu(m);

		setDocInfo(m_app->activeDocInfo());

		m_instrumenteditor = new InstrumentEditor(this);

		blockSignals(true);
		blockSignals(false);
	}