InsertTupletDialog::InsertTupletDialog(QWidget *parent, unsigned int untupledCount, unsigned int tupledCount) : QDialog(parent) { //setHelp("nv-tuplets"); setModal(true); setWindowTitle(tr("Tuplet")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QWidget *vbox = new QWidget(this); QVBoxLayout *vboxLayout = new QVBoxLayout; vbox->setLayout(vboxLayout); metagrid->addWidget(vbox, 0, 0); QGroupBox *timingBox = new QGroupBox( tr("New timing for tuplet group"), vbox ); timingBox->setContentsMargins(5, 5, 5, 5); QGridLayout *timingLayout = new QGridLayout; timingBox->setLayout(timingLayout); timingLayout->setSpacing(5); vboxLayout->addWidget(timingBox); timingLayout->addWidget(new QLabel(tr("Play "), timingBox), 0, 0); m_untupledSpin = new QSpinBox(parent); m_untupledSpin->setMinimum(1); m_untupledSpin->setValue(untupledCount); timingLayout->addWidget(m_untupledSpin, 0, 1); timingLayout->addWidget(new QLabel(tr("in the time of "), timingBox), 1, 0); m_tupledSpin = new QSpinBox(parent); m_tupledSpin->setMinimum(1); m_tupledSpin->setValue(tupledCount); timingLayout->addWidget(m_tupledSpin, 1, 1); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); // No such slot // connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(slotHelpRequested())); }
BeatsBarsDialog::BeatsBarsDialog(QWidget* parent) : QDialog(parent) { setModal(true); setWindowTitle(tr("Audio Segment Duration")); setObjectName("MinorDialog"); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QGroupBox *gbox = new QGroupBox(tr("The selected audio segment contains:")); gbox->setContentsMargins(5, 5, 5, 5); QGridLayout *layout = new QGridLayout; layout->setSpacing(5); metagrid->addWidget(gbox, 0, 0); m_spinBox = new QSpinBox; m_spinBox->setMinimum(1); m_spinBox->setMaximum(INT_MAX); m_spinBox->setSingleStep(1); layout->addWidget(m_spinBox, 0, 0); m_comboBox = new QComboBox; m_comboBox->setEditable(false); m_comboBox->addItem(tr("beat(s)")); m_comboBox->addItem(tr("bar(s)")); m_comboBox->setCurrentIndex(0); layout->addWidget(m_comboBox, 0, 1); gbox->setLayout(layout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }
DateTimeDialog::DateTimeDialog(QWidget *parent) : QDialog(parent) { QPalette pal = this->palette(); pal.setColor(QPalette::Window, "#D0D0E7"); setPalette(pal); setWindowTitle(QString::fromLocal8Bit("Změna času fotografií")); setLayout(new QVBoxLayout); QGroupBox *gBox = new QGroupBox; gBox->setLayout(new QVBoxLayout); rAll = new QRadioButton(tr("All pictures")); rAll->setChecked(true); rSelected = new QRadioButton(tr("Selected pictures")); gBox->setContentsMargins(QMargins(0,0,0,0)); gBox->layout()->addWidget(rAll); gBox->layout()->addWidget(rSelected); QLabel *l = new QLabel; l->setAutoFillBackground(true); l->setBackgroundRole(QPalette::Light); l->setMaximumHeight(1); QDialogButtonBox *buttonBox = new QDialogButtonBox;//(QDialogButtonBox::Apply & QDialogButtonBox::Cancel); buttonBox->addButton(QDialogButtonBox::Cancel); buttonBox->addButton(QDialogButtonBox::Ok); //Apply connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); this->layout()->addWidget(gBox); this->layout()->addWidget(l); this->layout()->addWidget(buttonBox); }
SplitByRecordingSrcDialog::SplitByRecordingSrcDialog(QWidget *parent, RosegardenDocument *doc) : QDialog(parent) { setModal(true); setWindowTitle(tr("Split by Recording Source")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QWidget *vBox = new QWidget(this); QVBoxLayout *vBoxLayout = new QVBoxLayout; metagrid->addWidget(vBox, 0, 0); QGroupBox *groupBox = new QGroupBox( tr("Recording Source"), vBox ); groupBox->setContentsMargins(10, 10, 10, 10); QGridLayout *layout = new QGridLayout(groupBox); layout->setSpacing(5); vBoxLayout->addWidget(groupBox); vBox->setLayout(vBoxLayout); layout->addWidget(new QLabel( tr("Channel:"), groupBox ), 0, 0); m_channel = new QComboBox( groupBox ); m_channel->setMaxVisibleItems( 17 ); layout->addWidget(m_channel, 0, 1); QSpacerItem *spacer = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout->addItem( spacer, 0, 2 ); m_channel->addItem(tr("any")); for (int i = 1; i < 17; ++i) { m_channel->addItem(QString::number(i)); } layout->addWidget(new QLabel( tr("Device:"), groupBox ), 1, 0); m_device = new QComboBox( groupBox ); layout->addWidget( m_device, 1, 1, 0+1, 2 - 1+1); m_deviceIds.clear(); m_deviceIds.push_back( -1); m_device->addItem(tr("any")); DeviceList *devices = doc->getStudio().getDevices(); DeviceListConstIterator it; for (it = devices->begin(); it != devices->end(); it++) { MidiDevice *dev = dynamic_cast<MidiDevice*>(*it); if (dev && dev->getDirection() == MidiDevice::Record) { QString label = QString::number(dev->getId()); label += ": "; label += strtoqstr(dev->getName()); QString connection = RosegardenSequencer::getInstance()->getConnection (dev->getId()); label += " - "; if (connection == "") label += tr("No connection"); else label += connection; m_device->addItem(label); m_deviceIds.push_back(dev->getId()); } } m_channel->setCurrentIndex(0); m_device->setCurrentIndex(0); groupBox->setLayout(layout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }
void EventFilterDialog::initDialog() { setModal(true); setWindowTitle(tr("Event Filter")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QWidget *mainWidget = new QWidget(this); QVBoxLayout *mainWidgetLayout = new QVBoxLayout; metagrid->addWidget(mainWidget, 0, 0); //----------[ Note Filter Widgets ]------------------------- // Frame QGroupBox* noteFrame = new QGroupBox(tr("Note Events")); noteFrame->setContentsMargins(20, 20, 20, 20); QGridLayout* noteFrameLayout = new QGridLayout; noteFrameLayout->setSpacing(6); mainWidgetLayout->addWidget(noteFrame); // Labels QLabel* pitchFromLabel = new QLabel(tr("lowest:"), noteFrame); noteFrameLayout->addWidget(pitchFromLabel, 0, 2); QLabel* pitchToLabel = new QLabel(tr("highest:"), noteFrame); noteFrameLayout->addWidget(pitchToLabel, 0, 4); QLabel* pitchLabel = new QLabel(tr("Pitch:"), noteFrame); noteFrameLayout->addWidget(pitchLabel, 1, 1); QLabel* velocityLabel = new QLabel(tr("Velocity:"), noteFrame); noteFrameLayout->addWidget(velocityLabel, 2, 1); QLabel* durationLabel = new QLabel(tr("Duration:"), noteFrame); noteFrameLayout->addWidget(durationLabel, 3, 1); m_useNotationDuration = new QCheckBox(); noteFrameLayout->addWidget(m_useNotationDuration, 4, 1); m_selectRests = new QCheckBox(); noteFrameLayout->addWidget(m_selectRests, 5, 1); // Include Boxes m_notePitchIncludeComboBox = new QComboBox(noteFrame); m_notePitchIncludeComboBox->setEditable(false); m_notePitchIncludeComboBox->addItem(tr("include")); m_notePitchIncludeComboBox->addItem(tr("exclude")); QSettings settings; settings.beginGroup( EventFilterDialogConfigGroup ); m_notePitchIncludeComboBox->setCurrentIndex( qStrToBool( settings.value("pitchinclude", "0" ) ) ); noteFrameLayout->addWidget(m_notePitchIncludeComboBox, 1, 0); m_noteVelocityIncludeComboBox = new QComboBox(noteFrame); m_noteVelocityIncludeComboBox->setEditable(false); m_noteVelocityIncludeComboBox->addItem(tr("include")); m_noteVelocityIncludeComboBox->addItem(tr("exclude")); m_noteVelocityIncludeComboBox->setCurrentIndex( qStrToBool( settings.value("velocityinclude", "0" ) ) ); noteFrameLayout->addWidget(m_noteVelocityIncludeComboBox, 2, 0); m_noteDurationIncludeComboBox = new QComboBox(noteFrame); m_noteDurationIncludeComboBox->setEditable(false); m_noteDurationIncludeComboBox->addItem(tr("include")); m_noteDurationIncludeComboBox->addItem(tr("exclude")); m_noteDurationIncludeComboBox->setCurrentIndex( qStrToBool( settings.value("durationinclude", "0" ) ) ); noteFrameLayout->addWidget(m_noteDurationIncludeComboBox, 3, 0); QLabel* durationCheckBoxLabel = new QLabel(tr("Use notation duration")); noteFrameLayout->addWidget(durationCheckBoxLabel, 4, 2); m_useNotationDuration->setChecked(settings.value("usenotationduration", "0").toBool()); QLabel* useRestsLabel = new QLabel(tr("Select rests")); noteFrameLayout->addWidget(useRestsLabel, 5, 2); m_selectRests->setChecked(settings.value("selectrests", "0").toBool()); // Pitch From m_pitchFromSpinBox = new QSpinBox(noteFrame); m_pitchFromSpinBox->setMaximum(127); m_pitchFromSpinBox->setValue( settings.value("pitchfrom", 0).toUInt() ); noteFrameLayout->addWidget(m_pitchFromSpinBox, 1, 2); connect(m_pitchFromSpinBox, SIGNAL(valueChanged(int)), SLOT(slotPitchFromChanged(int))); m_pitchFromChooserButton = new QPushButton(tr("edit"), noteFrame); m_pitchFromChooserButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed, QSizePolicy::PushButton)); m_pitchFromChooserButton->setToolTip(tr("choose a pitch using a staff")); noteFrameLayout->addWidget(m_pitchFromChooserButton, 1, 3); connect(m_pitchFromChooserButton, SIGNAL(clicked()), SLOT(slotPitchFromChooser())); // Pitch To m_pitchToSpinBox = new QSpinBox(noteFrame); m_pitchToSpinBox->setMaximum(127); m_pitchToSpinBox->setValue( settings.value("pitchto", 127).toUInt() ); noteFrameLayout->addWidget(m_pitchToSpinBox, 1, 4); connect(m_pitchToSpinBox, SIGNAL(valueChanged(int)), SLOT(slotPitchToChanged(int))); m_pitchToChooserButton = new QPushButton(tr("edit"), noteFrame); m_pitchToChooserButton->setToolTip(tr("choose a pitch using a staff")); noteFrameLayout->addWidget(m_pitchToChooserButton, 1, 5); connect(m_pitchToChooserButton, SIGNAL(clicked()), SLOT(slotPitchToChooser())); // Velocity From/To m_velocityFromSpinBox = new QSpinBox(noteFrame); m_velocityFromSpinBox->setMaximum(127); m_velocityFromSpinBox->setValue( settings.value("velocityfrom", 0).toUInt() ); noteFrameLayout->addWidget(m_velocityFromSpinBox, 2, 2); connect(m_velocityFromSpinBox, SIGNAL(valueChanged(int)), SLOT(slotVelocityFromChanged(int))); m_velocityToSpinBox = new QSpinBox(noteFrame); m_velocityToSpinBox->setMaximum(127); m_velocityToSpinBox->setValue( settings.value("velocityto", 127).toUInt() ); noteFrameLayout->addWidget( m_velocityToSpinBox, 2, 4 ); connect(m_velocityToSpinBox, SIGNAL(valueChanged(int)), SLOT(slotVelocityToChanged(int))); // Duration From/To m_noteDurationFromComboBox = new QComboBox(noteFrame); m_noteDurationFromComboBox->setEditable(false); m_noteDurationFromComboBox->addItem(tr("longest")); noteFrameLayout->addWidget(m_noteDurationFromComboBox, 3, 2); connect(m_noteDurationFromComboBox, SIGNAL(activated(int)), SLOT(slotDurationFromChanged(int))); m_noteDurationToComboBox = new QComboBox(noteFrame); m_noteDurationToComboBox->setEditable(false); m_noteDurationToComboBox->addItem(tr("longest")); noteFrameLayout->addWidget(m_noteDurationToComboBox, 3, 4); connect(m_noteDurationToComboBox, SIGNAL(activated(int)), SLOT(slotDurationToChanged(int))); populateDurationCombos(); //---------[ Buttons ]-------------------------------------- QFrame* privateLayoutWidget = new QFrame(mainWidget); privateLayoutWidget->setContentsMargins(20, 20, 20, 20); QGridLayout* buttonLayout = new QGridLayout; buttonLayout->setSpacing(6); mainWidgetLayout->addWidget(privateLayoutWidget); m_buttonAll = new QPushButton(tr("Include all"), privateLayoutWidget); m_buttonAll->setAutoDefault(true); m_buttonAll->setToolTip(tr("Include entire range of values")); buttonLayout->addWidget( m_buttonAll, 0, 0 ); m_buttonNone = new QPushButton(tr("Exclude all"), privateLayoutWidget); m_buttonNone->setAutoDefault(true); m_buttonNone->setToolTip(tr("Exclude entire range of values")); buttonLayout->addWidget( m_buttonNone, 0, 1 ); connect(m_buttonAll, SIGNAL(clicked()), this, SLOT(slotToggleAll())); connect(m_buttonNone, SIGNAL(clicked()), this, SLOT(slotToggleNone())); settings.endGroup(); privateLayoutWidget->setLayout(buttonLayout); noteFrame->setLayout(noteFrameLayout); mainWidget->setLayout(mainWidgetLayout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }
ManageMetronomeDialog::ManageMetronomeDialog(QWidget *parent, RosegardenDocument *doc) : QDialog(parent), m_doc(doc), m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close)) { setModal(true); setWindowTitle(tr("Metronome")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QWidget *hbox = new QWidget(this); QHBoxLayout *hboxLayout = new QHBoxLayout; hboxLayout->setMargin(0); metagrid->addWidget(hbox, 0, 0); QWidget *vbox = new QWidget(hbox); QVBoxLayout *vboxLayout = new QVBoxLayout; vboxLayout->setMargin(0); hboxLayout->addWidget(vbox); QGroupBox *deviceBox = new QGroupBox( tr("Metronome Instrument"), vbox ); deviceBox->setContentsMargins(10, 10, 10, 10); QGridLayout *deviceBoxLayout = new QGridLayout(deviceBox); deviceBoxLayout->setSpacing(5); vboxLayout->addWidget(deviceBox); deviceBoxLayout->addWidget(new QLabel(tr("Device"), deviceBox), 0, 0); m_metronomeDevice = new QComboBox(deviceBox); m_metronomeDevice->setToolTip(tr("<qt>Choose the device you want to use to play the metronome</qt>")); deviceBoxLayout->addWidget(m_metronomeDevice, 0, 1); DeviceList *devices = doc->getStudio().getDevices(); DeviceListConstIterator it; Studio &studio = m_doc->getStudio(); DeviceId deviceId = studio.getMetronomeDevice(); for (it = devices->begin(); it != devices->end(); it++) { Device *dev = *it; bool hasConnection = false; if (!isSuitable(dev, &hasConnection)) continue; QString label = QObject::tr(dev->getName().c_str()); // connections imply some untranslatable external string QString connection = RosegardenSequencer::getInstance()->getConnection (dev->getId()); if (hasConnection && connection != "") { label = tr("%1 - %2").arg(label).arg(connection); } else if (!hasConnection) { label = tr("%1 - No connection").arg(label); } m_metronomeDevice->addItem(label); if (dev->getId() == deviceId) { m_metronomeDevice->setCurrentIndex(m_metronomeDevice->count() - 1); } } deviceBoxLayout->addWidget(new QLabel(tr("Instrument"), deviceBox), 1, 0); m_metronomeInstrument = new QComboBox(deviceBox); m_metronomeInstrument->setToolTip(tr("<qt>Choose the instrument you want to use to play the metronome (typically #10)</qt>")); connect(m_metronomeInstrument, SIGNAL(activated(int)), this, SLOT(slotSetModified())); deviceBoxLayout->addWidget(m_metronomeInstrument, 1, 1); deviceBox->setLayout(deviceBoxLayout); QGroupBox *beatBox = new QGroupBox( tr("Beats"), vbox ); beatBox->setContentsMargins(10, 10, 10, 10); QGridLayout *beatBoxLayout = new QGridLayout(beatBox); beatBoxLayout->setSpacing(5); vboxLayout->addWidget(beatBox); beatBoxLayout->addWidget(new QLabel(tr("Resolution"), beatBox), 0, 0); m_metronomeResolution = new QComboBox(beatBox); m_metronomeResolution->setToolTip(tr("<qt>The metronome can sound bars only, bars and beats, or bars, beats and sub-beats. The latter mode can be particularly useful for playing in compound time signatures like 12/8.</qt>")); m_metronomeResolution->addItem(tr("None")); m_metronomeResolution->addItem(tr("Bars only")); m_metronomeResolution->addItem(tr("Bars and beats")); m_metronomeResolution->addItem(tr("Bars, beats, and sub-beats")); connect(m_metronomeResolution, SIGNAL(activated(int)), this, SLOT(slotResolutionChanged(int))); beatBoxLayout->addWidget(m_metronomeResolution, 0, 1); beatBoxLayout->addWidget(new QLabel(tr("Bar velocity"), beatBox), 1, 0); m_metronomeBarVely = new QSpinBox(beatBox); m_metronomeBarVely->setToolTip(tr("<qt>Controls how forcefully the bar division notes will be struck. (These are typically the loudest of all.)</qt>")); m_metronomeBarVely->setMinimum(0); m_metronomeBarVely->setMaximum(127); connect(m_metronomeBarVely, SIGNAL(valueChanged(int)), this, SLOT(slotSetModified())); beatBoxLayout->addWidget(m_metronomeBarVely, 1, 1); beatBoxLayout->addWidget(new QLabel(tr("Beat velocity"), beatBox), 2, 0); m_metronomeBeatVely = new QSpinBox(beatBox); m_metronomeBeatVely->setToolTip(tr("<qt>Controls how forcefully the beat division notes will be struck. (These are typically more quiet than beat division notes.)</qt>")); m_metronomeBeatVely->setMinimum(0); m_metronomeBeatVely->setMaximum(127); connect(m_metronomeBeatVely, SIGNAL(valueChanged(int)), this, SLOT(slotSetModified())); beatBoxLayout->addWidget(m_metronomeBeatVely, 2, 1); beatBoxLayout->addWidget(new QLabel(tr("Sub-beat velocity"), beatBox), 3, 0); m_metronomeSubBeatVely = new QSpinBox(beatBox); m_metronomeSubBeatVely->setToolTip(tr("<qt>Controls how forcefully the sub-beat division notes will be struck. (These are typically the most quiet of all, and are not heard unless you are working in compound time.)</qt>")); m_metronomeSubBeatVely->setMinimum(0); m_metronomeSubBeatVely->setMaximum(127); connect(m_metronomeSubBeatVely, SIGNAL(valueChanged(int)), this, SLOT(slotSetModified())); beatBoxLayout->addWidget(m_metronomeSubBeatVely, 3, 1); beatBox->setLayout(beatBoxLayout); vbox->setLayout(vboxLayout); vbox = new QWidget(hbox); vboxLayout = new QVBoxLayout; vboxLayout->setMargin(0); hboxLayout->addWidget(vbox); hbox->setLayout(hboxLayout); m_metronomePitch = new PitchChooser(tr("Pitch"), vbox , 60); m_metronomePitch->setToolTip(tr("<qt>It is typical to use a percussion instrument for the metronome, so the pitch normally controls which sort of drum will sound for each tick. You may configure a different pitch for each of the bar, beat, and sub-beat ticks.</qt>")); vboxLayout->addWidget(m_metronomePitch); connect(m_metronomePitch, SIGNAL(pitchChanged(int)), this, SLOT(slotPitchChanged(int))); connect(m_metronomePitch, SIGNAL(preview(int)), this, SLOT(slotPreviewPitch(int))); m_metronomePitchSelector = new QComboBox(); m_metronomePitchSelector->addItem(tr("for Bar")); m_metronomePitchSelector->addItem(tr("for Beat")); m_metronomePitchSelector->addItem(tr("for Sub-beat")); m_metronomePitch->addWidgetToLayout(m_metronomePitchSelector); connect(m_metronomePitchSelector, SIGNAL(activated(int)), this, SLOT(slotPitchSelectorChanged(int))); QGroupBox *enableBox = new QGroupBox( tr("Metronome Activated"), vbox ); QVBoxLayout *enableBoxLayout = new QVBoxLayout; vboxLayout->addWidget(enableBox); m_playEnabled = new QCheckBox(tr("Playing"), enableBox); enableBoxLayout->addWidget(m_playEnabled); m_recordEnabled = new QCheckBox(tr("Recording"), enableBox); enableBoxLayout->addWidget(m_recordEnabled); connect(m_playEnabled, SIGNAL(clicked()), this, SLOT(slotSetModified())); connect(m_recordEnabled, SIGNAL(clicked()), this, SLOT(slotSetModified())); enableBox->setLayout(enableBoxLayout); vbox->setLayout(vboxLayout); // populate the dialog populate(m_metronomeDevice->currentIndex()); // connect up the device list connect(m_metronomeDevice, SIGNAL(activated(int)), this, SLOT(populate(int))); // connect up the device list connect(m_metronomeDevice, SIGNAL(activated(int)), this, SLOT(slotSetModified())); metagrid->addWidget(m_buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); setModified(false); }
Gitarre::Gitarre(QWidget *parent, Qt::WindowFlags flags) : QMainWindow (parent, flags) { Repos = vector <Repository *> (0); setWindowTitle ("gitarre"); setMinimumSize (QSize (800, 600)); setFocusPolicy (Qt::StrongFocus); // Create menu NewMenu = new QMenu ("New"); QAction *initAction = new QAction ("Init", NewMenu); QAction *cloneAction = new QAction ("Clone", NewMenu); QObject::connect (initAction, &QAction::triggered, this, &Gitarre::onInitAction); connect (cloneAction, &QAction::triggered, this, &Gitarre::onCloneAction); NewMenu->addAction(initAction); NewMenu->addAction(cloneAction); QAction *openAction = new QAction ("Open", this); connect (openAction, &QAction::triggered, this, &Gitarre::onOpenAction); SaveMenu = new QMenu ("Save"); QAction *saveGitignoreAction = new QAction (".gitignore", SaveMenu); connect (saveGitignoreAction, &QAction::triggered, this, &Gitarre::onSaveGitignoreAction); SaveMenu->addAction (saveGitignoreAction); QMenu *fileMenu = menuBar()->addMenu("File"); fileMenu->addMenu (NewMenu); fileMenu->addAction(openAction); fileMenu->addMenu (SaveMenu); QMenu *repositoryMenu = menuBar()->addMenu ("Repository"); CommitAction = new QAction ("Commit", repositoryMenu); PushAction = new QAction ("Push", repositoryMenu); QAction *separator = new QAction (repositoryMenu); separator->setSeparator(true); connect (CommitAction, &QAction::triggered, this, &Gitarre::onCommitAction); connect (PushAction, &QAction::triggered, this, &Gitarre::onPushAction); repositoryMenu->addAction (CommitAction); repositoryMenu->addAction (PushAction); repositoryMenu->addAction (separator); RemotesMenu = new QMenu ("Remotes"); repositoryMenu->addMenu (RemotesMenu); // Create status bar StatusBar = new QStatusBar (); StatusLabel = new QLabel (""); StatusProgress = new QProgressBar (); StatusBar->addWidget(StatusLabel); StatusBar->addWidget(StatusProgress); StatusLabel->hide(); StatusProgress->hide(); setStatusBar (StatusBar); // Create overall layout QSplitter *splitter = new QSplitter (Qt::Horizontal); // Create repository browser RepoView = new QTreeWidget (); RepoView->header()->close(); RepoView->setContextMenuPolicy(Qt::ActionsContextMenu); connect (RepoView, &QTreeWidget::currentItemChanged, this, &Gitarre::onRepoViewItemChanged); QGroupBox *repoBox = new QGroupBox ("Repositories"); repoBox->setContentsMargins(6, 12, 0, 0); QVBoxLayout *repoBoxLayout = new QVBoxLayout (); repoBoxLayout->setContentsMargins(0, 12, 0, 0); repoBoxLayout->addWidget (RepoView); repoBox->setLayout (repoBoxLayout); splitter->addWidget (repoBox); this->setCentralWidget(splitter); // Create actions for RepoView FindRepoAction = new QAction ("Find", RepoView); CommitRepoAction = new QAction ("Commit", RepoView); PushRepoAction = new QAction ("Push", RepoView); RemoveSeparator = new QAction (RepoView); RemoveSeparator->setSeparator (true); RemoveRepoAction = new QAction ("Remove", RepoView); connect (FindRepoAction, &QAction::triggered, this, &Gitarre::onFindRepoAction); connect (CommitRepoAction, &QAction::triggered, this, &Gitarre::onCommitAction); connect (PushRepoAction, &QAction::triggered, this, &Gitarre::onPushAction); connect (RemoveRepoAction, &QAction::triggered, this, &Gitarre::onRemoveRepoAction); // Create main tab widget MainTabWidget = new QTabWidget (); splitter->addWidget (MainTabWidget); // Create .gitignore editor IgnoreEditor = new QTextEdit (); IgnoreEditor->installEventFilter (this); MainTabWidget->addTab(IgnoreEditor, ".gitignore"); // Check whether application folder in /home/user exists and creating if necessary QString userDataPath = QDir::homePath() + "/.gitarre/"; UserDataDir = QDir (userDataPath); if (!UserDataDir.exists()) UserDataDir.mkpath (userDataPath); // Read and load saved repositories ReadSavedRepos (); if (!Repos.empty()) RepoView->setCurrentItem(RepoView->topLevelItem (0)); }
UseOrnamentDialog::UseOrnamentDialog(QWidget *parent, Composition *composition) : QDialog(parent), m_composition(composition) { setModal(true); setWindowTitle(tr("Use Ornament")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QWidget *vbox = new QWidget(this); QVBoxLayout *vboxLayout = new QVBoxLayout; metagrid->addWidget(vbox, 0, 0); QLabel *label; QGroupBox *notationBox = new QGroupBox(tr("Notation")); vboxLayout->addWidget(notationBox); notationBox->setContentsMargins(5, 5, 5, 5); QGridLayout *layout = new QGridLayout; layout->setSpacing(5); label = new QLabel(tr("Display as: ")); layout->addWidget(label, 0, 0); m_mark = new QComboBox; layout->addWidget(m_mark, 0, 1); m_marks.push_back(Marks::Trill); m_marks.push_back(Marks::LongTrill); m_marks.push_back(Marks::TrillLine); m_marks.push_back(Marks::Turn); m_marks.push_back(Marks::Mordent); m_marks.push_back(Marks::MordentInverted); m_marks.push_back(Marks::MordentLong); m_marks.push_back(Marks::MordentLongInverted); const QString markLabels[] = { tr("Trill"), tr("Trill with line"), tr("Trill line only"), tr("Turn"), tr("Mordent"), tr("Inverted mordent"), tr("Long mordent"), tr("Long inverted mordent"), }; for (size_t i = 0; i < m_marks.size(); ++i) { m_mark->addItem(NotePixmapFactory::makeMarkMenuPixmap(m_marks[i]), markLabels[i]); } m_mark->addItem(tr("Text mark")); connect(m_mark, SIGNAL(activated(int)), this, SLOT(slotMarkChanged(int))); m_textLabel = new QLabel(tr(" Text: ")); layout->addWidget(m_textLabel, 0, 2); m_text = new LineEdit; layout->addWidget(m_text, 0, 3); notationBox->setLayout(layout); QGroupBox *performBox = new QGroupBox(tr("Performance")); vboxLayout->addWidget(performBox); vbox->setLayout(vboxLayout); performBox->setContentsMargins(5, 5, 5, 5); layout = new QGridLayout; layout->setSpacing(5); label = new QLabel(tr("Perform using triggered segment: ")); layout->addWidget(label, 0, 0); m_ornament = new QComboBox; layout->addWidget(m_ornament, 0, 1); int n = 1; for (Composition::triggersegmentcontaineriterator i = m_composition->getTriggerSegments().begin(); i != m_composition->getTriggerSegments().end(); ++i) { m_ornament->addItem (QString("%1. %2").arg(n++).arg(strtoqstr((*i)->getSegment()->getLabel()))); } label = new QLabel(tr("Perform with timing: ")); layout->addWidget(label, 1, 0); m_adjustTime = new QComboBox; layout->addWidget(m_adjustTime, 1, 1); m_adjustTime->addItem(tr("As stored")); m_adjustTime->addItem(tr("Truncate if longer than note")); m_adjustTime->addItem(tr("End at same time as note")); m_adjustTime->addItem(tr("Stretch or squash segment to note duration")); m_retune = new QCheckBox(tr("Adjust pitch to note")); m_retune->setChecked(true); layout->addWidget(m_retune, 2, 1); performBox->setLayout(layout); setupFromConfig(); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }
MainWindow::MainWindow(QWidget *parent){ this->setStyleSheet("background:qlineargradient(x1:0 y1:0, x2:0 y2:1,stop:0 #3498db, stop:1 #2980b9); color:white; width:200px;" ); this->setGeometry(500,250,0,0); QVBoxLayout*layout=new QVBoxLayout; QLabel* titolo=new QLabel("LinQedIn"); titolo->setAlignment(Qt::AlignHCenter); titolo->setStyleSheet("font: 20pt \"FontAwesome\";" "font-weight:bold;" "background:transparent;" "margin-bottom:20px;" "margin-top:20px;" ); QGroupBox *groupBoxUtente = new QGroupBox("Login Lato Client"); groupBoxUtente->setStyleSheet("background:transparent;"); groupBoxUtente->setAlignment(Qt::AlignHCenter); groupBoxUtente->setContentsMargins(5,0,5,0); QLabel* labelusernameU=new QLabel(tr("Username")); labelusernameU->setAlignment(Qt::AlignHCenter); labelusernameU->setStyleSheet("font: 12pt \"Times\";" "margin-top:20px;" "background:transparent;" ); caselladitestoUserU=new QLineEdit(); caselladitestoUserU->setStyleSheet("background:white;" "color:black;" ); QLabel* labelPasswordU=new QLabel(tr("Password")); labelPasswordU->setAlignment(Qt::AlignHCenter); labelPasswordU->setStyleSheet("font: 12pt \"Times\";" "margin-top:0px;" "background:transparent;" ); caselladitestoPwU=new QLineEdit(); caselladitestoPwU->setStyleSheet("background:white;" "color:black;" "margin-bottom:10px;"); caselladitestoPwU->setEchoMode(QLineEdit::Password); QPushButton* accediU=new QPushButton("Accedi"); accediU->setStyleSheet("background:#0082b6;"); QVBoxLayout *vboxU = new QVBoxLayout; vboxU->addWidget(labelusernameU); vboxU->addWidget(caselladitestoUserU); vboxU->addWidget(labelPasswordU); vboxU->addWidget(caselladitestoPwU); vboxU->addWidget(accediU); groupBoxUtente->setLayout(vboxU); QGroupBox *groupBoxAdmin = new QGroupBox(tr("Login Lato Admin")); groupBoxAdmin->setStyleSheet("background:transparent;"); QLabel* labelusernameA=new QLabel(tr("Username")); labelusernameA->setAlignment(Qt::AlignHCenter); labelusernameA->setStyleSheet("font: 12pt \"Times\";" "margin-top:20px;" "background:transparent;" ); caselladitestoUserA=new QLineEdit(); caselladitestoUserA->setStyleSheet("background:white;" "color:black;" ); QLabel* labelPasswordA=new QLabel(tr("Password")); labelPasswordA->setAlignment(Qt::AlignHCenter); labelPasswordA->setStyleSheet("font: 12pt \"Times\";" "margin-top:0px;" "background:transparent;" ); caselladitestoPwA=new QLineEdit(); caselladitestoPwA->setStyleSheet("background:white;" "color:black;" "margin-bottom:10px;"); caselladitestoPwA->setEchoMode(QLineEdit::Password); QPushButton* accediA=new QPushButton(("Accedi")); accediA->setStyleSheet("background:#0082b6;"); QVBoxLayout *vboxA = new QVBoxLayout; vboxA->addWidget(labelusernameA); vboxA->addWidget(caselladitestoUserA); vboxA->addWidget(labelPasswordA); vboxA->addWidget(caselladitestoPwA); vboxA->addWidget(accediA); groupBoxAdmin->setLayout(vboxA); QGridLayout *grid = new QGridLayout; grid->addWidget(groupBoxUtente, 0, 0); grid->addWidget(groupBoxAdmin, 0, 1); connect(accediU,SIGNAL(clicked()),this,SLOT(SlotAutenticationUser())); connect(accediA,SIGNAL(clicked()),this,SLOT(SlotAutenticationAdmin())); layout->addWidget(titolo); layout->addLayout(grid); layout -> setMargin(0); layout -> setContentsMargins (0,0,0,0); layout->setSizeConstraint(QLayout::SetFixedSize); setLayout(layout); }
GuitarChordSelectorDialog::GuitarChordSelectorDialog(QWidget *parent) : QDialog(parent) { QString localStyle = "QListView {background-color: #FFFFFF; alternate-background-color: #EEEEFF; color: #000000; selection-background-color: #80AFFF; selection-color: #FFFFFF;}"; // we'll use "localStyle" as a future search point, but switch over to a // more meaningful variable name for the actual style assignment // // Note that I'm just slapping another local stylesheet on these damn // QListView objects, because they're stubbornly refusing to be touched from // the external stylesheet, and I'm beyond losing patience with dicking // around to solve problems like this. Our stylesheet and style code are a // complete mess, and I will probably have to rewrite all of this one day, // but not before Thorn/Abraham Darby releases. QString listStyle = localStyle; setModal(true); setWindowTitle(tr("Guitar Chord Selector")); setWindowIcon(IconLoader().loadPixmap("window-guitar")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QGroupBox *page = new QGroupBox(this); QGridLayout *topLayout = new QGridLayout(page); metagrid->addWidget(page, 0, 0); topLayout->addWidget(new QLabel(tr("Root"), page), 0, 0); m_rootNotesList = new QListWidget(page); m_rootNotesList->setStyleSheet(listStyle); topLayout->addWidget(m_rootNotesList, 1, 0); topLayout->addWidget(new QLabel(tr("Extension"), page), 0, 1); m_chordExtList = new QListWidget(page); m_chordExtList->setStyleSheet(listStyle); topLayout->addWidget(m_chordExtList, 1, 1); m_newFingeringButton = new QPushButton(tr("New"), page); m_deleteFingeringButton = new QPushButton(tr("Delete"), page); m_editFingeringButton = new QPushButton(tr("Edit"), page); m_chordComplexityCombo = new QComboBox(page); m_chordComplexityCombo->addItem(tr("beginner")); m_chordComplexityCombo->addItem(tr("common")); m_chordComplexityCombo->addItem(tr("all")); //m_chordComplexityCombo->setMinimumContentsLength(20); connect(m_chordComplexityCombo, SIGNAL(activated(int)), this, SLOT(slotComplexityChanged(int))); page->setContentsMargins(5, 5, 5, 5); QVBoxLayout* vboxLayout = new QVBoxLayout(); //topLayout->addLayout(vboxLayout, 1, 2, 3, 1); topLayout->addLayout(vboxLayout, 2, 1); vboxLayout->addWidget(m_chordComplexityCombo); vboxLayout->addStretch(10); vboxLayout->addWidget(m_newFingeringButton); vboxLayout->addWidget(m_deleteFingeringButton); vboxLayout->addWidget(m_editFingeringButton); connect(m_newFingeringButton, SIGNAL(clicked()), this, SLOT(slotNewFingering())); connect(m_deleteFingeringButton, SIGNAL(clicked()), this, SLOT(slotDeleteFingering())); connect(m_editFingeringButton, SIGNAL(clicked()), this, SLOT(slotEditFingering())); topLayout->addWidget(new QLabel(tr("Fingerings"), page), 0, 3); m_fingeringsList = new QListWidget(page); m_fingeringsList->setStyleSheet(listStyle); // try setting size to something 200 can be divided into evenly, in the hope // of avoiding fuzzy half pixel scaling problems (50 was no good, but 100 // works well for grid lines here; dots still look awful, but who cares) m_fingeringsList->setIconSize(QSize(100, 100)); topLayout->addWidget(m_fingeringsList, 1, 3, 2, 1); m_fingeringBox = new FingeringBox(false, page, true); topLayout->addWidget(m_fingeringBox, 2, 0, 1, 2); connect(m_rootNotesList, SIGNAL(currentRowChanged(int)), this, SLOT(slotRootHighlighted(int))); connect(m_chordExtList, SIGNAL(currentRowChanged(int)), this, SLOT(slotChordExtHighlighted(int))); // connect itemClicked() so it will fire if a user clicks directly on the // fingering list doodad thingummy (and comments like "fingering list doodad // thingummy" are what you get when you abandon half-finished code the core // developers don't really understand, and expect them to keep it alive for // you in perpetuity) // connect(m_fingeringsList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotFingeringHighlighted(QListWidgetItem*))); // connect currentRowChanged() so this can be fired when other widgets are // manipulated, which will cause this one to pop back up to the top. This // slot triggers other updates in a leg bone connected to the thigh bone // fashion, so we have to wire it to some input to get those updates to // happen, and overloading this to fire two different ways was quick and // cheap // connect(m_fingeringsList, SIGNAL(currentRowChanged(int)), this, SLOT(slotFingeringHighlighted(int))); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }
US_EquilTime::US_EquilTime() : US_Widgets( true ) { astfem_rsa = new US_Astfem_RSA( model, simparams ); connect( astfem_rsa, SIGNAL( new_scan ( QVector< double >*, double* ) ), SLOT( check_equil( QVector< double >*, double* ) ) ); connect( astfem_rsa, SIGNAL( new_time( double ) ), SLOT( set_time( double ) ) ); setWindowTitle( tr( "Equilibrium Time Prediction" ) ); setPalette( US_GuiSettings::frameColor() ); init_simparams(); QBoxLayout* main = new QHBoxLayout( this ); main->setSpacing ( 2 ); main->setContentsMargins ( 2, 2, 2, 2 ); // Left Column QGridLayout* left = new QGridLayout; int row = 0; QLabel* lb_sample = us_banner( tr( "Model Settings" ) ); left->addWidget( lb_sample, row++, 0, 1, 2 ); QGridLayout* buttons1 = new QGridLayout; int b_row = 0; pb_changeModel = us_pushbutton( tr( "Set / Change / Review Model") ); connect ( pb_changeModel, SIGNAL( clicked() ) , SLOT( change_model() ) ); buttons1->addWidget( pb_changeModel, b_row++, 0, 1, 2 ); left->addLayout( buttons1, row, 0, 3, 2 ); row += 3; QPalette p; p.setColor( QPalette::WindowText, Qt::white ); p.setColor( QPalette::Shadow , Qt::white ); QFont font( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize(), QFont::Bold ); // Radius Info QLabel* lb_radius = us_banner( tr( "Radius Settings" ) ); left->addWidget( lb_radius, row++, 0, 1, 2 ); QGroupBox* channelGroupBox = new QGroupBox( tr( "Channel Type" ) ); channelGroupBox->setContentsMargins ( 2, 2, 2, 2 ); channelGroupBox->setPalette( p ); channelGroupBox->setFont ( font ); QRadioButton* rb_inner; QRadioButton* rb_outer; QRadioButton* rb_center; QRadioButton* rb_custom; QGridLayout* rb5 = us_radiobutton( tr( "Inner Channel" ), rb_inner, true ); QGridLayout* rb6 = us_radiobutton( tr( "Outer Channel" ), rb_outer ); QGridLayout* rb7 = us_radiobutton( tr( "Center Channel" ), rb_center ); QGridLayout* rb8 = us_radiobutton( tr( "Custom" ), rb_custom ); // Group the buttons QButtonGroup* channelGroup = new QButtonGroup; channelGroup->addButton( rb_inner , INNER ); channelGroup->addButton( rb_outer , OUTER ); channelGroup->addButton( rb_center, CENTER ); channelGroup->addButton( rb_custom, CUSTOM ); connect( channelGroup, SIGNAL( buttonClicked( int ) ), SLOT ( new_channel ( int ) ) ); current_position = INNER; QGridLayout* channel = new QGridLayout; channel->setContentsMargins ( 2, 2, 2, 2 ); channel->setSpacing( 0 ); channel->addLayout( rb5, 0, 0 ); channel->addLayout( rb6, 0, 1 ); channel->addLayout( rb7, 1, 0 ); channel->addLayout( rb8, 1, 1 ); channelGroupBox->setLayout( channel ); left->addWidget( channelGroupBox, row, 0, 2, 2 ); row += 2; // Top Radius QLabel* lb_top = us_label( tr( "Top Radius:" ) ); left->addWidget( lb_top, row, 0 ); cnt_top = us_counter( 3, 5.8, 7.3, 5.9 ); cnt_top->setSingleStep( 0.01 ); cnt_top->setEnabled ( false ); left->addWidget( cnt_top, row++, 1 ); // Bottom Radius QLabel* lb_bottom = us_label( tr( "Bottom Radius:" ) ); left->addWidget( lb_bottom, row, 0 ); cnt_bottom = us_counter( 3, 5.8, 7.3, 6.2 ); cnt_bottom->setSingleStep ( 0.01 ); cnt_bottom->setEnabled ( false ); left->addWidget( cnt_bottom, row++, 1 ); // Rotorspeed Info QLabel* lb_rotor = us_banner( tr( "Rotorspeed Settings" ) ); left->addWidget( lb_rotor, row++, 0, 1, 2 ); // Speed type buttons QGroupBox* rotor = new QGroupBox( tr( "Speed Type" ) ); rotor->setContentsMargins ( 2, 10, 2, 2 ); rotor->setPalette( p ); rotor->setFont ( font ); QRadioButton* rb_sigma; QRadioButton* rb_rpm; QGridLayout* rb9 = us_radiobutton( "Use Sigma", rb_sigma, true ); QGridLayout* rb10 = us_radiobutton( "Use RPM" , rb_rpm ); speed_type = SIGMA; sigma_start = 1; sigma_stop = 4; rpm_start = 18000; rpm_stop = 36000; speed_count = 5; QButtonGroup* speedGroup = new QButtonGroup; speedGroup->addButton( rb_sigma, SIGMA ); speedGroup->addButton( rb_rpm , RPM ); connect( speedGroup, SIGNAL( buttonClicked( int ) ), SLOT ( update_speeds( int ) ) ); QGridLayout* speedType = new QGridLayout; speedType->setContentsMargins( 2, 2, 2, 2 ); speedType->setSpacing ( 0 ); speedType->addLayout( rb9, 0, 0 ); speedType->addLayout( rb10, 0, 1 ); rotor->setLayout( speedType ); left->addWidget( rotor, row++, 0, 1, 2 ); // Low speed lb_lowspeed = us_label( tr( "Low Speed (sigma):" ) ); left->addWidget( lb_lowspeed, row, 0 ); cnt_lowspeed = us_counter( 3, 0.01, 10.0, sigma_start ); cnt_lowspeed->setSingleStep( 0.01 ); left->addWidget( cnt_lowspeed, row++, 1 ); connect( cnt_lowspeed, SIGNAL( valueChanged( double ) ), SLOT ( new_lowspeed( double ) ) ); // High speed lb_highspeed = us_label( tr( "High Speed (sigma):" ) ); left->addWidget( lb_highspeed, row, 0 ); cnt_highspeed = us_counter( 3, 0.01, 10.0, sigma_stop ); cnt_highspeed->setSingleStep( 0.01 ); left->addWidget( cnt_highspeed, row++, 1 ); connect( cnt_highspeed, SIGNAL( valueChanged ( double ) ), SLOT ( new_highspeed( double ) ) ); // Speed steps QLabel* lb_speedsteps = us_label( tr( "Speed Steps:" ) ); left->addWidget( lb_speedsteps, row, 0 ); cnt_speedsteps = us_counter( 3, 1.0, 100.0, speed_count ); cnt_speedsteps->setSingleStep( 1.0 ); left->addWidget( cnt_speedsteps, row++, 1 ); connect( cnt_speedsteps, SIGNAL( valueChanged ( double ) ), SLOT ( new_speedstep( double ) ) ); // Speed list QLabel* lb_speedlist = us_label( tr( "Current Speed List:" ) ); left->addWidget( lb_speedlist, row, 0 ); te_speedlist = us_textedit(); te_speedlist->setReadOnly( true ); left->addWidget( te_speedlist, row, 1, 3, 1 ); left->setRowStretch ( row + 1, 99 ); row += 3; // Misc Info QLabel* lb_sim2 = us_banner( tr( "Simulation Settings" ) ); left->addWidget( lb_sim2, row++, 0, 1, 2 ); // Tolerance QLabel* lb_tolerance = us_label( tr( "Tolerance:" ) ); left->addWidget( lb_tolerance, row, 0 ); cnt_tolerance = us_counter( 3, 1.0e-5, 0.01, 0.0005 ); cnt_tolerance->setSingleStep( 1.0e-5 ); left->addWidget( cnt_tolerance, row++, 1 ); // Time increment QLabel* lb_time = us_label( tr( "Time Increment (min):" ) ); left->addWidget( lb_time, row, 0 ); cnt_timeIncrement = us_counter( 3, 1.0, 1000.0, 15.0 ); cnt_timeIncrement->setSingleStep( 1.0 ); left->addWidget( cnt_timeIncrement, row++, 1 ); QGridLayout* buttons2 = new QGridLayout; b_row = 0; pb_estimate = us_pushbutton( tr( "Estimate Times" ) ); pb_estimate->setEnabled( false ); connect( pb_estimate, SIGNAL( clicked() ), SLOT( simulate() ) ); buttons2->addWidget( pb_estimate, b_row++, 0, 1, 2 ); QPushButton* pb_help = us_pushbutton( tr( "Help" ) ); connect( pb_help, SIGNAL( clicked() ), SLOT( help() ) ); buttons2->addWidget( pb_help, b_row, 0 ); QPushButton* pb_close = us_pushbutton( tr( "Close" ) ); connect( pb_close, SIGNAL( clicked() ), SLOT( close() ) ); buttons2->addWidget( pb_close, b_row++, 1 ); left->addLayout( buttons2, row, 0, 2, 2 ); main->addLayout( left ); // Right Column // Simulation plot QBoxLayout* right = new QVBoxLayout; QBoxLayout* plot = new US_Plot( equilibrium_plot, tr( "Approach to Equilibrium Simulation" ), tr( "Radius" ), tr( "Concentration" ) ); us_grid( equilibrium_plot ); equilibrium_plot->setMinimumSize( 600, 400 ); equilibrium_plot->setAxisScale( QwtPlot::yLeft , 0.0, 1.5 ); equilibrium_plot->setAxisScale( QwtPlot::xBottom, 5.9, 6.2 ); right->addLayout( plot ); te_info = new US_Editor( 0, true ); QFontMetrics fm( te_info->font() ); te_info->setFixedHeight( fm.height() * 15 ); right->addWidget( te_info ); right->setStretchFactor( plot , 10 ); right->setStretchFactor( te_info, 2 ); main->addLayout( right ); model.components.clear(); update_speeds( speed_type ); }
TempoDialog::TempoDialog(QWidget *parent, RosegardenDocument *doc, bool timeEditable): QDialog(parent), m_doc(doc), m_tempoTime(0) { setModal(true); setWindowTitle(tr("Insert Tempo Change")); setObjectName("MinorDialog"); QWidget* vbox = dynamic_cast<QWidget*>(this); QVBoxLayout *vboxLayout = new QVBoxLayout; vbox->setLayout(vboxLayout); // group box for tempo QGroupBox *frame = new QGroupBox(tr("Tempo"), vbox); frame->setContentsMargins(5, 5, 5, 5); QGridLayout *layout = new QGridLayout; layout->setSpacing(5); vboxLayout->addWidget(frame); // Set tempo layout->addWidget(new QLabel(tr("New tempo:"), frame), 0, 1); m_tempoValueSpinBox = new QDoubleSpinBox(frame); m_tempoValueSpinBox->setDecimals(3); m_tempoValueSpinBox->setMaximum(1000); m_tempoValueSpinBox->setMinimum(1); m_tempoValueSpinBox->setSingleStep(1); m_tempoValueSpinBox->setValue(120); // will set properly below layout->addWidget(m_tempoValueSpinBox, 0, 2); connect(m_tempoValueSpinBox, SIGNAL(valueChanged(double)), SLOT(slotTempoChanged(double))); m_tempoTap= new QPushButton(tr("Tap"), frame); layout->addWidget(m_tempoTap, 0, 3); connect(m_tempoTap, SIGNAL(clicked()), SLOT(slotTapClicked())); m_tempoConstant = new QRadioButton(tr("Tempo is fixed until the following tempo change"), frame); m_tempoRampToNext = new QRadioButton(tr("Tempo ramps to the following tempo"), frame); m_tempoRampToTarget = new QRadioButton(tr("Tempo ramps to:"), frame); // m_tempoTargetCheckBox = new QCheckBox(tr("Ramping to:"), frame); m_tempoTargetSpinBox = new QDoubleSpinBox(frame); m_tempoTargetSpinBox->setDecimals(3); m_tempoTargetSpinBox->setMaximum(1000); m_tempoTargetSpinBox->setMinimum(1); m_tempoTargetSpinBox->setSingleStep(1); m_tempoTargetSpinBox->setValue(120); // layout->addWidget(m_tempoTargetCheckBox, 1, 0, 0+1, 1- 1, AlignRight); // layout->addWidget(m_tempoTargetSpinBox, 1, 2); layout->addWidget(m_tempoConstant, 1, 1, 1, 2); layout->addWidget(m_tempoRampToNext, 2, 1, 1, 2); layout->addWidget(m_tempoRampToTarget, 3, 1); layout->addWidget(m_tempoTargetSpinBox, 3, 2); // connect(m_tempoTargetCheckBox, SIGNAL(clicked()), // SLOT(slotTargetCheckBoxClicked())); connect(m_tempoConstant, SIGNAL(clicked()), SLOT(slotTempoConstantClicked())); connect(m_tempoRampToNext, SIGNAL(clicked()), SLOT(slotTempoRampToNextClicked())); connect(m_tempoRampToTarget, SIGNAL(clicked()), SLOT(slotTempoRampToTargetClicked())); connect(m_tempoTargetSpinBox, SIGNAL(valueChanged(double)), SLOT(slotTargetChanged(double))); m_tempoBeatLabel = new QLabel(frame); layout->addWidget(m_tempoBeatLabel, 0, 4); m_tempoBeat = new QLabel(frame); layout->addWidget(m_tempoBeat, 0, 5); m_tempoBeatsPerMinute = new QLabel(frame); layout->addWidget(m_tempoBeatsPerMinute, 0, 6); frame->setLayout(layout); m_timeEditor = 0; if (timeEditable) { m_timeEditor = new TimeWidget (tr("Time of tempo change"), vbox, &m_doc->getComposition(), 0, true); vboxLayout->addWidget(m_timeEditor); } else { // group box for scope (area) QGroupBox *scopeGroup = new QGroupBox(tr("Scope"), vbox); vboxLayout->addWidget(scopeGroup); QVBoxLayout * scopeBoxLayout = new QVBoxLayout(scopeGroup); scopeBoxLayout->setSpacing(5); scopeBoxLayout->setMargin(5); QVBoxLayout * currentBoxLayout = scopeBoxLayout; QWidget * currentBox = scopeGroup; QLabel *child_15 = new QLabel(tr("The pointer is currently at "), currentBox); currentBoxLayout->addWidget(child_15); m_tempoTimeLabel = new QLabel(currentBox); currentBoxLayout->addWidget(m_tempoTimeLabel); m_tempoBarLabel = new QLabel(currentBox); currentBoxLayout->addWidget(m_tempoBarLabel); QLabel *spare = new QLabel(currentBox); currentBoxLayout->addWidget(spare); currentBox->setLayout(currentBoxLayout); currentBoxLayout->setStretchFactor(spare, 20); m_tempoStatusLabel = new QLabel(scopeGroup); scopeBoxLayout->addWidget(m_tempoStatusLabel); scopeGroup->setLayout(scopeBoxLayout); QWidget * changeWhereBox = scopeGroup; QVBoxLayout * changeWhereBoxLayout = scopeBoxLayout; spare = new QLabel(" ", changeWhereBox); changeWhereBoxLayout->addWidget(spare); QWidget *changeWhereVBox = new QWidget(changeWhereBox); QVBoxLayout *changeWhereVBoxLayout = new QVBoxLayout; changeWhereBoxLayout->addWidget(changeWhereVBox); changeWhereBox->setLayout(changeWhereBoxLayout); changeWhereBoxLayout->setStretchFactor(changeWhereVBox, 20); m_tempoChangeHere = new QRadioButton(tr("Apply this tempo from here onwards"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeHere); m_tempoChangeBefore = new QRadioButton(tr("Replace the last tempo change"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeBefore); m_tempoChangeBeforeAt = new QLabel(changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeBeforeAt); m_tempoChangeBeforeAt->hide(); m_tempoChangeStartOfBar = new QRadioButton(tr("Apply this tempo from the start of this bar"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeStartOfBar); m_tempoChangeGlobal = new QRadioButton(tr("Apply this tempo to the whole composition"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeGlobal); QWidget *optionHBox = new QWidget(changeWhereVBox); changeWhereVBoxLayout->addWidget(optionHBox); changeWhereVBox->setLayout(changeWhereVBoxLayout); QHBoxLayout *optionHBoxLayout = new QHBoxLayout; QLabel *child_6 = new QLabel(" ", optionHBox); optionHBoxLayout->addWidget(child_6); m_defaultBox = new QCheckBox(tr("Also make this the default tempo"), optionHBox); optionHBoxLayout->addWidget(m_defaultBox); spare = new QLabel(optionHBox); optionHBoxLayout->addWidget(spare); optionHBox->setLayout(optionHBoxLayout); optionHBoxLayout->setStretchFactor(spare, 20); connect(m_tempoChangeHere, SIGNAL(clicked()), SLOT(slotActionChanged())); connect(m_tempoChangeBefore, SIGNAL(clicked()), SLOT(slotActionChanged())); connect(m_tempoChangeStartOfBar, SIGNAL(clicked()), SLOT(slotActionChanged())); connect(m_tempoChangeGlobal, SIGNAL(clicked()), SLOT(slotActionChanged())); m_tempoChangeBefore->setChecked(true); // disable initially m_defaultBox->setEnabled(false); } QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help); vboxLayout->addWidget(buttonBox); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(slotHelpRequested())); populateTempo(); }
ControlParameterEditDialog::ControlParameterEditDialog( QWidget *parent, ControlParameter *control, RosegardenDocument *doc): QDialog(parent), m_doc(doc), m_control(control) { m_dialogControl = *control; // copy in the ControlParameter setModal(true); setWindowTitle(tr("Edit Controller")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QWidget *vbox = new QWidget(this); QVBoxLayout *vboxLayout = new QVBoxLayout; metagrid->addWidget(vbox, 0, 0); QGroupBox *frame = new QGroupBox(tr("Controller Properties"), vbox); vboxLayout->addWidget(frame); vbox->setLayout(vboxLayout); frame->setContentsMargins(10, 10, 10, 10); QGridLayout *layout = new QGridLayout(frame); layout->setSpacing(5); layout->addWidget(new QLabel(tr("Name:"), frame), 0, 0); m_nameEdit = new LineEdit(frame); layout->addWidget(m_nameEdit, 0, 1, 1, 2); layout->addWidget(new QLabel(tr("Type:"), frame), 1, 0); m_typeCombo = new QComboBox(frame); // spacing hack will stretch the whole grid layout, so combos don't get // scrunched up: m_typeCombo->setMinimumContentsLength(20); layout->addWidget(m_typeCombo, 1, 1, 1, 2); layout->addWidget(new QLabel(tr("Description:"), frame), 2, 0); m_description = new LineEdit(frame); layout->addWidget(m_description, 2, 1, 1, 2); // hex value alongside decimal value m_hexValue = new QLabel(frame); layout->addWidget(m_hexValue, 3, 1); layout->addWidget(new QLabel(tr("Controller number:"), frame), 3, 0); m_controllerBox = new QSpinBox(frame); layout->addWidget(m_controllerBox, 3, 2); layout->addWidget(new QLabel(tr("Minimum value:"), frame), 4, 0); m_minBox = new QSpinBox(frame); layout->addWidget(m_minBox, 4, 1, 1, 2); layout->addWidget(new QLabel(tr("Maximum value:"), frame), 5, 0); m_maxBox = new QSpinBox(frame); layout->addWidget(m_maxBox, 5, 1, 1, 2); layout->addWidget(new QLabel(tr("Default value:"), frame), 6, 0); m_defaultBox = new QSpinBox(frame); layout->addWidget(m_defaultBox, 6, 1, 1, 2); layout->addWidget(new QLabel(tr("Color:"), frame), 7, 0); m_colourCombo = new QComboBox(frame); layout->addWidget(m_colourCombo, 7, 1, 1, 2); layout->addWidget(new QLabel(tr("Instrument Parameter Box position:"), frame), 8, 0); m_ipbPosition = new QComboBox(frame); layout->addWidget(m_ipbPosition, 8, 1, 1, 2); frame->setLayout(layout); connect(m_nameEdit, SIGNAL(textChanged(const QString&)), SLOT(slotNameChanged(const QString&))); connect(m_typeCombo, SIGNAL(activated(int)), SLOT(slotTypeChanged(int))); connect(m_description, SIGNAL(textChanged(const QString&)), SLOT(slotDescriptionChanged(const QString &))); connect(m_controllerBox, SIGNAL(valueChanged(int)), SLOT(slotControllerChanged(int))); connect(m_minBox, SIGNAL(valueChanged(int)), SLOT(slotMinChanged(int))); connect(m_maxBox, SIGNAL(valueChanged(int)), SLOT(slotMaxChanged(int))); connect(m_defaultBox, SIGNAL(valueChanged(int)), SLOT(slotDefaultChanged(int))); connect(m_colourCombo, SIGNAL(activated(int)), SLOT(slotColourChanged(int))); connect(m_ipbPosition, SIGNAL(activated(int)), SLOT(slotIPBPositionChanged(int))); //m_nameEdit->selectAll(); //m_description->selectAll(); // set limits m_controllerBox->setMinimum(0); m_controllerBox->setMaximum(127); m_minBox->setMinimum(INT_MIN); m_minBox->setMaximum(INT_MAX); m_maxBox->setMinimum(INT_MIN); m_maxBox->setMaximum(INT_MAX); m_defaultBox->setMinimum(INT_MIN); m_defaultBox->setMaximum(INT_MAX); // populate combos m_typeCombo->addItem(strtoqstr(Controller::EventType)); m_typeCombo->addItem(strtoqstr(PitchBend::EventType)); /* m_typeCombo->addItem(strtoqstr(KeyPressure::EventType)); m_typeCombo->addItem(strtoqstr(ChannelPressure::EventType)); */ // Populate colour combo // // ColourMap &colourMap = m_doc->getComposition().getGeneralColourMap(); RCMap::const_iterator it; QPixmap colourPixmap(16, 16); for (it = colourMap.begin(); it != colourMap.end(); ++it) { Colour c = it->second.first; colourPixmap.fill(QColor(c.getRed(), c.getGreen(), c.getBlue())); m_colourCombo->addItem(colourPixmap, strtoqstr(it->second.second)); } // Populate IPB position combo // m_ipbPosition->addItem(tr("<not showing>")); // I couldn't find a constant for the maximum possible controller slots. // This seems to be it. It used to be 32. I upped it to 1024 because the // IPB is in a scrollable widget now, and that seems like a really // comfortable amount of headroom without being totally nuts like MAX_INT for (unsigned int i = 0; i < 1024; i++) m_ipbPosition->addItem(QString("%1").arg(i)); if (m_control->getType() == Controller::EventType) m_typeCombo->setCurrentIndex(0); else if (m_control->getType() == PitchBend::EventType) m_typeCombo->setCurrentIndex(1); /* else if (m_control->getType() == KeyPressure::EventType) m_typeCombo->setCurrentIndex(2); else if (m_control->getType() == ChannelPressure::EventType) m_typeCombo->setCurrentIndex(3); */ populate(); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }