This repository has been archived by the owner on May 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
439 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "NetworkProxy.h" | ||
|
||
using namespace MellowPlayer::Infrastructure; | ||
|
||
NetworkProxy::NetworkProxy(const QVariantMap& rawData): rawData_(rawData) | ||
{ | ||
} | ||
|
||
bool NetworkProxy::isEnabled() const { | ||
return rawData_["enabled"].toBool(); | ||
} | ||
|
||
void NetworkProxy::setEnabled(bool value) { | ||
if (isEnabled() != value) { | ||
rawData_["enabled"] = value; | ||
emit enabledChanged(); | ||
emit changed(); | ||
} | ||
} | ||
|
||
QString NetworkProxy::hostName() const | ||
{ | ||
return rawData_["hostName"].toString(); | ||
} | ||
|
||
void NetworkProxy::setHostName(const QString& value) | ||
{ | ||
if(hostName() != value){ | ||
rawData_["hostName"] = value; | ||
emit hostNameChanged(); | ||
emit changed(); | ||
} | ||
} | ||
|
||
int NetworkProxy::port() const | ||
{ | ||
return rawData_["port"].toInt(); | ||
} | ||
|
||
void NetworkProxy::setPort(int value) | ||
{ | ||
if (port() != value) { | ||
rawData_["port"] = value; | ||
emit portChanged(); | ||
emit changed(); | ||
} | ||
} | ||
|
||
QVariantMap NetworkProxy::rawData() const | ||
{ | ||
return rawData_; | ||
} | ||
|
||
QNetworkProxy NetworkProxy::create() const { | ||
return QNetworkProxy(isEnabled() ? QNetworkProxy::HttpProxy : QNetworkProxy::DefaultProxy, | ||
hostName(), static_cast<quint16 >(port())); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include <MellowPlayer/Domain/Properties.hpp> | ||
#include <QVariantMap> | ||
#include <QtNetwork/QNetworkProxy> | ||
|
||
namespace MellowPlayer::Infrastructure | ||
{ | ||
class NetworkProxy: public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) | ||
Q_PROPERTY(QString hostName READ hostName WRITE setHostName NOTIFY hostNameChanged) | ||
Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged) | ||
|
||
public: | ||
NetworkProxy() = default; | ||
NetworkProxy(const QVariantMap& rawData); | ||
|
||
bool isEnabled() const; | ||
void setEnabled(bool value); | ||
|
||
QString hostName() const; | ||
void setHostName(const QString& hostName); | ||
|
||
int port() const; | ||
void setPort(int port); | ||
|
||
QNetworkProxy create() const; | ||
|
||
QVariantMap rawData() const; | ||
|
||
signals: | ||
void changed(); | ||
void enabledChanged(); | ||
void hostNameChanged(); | ||
void portChanged(); | ||
|
||
private: | ||
QVariantMap rawData_; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
lib/MellowPlayer/Presentation/Views/MellowPlayer/Controls/ItemDelegateSeparator.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import QtQuick 2.9 | ||
import QtQuick.Layouts 1.3 | ||
|
||
Rectangle { | ||
color: _theme.isDark(_theme.background) ? Qt.lighter(_theme.background) : Qt.darker(_theme.background, 1.1) | ||
height: 1 | ||
} |
40 changes: 40 additions & 0 deletions
40
lib/MellowPlayer/Presentation/Views/MellowPlayer/Delegates/SpinBoxDelegate.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import QtQuick 2.9 | ||
import QtQuick.Layouts 1.3 | ||
import QtQuick.Controls 2.2 | ||
|
||
ItemDelegate { | ||
id: root | ||
|
||
property string label: "" | ||
property int value: 0 | ||
property int from: 0 | ||
property int to: 65535 | ||
|
||
hoverEnabled: true | ||
|
||
RowLayout { | ||
anchors.fill: parent | ||
anchors.leftMargin: 16 | ||
anchors.rightMargin: 16 | ||
spacing: 12 | ||
|
||
Label { | ||
text: root.label | ||
enabled: root.enabled | ||
} | ||
|
||
Item { | ||
Layout.fillWidth: true | ||
} | ||
|
||
SpinBox { | ||
enabled: root.enabled | ||
editable: true | ||
value: root.value | ||
from: root.from | ||
to: root.to | ||
|
||
onValueChanged: root.value = value; | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
lib/MellowPlayer/Presentation/Views/MellowPlayer/Delegates/TextFieldDelegate.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import QtQuick 2.9 | ||
import QtQuick.Layouts 1.3 | ||
import QtQuick.Controls 2.2 | ||
|
||
ItemDelegate { | ||
id: root | ||
|
||
property string label: "" | ||
property string value: "" | ||
property int textFieldPreferredWidth: 320 | ||
|
||
hoverEnabled: true | ||
|
||
RowLayout { | ||
anchors.fill: parent | ||
anchors.leftMargin: 16 | ||
anchors.rightMargin: 16 | ||
spacing: 12 | ||
|
||
Label { | ||
text: root.label | ||
enabled: root.enabled | ||
} | ||
|
||
Item { | ||
Layout.fillWidth: true | ||
} | ||
|
||
TextField { | ||
enabled: root.enabled | ||
selectByMouse: true | ||
text: root.value | ||
|
||
onTextChanged: root.value = text; | ||
|
||
Layout.preferredWidth: root.textFieldPreferredWidth | ||
} | ||
} | ||
} |
Oops, something went wrong.