diff options
-rw-r--r-- | app/MainView.qml | 2 | ||||
-rw-r--r-- | app/SettingsView.qml | 97 | ||||
-rw-r--r-- | plugins/alexainterface/AlexaInterface.h | 2 | ||||
-rw-r--r-- | plugins/alexainterface/QtMicrophoneWrapper.cpp | 13 | ||||
-rw-r--r-- | plugins/alexainterface/QtMicrophoneWrapper.h | 1 |
5 files changed, 80 insertions, 35 deletions
diff --git a/app/MainView.qml b/app/MainView.qml index f4aee3f..4bb93e7 100644 --- a/app/MainView.qml +++ b/app/MainView.qml @@ -112,7 +112,7 @@ Item { anchors.top: header.bottom anchors.left: sectionsColumn.right anchors.right: parent.right - height: parent.height - Sizes.dp(50) + height: parent.height - header.height - Sizes.dp(50) initialItem: mainView pushEnter: Transition { PropertyAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 } diff --git a/app/SettingsView.qml b/app/SettingsView.qml index 43de08f..2abd0bf 100644 --- a/app/SettingsView.qml +++ b/app/SettingsView.qml @@ -46,48 +46,77 @@ Item { signal resetAccountClicked() - ColumnLayout { + Flickable { anchors.fill: parent anchors.topMargin: Sizes.dp(80) - spacing: Sizes.dp(40) + anchors.bottomMargin: Sizes.dp(20) + contentHeight: settingsLayout.height + clip: true - ListItem { - subText: "123456"; - text: qsTr("Device serial number") - Layout.fillWidth: true - } + ScrollIndicator.vertical: ScrollIndicator { } - ListItem { - subText: "amzn1.application-oa2-client.a92e3edd0c8542a6bafcd89e5f125851"; - text: qsTr("Alexa Client ID") - Layout.fillWidth: true - } + ColumnLayout { + id: settingsLayout - ListItem { - subText: "default"; - text: qsTr("Recording device") - Layout.fillWidth: true - } + spacing: Sizes.dp(40) + width: parent.width - ListItemSwitch { - text: qsTr("Alexa wake word") - switchOn: true - enabled: false - Layout.fillWidth: true - } + ListItem { + subText: "123456"; + text: qsTr("Device serial number") + Layout.fillWidth: true + } - Button { - visible: AlexaInterface.loggedIn - implicitWidth: Sizes.dp(315) - implicitHeight: Sizes.dp(64) - font.pixelSize: Sizes.fontSizeS - text: qsTr("Reset account") - Layout.alignment: Qt.AlignHCenter - enabled: false - } + ListItem { + subText: "amzn1.application-oa2-client.a92e3edd0c8542a6bafcd89e5f125851"; + text: qsTr("Alexa Client ID") + Layout.fillWidth: true + } + + ListItemSwitch { + text: qsTr("Alexa wake word") + switchOn: true + enabled: false + Layout.fillWidth: true + } + + Button { + visible: AlexaInterface.loggedIn + implicitWidth: Sizes.dp(315) + implicitHeight: Sizes.dp(64) + font.pixelSize: Sizes.fontSizeS + text: qsTr("Reset account") + Layout.alignment: Qt.AlignHCenter + enabled: false + } + + ListItem { + text: qsTr("Recording devices") + Layout.fillWidth: true + } + + ListView { + id: listView + model: AlexaInterface.deviceList + height: childrenRect.height + Layout.fillWidth: true + interactive: false + delegate: RadioButton { + checked: modelData === "default" + width: parent.width + height: Sizes.dp(50) + font.pixelSize: Sizes.fontSizeXS + indicator.implicitHeight: Sizes.dp(30) + indicator.implicitWidth: Sizes.dp(30) + text: modelData + spacing: Sizes.dp(10) + checkable: false + } + } - Item { - Layout.fillHeight: true + Item { + Layout.fillHeight: true + } } } } diff --git a/plugins/alexainterface/AlexaInterface.h b/plugins/alexainterface/AlexaInterface.h index 492d8df..8061531 100644 --- a/plugins/alexainterface/AlexaInterface.h +++ b/plugins/alexainterface/AlexaInterface.h @@ -88,6 +88,7 @@ class AlexaInterface: public QObject { Q_PROPERTY(ConnectionManager::ConnectionStatus connectionStatus READ connectionStatus NOTIFY connectionStatusChanged) Q_PROPERTY(LogLevel logLevel READ logLevel WRITE setLogLevel NOTIFY logLevelChanged) Q_PROPERTY(qreal audioLevel READ audioLevel NOTIFY audioLevelChanged) + Q_PROPERTY(QStringList deviceList READ deviceList) public: @@ -119,6 +120,7 @@ public: ConnectionManager::ConnectionStatus connectionStatus() const { return m_connectionStatus; } LogLevel logLevel() const { return m_logLevel; } qreal audioLevel() const { return m_micWrapper ? m_micWrapper->audioLevel() : 0.0; } + QStringList deviceList() const { return m_micWrapper ? m_micWrapper->deviceList() : QStringList(); } explicit AlexaInterface(QObject* parent = nullptr); /// Destructor which manages the @c AlexaInterface shutdown sequence. diff --git a/plugins/alexainterface/QtMicrophoneWrapper.cpp b/plugins/alexainterface/QtMicrophoneWrapper.cpp index 86bfa6f..1573e3a 100644 --- a/plugins/alexainterface/QtMicrophoneWrapper.cpp +++ b/plugins/alexainterface/QtMicrophoneWrapper.cpp @@ -171,6 +171,19 @@ void QtMicrophoneWrapper::setAudioDevice(const QString &deviceName) { qDebug("QtMicrophoneWrapper: Latency is configured to: %d ms", m_audioInput->notifyInterval()); } +QStringList QtMicrophoneWrapper::deviceList() const +{ + QStringList deviceNames; + + QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); + + for (QAudioDeviceInfo &device : devices) { + deviceNames.append(device.deviceName()); + } + + return deviceNames; +} + AudioLevelInfo::AudioLevelInfo(const QAudioFormat &format) { init(format); diff --git a/plugins/alexainterface/QtMicrophoneWrapper.h b/plugins/alexainterface/QtMicrophoneWrapper.h index bfeb5ae..1c0def0 100644 --- a/plugins/alexainterface/QtMicrophoneWrapper.h +++ b/plugins/alexainterface/QtMicrophoneWrapper.h @@ -114,6 +114,7 @@ public: qreal audioLevel() const { return m_audioLevel; } void setLevelProcess(bool enable) { m_levelProcess = enable; } + QStringList deviceList() const; Q_SIGNALS: void audioLevelChanged(); |