Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to hide the menu bar with [Controls],show_menubar #3184

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions res/skins/Deere/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,18 @@ WPushButton[value="2"]:hover,
border: 1px solid #0080BE;
}

#MenubarToggle {
font-size: 14px;
font-weight: bold;
color: #888;
margin-top: 2px;
background-color: transparent;
border: none;
}
#MenubarToggle[hover="true"] {
color: #aaa;
}

#HotcueButton {
border: none;
}
Expand Down
13 changes: 13 additions & 0 deletions res/skins/Deere/tool_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
<SizePolicy>min,f</SizePolicy>
<Children>

<!-- If [Controls],show_menubar is not available on macOS,
hide this with "max-width: 0px;" in style-mac.qss -->
<Template src="skin:left_2state_button.xml">
<SetVariable name="TooltipId">FIXME</SetVariable>
<SetVariable name="ObjectName">MenubarToggle</SetVariable>
<SetVariable name="MinimumSize">70,22</SetVariable>
<SetVariable name="MaximumSize">70,22</SetVariable>
<SetVariable name="SizePolicy">f,f</SetVariable>
<SetVariable name="state_0_text">&#x2630; MENU</SetVariable>
<SetVariable name="state_1_text">&#x2630; MENU</SetVariable>
<SetVariable name="left_connection_control">[Controls],show_menubar</SetVariable>
</Template>

<Battery>
<ObjectName>Battery</ObjectName>
<Size>24,24</Size>
Expand Down
3 changes: 2 additions & 1 deletion res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ WEffectSelector QAbstractScrollArea,
#PreviewLabel,
WBeatSpinBox,
#spinBoxTransition,
WTime {
WTime,
#MenubarToggle {
font-size: 14px;
text-align: left;
}
Expand Down
7 changes: 5 additions & 2 deletions res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1267,13 +1267,16 @@ WEffectSelector,
#PreviewLabel,
WEffectSelector QAbstractScrollArea,
#fadeModeCombobox QAbstractScrollArea,
#GuiToggleButton[displayValue="0"],
#GuiToggleButton[displayValue="0"], #MenubarToggle,
#RecDuration[highlight="0"],
#BroadcastButton[displayValue="0"],
#SkinSettingsToggle[displayValue="0"],
WLibrary QLabel {
color: #777;
}
}/*
#MenubarToggle[hover="true"] {
color: #999;
}*/

/* Darker grey for knob labels & inactive decks/units */
#KnobLabel,
Expand Down
16 changes: 16 additions & 0 deletions res/skins/LateNight/toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
<SizePolicy>e,min</SizePolicy>
<Children>

<!-- If [Controls],show_menubar is not available on macOS,
hide those two items with stylesheet with "max-width: 0px;" -->
<Template src="skin:/controls/button_2state.xml">
<SetVariable name="TooltipId">FIXME</SetVariable>
<SetVariable name="ObjectName">MenubarToggle</SetVariable>
<SetVariable name="Size">70f,20f</SetVariable>
<SetVariable name="state_0_text">&#x2630; MENU</SetVariable>
<SetVariable name="state_1_text">&#x2630; MENU</SetVariable>
<SetVariable name="ConfigKey">[Controls],show_menubar</SetVariable>
</Template>

<WidgetGroup>
<ObjectName>MenubarToggleSeparator</ObjectName>
<Size>12f,9min</Size>
</WidgetGroup>

<Template src="skin:/controls/button_2state.xml">
<SetVariable name="TooltipId">maximize_library</SetVariable>
<SetVariable name="ObjectName">GuiToggleButton</SetVariable>
Expand Down
1 change: 1 addition & 0 deletions res/skins/Shade/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<attribute config_key="[Master],num_decks">2</attribute>
<attribute config_key="[Master],num_samplers">8</attribute>
<attribute config_key="[Master],num_preview_decks">1</attribute>
<attribute config_key="[Controls],show_menubar">1</attribute>
<!--Optionally, make elements visible on skin load-->
<attribute persist="true" config_key="[Spinny1],show_spinny">1</attribute>
<attribute persist="true" config_key="[Spinny2],show_spinny">1</attribute>
Expand Down
10 changes: 10 additions & 0 deletions res/skins/Tango/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ WWidgetGroup {
qproperty-layoutAlignment: 'AlignLeft | AlignVCenter';
}

#MenubarToggle {
font-size: 14px;
font-weight: bold;
color: #888;
margin-top: 2px;
}
#MenubarToggle[hover="true"] {
color: #aaa;
}

#GuiToggleButton,
#GuiToggleButton2,
#RecordingButton {
Expand Down
12 changes: 12 additions & 0 deletions res/skins/Tango/topbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ Description:

<WidgetGroup><Size>2f,0min</Size></WidgetGroup>


<!-- If [Controls],show_menubar is not available on macOS,
hide this with "max-width: 0px;" in style-mac.qss -->
<Template src="skin:button_2state.xml">
<SetVariable name="TooltipId">FIXME</SetVariable>
<SetVariable name="ObjectName">MenubarToggle</SetVariable>
<SetVariable name="Size">70f,22f</SetVariable>
<SetVariable name="state_0_text">&#x2630; MENU</SetVariable>
<SetVariable name="state_1_text">&#x2630; MENU</SetVariable>
<SetVariable name="ConfigKey">[Controls],show_menubar</SetVariable>
</Template>

<PushButton>
<Size>102f,24f</Size>
<NumberStates>2</NumberStates>
Expand Down
19 changes: 19 additions & 0 deletions src/widget/wmainmenubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ WMainMenuBar::WMainMenuBar(QWidget* pParent, UserSettingsPointer pConfig,
}

void WMainMenuBar::initialize() {
// Allow hiding the menu bar
m_bShowMenuBar = std::make_unique<ControlPushButton>(ConfigKey("[Controls]", "show_menubar"), false, 1.0);
m_bShowMenuBar->setButtonMode(ControlPushButton::TOGGLE);
connect(m_bShowMenuBar.get(),
&ControlPushButton::valueChanged,
this,
&WMainMenuBar::showHideMenuBar);

// FILE MENU
QMenu* pFileMenu = new QMenu(tr("&File"));

Expand Down Expand Up @@ -599,6 +607,17 @@ void WMainMenuBar::initialize() {
addMenu(pHelpMenu);
}

void WMainMenuBar::showHideMenuBar(double v) {
if (v > 0) {
int minHeight = sizeHint().height();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to read this after initialization, or keep it here in case fonts or decoration or whatever is changed by OS measures while Mixxx runs?

if (minHeight > 0) {
setFixedHeight(minHeight);
}
} else {
setFixedHeight(0);
}
}

void WMainMenuBar::onLibraryScanStarted() {
emit internalLibraryScanActive(true);
}
Expand Down
5 changes: 5 additions & 0 deletions src/widget/wmainmenubar.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
#include <QScopedPointer>

#include "control/controlproxy.h"
#include "control/controlobject.h"
#include "control/controlpushbutton.h"
#include "preferences/configobject.h"
#include "preferences/usersettings.h"
#include "util/memory.h"

class VisibilityControlConnection : public QObject {
Q_OBJECT
Expand All @@ -36,6 +39,7 @@ class WMainMenuBar : public QMenuBar {
ConfigObject<ConfigValueKbd>* pKbdConfig);

public slots:
void showHideMenuBar(double v);
void onLibraryScanStarted();
void onLibraryScanFinished();
void onRecordingStateChange(bool recording);
Expand Down Expand Up @@ -83,6 +87,7 @@ class WMainMenuBar : public QMenuBar {
void initialize();
void createVisibilityControl(QAction* pAction, const ConfigKey& key);

std::unique_ptr<ControlPushButton> m_bShowMenuBar;
UserSettingsPointer m_pConfig;
ConfigObject<ConfigValueKbd>* m_pKbdConfig;
QList<QAction*> m_loadToDeckActions;
Expand Down