raDIYo 0.4
swalarmcontrol.cpp
1/***************************************************************************
2
3 source::worx raDIYo
4 Copyright © 2020-2022 c.holzheuer
5 c.holzheuer@sourceworx.org
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12***************************************************************************/
13
14#include <QDebug>
15#include <QPainter>
16#include <QKeyEvent>
17#include <QTime>
18#include <QAction>
19#include <QtMath>
20
21#include <swalarmcontrol.h>
22
23SWAlarmControl::SWAlarmControl( SWRaDIYoMainWidget* parent )
24 : SWAbstractControl( parent )
25{
26
27 setAttribute( Qt::WA_OpaquePaintEvent, true );
28 //setAttribute( Qt::WA_NoSystemBackground, true );
29
30 setupUi( this );
31/*
32 //setStyleSheet( "background: rgb( 234,234,234 )" );
33 _weekdayButtons.setExclusive( false );
34 _weekdayButtons.addButton( _buttonMon, Qt::Monday );
35 _weekdayButtons.addButton( _buttonTue, Qt::Tuesday );
36 _weekdayButtons.addButton( _buttonWed, Qt::Wednesday );
37 _weekdayButtons.addButton( _buttonThu, Qt::Thursday );
38 _weekdayButtons.addButton( _buttonFri, Qt::Friday );
39 _weekdayButtons.addButton( _buttonSat, Qt::Saturday );
40 _weekdayButtons.addButton( _buttonSun, Qt::Sunday );
41*/
42 // du weiss das das nicht geht!
43 loadSettings();
44}
45
46
47SWAlarmControl::~SWAlarmControl()
48{
49
50}
51
52void SWAlarmControl::paintEvent( QPaintEvent *event )
53{
54 //QPainter painter( this );
55 //painter.fillRect( rect(), QColor( 234, 234, 234) );
56 return QWidget::paintEvent( event );
57}
58
59void SWAlarmControl::onDialClicked()
60{
61 qDebug() << "alarm onClick";
62}
63
64
65void SWAlarmControl::onDialValueChanged( int value )
66{
67 qDebug() << "alarm on ValueChanged: " << value;
68}
69
70void SWAlarmControl::loadSettings()
71{
72 /*
73 int hours = _settings.value( SWALARMHOURS, 07 ).toInt();
74 _hours->setNumber( hours );
75 int minutes = _settings.value( SWALARMMINUTES, 30 ).toInt();
76 _minutes->setNumber( minutes );
77 int weekdays = _settings.value( SWALARMWEEKDAYS, 0 ).toInt();
78 weekdays = 1|4|32;
79 for( int day = Qt::Monday; day <= Qt::Sunday; ++day )
80 {
81 int bitno = (int) qPow( 2, day );
82 bool checked = weekdays & bitno;
83 qDebug() << "day: " << day << " bitno: " << bitno << " checked " << checked;
84 _weekdayButtons.button( day )->setChecked( checked );
85 }
86 //QStringList list1 = str.split(QLatin1Char(','));;
87 //static const char* raDIYo::AppName = "raDIYo";
88 */
89}
90
91void SWAlarmControl::saveSettings()
92{
93
94}