Files
lmms/include/SetupDialog.h
IanCaio 639f3a49a3 Changes the behavior of "solo" so it doesn't mute Automation Tracks (#5547)
* Changes the toggleSolo method

- Changes the toggleSolo method so it doesn't mute automation tracks (keeps their original state)

* Stop restoring Automation Track's mute values

- Since Automation Tracks are not affected by enabling solo on other tracks, there's no need (and it's even counter intuitive) to restore their previous mute value.
- Reduces a line by using "else if".

* Saves two lines merging 2 conditionals in 1

* Adds the new solo behavior as a new LED button

To allow the user choosing between the old solo behavior and the new one, a new LED button was added which will be used to enable the solo keeping the automation tracks states, while the red LED will enable the solo with the current behavior.

Changes to the code:
	- Added a purple LED image that will be used on the new button.
	- Increased the default width of the widget that holds the mute and solo buttons so the third one fits.
	- Changed the positioning of the LEDs on both the standard and compact track modes to accomodate them.
	- Added a new model called m_soloAutomationsModel, which is connected to the new LED button (m_soloAutomationsBtn). This will dictate the behavior of the toggleSolo method.
	- The red LED calls the toggleSolo method as before. The purple LED will change the m_soloAutomationsModel value and toggle the red LED, which will then call toggleSolo. But since the value of m_soloAutomationsModel will be different, the new behavior will be used on the method.

* Revert "Adds the new solo behavior as a new LED button"

This reverts commit fdbc8b2712.

After consulting fellow users and devs about this change to the PR, it was decided that adding a third button for the new solo behavior was not the best approach. This reverts the commit so we go back to just changing the solo behavior. Later an option can be added on LMMS settings to choose between the old and new behaviors.

* Adds an option to use the legacy solo behavior

This commit adds an option on LMMS settings (saved to the config file) to go back to the legacy behavior of the track solo button. The option can be found on Settings>General>"Use solo legacy behavior"

Changes to the code:
	- Since there's a change to the configuration file, an upgrade method was created (upgrade_1_3_0) to add the value to the config XML if it isn't already present (safety check).
	- An attribute is added to the DOM structure of the app configuration under the "app" tag, called "sololegacybehavior", which can be either 0 or 1.
	- Changes were made to include/SetupDialog.h, include/ConfigManager.h and src/core/ConfigManager.cpp to implement this new configuration option.
	- The toggleSolo method was changed to behave according to the value of the "sololegacybehavior" configuration.

* Changes the description of the solo setting

Changes the description of the solo setting on the Setup Dialog from "Use solo legacy behavior" to "Mute automation tracks during solo" since the latter is more descriptive and new users wouldn't be confused about what the legacy behavior was.

* Merges "if"s and "if-else"s where possible

A conditional could be merged by using the "||" logical operator and there was a "if" nested inside an "else" that could be merged into a single "if-else".

Very small code format change (keeping code block curly braces in separate lines).

* Uses default value instead of upgrading ConfigFile

Instead of using an upgrade method on the ConfigManager class to set a value to the sololegacybehavior parameter, we now use a default value on every call to ConfigManager::value that requests it.

* Removes repetitive method call

To make the loop more efficient, a local variable was created to hold the behavior of the solo selected in the setup dialog, instead of calling the ConfigManager::value method repeated times.

Observation:

Since no code was added/removed from ConfigManager.cpp, it was restored to its original state. There's however a TAB character in a blank line on line 145, which was there at the beginning of this PR but removed during it. It was written again in this commit to remove ConfigManager.cpp from the "Files changed" list.

* Saves one line of code and adds a comment
2020-08-01 20:03:23 +02:00

208 lines
5.2 KiB
C++

/*
* SetupDialog.h - dialog for setting up LMMS
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef SETUP_DIALOG_H
#define SETUP_DIALOG_H
#include <QDialog>
#include <QtCore/QMap>
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
#include "LedCheckbox.h"
#include "lmmsconfig.h"
#include "MidiClient.h"
#include "MidiSetupWidget.h"
class QComboBox;
class QLabel;
class QLineEdit;
class QSlider;
class TabBar;
class SetupDialog : public QDialog
{
Q_OBJECT
public:
enum ConfigTabs
{
GeneralSettings,
PerformanceSettings,
AudioSettings,
MidiSettings,
PathsSettings
};
SetupDialog(ConfigTabs tab_to_open = GeneralSettings);
virtual ~SetupDialog();
protected slots:
void accept() override;
private slots:
// General settings widget.
void toggleDisplaydBFS(bool enabled);
void toggleTooltips(bool enabled);
void toggleDisplayWaveform(bool enabled);
void toggleNoteLabels(bool enabled);
void toggleCompactTrackButtons(bool enabled);
void toggleOneInstrumentTrackWindow(bool enabled);
void toggleSideBarOnRight(bool enabled);
void toggleSoloLegacyBehavior(bool enabled);
void toggleMMPZ(bool enabled);
void toggleDisableBackup(bool enabled);
void toggleOpenLastProject(bool enabled);
void setLanguage(int lang);
// Performance settings widget.
void setAutoSaveInterval(int time);
void resetAutoSave();
void toggleAutoSave(bool enabled);
void toggleRunningAutoSave(bool enabled);
void toggleSmoothScroll(bool enabled);
void toggleAnimateAFP(bool enabled);
void toggleSyncVSTPlugins(bool enabled);
void vstEmbedMethodChanged();
void toggleVSTAlwaysOnTop(bool en);
void toggleDisableAutoQuit(bool enabled);
// Audio settings widget.
void audioInterfaceChanged(const QString & driver);
void toggleHQAudioDev(bool enabled);
void setBufferSize(int value);
void resetBufferSize();
// MIDI settings widget.
void midiInterfaceChanged(const QString & driver);
// Paths settings widget.
void openWorkingDir();
void setWorkingDir(const QString & workingDir);
void openVSTDir();
void setVSTDir(const QString & vstDir);
void openLADSPADir();
void setLADSPADir(const QString & ladspaDir);
void openSF2Dir();
void setSF2Dir(const QString & sf2Dir);
void openSF2File();
void setSF2File(const QString & sf2File);
void openGIGDir();
void setGIGDir(const QString & gigDir);
void openThemeDir();
void setThemeDir(const QString & themeDir);
void openBackgroundPicFile();
void setBackgroundPicFile(const QString & backgroundPicFile);
void showRestartWarning();
private:
TabBar * m_tabBar;
// General settings widgets.
bool m_displaydBFS;
bool m_tooltips;
bool m_displayWaveform;
bool m_printNoteLabels;
bool m_compactTrackButtons;
bool m_oneInstrumentTrackWindow;
bool m_sideBarOnRight;
bool m_soloLegacyBehavior;
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
QString m_lang;
QStringList m_languages;
// Performance settings widgets.
int m_saveInterval;
bool m_enableAutoSave;
bool m_enableRunningAutoSave;
QSlider * m_saveIntervalSlider;
QLabel * m_saveIntervalLbl;
LedCheckBox * m_autoSave;
LedCheckBox * m_runningAutoSave;
bool m_smoothScroll;
bool m_animateAFP;
QLabel * m_vstEmbedLbl;
QComboBox* m_vstEmbedComboBox;
QString m_vstEmbedMethod;
LedCheckBox * m_vstAlwaysOnTopCheckBox;
bool m_vstAlwaysOnTop;
bool m_syncVSTPlugins;
bool m_disableAutoQuit;
typedef QMap<QString, AudioDeviceSetupWidget *> AswMap;
typedef QMap<QString, MidiSetupWidget *> MswMap;
typedef QMap<QString, QString> trMap;
// Audio settings widgets.
QComboBox * m_audioInterfaces;
AswMap m_audioIfaceSetupWidgets;
trMap m_audioIfaceNames;
bool m_NaNHandler;
bool m_hqAudioDev;
int m_bufferSize;
QSlider * m_bufferSizeSlider;
QLabel * m_bufferSizeLbl;
// MIDI settings widgets.
QComboBox * m_midiInterfaces;
MswMap m_midiIfaceSetupWidgets;
trMap m_midiIfaceNames;
QComboBox * m_assignableMidiDevices;
// Paths settings widgets.
QString m_workingDir;
QString m_vstDir;
QString m_ladspaDir;
QString m_gigDir;
QString m_sf2Dir;
#ifdef LMMS_HAVE_FLUIDSYNTH
QString m_sf2File;
#endif
QString m_themeDir;
QString m_backgroundPicFile;
QLineEdit * m_workingDirLineEdit;
QLineEdit * m_vstDirLineEdit;
QLineEdit * m_themeDirLineEdit;
QLineEdit * m_ladspaDirLineEdit;
QLineEdit * m_gigDirLineEdit;
QLineEdit * m_sf2DirLineEdit;
#ifdef LMMS_HAVE_FLUIDSYNTH
QLineEdit * m_sf2FileLineEdit;
#endif
QLineEdit * m_backgroundPicFileLineEdit;
QLabel * restartWarningLbl;
};
#endif