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

Fullscreen toggle rework #11313

Closed
wants to merge 14 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
6 changes: 4 additions & 2 deletions res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ WOverview QLabel {
/************** font sizes / alignment ****************************************/
/************** font settings *************************************************/



WFullScreenHint QPushButton {
border-width: 2px 2px 2px 2px;
border-image: url(skin:/classic/buttons/spinbox_elevated_border.svg) 2 2 2 2;
}



Expand Down
3 changes: 2 additions & 1 deletion res/skins/LateNight/style_classic.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,8 @@ WPushButton#FxParameterButton[displayValue="0"] {
#VinylCueButton[displayValue="2"],
#FxParameterButton[displayValue="1"],
#SplitCue[value="1"],
QPushButton#pushButtonRepeatPlaylist:checked {
QPushButton#pushButtonRepeatPlaylist:checked,
WFullScreenHint QPushButton {
background-color: #888;
}

Expand Down
7 changes: 7 additions & 0 deletions res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,9 @@ WLibrarySidebar,
#LibraryFeatureControls QRadioButton,
/* Tooltip and menus */
QToolTip,
WFullScreenHint QLabel,
WFullScreenHint QCheckBox,
WFullScreenHint QPushButton,
WLibrarySidebar QMenu,
WTrackTableViewHeader QMenu,
WLibraryTextBrowser QMenu,
Expand Down Expand Up @@ -2920,6 +2923,10 @@ WSearchLineEdit QAbstractScrollArea,
border-radius: 1px;
}


WFullScreenHint,
WFullScreenHint QLabel,
WFullScreenHint QCheckBox,
QToolTip,
#MainMenu,
#MainMenu::item,
Expand Down
9 changes: 9 additions & 0 deletions res/skins/Shade/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
padding: 5px 0px;
}
#Mixxx, WWidget,
WFullScreenHint QLabel,
WFullScreenHint QCheckBox,
WEffectName,
WKey,
WLabel,
Expand Down Expand Up @@ -92,10 +94,17 @@ WBeatSpinBox::down-button {



WFullScreenHint {
border: 1px solid white;
}

/* common colors for WEffectSelector, QMenu, QToolTip */
#MainMenu QMenu,
#MainMenu QMenu::item,
#MainMenu QMenu QCheckBox,
WFullScreenHint,
WFullScreenHint QLabel,
WFullScreenHint QCheckBox,
QToolTip,
WLibrarySidebar QMenu,
WLibrarySidebar QMenu::item,
Expand Down
17 changes: 17 additions & 0 deletions res/skins/default.qss
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,20 @@ WEffectChainPresetButton QMenu QCheckBox::indicator {
width: 0.7em;
height: 0.7em;
}


/* The popup that is shown when going fullscreen */
WFullScreenHint {
font-family: "Open Sans";
font-weight: normal;
font-style: normal;
padding: 200px;
border-radius: 5px;
border: 1px solid white;
}
WFullScreenHint QLabel,
WFullScreenHint QCheckBox,
WFullScreenHint QPushButton {
/*font-size: 3em;*/
font-size: 20px;
}
49 changes: 40 additions & 9 deletions src/controllers/keyboard/keyboardeventfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ KeyboardEventFilter::KeyboardEventFilter(ConfigObject<ConfigValueKbd>* pKbdConfi
QObject* parent,
const char* name)
: QObject(parent),
#ifndef __APPLE__
m_altPressedWithoutKey(false),
#endif
m_pKbdConfigObject(nullptr) {
setObjectName(name);
setKeyboardConfig(pKbdConfigObject);
Expand Down Expand Up @@ -41,7 +44,6 @@ bool KeyboardEventFilter::eventFilter(QObject*, QEvent* e) {

// Run through list of active keys to see if the pressed key is already active
// Just for returning true if we are consuming this key event

foreach (const KeyDownInformation& keyDownInfo, m_qActiveKeyList) {
if (keyDownInfo.keyId == keyId) {
return true;
Expand All @@ -50,6 +52,9 @@ bool KeyboardEventFilter::eventFilter(QObject*, QEvent* e) {

QKeySequence ks = getKeySeq(ke);
if (!ks.isEmpty()) {
#ifndef __APPLE__
m_altPressedWithoutKey = false;
#endif
ConfigValueKbd ksv(ks);
// Check if a shortcut is defined
bool result = false;
Expand All @@ -76,10 +81,32 @@ bool KeyboardEventFilter::eventFilter(QObject*, QEvent* e) {
}
}
return result;
#ifndef __APPLE__
} else {
// getKeySeq() returns empty string if the press was a modifier only
if (ke->modifiers() & Qt::AltModifier) {
// on Linux pressing Alt sends Alt+Qt::Key_Alt, so checking for
// Alt modifier is suffcient.
// Activate this in case there are issues on Windows
// || ke->key() == Qt::Key_Alt) {
m_altPressedWithoutKey = true;
}
#endif
}
} else if (e->type()==QEvent::KeyRelease) {
QKeyEvent* ke = (QKeyEvent*)e;

#ifndef __APPLE__
// QAction hotkeys are consumed by the object the created them, so we will
// not receive those here, for example WMainMenuBar hotkeys.
// However, it may happen that we receive an Alt+[key] combo RELEASE for
// which no [key] PRESS was registered.
if (m_altPressedWithoutKey && ke->key() == Qt::Key_Alt) {
emit altPressedWithoutKeys();
}
m_altPressedWithoutKey = false;
#endif

#ifdef __APPLE__
// On Mac OSX the nativeScanCode is empty
int keyId = ke->key();
Expand Down Expand Up @@ -127,9 +154,15 @@ bool KeyboardEventFilter::eventFilter(QObject*, QEvent* e) {
}

QKeySequence KeyboardEventFilter::getKeySeq(QKeyEvent* e) {
QString modseq;
QKeySequence k;

if (e->key() >= 0x01000020 && e->key() <= 0x01000023) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (e->key() >= 0x01000020 && e->key() <= 0x01000023) {
if (e->key() >= Qt::Key_Shift && e->key() <= Qt::Key_Alt) {

And how about Qt::Key_AltGr?

Copy link
Member Author

Choose a reason for hiding this comment

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

adopted in #11526

// Do not act on Modifier only
// avoid returning "khmer vowel sign ie (U+17C0)"
return k;
}

QString modseq;
// TODO(XXX) check if we may simply return QKeySequence(e->modifiers()+e->key())

if (e->modifiers() & Qt::ShiftModifier) {
Expand All @@ -148,17 +181,15 @@ QKeySequence KeyboardEventFilter::getKeySeq(QKeyEvent* e) {
modseq += "Meta+";
}

if (e->key() >= 0x01000020 && e->key() <= 0x01000023) {
// Do not act on Modifier only
// avoid returning "khmer vowel sign ie (U+17C0)"
return k;
}

QString keyseq = QKeySequence(e->key()).toString();
k = QKeySequence(modseq + keyseq);

if (CmdlineArgs::Instance().getDeveloper()) {
qDebug() << "keyboard press: " << k.toString();
if (e->type() == QEvent::KeyPress) {
qDebug() << "keyboard press: " << k.toString();
} else if (e->type() == QEvent::KeyRelease) {
qDebug() << "keyboard release: " << k.toString();
}
}
return k;
}
Expand Down
9 changes: 9 additions & 0 deletions src/controllers/keyboard/keyboardeventfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class KeyboardEventFilter : public QObject {
void setKeyboardConfig(ConfigObject<ConfigValueKbd> *pKbdConfigObject);
ConfigObject<ConfigValueKbd>* getKeyboardConfig();

#ifndef __APPLE__
signals:
void altPressedWithoutKeys();
#endif

private:
struct KeyDownInformation {
KeyDownInformation(int keyId, int modifiers, ControlObject* pControl)
Expand All @@ -37,6 +42,10 @@ class KeyboardEventFilter : public QObject {
ControlObject* pControl;
};

#ifndef __APPLE__
bool m_altPressedWithoutKey;
#endif

// Returns a valid QString with modifier keys from a QKeyEvent
QKeySequence getKeySeq(QKeyEvent *e);
// List containing keys which is currently pressed
Expand Down
Loading