Skip to content

Commit

Permalink
Merge branch 'release/1.0'
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Ruschival <thomas@ruschival.de>
  • Loading branch information
truschival committed Apr 4, 2021
2 parents 436be97 + 8cbae08 commit 64b9ec7
Show file tree
Hide file tree
Showing 28 changed files with 299 additions and 184 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
5 changes: 2 additions & 3 deletions libsrc/hardwarecontrol_mk3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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<int>(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) {
Expand Down
5 changes: 3 additions & 2 deletions qtgui/externalRes/IconLabel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
28 changes: 14 additions & 14 deletions qtgui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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();
}
14 changes: 9 additions & 5 deletions qtgui/qml/AlarmDelegate.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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
Expand Down Expand Up @@ -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"
Expand Down
13 changes: 9 additions & 4 deletions qtgui/qml/AlarmEditDialog.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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

Expand Down
12 changes: 9 additions & 3 deletions qtgui/qml/AlarmList.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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 {
Expand Down
15 changes: 10 additions & 5 deletions qtgui/qml/BrightnessMenu.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
11 changes: 8 additions & 3 deletions qtgui/qml/Clock.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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

Expand Down
13 changes: 9 additions & 4 deletions qtgui/qml/ClockPage.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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
Expand All @@ -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;
Expand Down
16 changes: 10 additions & 6 deletions qtgui/qml/ForecastWidget.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
17 changes: 11 additions & 6 deletions qtgui/qml/IRadioDelegate.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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

Expand All @@ -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
Expand All @@ -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 {
Expand Down
13 changes: 8 additions & 5 deletions qtgui/qml/IRadioList.qml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
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 <thomas@ruschival.de>
* Licensed under GNU PUBLIC LICENSE Version 3 or later
*/
import QtQuick 2.11
import QtQuick.Controls 2.4

ListView {
id:iradiolist
property string objectName : "InternetRadio"
width: stackView.width
height: stackView.height
contentWidth: stackView.width

rebound: listBoundTransition;

delegate: IRadioDelegate{
Expand All @@ -18,7 +21,7 @@ ListView {
model: iradiolistmodel

Connections {
onFlickStarted : {
function onFlickStarted() {
viewResetTimer.restart();
}
}
Expand Down
20 changes: 12 additions & 8 deletions qtgui/qml/PlayerControlWidget.qml
Original file line number Diff line number Diff line change
@@ -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 <thomas@ruschival.de>
* 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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -61,7 +65,7 @@ Popup {

onClicked: {
interactiontimer.restart()
if (playerProxy.playbackState == MediaPlayer.PlayingState) {
if (playerProxy.playbackState === MediaPlayer.PlayingState) {
playerProxy.pause()
} else {
playerProxy.play()
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Loading

0 comments on commit 64b9ec7

Please sign in to comment.