Microtuner UI update (#6206)

* Replace deprecated sprintf() function

* Update microtuner-related UI (add more clues explaining how to use it)

* Simpler wording in the tooltips for "apply" buttons

* Post-merge fix of a forward declaration

* Rename Misc tab to Tuning and transposition; move Microtuner config dialog to Edit menu and make it also available from instrument tab

* Enable word wrap on "MIDI unsupported" label

* Remove forgotten new unnecessary includes

* Rename InstrumentMiscView to InstrumentTuningView in locales
This commit is contained in:
Martin Pavelek
2023-08-31 19:21:26 +02:00
committed by GitHub
parent 8a94fb3681
commit e1d3ecb184
46 changed files with 122 additions and 92 deletions

View File

@@ -61,7 +61,7 @@ SET(LMMS_SRCS
gui/instrument/EnvelopeAndLfoView.cpp
gui/instrument/InstrumentFunctionViews.cpp
gui/instrument/InstrumentMidiIOView.cpp
gui/instrument/InstrumentMiscView.cpp
gui/instrument/InstrumentTuningView.cpp
gui/instrument/InstrumentSoundShapingView.cpp
gui/instrument/InstrumentTrackWindow.cpp
gui/instrument/InstrumentView.cpp

View File

@@ -363,10 +363,12 @@ void MainWindow::finalize()
}
edit_menu->addSeparator();
edit_menu->addAction( embed::getIconPixmap( "setup_general" ),
tr( "Settings" ),
this, SLOT(showSettingsDialog()));
connect( edit_menu, SIGNAL(aboutToShow()), this, SLOT(updateUndoRedoButtons()));
edit_menu->addAction(embed::getIconPixmap("microtuner"), tr("Scales and keymaps"),
this, SLOT(toggleMicrotunerWin()));
edit_menu->addAction(embed::getIconPixmap("setup_general"), tr("Settings"),
this, SLOT(showSettingsDialog()));
connect(edit_menu, SIGNAL(aboutToShow()), this, SLOT(updateUndoRedoButtons()));
m_viewMenu = new QMenu( this );
menuBar()->addMenu( m_viewMenu )->setText( tr( "&View" ) );
@@ -485,10 +487,6 @@ void MainWindow::finalize()
tr("Show/hide project notes") + " (Ctrl+7)", this, SLOT(toggleProjectNotesWin()), m_toolBar);
project_notes_window->setShortcut( Qt::CTRL + Qt::Key_7 );
auto microtuner_window = new ToolButton(embed::getIconPixmap("microtuner"),
tr("Microtuner configuration") + " (Ctrl+8)", this, SLOT(toggleMicrotunerWin()), m_toolBar);
microtuner_window->setShortcut( Qt::CTRL + Qt::Key_8 );
m_toolBarLayout->addWidget( song_editor_window, 1, 1 );
m_toolBarLayout->addWidget( pattern_editor_window, 1, 2 );
m_toolBarLayout->addWidget( piano_roll_window, 1, 3 );
@@ -496,7 +494,6 @@ void MainWindow::finalize()
m_toolBarLayout->addWidget( mixer_window, 1, 5 );
m_toolBarLayout->addWidget( controllers_window, 1, 6 );
m_toolBarLayout->addWidget( project_notes_window, 1, 7 );
m_toolBarLayout->addWidget( microtuner_window, 1, 8 );
m_toolBarLayout->setColumnStretch( 100, 1 );
// setup-dialog opened before?
@@ -1100,10 +1097,6 @@ void MainWindow::updateViewMenu()
tr( "Project Notes" ) + "\tCtrl+7",
this, SLOT(toggleProjectNotesWin())
);
m_viewMenu->addAction(embed::getIconPixmap( "microtuner" ),
tr( "Microtuner" ) + "\tCtrl+8",
this, SLOT(toggleMicrotunerWin())
);
m_viewMenu->addSeparator();

View File

@@ -56,8 +56,8 @@ namespace lmms::gui
MicrotunerConfig::MicrotunerConfig() :
QWidget(),
m_scaleComboModel(nullptr, tr("Selected scale")),
m_keymapComboModel(nullptr, tr("Selected keymap")),
m_scaleComboModel(nullptr, tr("Selected scale slot")),
m_keymapComboModel(nullptr, tr("Selected keymap slot")),
m_firstKeyModel(0, 0, NumKeys - 1, nullptr, tr("First key")),
m_lastKeyModel(NumKeys - 1, 0, NumKeys - 1, nullptr, tr("Last key")),
m_middleKeyModel(DefaultMiddleKey, 0, NumKeys - 1, nullptr, tr("Middle key")),
@@ -75,7 +75,7 @@ MicrotunerConfig::MicrotunerConfig() :
#endif
setWindowIcon(embed::getIconPixmap("microtuner"));
setWindowTitle(tr("Microtuner"));
setWindowTitle(tr("Microtuner Configuration"));
// Organize into 2 main columns: scales and keymaps
auto microtunerLayout = new QGridLayout();
@@ -84,7 +84,7 @@ MicrotunerConfig::MicrotunerConfig() :
// ----------------------------------
// Scale sub-column
//
auto scaleLabel = new QLabel(tr("Scale:"));
auto scaleLabel = new QLabel(tr("Scale slot to edit:"));
microtunerLayout->addWidget(scaleLabel, 0, 0, 1, 2, Qt::AlignBottom);
for (unsigned int i = 0; i < MaxScaleCount; i++)
@@ -102,6 +102,8 @@ MicrotunerConfig::MicrotunerConfig() :
auto loadScaleButton = new QPushButton(tr("Load"));
auto saveScaleButton = new QPushButton(tr("Save"));
loadScaleButton->setToolTip(tr("Load scale definition from a file."));
saveScaleButton->setToolTip(tr("Save scale definition to a file."));
microtunerLayout->addWidget(loadScaleButton, 3, 0, 1, 1);
microtunerLayout->addWidget(saveScaleButton, 3, 1, 1, 1);
connect(loadScaleButton, &QPushButton::clicked, [=] {loadScaleFromFile();});
@@ -112,14 +114,15 @@ MicrotunerConfig::MicrotunerConfig() :
m_scaleTextEdit->setToolTip(tr("Enter intervals on separate lines. Numbers containing a decimal point are treated as cents.\nOther inputs are treated as integer ratios and must be in the form of \'a/b\' or \'a\'.\nUnity (0.0 cents or ratio 1/1) is always present as a hidden first value; do not enter it manually."));
microtunerLayout->addWidget(m_scaleTextEdit, 4, 0, 2, 2);
auto applyScaleButton = new QPushButton(tr("Apply scale"));
auto applyScaleButton = new QPushButton(tr("Apply scale changes"));
applyScaleButton->setToolTip(tr("Verify and apply changes made to the selected scale. To use the scale, select it in the settings of a supported instrument."));
microtunerLayout->addWidget(applyScaleButton, 6, 0, 1, 2);
connect(applyScaleButton, &QPushButton::clicked, [=] {applyScale();});
// ----------------------------------
// Mapping sub-column
//
auto keymapLabel = new QLabel(tr("Keymap:"));
auto keymapLabel = new QLabel(tr("Keymap slot to edit:"));
microtunerLayout->addWidget(keymapLabel, 0, 2, 1, 2, Qt::AlignBottom);
for (unsigned int i = 0; i < MaxKeymapCount; i++)
@@ -137,6 +140,8 @@ MicrotunerConfig::MicrotunerConfig() :
auto loadKeymapButton = new QPushButton(tr("Load"));
auto saveKeymapButton = new QPushButton(tr("Save"));
loadKeymapButton->setToolTip(tr("Load key mapping definition from a file."));
saveKeymapButton->setToolTip(tr("Save key mapping definition to a file."));
microtunerLayout->addWidget(loadKeymapButton, 3, 2, 1, 1);
microtunerLayout->addWidget(saveKeymapButton, 3, 3, 1, 1);
connect(loadKeymapButton, &QPushButton::clicked, [=] {loadKeymapFromFile();});
@@ -181,7 +186,8 @@ MicrotunerConfig::MicrotunerConfig() :
baseFreqSpin->setToolTip(tr("Base note frequency"));
keymapRangeLayout->addWidget(baseFreqSpin, 1, 1, 1, 2);
auto applyKeymapButton = new QPushButton(tr("Apply keymap"));
auto applyKeymapButton = new QPushButton(tr("Apply keymap changes"));
applyKeymapButton->setToolTip(tr("Verify and apply changes made to the selected key mapping. To use the mapping, select it in the settings of a supported instrument."));
microtunerLayout->addWidget(applyKeymapButton, 6, 2, 1, 2);
connect(applyKeymapButton, &QPushButton::clicked, [=] {applyKeymap();});

View File

@@ -49,7 +49,7 @@
#include "InstrumentFunctions.h"
#include "InstrumentFunctionViews.h"
#include "InstrumentMidiIOView.h"
#include "InstrumentMiscView.h"
#include "InstrumentTuningView.h"
#include "InstrumentSoundShapingView.h"
#include "InstrumentTrack.h"
#include "InstrumentTrackView.h"
@@ -255,25 +255,25 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
instrumentFunctionsLayout->addStretch();
// MIDI tab
m_midiView = new InstrumentMidiIOView( m_tabWidget );
m_midiView = new InstrumentMidiIOView(m_tabWidget);
// FX tab
m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget );
m_effectView = new EffectRackView(m_track->m_audioPort.effects(), m_tabWidget);
// MISC tab
m_miscView = new InstrumentMiscView( m_track, m_tabWidget );
// Tuning tab
m_tuningView = new InstrumentTuningView(m_track, m_tabWidget);
m_tabWidget->addTab( m_ssView, tr( "Envelope, filter & LFO" ), "env_lfo_tab", 1 );
m_tabWidget->addTab( instrumentFunctions, tr( "Chord stacking & arpeggio" ), "func_tab", 2 );
m_tabWidget->addTab( m_effectView, tr( "Effects" ), "fx_tab", 3 );
m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi_tab", 4 );
m_tabWidget->addTab( m_miscView, tr( "Miscellaneous" ), "misc_tab", 5 );
m_tabWidget->addTab(m_ssView, tr("Envelope, filter & LFO"), "env_lfo_tab", 1);
m_tabWidget->addTab(instrumentFunctions, tr("Chord stacking & arpeggio"), "func_tab", 2);
m_tabWidget->addTab(m_effectView, tr("Effects"), "fx_tab", 3);
m_tabWidget->addTab(m_midiView, tr("MIDI"), "midi_tab", 4);
m_tabWidget->addTab(m_tuningView, tr("Tuning and transposition"), "tuning_tab", 5);
adjustTabSize(m_ssView);
adjustTabSize(instrumentFunctions);
m_effectView->resize(EffectRackView::DEFAULT_WIDTH, INSTRUMENT_HEIGHT - 4 - 1);
adjustTabSize(m_midiView);
adjustTabSize(m_miscView);
adjustTabSize(m_tuningView);
// setup piano-widget
m_pianoView = new PianoView( this );
@@ -376,12 +376,14 @@ void InstrumentTrackWindow::modelChanged()
if (m_track->instrument() && m_track->instrument()->flags().testFlag(Instrument::Flag::IsMidiBased))
{
m_miscView->microtunerGroupBox()->hide();
m_tuningView->microtunerNotSupportedLabel()->show();
m_tuningView->microtunerGroupBox()->hide();
m_track->m_microtuner.enabledModel()->setValue(false);
}
else
{
m_miscView->microtunerGroupBox()->show();
m_tuningView->microtunerNotSupportedLabel()->hide();
m_tuningView->microtunerGroupBox()->show();
}
m_ssView->setModel( &m_track->m_soundShaping );
@@ -389,11 +391,11 @@ void InstrumentTrackWindow::modelChanged()
m_arpeggioView->setModel( &m_track->m_arpeggio );
m_midiView->setModel( &m_track->m_midiPort );
m_effectView->setModel( m_track->m_audioPort.effects() );
m_miscView->pitchGroupBox()->setModel(&m_track->m_useMasterPitchModel);
m_miscView->microtunerGroupBox()->setModel(m_track->m_microtuner.enabledModel());
m_miscView->scaleCombo()->setModel(m_track->m_microtuner.scaleModel());
m_miscView->keymapCombo()->setModel(m_track->m_microtuner.keymapModel());
m_miscView->rangeImportCheckbox()->setModel(m_track->m_microtuner.keyRangeImportModel());
m_tuningView->pitchGroupBox()->setModel(&m_track->m_useMasterPitchModel);
m_tuningView->microtunerGroupBox()->setModel(m_track->m_microtuner.enabledModel());
m_tuningView->scaleCombo()->setModel(m_track->m_microtuner.scaleModel());
m_tuningView->keymapCombo()->setModel(m_track->m_microtuner.keymapModel());
m_tuningView->rangeImportCheckbox()->setModel(m_track->m_microtuner.keyRangeImportModel());
updateName();
}

View File

@@ -1,8 +1,8 @@
/*
* InstrumentMiscView.cpp - Miscellaneous instrument settings
* InstrumentTuningView.cpp - Instrument settings for tuning and transpositions
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2020 Martin Pavelek <he29.HS/at/gmail.com>
* Copyright (c) 2020-2022 Martin Pavelek <he29.HS/at/gmail.com>
*
* This file is part of LMMS - https://lmms.io
*
@@ -23,24 +23,28 @@
*
*/
#include "InstrumentMiscView.h"
#include "InstrumentTuningView.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QPixmap>
#include <QVBoxLayout>
#include "ComboBox.h"
#include "GroupBox.h"
#include "GuiApplication.h"
#include "gui_templates.h"
#include "InstrumentTrack.h"
#include "LedCheckBox.h"
#include "MainWindow.h"
#include "PixmapButton.h"
namespace lmms::gui
{
InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) :
InstrumentTuningView::InstrumentTuningView(InstrumentTrack *it, QWidget *parent) :
QWidget(parent)
{
auto layout = new QVBoxLayout(this);
@@ -60,6 +64,11 @@ InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) :
masterPitchLayout->addWidget(tlabel);
// Microtuner settings
m_microtunerNotSupportedLabel = new QLabel(tr("Microtuner is not available for MIDI-based instruments."));
m_microtunerNotSupportedLabel->setWordWrap(true);
m_microtunerNotSupportedLabel->hide();
layout->addWidget(m_microtunerNotSupportedLabel);
m_microtunerGroupBox = new GroupBox(tr("MICROTUNER"));
m_microtunerGroupBox->setModel(it->m_microtuner.enabledModel());
layout->addWidget(m_microtunerGroupBox);
@@ -67,8 +76,22 @@ InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) :
auto microtunerLayout = new QVBoxLayout(m_microtunerGroupBox);
microtunerLayout->setContentsMargins(8, 18, 8, 8);
auto scaleEditLayout = new QHBoxLayout();
scaleEditLayout->setContentsMargins(0, 0, 4, 0);
microtunerLayout->addLayout(scaleEditLayout);
auto scaleLabel = new QLabel(tr("Active scale:"));
microtunerLayout->addWidget(scaleLabel);
scaleEditLayout->addWidget(scaleLabel);
QPixmap editPixmap(embed::getIconPixmap("edit_draw_small"));
auto editPixButton = new PixmapButton(this, tr("Edit scales and keymaps"));
editPixButton->setToolTip(tr("Edit scales and keymaps"));
editPixButton->setInactiveGraphic(editPixmap);
editPixButton->setActiveGraphic(editPixmap);
editPixButton->setFixedSize(16, 16);
connect(editPixButton, SIGNAL(clicked()), getGUI()->mainWindow(), SLOT(toggleMicrotunerWin()));
scaleEditLayout->addWidget(editPixButton);
m_scaleCombo = new ComboBox();
m_scaleCombo->setModel(it->m_microtuner.scaleModel());