Debian Codegraph @

src/modeselector.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2014 Mario Stephan <[email protected]>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "modeselector.h"
19 #include "ui_modeselector.h"
20
21 ModeSelector::ModeSelector(QWidget *parent) :
22 QFrame(parent),
23 ui(new Ui::ModeSelector)
24 {
25 ui->setupUi(this);
26 ui->led1->setLook(QLed::Flat);
27 ui->led1->setShape(QLed::Rectangular);
28 ui->led1->setColor(QColor(35,119,246));
29 ui->led2->setLook(QLed::Flat);
30 ui->led2->setShape(QLed::Rectangular);
31 ui->led2->setColor(QColor(35,119,246));
32 ui->led3->setLook(QLed::Flat);
33 ui->led3->setShape(QLed::Rectangular);
34 ui->led3->setColor(QColor(35,119,246));
35 ui->led2->off();
36 ui->led3->off();
37 selMode = ModeSelector::MODENONE;
38 }
39
40 ModeSelector::~ModeSelector()
41 {
42 delete ui;
43 }
44
45 void ModeSelector::on_push1_clicked()
46 {
47 //ui->led1->on();
48 //ui->led2->off();
49 //ui->led3->off();
50 selMode = ModeSelector::MODENONE;
51 ui->push1->setStyleSheet("QPushButton { border: 1px solid #3399ff;}");
52 ui->push2->setStyleSheet("QPushButton { border: 1px solid #aaaaaa;}");
53 ui->push3->setStyleSheet("QPushButton { border: 1px solid #aaaaaa;}");
54 Q_EMIT modeChanged(selMode);
55 }
56 void ModeSelector::on_push2_clicked()
57 {
58 //ui->led1->off();
59 //ui->led2->on();
60 //ui->led3->off();
61 selMode = ModeSelector::MODEYEAR;
62 ui->push1->setStyleSheet("QPushButton { border: 1px solid #aaaaaa;}");
63 ui->push2->setStyleSheet("QPushButton { border: 1px solid #3399ff;}");
64 ui->push3->setStyleSheet("QPushButton { border: 1px solid #aaaaaa;}");
65 Q_EMIT modeChanged(selMode);
66 }
67 void ModeSelector::on_push3_clicked()
68 {
69 //ui->led1->off();
70 //ui->led2->off();
71 //ui->led3->on();
72 selMode = ModeSelector::MODEGENRE;
73 ui->push1->setStyleSheet("QPushButton { border: 1px solid #aaaaaa;}");
74 ui->push2->setStyleSheet("QPushButton { border: 1px solid #aaaaaa;}");
75 ui->push3->setStyleSheet("QPushButton { border: 1px solid #3399ff;}");
76 Q_EMIT modeChanged(selMode);
77 }
78 void ModeSelector::setMode(ModeSelector::modeType value)
79 {
80 switch (value)
81 {
82 case MODEGENRE:
83 on_push3_clicked();
84 break;
85 case MODEYEAR:
86 on_push2_clicked();
87 break;
88 default:
89 on_push1_clicked();
90 break;
91 }
92 }
93 ModeSelector::modeType ModeSelector::mode()
94 {
95 return selMode;
96
97 }