mirror of
https://github.com/LMMS/lmms.git
synced 2026-01-06 05:28:17 -05:00
Make the setup dialog resizable and use widgets that dynamically adjust to the font size set by the user. Current status of the tabs: * General: Done * Performance: Plugins group needs adjustments * Audio: Individual settings dialogs need adjustments * MIDI: Not started yet * Paths: Done The "Autosave" and "Buffer size" tabs have been slightly redesigned so that the revert/reset button is next to the slider. Technical details ------------------ Setting a fixed size has been removed from the setup dialog so that it can be resized. The settings widget (`settings_w`) now has a layout to which the sub dialogs are added. This is done so that the layout sizes are propagated upwards, i.e. all widgets along the chain now have a layout so that size hints are determined correctly. Instances of `TabWidget` are replaced with instances of `QGroupBox`. Each group box has a layout to which its children, e.g. check boxes, are added. These group boxes are then added to the layouts of their parents. Doing so also removes the need to count how many instances have been added and calculations on where to put the children. Instances of `LedCheckBox` are replaced with instances of `QCheckBox`. This is done in the new helper lambda `addCheckBox`. It's very similar to the previously used `addLedCheckBox` but creates a `QCheckBox` instead of a `LedCheckBox`. It returns the created `QCheckBox` as a result. If a layout is provided the created check box is also added to the layout before it is returned. The helper lambda `addPathEntry` has been adjusted to create a `QGroupBox` and to put all its children in a layout. The helper method `labelWidget` has been adjusted to not set the font size of the label. The method `TabBar::addTab` had to be extended with a new default parameter which controls if the added widget is fixed to the size of it's parent or not. In the case of the setup dialog we do not want this. So far the method is only used by the setup dialog and the `LadspaBrowser` class. So once the `LadspaBrowser` has been made resizable the default parameter can be removed again and treated as always being set to false. Add `QCheckBox` to the `style.css` so that it does not get a green font due to the palette magic that's done.
99 lines
2.2 KiB
C++
99 lines
2.2 KiB
C++
/*
|
|
* TabBar.h - class tabBar
|
|
*
|
|
* Copyright (c) 2004-2008 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 LMMS_GUI_TAB_BAR_H
|
|
#define LMMS_GUI_TAB_BAR_H
|
|
|
|
#include <QBoxLayout>
|
|
#include <QMap>
|
|
#include <QWidget>
|
|
|
|
#include "lmms_export.h"
|
|
|
|
|
|
namespace lmms::gui
|
|
{
|
|
|
|
|
|
class TabButton;
|
|
|
|
|
|
class LMMS_EXPORT TabBar : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
TabBar( QWidget * _parent,
|
|
QBoxLayout::Direction _dir = QBoxLayout::LeftToRight );
|
|
~TabBar() override = default;
|
|
|
|
TabButton * addTab( QWidget * _w, const QString & _text,
|
|
int _id, bool _add_stretch = false,
|
|
bool _text_is_tooltip = false,
|
|
// TODO Remove fixWidgetToParentSize once it is used
|
|
// with false everywhere.
|
|
// At the time of writing it is only used in
|
|
// LadspaBrowser with default parameters.
|
|
bool fixWidgetToParentSize = true );
|
|
void removeTab( int _id );
|
|
|
|
inline void setExclusive( bool _on )
|
|
{
|
|
m_exclusive = _on;
|
|
}
|
|
|
|
int activeTab();
|
|
|
|
|
|
public slots:
|
|
void setActiveTab( int _id );
|
|
|
|
|
|
protected:
|
|
bool tabState( int _id );
|
|
void setTabState( int _id, bool _checked );
|
|
bool allHidden();
|
|
|
|
|
|
protected slots:
|
|
void hideAll( int _exception = -1 );
|
|
void tabClicked( int _id );
|
|
|
|
|
|
private:
|
|
QMap<int, QPair<TabButton *, QWidget *> > m_tabs;
|
|
QBoxLayout * m_layout;
|
|
bool m_exclusive;
|
|
|
|
|
|
signals:
|
|
void allWidgetsHidden();
|
|
void widgetShown();
|
|
|
|
} ;
|
|
|
|
|
|
} // namespace lmms::gui
|
|
|
|
#endif // LMMS_GUI_TAB_BAR_H
|