From b447484d16e5ec212caf5ff5972fa1637a1d55d1 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 21:04:14 -0500 Subject: [PATCH 01/47] Remove extra transparency in send/receive arrows The extra transparency was conflicting with the positioning of the arrows in the layout --- data/themes/default/receive_bg_arrow.png | Bin 277 -> 4824 bytes data/themes/default/send_bg_arrow.png | Bin 279 -> 4810 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/data/themes/default/receive_bg_arrow.png b/data/themes/default/receive_bg_arrow.png index d4961540ad081a9c2a9b55bf28cca0529c6014f7..368a1bf15a9396285b9da153139940539746d6a2 100644 GIT binary patch literal 4824 zcmeHKc~Dd577vTE2-QcS2ug_&tAI&vR+0-*fgp6@t1(_N#L@yoCxkz&V+OV!L&D76ooHAbVRjAC6&ivL_A52 z5iz}7N+9U(zSy-WH`>!?Q}=PwB2MlUyI(rui?4rn>fJl_iQ9?ZX7{~Ac2;FUmNWXT z?smKz&~9*@gK9PucexkghiaxX9PxMOLza_W;?G8wL^nLrpQnm#tO{4g@D%UwaoTKG z791*yu}Ql3`9M7Bs^b1Zn-^JVa!pUaVvfqcy2V^!_84x?Id!jPW@BIO+V>6@&)W*(=Vr7V~apTwL1ee(eb*W~)U*i)dL-<@4z&uiwN^FE7pu48Ijq<=S=?W`r#k z`xW1w*Z3m+m<6v;wm*99x>zgR?m66f+^H$2$+qNX_NJ9(Ju>kFXZwvUBd$Wq7HS^Bpc-pe-8m{=BAwOUI=C?_uioRRbck54TXBX3}ehvNMT&!MK zHMP%UN_|xGDe;8L-LexMwQgR~#i^EAE~2kZE;V)2%dIV+X1=;ea!M`D+x%mH_pEIb zk{>R;_UyCV0R>@3b+ffBXaS)yXosCkZ5-dS&`g;6Y;KOHyER#cC9lCfA>37KU#TM6YSS z_;?wtd!nD8{It2E`4{zpdvUN?`;e9r1AUb8evtrG~ zAVI)|h|9%y>douB`Lh{>M^mh76r=@yeP|-*%C+sSXd+r$D%`Xk-jlGmW&xC61NYQY zUIyT~Z(~~1u2?AF#nf%w{F^{?zr3QLxqDjc7bl;6apTaJY4s`x^-1MxTx`1$c3MO^Z zmWb>w4J3pg5a|}@KfeE3Hc*nZ#l&PYr`G27SM9|7_A|CO-qw&j>pXh7z2}1+-M;Jm z`C;$0?t))T|7~9%nw%fywkyNsI1YL4aqhK`=QrWk9Z!9EZ2vh<>`v#{w(XVB{+7sH zo`vTuni1)gIek*G-}>kOsTzFnIl}Rm*;u4?gPrw+2k$d4xm(z@n^wfOx31{sq!8%LW1Y5YwPmJ*``WhdHr@g4+jB*% zO4pL9f~v$AMXykUVMQSL%-5?CNi2pF#h6U4WVBdx}9HB6=I zbUKQTK~ZUBR2rAdr9yNnolXW8WNnfXNAzT+cBTPh2!oGlB^tRJm#dUS112I?CEz>~ z3FwI<@hQ{-!6>{^JIn&$gQ`c=R2l`MDiqYQE3|k(A^;f<=ucN@MPQ~=mta~|f<}S` zBw|W@=2(cpV1aNH!H|+nu23730_1(<43&)9sS`ADMjKQ@#o{mp0M&x{Xdl_*a_I-M zK8nqtF{U#%5a4bU|0C;>+>OS-N+5vwDoKLDX)vEhGQuU3<`}48r4~n&63hSvz$tQo!-cpQ%Zn~0(@>O2W};Gr zj4-4$GK0>>xKfl$L+Ro%5aAj*s7fSmY*Yp)6hJ{-u0+ZNfnW#+1<^=2WCUY~$zEJ9 zj80>-#dN8c5z4R+u&*$fN1{`p4-#P~ZLi$;c6Ff_(q zh03K#e`RfG9-`0CmIukTz<-iaG}KWMSp3k_&|{q3*h)mAu_<6gGL(WANyJcNoB(S` zC0UIqWf+(q!{s_6m;XsAaM+-?#cU>-CSgHjCdNX@Tq$UCNW!4e#VCu7K|`#LqH9%B zT!&~dUm4&La0SZK$Q5ypaR=Q$jzzZ`Gi(naj7$UP9|)rkCrmZWjFF6esDI$Z$7nES z$bfZ2GBCWrEToPO!(q-qynp9scrX4=7ewN?lTYGzoUU=YK8b-(G9It4ak@T7o-C(OM`%q z^o@3ANllYqJ2>{HI(c^W_||s)bH?DtNr@`&U8*ScYHwlwiHD84f}^$G`3IIHw-rr= a>|?%4OE;&Nbfy7(LU2GBzszq{+W!Ef0va;_ literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^vOsLX!3HE5KYi{3QY^(zo*^7SP{WbZ0pxQQctjQh z)n5l;MkkHg6+l7B64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1ShdAc}; zM6|xWa+mXvfk@lKB|CiF3tIUeimZEKvG+~r!u8^E3!8%ct~P!9tI+aij*WnaR=_sD z%{w);c6o2nT^h6KJo|}l$`^{gjNHJ?CTD!)Pxu94gHJZeYwAU8nJ;sHn5X$o zcV2kp_lM`Zv$p+MKJQGl<(f6#@h@$D?~DsX1sC@_uIDYTtur`Nl?ZelgQu&X%Q~lo FCIC;uXG#D7 diff --git a/data/themes/default/send_bg_arrow.png b/data/themes/default/send_bg_arrow.png index 05a8c7366b4fb0349cc6dfddb68edaef26a77aa0..311505b6850b90a8138c72a8e1e2c8920b383873 100644 GIT binary patch literal 4810 zcmeHKdsGu=77tc2Qgtn^idqjLDyT4dk&p+8fC-PFfhZ^sl{%TsghBEk2@r5m1mqwJ z${SQ%U#Jyu@lh-S6%bI-f)s603s~EV6-AUR0y@DPdS;G4>sl0qO%>WlRc)USi1NgAyh!^2UM zK1PF*Py>z;2!{L5b2nx#w4a{b737|KJ9C!h&F{YQN2dmD-yZsGub?@xCB{3awyiGA zCTV3Y=g^hy>3tuhtx2DCm;Yn-%!~QR;Lolu^rRrYw@d)_nmY0M45 zkayyX(zFM^JhN=+I&QOV^SN}|KUZlVF0Tt9Forl@wI7D~e!qJ2mJ@lHXF^g{Q(HAE zVq&LX7PT%eeeh)W28bQzdy%Z39pkONd^2yrb>Kjg_h4Sm@fRPtJYBmd*8S(~!JOY( z<4Od`yrs4$c+Vvr<)3?$31b>7E>2C#b+xPgm$3P8>!S4?Qj5XR(?6z0*qWbp%izsf zpr_nBZBu_;v87D*xbb}U%&3Be?HTp=@G@~OW#%y@ysz#}U?_BO-`uam(sP_^v!^v< z+^UYNm9rc3J$HsaKA)RoU*EvbN~76U{F*dB<#xOHZqCDvJ5*W4@kg2+S{7$!w8vJQ z_THhI6m-NcWLH%)DX44aezHR;F?sT2*EG@cR``}jl88r`lhkZkkwExV>$(49cguE8 zOA);xwBS7Bj#=y`jC3@!zQ%U7S&7x0*GTJHp}YI>Gq$YAFM~5rC{o}3YQf*9*#ZP=Ht>IWbUo>vWj@(bv1b(zp3zk<3Q;Zw=^eK z$cd9jJ3e*W8l`jV=e6FLUc(Vhia1D=-sTr9@}a+4!Y)`;&@H$|TxWN|C(DZ1m=!p+ zqkYO3DL&evJsZpZU6VFsUqNfF7WX<|3b->+mH2=hRajSWN2nRt;@AGNcIeCt#&6FX zDqns7Wc2FNEJ60(?rs_CTJ(IytEghz3j~5$5-t=<#X{j|?SqOx6qh0Jx+?wqE?>VQ z@_IMt6#aE+;j?4p^x$1&f8uAWif7tV2NP{)h*S3*e;BOkQ=EJH@KH%|Vlj#Mdpw87 zU4GeX_nW1==F&q9Rr~sTxmD5DB<6}W7cOIFl1pFe88(=%SoUNNJe?fBYyidP>oT(w z)Nvhtc6T=)QvCX6FeompQ|9Wr&a_vPo}c}uqcaQV^8 zh26()PHNekU+^ASPqW#6wJ<_N6A9afwe7K`;Tlof9TesT6 zF1~l(wO_5Ktg3Xq(97w%mfprUOK7Rd>HH;NVa+YOpI(>Gb)IBizH?7c`N?NydCoO` zSvCjH+fTu#?V8lL-J>h}gJjjtPL^6#synojF#o{%r{)~afZj|!_5_g584iN z{ms`~o8J&|$p!Q%0}gsopkxgXQ7b91TrEQ>2Bik{DguG;V$i_IR#Z=tp$c3jAit=* zLMGvI0Xcvrp-D7CG!*xW)uMi}KK@ATR)i}jyR5X}8+ZUfiRxjJK^d;n@eBg836}@n zjbbX9WKz*@6_5iZQj$=uMM+EwlR|^s4R{oTywZZi*UB;8I+4c+1Q-d(p?bZBN2Nwb zM^mC5DQc~PO6PL9R2qZIU_d|v(#5FsumMu(78@akF+`{i(c&6Cu2zwZn6OM8sTYvR zV4gJUpHd@{jKQmPBP;+us0LU=rBi5BrII>+g--7t1wcj|`qLFUf6&sY>rkCKQj4JO zQK(A4cszusSRx%mFovYSl^Rn}fV_8%$&oQVO{6y5q$5YDXgI0_pgQ0m{T+Qhj=d%8 z9p8*Irf|kP0?du!zoR`GyGa>nNhCax8i_O-6^jI9qrW`48o}i}(<{dbWin9?7h-Z? zImBczIS|ZYG9iR5mm>(s6qC&u2PIbN^sov+jZgrbf&&~HiZNJp41qWZ<_IyFY#8ET zP7H_%vz<@`%wcSF9E7hH2UQ7&kN3(5B?nM!7RQOslF=b28b*VdG?pBa0skPm45KkI z78jAj921l=4?H)iSU_e_Xm2Iba9EG2wMqeb4X%nbyq)mJm8hQ{Hj+knV$&TNY)40? zBQU@khqnRM>OjF6G3hjl<8a(^gy#VeVNf`@5>}v8jY?s{HKv6Jf&s+B#ySPaCOL?O zC)A>_Uaj?4tHT9kqpu_*LV@#sq9p#5c43CC~;kaolkw~UZ!Gn?E5Oi=9DmVEFu!g6Q zP*|lvLH8Ib*HJnCC#Arp$zi}L9m1SoCdA~TbciFPu^|}9omet13#Jc~G={EIWBO=V zi@GTQkAN#so+hqH%S;(u{;n_4p{OxEfG~&-?oq-VnInWzM*^lAd&X$QeCi)K;hPl3 zH5ssOSO%IG=!Mj=W;ntb@b|C$jO604G(jRw7>%ACwFXf5qnxN~w7r?YR2kJ+ka z2Ms_NEEc)>Teao1oSPQ!I!ms$5N@!jbu z21P%!CV%guJfE|7D#~11W}H&{gvYd}=GG^_zA)P&Y@U773!($3?1yLO0mOe;x*h8` PnkI8EW-qY&5Dq7w`MG9~LoS1njjx zc?aWXzB$JC?=0_PGhhgA3ZCa}+qZ!6%K_!@MSq2zWXfCmCS>^l-N)eR>gTe~DWM4f DG7)b5 From fb948051d71a730349b937b1876ab67238ec12a8 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 22:31:00 -0500 Subject: [PATCH 02/47] Begin reimplementing MixerChannelView MixerChannelView is now a combination of the MixerLine with the previous MixerChannelView --- include/MixerChannelView.h | 94 +++++++++++ src/gui/CMakeLists.txt | 1 + src/gui/widgets/MixerChannelView.cpp | 226 +++++++++++++++++++++++++++ 3 files changed, 321 insertions(+) create mode 100644 include/MixerChannelView.h create mode 100644 src/gui/widgets/MixerChannelView.cpp diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h new file mode 100644 index 00000000000..bb4825a8c3a --- /dev/null +++ b/include/MixerChannelView.h @@ -0,0 +1,94 @@ +/* + * MixerChannelView.h - the mixer channel view + * + * Copyright (c) 2022 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 MIXER_CHANNEL_VIEW_H +#define MIXER_CHANNEL_VIEW_H + +#include "EffectRackView.h" +#include "Fader.h" +#include "Knob.h" +#include "LcdWidget.h" +#include "PixmapButton.h" +#include "SendButtonIndicator.h" + +#include +#include +#include +#include + +namespace lmms::gui +{ + constexpr int MIXER_CHANNEL_WIDTH = 53; + constexpr int MIXER_CHANNEL_INNER_BORDER_SIZE = 3; + constexpr int MIXER_CHANNEL_OUTER_BORDER_SIZE = 1; + + class MixerChannelView : public QWidget + { + Q_OBJECT + public: + enum class SendReceiveState + { + None, Send, Receive + }; + + MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent = nullptr); + void contextMenuEvent(QContextMenuEvent*) override; + void mousePressEvent(QMouseEvent*) override; + void mouseDoubleClickEvent(QMouseEvent*) override; + + int channelIndex() const; + void setChannelIndex(int index); + + SendReceiveState sendReceiveState() const; + void setSendReceiveState(const SendReceiveState& state); + + QSize sizeHint() const override; + bool eventFilter (QObject *dist, QEvent *event) override; + + public slots: + void renameChannel(); + void resetColor(); + void selectColor(); + void randomizeColor(); + + private slots: + void renameFinished(); + void removeChannel(); + void removeUnusedChannels(); + void moveChannelLeft(); + void moveChannelRight(); + + private: + QString elideName(const QString& name); + + private: + MixerView* m_mixerView; + SendReceiveState m_sendReceiveState = SendReceiveState::None; + int m_channelIndex = 0; + bool m_inRename = false; + friend class MixerView; + }; +} // namespace lmms::gui + +#endif \ No newline at end of file diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 1000ba51d1c..07f93d47322 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -108,6 +108,7 @@ SET(LMMS_SRCS gui/widgets/LedCheckBox.cpp gui/widgets/LeftRightNav.cpp gui/widgets/MeterDialog.cpp + gui/widgets/MixerChannelView.cpp gui/widgets/MixerLineLcdSpinBox.cpp gui/widgets/NStateButton.cpp gui/widgets/Oscilloscope.cpp diff --git a/src/gui/widgets/MixerChannelView.cpp b/src/gui/widgets/MixerChannelView.cpp new file mode 100644 index 00000000000..a6c39de806c --- /dev/null +++ b/src/gui/widgets/MixerChannelView.cpp @@ -0,0 +1,226 @@ +/* + * MixerChannelView.h - the mixer channel view + * + * Copyright (c) 2022 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. + * + */ + +#include "CaptionMenu.h" +#include "Mixer.h" +#include "MixerChannelView.h" +#include "MixerView.h" +#include "gui_templates.h" +#include "lmms_math.h" + +#include +#include +#include +#include +#include + +namespace lmms::gui +{ + MixerChannelView::MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent) : + QWidget(parent), + m_mixerView(mixerView), + m_channelIndex(channelIndex) + { + // assert(dynamic_cast(parent) != nullptr); + + auto sendButton = new SendButtonIndicator{nullptr, this, mixerView}; + auto sendKnob = new Knob{knobBright_26, nullptr, tr("Channel send amount")}; + + auto channelNumberLcd = new LcdWidget{2, nullptr}; + channelNumberLcd->setValue(channelIndex); + + auto mixerChannel = Engine::mixer()->mixerChannel(channelIndex); + auto mixerName = mixerChannel->m_name; + setToolTip(mixerName); + + auto renameLineEdit = new QLineEdit{}; + renameLineEdit->setText(mixerName); + renameLineEdit->setFont(pointSizeF(font(), 7.5f)); + renameLineEdit->installEventFilter(this); + + auto renameLineEditScene = new QGraphicsScene{}; + auto renameLineEditView = new QGraphicsView{}; + renameLineEditView->setStyleSheet("border-style: none; background: transparent;"); + renameLineEditView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + renameLineEditView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + renameLineEditView->setAttribute(Qt::WA_TransparentForMouseEvents, true); + renameLineEditView->setScene(renameLineEditScene); + + auto renameLineEditProxy = renameLineEditScene->addWidget(renameLineEdit); + renameLineEditProxy->setRotation(-90); + + auto sendArrow = new QLabel{}; + sendArrow->setPixmap(embed::getIconPixmap("send_bg_arrow")); + sendArrow->setVisible(m_sendReceiveState == SendReceiveState::Send); + + auto receiveArrow = new QLabel{}; + receiveArrow->setPixmap(embed::getIconPixmap("receive_bg_arrow")); + receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::Receive); + + auto muteBtn = new PixmapButton(nullptr, tr("Mute")); + muteBtn->setModel(&mixerChannel->m_muteModel); + muteBtn->setActiveGraphic(embed::getIconPixmap("led_off")); + muteBtn->setInactiveGraphic(embed::getIconPixmap("led_green")); + muteBtn->setCheckable(true); + muteBtn->setToolTip(tr("Mute this channel")); + + auto soloBtn = new PixmapButton(nullptr, tr("Solo")); + soloBtn->setModel(&mixerChannel->m_soloModel); + soloBtn->setActiveGraphic(embed::getIconPixmap("led_red")); + soloBtn->setInactiveGraphic(embed::getIconPixmap("led_off")); + soloBtn->setCheckable(true); + connect(&mixerChannel->m_soloModel, SIGNAL(dataChanged()), mixerView, SLOT(toggledSolo()), Qt::DirectConnection); + soloBtn->setToolTip(tr("Solo this channel")); + + auto fader = new Fader{&mixerChannel->m_volumeModel, tr("Fader %1").arg(channelIndex), nullptr}; + fader->setLevelsDisplayedInDBFS(); + fader->setMinPeak(dbfsToAmp(-42)); + fader->setMaxPeak(dbfsToAmp(9)); + + auto mainLayout = new QVBoxLayout{this}; + mainLayout->addWidget(receiveArrow, 0, Qt::AlignHCenter); + mainLayout->addWidget(sendButton, 0, Qt::AlignHCenter); + mainLayout->addWidget(sendKnob, 0, Qt::AlignHCenter); + mainLayout->addWidget(sendArrow, 0, Qt::AlignHCenter); + mainLayout->addWidget(channelNumberLcd, 0, Qt::AlignHCenter); + mainLayout->addStretch(); + mainLayout->addWidget(renameLineEditView, 0, Qt::AlignHCenter); + mainLayout->addStretch(); + mainLayout->addWidget(soloBtn, 0, Qt::AlignHCenter); + mainLayout->addWidget(muteBtn, 0, Qt::AlignHCenter); + mainLayout->addWidget(fader, 0, Qt::AlignHCenter); + + connect(renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); + connect(&Engine::mixer()->mixerChannel(m_channelIndex)->m_muteModel, SIGNAL(dataChanged()), this, SLOT(update())); + } + + void MixerChannelView::contextMenuEvent(QContextMenuEvent*) + { + QPointer contextMenu = new CaptionMenu( Engine::mixer()->mixerChannel( m_channelIndex )->m_name, this ); + if( m_channelIndex != 0 ) // no move-options in master + { + contextMenu->addAction( tr( "Move &left" ), this, SLOT(moveChannelLeft())); + contextMenu->addAction( tr( "Move &right" ), this, SLOT(moveChannelRight())); + } + contextMenu->addAction( tr( "Rename &channel" ), this, SLOT(renameChannel())); + contextMenu->addSeparator(); + + if( m_channelIndex != 0 ) // no remove-option in master + { + contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "R&emove channel" ), this, SLOT(removeChannel())); + contextMenu->addSeparator(); + } + contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "Remove &unused channels" ), this, SLOT(removeUnusedChannels())); + contextMenu->addSeparator(); + + QMenu colorMenu(tr("Color"), this); + colorMenu.setIcon(embed::getIconPixmap("colorize")); + colorMenu.addAction(tr("Change"), this, SLOT(selectColor())); + colorMenu.addAction(tr("Reset"), this, SLOT(resetColor())); + colorMenu.addAction(tr("Pick random"), this, SLOT(randomizeColor())); + contextMenu->addMenu(&colorMenu); + + contextMenu->exec( QCursor::pos() ); + delete contextMenu; + } + + int MixerChannelView::channelIndex() const + { + return m_channelIndex; + } + + void MixerChannelView::setChannelIndex(int index) + { + m_channelIndex = index; + } + + MixerChannelView::SendReceiveState MixerChannelView::sendReceiveState() const + { + return m_sendReceiveState; + } + + void MixerChannelView::setSendReceiveState(const SendReceiveState& state) + { + m_sendReceiveState = state; + switch (state) + { + case SendReceiveState::Send: + break; + case SendReceiveState::Receive: + break; + } + } + + QSize MixerChannelView::sizeHint() const + { + const auto parentHeight = static_cast(parent())->height(); + return QSize{MIXER_CHANNEL_WIDTH, parentHeight}; + } + + void MixerChannelView::renameChannel() + { + + } + + void MixerChannelView::renameFinished() + { + + } + + void MixerChannelView::resetColor() + { + + } + + void MixerChannelView::selectColor() + { + + } + + void MixerChannelView::randomizeColor() + { + + } + + void MixerChannelView::removeChannel() + { + + } + + void MixerChannelView::removeUnusedChannels() + { + + } + + void MixerChannelView::moveChannelLeft() + { + + } + + void MixerChannelView::moveChannelRight() + { + + } + +} // namespace lmms::gui \ No newline at end of file From 4e5135f5148e976bba5b79a644ccb0d7c81d3039 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 22:41:19 -0500 Subject: [PATCH 03/47] Adjust SendButtonIndicator to use MixerChannelView --- include/SendButtonIndicator.h | 7 +++---- src/gui/SendButtonIndicator.cpp | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index ec4a90db37a..83e0508c37e 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -37,20 +37,19 @@ namespace gui class MixerLine; class MixerView; - +class MixerChannelView; class SendButtonIndicator : public QLabel { public: - SendButtonIndicator( QWidget * _parent, MixerLine * _owner, - MixerView * _mv); + SendButtonIndicator(QWidget * _parent, MixerChannelView * _owner, MixerView * _mv); void mousePressEvent( QMouseEvent * e ) override; void updateLightStatus(); private: - MixerLine * m_parent; + MixerChannelView * m_parent; MixerView * m_mv; static QPixmap * s_qpmOn; static QPixmap * s_qpmOff; diff --git a/src/gui/SendButtonIndicator.cpp b/src/gui/SendButtonIndicator.cpp index cd1996c4564..19bd74d8b9c 100644 --- a/src/gui/SendButtonIndicator.cpp +++ b/src/gui/SendButtonIndicator.cpp @@ -3,6 +3,7 @@ #include "embed.h" #include "Mixer.h" #include "MixerLine.h" +#include "MixerChannelView.h" #include "MixerView.h" namespace lmms::gui @@ -12,8 +13,7 @@ namespace lmms::gui QPixmap * SendButtonIndicator::s_qpmOff = nullptr; QPixmap * SendButtonIndicator::s_qpmOn = nullptr; -SendButtonIndicator:: SendButtonIndicator( QWidget * _parent, MixerLine * _owner, - MixerView * _mv) : +SendButtonIndicator:: SendButtonIndicator(QWidget * _parent, MixerChannelView * _owner, MixerView * _mv) : QLabel( _parent ), m_parent( _owner ), m_mv( _mv ) From 3b71b6aa8948a2ce3225599e51f58ef6210dcdac Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 22:50:22 -0500 Subject: [PATCH 04/47] Remove MixerLine - Move MixerChannelView into src/gui --- src/gui/CMakeLists.txt | 3 +- src/gui/{widgets => }/MixerChannelView.cpp | 0 src/gui/MixerLine.cpp | 465 --------------------- 3 files changed, 1 insertion(+), 467 deletions(-) rename src/gui/{widgets => }/MixerChannelView.cpp (100%) delete mode 100644 src/gui/MixerLine.cpp diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 07f93d47322..e0d4f93040a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -26,7 +26,7 @@ SET(LMMS_SRCS gui/MicrotunerConfig.cpp gui/MidiCCRackView.cpp gui/MidiSetupWidget.cpp - gui/MixerLine.cpp + gui/MixerChannelView.cpp gui/MixerView.cpp gui/ModelView.cpp gui/PeakControllerDialog.cpp @@ -108,7 +108,6 @@ SET(LMMS_SRCS gui/widgets/LedCheckBox.cpp gui/widgets/LeftRightNav.cpp gui/widgets/MeterDialog.cpp - gui/widgets/MixerChannelView.cpp gui/widgets/MixerLineLcdSpinBox.cpp gui/widgets/NStateButton.cpp gui/widgets/Oscilloscope.cpp diff --git a/src/gui/widgets/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp similarity index 100% rename from src/gui/widgets/MixerChannelView.cpp rename to src/gui/MixerChannelView.cpp diff --git a/src/gui/MixerLine.cpp b/src/gui/MixerLine.cpp deleted file mode 100644 index 030ea892ec3..00000000000 --- a/src/gui/MixerLine.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * MixerLine.cpp - Mixer line widget - * - * Copyright (c) 2009 Andrew Kelley - * Copyright (c) 2014 Tobias Doerffel - * - * 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. - * - */ - -#include "MixerLine.h" - -#include - -#include -#include -#include -#include - -#include "CaptionMenu.h" -#include "ColorChooser.h" -#include "embed.h" -#include "Knob.h" -#include "LcdWidget.h" -#include "Mixer.h" -#include "MixerView.h" -#include "gui_templates.h" -#include "GuiApplication.h" -#include "SendButtonIndicator.h" -#include "Song.h" - -namespace lmms::gui -{ - - -bool MixerLine::eventFilter( QObject *dist, QEvent *event ) -{ - // If we are in a rename, capture the enter/return events and handle them - if ( event->type() == QEvent::KeyPress ) - { - auto keyEvent = static_cast(event); - if( keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return ) - { - if( m_inRename ) - { - renameFinished(); - event->accept(); // Stop the event from propagating - return true; - } - } - } - return false; -} - -const int MixerLine::MixerLineHeight = 287; -QPixmap * MixerLine::s_sendBgArrow = nullptr; -QPixmap * MixerLine::s_receiveBgArrow = nullptr; - -MixerLine::MixerLine( QWidget * _parent, MixerView * _mv, int _channelIndex ) : - QWidget( _parent ), - m_mv( _mv ), - m_channelIndex( _channelIndex ), - m_backgroundActive( Qt::SolidPattern ), - m_strokeOuterActive( 0, 0, 0 ), - m_strokeOuterInactive( 0, 0, 0 ), - m_strokeInnerActive( 0, 0, 0 ), - m_strokeInnerInactive( 0, 0, 0 ), - m_inRename( false ) -{ - if( !s_sendBgArrow ) - { - s_sendBgArrow = new QPixmap( embed::getIconPixmap( "send_bg_arrow", 29, 56 ) ); - } - if( !s_receiveBgArrow ) - { - s_receiveBgArrow = new QPixmap( embed::getIconPixmap( "receive_bg_arrow", 29, 56 ) ); - } - - setFixedSize( 33, MixerLineHeight ); - setAttribute( Qt::WA_OpaquePaintEvent, true ); - setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) ); - - // mixer sends knob - m_sendKnob = new Knob( knobBright_26, this, tr( "Channel send amount" ) ); - m_sendKnob->move( 3, 22 ); - m_sendKnob->setVisible( false ); - - // send button indicator - m_sendBtn = new SendButtonIndicator( this, this, m_mv ); - m_sendBtn->move( 2, 2 ); - - // channel number - m_lcd = new LcdWidget( 2, this ); - m_lcd->setValue( m_channelIndex ); - m_lcd->move( 4, 58 ); - m_lcd->setMarginWidth( 1 ); - - QString name = Engine::mixer()->mixerChannel( m_channelIndex )->m_name; - setToolTip( name ); - - m_renameLineEdit = new QLineEdit(); - m_renameLineEdit->setText( name ); - m_renameLineEdit->setFixedWidth( 65 ); - m_renameLineEdit->setFont( pointSizeF( font(), 7.5f ) ); - m_renameLineEdit->setReadOnly( true ); - m_renameLineEdit->installEventFilter( this ); - - auto scene = new QGraphicsScene(); - scene->setSceneRect( 0, 0, 33, MixerLineHeight ); - - m_view = new QGraphicsView( this ); - m_view->setStyleSheet( "border-style: none; background: transparent;" ); - m_view->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - m_view->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - m_view->setAttribute( Qt::WA_TransparentForMouseEvents, true ); - m_view->setScene( scene ); - - QGraphicsProxyWidget * proxyWidget = scene->addWidget( m_renameLineEdit ); - proxyWidget->setRotation( -90 ); - proxyWidget->setPos( 8, 145 ); - - connect( m_renameLineEdit, SIGNAL(editingFinished()), this, SLOT(renameFinished())); - connect( &Engine::mixer()->mixerChannel( m_channelIndex )->m_muteModel, SIGNAL(dataChanged()), this, SLOT(update())); -} - - - - -MixerLine::~MixerLine() -{ - delete m_sendKnob; - delete m_sendBtn; - delete m_lcd; -} - - - - -void MixerLine::setChannelIndex( int index ) -{ - m_channelIndex = index; - m_lcd->setValue( m_channelIndex ); - m_lcd->update(); -} - - - -void MixerLine::drawMixerLine( QPainter* p, const MixerLine *mixerLine, bool isActive, bool sendToThis, bool receiveFromThis ) -{ - auto channel = Engine::mixer()->mixerChannel( m_channelIndex ); - bool muted = channel->m_muteModel.value(); - QString name = channel->m_name; - QString elidedName = elideName( name ); - if( !m_inRename && m_renameLineEdit->text() != elidedName ) - { - m_renameLineEdit->setText( elidedName ); - } - - int width = mixerLine->rect().width(); - int height = mixerLine->rect().height(); - - if( channel->m_hasColor && !muted ) - { - p->fillRect( mixerLine->rect(), channel->m_color.darker( isActive ? 120 : 150 ) ); - } - else - { - p->fillRect( mixerLine->rect(), - isActive ? mixerLine->backgroundActive().color() : p->background().color() ); - } - - // inner border - p->setPen( isActive ? mixerLine->strokeInnerActive() : mixerLine->strokeInnerInactive() ); - p->drawRect( 1, 1, width-3, height-3 ); - - // outer border - p->setPen( isActive ? mixerLine->strokeOuterActive() : mixerLine->strokeOuterInactive() ); - p->drawRect( 0, 0, width-1, height-1 ); - - // draw the mixer send background - if( sendToThis ) - { - p->drawPixmap( 2, 0, 29, 56, *s_sendBgArrow ); - } - else if( receiveFromThis ) - { - p->drawPixmap( 2, 0, 29, 56, *s_receiveBgArrow ); - } -} - - - - -QString MixerLine::elideName( const QString & name ) -{ - const int maxTextHeight = 60; - QFontMetrics metrics( m_renameLineEdit->font() ); - QString elidedName = metrics.elidedText( name, Qt::ElideRight, maxTextHeight ); - return elidedName; -} - - - - -void MixerLine::paintEvent( QPaintEvent * ) -{ - bool sendToThis = Engine::mixer()->channelSendModel( m_mv->currentMixerLine()->m_channelIndex, m_channelIndex ) != nullptr; - bool receiveFromThis = Engine::mixer()->channelSendModel( m_channelIndex, m_mv->currentMixerLine()->m_channelIndex ) != nullptr; - QPainter painter; - painter.begin( this ); - drawMixerLine( &painter, this, m_mv->currentMixerLine() == this, sendToThis, receiveFromThis ); - painter.end(); -} - - - - -void MixerLine::mousePressEvent( QMouseEvent * ) -{ - m_mv->setCurrentMixerLine( this ); -} - - - - -void MixerLine::mouseDoubleClickEvent( QMouseEvent * ) -{ - renameChannel(); -} - - - - -void MixerLine::contextMenuEvent( QContextMenuEvent * ) -{ - QPointer contextMenu = new CaptionMenu( Engine::mixer()->mixerChannel( m_channelIndex )->m_name, this ); - if( m_channelIndex != 0 ) // no move-options in master - { - contextMenu->addAction( tr( "Move &left" ), this, SLOT(moveChannelLeft())); - contextMenu->addAction( tr( "Move &right" ), this, SLOT(moveChannelRight())); - } - contextMenu->addAction( tr( "Rename &channel" ), this, SLOT(renameChannel())); - contextMenu->addSeparator(); - - if( m_channelIndex != 0 ) // no remove-option in master - { - contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "R&emove channel" ), this, SLOT(removeChannel())); - contextMenu->addSeparator(); - } - contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "Remove &unused channels" ), this, SLOT(removeUnusedChannels())); - contextMenu->addSeparator(); - - QMenu colorMenu(tr("Color"), this); - colorMenu.setIcon(embed::getIconPixmap("colorize")); - colorMenu.addAction(tr("Change"), this, SLOT(selectColor())); - colorMenu.addAction(tr("Reset"), this, SLOT(resetColor())); - colorMenu.addAction(tr("Pick random"), this, SLOT(randomizeColor())); - contextMenu->addMenu(&colorMenu); - - contextMenu->exec( QCursor::pos() ); - delete contextMenu; -} - - - - -void MixerLine::renameChannel() -{ - m_inRename = true; - setToolTip( "" ); - m_renameLineEdit->setReadOnly( false ); - m_lcd->hide(); - m_renameLineEdit->setFixedWidth( 135 ); - m_renameLineEdit->setText( Engine::mixer()->mixerChannel( m_channelIndex )->m_name ); - m_view->setFocus(); - m_renameLineEdit->selectAll(); - m_renameLineEdit->setFocus(); -} - - - - -void MixerLine::renameFinished() -{ - m_inRename = false; - m_renameLineEdit->deselect(); - m_renameLineEdit->setReadOnly( true ); - m_renameLineEdit->setFixedWidth( 65 ); - m_lcd->show(); - QString newName = m_renameLineEdit->text(); - setFocus(); - if( !newName.isEmpty() && Engine::mixer()->mixerChannel( m_channelIndex )->m_name != newName ) - { - Engine::mixer()->mixerChannel( m_channelIndex )->m_name = newName; - m_renameLineEdit->setText( elideName( newName ) ); - Engine::getSong()->setModified(); - } - QString name = Engine::mixer()->mixerChannel( m_channelIndex )->m_name; - setToolTip( name ); -} - - - - -void MixerLine::removeChannel() -{ - MixerView * mix = getGUI()->mixerView(); - mix->deleteChannel( m_channelIndex ); -} - - - - -void MixerLine::removeUnusedChannels() -{ - MixerView * mix = getGUI()->mixerView(); - mix->deleteUnusedChannels(); -} - - - - -void MixerLine::moveChannelLeft() -{ - MixerView * mix = getGUI()->mixerView(); - mix->moveChannelLeft( m_channelIndex ); -} - - - - -void MixerLine::moveChannelRight() -{ - MixerView * mix = getGUI()->mixerView(); - mix->moveChannelRight( m_channelIndex ); -} - - - - -QBrush MixerLine::backgroundActive() const -{ - return m_backgroundActive; -} - - - - -void MixerLine::setBackgroundActive( const QBrush & c ) -{ - m_backgroundActive = c; -} - - - - -QColor MixerLine::strokeOuterActive() const -{ - return m_strokeOuterActive; -} - - - - -void MixerLine::setStrokeOuterActive( const QColor & c ) -{ - m_strokeOuterActive = c; -} - - - - -QColor MixerLine::strokeOuterInactive() const -{ - return m_strokeOuterInactive; -} - - - - -void MixerLine::setStrokeOuterInactive( const QColor & c ) -{ - m_strokeOuterInactive = c; -} - - - - -QColor MixerLine::strokeInnerActive() const -{ - return m_strokeInnerActive; -} - - - - -void MixerLine::setStrokeInnerActive( const QColor & c ) -{ - m_strokeInnerActive = c; -} - - - - -QColor MixerLine::strokeInnerInactive() const -{ - return m_strokeInnerInactive; -} - - - - -void MixerLine::setStrokeInnerInactive( const QColor & c ) -{ - m_strokeInnerInactive = c; -} - - -// Ask user for a color, and set it as the mixer line color -void MixerLine::selectColor() -{ - auto channel = Engine::mixer()->mixerChannel( m_channelIndex ); - auto new_color = ColorChooser(this).withPalette(ColorChooser::Palette::Mixer)->getColor(channel->m_color); - if(!new_color.isValid()) { return; } - channel->setColor (new_color); - Engine::getSong()->setModified(); - update(); -} - - -// Disable the usage of color on this mixer line -void MixerLine::resetColor() -{ - Engine::mixer()->mixerChannel( m_channelIndex )->m_hasColor = false; - Engine::getSong()->setModified(); - update(); -} - - -// Pick a random color from the mixer palette and set it as our color -void MixerLine::randomizeColor() -{ - auto channel = Engine::mixer()->mixerChannel( m_channelIndex ); - channel->setColor (ColorChooser::getPalette(ColorChooser::Palette::Mixer)[rand() % 48]); - Engine::getSong()->setModified(); - update(); -} - - -} // namespace lmms::gui From e5b81d2a2520c74d9645f8513ebddc2b7d26f322 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 22:52:47 -0500 Subject: [PATCH 05/47] Remove MixerView::MixerChannelView --- include/MixerView.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/include/MixerView.h b/include/MixerView.h index a7b1b51919d..ef480408415 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -50,21 +50,6 @@ class LMMS_EXPORT MixerView : public QWidget, public ModelView, { Q_OBJECT public: - class MixerChannelView - { - public: - MixerChannelView(QWidget * _parent, MixerView * _mv, int _chIndex ); - - void setChannelIndex( int index ); - - MixerLine * m_mixerLine; - PixmapButton * m_muteBtn; - PixmapButton * m_soloBtn; - Fader * m_fader; - EffectRackView * m_rackView; - }; - - MixerView(); ~MixerView() override; From 6511771edf5b3dc10bedbcbfb2394b8072a53662 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 22:56:21 -0500 Subject: [PATCH 06/47] Remove header of MixerLine --- include/MixerLine.h | 120 -------------------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 include/MixerLine.h diff --git a/include/MixerLine.h b/include/MixerLine.h deleted file mode 100644 index decd5f3aa0c..00000000000 --- a/include/MixerLine.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * MixerLine.h - Mixer line widget - * - * Copyright (c) 2009 Andrew Kelley - * Copyright (c) 2014 Tobias Doerffel - * - * 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 MIXERLINE_H -#define MIXERLINE_H - -#include - -class QGraphicsView; -class QLineEdit; - -namespace lmms::gui -{ - - -class Knob; -class LcdWidget; -class MixerView; -class SendButtonIndicator; - -class MixerLine : public QWidget -{ - Q_OBJECT -public: - 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 ) - MixerLine( QWidget * _parent, MixerView * _mv, int _channelIndex); - ~MixerLine() override; - - void paintEvent( QPaintEvent * ) override; - void mousePressEvent( QMouseEvent * ) override; - void mouseDoubleClickEvent( QMouseEvent * ) override; - void contextMenuEvent( QContextMenuEvent * ) override; - - inline int channelIndex() { return m_channelIndex; } - void setChannelIndex(int index); - - Knob * m_sendKnob; - SendButtonIndicator * m_sendBtn; - - QBrush backgroundActive() const; - void setBackgroundActive( const QBrush & c ); - - QColor strokeOuterActive() const; - void setStrokeOuterActive( const QColor & c ); - - QColor strokeOuterInactive() const; - void setStrokeOuterInactive( const QColor & c ); - - QColor strokeInnerActive() const; - void setStrokeInnerActive( const QColor & c ); - - QColor strokeInnerInactive() const; - void setStrokeInnerInactive( const QColor & c ); - - static const int MixerLineHeight; - - bool eventFilter (QObject *dist, QEvent *event) override; - -private: - void drawMixerLine( QPainter* p, const MixerLine *mixerLine, bool isActive, bool sendToThis, bool receiveFromThis ); - QString elideName( const QString & name ); - - MixerView * m_mv; - LcdWidget* m_lcd; - int m_channelIndex; - QBrush m_backgroundActive; - QColor m_strokeOuterActive; - QColor m_strokeOuterInactive; - QColor m_strokeInnerActive; - QColor m_strokeInnerInactive; - static QPixmap * s_sendBgArrow; - static QPixmap * s_receiveBgArrow; - bool m_inRename; - QLineEdit * m_renameLineEdit; - QGraphicsView * m_view; - -public slots: - void renameChannel(); - void resetColor(); - void selectColor(); - void randomizeColor(); - -private slots: - void renameFinished(); - void removeChannel(); - void removeUnusedChannels(); - void moveChannelLeft(); - void moveChannelRight(); -}; - - -} // namespace lmms::gui - -#endif // MIXERLINE_H From 28c8ab277fc1d7871da2d978a59270b627f74411 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:12:27 -0500 Subject: [PATCH 07/47] Change MixerView.h to use MixerChannelView Change MixerView.h to use MixerChannelView rather than MixerLine Also do some cleanup, such as removing an unused forward declaration of QButtonGroup --- include/MixerView.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/include/MixerView.h b/include/MixerView.h index ef480408415..a12fe514d69 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -37,14 +37,8 @@ #include "embed.h" #include "EffectRackView.h" -class QButtonGroup; - - namespace lmms::gui { - -class MixerLine; - class LMMS_EXPORT MixerView : public QWidget, public ModelView, public SerializingObjectHook { @@ -58,9 +52,9 @@ class LMMS_EXPORT MixerView : public QWidget, public ModelView, void saveSettings( QDomDocument & _doc, QDomElement & _this ) override; void loadSettings( const QDomElement & _this ) override; - inline MixerLine * currentMixerLine() + inline MixerChannelView* currentMixerChannel() { - return m_currentMixerLine; + return m_currentMixerChannel; } inline MixerChannelView * channelView(int index) @@ -69,14 +63,14 @@ class LMMS_EXPORT MixerView : public QWidget, public ModelView, } - void setCurrentMixerLine( MixerLine * _line ); - void setCurrentMixerLine( int _line ); + void setCurrentMixerChannel(MixerChannelView* channel); + void setCurrentMixerChannel(int channel); void clear(); // display the send button and knob correctly - void updateMixerLine(int index); + void updateMixerChannel(int index); // notify the view that a mixer channel was deleted void deleteChannel(int index); @@ -108,7 +102,7 @@ private slots: private: QVector m_mixerChannelViews; - MixerLine * m_currentMixerLine; + MixerChannelView* m_currentMixerChannel; QScrollArea * channelArea; QHBoxLayout * chLayout; From 48a5d4d8a64f2cfe17cb8e4f2fe8024bcc698c21 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:17:16 -0500 Subject: [PATCH 08/47] Create EffectRackView + Set height of sizeHint() using MIXER_CHANNEL_HEIGHT (287) --- include/MixerChannelView.h | 2 ++ src/gui/MixerChannelView.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index bb4825a8c3a..7d5bf63fa54 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -40,6 +40,7 @@ namespace lmms::gui { constexpr int MIXER_CHANNEL_WIDTH = 53; + constexpr int MIXER_CHANNEL_HEIGHT = 287; constexpr int MIXER_CHANNEL_INNER_BORDER_SIZE = 3; constexpr int MIXER_CHANNEL_OUTER_BORDER_SIZE = 1; @@ -84,6 +85,7 @@ namespace lmms::gui private: MixerView* m_mixerView; + EffectRackView* m_effectRackView; SendReceiveState m_sendReceiveState = SendReceiveState::None; int m_channelIndex = 0; bool m_inRename = false; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index a6c39de806c..8be3d29bffc 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -97,6 +97,9 @@ namespace lmms::gui fader->setLevelsDisplayedInDBFS(); fader->setMinPeak(dbfsToAmp(-42)); fader->setMaxPeak(dbfsToAmp(9)); + + m_effectRackView = new EffectRackView{&mixerChannel->m_fxChain, mixerView->m_racksWidget}; + m_effectRackView->setFixedSize(EffectRackView::DEFAULT_WIDTH, MIXER_CHANNEL_HEIGHT); auto mainLayout = new QVBoxLayout{this}; mainLayout->addWidget(receiveArrow, 0, Qt::AlignHCenter); @@ -174,8 +177,7 @@ namespace lmms::gui QSize MixerChannelView::sizeHint() const { - const auto parentHeight = static_cast(parent())->height(); - return QSize{MIXER_CHANNEL_WIDTH, parentHeight}; + return QSize{MIXER_CHANNEL_WIDTH, MIXER_CHANNEL_HEIGHT}; } void MixerChannelView::renameChannel() From 4ba600fdb9e9ba038d49346163cb56ce0a043121 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:21:02 -0500 Subject: [PATCH 09/47] Remove include of MixerLine - Include MixerChannelView --- src/gui/MixerView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 62d4cb7ce05..ce5895ddba1 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -31,9 +31,9 @@ #include "lmms_math.h" +#include "MixerChannelView.h" #include "MixerView.h" #include "Knob.h" -#include "MixerLine.h" #include "Mixer.h" #include "GuiApplication.h" #include "MainWindow.h" @@ -90,7 +90,7 @@ MixerView::MixerView() : // add master channel m_mixerChannelViews.resize( m->numChannels() ); - m_mixerChannelViews[0] = new MixerChannelView( this, this, 0 ); + m_mixerChannelViews[0] = new MixerChannelView(0, this, this); m_racksLayout->addWidget( m_mixerChannelViews[0]->m_rackView ); From 19082316fc0f5ea964e235135a1fa76409c0a1c2 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:28:31 -0500 Subject: [PATCH 10/47] Phase 1: Adjust MixerView to use new MixerChannelView --- src/gui/MixerView.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index ce5895ddba1..a3ae7ad8a40 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -92,18 +92,18 @@ MixerView::MixerView() : m_mixerChannelViews.resize( m->numChannels() ); m_mixerChannelViews[0] = new MixerChannelView(0, this, this); - m_racksLayout->addWidget( m_mixerChannelViews[0]->m_rackView ); + m_racksLayout->addWidget(m_mixerChannelViews[0]->m_effectRackView); MixerChannelView * masterView = m_mixerChannelViews[0]; - ml->addWidget( masterView->m_mixerLine, 0, Qt::AlignTop ); + ml->addWidget(masterView, 0, Qt::AlignTop); - QSize mixerLineSize = masterView->m_mixerLine->size(); + QSize mixerChannelSize = masterView->size(); // add mixer channels for( int i = 1; i < m_mixerChannelViews.size(); ++i ) { - m_mixerChannelViews[i] = new MixerChannelView(m_channelAreaWidget, this, i); - chLayout->addWidget( m_mixerChannelViews[i]->m_mixerLine ); + m_mixerChannelViews[i] = new MixerChannelView(i, this, m_channelAreaWidget); + chLayout->addWidget(m_mixerChannelViews[i]); } // add the scrolling section to the main layout @@ -125,15 +125,15 @@ MixerView::MixerView() : channelArea->setWidget( m_channelAreaWidget ); channelArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); channelArea->setFrameStyle( QFrame::NoFrame ); - channelArea->setMinimumWidth( mixerLineSize.width() * 6 ); - channelArea->setFixedHeight( mixerLineSize.height() + + channelArea->setMinimumWidth(mixerChannelSize.width() * 6); + channelArea->setFixedHeight(mixerChannelSize.height() + style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); ml->addWidget( channelArea, 1, Qt::AlignTop ); // show the add new mixer channel button auto newChannelBtn = new QPushButton(embed::getIconPixmap("new_channel"), QString(), this); newChannelBtn->setObjectName( "newChannelBtn" ); - newChannelBtn->setFixedSize( mixerLineSize ); + newChannelBtn->setFixedSize( mixerChannelSize ); connect( newChannelBtn, SIGNAL(clicked()), this, SLOT(addNewChannel())); ml->addWidget( newChannelBtn, 0, Qt::AlignTop ); @@ -141,7 +141,7 @@ MixerView::MixerView() : // add the stacked layout for the effect racks of mixer channels ml->addWidget( m_racksWidget, 0, Qt::AlignTop | Qt::AlignRight ); - setCurrentMixerLine( m_mixerChannelViews[0]->m_mixerLine ); + setCurrentMixerChannel(m_mixerChannelViews[0]); setLayout( ml ); updateGeometry(); From dcfb14c986b2a83312fe0d70496831ae2f78f5db Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:36:48 -0500 Subject: [PATCH 11/47] Move children wigets into header file --- include/MixerChannelView.h | 11 ++++- src/gui/MixerChannelView.cpp | 86 ++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 44 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index 7d5bf63fa54..ff20a1cda9e 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -84,8 +84,17 @@ namespace lmms::gui QString elideName(const QString& name); private: - MixerView* m_mixerView; + SendButtonIndicator* m_sendButton; + Knob* m_sendKnob; + LcdWidget* m_channelNumberLcd; + QLineEdit* m_renameLineEdit; + QLabel* m_sendArrow; + QLabel* m_receiveArrow; + PixmapButton* m_muteButton; + PixmapButton* m_soloButton; + Fader* m_fader; EffectRackView* m_effectRackView; + MixerView* m_mixerView; SendReceiveState m_sendReceiveState = SendReceiveState::None; int m_channelIndex = 0; bool m_inRename = false; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 8be3d29bffc..ae18360b809 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -44,20 +44,20 @@ namespace lmms::gui { // assert(dynamic_cast(parent) != nullptr); - auto sendButton = new SendButtonIndicator{nullptr, this, mixerView}; - auto sendKnob = new Knob{knobBright_26, nullptr, tr("Channel send amount")}; + m_sendButton = new SendButtonIndicator{nullptr, this, mixerView}; + m_sendKnob = new Knob{knobBright_26, nullptr, tr("Channel send amount")}; - auto channelNumberLcd = new LcdWidget{2, nullptr}; - channelNumberLcd->setValue(channelIndex); + m_channelNumberLcd = new LcdWidget{2, nullptr}; + m_channelNumberLcd->setValue(channelIndex); auto mixerChannel = Engine::mixer()->mixerChannel(channelIndex); auto mixerName = mixerChannel->m_name; setToolTip(mixerName); - auto renameLineEdit = new QLineEdit{}; - renameLineEdit->setText(mixerName); - renameLineEdit->setFont(pointSizeF(font(), 7.5f)); - renameLineEdit->installEventFilter(this); + m_renameLineEdit = new QLineEdit{}; + m_renameLineEdit->setText(mixerName); + m_renameLineEdit->setFont(pointSizeF(font(), 7.5f)); + m_renameLineEdit->installEventFilter(this); auto renameLineEditScene = new QGraphicsScene{}; auto renameLineEditView = new QGraphicsView{}; @@ -67,54 +67,54 @@ namespace lmms::gui renameLineEditView->setAttribute(Qt::WA_TransparentForMouseEvents, true); renameLineEditView->setScene(renameLineEditScene); - auto renameLineEditProxy = renameLineEditScene->addWidget(renameLineEdit); + auto renameLineEditProxy = renameLineEditScene->addWidget(m_renameLineEdit); renameLineEditProxy->setRotation(-90); - auto sendArrow = new QLabel{}; - sendArrow->setPixmap(embed::getIconPixmap("send_bg_arrow")); - sendArrow->setVisible(m_sendReceiveState == SendReceiveState::Send); - - auto receiveArrow = new QLabel{}; - receiveArrow->setPixmap(embed::getIconPixmap("receive_bg_arrow")); - receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::Receive); - - auto muteBtn = new PixmapButton(nullptr, tr("Mute")); - muteBtn->setModel(&mixerChannel->m_muteModel); - muteBtn->setActiveGraphic(embed::getIconPixmap("led_off")); - muteBtn->setInactiveGraphic(embed::getIconPixmap("led_green")); - muteBtn->setCheckable(true); - muteBtn->setToolTip(tr("Mute this channel")); - - auto soloBtn = new PixmapButton(nullptr, tr("Solo")); - soloBtn->setModel(&mixerChannel->m_soloModel); - soloBtn->setActiveGraphic(embed::getIconPixmap("led_red")); - soloBtn->setInactiveGraphic(embed::getIconPixmap("led_off")); - soloBtn->setCheckable(true); + m_sendArrow = new QLabel{}; + m_sendArrow->setPixmap(embed::getIconPixmap("send_bg_arrow")); + m_sendArrow->setVisible(m_sendReceiveState == SendReceiveState::Send); + + m_receiveArrow = new QLabel{}; + m_receiveArrow->setPixmap(embed::getIconPixmap("receive_bg_arrow")); + m_receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::Receive); + + m_muteButton = new PixmapButton(nullptr, tr("Mute")); + m_muteButton->setModel(&mixerChannel->m_muteModel); + m_muteButton->setActiveGraphic(embed::getIconPixmap("led_off")); + m_muteButton->setInactiveGraphic(embed::getIconPixmap("led_green")); + m_muteButton->setCheckable(true); + m_muteButton->setToolTip(tr("Mute this channel")); + + m_soloButton = new PixmapButton(nullptr, tr("Solo")); + m_soloButton->setModel(&mixerChannel->m_soloModel); + m_soloButton->setActiveGraphic(embed::getIconPixmap("led_red")); + m_soloButton->setInactiveGraphic(embed::getIconPixmap("led_off")); + m_soloButton->setCheckable(true); + m_soloButton->setToolTip(tr("Solo this channel")); connect(&mixerChannel->m_soloModel, SIGNAL(dataChanged()), mixerView, SLOT(toggledSolo()), Qt::DirectConnection); - soloBtn->setToolTip(tr("Solo this channel")); - auto fader = new Fader{&mixerChannel->m_volumeModel, tr("Fader %1").arg(channelIndex), nullptr}; - fader->setLevelsDisplayedInDBFS(); - fader->setMinPeak(dbfsToAmp(-42)); - fader->setMaxPeak(dbfsToAmp(9)); + m_fader = new Fader{&mixerChannel->m_volumeModel, tr("Fader %1").arg(channelIndex), nullptr}; + m_fader->setLevelsDisplayedInDBFS(); + m_fader->setMinPeak(dbfsToAmp(-42)); + m_fader->setMaxPeak(dbfsToAmp(9)); m_effectRackView = new EffectRackView{&mixerChannel->m_fxChain, mixerView->m_racksWidget}; m_effectRackView->setFixedSize(EffectRackView::DEFAULT_WIDTH, MIXER_CHANNEL_HEIGHT); auto mainLayout = new QVBoxLayout{this}; - mainLayout->addWidget(receiveArrow, 0, Qt::AlignHCenter); - mainLayout->addWidget(sendButton, 0, Qt::AlignHCenter); - mainLayout->addWidget(sendKnob, 0, Qt::AlignHCenter); - mainLayout->addWidget(sendArrow, 0, Qt::AlignHCenter); - mainLayout->addWidget(channelNumberLcd, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_receiveArrow, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_sendButton, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_sendKnob, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_sendArrow, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_channelNumberLcd, 0, Qt::AlignHCenter); mainLayout->addStretch(); mainLayout->addWidget(renameLineEditView, 0, Qt::AlignHCenter); mainLayout->addStretch(); - mainLayout->addWidget(soloBtn, 0, Qt::AlignHCenter); - mainLayout->addWidget(muteBtn, 0, Qt::AlignHCenter); - mainLayout->addWidget(fader, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_soloButton, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_muteButton, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_fader, 0, Qt::AlignHCenter); - connect(renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); + connect(m_renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); connect(&Engine::mixer()->mixerChannel(m_channelIndex)->m_muteModel, SIGNAL(dataChanged()), this, SLOT(update())); } From 539c2cf9dd4d1134967a47bcea6722a075c1b120 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:37:55 -0500 Subject: [PATCH 12/47] Phase 2: Adjust MixerView to use new MixerChannelView --- src/gui/MixerView.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index a3ae7ad8a40..0cfd7d89353 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -182,12 +182,11 @@ int MixerView::addNewChannel() Mixer * mix = Engine::mixer(); int newChannelIndex = mix->createChannel(); - m_mixerChannelViews.push_back(new MixerChannelView(m_channelAreaWidget, this, - newChannelIndex)); - chLayout->addWidget( m_mixerChannelViews[newChannelIndex]->m_mixerLine ); - m_racksLayout->addWidget( m_mixerChannelViews[newChannelIndex]->m_rackView ); + m_mixerChannelViews.push_back(new MixerChannelView(newChannelIndex, this, m_channelAreaWidget)); + chLayout->addWidget(m_mixerChannelViews[newChannelIndex]); + m_racksLayout->addWidget(m_mixerChannelViews[newChannelIndex]); - updateMixerLine(newChannelIndex); + updateMixerChannel(newChannelIndex); updateMaxChannelSelector(); @@ -351,13 +350,13 @@ void MixerView::setCurrentMixerLine( MixerLine * _line ) } -void MixerView::updateMixerLine(int index) +void MixerView::updateMixerChannel(int index) { Mixer * mix = Engine::mixer(); // does current channel send to this channel? - int selIndex = m_currentMixerLine->channelIndex(); - MixerLine * thisLine = m_mixerChannelViews[index]->m_mixerLine; + int selIndex = m_currentMixerChannel->channelIndex(); + auto thisLine = m_mixerChannelViews[index]; thisLine->setToolTip( Engine::mixer()->mixerChannel( index )->m_name ); FloatModel * sendModel = mix->channelSendModel(selIndex, index); From e3be7c84c05bf0e764292c941d38554cf116fd2c Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:40:33 -0500 Subject: [PATCH 13/47] Phase 3: Adjust MixerView to use new MixerChannelView --- src/gui/MixerView.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 0cfd7d89353..b6d7e598785 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -199,14 +199,8 @@ void MixerView::refreshDisplay() // delete all views and re-add them for( int i = 1; iremoveWidget(m_mixerChannelViews[i]->m_mixerLine); - m_racksLayout->removeWidget( m_mixerChannelViews[i]->m_rackView ); - delete m_mixerChannelViews[i]->m_fader; - delete m_mixerChannelViews[i]->m_muteBtn; - delete m_mixerChannelViews[i]->m_soloBtn; - delete m_mixerChannelViews[i]->m_mixerLine; - delete m_mixerChannelViews[i]->m_rackView; - delete m_mixerChannelViews[i]; + chLayout->removeWidget(m_mixerChannelViews[i]); + m_racksLayout->removeWidget(m_mixerChannelViews[i]->m_effectRackView); } m_channelAreaWidget->adjustSize(); @@ -214,18 +208,18 @@ void MixerView::refreshDisplay() m_mixerChannelViews.resize(Engine::mixer()->numChannels()); for( int i = 1; i < m_mixerChannelViews.size(); ++i ) { - m_mixerChannelViews[i] = new MixerChannelView(m_channelAreaWidget, this, i); - chLayout->addWidget(m_mixerChannelViews[i]->m_mixerLine); - m_racksLayout->addWidget( m_mixerChannelViews[i]->m_rackView ); + m_mixerChannelViews[i] = new MixerChannelView(i, this, m_channelAreaWidget); + chLayout->addWidget(m_mixerChannelViews[i]); + m_racksLayout->addWidget( m_mixerChannelViews[i]->m_effectRackView); } - // set selected mixer line to 0 - setCurrentMixerLine( 0 ); + // set selected mixer channel to 0 + setCurrentMixerChannel( 0 ); // update all mixer lines for( int i = 0; i < m_mixerChannelViews.size(); ++i ) { - updateMixerLine( i ); + updateMixerChannel(i); } updateMaxChannelSelector(); From beb3d8e426b807d42fe9193cb2d5b339459c4818 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:45:51 -0500 Subject: [PATCH 14/47] Phase 4: Adjust MixerView to use new MixerChannelView --- src/gui/MixerChannelView.cpp | 5 ++++ src/gui/MixerView.cpp | 53 ------------------------------------ 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index ae18360b809..3e4c47650bd 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -155,6 +155,11 @@ namespace lmms::gui void MixerChannelView::setChannelIndex(int index) { + MixerChannel* mixerChannel = Engine::mixer()->mixerChannel( index ); + m_fader->setModel( &mixerChannel->m_volumeModel ); + m_muteButton->setModel(&mixerChannel->m_muteModel); + m_soloButton->setModel(&mixerChannel->m_soloModel); + m_effectRackView->setModel(&mixerChannel->m_fxChain); m_channelIndex = index; } diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index b6d7e598785..254d339bf09 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -267,60 +267,7 @@ void MixerView::loadSettings( const QDomElement & _this ) } -MixerView::MixerChannelView::MixerChannelView(QWidget * _parent, MixerView * _mv, - int channelIndex ) -{ - m_mixerLine = new MixerLine(_parent, _mv, channelIndex); - - MixerChannel *mixerChannel = Engine::mixer()->mixerChannel(channelIndex); - - m_fader = new Fader( &mixerChannel->m_volumeModel, - tr( "Fader %1" ).arg( channelIndex ), m_mixerLine ); - m_fader->setLevelsDisplayedInDBFS(); - m_fader->setMinPeak(dbfsToAmp(-42)); - m_fader->setMaxPeak(dbfsToAmp(9)); - - m_fader->move( 16-m_fader->width()/2, - m_mixerLine->height()- - m_fader->height()-5 ); - - m_muteBtn = new PixmapButton( m_mixerLine, tr( "Mute" ) ); - m_muteBtn->setModel( &mixerChannel->m_muteModel ); - m_muteBtn->setActiveGraphic( - embed::getIconPixmap( "led_off" ) ); - m_muteBtn->setInactiveGraphic( - embed::getIconPixmap( "led_green" ) ); - m_muteBtn->setCheckable( true ); - m_muteBtn->move( 9, m_fader->y()-11); - m_muteBtn->setToolTip(tr("Mute this channel")); - - m_soloBtn = new PixmapButton( m_mixerLine, tr( "Solo" ) ); - m_soloBtn->setModel( &mixerChannel->m_soloModel ); - m_soloBtn->setActiveGraphic( - embed::getIconPixmap( "led_red" ) ); - m_soloBtn->setInactiveGraphic( - embed::getIconPixmap( "led_off" ) ); - m_soloBtn->setCheckable( true ); - m_soloBtn->move( 9, m_fader->y()-21); - connect(&mixerChannel->m_soloModel, SIGNAL(dataChanged()), - _mv, SLOT ( toggledSolo() ), Qt::DirectConnection ); - m_soloBtn->setToolTip(tr("Solo this channel")); - - // Create EffectRack for the channel - m_rackView = new EffectRackView( &mixerChannel->m_fxChain, _mv->m_racksWidget ); - m_rackView->setFixedSize( EffectRackView::DEFAULT_WIDTH, MixerLine::MixerLineHeight ); -} - -void MixerView::MixerChannelView::setChannelIndex( int index ) -{ - MixerChannel* mixerChannel = Engine::mixer()->mixerChannel( index ); - - m_fader->setModel( &mixerChannel->m_volumeModel ); - m_muteBtn->setModel( &mixerChannel->m_muteModel ); - m_soloBtn->setModel( &mixerChannel->m_soloModel ); - m_rackView->setModel( &mixerChannel->m_fxChain ); -} void MixerView::toggledSolo() From dfe0561d59659ec7c4fdff52de05a1dbab885a20 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:50:32 -0500 Subject: [PATCH 15/47] Phase 5: Adjust MixerView to use new MixerChannelView --- src/gui/MixerView.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 254d339bf09..8853b055fde 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -277,16 +277,16 @@ void MixerView::toggledSolo() -void MixerView::setCurrentMixerLine( MixerLine * _line ) +void MixerView::setCurrentMixerChannel(MixerChannelView* channel) { // select - m_currentMixerLine = _line; - m_racksLayout->setCurrentWidget( m_mixerChannelViews[ _line->channelIndex() ]->m_rackView ); + m_currentMixerChannel = channel; + m_racksLayout->setCurrentWidget(m_mixerChannelViews[channel->channelIndex()]->m_effectRackView); // set up send knob for(int i = 0; i < m_mixerChannelViews.size(); ++i) { - updateMixerLine(i); + updateMixerChannel(i); } } @@ -314,8 +314,8 @@ void MixerView::updateMixerChannel(int index) } // disable the send button if it would cause an infinite loop - thisLine->m_sendBtn->setVisible(! mix->isInfiniteLoop(selIndex, index)); - thisLine->m_sendBtn->updateLightStatus(); + thisLine->m_sendButton->setVisible(! mix->isInfiniteLoop(selIndex, index)); + thisLine->m_sendButton->updateLightStatus(); thisLine->update(); } @@ -326,7 +326,7 @@ void MixerView::deleteChannel(int index) if( index == 0 ) return; // remember selected line - int selLine = m_currentMixerLine->channelIndex(); + int selLine = m_currentMixerChannel->channelIndex(); // in case the deleted channel is soloed or the remaining // channels will be left in a muted state @@ -336,22 +336,22 @@ void MixerView::deleteChannel(int index) Engine::mixer()->deleteChannel(index); // delete the view - chLayout->removeWidget(m_mixerChannelViews[index]->m_mixerLine); - m_racksLayout->removeWidget( m_mixerChannelViews[index]->m_rackView ); + chLayout->removeWidget(m_mixerChannelViews[index]); + m_racksLayout->removeWidget( m_mixerChannelViews[index]); delete m_mixerChannelViews[index]->m_fader; - delete m_mixerChannelViews[index]->m_muteBtn; - delete m_mixerChannelViews[index]->m_soloBtn; + delete m_mixerChannelViews[index]->m_muteButton; + delete m_mixerChannelViews[index]->m_soloButton; // delete mixerLine later to prevent a crash when deleting from context menu - m_mixerChannelViews[index]->m_mixerLine->hide(); - m_mixerChannelViews[index]->m_mixerLine->deleteLater(); - delete m_mixerChannelViews[index]->m_rackView; + m_mixerChannelViews[index]->hide(); + m_mixerChannelViews[index]->deleteLater(); + delete m_mixerChannelViews[index]->m_effectRackView; delete m_mixerChannelViews[index]; m_channelAreaWidget->adjustSize(); // make sure every channel knows what index it is for(int i=index + 1; im_mixerLine->setChannelIndex(i-1); + m_mixerChannelViews[i]->setChannelIndex(i - 1); } m_mixerChannelViews.remove(index); @@ -360,7 +360,7 @@ void MixerView::deleteChannel(int index) { selLine = m_mixerChannelViews.size()-1; } - setCurrentMixerLine(selLine); + setCurrentMixerChannel(selLine); updateMaxChannelSelector(); } @@ -419,7 +419,7 @@ void MixerView::moveChannelLeft(int index, int focusIndex) m_mixerChannelViews[index - 1]->setChannelIndex( index - 1 ); // Focus on new position - setCurrentMixerLine( focusIndex ); + setCurrentMixerChannel(focusIndex); } @@ -439,7 +439,7 @@ void MixerView::moveChannelRight(int index) void MixerView::renameChannel(int index) { - m_mixerChannelViews[index]->m_mixerLine->renameChannel(); + m_mixerChannelViews[index]->renameChannel(); } @@ -449,7 +449,7 @@ void MixerView::keyPressEvent(QKeyEvent * e) switch(e->key()) { case Qt::Key_Delete: - deleteChannel(m_currentMixerLine->channelIndex()); + deleteChannel(m_currentMixerChannel->channelIndex()); break; case Qt::Key_Left: if( e->modifiers() & Qt::AltModifier ) From 63d59892af2405327af818c2f0cbaad8b69041a1 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 17 Dec 2022 23:53:42 -0500 Subject: [PATCH 16/47] Phase 5: Adjust MixerView to use new MixerChannelView --- src/gui/MixerView.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 8853b055fde..15fe512294c 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -454,23 +454,23 @@ void MixerView::keyPressEvent(QKeyEvent * e) case Qt::Key_Left: if( e->modifiers() & Qt::AltModifier ) { - moveChannelLeft( m_currentMixerLine->channelIndex() ); + moveChannelLeft(m_currentMixerChannel->channelIndex()); } else { // select channel to the left - setCurrentMixerLine( m_currentMixerLine->channelIndex()-1 ); + setCurrentMixerChannel(m_currentMixerChannel->channelIndex() - 1); } break; case Qt::Key_Right: if( e->modifiers() & Qt::AltModifier ) { - moveChannelRight( m_currentMixerLine->channelIndex() ); + moveChannelRight(m_currentMixerChannel->channelIndex()); } else { // select channel to the right - setCurrentMixerLine( m_currentMixerLine->channelIndex()+1 ); + setCurrentMixerChannel(m_currentMixerChannel->channelIndex() + 1); } break; case Qt::Key_Insert: @@ -482,7 +482,7 @@ void MixerView::keyPressEvent(QKeyEvent * e) case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_F2: - renameChannel( m_currentMixerLine->channelIndex() ); + renameChannel(m_currentMixerChannel->channelIndex()); break; } } @@ -504,11 +504,11 @@ void MixerView::closeEvent( QCloseEvent * _ce ) -void MixerView::setCurrentMixerLine( int _line ) +void MixerView::setCurrentMixerChannel(int channel) { - if( _line >= 0 && _line < m_mixerChannelViews.size() ) + if (channel >= 0 && channel < m_mixerChannelViews.size()) { - setCurrentMixerLine( m_mixerChannelViews[_line]->m_mixerLine ); + setCurrentMixerChannel(m_mixerChannelViews[channel]); } } From 190543161cb5391ac4d23bf45cdc1df6cc2e5eeb Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 00:04:49 -0500 Subject: [PATCH 17/47] Remove places where MixerChannelView is being deleted Before, MixerChannelView was not inherited by QWidget, meaning it could not have a parent and had to be deleted when necessary. Since the MixerView owns the new MixerChannelView, this is no longer necessary. --- include/MixerView.h | 2 -- src/gui/MixerView.cpp | 20 -------------------- 2 files changed, 22 deletions(-) diff --git a/include/MixerView.h b/include/MixerView.h index a12fe514d69..c1427f61fdf 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -45,8 +45,6 @@ class LMMS_EXPORT MixerView : public QWidget, public ModelView, Q_OBJECT public: MixerView(); - ~MixerView() override; - void keyPressEvent(QKeyEvent * e) override; void saveSettings( QDomDocument & _doc, QDomElement & _this ) override; diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 15fe512294c..4e3d2d6755c 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -166,13 +166,6 @@ MixerView::MixerView() : setModel( m ); } -MixerView::~MixerView() -{ - for (auto mixerChannelView : m_mixerChannelViews) - { - delete mixerChannelView; - } -} @@ -335,19 +328,6 @@ void MixerView::deleteChannel(int index) // delete the real channel Engine::mixer()->deleteChannel(index); - // delete the view - chLayout->removeWidget(m_mixerChannelViews[index]); - m_racksLayout->removeWidget( m_mixerChannelViews[index]); - delete m_mixerChannelViews[index]->m_fader; - delete m_mixerChannelViews[index]->m_muteButton; - delete m_mixerChannelViews[index]->m_soloButton; - // delete mixerLine later to prevent a crash when deleting from context menu - m_mixerChannelViews[index]->hide(); - m_mixerChannelViews[index]->deleteLater(); - delete m_mixerChannelViews[index]->m_effectRackView; - delete m_mixerChannelViews[index]; - m_channelAreaWidget->adjustSize(); - // make sure every channel knows what index it is for(int i=index + 1; i Date: Sun, 18 Dec 2022 00:23:39 -0500 Subject: [PATCH 18/47] Replace MixerLine with MixerChannelView - Include MixerChannelView in MixerView --- include/MixerView.h | 1 + src/gui/SendButtonIndicator.cpp | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/MixerView.h b/include/MixerView.h index c1427f61fdf..94687152d47 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -30,6 +30,7 @@ #include #include +#include "MixerChannelView.h" #include "ModelView.h" #include "Engine.h" #include "Fader.h" diff --git a/src/gui/SendButtonIndicator.cpp b/src/gui/SendButtonIndicator.cpp index 19bd74d8b9c..86f38a20525 100644 --- a/src/gui/SendButtonIndicator.cpp +++ b/src/gui/SendButtonIndicator.cpp @@ -2,7 +2,6 @@ #include "embed.h" #include "Mixer.h" -#include "MixerLine.h" #include "MixerChannelView.h" #include "MixerView.h" @@ -37,7 +36,7 @@ SendButtonIndicator:: SendButtonIndicator(QWidget * _parent, MixerChannelView * void SendButtonIndicator::mousePressEvent( QMouseEvent * e ) { Mixer * mix = Engine::mixer(); - int from = m_mv->currentMixerLine()->channelIndex(); + int from = m_mv->currentMixerChannel()->channelIndex(); int to = m_parent->channelIndex(); FloatModel * sendModel = mix->channelSendModel(from, to); if( sendModel == nullptr ) @@ -51,15 +50,14 @@ void SendButtonIndicator::mousePressEvent( QMouseEvent * e ) mix->deleteChannelSend( from, to ); } - m_mv->updateMixerLine(m_parent->channelIndex()); + m_mv->updateMixerChannel(m_parent->channelIndex()); updateLightStatus(); } FloatModel * SendButtonIndicator::getSendModel() { Mixer * mix = Engine::mixer(); - return mix->channelSendModel( - m_mv->currentMixerLine()->channelIndex(), m_parent->channelIndex()); + return mix->channelSendModel(m_mv->currentMixerChannel()->channelIndex(), m_parent->channelIndex()); } void SendButtonIndicator::updateLightStatus() From b83b5108b3568aa8aca5383a784b57ec61c4971a Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 00:25:36 -0500 Subject: [PATCH 19/47] Replace setCurrentMixerLine calls with setCurrentMixerChannel around codebase --- src/gui/tracks/InstrumentTrackView.cpp | 2 +- src/gui/tracks/SampleTrackView.cpp | 2 +- src/gui/widgets/MixerLineLcdSpinBox.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/tracks/InstrumentTrackView.cpp b/src/gui/tracks/InstrumentTrackView.cpp index 5daa5138107..c55f7807ad1 100644 --- a/src/gui/tracks/InstrumentTrackView.cpp +++ b/src/gui/tracks/InstrumentTrackView.cpp @@ -243,7 +243,7 @@ void InstrumentTrackView::assignMixerLine(int channelIndex) { model()->mixerChannelModel()->setValue( channelIndex ); - getGUI()->mixerView()->setCurrentMixerLine( channelIndex ); + getGUI()->mixerView()->setCurrentMixerChannel(channelIndex); } diff --git a/src/gui/tracks/SampleTrackView.cpp b/src/gui/tracks/SampleTrackView.cpp index 08ddee863fb..12576263846 100644 --- a/src/gui/tracks/SampleTrackView.cpp +++ b/src/gui/tracks/SampleTrackView.cpp @@ -234,7 +234,7 @@ void SampleTrackView::assignMixerLine(int channelIndex) { model()->mixerChannelModel()->setValue(channelIndex); - getGUI()->mixerView()->setCurrentMixerLine(channelIndex); + getGUI()->mixerView()->setCurrentMixerChannel(channelIndex); } diff --git a/src/gui/widgets/MixerLineLcdSpinBox.cpp b/src/gui/widgets/MixerLineLcdSpinBox.cpp index 06eb823c01c..167b4d4f977 100644 --- a/src/gui/widgets/MixerLineLcdSpinBox.cpp +++ b/src/gui/widgets/MixerLineLcdSpinBox.cpp @@ -40,7 +40,7 @@ void MixerLineLcdSpinBox::setTrackView(TrackView * tv) void MixerLineLcdSpinBox::mouseDoubleClickEvent(QMouseEvent* event) { - getGUI()->mixerView()->setCurrentMixerLine(model()->value()); + getGUI()->mixerView()->setCurrentMixerChannel(model()->value()); getGUI()->mixerView()->parentWidget()->show(); getGUI()->mixerView()->show();// show Mixer window From fed33894592493c0bd9c55684d3ec3c8657f045b Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 00:29:29 -0500 Subject: [PATCH 20/47] Add event handlers in MixerChannelView --- include/MixerChannelView.h | 2 +- src/gui/MixerChannelView.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index ff20a1cda9e..3032995c624 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -57,6 +57,7 @@ namespace lmms::gui void contextMenuEvent(QContextMenuEvent*) override; void mousePressEvent(QMouseEvent*) override; void mouseDoubleClickEvent(QMouseEvent*) override; + bool eventFilter(QObject* dist, QEvent* event) override; int channelIndex() const; void setChannelIndex(int index); @@ -65,7 +66,6 @@ namespace lmms::gui void setSendReceiveState(const SendReceiveState& state); QSize sizeHint() const override; - bool eventFilter (QObject *dist, QEvent *event) override; public slots: void renameChannel(); diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 3e4c47650bd..1be470b134f 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -148,6 +148,21 @@ namespace lmms::gui delete contextMenu; } + void MixerChannelView::mousePressEvent(QMouseEvent*) + { + + } + + void MixerChannelView::mouseDoubleClickEvent(QMouseEvent*) + { + + } + + bool MixerChannelView::eventFilter(QObject* dist, QEvent* event) + { + + } + int MixerChannelView::channelIndex() const { return m_channelIndex; From c6fcee56dacbbcd93f0f2bce61513e3ab66c92c2 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 00:35:53 -0500 Subject: [PATCH 21/47] Implement MixerChannelView::eventFilter --- src/gui/MixerChannelView.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 1be470b134f..735f661f71e 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -160,7 +160,21 @@ namespace lmms::gui bool MixerChannelView::eventFilter(QObject* dist, QEvent* event) { - + // If we are in a rename, capture the enter/return events and handle them + if (event->type() == QEvent::KeyPress) + { + auto keyEvent = static_cast(event); + if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) + { + if (m_inRename) + { + renameFinished(); + event->accept(); // Stop the event from propagating + return true; + } + } + } + return false; } int MixerChannelView::channelIndex() const From 135c16cccc24f7c105d3aaac6d1eda758168eb1b Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 00:38:02 -0500 Subject: [PATCH 22/47] Update theme styles to use MixerChannelView --- data/themes/classic/style.css | 2 +- data/themes/default/style.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/themes/classic/style.css b/data/themes/classic/style.css index 58ec5dc0927..15340a9f7b4 100644 --- a/data/themes/classic/style.css +++ b/data/themes/classic/style.css @@ -610,7 +610,7 @@ lmms--gui--ControllerRackView QPushButton { font-size: 10px; } -lmms--gui--MixerLine { +lmms--gui--MixerChannelView { background: #5b6571; color: #e0e0e0; qproperty-backgroundActive: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:0, diff --git a/data/themes/default/style.css b/data/themes/default/style.css index f4c651c9e65..2fe672a8487 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -649,7 +649,7 @@ lmms--gui--ControllerRackView QPushButton { font-size: 10px; } -lmms--gui--MixerLine { +lmms--gui--MixerChannelView { background: #14161A; color: #d1d8e4; qproperty-backgroundActive: #3B424A; From 4eddae65ad7cc23c44968e748e4a04959f6f9cdc Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 01:08:22 -0500 Subject: [PATCH 23/47] Add QColor properties from style - Set the Qt::WA_StyledBackground attribute on --- include/MixerChannelView.h | 30 ++++++++++++++++++- src/gui/MixerChannelView.cpp | 56 ++++++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index 3032995c624..13f10e3ae78 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -47,6 +47,11 @@ namespace lmms::gui 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: enum class SendReceiveState { @@ -58,14 +63,30 @@ namespace lmms::gui void mousePressEvent(QMouseEvent*) override; void mouseDoubleClickEvent(QMouseEvent*) override; bool eventFilter(QObject* dist, QEvent* event) override; + QSize sizeHint() const override; int channelIndex() const; void setChannelIndex(int index); SendReceiveState sendReceiveState() const; void setSendReceiveState(const SendReceiveState& state); + + QBrush backgroundActive() const; + void setBackgroundActive(const QBrush & c); + + QColor strokeOuterActive() const; + void setStrokeOuterActive(const QColor & c); + + QColor strokeOuterInactive() const; + void setStrokeOuterInactive(const QColor & c ); + + QColor strokeInnerActive() const; + void setStrokeInnerActive(const QColor & c ); + + QColor strokeInnerInactive() const; + void setStrokeInnerInactive(const QColor& c); + - QSize sizeHint() const override; public slots: void renameChannel(); @@ -98,6 +119,13 @@ namespace lmms::gui SendReceiveState m_sendReceiveState = SendReceiveState::None; 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 diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 735f661f71e..b26aecfc3bb 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -43,6 +43,7 @@ namespace lmms::gui m_channelIndex(channelIndex) { // assert(dynamic_cast(parent) != nullptr); + setAttribute(Qt::WA_StyledBackground); m_sendButton = new SendButtonIndicator{nullptr, this, mixerView}; m_sendKnob = new Knob{knobBright_26, nullptr, tr("Channel send amount")}; @@ -116,6 +117,7 @@ namespace lmms::gui connect(m_renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); connect(&Engine::mixer()->mixerChannel(m_channelIndex)->m_muteModel, SIGNAL(dataChanged()), this, SLOT(update())); + } void MixerChannelView::contextMenuEvent(QContextMenuEvent*) @@ -184,8 +186,8 @@ namespace lmms::gui void MixerChannelView::setChannelIndex(int index) { - MixerChannel* mixerChannel = Engine::mixer()->mixerChannel( index ); - m_fader->setModel( &mixerChannel->m_volumeModel ); + MixerChannel* mixerChannel = Engine::mixer()->mixerChannel(index); + m_fader->setModel(&mixerChannel->m_volumeModel); m_muteButton->setModel(&mixerChannel->m_muteModel); m_soloButton->setModel(&mixerChannel->m_soloModel); m_effectRackView->setModel(&mixerChannel->m_fxChain); @@ -214,6 +216,56 @@ namespace lmms::gui return QSize{MIXER_CHANNEL_WIDTH, MIXER_CHANNEL_HEIGHT}; } + QBrush MixerChannelView::backgroundActive() const + { + return m_backgroundActive; + } + + void MixerChannelView::setBackgroundActive(const QBrush & c) + { + m_backgroundActive = c; + } + + QColor MixerChannelView::strokeOuterActive() const + { + return m_strokeOuterActive; + } + + void MixerChannelView::setStrokeOuterActive(const QColor & c) + { + m_strokeOuterActive = c; + } + + QColor MixerChannelView::strokeOuterInactive() const + { + return m_strokeOuterInactive; + } + + void MixerChannelView::setStrokeOuterInactive(const QColor& c) + { + m_strokeOuterInactive = c; + } + + QColor MixerChannelView::strokeInnerActive() const + { + return m_strokeInnerActive; + } + + void MixerChannelView::setStrokeInnerActive(const QColor& c) + { + m_strokeInnerActive = c; + } + + QColor MixerChannelView::strokeInnerInactive() const + { + return m_strokeInnerInactive; + } + + void MixerChannelView::setStrokeInnerInactive(const QColor& c) + { + m_strokeInnerInactive = c; + } + void MixerChannelView::renameChannel() { From 937c4a16785679c2d8a8b5fd49d45c5a6946771c Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 02:35:16 -0500 Subject: [PATCH 24/47] Add effect rack to rack layout when adding channel --- src/gui/MixerView.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 4e3d2d6755c..0b3e9a8ebc3 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -177,7 +177,7 @@ int MixerView::addNewChannel() int newChannelIndex = mix->createChannel(); m_mixerChannelViews.push_back(new MixerChannelView(newChannelIndex, this, m_channelAreaWidget)); chLayout->addWidget(m_mixerChannelViews[newChannelIndex]); - m_racksLayout->addWidget(m_mixerChannelViews[newChannelIndex]); + m_racksLayout->addWidget(m_mixerChannelViews[newChannelIndex]->m_effectRackView); updateMixerChannel(newChannelIndex); @@ -328,6 +328,13 @@ void MixerView::deleteChannel(int index) // delete the real channel Engine::mixer()->deleteChannel(index); + chLayout->removeWidget(m_mixerChannelViews[index]); + m_racksLayout->removeWidget( m_mixerChannelViews[index]); + // delete mixerLine later to prevent a crash when deleting from context menu + m_mixerChannelViews[index]->hide(); + m_mixerChannelViews[index]->deleteLater(); + m_channelAreaWidget->adjustSize(); + // make sure every channel knows what index it is for(int i=index + 1; i Date: Sun, 18 Dec 2022 03:53:36 -0500 Subject: [PATCH 25/47] Set size for MixerChannelView - Change nullptr to this for certain widgets - Some custom widgets may expect there to be a parent - Add spacing in channel layout - Increase size of mixer channel --- include/MixerChannelView.h | 4 ++-- src/gui/MixerChannelView.cpp | 18 ++++++++++-------- src/gui/MixerView.cpp | 7 +++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index 13f10e3ae78..099ed7c1205 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -39,8 +39,8 @@ namespace lmms::gui { - constexpr int MIXER_CHANNEL_WIDTH = 53; - constexpr int MIXER_CHANNEL_HEIGHT = 287; + constexpr int MIXER_CHANNEL_WIDTH = 48; + constexpr int MIXER_CHANNEL_HEIGHT = 512; constexpr int MIXER_CHANNEL_INNER_BORDER_SIZE = 3; constexpr int MIXER_CHANNEL_OUTER_BORDER_SIZE = 1; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index b26aecfc3bb..ba121351a19 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -42,13 +42,15 @@ namespace lmms::gui m_mixerView(mixerView), m_channelIndex(channelIndex) { - // assert(dynamic_cast(parent) != nullptr); setAttribute(Qt::WA_StyledBackground); + setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); + setFixedWidth(MIXER_CHANNEL_WIDTH); + setMinimumHeight(MIXER_CHANNEL_HEIGHT); - m_sendButton = new SendButtonIndicator{nullptr, this, mixerView}; - m_sendKnob = new Knob{knobBright_26, nullptr, tr("Channel send amount")}; + m_sendButton = new SendButtonIndicator{this, this, mixerView}; + m_sendKnob = new Knob{knobBright_26, this, tr("Channel send amount")}; - m_channelNumberLcd = new LcdWidget{2, nullptr}; + m_channelNumberLcd = new LcdWidget{2, this}; m_channelNumberLcd->setValue(channelIndex); auto mixerChannel = Engine::mixer()->mixerChannel(channelIndex); @@ -79,22 +81,22 @@ namespace lmms::gui m_receiveArrow->setPixmap(embed::getIconPixmap("receive_bg_arrow")); m_receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::Receive); - m_muteButton = new PixmapButton(nullptr, tr("Mute")); + m_muteButton = new PixmapButton(this, tr("Mute")); m_muteButton->setModel(&mixerChannel->m_muteModel); m_muteButton->setActiveGraphic(embed::getIconPixmap("led_off")); m_muteButton->setInactiveGraphic(embed::getIconPixmap("led_green")); m_muteButton->setCheckable(true); m_muteButton->setToolTip(tr("Mute this channel")); - m_soloButton = new PixmapButton(nullptr, tr("Solo")); + m_soloButton = new PixmapButton(this, tr("Solo")); m_soloButton->setModel(&mixerChannel->m_soloModel); m_soloButton->setActiveGraphic(embed::getIconPixmap("led_red")); m_soloButton->setInactiveGraphic(embed::getIconPixmap("led_off")); m_soloButton->setCheckable(true); m_soloButton->setToolTip(tr("Solo this channel")); - connect(&mixerChannel->m_soloModel, SIGNAL(dataChanged()), mixerView, SLOT(toggledSolo()), Qt::DirectConnection); + connect(&mixerChannel->m_soloModel, &BoolModel::dataChanged, mixerView, &MixerView::toggledSolo, Qt::DirectConnection); - m_fader = new Fader{&mixerChannel->m_volumeModel, tr("Fader %1").arg(channelIndex), nullptr}; + m_fader = new Fader{&mixerChannel->m_volumeModel, tr("Fader %1").arg(channelIndex), this}; m_fader->setLevelsDisplayedInDBFS(); m_fader->setMinPeak(dbfsToAmp(-42)); m_fader->setMaxPeak(dbfsToAmp(9)); diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 0b3e9a8ebc3..4c54f1707da 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -69,7 +69,7 @@ MixerView::MixerView() : setWindowIcon( embed::getIconPixmap( "mixer" ) ); // main-layout - auto ml = new QHBoxLayout; + auto ml = new QHBoxLayout{this}; // Set margins ml->setContentsMargins( 0, 4, 0, 0 ); @@ -78,8 +78,8 @@ MixerView::MixerView() : m_channelAreaWidget = new QWidget; chLayout = new QHBoxLayout( m_channelAreaWidget ); chLayout->setSizeConstraint( QLayout::SetMinimumSize ); - chLayout->setSpacing( 0 ); - chLayout->setMargin( 0 ); + chLayout->setSpacing(5); + chLayout->setMargin(0); m_channelAreaWidget->setLayout(chLayout); // create rack layout before creating the first channel @@ -143,7 +143,6 @@ MixerView::MixerView() : setCurrentMixerChannel(m_mixerChannelViews[0]); - setLayout( ml ); updateGeometry(); // timer for updating faders From b9b894e89937a53d7179e95436ada1ec28a48087 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 04:17:11 -0500 Subject: [PATCH 26/47] Retain size when widgets are hidden --- src/gui/MixerChannelView.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index ba121351a19..d3b9c6d22f5 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -47,8 +47,18 @@ namespace lmms::gui setFixedWidth(MIXER_CHANNEL_WIDTH); setMinimumHeight(MIXER_CHANNEL_HEIGHT); + auto retainSizeWhenHidden = [](QWidget* widget) + { + auto sizePolicy = widget->sizePolicy(); + sizePolicy.setRetainSizeWhenHidden(true); + widget->setSizePolicy(sizePolicy); + }; + m_sendButton = new SendButtonIndicator{this, this, mixerView}; + retainSizeWhenHidden(m_sendButton); + m_sendKnob = new Knob{knobBright_26, this, tr("Channel send amount")}; + retainSizeWhenHidden(m_sendKnob); m_channelNumberLcd = new LcdWidget{2, this}; m_channelNumberLcd->setValue(channelIndex); @@ -75,10 +85,12 @@ namespace lmms::gui m_sendArrow = new QLabel{}; m_sendArrow->setPixmap(embed::getIconPixmap("send_bg_arrow")); + retainSizeWhenHidden(m_sendArrow); m_sendArrow->setVisible(m_sendReceiveState == SendReceiveState::Send); m_receiveArrow = new QLabel{}; m_receiveArrow->setPixmap(embed::getIconPixmap("receive_bg_arrow")); + retainSizeWhenHidden(m_receiveArrow); m_receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::Receive); m_muteButton = new PixmapButton(this, tr("Mute")); @@ -119,7 +131,6 @@ namespace lmms::gui connect(m_renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); connect(&Engine::mixer()->mixerChannel(m_channelIndex)->m_muteModel, SIGNAL(dataChanged()), this, SLOT(update())); - } void MixerChannelView::contextMenuEvent(QContextMenuEvent*) @@ -154,12 +165,12 @@ namespace lmms::gui void MixerChannelView::mousePressEvent(QMouseEvent*) { - + m_mixerView->setCurrentMixerChannel(this); } void MixerChannelView::mouseDoubleClickEvent(QMouseEvent*) { - + renameChannel(); } bool MixerChannelView::eventFilter(QObject* dist, QEvent* event) From 38d176ec5da8af7d1d1ceb8ddd8f6dfa0ae16ec6 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 19:06:48 -0500 Subject: [PATCH 27/47] Implement paintEvent - Rename states in SendReceiveState --- include/MixerChannelView.h | 5 +-- src/gui/MixerChannelView.cpp | 77 ++++++++++++++++++++++++++++++------ 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index 099ed7c1205..d118d63eab2 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -55,10 +55,11 @@ namespace lmms::gui public: enum class SendReceiveState { - None, Send, Receive + None, SendToThis, ReceiveFromThis }; MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent = nullptr); + void paintEvent(QPaintEvent* event) override; void contextMenuEvent(QContextMenuEvent*) override; void mousePressEvent(QMouseEvent*) override; void mouseDoubleClickEvent(QMouseEvent*) override; @@ -86,8 +87,6 @@ namespace lmms::gui QColor strokeInnerInactive() const; void setStrokeInnerInactive(const QColor& c); - - public slots: void renameChannel(); void resetColor(); diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index d3b9c6d22f5..e80339d4c63 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -34,6 +34,7 @@ #include #include #include +#include namespace lmms::gui { @@ -42,7 +43,7 @@ namespace lmms::gui m_mixerView(mixerView), m_channelIndex(channelIndex) { - setAttribute(Qt::WA_StyledBackground); + setAutoFillBackground(true); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); setFixedWidth(MIXER_CHANNEL_WIDTH); setMinimumHeight(MIXER_CHANNEL_HEIGHT); @@ -86,12 +87,12 @@ namespace lmms::gui m_sendArrow = new QLabel{}; m_sendArrow->setPixmap(embed::getIconPixmap("send_bg_arrow")); retainSizeWhenHidden(m_sendArrow); - m_sendArrow->setVisible(m_sendReceiveState == SendReceiveState::Send); + m_sendArrow->setVisible(m_sendReceiveState == SendReceiveState::SendToThis); m_receiveArrow = new QLabel{}; m_receiveArrow->setPixmap(embed::getIconPixmap("receive_bg_arrow")); retainSizeWhenHidden(m_receiveArrow); - m_receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::Receive); + m_receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::ReceiveFromThis); m_muteButton = new PixmapButton(this, tr("Mute")); m_muteButton->setModel(&mixerChannel->m_muteModel); @@ -163,9 +164,58 @@ namespace lmms::gui delete contextMenu; } + void MixerChannelView::paintEvent(QPaintEvent* event) + { + const auto channel = Engine::mixer()->mixerChannel(m_channelIndex); + const bool muted = channel->m_muteModel.value(); + const auto name = channel->m_name; + const auto elidedName = elideName(name); + const auto isActive = m_mixerView->currentMixerChannel() == this; + + if (!m_inRename && m_renameLineEdit->text() != elidedName) + { + m_renameLineEdit->setText(elidedName); + } + + const auto width = rect().width(); + const auto height = rect().height(); + auto painter = QPainter{this}; + + if (channel->m_hasColor && !muted) + { + painter.fillRect(rect(), channel->m_color.darker(isActive ? 120 : 150)); + } + else + { + painter.fillRect(rect(), + isActive ? backgroundActive().color() : painter.background().color()); + } + + // inner border + painter.setPen(isActive ? strokeInnerActive() : strokeInnerInactive()); + painter.drawRect(1, 1, width - MIXER_CHANNEL_INNER_BORDER_SIZE, height - MIXER_CHANNEL_INNER_BORDER_SIZE); + + // outer border + painter.setPen(isActive ? strokeOuterActive() : strokeOuterInactive()); + painter.drawRect(0, 0, width - MIXER_CHANNEL_OUTER_BORDER_SIZE, height - MIXER_CHANNEL_OUTER_BORDER_SIZE); + + m_sendArrow->setVisible(m_sendReceiveState == SendReceiveState::SendToThis); + m_receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::ReceiveFromThis); + + QWidget::paintEvent(event); + } + void MixerChannelView::mousePressEvent(QMouseEvent*) { - m_mixerView->setCurrentMixerChannel(this); + if (m_mixerView->currentMixerChannel() != this) + { + auto pal = QPalette{}; + pal.setColor(QPalette::Window, m_strokeInnerActive); + pal.setColor(QPalette::WindowText, m_strokeInnerActive); + setPalette(pal); + m_mixerView->setCurrentMixerChannel(this); + } + } void MixerChannelView::mouseDoubleClickEvent(QMouseEvent*) @@ -214,14 +264,9 @@ namespace lmms::gui void MixerChannelView::setSendReceiveState(const SendReceiveState& state) { - m_sendReceiveState = state; - switch (state) - { - case SendReceiveState::Send: - break; - case SendReceiveState::Receive: - break; - } + m_sendReceiveState = state; + m_sendArrow->setVisible(state == SendReceiveState::SendToThis); + m_receiveArrow->setVisible(state == SendReceiveState::ReceiveFromThis); } QSize MixerChannelView::sizeHint() const @@ -323,5 +368,13 @@ namespace lmms::gui { } + + QString MixerChannelView::elideName(const QString& name) + { + const auto maxTextHeight = 60; + const auto metrics = QFontMetrics{m_renameLineEdit->font()}; + const auto elidedName = metrics.elidedText(name, Qt::ElideRight, maxTextHeight); + return elidedName; + } } // namespace lmms::gui \ No newline at end of file From 484fe765f66a78e402f1c58513b5905044eb7370 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 19:41:15 -0500 Subject: [PATCH 28/47] Implement send/receive arrow toggling - Make maxTextHeight constexpr in elideName - Remove background changing on mouse press (is now handled in paintEvent) --- src/gui/MixerChannelView.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index e80339d4c63..fda2059d0e1 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -199,20 +199,32 @@ namespace lmms::gui painter.setPen(isActive ? strokeOuterActive() : strokeOuterInactive()); painter.drawRect(0, 0, width - MIXER_CHANNEL_OUTER_BORDER_SIZE, height - MIXER_CHANNEL_OUTER_BORDER_SIZE); - m_sendArrow->setVisible(m_sendReceiveState == SendReceiveState::SendToThis); - m_receiveArrow->setVisible(m_sendReceiveState == SendReceiveState::ReceiveFromThis); + const auto sendToThis = Engine::mixer()->channelSendModel(m_mixerView->currentMixerChannel()->m_channelIndex, m_channelIndex) != nullptr; + const auto receiveFromThis = Engine::mixer()->channelSendModel(m_channelIndex, m_mixerView->currentMixerChannel()->m_channelIndex) != nullptr; + const auto sendReceiveStateNone = !sendToThis && !receiveFromThis; + + // Only one or none of them can be on + assert(sendToThis ^ receiveFromThis || sendReceiveStateNone); + + m_sendArrow->setVisible(sendToThis); + m_receiveArrow->setVisible(receiveFromThis); + + if (sendReceiveStateNone) + { + setSendReceiveState(SendReceiveState::None); + } + else + { + setSendReceiveState(sendToThis ? SendReceiveState::SendToThis : SendReceiveState::ReceiveFromThis); + } QWidget::paintEvent(event); } void MixerChannelView::mousePressEvent(QMouseEvent*) { - if (m_mixerView->currentMixerChannel() != this) + if (m_mixerView->currentMixerChannel() != this) { - auto pal = QPalette{}; - pal.setColor(QPalette::Window, m_strokeInnerActive); - pal.setColor(QPalette::WindowText, m_strokeInnerActive); - setPalette(pal); m_mixerView->setCurrentMixerChannel(this); } @@ -371,7 +383,7 @@ namespace lmms::gui QString MixerChannelView::elideName(const QString& name) { - const auto maxTextHeight = 60; + constexpr auto maxTextHeight = 60; const auto metrics = QFontMetrics{m_renameLineEdit->font()}; const auto elidedName = metrics.elidedText(name, Qt::ElideRight, maxTextHeight); return elidedName; From 4b3dba2a6ce37fd424ba16bc400f738ea8d77695 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 19:58:05 -0500 Subject: [PATCH 29/47] Implement renaming mixer channels --- include/MixerChannelView.h | 6 +++-- src/gui/MixerChannelView.cpp | 48 ++++++++++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index d118d63eab2..8a0b0f82066 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -32,10 +32,11 @@ #include "PixmapButton.h" #include "SendButtonIndicator.h" -#include -#include +#include #include #include +#include +#include namespace lmms::gui { @@ -108,6 +109,7 @@ namespace lmms::gui Knob* m_sendKnob; LcdWidget* m_channelNumberLcd; QLineEdit* m_renameLineEdit; + QGraphicsView* m_renameLineEditView; QLabel* m_sendArrow; QLabel* m_receiveArrow; PixmapButton* m_muteButton; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index fda2059d0e1..988942fd17f 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -26,12 +26,12 @@ #include "Mixer.h" #include "MixerChannelView.h" #include "MixerView.h" +#include "Song.h" #include "gui_templates.h" #include "lmms_math.h" #include #include -#include #include #include #include @@ -74,12 +74,12 @@ namespace lmms::gui m_renameLineEdit->installEventFilter(this); auto renameLineEditScene = new QGraphicsScene{}; - auto renameLineEditView = new QGraphicsView{}; - renameLineEditView->setStyleSheet("border-style: none; background: transparent;"); - renameLineEditView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - renameLineEditView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - renameLineEditView->setAttribute(Qt::WA_TransparentForMouseEvents, true); - renameLineEditView->setScene(renameLineEditScene); + m_renameLineEditView = new QGraphicsView{}; + m_renameLineEditView->setStyleSheet("border-style: none; background: transparent;"); + m_renameLineEditView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_renameLineEditView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_renameLineEditView->setAttribute(Qt::WA_TransparentForMouseEvents, true); + m_renameLineEditView->setScene(renameLineEditScene); auto renameLineEditProxy = renameLineEditScene->addWidget(m_renameLineEdit); renameLineEditProxy->setRotation(-90); @@ -124,7 +124,7 @@ namespace lmms::gui mainLayout->addWidget(m_sendArrow, 0, Qt::AlignHCenter); mainLayout->addWidget(m_channelNumberLcd, 0, Qt::AlignHCenter); mainLayout->addStretch(); - mainLayout->addWidget(renameLineEditView, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_renameLineEditView, 0, Qt::AlignHCenter); mainLayout->addStretch(); mainLayout->addWidget(m_soloButton, 0, Qt::AlignHCenter); mainLayout->addWidget(m_muteButton, 0, Qt::AlignHCenter); @@ -227,7 +227,6 @@ namespace lmms::gui { m_mixerView->setCurrentMixerChannel(this); } - } void MixerChannelView::mouseDoubleClickEvent(QMouseEvent*) @@ -338,12 +337,41 @@ namespace lmms::gui void MixerChannelView::renameChannel() { + m_inRename = true; + setToolTip(""); + m_renameLineEdit->setReadOnly(false); + + m_channelNumberLcd->hide(); + m_renameLineEdit->setFixedWidth(m_renameLineEdit->width()); + m_renameLineEdit->setText(Engine::mixer()->mixerChannel(m_channelIndex)->m_name); + + m_renameLineEditView->setFocus(); + m_renameLineEdit->selectAll(); + m_renameLineEdit->setFocus(); } void MixerChannelView::renameFinished() { + m_inRename = false; + + m_renameLineEdit->deselect(); + m_renameLineEdit->setReadOnly(true); + m_renameLineEdit->setFixedWidth(m_renameLineEdit->width()); + m_channelNumberLcd->show(); + + auto newName = m_renameLineEdit->text(); + setFocus(); + + const auto mixerChannel = Engine::mixer()->mixerChannel(m_channelIndex); + if (!newName.isEmpty() && mixerChannel->m_name != newName) + { + mixerChannel->m_name = newName; + m_renameLineEdit->setText(elideName(newName)); + Engine::getSong()->setModified(); + } + setToolTip(mixerChannel->m_name); } void MixerChannelView::resetColor() @@ -383,7 +411,7 @@ namespace lmms::gui QString MixerChannelView::elideName(const QString& name) { - constexpr auto maxTextHeight = 60; + const auto maxTextHeight = m_renameLineEdit->width(); const auto metrics = QFontMetrics{m_renameLineEdit->font()}; const auto elidedName = metrics.elidedText(name, Qt::ElideRight, maxTextHeight); return elidedName; From cfad01ee11bfe9def10f077bb0503fb4915fc077 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 20:00:33 -0500 Subject: [PATCH 30/47] Implement color functions --- src/gui/MixerChannelView.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 988942fd17f..1f6551c7410 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -23,6 +23,7 @@ */ #include "CaptionMenu.h" +#include "ColorChooser.h" #include "Mixer.h" #include "MixerChannelView.h" #include "MixerView.h" @@ -376,17 +377,29 @@ namespace lmms::gui void MixerChannelView::resetColor() { - + Engine::mixer()->mixerChannel(m_channelIndex)->m_hasColor = false; + Engine::getSong()->setModified(); + update(); } void MixerChannelView::selectColor() { - + auto channel = Engine::mixer()->mixerChannel(m_channelIndex); + auto new_color = ColorChooser(this).withPalette(ColorChooser::Palette::Mixer)->getColor(channel->m_color); + + if (!new_color.isValid()) { return; } + channel->setColor(new_color); + + Engine::getSong()->setModified(); + update(); } void MixerChannelView::randomizeColor() { - + auto channel = Engine::mixer()->mixerChannel(m_channelIndex); + channel->setColor(ColorChooser::getPalette(ColorChooser::Palette::Mixer)[rand() % 48]); + Engine::getSong()->setModified(); + update(); } void MixerChannelView::removeChannel() From 12e5759ba739404ef494f29e59ce22501581a5ad Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 20:03:08 -0500 Subject: [PATCH 31/47] Implement channel moving/removing functions --- src/gui/MixerChannelView.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 1f6551c7410..3e6c9749f8d 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -24,6 +24,7 @@ #include "CaptionMenu.h" #include "ColorChooser.h" +#include "GuiApplication.h" #include "Mixer.h" #include "MixerChannelView.h" #include "MixerView.h" @@ -404,22 +405,26 @@ namespace lmms::gui void MixerChannelView::removeChannel() { - + auto mix = getGUI()->mixerView(); + mix->deleteChannel(m_channelIndex); } void MixerChannelView::removeUnusedChannels() { - + auto mix = getGUI()->mixerView(); + mix->deleteUnusedChannels(); } void MixerChannelView::moveChannelLeft() { - + auto mix = getGUI()->mixerView(); + mix->moveChannelLeft(m_channelIndex); } void MixerChannelView::moveChannelRight() { - + auto mix = getGUI()->mixerView(); + mix->moveChannelRight(m_channelIndex); } QString MixerChannelView::elideName(const QString& name) From d2a3e5fa6ea64ec272ce8b093fb0498b9626b3bf Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 20:26:51 -0500 Subject: [PATCH 32/47] Do some cleanup Not sure if that connection with the mute model was needed, but removing it did not seem to introduce any issues. --- src/gui/MixerChannelView.cpp | 42 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 3e6c9749f8d..926ec6e972f 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -29,6 +29,7 @@ #include "MixerChannelView.h" #include "MixerView.h" #include "Song.h" + #include "gui_templates.h" #include "lmms_math.h" @@ -66,8 +67,8 @@ namespace lmms::gui m_channelNumberLcd = new LcdWidget{2, this}; m_channelNumberLcd->setValue(channelIndex); - auto mixerChannel = Engine::mixer()->mixerChannel(channelIndex); - auto mixerName = mixerChannel->m_name; + const auto mixerChannel = Engine::mixer()->mixerChannel(channelIndex); + const auto mixerName = mixerChannel->m_name; setToolTip(mixerName); m_renameLineEdit = new QLineEdit{}; @@ -133,36 +134,38 @@ namespace lmms::gui mainLayout->addWidget(m_fader, 0, Qt::AlignHCenter); connect(m_renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); - connect(&Engine::mixer()->mixerChannel(m_channelIndex)->m_muteModel, SIGNAL(dataChanged()), this, SLOT(update())); } void MixerChannelView::contextMenuEvent(QContextMenuEvent*) { - QPointer contextMenu = new CaptionMenu( Engine::mixer()->mixerChannel( m_channelIndex )->m_name, this ); - if( m_channelIndex != 0 ) // no move-options in master + auto contextMenu = new CaptionMenu( Engine::mixer()->mixerChannel( m_channelIndex )->m_name, this ); + + if (m_channelIndex != 0) // no move-options in master { - contextMenu->addAction( tr( "Move &left" ), this, SLOT(moveChannelLeft())); - contextMenu->addAction( tr( "Move &right" ), this, SLOT(moveChannelRight())); + contextMenu->addAction(tr("Move &left"), this, &MixerChannelView::moveChannelLeft); + contextMenu->addAction(tr("Move &right"), this, &MixerChannelView::moveChannelRight); } - contextMenu->addAction( tr( "Rename &channel" ), this, SLOT(renameChannel())); + + contextMenu->addAction(tr("Rename &channel"), this, &MixerChannelView::renameChannel); contextMenu->addSeparator(); - if( m_channelIndex != 0 ) // no remove-option in master + if (m_channelIndex != 0) // no remove-option in master { - contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "R&emove channel" ), this, SLOT(removeChannel())); + contextMenu->addAction(embed::getIconPixmap("cancel"), tr("R&emove channel"), this, &MixerChannelView::removeChannel); contextMenu->addSeparator(); } - contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "Remove &unused channels" ), this, SLOT(removeUnusedChannels())); + + contextMenu->addAction(embed::getIconPixmap("cancel"), tr("Remove &unused channels"), this, &MixerChannelView::removeUnusedChannels); contextMenu->addSeparator(); - QMenu colorMenu(tr("Color"), this); + auto colorMenu = QMenu{tr("Color"), this}; colorMenu.setIcon(embed::getIconPixmap("colorize")); - colorMenu.addAction(tr("Change"), this, SLOT(selectColor())); - colorMenu.addAction(tr("Reset"), this, SLOT(resetColor())); - colorMenu.addAction(tr("Pick random"), this, SLOT(randomizeColor())); + colorMenu.addAction(tr("Change"), this, &MixerChannelView::selectColor); + colorMenu.addAction(tr("Reset"), this, &MixerChannelView::resetColor); + colorMenu.addAction(tr("Pick random"), this, &MixerChannelView::randomizeColor); contextMenu->addMenu(&colorMenu); - contextMenu->exec( QCursor::pos() ); + contextMenu->exec(QCursor::pos()); delete contextMenu; } @@ -189,8 +192,7 @@ namespace lmms::gui } else { - painter.fillRect(rect(), - isActive ? backgroundActive().color() : painter.background().color()); + painter.fillRect(rect(), isActive ? backgroundActive().color() : painter.background().color()); } // inner border @@ -211,11 +213,11 @@ namespace lmms::gui m_sendArrow->setVisible(sendToThis); m_receiveArrow->setVisible(receiveFromThis); - if (sendReceiveStateNone) + if (sendReceiveStateNone) { setSendReceiveState(SendReceiveState::None); } - else + else { setSendReceiveState(sendToThis ? SendReceiveState::SendToThis : SendReceiveState::ReceiveFromThis); } From 7dec220b2961c3548c6a0d84aebe063fdb657bae Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 20:42:39 -0500 Subject: [PATCH 33/47] Include cassert --- src/gui/MixerChannelView.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 926ec6e972f..8c22f8df673 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -39,6 +39,8 @@ #include #include +#include + namespace lmms::gui { MixerChannelView::MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent) : From 354fd2a33725b4381fc56505a13f9f8385c59020 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sun, 18 Dec 2022 21:29:36 -0500 Subject: [PATCH 34/47] Replace references to MixerLine with MixerChannelView --- data/locale/ar.ts | 26 +++++++++---------- data/locale/bs.ts | 22 ++++++++-------- data/locale/ca.ts | 26 +++++++++---------- data/locale/cs.ts | 26 +++++++++---------- data/locale/de.ts | 26 +++++++++---------- data/locale/el.ts | 26 +++++++++---------- data/locale/en.ts | 26 +++++++++---------- data/locale/eo.ts | 26 +++++++++---------- data/locale/es.ts | 26 +++++++++---------- data/locale/eu.ts | 26 +++++++++---------- data/locale/fa.ts | 26 +++++++++---------- data/locale/fr.ts | 26 +++++++++---------- data/locale/gl.ts | 26 +++++++++---------- data/locale/he.ts | 26 +++++++++---------- data/locale/hi_IN.ts | 26 +++++++++---------- data/locale/hu_HU.ts | 26 +++++++++---------- data/locale/id.ts | 26 +++++++++---------- data/locale/it.ts | 26 +++++++++---------- data/locale/ja.ts | 26 +++++++++---------- data/locale/ka.ts | 26 +++++++++---------- data/locale/ko.ts | 26 +++++++++---------- data/locale/ms_MY.ts | 26 +++++++++---------- data/locale/nb.ts | 26 +++++++++---------- data/locale/nl.ts | 26 +++++++++---------- data/locale/oc.ts | 26 +++++++++---------- data/locale/pl.ts | 26 +++++++++---------- data/locale/pt.ts | 26 +++++++++---------- data/locale/ro.ts | 26 +++++++++---------- data/locale/ru.ts | 26 +++++++++---------- data/locale/sl.ts | 26 +++++++++---------- data/locale/sr.ts | 4 +-- data/locale/sv.ts | 26 +++++++++---------- data/locale/tr.ts | 26 +++++++++---------- data/locale/uk.ts | 26 +++++++++---------- data/locale/zh_CN.ts | 26 +++++++++---------- data/locale/zh_TW.ts | 26 +++++++++---------- include/InstrumentTrackWindow.h | 4 +-- ...eLcdSpinBox.h => MixerChannelLcdSpinBox.h} | 12 ++++----- include/SampleTrackWindow.h | 4 +-- include/SendButtonIndicator.h | 2 +- src/gui/CMakeLists.txt | 2 +- src/gui/MixerView.cpp | 2 +- src/gui/SampleTrackWindow.cpp | 4 +-- src/gui/SendButtonIndicator.cpp | 2 +- src/gui/instrument/InstrumentTrackWindow.cpp | 4 +-- ...SpinBox.cpp => MixerChannelLcdSpinBox.cpp} | 10 +++---- 46 files changed, 478 insertions(+), 478 deletions(-) rename include/{MixerLineLcdSpinBox.h => MixerChannelLcdSpinBox.h} (77%) rename src/gui/widgets/{MixerLineLcdSpinBox.cpp => MixerChannelLcdSpinBox.cpp} (85%) diff --git a/data/locale/ar.ts b/data/locale/ar.ts index 1f159c42a2a..1151a635666 100644 --- a/data/locale/ar.ts +++ b/data/locale/ar.ts @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New Mixer Channel diff --git a/data/locale/bs.ts b/data/locale/bs.ts index 506b401bd61..6baba1d3c34 100644 --- a/data/locale/bs.ts +++ b/data/locale/bs.ts @@ -2698,14 +2698,14 @@ Please make sure you have write-permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + The Mixer channel receives input from one or more instrument tracks. It in turn can be routed to multiple other mixer channels. LMMS automatically takes care of preventing infinite loops for you and doesn't allow making a connection that would result in an infinite loop. @@ -2716,27 +2716,27 @@ You can remove and move mixer channels in the context menu, which is accessed by - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels @@ -2789,12 +2789,12 @@ You can remove and move mixer channels in the context menu, which is accessed by - + Rename mixer channel - + Enter the new name for this mixer channel @@ -9752,7 +9752,7 @@ Please make sure you have read-permission to the file and the directory containi - MixerLineLcdSpinBox + MixerChannelLcdSpinBox Assign to: diff --git a/data/locale/ca.ts b/data/locale/ca.ts index 765cf3b6081..26c5afa91e7 100644 --- a/data/locale/ca.ts +++ b/data/locale/ca.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/cs.ts b/data/locale/cs.ts index 0ed175022be..26964ca5c5a 100644 --- a/data/locale/cs.ts +++ b/data/locale/cs.ts @@ -5334,62 +5334,62 @@ Ověřte si prosím, zda máte povolen zápis do souboru a do složky, ve které - MixerLine + MixerChannelView - + Channel send amount Množství odeslaného kanálu - + Move &left Přesunout do&leva - + Move &right Přesun dop&rava - + Rename &channel Přejmenovat &kanál - + R&emove channel Př&esunout kanál - + Remove &unused channels Odstranit nepo&užívané kanály - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Přiřadit k: - + New mixer Channel Nový efektový kanál diff --git a/data/locale/de.ts b/data/locale/de.ts index 51ca7d56204..bb3ff1943d2 100644 --- a/data/locale/de.ts +++ b/data/locale/de.ts @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount Kanal Sendemenge - + Move &left Nach &links verschieben - + Move &right Nach &rechts verschieben - + Rename &channel &Kanal umbenennen - + R&emove channel Kanal &Entfernen - + Remove &unused channels Entferne &unbenutzte Kanäle - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Weise hinzu: - + New mixer Channel Neuer FX-Kanal diff --git a/data/locale/el.ts b/data/locale/el.ts index 320a6657f61..e79f2837ef0 100644 --- a/data/locale/el.ts +++ b/data/locale/el.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/en.ts b/data/locale/en.ts index e52ae39ab7e..6b8a3311227 100644 --- a/data/locale/en.ts +++ b/data/locale/en.ts @@ -5335,62 +5335,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/eo.ts b/data/locale/eo.ts index 005ee8100bf..f45facb119d 100644 --- a/data/locale/eo.ts +++ b/data/locale/eo.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/es.ts b/data/locale/es.ts index 4fc4951ef92..2015ff4a40d 100644 --- a/data/locale/es.ts +++ b/data/locale/es.ts @@ -5334,62 +5334,62 @@ Asegúrate de tener permisos de escritura tanto del archivo como del directorio - MixerLine + MixerChannelView - + Channel send amount Cantidad de envío del canal - + Move &left Mover a la Izquierda (&L) - + Move &right Mover a la Derecha (&R) - + Rename &channel Renombrar &Canal - + R&emove channel Borrar canal (&E) - + Remove &unused channels Quitar los canales que no esten en &uso - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Asignar a: - + New mixer Channel Nuevo Canal FX diff --git a/data/locale/eu.ts b/data/locale/eu.ts index 25c165f81f8..cdc4ddd928f 100644 --- a/data/locale/eu.ts +++ b/data/locale/eu.ts @@ -5614,62 +5614,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/fa.ts b/data/locale/fa.ts index 181ca0ca1ff..6749ca60d15 100644 --- a/data/locale/fa.ts +++ b/data/locale/fa.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/fr.ts b/data/locale/fr.ts index 2c65444a8e0..93f0cb13366 100644 --- a/data/locale/fr.ts +++ b/data/locale/fr.ts @@ -5618,62 +5618,62 @@ Veuillez vous assurez que vous avez les droits d'écriture sur le fichier e - MixerLine + MixerChannelView - + Channel send amount Quantité de signal envoyé du canal - + Move &left Déplacer à &gauche - + Move &right Déplacer à &droite - + Rename &channel &Renommer le canal - + R&emove channel &Supprimer le canal - + Remove &unused channels Supprimer les canaux &inutilisés - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Assigner à : - + New mixer Channel Nouveau canal d'effet diff --git a/data/locale/gl.ts b/data/locale/gl.ts index cf04fd5d428..8b22b94906f 100644 --- a/data/locale/gl.ts +++ b/data/locale/gl.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/he.ts b/data/locale/he.ts index ee5a23613b2..277ea17b2f1 100644 --- a/data/locale/he.ts +++ b/data/locale/he.ts @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/hi_IN.ts b/data/locale/hi_IN.ts index 15550231f85..9e59ce1c48b 100644 --- a/data/locale/hi_IN.ts +++ b/data/locale/hi_IN.ts @@ -5335,62 +5335,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/hu_HU.ts b/data/locale/hu_HU.ts index 83605994674..468e90d8e8f 100644 --- a/data/locale/hu_HU.ts +++ b/data/locale/hu_HU.ts @@ -5339,62 +5339,62 @@ Ellenőrizd, hogy rendelkezel-e a szükséges engedélyekkel és próbáld újra - MixerLine + MixerChannelView - + Channel send amount - + Move &left Mozgatás &balra - + Move &right Mozgatás &jobbra - + Rename &channel Csatorna át&nevezése - + R&emove channel Csatorna &eltávolítása - + Remove &unused channels &Nem használt csatornák eltávolítása - + Set channel color Szín módosítása - + Remove channel color Szín eltávolítása - + Pick random channel color Véletlenszerű szín - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Hozzárendelés: - + New mixer Channel Új csatorna diff --git a/data/locale/id.ts b/data/locale/id.ts index e381ea726d8..cb13bf4077e 100644 --- a/data/locale/id.ts +++ b/data/locale/id.ts @@ -5335,62 +5335,62 @@ Pastikan Anda memiliki izin menulis ke file dan direktori yang berisi berkas ter - MixerLine + MixerChannelView - + Channel send amount Jumlah kirim saluran - + Move &left Pindah ke &kiri - + Move &right Pindah ke &kanan - + Rename &channel Ganti nama &saluran - + R&emove channel H&apus saluran - + Remove &unused channels Hapus &saluran yang tak terpakai - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel Saluran FX Baru diff --git a/data/locale/it.ts b/data/locale/it.ts index ff146d47120..a18183490a4 100644 --- a/data/locale/it.ts +++ b/data/locale/it.ts @@ -5339,62 +5339,62 @@ Si prega di controllare i permessi di scrittura sul file e la cartella che lo co - MixerLine + MixerChannelView - + Channel send amount Quantità di segnale inviata dal canale - + Move &left Sposta a &sinistra - + Move &right Sposta a $destra - + Rename &channel Rinomina &canale - + R&emove channel R&imuovi canale - + Remove &unused channels Rimuovi canali in&utilizzati - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Assegna a: - + New mixer Channel Nuovo canale FX diff --git a/data/locale/ja.ts b/data/locale/ja.ts index e10ca511818..18d49bdbd54 100644 --- a/data/locale/ja.ts +++ b/data/locale/ja.ts @@ -5335,62 +5335,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left 一つ左へ (&l) - + Move &right 一つ右へ (&r) - + Rename &channel チャンネル名を変更 (&c) - + R&emove channel チャンネルを削除 (&e) - + Remove &unused channels 使用していないチャンネルを削除 (&u) - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/ka.ts b/data/locale/ka.ts index 1956d8d04e5..f1db1d10952 100644 --- a/data/locale/ka.ts +++ b/data/locale/ka.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/ko.ts b/data/locale/ko.ts index 7373b5ca9a7..74833409a19 100644 --- a/data/locale/ko.ts +++ b/data/locale/ko.ts @@ -5337,62 +5337,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left 왼쪽으로 이동(&L) - + Move &right 오른쪽으로 이동(&R) - + Rename &channel 채널 이름 바꾸기(&C) - + R&emove channel 채널 제거(&R) - + Remove &unused channels 사용하지 않는 채널 제거(&U) - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: 채널 할당: - + New mixer Channel 새 FX 채널 diff --git a/data/locale/ms_MY.ts b/data/locale/ms_MY.ts index 209d51d108c..c63eee27c81 100644 --- a/data/locale/ms_MY.ts +++ b/data/locale/ms_MY.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/nb.ts b/data/locale/nb.ts index 3675b7f589c..bea4c901a9f 100644 --- a/data/locale/nb.ts +++ b/data/locale/nb.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/nl.ts b/data/locale/nl.ts index ad630a249c9..29a94186315 100644 --- a/data/locale/nl.ts +++ b/data/locale/nl.ts @@ -5335,62 +5335,62 @@ Zorg ervoor dat u schrijfbevoegdheid heeft voor het bestand en voor de map die h - MixerLine + MixerChannelView - + Channel send amount Hoeveelheid kanaal-send - + Move &left &Links verplaatsen - + Move &right &Rechts verplaatsen - + Rename &channel &Kanaal hernoemen - + R&emove channel Kanaal v&erwijderen - + Remove &unused channels Ongebr&uikte kanalen verwijderen - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Toewijzen aan: - + New mixer Channel Nieuw FX-kanaal diff --git a/data/locale/oc.ts b/data/locale/oc.ts index 58c81c96453..f5fd0214407 100644 --- a/data/locale/oc.ts +++ b/data/locale/oc.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/pl.ts b/data/locale/pl.ts index bb0c64edec0..cd9091ef32d 100644 --- a/data/locale/pl.ts +++ b/data/locale/pl.ts @@ -5619,62 +5619,62 @@ Upewnij się, że masz uprawnienia do zapisu do pliku i katalogu zawierającego - MixerLine + MixerChannelView - + Channel send amount Ilość wysyłania kanału - + Move &left Przesuń w &lewo - + Move &right Przesuń w p&rawo - + Rename &channel Zmień nazwę &kanału - + R&emove channel Usuń k&anał - + Remove &unused channels &Usuń nieużywane kanały - + Set channel color Ustaw kolor kanału - + Remove channel color Usuń kolor kanału - + Pick random channel color Ustaw losowy kolor kanału - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Przypisz do: - + New mixer Channel Nowy kanał efektów diff --git a/data/locale/pt.ts b/data/locale/pt.ts index b375e289f38..64bcf478c91 100644 --- a/data/locale/pt.ts +++ b/data/locale/pt.ts @@ -5336,62 +5336,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount Quantidade de envio de canal - + Move &left - + Move &right - + Rename &channel Renomear canal - + R&emove channel Remover canal - + Remove &unused channels Remover canais não utilizados - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Atribuir a: - + New mixer Channel Novo Canal FX diff --git a/data/locale/ro.ts b/data/locale/ro.ts index eceb45a6485..5bbc2025873 100644 --- a/data/locale/ro.ts +++ b/data/locale/ro.ts @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/ru.ts b/data/locale/ru.ts index 8235f291f34..fadbb92410b 100644 --- a/data/locale/ru.ts +++ b/data/locale/ru.ts @@ -5348,62 +5348,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount Величина отправки канала - + Move &left Подвинуть в&лево - + Move &right Подвинуть в&право - + Rename &channel Пере&именовать канал - + R&emove channel &Удалить канал - + Remove &unused channels Удалить &неиспользуемые каналы - + Set channel color Установить цвет канала - + Remove channel color Удалить цвет канала - + Pick random channel color Выбрать случайный цвет канала - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Назначить на: - + New mixer Channel Новый канал ЭФ diff --git a/data/locale/sl.ts b/data/locale/sl.ts index 3ad55a4c044..bdbab028fd9 100644 --- a/data/locale/sl.ts +++ b/data/locale/sl.ts @@ -5333,62 +5333,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount - + Move &left - + Move &right - + Rename &channel - + R&emove channel - + Remove &unused channels - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: - + New mixer Channel diff --git a/data/locale/sr.ts b/data/locale/sr.ts index 9b90164ab3b..01026a224c1 100644 --- a/data/locale/sr.ts +++ b/data/locale/sr.ts @@ -2178,7 +2178,7 @@ Please make sure you have write-permission to the file and the directory contain - MixerLine + MixerChannelView Channel send amount @@ -7752,7 +7752,7 @@ Please make sure you have read-permission to the file and the directory containi - MixerLineLcdSpinBox + MixerChannelLcdSpinBox Assign to: diff --git a/data/locale/sv.ts b/data/locale/sv.ts index 4963b07a9ad..2a97a6fb1fc 100644 --- a/data/locale/sv.ts +++ b/data/locale/sv.ts @@ -5617,62 +5617,62 @@ Se till att du har skrivbehörighet till filen och mappen som innehåller filen - MixerLine + MixerChannelView - + Channel send amount Kanalsändningsbelopp - + Move &left Flytta &vänster - + Move &right Flytta &höger - + Rename &channel Byt namn på &kanal - + R&emove channel T&a bort kanal - + Remove &unused channels Ta bort &oanvända kanaler - + Set channel color Ställ in kanalfärg - + Remove channel color Ta bort kanalfärg - + Pick random channel color Välj slumpmässig kanalfärg - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Tilldela till: - + New mixer Channel Ny FX-kanal diff --git a/data/locale/tr.ts b/data/locale/tr.ts index 387be6d8b96..80bf63c5dc3 100644 --- a/data/locale/tr.ts +++ b/data/locale/tr.ts @@ -5619,62 +5619,62 @@ Lütfen dosyaya ve dosyayı içeren dizine yazma izniniz olduğundan emin olun v - MixerLine + MixerChannelView - + Channel send amount Kanal gönderme miktarı - + Move &left Sol&a taşı - + Move &right &Sağa taşı - + Rename &channel &Kanalı yeniden adlandır - + R&emove channel Kanalı k&aldır - + Remove &unused channels &Kullanılmayan kanalları kaldırın - + Set channel color Kanal rengini ayarla - + Remove channel color Kanal rengini kaldır - + Pick random channel color Rastgele kanal rengi seçin - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Ata: - + New mixer Channel Yeni FX Kanalı diff --git a/data/locale/uk.ts b/data/locale/uk.ts index 50df10e4b72..02ed29c6f7b 100644 --- a/data/locale/uk.ts +++ b/data/locale/uk.ts @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount Величина відправки каналу - + Move &left Рухати вліво &L - + Move &right Рухати вправо &R - + Rename &channel Перейменувати канал &C - + R&emove channel Видалити канал &e - + Remove &unused channels Видалити канали які &не використовуються - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: Призначити до: - + New mixer Channel Новий ефект каналу diff --git a/data/locale/zh_CN.ts b/data/locale/zh_CN.ts index 63b22df9902..b213eed0bb0 100644 --- a/data/locale/zh_CN.ts +++ b/data/locale/zh_CN.ts @@ -5343,62 +5343,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount 通道发送的数量 - + Move &left 向左移(&L) - + Move &right 向右移(&R) - + Rename &channel 重命名通道(&C) - + R&emove channel 删除通道(&E) - + Remove &unused channels 移除所有未用通道(&U) - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: 分配给: - + New mixer Channel 新的效果通道 diff --git a/data/locale/zh_TW.ts b/data/locale/zh_TW.ts index 791a45599f9..02cc41494a2 100644 --- a/data/locale/zh_TW.ts +++ b/data/locale/zh_TW.ts @@ -5334,62 +5334,62 @@ Please make sure you have write permission to the file and the directory contain - MixerLine + MixerChannelView - + Channel send amount 通道發送的數量 - + Move &left 向左移(&L) - + Move &right 向右移(&R) - + Rename &channel 重命名通道(&C) - + R&emove channel 刪除通道(&E) - + Remove &unused channels 移除所有未用通道(&U) - + Set channel color - + Remove channel color - + Pick random channel color - MixerLineLcdSpinBox + MixerChannelLcdSpinBox - + Assign to: 分配給: - + New mixer Channel 新的效果通道 diff --git a/include/InstrumentTrackWindow.h b/include/InstrumentTrackWindow.h index 68750c0b8f4..cf65e16fe21 100644 --- a/include/InstrumentTrackWindow.h +++ b/include/InstrumentTrackWindow.h @@ -43,7 +43,7 @@ namespace gui { class EffectRackView; -class MixerLineLcdSpinBox; +class MixerChannelLcdSpinBox; class InstrumentFunctionArpeggioView; class InstrumentFunctionNoteStackingView; class InstrumentMidiIOView; @@ -142,7 +142,7 @@ protected slots: QLabel * m_pitchLabel; LcdSpinBox* m_pitchRangeSpinBox; QLabel * m_pitchRangeLabel; - MixerLineLcdSpinBox * m_mixerChannelNumber; + MixerChannelLcdSpinBox * m_mixerChannelNumber; diff --git a/include/MixerLineLcdSpinBox.h b/include/MixerChannelLcdSpinBox.h similarity index 77% rename from include/MixerLineLcdSpinBox.h rename to include/MixerChannelLcdSpinBox.h index bfd6cd5c962..625eda24d6e 100644 --- a/include/MixerLineLcdSpinBox.h +++ b/include/MixerChannelLcdSpinBox.h @@ -1,5 +1,5 @@ /* - * MixerLineLcdSpinBox.h - a specialization of LcdSpnBox for setting mixer channels + * MixerChannelLcdSpinBox.h - a specialization of LcdSpnBox for setting mixer channels * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -22,8 +22,8 @@ * */ -#ifndef MIXER_LINE_LCD_SPIN_BOX_H -#define MIXER_LINE_LCD_SPIN_BOX_H +#ifndef MIXER_CHANNEL_LCD_SPIN_BOX_H +#define MIXER_CHANNEL_LCD_SPIN_BOX_H #include "LcdSpinBox.h" @@ -34,14 +34,14 @@ namespace lmms::gui class TrackView; -class MixerLineLcdSpinBox : public LcdSpinBox +class MixerChannelLcdSpinBox : public LcdSpinBox { Q_OBJECT public: - MixerLineLcdSpinBox(int numDigits, QWidget * parent, const QString& name, TrackView * tv = nullptr) : + MixerChannelLcdSpinBox(int numDigits, QWidget * parent, const QString& name, TrackView * tv = nullptr) : LcdSpinBox(numDigits, parent, name), m_tv(tv) {} - ~MixerLineLcdSpinBox() override = default; + ~MixerChannelLcdSpinBox() override = default; void setTrackView(TrackView * tv); diff --git a/include/SampleTrackWindow.h b/include/SampleTrackWindow.h index d302b2c44f0..cd1f222710e 100644 --- a/include/SampleTrackWindow.h +++ b/include/SampleTrackWindow.h @@ -41,7 +41,7 @@ namespace lmms::gui class EffectRackView; class Knob; -class MixerLineLcdSpinBox; +class MixerChannelLcdSpinBox; class SampleTrackView; @@ -93,7 +93,7 @@ public slots: QLineEdit * m_nameLineEdit; Knob * m_volumeKnob; Knob * m_panningKnob; - MixerLineLcdSpinBox * m_mixerChannelNumber; + MixerChannelLcdSpinBox * m_mixerChannelNumber; EffectRackView * m_effectRack; } ; diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index 83e0508c37e..e6ee0c0ba33 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -35,7 +35,7 @@ class FloatModel; namespace gui { -class MixerLine; +class MixerChannelView; class MixerView; class MixerChannelView; diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index e0d4f93040a..d054d15b68c 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -108,7 +108,7 @@ SET(LMMS_SRCS gui/widgets/LedCheckBox.cpp gui/widgets/LeftRightNav.cpp gui/widgets/MeterDialog.cpp - gui/widgets/MixerLineLcdSpinBox.cpp + gui/widgets/MixerChannelLcdSpinBox.cpp gui/widgets/NStateButton.cpp gui/widgets/Oscilloscope.cpp gui/widgets/PixmapButton.cpp diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 4c54f1707da..d579718a837 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -329,7 +329,7 @@ void MixerView::deleteChannel(int index) chLayout->removeWidget(m_mixerChannelViews[index]); m_racksLayout->removeWidget( m_mixerChannelViews[index]); - // delete mixerLine later to prevent a crash when deleting from context menu + // delete MixerChannelView later to prevent a crash when deleting from context menu m_mixerChannelViews[index]->hide(); m_mixerChannelViews[index]->deleteLater(); m_channelAreaWidget->adjustSize(); diff --git a/src/gui/SampleTrackWindow.cpp b/src/gui/SampleTrackWindow.cpp index 78b899a0939..d6dc4b9260e 100644 --- a/src/gui/SampleTrackWindow.cpp +++ b/src/gui/SampleTrackWindow.cpp @@ -37,7 +37,7 @@ #include "GuiApplication.h" #include "Knob.h" #include "MainWindow.h" -#include "MixerLineLcdSpinBox.h" +#include "MixerChannelLcdSpinBox.h" #include "SampleTrackView.h" #include "Song.h" #include "SubWindow.h" @@ -124,7 +124,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : // setup spinbox for selecting Mixer-channel - m_mixerChannelNumber = new MixerLineLcdSpinBox(2, nullptr, tr("Mixer channel"), m_stv); + m_mixerChannelNumber = new MixerChannelLcdSpinBox(2, nullptr, tr("Mixer channel"), m_stv); basicControlsLayout->addWidget(m_mixerChannelNumber, 0, 3); basicControlsLayout->setAlignment(m_mixerChannelNumber, widgetAlignment); diff --git a/src/gui/SendButtonIndicator.cpp b/src/gui/SendButtonIndicator.cpp index 86f38a20525..922659f64d4 100644 --- a/src/gui/SendButtonIndicator.cpp +++ b/src/gui/SendButtonIndicator.cpp @@ -27,7 +27,7 @@ SendButtonIndicator:: SendButtonIndicator(QWidget * _parent, MixerChannelView * s_qpmOn = new QPixmap( embed::getIconPixmap( "mixer_send_on", 29, 20 ) ); } - // don't do any initializing yet, because the MixerView and MixerLine + // don't do any initializing yet, because the MixerView and MixerChannelView // that were passed to this constructor are not done with their constructors // yet. setPixmap( *s_qpmOff ); diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 70c11976a24..e53ea0059ac 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -42,7 +42,7 @@ #include "FileBrowser.h" #include "FileDialog.h" #include "GroupBox.h" -#include "MixerLineLcdSpinBox.h" +#include "MixerChannelLcdSpinBox.h" #include "GuiApplication.h" #include "gui_templates.h" #include "Instrument.h" @@ -206,7 +206,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // setup spinbox for selecting Mixer-channel - m_mixerChannelNumber = new MixerLineLcdSpinBox( 2, nullptr, tr( "Mixer channel" ), m_itv ); + m_mixerChannelNumber = new MixerChannelLcdSpinBox( 2, nullptr, tr( "Mixer channel" ), m_itv ); basicControlsLayout->addWidget( m_mixerChannelNumber, 0, 6 ); basicControlsLayout->setAlignment( m_mixerChannelNumber, widgetAlignment ); diff --git a/src/gui/widgets/MixerLineLcdSpinBox.cpp b/src/gui/widgets/MixerChannelLcdSpinBox.cpp similarity index 85% rename from src/gui/widgets/MixerLineLcdSpinBox.cpp rename to src/gui/widgets/MixerChannelLcdSpinBox.cpp index 167b4d4f977..8a67394de91 100644 --- a/src/gui/widgets/MixerLineLcdSpinBox.cpp +++ b/src/gui/widgets/MixerChannelLcdSpinBox.cpp @@ -1,5 +1,5 @@ /* - * MixerLineLcdSpinBox.cpp - a specialization of LcdSpnBox for setting mixer channels + * MixerChannelLcdSpinBox.cpp - a specialization of LcdSpnBox for setting mixer channels * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -22,7 +22,7 @@ * */ -#include "MixerLineLcdSpinBox.h" +#include "MixerChannelLcdSpinBox.h" #include "CaptionMenu.h" #include "MixerView.h" @@ -33,12 +33,12 @@ namespace lmms::gui { -void MixerLineLcdSpinBox::setTrackView(TrackView * tv) +void MixerChannelLcdSpinBox::setTrackView(TrackView * tv) { m_tv = tv; } -void MixerLineLcdSpinBox::mouseDoubleClickEvent(QMouseEvent* event) +void MixerChannelLcdSpinBox::mouseDoubleClickEvent(QMouseEvent* event) { getGUI()->mixerView()->setCurrentMixerChannel(model()->value()); @@ -48,7 +48,7 @@ void MixerLineLcdSpinBox::mouseDoubleClickEvent(QMouseEvent* event) //engine::getMixerView()->raise(); } -void MixerLineLcdSpinBox::contextMenuEvent(QContextMenuEvent* event) +void MixerChannelLcdSpinBox::contextMenuEvent(QContextMenuEvent* event) { // for the case, the user clicked right while pressing left mouse- // button, the context-menu appears while mouse-cursor is still hidden From a51855c23e5afbf4edc3185b77e854fe825552da Mon Sep 17 00:00:00 2001 From: sakertooth Date: Thu, 22 Dec 2022 11:23:38 -0500 Subject: [PATCH 35/47] Reduce height + Make m_renameLineEdit transparent + Retain size when LCD is hidden + Remove stretch after renameLineEdit in layout --- include/MixerChannelView.h | 2 +- src/gui/MixerChannelView.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index 8a0b0f82066..e0ae84ce6ef 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -41,7 +41,7 @@ namespace lmms::gui { constexpr int MIXER_CHANNEL_WIDTH = 48; - constexpr int MIXER_CHANNEL_HEIGHT = 512; + constexpr int MIXER_CHANNEL_HEIGHT = 350; constexpr int MIXER_CHANNEL_INNER_BORDER_SIZE = 3; constexpr int MIXER_CHANNEL_OUTER_BORDER_SIZE = 1; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 8c22f8df673..40b758cf492 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -68,17 +68,20 @@ namespace lmms::gui m_channelNumberLcd = new LcdWidget{2, this}; m_channelNumberLcd->setValue(channelIndex); + retainSizeWhenHidden(m_channelNumberLcd); const auto mixerChannel = Engine::mixer()->mixerChannel(channelIndex); const auto mixerName = mixerChannel->m_name; setToolTip(mixerName); m_renameLineEdit = new QLineEdit{}; + m_renameLineEdit->setStyleSheet("border-style: none; background: transparent;"); m_renameLineEdit->setText(mixerName); + m_renameLineEdit->setFixedWidth(65); m_renameLineEdit->setFont(pointSizeF(font(), 7.5f)); m_renameLineEdit->installEventFilter(this); - auto renameLineEditScene = new QGraphicsScene{}; + auto renameLineEditScene = new QGraphicsScene{}; m_renameLineEditView = new QGraphicsView{}; m_renameLineEditView->setStyleSheet("border-style: none; background: transparent;"); m_renameLineEditView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -130,7 +133,6 @@ namespace lmms::gui mainLayout->addWidget(m_channelNumberLcd, 0, Qt::AlignHCenter); mainLayout->addStretch(); mainLayout->addWidget(m_renameLineEditView, 0, Qt::AlignHCenter); - mainLayout->addStretch(); mainLayout->addWidget(m_soloButton, 0, Qt::AlignHCenter); mainLayout->addWidget(m_muteButton, 0, Qt::AlignHCenter); mainLayout->addWidget(m_fader, 0, Qt::AlignHCenter); From 0e92d4da1b1d6be0eec75cb7e13a81744aae7a4b Mon Sep 17 00:00:00 2001 From: sakertooth Date: Fri, 23 Dec 2022 13:43:57 -0500 Subject: [PATCH 36/47] Remove trailing whitespace --- include/MixerChannelView.h | 16 ++--- include/MixerView.h | 6 +- include/SampleTrackWindow.h | 6 +- include/SendButtonIndicator.h | 2 +- src/gui/MixerChannelView.cpp | 104 ++++++++++++++--------------- src/gui/SampleTrackWindow.cpp | 2 +- src/gui/SendButtonIndicator.cpp | 4 +- src/gui/tracks/SampleTrackView.cpp | 2 +- 8 files changed, 71 insertions(+), 71 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index e0ae84ce6ef..cb6793481f9 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -38,13 +38,13 @@ #include #include -namespace lmms::gui +namespace lmms::gui { constexpr int MIXER_CHANNEL_WIDTH = 48; constexpr int MIXER_CHANNEL_HEIGHT = 350; constexpr int MIXER_CHANNEL_INNER_BORDER_SIZE = 3; constexpr int MIXER_CHANNEL_OUTER_BORDER_SIZE = 1; - + class MixerChannelView : public QWidget { Q_OBJECT @@ -54,7 +54,7 @@ namespace lmms::gui Q_PROPERTY(QColor strokeInnerActive READ strokeInnerActive WRITE setStrokeInnerActive) Q_PROPERTY(QColor strokeInnerInactive READ strokeInnerInactive WRITE setStrokeInnerInactive) public: - enum class SendReceiveState + enum class SendReceiveState { None, SendToThis, ReceiveFromThis }; @@ -75,16 +75,16 @@ namespace lmms::gui QBrush backgroundActive() const; void setBackgroundActive(const QBrush & c); - + QColor strokeOuterActive() const; void setStrokeOuterActive(const QColor & c); - + QColor strokeOuterInactive() const; void setStrokeOuterInactive(const QColor & c ); - + QColor strokeInnerActive() const; void setStrokeInnerActive(const QColor & c ); - + QColor strokeInnerInactive() const; void setStrokeInnerInactive(const QColor& c); @@ -126,7 +126,7 @@ namespace lmms::gui QColor m_strokeOuterInactive; QColor m_strokeInnerActive; QColor m_strokeInnerInactive; - + friend class MixerView; }; } // namespace lmms::gui diff --git a/include/MixerView.h b/include/MixerView.h index 94687152d47..dff30b5c47e 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -2,7 +2,7 @@ * MixerView.h - effect-mixer-view for LMMS * * Copyright (c) 2008-2014 Tobias Doerffel - * + * * This file is part of LMMS - https://lmms.io * * This program is free software; you can redistribute it and/or @@ -93,7 +93,7 @@ public slots: protected: void closeEvent( QCloseEvent * _ce ) override; - + private slots: void updateFaders(); void toggledSolo(); @@ -110,7 +110,7 @@ private slots: QWidget * m_racksWidget; void updateMaxChannelSelector(); - + friend class MixerChannelView; } ; diff --git a/include/SampleTrackWindow.h b/include/SampleTrackWindow.h index cd1f222710e..cce7da6e366 100644 --- a/include/SampleTrackWindow.h +++ b/include/SampleTrackWindow.h @@ -21,8 +21,8 @@ * Boston, MA 02110-1301 USA. * */ - - + + #ifndef SAMPLE_TRACK_WINDOW_H #define SAMPLE_TRACK_WINDOW_H @@ -43,7 +43,7 @@ class EffectRackView; class Knob; class MixerChannelLcdSpinBox; class SampleTrackView; - + class SampleTrackWindow : public QWidget, public ModelView, public SerializingObjectHook { diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index e6ee0c0ba33..ef4acb53524 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -39,7 +39,7 @@ class MixerChannelView; class MixerView; class MixerChannelView; -class SendButtonIndicator : public QLabel +class SendButtonIndicator : public QLabel { public: SendButtonIndicator(QWidget * _parent, MixerChannelView * _owner, MixerView * _mv); diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 40b758cf492..9c08cbd3243 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -43,7 +43,7 @@ namespace lmms::gui { - MixerChannelView::MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent) : + MixerChannelView::MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent) : QWidget(parent), m_mixerView(mixerView), m_channelIndex(channelIndex) @@ -53,16 +53,16 @@ namespace lmms::gui setFixedWidth(MIXER_CHANNEL_WIDTH); setMinimumHeight(MIXER_CHANNEL_HEIGHT); - auto retainSizeWhenHidden = [](QWidget* widget) + auto retainSizeWhenHidden = [](QWidget* widget) { auto sizePolicy = widget->sizePolicy(); sizePolicy.setRetainSizeWhenHidden(true); widget->setSizePolicy(sizePolicy); }; - m_sendButton = new SendButtonIndicator{this, this, mixerView}; + m_sendButton = new SendButtonIndicator{this, this, mixerView}; retainSizeWhenHidden(m_sendButton); - + m_sendKnob = new Knob{knobBright_26, this, tr("Channel send amount")}; retainSizeWhenHidden(m_sendKnob); @@ -88,7 +88,7 @@ namespace lmms::gui m_renameLineEditView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_renameLineEditView->setAttribute(Qt::WA_TransparentForMouseEvents, true); m_renameLineEditView->setScene(renameLineEditScene); - + auto renameLineEditProxy = renameLineEditScene->addWidget(m_renameLineEdit); renameLineEditProxy->setRotation(-90); @@ -121,7 +121,7 @@ namespace lmms::gui m_fader->setLevelsDisplayedInDBFS(); m_fader->setMinPeak(dbfsToAmp(-42)); m_fader->setMaxPeak(dbfsToAmp(9)); - + m_effectRackView = new EffectRackView{&mixerChannel->m_fxChain, mixerView->m_racksWidget}; m_effectRackView->setFixedSize(EffectRackView::DEFAULT_WIDTH, MIXER_CHANNEL_HEIGHT); @@ -143,7 +143,7 @@ namespace lmms::gui void MixerChannelView::contextMenuEvent(QContextMenuEvent*) { auto contextMenu = new CaptionMenu( Engine::mixer()->mixerChannel( m_channelIndex )->m_name, this ); - + if (m_channelIndex != 0) // no move-options in master { contextMenu->addAction(tr("Move &left"), this, &MixerChannelView::moveChannelLeft); @@ -173,7 +173,7 @@ namespace lmms::gui delete contextMenu; } - void MixerChannelView::paintEvent(QPaintEvent* event) + void MixerChannelView::paintEvent(QPaintEvent* event) { const auto channel = Engine::mixer()->mixerChannel(m_channelIndex); const bool muted = channel->m_muteModel.value(); @@ -189,7 +189,7 @@ namespace lmms::gui const auto width = rect().width(); const auto height = rect().height(); auto painter = QPainter{this}; - + if (channel->m_hasColor && !muted) { painter.fillRect(rect(), channel->m_color.darker(isActive ? 120 : 150)); @@ -198,11 +198,11 @@ namespace lmms::gui { painter.fillRect(rect(), isActive ? backgroundActive().color() : painter.background().color()); } - + // inner border painter.setPen(isActive ? strokeInnerActive() : strokeInnerInactive()); painter.drawRect(1, 1, width - MIXER_CHANNEL_INNER_BORDER_SIZE, height - MIXER_CHANNEL_INNER_BORDER_SIZE); - + // outer border painter.setPen(isActive ? strokeOuterActive() : strokeOuterInactive()); painter.drawRect(0, 0, width - MIXER_CHANNEL_OUTER_BORDER_SIZE, height - MIXER_CHANNEL_OUTER_BORDER_SIZE); @@ -229,20 +229,20 @@ namespace lmms::gui QWidget::paintEvent(event); } - void MixerChannelView::mousePressEvent(QMouseEvent*) + void MixerChannelView::mousePressEvent(QMouseEvent*) { if (m_mixerView->currentMixerChannel() != this) { m_mixerView->setCurrentMixerChannel(this); } } - - void MixerChannelView::mouseDoubleClickEvent(QMouseEvent*) + + void MixerChannelView::mouseDoubleClickEvent(QMouseEvent*) { renameChannel(); } - bool MixerChannelView::eventFilter(QObject* dist, QEvent* event) + bool MixerChannelView::eventFilter(QObject* dist, QEvent* event) { // If we are in a rename, capture the enter/return events and handle them if (event->type() == QEvent::KeyPress) @@ -261,12 +261,12 @@ namespace lmms::gui return false; } - int MixerChannelView::channelIndex() const + int MixerChannelView::channelIndex() const { return m_channelIndex; } - - void MixerChannelView::setChannelIndex(int index) + + void MixerChannelView::setChannelIndex(int index) { MixerChannel* mixerChannel = Engine::mixer()->mixerChannel(index); m_fader->setModel(&mixerChannel->m_volumeModel); @@ -276,93 +276,93 @@ namespace lmms::gui m_channelIndex = index; } - MixerChannelView::SendReceiveState MixerChannelView::sendReceiveState() const + MixerChannelView::SendReceiveState MixerChannelView::sendReceiveState() const { return m_sendReceiveState; } - void MixerChannelView::setSendReceiveState(const SendReceiveState& state) + void MixerChannelView::setSendReceiveState(const SendReceiveState& state) { m_sendReceiveState = state; - m_sendArrow->setVisible(state == SendReceiveState::SendToThis); + m_sendArrow->setVisible(state == SendReceiveState::SendToThis); m_receiveArrow->setVisible(state == SendReceiveState::ReceiveFromThis); } - + QSize MixerChannelView::sizeHint() const { return QSize{MIXER_CHANNEL_WIDTH, MIXER_CHANNEL_HEIGHT}; } - QBrush MixerChannelView::backgroundActive() const + QBrush MixerChannelView::backgroundActive() const { return m_backgroundActive; } - - void MixerChannelView::setBackgroundActive(const QBrush & c) + + void MixerChannelView::setBackgroundActive(const QBrush & c) { m_backgroundActive = c; } - - QColor MixerChannelView::strokeOuterActive() const + + QColor MixerChannelView::strokeOuterActive() const { return m_strokeOuterActive; } - void MixerChannelView::setStrokeOuterActive(const QColor & c) + void MixerChannelView::setStrokeOuterActive(const QColor & c) { m_strokeOuterActive = c; } - QColor MixerChannelView::strokeOuterInactive() const + QColor MixerChannelView::strokeOuterInactive() const { return m_strokeOuterInactive; } - void MixerChannelView::setStrokeOuterInactive(const QColor& c) + void MixerChannelView::setStrokeOuterInactive(const QColor& c) { m_strokeOuterInactive = c; } - - QColor MixerChannelView::strokeInnerActive() const + + QColor MixerChannelView::strokeInnerActive() const { return m_strokeInnerActive; } - void MixerChannelView::setStrokeInnerActive(const QColor& c) + void MixerChannelView::setStrokeInnerActive(const QColor& c) { m_strokeInnerActive = c; } - - QColor MixerChannelView::strokeInnerInactive() const + + QColor MixerChannelView::strokeInnerInactive() const { return m_strokeInnerInactive; } - void MixerChannelView::setStrokeInnerInactive(const QColor& c) + void MixerChannelView::setStrokeInnerInactive(const QColor& c) { m_strokeInnerInactive = c; } - void MixerChannelView::renameChannel() + void MixerChannelView::renameChannel() { m_inRename = true; setToolTip(""); m_renameLineEdit->setReadOnly(false); - + m_channelNumberLcd->hide(); m_renameLineEdit->setFixedWidth(m_renameLineEdit->width()); m_renameLineEdit->setText(Engine::mixer()->mixerChannel(m_channelIndex)->m_name); - + m_renameLineEditView->setFocus(); m_renameLineEdit->selectAll(); m_renameLineEdit->setFocus(); } - void MixerChannelView::renameFinished() + void MixerChannelView::renameFinished() { m_inRename = false; - + m_renameLineEdit->deselect(); m_renameLineEdit->setReadOnly(true); m_renameLineEdit->setFixedWidth(m_renameLineEdit->width()); @@ -382,26 +382,26 @@ namespace lmms::gui setToolTip(mixerChannel->m_name); } - void MixerChannelView::resetColor() + void MixerChannelView::resetColor() { Engine::mixer()->mixerChannel(m_channelIndex)->m_hasColor = false; Engine::getSong()->setModified(); update(); } - void MixerChannelView::selectColor() + void MixerChannelView::selectColor() { auto channel = Engine::mixer()->mixerChannel(m_channelIndex); auto new_color = ColorChooser(this).withPalette(ColorChooser::Palette::Mixer)->getColor(channel->m_color); - + if (!new_color.isValid()) { return; } channel->setColor(new_color); - + Engine::getSong()->setModified(); update(); } - void MixerChannelView::randomizeColor() + void MixerChannelView::randomizeColor() { auto channel = Engine::mixer()->mixerChannel(m_channelIndex); channel->setColor(ColorChooser::getPalette(ColorChooser::Palette::Mixer)[rand() % 48]); @@ -409,36 +409,36 @@ namespace lmms::gui update(); } - void MixerChannelView::removeChannel() + void MixerChannelView::removeChannel() { auto mix = getGUI()->mixerView(); mix->deleteChannel(m_channelIndex); } - void MixerChannelView::removeUnusedChannels() + void MixerChannelView::removeUnusedChannels() { auto mix = getGUI()->mixerView(); mix->deleteUnusedChannels(); } - void MixerChannelView::moveChannelLeft() + void MixerChannelView::moveChannelLeft() { auto mix = getGUI()->mixerView(); mix->moveChannelLeft(m_channelIndex); } - void MixerChannelView::moveChannelRight() + void MixerChannelView::moveChannelRight() { auto mix = getGUI()->mixerView(); mix->moveChannelRight(m_channelIndex); } - QString MixerChannelView::elideName(const QString& name) + QString MixerChannelView::elideName(const QString& name) { const auto maxTextHeight = m_renameLineEdit->width(); const auto metrics = QFontMetrics{m_renameLineEdit->font()}; const auto elidedName = metrics.elidedText(name, Qt::ElideRight, maxTextHeight); return elidedName; } - + } // namespace lmms::gui \ No newline at end of file diff --git a/src/gui/SampleTrackWindow.cpp b/src/gui/SampleTrackWindow.cpp index d6dc4b9260e..a35c3b5c4ad 100644 --- a/src/gui/SampleTrackWindow.cpp +++ b/src/gui/SampleTrackWindow.cpp @@ -21,7 +21,7 @@ * Boston, MA 02110-1301 USA. * */ - + #include "SampleTrackWindow.h" #include diff --git a/src/gui/SendButtonIndicator.cpp b/src/gui/SendButtonIndicator.cpp index 922659f64d4..6ff10b5f911 100644 --- a/src/gui/SendButtonIndicator.cpp +++ b/src/gui/SendButtonIndicator.cpp @@ -21,12 +21,12 @@ SendButtonIndicator:: SendButtonIndicator(QWidget * _parent, MixerChannelView * { s_qpmOff = new QPixmap( embed::getIconPixmap( "mixer_send_off", 29, 20 ) ); } - + if( ! s_qpmOn ) { s_qpmOn = new QPixmap( embed::getIconPixmap( "mixer_send_on", 29, 20 ) ); } - + // don't do any initializing yet, because the MixerView and MixerChannelView // that were passed to this constructor are not done with their constructors // yet. diff --git a/src/gui/tracks/SampleTrackView.cpp b/src/gui/tracks/SampleTrackView.cpp index 12576263846..3a4f71f5757 100644 --- a/src/gui/tracks/SampleTrackView.cpp +++ b/src/gui/tracks/SampleTrackView.cpp @@ -21,7 +21,7 @@ * Boston, MA 02110-1301 USA. * */ - + #include "SampleTrackView.h" #include From 51bb83fef4600b3a5854ef352b1388dfd59fac86 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 24 Dec 2022 01:15:19 -0500 Subject: [PATCH 37/47] Make m_renameLineEdit read only + Transpose m_renameLineEditView rectangle (with 5px offset) --- src/gui/MixerChannelView.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 9c08cbd3243..d6b20dc6429 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -74,11 +74,10 @@ namespace lmms::gui const auto mixerName = mixerChannel->m_name; setToolTip(mixerName); - m_renameLineEdit = new QLineEdit{}; - m_renameLineEdit->setStyleSheet("border-style: none; background: transparent;"); - m_renameLineEdit->setText(mixerName); + m_renameLineEdit = new QLineEdit{mixerName, nullptr}; m_renameLineEdit->setFixedWidth(65); m_renameLineEdit->setFont(pointSizeF(font(), 7.5f)); + m_renameLineEdit->setReadOnly(true); m_renameLineEdit->installEventFilter(this); auto renameLineEditScene = new QGraphicsScene{}; @@ -91,6 +90,7 @@ namespace lmms::gui auto renameLineEditProxy = renameLineEditScene->addWidget(m_renameLineEdit); renameLineEditProxy->setRotation(-90); + m_renameLineEditView->setFixedSize(m_renameLineEdit->height() + 5, m_renameLineEdit->width() + 5); m_sendArrow = new QLabel{}; m_sendArrow->setPixmap(embed::getIconPixmap("send_bg_arrow")); From 2a451a7bb3a0466c59d2be0d1b4b1a0fb3ab61bd Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 24 Dec 2022 01:17:02 -0500 Subject: [PATCH 38/47] Set spacing in channel layout back to 0 --- src/gui/MixerView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index d579718a837..a19669b3428 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -78,8 +78,8 @@ MixerView::MixerView() : m_channelAreaWidget = new QWidget; chLayout = new QHBoxLayout( m_channelAreaWidget ); chLayout->setSizeConstraint( QLayout::SetMinimumSize ); - chLayout->setSpacing(5); - chLayout->setMargin(0); + chLayout->setSpacing( 0 ); + chLayout->setMargin( 0 ); m_channelAreaWidget->setLayout(chLayout); // create rack layout before creating the first channel From 3eac41358a2c551f7fd8c72b3259927d96ba4775 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 24 Dec 2022 01:26:27 -0500 Subject: [PATCH 39/47] Remove sizeHint override and constant size --- include/MixerChannelView.h | 3 --- src/gui/MixerChannelView.cpp | 7 ------- 2 files changed, 10 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index cb6793481f9..a1b99bb3c89 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -40,8 +40,6 @@ namespace lmms::gui { - constexpr int MIXER_CHANNEL_WIDTH = 48; - constexpr int MIXER_CHANNEL_HEIGHT = 350; constexpr int MIXER_CHANNEL_INNER_BORDER_SIZE = 3; constexpr int MIXER_CHANNEL_OUTER_BORDER_SIZE = 1; @@ -65,7 +63,6 @@ namespace lmms::gui void mousePressEvent(QMouseEvent*) override; void mouseDoubleClickEvent(QMouseEvent*) override; bool eventFilter(QObject* dist, QEvent* event) override; - QSize sizeHint() const override; int channelIndex() const; void setChannelIndex(int index); diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index d6b20dc6429..e74d8a69d71 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -50,8 +50,6 @@ namespace lmms::gui { setAutoFillBackground(true); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); - setFixedWidth(MIXER_CHANNEL_WIDTH); - setMinimumHeight(MIXER_CHANNEL_HEIGHT); auto retainSizeWhenHidden = [](QWidget* widget) { @@ -288,11 +286,6 @@ namespace lmms::gui m_receiveArrow->setVisible(state == SendReceiveState::ReceiveFromThis); } - QSize MixerChannelView::sizeHint() const - { - return QSize{MIXER_CHANNEL_WIDTH, MIXER_CHANNEL_HEIGHT}; - } - QBrush MixerChannelView::backgroundActive() const { return m_backgroundActive; From ff7965aae20887476e798b0a25f6d614ac810f28 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 24 Dec 2022 16:14:03 -0500 Subject: [PATCH 40/47] Use sizeHint for mixerChannelSize + Leave auto fill background to false in MixerChannelView + Only set width for EffectRackView --- src/gui/MixerChannelView.cpp | 3 +-- src/gui/MixerView.cpp | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index e74d8a69d71..b9dfa521cb6 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -48,7 +48,6 @@ namespace lmms::gui m_mixerView(mixerView), m_channelIndex(channelIndex) { - setAutoFillBackground(true); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); auto retainSizeWhenHidden = [](QWidget* widget) @@ -121,7 +120,7 @@ namespace lmms::gui m_fader->setMaxPeak(dbfsToAmp(9)); m_effectRackView = new EffectRackView{&mixerChannel->m_fxChain, mixerView->m_racksWidget}; - m_effectRackView->setFixedSize(EffectRackView::DEFAULT_WIDTH, MIXER_CHANNEL_HEIGHT); + m_effectRackView->setFixedWidth(EffectRackView::DEFAULT_WIDTH); auto mainLayout = new QVBoxLayout{this}; mainLayout->addWidget(m_receiveArrow, 0, Qt::AlignHCenter); diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index a19669b3428..4dcfefe0c19 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -97,7 +97,7 @@ MixerView::MixerView() : MixerChannelView * masterView = m_mixerChannelViews[0]; ml->addWidget(masterView, 0, Qt::AlignTop); - QSize mixerChannelSize = masterView->size(); + auto mixerChannelSize = masterView->sizeHint(); // add mixer channels for( int i = 1; i < m_mixerChannelViews.size(); ++i ) @@ -139,7 +139,8 @@ MixerView::MixerView() : // add the stacked layout for the effect racks of mixer channels - ml->addWidget( m_racksWidget, 0, Qt::AlignTop | Qt::AlignRight ); + m_racksWidget->setFixedHeight(mixerChannelSize.height()); + ml->addWidget(m_racksWidget); setCurrentMixerChannel(m_mixerChannelViews[0]); From ac835dc8600c1efd9cc39434e2fbf57efc975052 Mon Sep 17 00:00:00 2001 From: sakertooth Date: Sat, 24 Dec 2022 16:20:01 -0500 Subject: [PATCH 41/47] Set margins to 4 on all sides in MixerChannelView --- src/gui/MixerChannelView.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index b9dfa521cb6..eefe707ebf9 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -123,6 +123,7 @@ namespace lmms::gui m_effectRackView->setFixedWidth(EffectRackView::DEFAULT_WIDTH); auto mainLayout = new QVBoxLayout{this}; + mainLayout->setContentsMargins(4, 4, 4, 4); mainLayout->addWidget(m_receiveArrow, 0, Qt::AlignHCenter); mainLayout->addWidget(m_sendButton, 0, Qt::AlignHCenter); mainLayout->addWidget(m_sendKnob, 0, Qt::AlignHCenter); From 27f91c356ab20ba259fbf9a9c42d99d3d9cf8abb Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Wed, 27 Dec 2023 21:53:09 +0100 Subject: [PATCH 42/47] Move solo and mute closer to each other Move the solo and mute buttons closer to each other in the mixer channels. Technically this is accomplished by putting them into their own layout with minimal margins and spacing. --- src/gui/MixerChannelView.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 9fdb2d498e7..7d355addf7f 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -114,6 +114,12 @@ namespace lmms::gui m_soloButton->setToolTip(tr("Solo this channel")); connect(&mixerChannel->m_soloModel, &BoolModel::dataChanged, mixerView, &MixerView::toggledSolo, Qt::DirectConnection); + QVBoxLayout * soloMuteLayout = new QVBoxLayout(); + soloMuteLayout->setContentsMargins(0, 0, 0, 0); + soloMuteLayout->setSpacing(0); + soloMuteLayout->addWidget(m_soloButton, 0, Qt::AlignHCenter); + soloMuteLayout->addWidget(m_muteButton, 0, Qt::AlignHCenter); + m_fader = new Fader{&mixerChannel->m_volumeModel, tr("Fader %1").arg(channelIndex), this}; m_fader->setLevelsDisplayedInDBFS(); m_fader->setMinPeak(dbfsToAmp(-42)); @@ -131,8 +137,7 @@ namespace lmms::gui mainLayout->addWidget(m_channelNumberLcd, 0, Qt::AlignHCenter); mainLayout->addStretch(); mainLayout->addWidget(m_renameLineEditView, 0, Qt::AlignHCenter); - mainLayout->addWidget(m_soloButton, 0, Qt::AlignHCenter); - mainLayout->addWidget(m_muteButton, 0, Qt::AlignHCenter); + mainLayout->addLayout(soloMuteLayout, 0); mainLayout->addWidget(m_fader, 0, Qt::AlignHCenter); connect(m_renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); From 29e4cfe45c60f85e9fda63b540572334d22b0c4d Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Wed, 27 Dec 2023 21:54:04 +0100 Subject: [PATCH 43/47] Fixes for CodeFactor --- src/gui/MixerChannelView.cpp | 1 - src/gui/SendButtonIndicator.cpp | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 7d355addf7f..885338e1c3f 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -354,7 +354,6 @@ namespace lmms::gui m_renameLineEditView->setFocus(); m_renameLineEdit->selectAll(); m_renameLineEdit->setFocus(); - } void MixerChannelView::renameFinished() diff --git a/src/gui/SendButtonIndicator.cpp b/src/gui/SendButtonIndicator.cpp index adca5b39a47..892e10a42c5 100644 --- a/src/gui/SendButtonIndicator.cpp +++ b/src/gui/SendButtonIndicator.cpp @@ -13,8 +13,6 @@ SendButtonIndicator:: SendButtonIndicator(QWidget * _parent, MixerChannelView * m_parent( _owner ), m_mv( _mv ) { - - // don't do any initializing yet, because the MixerView and MixerChannelView // that were passed to this constructor are not done with their constructors // yet. From f32d9ce0377e11f04d3ebd5b2ac397e1b645b2ed Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Fri, 29 Dec 2023 11:51:57 +0100 Subject: [PATCH 44/47] Code review changes Mostly whitespace and formatting changes: remove tabs, remove spaces in parameter lists, remove underscores from parameter names. Some lines have been shortened by introducing intermediate variables, e.g. in `MixerChannelView`. `MixerView` has many changes but only related to whitespace. Spaces have been introduced for if and for statements. Whitespace at round braces has been removed everywhere in the implementation file even if a line was not touched by the intial changes. Remove duplicate forward declaration of `MixerChannelView`. --- include/MixerChannelView.h | 2 +- include/SendButtonIndicator.h | 5 +- src/gui/MixerChannelView.cpp | 30 ++-- src/gui/MixerView.cpp | 148 +++++++++---------- src/gui/SendButtonIndicator.cpp | 12 +- src/gui/instrument/InstrumentTrackWindow.cpp | 2 +- 6 files changed, 102 insertions(+), 97 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index a1b99bb3c89..65a9a507fd9 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -61,7 +61,7 @@ namespace lmms::gui void paintEvent(QPaintEvent* event) override; void contextMenuEvent(QContextMenuEvent*) override; void mousePressEvent(QMouseEvent*) override; - void mouseDoubleClickEvent(QMouseEvent*) override; + void mouseDoubleClickEvent(QMouseEvent*) override; bool eventFilter(QObject* dist, QEvent* event) override; int channelIndex() const; diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index 151cbcfb0af..6ee391b0ef4 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -39,14 +39,13 @@ namespace gui class MixerChannelView; class MixerView; -class MixerChannelView; class SendButtonIndicator : public QLabel { public: - SendButtonIndicator(QWidget * _parent, MixerChannelView * _owner, MixerView * _mv); + SendButtonIndicator(QWidget * parent, MixerChannelView * owner, MixerView * mv); - void mousePressEvent( QMouseEvent * e ) override; + void mousePressEvent(QMouseEvent * e) override; void updateLightStatus(); private: diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 885338e1c3f..94b64886581 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -145,7 +145,7 @@ namespace lmms::gui void MixerChannelView::contextMenuEvent(QContextMenuEvent*) { - auto contextMenu = new CaptionMenu( Engine::mixer()->mixerChannel( m_channelIndex )->m_name, this ); + auto contextMenu = new CaptionMenu(Engine::mixer()->mixerChannel(m_channelIndex)->m_name, this); if (m_channelIndex != 0) // no move-options in master { @@ -178,11 +178,13 @@ namespace lmms::gui void MixerChannelView::paintEvent(QPaintEvent* event) { - const auto channel = Engine::mixer()->mixerChannel(m_channelIndex); + auto * mixer = Engine::mixer(); + const auto channel = mixer->mixerChannel(m_channelIndex); const bool muted = channel->m_muteModel.value(); const auto name = channel->m_name; const auto elidedName = elideName(name); - const auto isActive = m_mixerView->currentMixerChannel() == this; + const auto * mixerChannelView = m_mixerView->currentMixerChannel(); + const auto isActive = mixerChannelView == this; if (!m_inRename && m_renameLineEdit->text() != elidedName) { @@ -210,8 +212,9 @@ namespace lmms::gui painter.setPen(isActive ? strokeOuterActive() : strokeOuterInactive()); painter.drawRect(0, 0, width - MIXER_CHANNEL_OUTER_BORDER_SIZE, height - MIXER_CHANNEL_OUTER_BORDER_SIZE); - const auto sendToThis = Engine::mixer()->channelSendModel(m_mixerView->currentMixerChannel()->m_channelIndex, m_channelIndex) != nullptr; - const auto receiveFromThis = Engine::mixer()->channelSendModel(m_channelIndex, m_mixerView->currentMixerChannel()->m_channelIndex) != nullptr; + const auto & currentMixerChannelIndex = mixerChannelView->m_channelIndex; + const auto sendToThis = mixer->channelSendModel(currentMixerChannelIndex, m_channelIndex) != nullptr; + const auto receiveFromThis = mixer->channelSendModel(m_channelIndex, currentMixerChannelIndex) != nullptr; const auto sendReceiveStateNone = !sendToThis && !receiveFromThis; // Only one or none of them can be on @@ -389,10 +392,13 @@ namespace lmms::gui void MixerChannelView::selectColor() { const auto channel = Engine::mixer()->mixerChannel(m_channelIndex); - const auto newColor = ColorChooser{this} - .withPalette(ColorChooser::Palette::Mixer) - ->getColor(channel->color().value_or(backgroundActive().color())); + + const auto initialColor = channel->color().value_or(backgroundActive().color()); + const auto * colorChooser = ColorChooser{this}.withPalette(ColorChooser::Palette::Mixer); + const auto newColor = colorChooser->getColor(initialColor); + if (!newColor.isValid()) { return; } + channel->setColor(newColor); Engine::getSong()->setModified(); @@ -410,25 +416,25 @@ namespace lmms::gui void MixerChannelView::removeChannel() { auto mix = getGUI()->mixerView(); - mix->deleteChannel(m_channelIndex); + mix->deleteChannel(m_channelIndex); } void MixerChannelView::removeUnusedChannels() { auto mix = getGUI()->mixerView(); - mix->deleteUnusedChannels(); + mix->deleteUnusedChannels(); } void MixerChannelView::moveChannelLeft() { auto mix = getGUI()->mixerView(); - mix->moveChannelLeft(m_channelIndex); + mix->moveChannelLeft(m_channelIndex); } void MixerChannelView::moveChannelRight() { auto mix = getGUI()->mixerView(); - mix->moveChannelRight(m_channelIndex); + mix->moveChannelRight(m_channelIndex); } QString MixerChannelView::elideName(const QString& name) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index cc0a18414f4..e340709d8d9 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -54,7 +54,7 @@ namespace lmms::gui MixerView::MixerView() : QWidget(), - ModelView( nullptr, this ), + ModelView(nullptr, this), SerializingObjectHook() { #if QT_VERSION < 0x50C00 @@ -68,40 +68,40 @@ MixerView::MixerView() : #endif Mixer * m = Engine::mixer(); - m->setHook( this ); + m->setHook(this); //QPalette pal = palette(); - //pal.setColor( QPalette::Window, QColor( 72, 76, 88 ) ); - //setPalette( pal ); + //pal.setColor(QPalette::Window, QColor(72, 76, 88)); + //setPalette(pal); - setAutoFillBackground( true ); - setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); + setAutoFillBackground(true); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - setWindowTitle( tr( "Mixer" ) ); - setWindowIcon( embed::getIconPixmap( "mixer" ) ); + setWindowTitle(tr("Mixer")); + setWindowIcon(embed::getIconPixmap("mixer")); // main-layout auto ml = new QHBoxLayout{this}; // Set margins - ml->setContentsMargins( 0, 4, 0, 0 ); + ml->setContentsMargins(0, 4, 0, 0); // Channel area m_channelAreaWidget = new QWidget; - chLayout = new QHBoxLayout( m_channelAreaWidget ); - chLayout->setSizeConstraint( QLayout::SetMinimumSize ); - chLayout->setSpacing( 0 ); + chLayout = new QHBoxLayout(m_channelAreaWidget); + chLayout->setSizeConstraint(QLayout::SetMinimumSize); + chLayout->setSpacing(0); chLayout->setContentsMargins(0, 0, 0, 0); m_channelAreaWidget->setLayout(chLayout); // create rack layout before creating the first channel m_racksWidget = new QWidget; - m_racksLayout = new QStackedLayout( m_racksWidget ); - m_racksLayout->setContentsMargins( 0, 0, 0, 0 ); - m_racksWidget->setLayout( m_racksLayout ); + m_racksLayout = new QStackedLayout(m_racksWidget); + m_racksLayout->setContentsMargins(0, 0, 0, 0); + m_racksWidget->setLayout(m_racksLayout); // add master channel - m_mixerChannelViews.resize( m->numChannels() ); + m_mixerChannelViews.resize(m->numChannels()); m_mixerChannelViews[0] = new MixerChannelView(0, this, this); m_racksLayout->addWidget(m_mixerChannelViews[0]->m_effectRackView); @@ -112,7 +112,7 @@ MixerView::MixerView() : auto mixerChannelSize = masterView->sizeHint(); // add mixer channels - for( int i = 1; i < m_mixerChannelViews.size(); ++i ) + for (int i = 1; i < m_mixerChannelViews.size(); ++i) { m_mixerChannelViews[i] = new MixerChannelView(i, this, m_channelAreaWidget); chLayout->addWidget(m_mixerChannelViews[i]); @@ -123,31 +123,31 @@ MixerView::MixerView() : class ChannelArea : public QScrollArea { public: - ChannelArea( QWidget * parent, MixerView * mv ) : - QScrollArea( parent ), m_mv( mv ) {} + ChannelArea(QWidget * parent, MixerView * mv) : + QScrollArea(parent), m_mv(mv) {} ~ChannelArea() override = default; - void keyPressEvent( QKeyEvent * e ) override + void keyPressEvent(QKeyEvent * e) override { - m_mv->keyPressEvent( e ); + m_mv->keyPressEvent(e); } private: MixerView * m_mv; }; - channelArea = new ChannelArea( this, this ); - channelArea->setWidget( m_channelAreaWidget ); - channelArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - channelArea->setFrameStyle( QFrame::NoFrame ); + channelArea = new ChannelArea(this, this); + channelArea->setWidget(m_channelAreaWidget); + channelArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + channelArea->setFrameStyle(QFrame::NoFrame); channelArea->setMinimumWidth(mixerChannelSize.width() * 6); channelArea->setFixedHeight(mixerChannelSize.height() + - style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); - ml->addWidget( channelArea, 1, Qt::AlignTop ); + style()->pixelMetric(QStyle::PM_ScrollBarExtent)); + ml->addWidget(channelArea, 1, Qt::AlignTop); // show the add new mixer channel button auto newChannelBtn = new QPushButton(embed::getIconPixmap("new_channel"), QString(), this); - newChannelBtn->setObjectName( "newChannelBtn" ); - newChannelBtn->setFixedSize( mixerChannelSize ); - connect( newChannelBtn, SIGNAL(clicked()), this, SLOT(addNewChannel())); - ml->addWidget( newChannelBtn, 0, Qt::AlignTop ); + newChannelBtn->setObjectName("newChannelBtn"); + newChannelBtn->setFixedSize(mixerChannelSize); + connect(newChannelBtn, SIGNAL(clicked()), this, SLOT(addNewChannel())); + ml->addWidget(newChannelBtn, 0, Qt::AlignTop); // add the stacked layout for the effect racks of mixer channels @@ -159,23 +159,23 @@ MixerView::MixerView() : updateGeometry(); // timer for updating faders - connect( getGUI()->mainWindow(), SIGNAL(periodicUpdate()), + connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(updateFaders())); // add ourself to workspace - QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget( this ); + QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this); Qt::WindowFlags flags = subWin->windowFlags(); flags &= ~Qt::WindowMaximizeButtonHint; - subWin->setWindowFlags( flags ); - layout()->setSizeConstraint( QLayout::SetMinimumSize ); - subWin->layout()->setSizeConstraint( QLayout::SetMinAndMaxSize ); + subWin->setWindowFlags(flags); + layout()->setSizeConstraint(QLayout::SetMinimumSize); + subWin->layout()->setSizeConstraint(QLayout::SetMinAndMaxSize); - parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false ); - parentWidget()->move( 5, 310 ); + parentWidget()->setAttribute(Qt::WA_DeleteOnClose, false); + parentWidget()->move(5, 310); // we want to receive dataChanged-signals in order to update - setModel( m ); + setModel(m); } @@ -202,7 +202,7 @@ int MixerView::addNewChannel() void MixerView::refreshDisplay() { // delete all views and re-add them - for( int i = 1; iremoveWidget(m_mixerChannelViews[i]); m_racksLayout->removeWidget(m_mixerChannelViews[i]->m_effectRackView); @@ -211,18 +211,18 @@ void MixerView::refreshDisplay() // re-add the views m_mixerChannelViews.resize(Engine::mixer()->numChannels()); - for( int i = 1; i < m_mixerChannelViews.size(); ++i ) + for (int i = 1; i < m_mixerChannelViews.size(); ++i) { m_mixerChannelViews[i] = new MixerChannelView(i, this, m_channelAreaWidget); chLayout->addWidget(m_mixerChannelViews[i]); - m_racksLayout->addWidget( m_mixerChannelViews[i]->m_effectRackView); + m_racksLayout->addWidget(m_mixerChannelViews[i]->m_effectRackView); } // set selected mixer channel to 0 - setCurrentMixerChannel( 0 ); + setCurrentMixerChannel(0); // update all mixer lines - for( int i = 0; i < m_mixerChannelViews.size(); ++i ) + for (int i = 0; i < m_mixerChannelViews.size(); ++i) { updateMixerChannel(i); } @@ -258,17 +258,17 @@ void MixerView::updateMaxChannelSelector() } -void MixerView::saveSettings( QDomDocument & _doc, QDomElement & _this ) +void MixerView::saveSettings(QDomDocument & _doc, QDomElement & _this) { - MainWindow::saveWidgetState( this, _this ); + MainWindow::saveWidgetState(this, _this); } -void MixerView::loadSettings( const QDomElement & _this ) +void MixerView::loadSettings(const QDomElement & _this) { - MainWindow::restoreWidgetState( this, _this ); + MainWindow::restoreWidgetState(this, _this); } @@ -289,7 +289,7 @@ void MixerView::setCurrentMixerChannel(MixerChannelView* channel) m_racksLayout->setCurrentWidget(m_mixerChannelViews[channel->channelIndex()]->m_effectRackView); // set up send knob - for(int i = 0; i < m_mixerChannelViews.size(); ++i) + for (int i = 0; i < m_mixerChannelViews.size(); ++i) { updateMixerChannel(i); } @@ -303,10 +303,10 @@ void MixerView::updateMixerChannel(int index) // does current channel send to this channel? int selIndex = m_currentMixerChannel->channelIndex(); auto thisLine = m_mixerChannelViews[index]; - thisLine->setToolTip( Engine::mixer()->mixerChannel( index )->m_name ); + thisLine->setToolTip(Engine::mixer()->mixerChannel(index)->m_name); FloatModel * sendModel = mix->channelSendModel(selIndex, index); - if( sendModel == nullptr ) + if (sendModel == nullptr) { // does not send, hide send knob thisLine->m_sendKnob->setVisible(false); @@ -319,7 +319,7 @@ void MixerView::updateMixerChannel(int index) } // disable the send button if it would cause an infinite loop - thisLine->m_sendButton->setVisible(! mix->isInfiniteLoop(selIndex, index)); + thisLine->m_sendButton->setVisible(!mix->isInfiniteLoop(selIndex, index)); thisLine->m_sendButton->updateLightStatus(); thisLine->update(); } @@ -328,7 +328,7 @@ void MixerView::updateMixerChannel(int index) void MixerView::deleteChannel(int index) { // can't delete master - if( index == 0 ) return; + if (index == 0) return; // if there is no user confirmation, do nothing if (!confirmRemoval(index)) @@ -347,7 +347,7 @@ void MixerView::deleteChannel(int index) Engine::mixer()->deleteChannel(index); chLayout->removeWidget(m_mixerChannelViews[index]); - m_racksLayout->removeWidget( m_mixerChannelViews[index]); + m_racksLayout->removeWidget(m_mixerChannelViews[index]); // delete MixerChannelView later to prevent a crash when deleting from context menu m_mixerChannelViews[index]->hide(); m_mixerChannelViews[index]->deleteLater(); @@ -430,16 +430,16 @@ void MixerView::deleteUnusedChannels() void MixerView::moveChannelLeft(int index, int focusIndex) { // can't move master or first channel left or last channel right - if( index <= 1 || index >= m_mixerChannelViews.size() ) return; + if (index <= 1 || index >= m_mixerChannelViews.size()) return; Mixer *m = Engine::mixer(); // Move instruments channels - m->moveChannelLeft( index ); + m->moveChannelLeft(index); // Update widgets models - m_mixerChannelViews[index]->setChannelIndex( index ); - m_mixerChannelViews[index - 1]->setChannelIndex( index - 1 ); + m_mixerChannelViews[index]->setChannelIndex(index); + m_mixerChannelViews[index - 1]->setChannelIndex(index - 1); // Focus on new position setCurrentMixerChannel(focusIndex); @@ -449,14 +449,14 @@ void MixerView::moveChannelLeft(int index, int focusIndex) void MixerView::moveChannelLeft(int index) { - moveChannelLeft( index, index - 1 ); + moveChannelLeft(index, index - 1); } void MixerView::moveChannelRight(int index) { - moveChannelLeft( index + 1, index + 1 ); + moveChannelLeft(index + 1, index + 1); } @@ -475,7 +475,7 @@ void MixerView::keyPressEvent(QKeyEvent * e) deleteChannel(m_currentMixerChannel->channelIndex()); break; case Qt::Key_Left: - if( e->modifiers() & Qt::AltModifier ) + if (e->modifiers() & Qt::AltModifier) { moveChannelLeft(m_currentMixerChannel->channelIndex()); } @@ -486,7 +486,7 @@ void MixerView::keyPressEvent(QKeyEvent * e) } break; case Qt::Key_Right: - if( e->modifiers() & Qt::AltModifier ) + if (e->modifiers() & Qt::AltModifier) { moveChannelRight(m_currentMixerChannel->channelIndex()); } @@ -497,7 +497,7 @@ void MixerView::keyPressEvent(QKeyEvent * e) } break; case Qt::Key_Insert: - if ( e->modifiers() & Qt::ShiftModifier ) + if (e->modifiers() & Qt::ShiftModifier) { addNewChannel(); } @@ -512,9 +512,9 @@ void MixerView::keyPressEvent(QKeyEvent * e) -void MixerView::closeEvent( QCloseEvent * _ce ) +void MixerView::closeEvent(QCloseEvent * _ce) { - if( parentWidget() ) + if (parentWidget()) { parentWidget()->hide(); } @@ -555,31 +555,31 @@ void MixerView::updateFaders() m->mixerChannel(0)->m_peakLeft *= Engine::audioEngine()->masterGain(); m->mixerChannel(0)->m_peakRight *= Engine::audioEngine()->masterGain(); - for( int i = 0; i < m_mixerChannelViews.size(); ++i ) + for (int i = 0; i < m_mixerChannelViews.size(); ++i) { const float opl = m_mixerChannelViews[i]->m_fader->getPeak_L(); const float opr = m_mixerChannelViews[i]->m_fader->getPeak_R(); const float fallOff = 1.25; - if( m->mixerChannel(i)->m_peakLeft >= opl/fallOff ) + if (m->mixerChannel(i)->m_peakLeft >= opl/fallOff) { - m_mixerChannelViews[i]->m_fader->setPeak_L( m->mixerChannel(i)->m_peakLeft ); + m_mixerChannelViews[i]->m_fader->setPeak_L(m->mixerChannel(i)->m_peakLeft); // Set to -1 so later we'll know if this value has been refreshed yet. m->mixerChannel(i)->m_peakLeft = -1; } - else if( m->mixerChannel(i)->m_peakLeft != -1 ) + else if (m->mixerChannel(i)->m_peakLeft != -1) { - m_mixerChannelViews[i]->m_fader->setPeak_L( opl/fallOff ); + m_mixerChannelViews[i]->m_fader->setPeak_L(opl/fallOff); } - if( m->mixerChannel(i)->m_peakRight >= opr/fallOff ) + if (m->mixerChannel(i)->m_peakRight >= opr/fallOff) { - m_mixerChannelViews[i]->m_fader->setPeak_R( m->mixerChannel(i)->m_peakRight ); + m_mixerChannelViews[i]->m_fader->setPeak_R(m->mixerChannel(i)->m_peakRight); // Set to -1 so later we'll know if this value has been refreshed yet. m->mixerChannel(i)->m_peakRight = -1; } - else if( m->mixerChannel(i)->m_peakRight != -1 ) + else if (m->mixerChannel(i)->m_peakRight != -1) { - m_mixerChannelViews[i]->m_fader->setPeak_R( opr/fallOff ); + m_mixerChannelViews[i]->m_fader->setPeak_R(opr/fallOff); } } } diff --git a/src/gui/SendButtonIndicator.cpp b/src/gui/SendButtonIndicator.cpp index 892e10a42c5..9670a5e1710 100644 --- a/src/gui/SendButtonIndicator.cpp +++ b/src/gui/SendButtonIndicator.cpp @@ -8,10 +8,10 @@ namespace lmms::gui { -SendButtonIndicator:: SendButtonIndicator(QWidget * _parent, MixerChannelView * _owner, MixerView * _mv) : - QLabel( _parent ), - m_parent( _owner ), - m_mv( _mv ) +SendButtonIndicator:: SendButtonIndicator(QWidget * parent, MixerChannelView * owner, MixerView * mv) : + QLabel(parent), + m_parent(owner), + m_mv(mv) { // don't do any initializing yet, because the MixerView and MixerChannelView // that were passed to this constructor are not done with their constructors @@ -19,13 +19,13 @@ SendButtonIndicator:: SendButtonIndicator(QWidget * _parent, MixerChannelView * setPixmap(m_qpmOff); } -void SendButtonIndicator::mousePressEvent( QMouseEvent * e ) +void SendButtonIndicator::mousePressEvent(QMouseEvent * e) { Mixer * mix = Engine::mixer(); int from = m_mv->currentMixerChannel()->channelIndex(); int to = m_parent->channelIndex(); FloatModel * sendModel = mix->channelSendModel(from, to); - if( sendModel == nullptr ) + if (sendModel == nullptr) { // not sending. create a mixer send. mix->createChannelSend( from, to ); diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 0d868089caf..fa9be2a5055 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -206,7 +206,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // setup spinbox for selecting Mixer-channel - m_mixerChannelNumber = new MixerChannelLcdSpinBox( 2, nullptr, tr( "Mixer channel" ), m_itv ); + m_mixerChannelNumber = new MixerChannelLcdSpinBox(2, nullptr, tr("Mixer channel"), m_itv); basicControlsLayout->addWidget( m_mixerChannelNumber, 0, 6 ); basicControlsLayout->setAlignment( m_mixerChannelNumber, widgetAlignment ); From 69509980994d0a58dbdd879b8eea78ea79232e34 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Fri, 29 Dec 2023 12:09:08 +0100 Subject: [PATCH 45/47] Adjust parameter order in MixerChannelView's constructor Make the parent `QWidget` the first parameter as it is a Qt convention. The default parameter had to be removed due to this. --- include/MixerChannelView.h | 2 +- src/gui/MixerChannelView.cpp | 2 +- src/gui/MixerView.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index 65a9a507fd9..fc9844a4c8b 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -57,7 +57,7 @@ namespace lmms::gui None, SendToThis, ReceiveFromThis }; - MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent = nullptr); + MixerChannelView(QWidget* parent, MixerView* mixerView, int channelIndex); void paintEvent(QPaintEvent* event) override; void contextMenuEvent(QContextMenuEvent*) override; void mousePressEvent(QMouseEvent*) override; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 94b64886581..aad76699bb2 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -43,7 +43,7 @@ namespace lmms::gui { - MixerChannelView::MixerChannelView(int channelIndex, MixerView* mixerView, QWidget* parent) : + MixerChannelView::MixerChannelView(QWidget* parent, MixerView* mixerView, int channelIndex) : QWidget(parent), m_mixerView(mixerView), m_channelIndex(channelIndex) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index e340709d8d9..b7a1daa9bb6 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -102,7 +102,7 @@ MixerView::MixerView() : // add master channel m_mixerChannelViews.resize(m->numChannels()); - m_mixerChannelViews[0] = new MixerChannelView(0, this, this); + m_mixerChannelViews[0] = new MixerChannelView(this, this, 0); m_racksLayout->addWidget(m_mixerChannelViews[0]->m_effectRackView); @@ -114,7 +114,7 @@ MixerView::MixerView() : // add mixer channels for (int i = 1; i < m_mixerChannelViews.size(); ++i) { - m_mixerChannelViews[i] = new MixerChannelView(i, this, m_channelAreaWidget); + m_mixerChannelViews[i] = new MixerChannelView(m_channelAreaWidget, this, i); chLayout->addWidget(m_mixerChannelViews[i]); } @@ -187,7 +187,7 @@ int MixerView::addNewChannel() Mixer * mix = Engine::mixer(); int newChannelIndex = mix->createChannel(); - m_mixerChannelViews.push_back(new MixerChannelView(newChannelIndex, this, m_channelAreaWidget)); + m_mixerChannelViews.push_back(new MixerChannelView(m_channelAreaWidget, this, newChannelIndex)); chLayout->addWidget(m_mixerChannelViews[newChannelIndex]); m_racksLayout->addWidget(m_mixerChannelViews[newChannelIndex]->m_effectRackView); @@ -213,7 +213,7 @@ void MixerView::refreshDisplay() m_mixerChannelViews.resize(Engine::mixer()->numChannels()); for (int i = 1; i < m_mixerChannelViews.size(); ++i) { - m_mixerChannelViews[i] = new MixerChannelView(i, this, m_channelAreaWidget); + m_mixerChannelViews[i] = new MixerChannelView(m_channelAreaWidget, this, i); chLayout->addWidget(m_mixerChannelViews[i]); m_racksLayout->addWidget(m_mixerChannelViews[i]->m_effectRackView); } From 1d3ee1858b81dde9f9d3dd33dd0cf61dba1ca0d9 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Fri, 29 Dec 2023 12:28:14 +0100 Subject: [PATCH 46/47] Move styling of rename line edit into style sheets Move the style of the `QGraphicsView` for the rename line edit from the code into the style sheets of the default and classic theme. --- data/themes/classic/style.css | 5 +++++ data/themes/default/style.css | 5 +++++ src/gui/MixerChannelView.cpp | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/data/themes/classic/style.css b/data/themes/classic/style.css index 0d4f70defcb..3ef39765122 100644 --- a/data/themes/classic/style.css +++ b/data/themes/classic/style.css @@ -643,6 +643,11 @@ lmms--gui--MixerChannelView { qproperty-strokeInnerInactive: rgba( 255, 255, 255, 50 ); } +lmms--gui--MixerChannelView QGraphicsView { + background: transparent; + border-style: none; +} + /* persistent peak markers for fx peak meters */ lmms--gui--Fader { qproperty-peakGreen: rgb( 74, 253, 133); diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 8d13b30d467..3a8f411de78 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -684,6 +684,11 @@ lmms--gui--MixerChannelView { qproperty-strokeInnerInactive: #0C0D0F; } +lmms--gui--MixerChannelView QGraphicsView { + background: transparent; + border-style: none; +} + /* persistent peak markers for fx peak meters */ lmms--gui--Fader { qproperty-peakGreen: #0ad45c; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index aad76699bb2..8428df8bbc2 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -79,7 +79,6 @@ namespace lmms::gui auto renameLineEditScene = new QGraphicsScene{}; m_renameLineEditView = new QGraphicsView{}; - m_renameLineEditView->setStyleSheet("border-style: none; background: transparent;"); m_renameLineEditView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_renameLineEditView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_renameLineEditView->setAttribute(Qt::WA_TransparentForMouseEvents, true); From 92878ce4030eff3652e35a10a83793b455715340 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Sat, 30 Dec 2023 11:39:54 +0100 Subject: [PATCH 47/47] More code review changes Fix spaces between types and references/pointers, e.g. use `const QBrush& c` instead of `const QBrush & c`. Remove underscores from parameter names. Remove spaces near parentheses. Replace tabs with spaces. Introduce intermediate variable to resolve "hanging" + operator. Replace the connection for the periodic fader updates with one that uses function pointers instead of `SIGNAL` and `SLOT`. --- include/MixerChannelView.h | 8 ++++---- include/MixerView.h | 22 +++++++++++----------- include/SendButtonIndicator.h | 10 +++++----- src/gui/MixerChannelView.cpp | 16 ++++++++-------- src/gui/MixerView.cpp | 32 +++++++++++++++++--------------- src/gui/SendButtonIndicator.cpp | 16 ++++++++-------- 6 files changed, 53 insertions(+), 51 deletions(-) diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index fc9844a4c8b..8d2306f919f 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -71,16 +71,16 @@ namespace lmms::gui void setSendReceiveState(const SendReceiveState& state); QBrush backgroundActive() const; - void setBackgroundActive(const QBrush & c); + void setBackgroundActive(const QBrush& c); QColor strokeOuterActive() const; - void setStrokeOuterActive(const QColor & c); + void setStrokeOuterActive(const QColor& c); QColor strokeOuterInactive() const; - void setStrokeOuterInactive(const QColor & c ); + void setStrokeOuterInactive(const QColor& c); QColor strokeInnerActive() const; - void setStrokeInnerActive(const QColor & c ); + void setStrokeInnerActive(const QColor& c); QColor strokeInnerInactive() const; void setStrokeInnerInactive(const QColor& c); diff --git a/include/MixerView.h b/include/MixerView.h index c3f361ee0e8..a477864810e 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -46,17 +46,17 @@ class LMMS_EXPORT MixerView : public QWidget, public ModelView, Q_OBJECT public: MixerView(); - void keyPressEvent(QKeyEvent * e) override; + void keyPressEvent(QKeyEvent* e) override; - void saveSettings( QDomDocument & _doc, QDomElement & _this ) override; - void loadSettings( const QDomElement & _this ) override; + void saveSettings(QDomDocument& doc, QDomElement& domElement) override; + void loadSettings(const QDomElement& domElement) override; inline MixerChannelView* currentMixerChannel() { return m_currentMixerChannel; } - inline MixerChannelView * channelView(int index) + inline MixerChannelView* channelView(int index) { return m_mixerChannelViews[index]; } @@ -93,22 +93,22 @@ public slots: int addNewChannel(); protected: - void closeEvent( QCloseEvent * _ce ) override; + void closeEvent(QCloseEvent* ce) override; private slots: void updateFaders(); void toggledSolo(); private: - QVector m_mixerChannelViews; + QVector m_mixerChannelViews; MixerChannelView* m_currentMixerChannel; - QScrollArea * channelArea; - QHBoxLayout * chLayout; - QWidget * m_channelAreaWidget; - QStackedLayout * m_racksLayout; - QWidget * m_racksWidget; + QScrollArea* channelArea; + QHBoxLayout* chLayout; + QWidget* m_channelAreaWidget; + QStackedLayout* m_racksLayout; + QWidget* m_racksWidget; void updateMaxChannelSelector(); diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index 6ee391b0ef4..9e941792648 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -43,19 +43,19 @@ class MixerView; class SendButtonIndicator : public QLabel { public: - SendButtonIndicator(QWidget * parent, MixerChannelView * owner, MixerView * mv); + SendButtonIndicator(QWidget* parent, MixerChannelView* owner, MixerView* mv); - void mousePressEvent(QMouseEvent * e) override; + void mousePressEvent(QMouseEvent* e) override; void updateLightStatus(); private: - MixerChannelView * m_parent; - MixerView * m_mv; + MixerChannelView* m_parent; + MixerView* m_mv; QPixmap m_qpmOff = embed::getIconPixmap("mixer_send_off", 29, 20); QPixmap m_qpmOn = embed::getIconPixmap("mixer_send_on", 29, 20); - FloatModel * getSendModel(); + FloatModel* getSendModel(); }; diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 8428df8bbc2..0f8ccedeac8 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -69,13 +69,13 @@ namespace lmms::gui const auto mixerChannel = Engine::mixer()->mixerChannel(channelIndex); const auto mixerName = mixerChannel->m_name; - setToolTip(mixerName); + setToolTip(mixerName); m_renameLineEdit = new QLineEdit{mixerName, nullptr}; m_renameLineEdit->setFixedWidth(65); m_renameLineEdit->setFont(pointSizeF(font(), 7.5f)); m_renameLineEdit->setReadOnly(true); - m_renameLineEdit->installEventFilter(this); + m_renameLineEdit->installEventFilter(this); auto renameLineEditScene = new QGraphicsScene{}; m_renameLineEditView = new QGraphicsView{}; @@ -113,7 +113,7 @@ namespace lmms::gui m_soloButton->setToolTip(tr("Solo this channel")); connect(&mixerChannel->m_soloModel, &BoolModel::dataChanged, mixerView, &MixerView::toggledSolo, Qt::DirectConnection); - QVBoxLayout * soloMuteLayout = new QVBoxLayout(); + QVBoxLayout* soloMuteLayout = new QVBoxLayout(); soloMuteLayout->setContentsMargins(0, 0, 0, 0); soloMuteLayout->setSpacing(0); soloMuteLayout->addWidget(m_soloButton, 0, Qt::AlignHCenter); @@ -298,7 +298,7 @@ namespace lmms::gui return m_backgroundActive; } - void MixerChannelView::setBackgroundActive(const QBrush & c) + void MixerChannelView::setBackgroundActive(const QBrush& c) { m_backgroundActive = c; } @@ -308,7 +308,7 @@ namespace lmms::gui return m_strokeOuterActive; } - void MixerChannelView::setStrokeOuterActive(const QColor & c) + void MixerChannelView::setStrokeOuterActive(const QColor& c) { m_strokeOuterActive = c; } @@ -394,11 +394,11 @@ namespace lmms::gui const auto initialColor = channel->color().value_or(backgroundActive().color()); const auto * colorChooser = ColorChooser{this}.withPalette(ColorChooser::Palette::Mixer); - const auto newColor = colorChooser->getColor(initialColor); + const auto newColor = colorChooser->getColor(initialColor); - if (!newColor.isValid()) { return; } + if (!newColor.isValid()) { return; } - channel->setColor(newColor); + channel->setColor(newColor); Engine::getSong()->setModified(); update(); diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index b7a1daa9bb6..f20b60a3842 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -123,23 +123,25 @@ MixerView::MixerView() : class ChannelArea : public QScrollArea { public: - ChannelArea(QWidget * parent, MixerView * mv) : + ChannelArea(QWidget* parent, MixerView* mv) : QScrollArea(parent), m_mv(mv) {} ~ChannelArea() override = default; - void keyPressEvent(QKeyEvent * e) override + void keyPressEvent(QKeyEvent* e) override { m_mv->keyPressEvent(e); } private: - MixerView * m_mv; + MixerView* m_mv; }; channelArea = new ChannelArea(this, this); channelArea->setWidget(m_channelAreaWidget); channelArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); channelArea->setFrameStyle(QFrame::NoFrame); channelArea->setMinimumWidth(mixerChannelSize.width() * 6); - channelArea->setFixedHeight(mixerChannelSize.height() + - style()->pixelMetric(QStyle::PM_ScrollBarExtent)); + + int const scrollBarExtent = style()->pixelMetric(QStyle::PM_ScrollBarExtent); + channelArea->setFixedHeight(mixerChannelSize.height() + scrollBarExtent); + ml->addWidget(channelArea, 1, Qt::AlignTop); // show the add new mixer channel button @@ -158,13 +160,13 @@ MixerView::MixerView() : updateGeometry(); - // timer for updating faders - connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), - this, SLOT(updateFaders())); + auto* mainWindow = getGUI()->mainWindow(); + // timer for updating faders + connect(mainWindow, &MainWindow::periodicUpdate, this, &MixerView::updateFaders); // add ourself to workspace - QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this); + QMdiSubWindow* subWin = mainWindow->addWindowedWidget(this); Qt::WindowFlags flags = subWin->windowFlags(); flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags(flags); @@ -258,17 +260,17 @@ void MixerView::updateMaxChannelSelector() } -void MixerView::saveSettings(QDomDocument & _doc, QDomElement & _this) +void MixerView::saveSettings(QDomDocument& doc, QDomElement& domElement) { - MainWindow::saveWidgetState(this, _this); + MainWindow::saveWidgetState(this, domElement); } -void MixerView::loadSettings(const QDomElement & _this) +void MixerView::loadSettings(const QDomElement& domElement) { - MainWindow::restoreWidgetState(this, _this); + MainWindow::restoreWidgetState(this, domElement); } @@ -512,7 +514,7 @@ void MixerView::keyPressEvent(QKeyEvent * e) -void MixerView::closeEvent(QCloseEvent * _ce) +void MixerView::closeEvent(QCloseEvent * ce) { if (parentWidget()) { @@ -522,7 +524,7 @@ void MixerView::closeEvent(QCloseEvent * _ce) { hide(); } - _ce->ignore(); + ce->ignore(); } diff --git a/src/gui/SendButtonIndicator.cpp b/src/gui/SendButtonIndicator.cpp index 9670a5e1710..4fb20cc315e 100644 --- a/src/gui/SendButtonIndicator.cpp +++ b/src/gui/SendButtonIndicator.cpp @@ -8,7 +8,7 @@ namespace lmms::gui { -SendButtonIndicator:: SendButtonIndicator(QWidget * parent, MixerChannelView * owner, MixerView * mv) : +SendButtonIndicator:: SendButtonIndicator(QWidget* parent, MixerChannelView* owner, MixerView* mv) : QLabel(parent), m_parent(owner), m_mv(mv) @@ -19,30 +19,30 @@ SendButtonIndicator:: SendButtonIndicator(QWidget * parent, MixerChannelView * o setPixmap(m_qpmOff); } -void SendButtonIndicator::mousePressEvent(QMouseEvent * e) +void SendButtonIndicator::mousePressEvent(QMouseEvent* e) { - Mixer * mix = Engine::mixer(); + Mixer* mix = Engine::mixer(); int from = m_mv->currentMixerChannel()->channelIndex(); int to = m_parent->channelIndex(); - FloatModel * sendModel = mix->channelSendModel(from, to); + FloatModel* sendModel = mix->channelSendModel(from, to); if (sendModel == nullptr) { // not sending. create a mixer send. - mix->createChannelSend( from, to ); + mix->createChannelSend(from, to); } else { // sending. delete the mixer send. - mix->deleteChannelSend( from, to ); + mix->deleteChannelSend(from, to); } m_mv->updateMixerChannel(m_parent->channelIndex()); updateLightStatus(); } -FloatModel * SendButtonIndicator::getSendModel() +FloatModel* SendButtonIndicator::getSendModel() { - Mixer * mix = Engine::mixer(); + Mixer* mix = Engine::mixer(); return mix->channelSendModel(m_mv->currentMixerChannel()->channelIndex(), m_parent->channelIndex()); }