Skip to content

Commit

Permalink
Merge branch '2.3' of github.com:mixxxdj/mixxx
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jun 1, 2021
2 parents 0bef3dd + 7319513 commit 2a85c7c
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/widget/wpixmapstore.cpp
src/widget/wpushbutton.cpp
src/widget/wrecordingduration.cpp
src/widget/wscrollable.cpp
src/widget/wsearchlineedit.cpp
src/widget/wsearchrelatedtracksmenu.cpp
src/widget/wsingletoncontainer.cpp
Expand Down
Binary file modified res/skins/Deere (64 Samplers)/skin_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/Deere/skin_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/LateNight/skin_preview_Classic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/LateNight/skin_preview_PaleMoon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/Shade/skin_preview_Classic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/Shade/skin_preview_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/Shade/skin_preview_SummerSunset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/Tango (64 Samplers)/skin_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/skins/Tango/skin_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions src/preferences/dialog/dlgprefinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ void DlgPrefInterface::slotSetScheme(int) {
m_colorScheme = newScheme;
m_bRebootMixxxView = true;
}
skinPreviewLabel->setPixmap(m_pSkin->preview(m_colorScheme));
QPixmap preview = m_pSkin->preview(m_colorScheme);
skinPreviewLabel->setPixmap(preview.scaled(
QSize(640, 360), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}

void DlgPrefInterface::slotSetSkinDescription() {
Expand Down Expand Up @@ -372,7 +374,9 @@ void DlgPrefInterface::slotSetSkin(int) {
}
slotUpdateSchemes();
slotSetSkinDescription();
skinPreviewLabel->setPixmap(m_pSkin->preview(m_colorScheme));
QPixmap preview = m_pSkin->preview(m_colorScheme);
skinPreviewLabel->setPixmap(preview.scaled(
QSize(640, 360), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}

void DlgPrefInterface::slotApply() {
Expand Down
34 changes: 34 additions & 0 deletions src/skin/legacy/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "widget/wpushbutton.h"
#include "widget/wraterange.h"
#include "widget/wrecordingduration.h"
#include "widget/wscrollable.h"
#include "widget/wsearchlineedit.h"
#include "widget/wsingletoncontainer.h"
#include "widget/wsizeawarestack.h"
Expand Down Expand Up @@ -598,6 +599,8 @@ QList<QWidget*> LegacySkinParser::parseNode(const QDomElement& node) {
result = wrapWidget(parseBattery(node));
} else if (nodeName == "SetVariable") {
m_pContext->updateVariable(node);
} else if (nodeName == "Scrollable") {
result = wrapWidget(parseScrollable(node));
} else if (nodeName == "Template") {
result = parseTemplate(node);
} else if (nodeName == "SingletonDefinition") {
Expand Down Expand Up @@ -648,6 +651,37 @@ QWidget* LegacySkinParser::parseSplitter(const QDomElement& node) {
return pSplitter;
}

QWidget* LegacySkinParser::parseScrollable(const QDomElement& node) {
WScrollable* pScrollable = new WScrollable(m_pParent);
commonWidgetSetup(node, pScrollable);

QDomNode childrenNode = m_pContext->selectNode(node, "Children");
QWidget* pOldParent = m_pParent;
m_pParent = pScrollable;

if (!childrenNode.isNull()) {
QDomNodeList childNodes = childrenNode.childNodes();
if (childNodes.count() != 1) {
SKIN_WARNING(node, *m_pContext) << "Scrollables must have exactly one child";
}

QDomNode childnode = childNodes.at(0);
if (childnode.isElement()) {
QList<QWidget*> children = parseNode(childnode.toElement());
if (children.count() != 1) {
SKIN_WARNING(node, *m_pContext) << "Scrollables must have exactly one child";
} else if (children.at(0) != nullptr) {
pScrollable->setWidget(children.at(0));
}
}
}
pScrollable->setup(node, *m_pContext);
pScrollable->Init();

m_pParent = pOldParent;
return pScrollable;
}

void LegacySkinParser::parseChildren(
const QDomElement& node,
WWidgetGroup* pGroup) {
Expand Down
1 change: 1 addition & 0 deletions src/skin/legacy/legacyskinparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class LegacySkinParser : public QObject, public SkinParser {
QWidget* parseWidgetStack(const QDomElement& node);
QWidget* parseSizeAwareStack(const QDomElement& node);
QWidget* parseSplitter(const QDomElement& node);
QWidget* parseScrollable(const QDomElement& node);
void parseSingletonDefinition(const QDomElement& node);

// Visual widgets.
Expand Down
26 changes: 26 additions & 0 deletions src/widget/wscrollable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "widget/wscrollable.h"

WScrollable::WScrollable(QWidget* pParent)
: QScrollArea(pParent),
WBaseWidget(this) {
}

void WScrollable::setup(const QDomNode& node, const SkinContext& context) {
QString horizontalPolicy;
// The QT default is "As Needed", so we don't need a selector for that.
if (context.hasNodeSelectString(node, "HorizontalScrollBarPolicy", &horizontalPolicy)) {
if (horizontalPolicy == "on") {
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
} else if (horizontalPolicy == "off") {
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
}
QString verticalPolicy;
if (context.hasNodeSelectString(node, "VerticalScrollBarPolicy", &verticalPolicy)) {
if (verticalPolicy == "on") {
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
} else if (verticalPolicy == "off") {
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
}
}
19 changes: 19 additions & 0 deletions src/widget/wscrollable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <QDomNode>
#include <QEvent>
#include <QScrollArea>

#include "preferences/usersettings.h"
#include "skin/legacy/skincontext.h"
#include "widget/wbasewidget.h"

/// Creates a QScrollArea. The QT default is to show scrollbars if needed.
class WScrollable : public QScrollArea, public WBaseWidget {
Q_OBJECT
public:
WScrollable(QWidget* pParent);

/// WScrollable supports the following attributes: HorizontalScrollBarPolicy, VerticalScrollBarPolicy
void setup(const QDomNode& node, const SkinContext& context);
};

0 comments on commit 2a85c7c

Please sign in to comment.