00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "LabelCounterInputDialog.h"
00017
00018 #include <QVBoxLayout>
00019 #include <QHBoxLayout>
00020 #include <QLabel>
00021 #include <QSpinBox>
00022 #include <QDialogButtonBox>
00023
00024 LabelCounterInputDialog::LabelCounterInputDialog(Labeller *labeller,
00025 QWidget *parent) :
00026 QDialog(parent),
00027 m_labeller(labeller)
00028 {
00029 setWindowTitle(tr("Set Counters"));
00030
00031 QGridLayout *layout = new QGridLayout(this);
00032
00033 QLabel *label = new QLabel(tr("Fine counter (beats):"));
00034 layout->addWidget(label, 1, 0);
00035
00036 label = new QLabel(tr("Coarse counter (bars):"));
00037 layout->addWidget(label, 0, 0);
00038
00039 QSpinBox *counter = new QSpinBox;
00040 counter->setMinimum(-10);
00041 counter->setMaximum(10000);
00042 counter->setSingleStep(1);
00043 m_origSecondCounter = m_labeller->getSecondLevelCounterValue();
00044 counter->setValue(m_origSecondCounter);
00045 connect(counter, SIGNAL(valueChanged(int)),
00046 this, SLOT(secondCounterChanged(int)));
00047 layout->addWidget(counter, 0, 1);
00048
00049 counter = new QSpinBox;
00050 counter->setMinimum(-10);
00051 counter->setMaximum(10000);
00052 counter->setSingleStep(1);
00053 m_origCounter = m_labeller->getCounterValue();
00054 counter->setValue(m_origCounter);
00055 connect(counter, SIGNAL(valueChanged(int)),
00056 this, SLOT(counterChanged(int)));
00057 layout->addWidget(counter, 1, 1);
00058
00059 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok |
00060 QDialogButtonBox::Cancel);
00061 layout->addWidget(bb, 2, 0, 1, 2);
00062 connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
00063 connect(bb, SIGNAL(rejected()), this, SLOT(cancelClicked()));
00064 }
00065
00066 LabelCounterInputDialog::~LabelCounterInputDialog()
00067 {
00068 }
00069
00070 void
00071 LabelCounterInputDialog::counterChanged(int value)
00072 {
00073 m_labeller->setCounterValue(value);
00074 }
00075
00076 void
00077 LabelCounterInputDialog::secondCounterChanged(int value)
00078 {
00079 m_labeller->setSecondLevelCounterValue(value);
00080 }
00081
00082 void
00083 LabelCounterInputDialog::cancelClicked()
00084 {
00085 m_labeller->setCounterValue(m_origCounter);
00086 m_labeller->setSecondLevelCounterValue(m_origSecondCounter);
00087 reject();
00088 }
00089