aboutsummaryrefslogtreecommitdiffstats
blob: ad5dbae42e3fb360fe46e5aca03ac40de288f297 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "optionswidget.h"
#include "awayscreen.h"
#include "thermostatwidget.h"
#include "schedulescreen.h"
#include "settingscreen.h"
#include "mainwindow.h"

OptionsWidget::OptionsWidget(QWidget *parent) :
    QWidget(parent)
{
    int optionButtonIconSize = 50;

    setObjectName("optionsWidget");
    setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    setAttribute(Qt::WA_StyledBackground,true);

    // create settings button
    settingsButton = new QPushButton();
    settingsButton->setIcon(QIcon(":/Images/glossy-blue-orb-icon-gears.png"));
    settingsButton->setIconSize(QSize(optionButtonIconSize,optionButtonIconSize));
    settingsButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    settingsButton->setFocusPolicy(Qt::NoFocus);

    // create settings screen
    settingScreen = new SettingScreen;
    // when settings button is clicked, show settings screen
    connect(settingsButton,SIGNAL(clicked()),settingScreen,SLOT(showFullScreen()));
    // pass C/F value from settings screen to options widget and out to main window
    connect(settingScreen, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
    // pass new city string value from settings screen to options widget and out to main window
    connect(settingScreen, SIGNAL(cityChanged()), this, SIGNAL(cityChanged()));

    // create new calender button
    calendarButton = new QPushButton();
    calendarButton->setIcon(QIcon(":/Images/glossy-blue-orb-icon-calendar.png"));
    calendarButton->setIconSize(QSize(optionButtonIconSize,optionButtonIconSize));
    calendarButton->setFocusPolicy(Qt::NoFocus);
    calendarButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // create new schedule screen
    scheduleScreen = new ScheduleScreen;
    connect(calendarButton,SIGNAL(clicked()),scheduleScreen,SLOT(showFullScreen()));
    connect(settingScreen, SIGNAL(valueChanged()), scheduleScreen, SIGNAL(valueChanged()));

    // create new away button
    awayButton = new QPushButton();
    awayButton->setIcon(QIcon(":/Images/glossy-blue-orb-icon-airplane.png"));
    awayButton->setIconSize(QSize(optionButtonIconSize,optionButtonIconSize));
    awayButton->setFocusPolicy(Qt::NoFocus);
    awayButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // create new away screen
    awayScreen = new AwayScreen;
    connect(awayButton,SIGNAL(clicked()),awayScreen,SLOT(showFullScreen()));
    connect(this, SIGNAL(currentTempChanged()), awayScreen, SLOT(updateCurrentTemp()));
    connect(settingScreen, SIGNAL(valueChanged()), awayScreen, SLOT(updateUnit()));


    // create layout
    QHBoxLayout *optionsLayout = new QHBoxLayout;
    optionsLayout->addWidget(settingsButton);
    optionsLayout->addWidget(calendarButton);
    optionsLayout->addWidget(awayButton);
    optionsLayout->setSpacing(0);

    // show layout
    setLayout(optionsLayout);

}