mirror of
https://github.com/LMMS/lmms.git
synced 2025-12-23 22:58:33 -05:00
Follow-Up of 7db3fa94a1 .
This was done by setting `CMAKE_C_INCLUDE_WHAT_YOU_USE` and
`CMAKE_CXX_INCLUDE_WHAT_YOU_USE` to (broken down into multiple lines here,
note, all below `FL/x.h` is not required for C):
```
include-what-you-use;
-Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
-Xiwyu;--keep=*/xmmintrin.h;
-Xiwyu;--keep=*/lmmsconfig.h;
-Xiwyu;--keep=*/weak_libjack.h;
-Xiwyu;--keep=*/sys/*;
-Xiwyu;--keep=*/debug.h;
-Xiwyu;--keep=*/SDL/*;
-Xiwyu;--keep=*/alsa/*;
-Xiwyu;--keep=*/FL/x.h;
-Xiwyu;--keep=*/MidiApple.h;
-Xiwyu;--keep=*/MidiWinMM.h;
-Xiwyu;--keep=*/AudioSoundIo.h;
-Xiwyu;--keep=*/OpulenZ/adplug/*;
-Xiwyu;--keep=QPainterPath;
-Xiwyu;--keep=QtTest
```
FAQ:
* Q: Does this speed-up a completely fresh compile?
* A: No, I measured it.
* Q: Does it speed up anything else?
* A: Yes. If you change one header, it can reduce the number of CPP files
that your compiler needs to recompile, or your IDE has to re-scan.
* Q: What other reasons are for this PR?
* A: It's idiomatic to only include headers if you need them. Also, it will
reduce output for those who want to use IWYU for new PRs.
Background:
This is just a remainder PR of what I planned. My original idea was to setup
a CI which warns you of useless includes (but not of all issues that IWYU
complains about). However, I could not see that this was favored on Discord.
A full IWYU CI also has the problem that it (possibly??) needs to compile
with `make -j 1`, which would make CI really slow.
However, for that plan, I had to fix the whole code base to be IWYU
compliant - which it now is.
138 lines
4.1 KiB
C++
138 lines
4.1 KiB
C++
/*
|
|
* MixerChannelView.h
|
|
*
|
|
* Copyright (c) 2024 saker
|
|
*
|
|
* 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_MIXER_CHANNEL_VIEW_H
|
|
#define LMMS_GUI_MIXER_CHANNEL_VIEW_H
|
|
|
|
#include <QWidget>
|
|
|
|
class QGraphicsView;
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class QStackedWidget;
|
|
|
|
namespace lmms {
|
|
class MixerChannel;
|
|
}
|
|
|
|
namespace lmms::gui {
|
|
class AutomatableButton;
|
|
class EffectRackView;
|
|
class Fader;
|
|
class Knob;
|
|
class LcdWidget;
|
|
class MixerView;
|
|
class PeakIndicator;
|
|
class SendButtonIndicator;
|
|
|
|
|
|
class MixerChannelView : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(QBrush backgroundActive READ backgroundActive WRITE setBackgroundActive)
|
|
Q_PROPERTY(QColor strokeOuterActive READ strokeOuterActive WRITE setStrokeOuterActive)
|
|
Q_PROPERTY(QColor strokeOuterInactive READ strokeOuterInactive WRITE setStrokeOuterInactive)
|
|
Q_PROPERTY(QColor strokeInnerActive READ strokeInnerActive WRITE setStrokeInnerActive)
|
|
Q_PROPERTY(QColor strokeInnerInactive READ strokeInnerInactive WRITE setStrokeInnerInactive)
|
|
public:
|
|
MixerChannelView(QWidget* parent, MixerView* mixerView, int channelIndex);
|
|
void paintEvent(QPaintEvent* event) override;
|
|
void contextMenuEvent(QContextMenuEvent*) override;
|
|
void mousePressEvent(QMouseEvent*) override;
|
|
void mouseDoubleClickEvent(QMouseEvent*) override;
|
|
void keyPressEvent(QKeyEvent* ke) override;
|
|
|
|
void reset();
|
|
int channelIndex() const { return m_channelIndex; }
|
|
void setChannelIndex(int index);
|
|
|
|
QBrush backgroundActive() const { return m_backgroundActive; }
|
|
void setBackgroundActive(const QBrush& c) { m_backgroundActive = c; }
|
|
|
|
QColor strokeOuterActive() const { return m_strokeOuterActive; }
|
|
void setStrokeOuterActive(const QColor& c) { m_strokeOuterActive = c; }
|
|
|
|
QColor strokeOuterInactive() const { return m_strokeOuterInactive; }
|
|
void setStrokeOuterInactive(const QColor& c) { m_strokeOuterInactive = c; }
|
|
|
|
QColor strokeInnerActive() const { return m_strokeInnerActive; }
|
|
void setStrokeInnerActive(const QColor& c) { m_strokeInnerActive = c; }
|
|
|
|
QColor strokeInnerInactive() const { return m_strokeInnerInactive; }
|
|
void setStrokeInnerInactive(const QColor& c) { m_strokeInnerInactive = c; }
|
|
|
|
Fader* fader() const { return m_fader; }
|
|
|
|
public slots:
|
|
void renameChannel();
|
|
void resetColor();
|
|
void selectColor();
|
|
void randomizeColor();
|
|
|
|
private slots:
|
|
void renameFinished();
|
|
void removeChannel();
|
|
void removeUnusedChannels();
|
|
void moveChannelLeft();
|
|
void moveChannelRight();
|
|
|
|
private:
|
|
bool confirmRemoval(int index);
|
|
QString elideName(const QString& name);
|
|
MixerChannel* mixerChannel() const;
|
|
auto isMasterChannel() const -> bool { return m_channelIndex == 0; }
|
|
|
|
private:
|
|
SendButtonIndicator* m_sendButton;
|
|
QLabel* m_receiveArrow;
|
|
QStackedWidget* m_receiveArrowOrSendButton;
|
|
int m_receiveArrowStackedIndex = -1;
|
|
int m_sendButtonStackedIndex = -1;
|
|
|
|
Knob* m_sendKnob;
|
|
LcdWidget* m_channelNumberLcd;
|
|
QLineEdit* m_renameLineEdit;
|
|
QGraphicsView* m_renameLineEditView;
|
|
QLabel* m_sendArrow;
|
|
AutomatableButton* m_muteButton;
|
|
AutomatableButton* m_soloButton;
|
|
PeakIndicator* m_peakIndicator = nullptr;
|
|
Fader* m_fader;
|
|
EffectRackView* m_effectRackView;
|
|
MixerView* m_mixerView;
|
|
int m_channelIndex = 0;
|
|
bool m_inRename = false;
|
|
|
|
QBrush m_backgroundActive;
|
|
QColor m_strokeOuterActive;
|
|
QColor m_strokeOuterInactive;
|
|
QColor m_strokeInnerActive;
|
|
QColor m_strokeInnerInactive;
|
|
|
|
friend class MixerView;
|
|
};
|
|
} // namespace lmms::gui
|
|
|
|
#endif // LMMS_GUI_MIXER_CHANNEL_VIEW_H
|