示例#1
0
PresetWidget::PresetWidget(QWidget* parent) :
	BaseWidget(parent, "PresetWidget", "Presets"), mLayout(new QVBoxLayout(this))
{
	this->setToolTip("Select a predefined set of options");
	mPresetsComboBox = new QComboBox(this);
	mPresetsComboBox->setToolTip("Select a preset to use");
	connect(mPresetsComboBox, SIGNAL(currentIndexChanged(const QString&)), this,
			SLOT(presetsBoxChangedSlot(const QString&)));

	mActionGroup = new QActionGroup(this);

	this->createAction(mActionGroup,
	                QIcon(":/icons/preset_reset.png"),
	                "Reset all transfer function values to the defaults", "",
	                SLOT(resetSlot()));

	this->createAction(mActionGroup,
	                QIcon(":/icons/preset_remove.png"),
					"Delete the current preset", "",
	                SLOT(deleteSlot()));

	this->createAction(mActionGroup,
		            QIcon(":/icons/preset_save.png"),
					"Add the current setting as a preset", "",
	                SLOT(saveSlot()));

	mLayout->addWidget(mPresetsComboBox);

	mButtonLayout = NULL;
	this->populateButtonLayout();

	this->setLayout(mLayout);
}
示例#2
0
void GlobalUtility::Restore()
{
	Module::instance().getScriptInterface().PushDocumentTable(mVM, m_pDoc);
	if (mSelfSet)
	{
		deleteSlot("self");
		mSelfSet = false;
	}

	if (mEvtSet)
	{
		deleteSlot("event");
		mEvtSet = false;
	}

	sq_poptop(mVM);
}
void SourcesTrajectory::erase(double aFractionnalValueBegin, double aFractionnalValueEnd)
{
    long anIndexBegin = Tools::clip(aFractionnalValueBegin, 0., 1.) * (double)getMaximumIndexOfSlot();
    long anIndexEnd = Tools::clip(aFractionnalValueEnd, 0., 1.) * (double)getMaximumIndexOfSlot();
    for(long i = anIndexBegin; i < anIndexEnd; i++)
    {
        deleteSlot(i);
    }
}
示例#4
0
void Component::createActions() {
    // delete
	deleteAct = new QAction(tr("&Delete"), this);
	deleteAct->setStatusTip(tr("Delete this variable"));
	connect(deleteAct, SIGNAL(triggered()), this, SLOT(deleteSlot()));
    // connect
	wireAct = new QAction(tr("&Connect"), this);
	wireAct->setStatusTip(tr("Connect this element with another"));
	connect(wireAct, SIGNAL(triggered()), this, SLOT(wireSlot()));
    // disconnect
	deleteWireAct = new QAction(tr("&Disconnect"), this);
	deleteWireAct->setStatusTip(tr("Disconnect this element from others"));
	connect(deleteWireAct, SIGNAL(triggered()), this, SLOT(deleteWireSlot()));
    // change divider if the component is a diver
    dividerAct = new QAction(tr("&Change divider"), this);
    dividerAct->setStatusTip(tr("Change the current divider, by default it's neutral"));
    connect(dividerAct, SIGNAL(triggered()), this, SLOT(dividerSlot()));
}
AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) :
    QDialog(parent, Qt::Dialog),
    ui(new Ui::AdvanceButtonDialog)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);

    this->button = button;
    oldRow = 0;

    if (this->button->getToggleState())
    {
        ui->toggleCheckbox->setChecked(true);
    }

    if (this->button->isUsingTurbo())
    {
        ui->turboCheckbox->setChecked(true);
        ui->turboSlider->setEnabled(true);
    }

    int interval = this->button->getTurboInterval() / 10;
    if (interval < MINIMUMTURBO)
    {
        interval = JoyButton::ENABLEDTURBODEFAULT / 10;
    }
    ui->turboSlider->setValue(interval);
    this->changeTurboText(interval);

    QListIterator<JoyButtonSlot*> iter(*(this->button->getAssignedSlots()));
    while (iter.hasNext())
    {
        JoyButtonSlot *buttonslot = iter.next();
        SimpleKeyGrabberButton *existingCode = new SimpleKeyGrabberButton(this);
        existingCode->setText(buttonslot->getSlotString());
        existingCode->setValue(buttonslot->getSlotCode(), buttonslot->getSlotCodeAlias(), buttonslot->getSlotMode());

        QListWidgetItem *item = new QListWidgetItem();
        item->setData(Qt::UserRole, QVariant::fromValue<SimpleKeyGrabberButton*>(existingCode));
        QHBoxLayout *layout= new QHBoxLayout();
        layout->setContentsMargins(10, 0, 10, 0);
        layout->addWidget(existingCode);
        QWidget *widget = new QWidget();
        widget->setLayout(layout);
        item->setSizeHint(widget->sizeHint());

        ui->slotListWidget->addItem(item);
        ui->slotListWidget->setItemWidget(item, widget);
        connectButtonEvents(existingCode);
    }

    appendBlankKeyGrabber();
    populateSetSelectionComboBox();

    if (this->button->getSetSelection() > -1 && this->button->getChangeSetCondition() != JoyButton::SetChangeDisabled)
    {
        int selectIndex = (int)this->button->getChangeSetCondition();
        selectIndex += this->button->getSetSelection() * 3;
        if (this->button->getOriginSet() < this->button->getSetSelection())
        {
            selectIndex -= 3;
        }

        ui->setSelectionComboBox->setCurrentIndex(selectIndex);
    }

    fillTimeComboBoxes();
    ui->actionTenthsComboBox->setCurrentIndex(1);

    updateActionTimeLabel();
    changeTurboForSequences();

    if (button->isCycleResetActive())
    {
        ui->autoResetCycleCheckBox->setEnabled(true);
        ui->autoResetCycleCheckBox->setChecked(true);
        checkCycleResetWidgetStatus(true);
    }

    if (button->getCycleResetTime() != 0)
    {
        populateAutoResetInterval();
    }

    updateWindowTitleButtonName();

    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), ui->turboSlider, SLOT(setEnabled(bool)));
    connect(ui->turboSlider, SIGNAL(valueChanged(int)), this, SLOT(checkTurboIntervalValue(int)));

    connect(ui->insertSlotButton, SIGNAL(clicked()), this, SLOT(insertSlot()));
    connect(ui->deleteSlotButton, SIGNAL(clicked()), this, SLOT(deleteSlot()));
    connect(ui->clearAllPushButton, SIGNAL(clicked()), this, SLOT(clearAllSlots()));
    connect(ui->pausePushButton, SIGNAL(clicked()), this, SLOT(insertPauseSlot()));
    connect(ui->holdPushButton, SIGNAL(clicked()), this, SLOT(insertHoldSlot()));
    connect(ui->cyclePushButton, SIGNAL(clicked()), this, SLOT(insertCycleSlot()));
    connect(ui->distancePushButton, SIGNAL(clicked()), this, SLOT(insertDistanceSlot()));
    connect(ui->releasePushButton, SIGNAL(clicked()), this, SLOT(insertReleaseSlot()));

    connect(ui->actionHundredthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionSecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionMinutesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionTenthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));

    connect(ui->toggleCheckbox, SIGNAL(clicked(bool)), button, SLOT(setToggle(bool)));
    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), this, SLOT(checkTurboSetting(bool)));

    connect(ui->setSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSetSelection()));
    connect(ui->mouseModPushButton, SIGNAL(clicked()), this, SLOT(insertMouseSpeedModSlot()));

    connect(ui->slotListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(performStatsWidgetRefresh(QListWidgetItem*)));

    connect(ui->actionHundredthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));
    connect(ui->actionTenthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));
    connect(ui->actionSecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));
    connect(ui->actionMinutesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));

    connect(ui->distanceSpinBox, SIGNAL(valueChanged(int)), this, SLOT(checkSlotDistanceUpdate()));
    connect(ui->mouseSpeedModSpinBox, SIGNAL(valueChanged(int)), this, SLOT(checkSlotMouseModUpdate()));
    connect(ui->pressTimePushButton, SIGNAL(clicked()), this, SLOT(insertKeyPressSlot()));
    connect(ui->delayPushButton, SIGNAL(clicked()), this, SLOT(insertDelaySlot()));

    connect(ui->autoResetCycleCheckBox, SIGNAL(clicked(bool)), this, SLOT(checkCycleResetWidgetStatus(bool)));
    connect(ui->autoResetCycleCheckBox, SIGNAL(clicked(bool)), this, SLOT(setButtonCycleReset(bool)));
    connect(ui->resetCycleDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setButtonCycleResetInterval(double)));

    connect(button, SIGNAL(toggleChanged(bool)), ui->toggleCheckbox, SLOT(setChecked(bool)));
    connect(button, SIGNAL(turboChanged(bool)), this, SLOT(checkTurboSetting(bool)));
}
示例#6
0
AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) :
    QDialog(parent, Qt::Window),
    ui(new Ui::AdvanceButtonDialog)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);

    this->button = button;
    oldRow = 0;

    if (this->button->getToggleState())
    {
        ui->toggleCheckbox->setChecked(true);
    }

    if (this->button->isUsingTurbo())
    {
        ui->turboCheckbox->setChecked(true);
        ui->turboSlider->setEnabled(true);
    }

    int interval = this->button->getTurboInterval() / 10;
    if (interval < MINIMUMTURBO)
    {
        interval = JoyButton::ENABLEDTURBODEFAULT / 10;
    }
    ui->turboSlider->setValue(interval);
    this->changeTurboText(interval);

    QListIterator<JoyButtonSlot*> iter(*(this->button->getAssignedSlots()));
    while (iter.hasNext())
    {
        JoyButtonSlot *buttonslot = iter.next();
        SimpleKeyGrabberButton *existingCode = new SimpleKeyGrabberButton(this);
        existingCode->setText(buttonslot->getSlotString());
        existingCode->setValue(buttonslot->getSlotCode(), buttonslot->getSlotMode());

        //existingCode->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

        connectButtonEvents(existingCode);
        QListWidgetItem *item = new QListWidgetItem();
        ui->slotListWidget->addItem(item);

        item->setData(Qt::UserRole, QVariant::fromValue<SimpleKeyGrabberButton*>(existingCode));
        QHBoxLayout *layout= new QHBoxLayout();
        layout->addWidget(existingCode);
        QWidget *widget = new QWidget();
        widget->setLayout(layout);
        item->setSizeHint(widget->sizeHint());
        ui->slotListWidget->setItemWidget(item, widget);
    }

    appendBlankKeyGrabber();

    if (this->button->getSetSelection() > -1 && this->button->getChangeSetCondition() != JoyButton::SetChangeDisabled)
    {
        int offset = (int)this->button->getChangeSetCondition();
        ui->setSelectionComboBox->setCurrentIndex((this->button->getSetSelection() * 3) + offset);
    }

    if (this->button->getOriginSet() == 0)
    {
        ui->setSelectionComboBox->model()->removeRows(1, 3);
    }
    else if (this->button->getOriginSet() == 1)
    {
        ui->setSelectionComboBox->model()->removeRows(4, 3);
    }
    else if (this->button->getOriginSet() == 2)
    {
        ui->setSelectionComboBox->model()->removeRows(7, 3);
    }
    else if (this->button->getOriginSet() == 3)
    {
        ui->setSelectionComboBox->model()->removeRows(10, 3);
    }
    else if (this->button->getOriginSet() == 4)
    {
        ui->setSelectionComboBox->model()->removeRows(13, 3);
    }
    else if (this->button->getOriginSet() == 5)
    {
        ui->setSelectionComboBox->model()->removeRows(16, 3);
    }
    else if (this->button->getOriginSet() == 6)
    {
        ui->setSelectionComboBox->model()->removeRows(19, 3);
    }
    else if (this->button->getOriginSet() == 7)
    {
        ui->setSelectionComboBox->model()->removeRows(22, 3);
    }

    updateActionTimeLabel();
    changeTurboForSequences();

    setWindowTitle(tr("Advanced").append(": ").append(button->getPartialName()));

    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), ui->turboSlider, SLOT(setEnabled(bool)));
    connect(ui->turboSlider, SIGNAL(valueChanged(int)), this, SLOT(checkTurboIntervalValue(int)));

    connect(ui->insertSlotButton, SIGNAL(clicked()), this, SLOT(insertSlot()));
    connect(ui->deleteSlotButton, SIGNAL(clicked()), this, SLOT(deleteSlot()));
    connect(ui->clearAllPushButton, SIGNAL(clicked()), this, SLOT(clearAllSlots()));
    connect(ui->pausePushButton, SIGNAL(clicked()), this, SLOT(insertPauseSlot()));
    connect(ui->holdPushButton, SIGNAL(clicked()), this, SLOT(insertHoldSlot()));
    connect(ui->cyclePushButton, SIGNAL(clicked()), this, SLOT(insertCycleSlot()));
    connect(ui->distancePushButton, SIGNAL(clicked()), this, SLOT(insertDistanceSlot()));
    connect(ui->releasePushButton, SIGNAL(clicked()), this, SLOT(insertReleaseSlot()));

    connect(ui->actionSecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionMillisecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));

    connect(ui->toggleCheckbox, SIGNAL(clicked(bool)), button, SLOT(setToggle(bool)));
    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), this, SLOT(checkTurboSetting(bool)));

    connect(ui->setSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSetSelection()));

    connect(button, SIGNAL(toggleChanged(bool)), ui->toggleCheckbox, SLOT(setChecked(bool)));
    connect(button, SIGNAL(turboChanged(bool)), this, SLOT(checkTurboSetting(bool)));
}
// Constructor.
qsamplerInstrumentList::qsamplerInstrumentList (
	QWidget *pParent, const char *pszName )
	: QListView(pParent, pszName)
{
	m_iMidiMap = LSCP_MIDI_MAP_ALL;

//  QListView::setRootIsDecorated(true);
	QListView::setAllColumnsShowFocus(true);
	QListView::setResizeMode(QListView::NoColumn);
//	QListView::setAcceptDrops(true);
	QListView::setDragAutoScroll(true);
	QListView::setSizePolicy(
		QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
//	QListView::setShowToolTips(false);
	QListView::setSortColumn(-1);

	QListView::addColumn(tr("Name"));
	QListView::addColumn(tr("Map"));
	QListView::addColumn(tr("Bank"));
	QListView::addColumn(tr("Prog"));
	QListView::addColumn(tr("Engine"));
	QListView::addColumn(tr("File"));
	QListView::addColumn(tr("Nr"));
	QListView::addColumn(tr("Vol"));
	QListView::addColumn(tr("Mode"));

	QListView::setColumnAlignment(1, Qt::AlignHCenter);	// Map
	QListView::setColumnAlignment(2, Qt::AlignHCenter);	// Bank
	QListView::setColumnAlignment(3, Qt::AlignHCenter);	// Prog
	QListView::setColumnAlignment(6, Qt::AlignHCenter);	// Nr
	QListView::setColumnAlignment(7, Qt::AlignHCenter);	// Vol

	QListView::setColumnWidth(0, 120);	// Name
	QListView::setColumnWidth(5, 240);	// File

	m_pNewGroupAction = new QAction(
		QIconSet(QPixmap::fromMimeSource("itemGroupNew.png")),
		tr("New &Group"), tr("Ctrl+G"), this);
	m_pNewItemAction  = new QAction(
		QIconSet(QPixmap::fromMimeSource("itemNew.png")),
		tr("New &Instrument..."), tr("Ins"), this);
	m_pEditItemAction = new QAction(
		QIconSet(QPixmap::fromMimeSource("formEdit.png")),
		tr("&Edit..."), tr("Enter"), this);
	m_pRenameAction   = new QAction(tr("&Rename"), tr("F2"), this);
	m_pDeleteAction   = new QAction(
		QIconSet(QPixmap::fromMimeSource("formRemove.png")),
		tr("&Delete"), tr("Del"), this);
	m_pRefreshAction  = new QAction(
		QIconSet(QPixmap::fromMimeSource("formRefresh.png")),
		tr("Re&fresh"), tr("F5"), this);

	m_pNewGroupAction->setToolTip(tr("New Group"));
	m_pNewItemAction->setToolTip(tr("New Instrument"));
	m_pEditItemAction->setToolTip(tr("Edit"));
	m_pRenameAction->setToolTip(tr("Rename"));
	m_pDeleteAction->setToolTip(tr("Delete"));
	m_pRefreshAction->setToolTip(tr("Refresh"));

	QObject::connect(m_pNewGroupAction,
		SIGNAL(activated()),
		SLOT(newGroupSlot()));
	QObject::connect(m_pNewItemAction,
		SIGNAL(activated()),
		SLOT(newItemSlot()));
	QObject::connect(m_pEditItemAction,
		SIGNAL(activated()),
		SLOT(editItemSlot()));
	QObject::connect(m_pRenameAction,
		SIGNAL(activated()),
		SLOT(renameSlot()));
	QObject::connect(m_pDeleteAction,
		SIGNAL(activated()),
		SLOT(deleteSlot()));
	QObject::connect(m_pRefreshAction,
		SIGNAL(activated()),
		SLOT(refresh()));

	QObject::connect(this,
		SIGNAL(selectionChanged()),
		SLOT(selectionChangedSlot()));
	QObject::connect(this,
		SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)),
		SLOT(activatedSlot(QListViewItem*)));
	QObject::connect(this,
		SIGNAL(returnPressed(QListViewItem*)),
		SLOT(activatedSlot(QListViewItem*)));
	QObject::connect(this,
		SIGNAL(itemRenamed(QListViewItem*,int)),
		SLOT(renamedSlot(QListViewItem*)));

	selectionChangedSlot();
}