diff --git a/CMakeLists.txt b/CMakeLists.txt index fa1d9eb..8d7be28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/) # Project Name MESSAGE( STATUS "Running ${CMAKE_COMMAND} v${CMAKE_VERSION}" ) PROJECT(DigitalRooster - VERSION 0.14.0 + VERSION 1.0.0 DESCRIPTION "A digital alarm clock and podcast player" LANGUAGES CXX C ) diff --git a/libsrc/hardwarecontrol_mk3.cpp b/libsrc/hardwarecontrol_mk3.cpp index a1fb974..33caee5 100644 --- a/libsrc/hardwarecontrol_mk3.cpp +++ b/libsrc/hardwarecontrol_mk3.cpp @@ -45,7 +45,7 @@ namespace Hal { /*****************************************************************************/ static InputEvent read_event(int filedescriptor) { qCDebug(CLASS_LC) << Q_FUNC_INFO; - InputEvent evt{0}; + InputEvent evt{0,0,0}; struct input_event evt_raw; auto s = ::read(filedescriptor, &evt_raw, sizeof(evt_raw)); @@ -227,8 +227,7 @@ void HardwareControlMk3::set_backlight(int brightness_in) { /* maximum brightness if PWM reg == 0, minimum at BRIGHTNESS_VAL_MAX */ auto pwm_val = static_cast(BRIGHTNESS_VAL_MAX - brightness * BRIGHTNESS_SLOPE); - qCDebug(CLASS_LC) << "brightness:" << brightness << "pwm val:" << pwm_val - << Qt::endl; + qCDebug(CLASS_LC) << "brightness:" << brightness << "pwm val:" << pwm_val; try { backlight_pwm << pwm_val << std::endl; } catch (std::exception& exc) { diff --git a/qtgui/externalRes/IconLabel.qml b/qtgui/externalRes/IconLabel.qml index 5f40c12..c496b2d 100644 --- a/qtgui/externalRes/IconLabel.qml +++ b/qtgui/externalRes/IconLabel.qml @@ -4,9 +4,10 @@ // https://kevincarlson.codes/using-material-design-icons-with-qml/ // -import QtQuick 2.7 -import QtQuick.Controls 2.0 +import QtQuick 2.9 +import QtQuick.Controls 2.2 Text { font: Style.font.button; + color: Style.colors.primaryText; } diff --git a/qtgui/main.cpp b/qtgui/main.cpp index 8975720..e2b9405 100644 --- a/qtgui/main.cpp +++ b/qtgui/main.cpp @@ -173,7 +173,7 @@ int main(int argc, char* argv[]) { &MediaPlayer::stop); /* Powercontrol stop any running alarm monitor timers */ QObject::connect(&power, &PowerControl::going_in_standby, &alarmmonitor, - &AlarmMonitor::stop); + &AlarmMonitor::stop); /* Wire shutdown and reboot requests to hardware */ QObject::connect(&power, &PowerControl::reboot_request, &hwctrl, &Hal::IHardware::system_reboot); @@ -214,9 +214,11 @@ int main(int argc, char* argv[]) { QObject::connect(&playerproxy, &MediaPlayer::volume_changed, &cm, &ConfigurationManager::set_volume); - - /* we start in standby */ - power.standby(); + /* Network / Wifi Settings */ + NetworkInfo netinfo(cm.get_net_dev_name()); + WifiControl* wifictrl = WifiControl::get_instance(&cm); + QObject::connect(wifictrl, &WifiControl::networks_found, &wifilistmodel, + &WifiListModel::update_scan_results); #ifdef REST_API RestApi rest(cm, cm, cm, cm, cm); @@ -245,15 +247,6 @@ int main(int argc, char* argv[]) { QQmlApplicationEngine view; QQmlContext* ctxt = view.rootContext(); - - WifiControl* wifictrl = WifiControl::get_instance(&cm); - ctxt->setContextProperty("wifictrl", wifictrl); - ctxt->setContextProperty("wifilistmodel", &wifilistmodel); - QObject::connect(wifictrl, &WifiControl::networks_found, &wifilistmodel, - &WifiListModel::update_scan_results); - - NetworkInfo netinfo(cm.get_net_dev_name()); - ctxt->setContextProperty("podcastmodel", &psmodel); ctxt->setContextProperty("playerProxy", &playerproxy); ctxt->setContextProperty("alarmlistmodel", &alarmlistmodel); @@ -266,12 +259,19 @@ int main(int argc, char* argv[]) { ctxt->setContextProperty("volumeButton", &volbtn); ctxt->setContextProperty("sleeptimer", &sleeptimer); ctxt->setContextProperty("netinfo", &netinfo); - + ctxt->setContextProperty("wifictrl", wifictrl); + ctxt->setContextProperty("wifilistmodel", &wifilistmodel); ctxt->setContextProperty( "DEFAULT_ICON_WIDTH", QVariant::fromValue(DEFAULT_ICON_WIDTH)); ctxt->setContextProperty("FONT_SCALING", QVariant::fromValue(dpi)); view.load(QUrl("qrc:/main.qml")); + /* Start in standby mode - defined in qtgui/CMakeLists.txt */ +#ifndef HARDWARE_STUB + qCInfo(MAIN) << " starting in Standby "; + power.standby(); +#endif + return app.exec(); } diff --git a/qtgui/qml/AlarmDelegate.qml b/qtgui/qml/AlarmDelegate.qml index 43a2ef3..efc6e24 100644 --- a/qtgui/qml/AlarmDelegate.qml +++ b/qtgui/qml/AlarmDelegate.qml @@ -1,7 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 import ruschi.Alarm 1.0 import "Jsutil.js" as Util @@ -66,7 +70,7 @@ Rectangle{ contentItem: Text{ text: "\ufa79" - color: "white" + color: Style.colors.primaryText; font.pointSize: 24 horizontalAlignment: Text.AlignHCenter font.family: "Material Design Icons" diff --git a/qtgui/qml/AlarmEditDialog.qml b/qtgui/qml/AlarmEditDialog.qml index 827df4e..e45a3ca 100644 --- a/qtgui/qml/AlarmEditDialog.qml +++ b/qtgui/qml/AlarmEditDialog.qml @@ -1,8 +1,13 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 1.4 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 import QtQuick.Extras 1.4 + import ruschi.Alarm 1.0 import "Jsutil.js" as Util diff --git a/qtgui/qml/AlarmList.qml b/qtgui/qml/AlarmList.qml index 296ea64..a8c9be0 100644 --- a/qtgui/qml/AlarmList.qml +++ b/qtgui/qml/AlarmList.qml @@ -1,6 +1,12 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 + import ruschi.Alarm 1.0 ListView { diff --git a/qtgui/qml/BrightnessMenu.qml b/qtgui/qml/BrightnessMenu.qml index 754f447..9c30d88 100644 --- a/qtgui/qml/BrightnessMenu.qml +++ b/qtgui/qml/BrightnessMenu.qml @@ -1,6 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 /** * Brightness Menu @@ -43,7 +48,7 @@ Menu { Text{ text: "Active brightness:"; font: Style.font.boldLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.leftMargin: Style.itemMargins.wide; } @@ -64,7 +69,7 @@ Menu { Text{ text: "Standby brightness:"; font: Style.font.boldLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.leftMargin: Style.itemMargins.wide; } diff --git a/qtgui/qml/Clock.qml b/qtgui/qml/Clock.qml index da2af54..3458419 100644 --- a/qtgui/qml/Clock.qml +++ b/qtgui/qml/Clock.qml @@ -1,6 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 import "Jsutil.js" as Util diff --git a/qtgui/qml/ClockPage.qml b/qtgui/qml/ClockPage.qml index 56c3daf..c2905b7 100644 --- a/qtgui/qml/ClockPage.qml +++ b/qtgui/qml/ClockPage.qml @@ -1,6 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 Page { id: clockPage @@ -18,7 +23,7 @@ Page { Text{ text: currentTime.timestring_lz_hh_mm font: Style.font.clock; - color: "white" + color: Style.colors.primaryText Layout.columnSpan: 3; Layout.topMargin: Style.itemMargins.medium; Layout.bottomMargin:0; diff --git a/qtgui/qml/ForecastWidget.qml b/qtgui/qml/ForecastWidget.qml index 5936a2c..62ce06b 100644 --- a/qtgui/qml/ForecastWidget.qml +++ b/qtgui/qml/ForecastWidget.qml @@ -1,7 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 - +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 Rectangle { property double temperature; @@ -27,7 +31,7 @@ Rectangle { id: temp; text: "-12\u00B0C" font: Style.font.weatherInfo; - color: "white"; + color: Style.colors.primaryText; style: Text.Outline; styleColor: Style.colors.selected; Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter; @@ -49,7 +53,7 @@ Rectangle { id: timestamp; text: "23:55"; font: Style.font.weatherTime; - color: "white" + color: Style.colors.primaryText; Layout.topMargin: -12; Layout.columnSpan: 2; Layout.alignment: Qt.AlignHCenter | Qt.AlignTop; diff --git a/qtgui/qml/IRadioDelegate.qml b/qtgui/qml/IRadioDelegate.qml index 8de3304..5e27817 100644 --- a/qtgui/qml/IRadioDelegate.qml +++ b/qtgui/qml/IRadioDelegate.qml @@ -1,7 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.1 -import QtQuick.Controls.Material 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 import ruschi.PlayableItem 1.0 @@ -11,8 +15,7 @@ Rectangle{ height: Style.contentHeight/4; radius: 3; border.width: 1; - color: iradiolist.currentItem === this ? - Style.colors.selected : Style.colors.unselected ; + color: Style.colors.widgetBackground; Text { id: stationName @@ -22,6 +25,8 @@ Rectangle{ verticalAlignment: Text.AlignVCenter; anchors.fill: parent; anchors.margins: Style.itemMargins.medium; + color: iradiolist.currentItem === parent ? + Style.colors.selected : Style.colors.primaryText ; } MouseArea { diff --git a/qtgui/qml/IRadioList.qml b/qtgui/qml/IRadioList.qml index bf48b40..67de13a 100644 --- a/qtgui/qml/IRadioList.qml +++ b/qtgui/qml/IRadioList.qml @@ -1,6 +1,10 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 ListView { id:iradiolist @@ -8,7 +12,6 @@ ListView { width: stackView.width height: stackView.height contentWidth: stackView.width - rebound: listBoundTransition; delegate: IRadioDelegate{ @@ -18,7 +21,7 @@ ListView { model: iradiolistmodel Connections { - onFlickStarted : { + function onFlickStarted() { viewResetTimer.restart(); } } diff --git a/qtgui/qml/PlayerControlWidget.qml b/qtgui/qml/PlayerControlWidget.qml index b01ca28..d2a63c6 100644 --- a/qtgui/qml/PlayerControlWidget.qml +++ b/qtgui/qml/PlayerControlWidget.qml @@ -1,8 +1,12 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 import QtMultimedia 5.9 -import QtQuick.Controls.Material 2.1 import ruschi.PodcastEpisode 1.0 import "Jsutil.js" as Util @@ -32,7 +36,7 @@ Popup { id: currentMediaTitle text: "" ; font: Style.font.label; - color: Material.accent; + color: Style.colors.selected; elide: Text.ElideRight; Layout.topMargin: 0; @@ -61,7 +65,7 @@ Popup { onClicked: { interactiontimer.restart() - if (playerProxy.playbackState == MediaPlayer.PlayingState) { + if (playerProxy.playbackState === MediaPlayer.PlayingState) { playerProxy.pause() } else { playerProxy.play() @@ -110,7 +114,7 @@ Popup { text: Util.display_time_ms(playerProxy.position) font: Style.font.valueLabel; Layout.alignment: Qt.AlignRight | Qt.AlignTop - color: "white" + color: Style.colors.primaryText; } Slider { @@ -130,7 +134,7 @@ Popup { text: playerProxy.seekable? Util.display_time_ms(playerProxy.duration): "\u221E" Layout.preferredWidth: timeElapsed.width font: playerProxy.seekable? Style.font.valueLabel: Style.font.listItemHeadListened; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignTop } }// RowLayout Row 3 diff --git a/qtgui/qml/PodcastContextMenu.qml b/qtgui/qml/PodcastContextMenu.qml index ed76d6f..92f9724 100644 --- a/qtgui/qml/PodcastContextMenu.qml +++ b/qtgui/qml/PodcastContextMenu.qml @@ -1,10 +1,11 @@ -/** - * Popup to update/delete Podcast +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later */ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.1 +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 Menu { focus: true @@ -35,7 +36,7 @@ Menu { text: podcastControl.title; font: Style.font.label; elide: Text.ElideMiddle; - color: Material.accent; + color: Style.colors.primaryText; Layout.columnSpan:2; Layout.margins:Style.itemMargins.slim; @@ -60,7 +61,7 @@ Menu { Text{ text: "refresh"; font: Style.font.label; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } @@ -81,7 +82,7 @@ Menu { Text{ text: "purge local"; font: Style.font.label; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } @@ -92,7 +93,7 @@ Menu { Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter contentItem: Text{ text: "\ufa79" - color: "white" + color: Style.colors.primaryText; font.pointSize: 20 horizontalAlignment: Text.AlignHCenter font.family: "Material Design Icons" @@ -107,7 +108,7 @@ Menu { Text{ text: "delete"; font: Style.font.label; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } } diff --git a/qtgui/qml/PodcastDelegate.qml b/qtgui/qml/PodcastDelegate.qml index e976735..64ac20d 100644 --- a/qtgui/qml/PodcastDelegate.qml +++ b/qtgui/qml/PodcastDelegate.qml @@ -1,6 +1,12 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 + import ruschi.PodcastEpisodeModel 1.0 Rectangle{ @@ -9,8 +15,7 @@ Rectangle{ height: DEFAULT_ICON_WIDTH+Style.itemMargins.slim+2; radius: 2; border.width: 1; - color: podcastlist.currentItem == this ? - Style.colors.selected : Style.colors.unselected ; + color: Style.colors.widgetBackground; GridLayout{ anchors.margins: Style.itemMargins.slim; @@ -22,22 +27,10 @@ Rectangle{ Image { id: podcasticon; - Layout.minimumHeight : DEFAULT_ICON_WIDTH; - Layout.minimumWidth : DEFAULT_ICON_WIDTH; - Layout.maximumHeight : DEFAULT_ICON_WIDTH; + Layout.minimumHeight: DEFAULT_ICON_WIDTH; + Layout.minimumWidth: DEFAULT_ICON_WIDTH; + Layout.maximumHeight: DEFAULT_ICON_WIDTH; Layout.maximumWidth : DEFAULT_ICON_WIDTH; - /* - Layout.maximumHeight : podcastdelegate.height- - 2*Style.itemMargins.slim; - Layout.maximumWidth : podcastdelegate.height- - 2*Style.itemMargins.slim; - // yes width is specified as height, - // gives the layout a hint while image is not loaded - Layout.minimumWidth : 0.9*podcastdelegate.height- - 2*Style.itemMargins.slim; - Layout.minimumHeight : 0.9*podcastdelegate.height- - 2*Style.itemMargins.slim; - */ Layout.rowSpan: 2 Layout.alignment: Qt.AlignLeft| Qt.AlignVCenter Layout.leftMargin: 1; @@ -51,6 +44,7 @@ Rectangle{ elide: Text.ElideRight; Layout.alignment: Qt.AlignLeft| Qt.AlignTop Layout.fillWidth: true; + color: Style.colors.primaryText; } Text { @@ -59,23 +53,24 @@ Rectangle{ font: Style.font.valueLabel; Layout.preferredWidth: (parent.with-podcasticon.width)*0.2 Layout.alignment: Qt.AlignRight | Qt.AlignTop + color: Style.colors.primaryText; } Text { text: description ; elide: Text.ElideRight; - wrapMode: Text.WordWrap; + wrapMode: Text.WordWrap; font: Style.font.flowText; - lineHeight : 0.8; + lineHeight: 0.8; Layout.topMargin: 0; Layout.columnSpan: 2; Layout.fillWidth: true; Layout.maximumHeight: parent.height/1.8 Layout.alignment: Qt.AlignLeft| Qt.AlignTop + color: Style.colors.primaryText; } } - MouseArea { id: mouseArea anchors.fill: parent diff --git a/qtgui/qml/PodcastEpisodeDelegate.qml b/qtgui/qml/PodcastEpisodeDelegate.qml index 78f955b..da564ab 100644 --- a/qtgui/qml/PodcastEpisodeDelegate.qml +++ b/qtgui/qml/PodcastEpisodeDelegate.qml @@ -1,7 +1,13 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 import QtMultimedia 5.9 + import ruschi.PodcastEpisode 1.0 Rectangle{ @@ -10,9 +16,7 @@ Rectangle{ height: 100; radius: 3; border.width: 1; - color: episodemodel.currentIndex === index ? - Style.colors.selected : Style.colors.unselected ; - + color: Style.colors.widgetBackground; anchors.margins: Style.itemMargins.slim; GridLayout{ @@ -34,6 +38,7 @@ Rectangle{ Layout.columnSpan: 2 Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.bottomMargin: Style.itemMargins.slim; + color: Style.colors.primaryText; } Text { @@ -43,6 +48,7 @@ Rectangle{ elide: Text.ElideRight Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.topMargin: Style.itemMargins.slim; + color: Style.colors.primaryText; } Text { @@ -52,6 +58,7 @@ Rectangle{ elide: Text.ElideRight Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.topMargin: Style.itemMargins.slim; + color: Style.colors.primaryText; } Text { @@ -67,6 +74,7 @@ Rectangle{ Layout.maximumHeight: parent.heigth*0.6 Layout.columnSpan: 2 Layout.alignment: Qt.AlignLeft | Qt.AlignTop + color: Style.colors.primaryText; } } MouseArea { diff --git a/qtgui/qml/PodcastEpisodeList.qml b/qtgui/qml/PodcastEpisodeList.qml index 504f116..4f950e2 100644 --- a/qtgui/qml/PodcastEpisodeList.qml +++ b/qtgui/qml/PodcastEpisodeList.qml @@ -1,24 +1,28 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 import ruschi.PodcastEpisodeModel 1.0 ListView { - width: parent.width - height: parent.height; - - rebound: listBoundTransition; - - property PodcastEpisodeModel episodemodel; + width: parent.width + height: parent.height; - delegate:PodcastEpisodeDelegate{ - id: ped - } + rebound: listBoundTransition; - Connections { - onFlickStarted : { - viewResetTimer.restart(); - } - } + property PodcastEpisodeModel episodemodel; + + delegate:PodcastEpisodeDelegate{ + id: ped + } + + Connections { + function onFlickStarted () { + viewResetTimer.restart(); + } + } } diff --git a/qtgui/qml/PodcastList.qml b/qtgui/qml/PodcastList.qml index bb80c06..36a598a 100644 --- a/qtgui/qml/PodcastList.qml +++ b/qtgui/qml/PodcastList.qml @@ -1,7 +1,10 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 ListView { id: podcastlist; @@ -18,7 +21,7 @@ ListView { model: podcastmodel Connections { - onFlickStarted : { + function onFlickStarted() { viewResetTimer.restart(); } } diff --git a/qtgui/qml/PowerMenu.qml b/qtgui/qml/PowerMenu.qml index 4a088df..ecfbc72 100644 --- a/qtgui/qml/PowerMenu.qml +++ b/qtgui/qml/PowerMenu.qml @@ -1,6 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 /** * Power (-Off) Menu @@ -42,7 +47,7 @@ Menu { Text{ text: "shutdown"; font: Style.font.boldLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } @@ -59,7 +64,7 @@ Menu { Text{ text: "reboot"; font: Style.font.boldLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } } diff --git a/qtgui/qml/SettingsPage.qml b/qtgui/qml/SettingsPage.qml index 277e39a..2fcbae7 100644 --- a/qtgui/qml/SettingsPage.qml +++ b/qtgui/qml/SettingsPage.qml @@ -1,6 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 Page { id: settingsPage @@ -17,41 +22,42 @@ Page { Text{ text: "Revision: "; font: Style.font.label; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignTop } Text{ text: config.revision; font: Style.font.valueLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignTop } Text{ text: "Build: "; font: Style.font.label; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignTop } Text{ text: config.buildtime; font: Style.font.valueLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignTop } - Text{ + Text{ text: "IP: "; font: Style.font.label; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignTop } Text{ text: netinfo.ipaddr; font: Style.font.valueLabel; - color: netinfo.linkstatus? "white" : Style.colors.disabled; + color: netinfo.linkstatus? Style.colors.primaryText + : Style.colors.disabled; Layout.alignment: Qt.AlignLeft | Qt.AlignTop } @@ -67,7 +73,7 @@ Page { Text{ text: "change brightness"; font: Style.font.boldLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } @@ -83,7 +89,7 @@ Page { Text{ text: "sleep timeout"; font: Style.font.boldLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } @@ -99,7 +105,7 @@ Page { Text{ text: "Wifi"; font: Style.font.boldLabel; - color: "white" + color: Style.colors.primaryText; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter } }// GridLayout diff --git a/qtgui/qml/SleepTimeoutMenu.qml b/qtgui/qml/SleepTimeoutMenu.qml index e9eeae9..6590901 100644 --- a/qtgui/qml/SleepTimeoutMenu.qml +++ b/qtgui/qml/SleepTimeoutMenu.qml @@ -1,7 +1,12 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 1.4 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 + import QtQuick.Extras 1.4 import "Jsutil.js" as Util @@ -32,9 +37,8 @@ Menu { Text{ text: "Sleep after minutes"; font: Style.font.label; - color: "white"; + color: Style.colors.primaryText; elide: Text.ElideRight; - Layout.topMargin: Style.itemMargins.wide; Layout.columnSpan: 2; Layout.fillWidth: true; diff --git a/qtgui/qml/Style.qml b/qtgui/qml/Style.qml index 047fb41..2b3b300 100644 --- a/qtgui/qml/Style.qml +++ b/qtgui/qml/Style.qml @@ -1,6 +1,10 @@ -// Style.qml -import QtQuick 2.0 -import QtQuick.Controls.Material 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls.Material 2.4 pragma Singleton @@ -15,7 +19,9 @@ QtObject { property int contentHeight: canvasHeight-toolbarHeight; property QtObject colors: QtObject{ - property color selected : Material.primary; // "#2196F3"; + property color primaryText : "white"; + property color widgetBackground : Material.background; + property color selected : Material.accent; // "#2196F3"; property color unselected: Material.color(Material.Grey) ;// "gainsboro"; property color disabled: Material.color(Material.Grey); property color enabled: Material.primary; //"#2196F3"; diff --git a/qtgui/qml/VolumePopup.qml b/qtgui/qml/VolumePopup.qml index 93961d3..5d0c06d 100644 --- a/qtgui/qml/VolumePopup.qml +++ b/qtgui/qml/VolumePopup.qml @@ -1,6 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 Menu { focus: true @@ -27,13 +32,13 @@ Menu { font: Style.font.sliderValue text: volumeSlider.value Layout.alignment: Qt.AlignVCenter| Qt.AlignHCenter - Layout.columnSpan: 3 + Layout.columnSpan: 3; } // Row 2 IconLabel{ // volume low text: "\uf57f"; - } + } Slider { id: volumeSlider diff --git a/qtgui/qml/WifiList.qml b/qtgui/qml/WifiList.qml index 4c21aba..a24b93d 100644 --- a/qtgui/qml/WifiList.qml +++ b/qtgui/qml/WifiList.qml @@ -1,6 +1,10 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 ListView { boundsBehavior: Flickable.StopAtBounds diff --git a/qtgui/qml/WifiMenu.qml b/qtgui/qml/WifiMenu.qml index d42428b..9db3f17 100644 --- a/qtgui/qml/WifiMenu.qml +++ b/qtgui/qml/WifiMenu.qml @@ -1,6 +1,11 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 /** * Wifi Menu @@ -35,7 +40,7 @@ Menu { id: wifictrlStatus; text: "Press for WPS PBC"; font: Style.font.label; - color: "white"; + color: Style.colors.primaryText; Layout.rightMargin: Style.itemMargins.wide; Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter; } diff --git a/qtgui/qml/WifiNetworkDelegate.qml b/qtgui/qml/WifiNetworkDelegate.qml index 88b9065..614bf29 100644 --- a/qtgui/qml/WifiNetworkDelegate.qml +++ b/qtgui/qml/WifiNetworkDelegate.qml @@ -1,14 +1,18 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 - +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 Rectangle{ width: parent.width; height: Style.contentHeight/4; radius: 3; border.width: 1; - color: connected ? Style.colors.enabled : Style.colors.disabled; + color: connected ? Style.colors.enabled : Style.colors.disabled; MouseArea { anchors.fill: parent diff --git a/qtgui/qml/main.qml b/qtgui/qml/main.qml index 5b2a23b..632ca40 100644 --- a/qtgui/qml/main.qml +++ b/qtgui/qml/main.qml @@ -1,7 +1,13 @@ -import QtQuick 2.9 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.1 +// SPDX-License-Identifier: GPL-3.0-or-later +/* + * copyright (c) 2021 Thomas Ruschival + * Licensed under GNU PUBLIC LICENSE Version 3 or later + */ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 +import QtQuick.Controls.Material 2.4 + import QtMultimedia 5.9 import ruschi.PodcastEpisode 1.0 @@ -22,6 +28,7 @@ ApplicationWindow { property string functionMode: "Clock" property int pressAndHoldInterval: 300; property int dialogTimeout: 8000; // Dialog shown for 8s w/o interaction + property bool widgetsEnabled: true; // widgets enabled? Clock{ id: currentTime @@ -53,6 +60,7 @@ ApplicationWindow { IconButton { text: "\uf35c"; Layout.maximumWidth: 48; + enabled : widgetsEnabled; onClicked: { drawer.open() } @@ -74,11 +82,11 @@ ApplicationWindow { id: countdown_to_sleep; text: "\uf4b2 "+ - sleeptimer.time_remaining +" min" + sleeptimer.time_remaining +" min" Layout.rightMargin: 1; textFormat: Text.RichText horizontalAlignment: Text.AlignRight - color: "white" + color: Style.colors.primaryText; visible: (playerProxy.playbackState === MediaPlayer.PlayingState) Layout.fillWidth: true @@ -100,6 +108,7 @@ ApplicationWindow { id : playerControlBtn text: "\uf40a" Layout.maximumWidth: 48; + visible: widgetsEnabled; onClicked:{ playerControlWidget.show() } @@ -130,6 +139,7 @@ ApplicationWindow { closePolicy : Popup.CloseOnPressOutside; edge: Qt.LeftEdge; interactive: true; + enabled: widgetsEnabled; onOpened :{ autocloseTimer.start() @@ -137,7 +147,7 @@ ApplicationWindow { Timer { id: autocloseTimer - interval: 4000 + interval: 5000 running: true repeat: false onTriggered: drawer.close(); @@ -247,12 +257,20 @@ ApplicationWindow { } + /* + * Enable buttons etc. when in standby + */ + function toggleControls(ena) { + console.log("toggleControls "+ ena); + widgetsEnabled = ena + } + /* Global Transitions */ Transition { id: listBoundTransition; /* NumberAnimation { */ /* properties: "x,y"; */ - /* duration: 800; */ + /* duration: 150; */ /* easing.type: Easing.InOutBack; */ /* } */ } @@ -273,6 +291,7 @@ ApplicationWindow { Component.onCompleted: { console.log("main.qml completed") powerControl.going_in_standby.connect(stackView.reset) + powerControl.active.connect(toggleControls); volumeButton.volume_incremented.connect(volumePopUp.show) } } // application window