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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: midisyncimpl.cpp,v 1.1.1.1 2003/10/29 10:06:21 wschweer Exp $
//
// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
//=========================================================
#include "midisyncimpl.h"
#include "sync.h"
#include <qspinbox.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qpushbutton.h>
//---------------------------------------------------------
// syncChanged
// val = 1 - Master Mode
// 0 - Slave Mode
//---------------------------------------------------------
void MidiSyncConfig::syncChanged(int val)
{
acceptMTCCheckbox->setEnabled(val);
acceptMCCheckbox->setEnabled(val);
acceptMMCCheckbox->setEnabled(val);
}
//---------------------------------------------------------
// MidiSyncConfig
// Midi Sync Config
//---------------------------------------------------------
MidiSyncConfig::MidiSyncConfig(QWidget* parent, const char* name)
: MidiSyncConfigBase(parent, name)
{
connect(okButton, SIGNAL(clicked()), SLOT(ok()));
connect(applyButton, SIGNAL(clicked()), SLOT(apply()));
connect(cancelButton, SIGNAL(clicked()), SLOT(cancel()));
connect(syncMode, SIGNAL(clicked(int)), SLOT(syncChanged(int)));
bool ext = extSyncFlag.value();
syncMode->setButton(int(ext));
dstDevId->setValue(txDeviceId);
srcDevId->setValue(rxDeviceId);
srcSyncPort->setValue(rxSyncPort + 1);
dstSyncPort->setValue(txSyncPort + 1);
mtcSync->setChecked(genMTCSync);
mcSync->setChecked(genMCSync);
midiMachineControl->setChecked(genMMC);
acceptMTCCheckbox->setChecked(acceptMTC);
acceptMCCheckbox->setChecked(acceptMC);
acceptMMCCheckbox->setChecked(acceptMMC);
mtcSyncType->setCurrentItem(mtcType);
mtcOffH->setValue(mtcOffset.h());
mtcOffM->setValue(mtcOffset.m());
mtcOffS->setValue(mtcOffset.s());
mtcOffF->setValue(mtcOffset.f());
mtcOffSf->setValue(mtcOffset.sf());
syncChanged(ext);
}
//---------------------------------------------------------
// ok Pressed
//---------------------------------------------------------
void MidiSyncConfig::ok()
{
apply();
cancel();
}
//---------------------------------------------------------
// cancel Pressed
//---------------------------------------------------------
void MidiSyncConfig::cancel()
{
close(false);
}
//---------------------------------------------------------
// apply Pressed
//---------------------------------------------------------
void MidiSyncConfig::apply()
{
txDeviceId = dstDevId->value();
rxDeviceId = srcDevId->value();
rxSyncPort = srcSyncPort->value() - 1;
txSyncPort = dstSyncPort->value() - 1;
genMTCSync = mtcSync->isChecked();
genMCSync = mcSync->isChecked();
genMMC = midiMachineControl->isChecked();
mtcType = mtcSyncType->currentItem();
extSyncFlag.setValue(syncMode->id(syncMode->selected()));
mtcOffset.setH(mtcOffH->value());
mtcOffset.setM(mtcOffM->value());
mtcOffset.setS(mtcOffS->value());
mtcOffset.setF(mtcOffF->value());
mtcOffset.setSf(mtcOffSf->value());
acceptMC = acceptMCCheckbox->isChecked();
acceptMMC = acceptMMCCheckbox->isChecked();
acceptMTC = acceptMTCCheckbox->isChecked();
}
|