1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Rosegarden
5 A MIDI and audio sequencer and musical notation editor.
6 Copyright 2000-2021 the Rosegarden development team.
7
8 Other copyrights also apply to some parts of this work. Please
9 see the AUTHORS file and individual file headers for details.
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 */
17
18
19 #include "BeatsBarsDialog.h"
20
21 #include "base/Segment.h"
22
23 #include <QLayout>
24 #include <QComboBox>
25 #include <QDialog>
26 #include <QDialogButtonBox>
27 #include <QFrame>
28 #include <QGroupBox>
29 #include <QSpinBox>
30 #include <QWidget>
31
32
33 namespace Rosegarden
34 {
35
BeatsBarsDialog(QWidget * parent)36 BeatsBarsDialog::BeatsBarsDialog(QWidget* parent) :
37 QDialog(parent)
38 {
39 setModal(true);
40 setWindowTitle(tr("Audio Segment Duration"));
41 setObjectName("MinorDialog");
42 QGridLayout *metagrid = new QGridLayout;
43 setLayout(metagrid);
44
45 QGroupBox *gbox = new QGroupBox(tr("The selected audio segment contains:"));
46 gbox->setContentsMargins(5, 5, 5, 5);
47 QGridLayout *layout = new QGridLayout;
48 layout->setSpacing(5);
49
50 metagrid->addWidget(gbox, 0, 0);
51
52 m_spinBox = new QSpinBox;
53 m_spinBox->setMinimum(1);
54 m_spinBox->setMaximum(INT_MAX);
55 m_spinBox->setSingleStep(1);
56 layout->addWidget(m_spinBox, 0, 0);
57
58 m_comboBox = new QComboBox;
59 m_comboBox->setEditable(false);
60 m_comboBox->addItem(tr("beat(s)"));
61 m_comboBox->addItem(tr("bar(s)"));
62 m_comboBox->setCurrentIndex(0);
63 layout->addWidget(m_comboBox, 0, 1);
64
65 gbox->setLayout(layout);
66
67 QDialogButtonBox *buttonBox
68 = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
69 metagrid->addWidget(buttonBox, 1, 0);
70 metagrid->setRowStretch(0, 10);
71 connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
72 connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
73 }
74
75 }
76