-
Notifications
You must be signed in to change notification settings - Fork 4
/
securityscreen.cpp
475 lines (402 loc) · 21.8 KB
/
securityscreen.cpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
/****************************************************************************
**
** Copyright (C) 2013 Atmel Corporation and/or its subsidiary(-ies).
** All rights reserved.
**
** LIMITED License Agreement
**
** IT IS IMPORTANT THAT YOU READ THIS AGREEMENT CAREFULLY AND COMPLETELY.
** This Limited License Agreement (“Agreement”) is a legally binding agreement between,
** on one hand, either your employer (if you are acting on behalf of your employer)
** or you (if you are acting on your own behalf) (“Licensee”), and on the other hand,
** Atmel Corporation (“Atmel”).
**
** By installing or using any of the software downloaded or provided with these
** terms (“Licensed Software”), you are indicating that you are binding Licensee
** to the terms of this Agreement, and that you are duly authorized by Licensee to do so.
** If you are not authorized to bind Licensee to the terms of this Agreement,
** or if Licensee does not agree to be bound by all of the terms of this Agreement,
** do not install or use any such software.
**
**
** 1. Grant of License. Subject to the terms and conditions of this Agreement,
** Atmel grants Licensee a non-exclusive, non-transferable, non-sublicensable,
** limited license to use the Licensed Software solely in connection with Atmel products
** from SAM9 and SAMA5 families (“Atmel Product”).
**
** 2. Restrictions. Except as expressly set forth in Section 1, Licensee will not,
** and will have no right to, (a) use, copy or reproduce any Licensed Software except,
** (b) modify, create derivative works of, sell, distribute, transfer or disclose any
** Licensed Software. Without limiting the generality of the foregoing, Licensee will not,
** and will have no right to, use any Licensed Software for any semiconductor products
** that are not Atmel Products. Licensee will not remove, obscure or alter any trademark,
** copyright or other proprietary rights or ownership notices of Atmel that appear
** in any Licensed Software.
**
** 3. Title. As between the parties, Atmel retains full rights, title, and ownership
** including all patents, copyrights, trade secrets, trade names, trademarks, and other
** intellectual property rights in and to the Licensed Software.
**
** 4. No Other Rights. Except as expressly stated herein, this Agreement does not grant
** Licensee any rights to patents, copyrights, trade secrets, trade names, trademarks
** (whether registered or unregistered), or any other rights, franchises, or licenses
** in respect of the Licensed Software.
**
** 5. Disclaimer of Warranty and No Support. ALL LICENSED SOFTWARE IS PROVIDED “AS IS”,
** “WITH ALL FAULTS”, AND WITH NO WARRANTY WHATSOEVER. ATMEL EXPRESSLY DISCLAIMS ALL
** WARRANTIES OF ANY KIND (WHEHTER EXPRESS, IMPLIED, STATUTORY OR OTHERWISE) IN CONNECTION
** WITH THE LICENSED SOFTWARE OR ANY OTHER ASPECT OF THIS AGREEMENT, INCLUDING, WITHOUT
** LIMITATION ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
** TITLE OR NON-INFRINGEMENT OF THIRD PARTY RIGHTS, AND ANY WARRANTIES THAT MAY ARISE
** FROM COURSE OF DEALING, COURSE OF PERFORMANCE OR USAGE OF TRADE. ATMEL WILL HAVE
** NO OBLIGATION UNDER THIS AGREEMENT TO CORRECT ANY BUGS, DEFECTS OR ERRORS IN
** THE LICENSED SOFTWARE, PROVIDE ANY UPDATES, UPGRADES OR NEW RELEASES OF THE LICENSED SOFTWARE,
** OR OTHERWISE PROVIDE ANY SUPPORT OR MAINTENANCE FOR THE LICENSED SOFTWARE.
**
** 6. Export. Licensee will comply with all applicable laws and regulations of all
** relevant jurisdictions in connection with its activities related to the Licensed Software.
** Without limitation of the foregoing, Licensee acknowledges that certain laws
** and regulations of the United States and other jurisdictions may pertain to the export
** and re-export of the Licensed Software, and Licensee will not export or re-export
** any Licensed Software in any form without the appropriate governmental approvals,
** or otherwise in violation of any such laws or regulations.
**
** 7. Termination. The license will automatically terminate if Licensee fails to comply
** with any of the terms and conditions of the license including, without limitation
** the confidentiality obligation or the obligations set forth in Sections 1, 2, 6, 7, 10
** and 11 herein. Upon termination for any reason, Licensee will immediately destroy
** or return to Atmel all whole or partial copies of the Licensed Software.
**
** 8. High Risk Activities. LICENSEE ACKNOWLEDGES AND AGREES THAT THE LICENSED SOFTWARE
** IS NOT DESIGNED OR APPROVED FOR, AND WILL NOT BE INCORPORATED (WITHOUT THE EXPRESS WRITTEN
** APPROVAL OF AN OFFICER OF ATMEL) INTO, ANY PRODUCTS THAT ARE USED OR DESIGNED TO BE USED
** IN CONNECTION WITH ANY ACTIVITIES WHERE THE FAILURE OF SUCH PRODUCTS COULD REASONABLY
** BE EXPECTED TO RESULT IN DEATH, BODILY INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE
** ("HIGH RISK ACTIVITIES"). IN NO EVENT WILL ATMEL HAVE ANY LIABILITY TO LICENSEE
** OR ANY THIRD PARTY ARISING OUT OF OR RELATED TO ANY USE OF LICENSED SOFTWARE IN CONNECTION
** WITH HIGH RISK ACTIVITIES, AND ATMEL HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF
** FITNESS FOR ANY HIGH RISK ACTIVITIES.
**
** 9. LIMITATION OF LIABILITY. TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL
** ATMEL BE LIABLE TO LICENSEE OR ANY THIRD PARTY (WHETHER SUCH LIABILITY IS BASED ON CONTRACT,
** NEGLIGENCE, STRICT LIABILITY, OTHER TORT THEORY, CONTRIBUTION, BREACH OF WARRANTY,
** OR OTHER LEGAL OR EQUITABLE THEORY) FOR ANY SPECIAL, INDIRECT, INCIDENTAL, EXEMPLARY,
** PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES FOR LOSS OF PROFITS,
** LOSS OR INTERRUPTION OF BUSINESS, OR LOSS OF DATA, ARISING OUT OF OR RELATING TO
** THE LICENSED SOFTWARE OR ANY OTHER ASPECT OF THIS AGREEMENT, EVEN IF ATMEL has been advised
** of or should have known of the possibility of such damages.
**
** IN NO EVENT WILL ATMEL’S TOTAL LIABILITY ARISING OUT OF OR RELATED TO THE LICENSED SOFTWARE
** OR ANY OTHER ASPECT OF THIS AGREEMENT (WHETHER UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY,
** CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL OR EQUITABLE THEORY) EXCEED THE GREATER OF
** (A) THE AGGREGATE OF ALL LICENSE FEES PAID BY LICENSEE TO ATMEL FOR THE LICENSED SOFTWARE, OR
** (B) ONE THOUSAND DOLLARS ($1,000). WITHOUT LIMITING THE FOREGOING,
** AND Notwithstanding any provision herein to the contrary, ATMEL will not be liable for
** ANY costs of PROCURING SUBSTITUTE GOODS, SERVICES OR TECHNOLOGY under any circumstances.
**
** Each Party acknowledges that THE OTHER PARTY has entered into this agreement in reliance
** on the limitations of liability, DISCLAIMERS OF WARRANTIES, EXCLUSION OF DAMAGES
** AND EXCLUSIVE REMEDIES contained in this AGREEMENT, AND THAT EACH OF THE FOREGOING PROVISIONS FORMS
** AN ESSENTIAL AND fundamental part of the basis of the bargain BETWEEN THE PARTIES,
** WITHOUT WHICH SUCH the other Party would not have entered into this Agreement.
** EACH PARTY AGREES THAT SUCH PROVISIONS WILL SURVIVE AND APPLY NOTWITHSTANDING ANY
** FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY OR LIMITATION OF LIABILITY.
**
** 10. Governing Law; Dispute Resolution. This Agreement is to be construed in accordance
** with and governed by the internal laws of the State of California (as permitted by Section 1646.5
** of the California Civil Code or any similar successor provision), without giving effect
** to any choice of law rule that would cause the application of the laws of any jurisdiction
** other than the internal laws of the State of California to the rights and duties of the parties.
** This Agreement will not be governed by the U.N. Convention on the Sale of Goods,
** the application of which is expressly excluded. Except for actions for injunctive
** or other equitable relief, which may be brought in any court of competent jurisdiction,
** all disputes arising out of or related to this Agreement will be subject to the exclusive
** jurisdiction of the California state courts in Santa Clara County, California,
** or if there is exclusive federal jurisdiction, the United States District Court for
** the Northern District of California, and the Parties hereby consent to, and agree to submit to,
** the personal and exclusive jurisdiction and venue of such courts.
**
** 11. General. Licensee will not, and will have no right to, assign, delegate or otherwise
** transfer (whether voluntarily, by operation of law or otherwise) this Agreement or any of
** its rights or obligations hereunder to any third party without the prior written consent
** of Atmel, and any purported assignment, delegation or other transfer without such consent
** will have no force or effect. Subject to the foregoing, this Agreement will be binding upon
** and will inure to the benefit of the parties and their respective successors and permitted assigns.
** No failure of either party to enforce any right under this Agreement will be deemed a waiver
** of such right or any other right under this Agreement. Any waiver by a party of a breach
** of any provision of this Agreement by the other party hereunder will not be deemed to be
** a waiver of any subsequent breach of such provision or a waiver of any breach of any other
** provision of this Agreement.
** This Agreement may not be superseded, modified, or amended except in a writing signed by an officer
** of each party. If any provision of this Agreement is determined to be invalid, illegal
** or otherwise unenforceable, such provision will be enforced to the extent possible consistent
** with the intent of the parties, and the remaining provisions of this Agreement will remain in
** full force and effect. This Agreement will be fairly interpreted in accordance with its terms
** and without any strict construction against either party because it was drafted by such party
** or for any other reason. This Agreement will constitute the entire agreement between the parties
** relating to the subject matter hereof, and expressly supersedes and replaces all prior
** and contemporaneous agreements, proposals, quotations, negotiations and communications, written
** or oral, between the parties relating to such subject matter.
**
**
** Software Author: Timesys Corporation (www.timesys.com)
**
** Summary: Qt UI handling class for the Security screen. Please consult securityscreen.ui file for
** object definitions
**
****************************************************************************/
#include <QPropertyAnimation>
#include <QParallelAnimationGroup>
#include <QTimer>
#include <QDebug>
#include "securityscreen.h"
#include "ui_securityscreen.h"
/***
** Default constructor
**/
SecurityScreen::SecurityScreen(QWidget *parent) :
QWidget(parent),
ui(new Ui::SecurityScreen)
{
ui->setupUi(this);
if (isSmallResolution) {
autoHideTimer = new QTimer(this);
timeOut = 3000;
autoHideTimer->setSingleShot(true);
connect (autoHideTimer, SIGNAL(timeout()), this, SLOT(toggleMenus()));
float wSFactor = 480. / 800.;
float hSFactor = 272. / 480.;
setGeometry(0, 0, this->width() * wSFactor, this->height() * hSFactor);
ui->label->setPixmap(QPixmap(QString::fromUtf8(":/resources/smalltopnav-all/title-security.png")));
ui->label_2->setPixmap(QPixmap(QString::fromUtf8(":/resources/smalltopnav-all/nav-filler.png")));
QSize size = QSize(60 * wSFactor, 60 * hSFactor);
QIcon icon;
icon.addFile(QString::fromUtf8(":/resources/smallcamera/Security_btn_1_talk.png"), QSize(), QIcon::Normal, QIcon::On);
ui->pushButtonSpeak->setIcon(icon);
ui->pushButtonSpeak->setIconSize(size);
ui->pushButtonSpeak->setMinimumSize(0,0);
ui->pushButtonSpeak->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QIcon icon1;
icon1.addFile(QString::fromUtf8(":/resources/smallcamera/Security_btn_3_noaccess.png"), QSize(), QIcon::Normal, QIcon::On);
ui->pushButtonAlert->setIcon(icon1);
ui->pushButtonAlert->setIconSize(size);
ui->pushButtonAlert->setMinimumSize(0,0);
ui->pushButtonAlert->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QIcon icon2;
icon2.addFile(QString::fromUtf8(":/resources/smallcamera/Security_btn_2_allowaccess.png"), QSize(), QIcon::Normal, QIcon::On);
ui->pushButtonBuzz->setIcon(icon2);
ui->pushButtonBuzz->setIconSize(size);
ui->pushButtonBuzz->setMinimumSize(0,0);
ui->pushButtonBuzz->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
ui->label->setMaximumSize(ui->label->maximumWidth() * wSFactor, ui->label->maximumHeight() * hSFactor);
ui->label_2->setMaximumSize(ui->label_2->maximumWidth() * wSFactor, ui->label_2->maximumHeight() * hSFactor);
ui->buttonZone1->setMinimumSize(ui->buttonZone1->minimumWidth() * wSFactor, ui->buttonZone1->minimumHeight() * hSFactor);
ui->buttonZone2->setMinimumSize(ui->buttonZone2->minimumWidth() * wSFactor, ui->buttonZone2->minimumHeight() * hSFactor);
ui->buttonZone3->setMinimumSize(ui->buttonZone3->minimumWidth() * wSFactor, ui->buttonZone3->minimumHeight() * hSFactor);
QFont f = ui->buttonZone1->font();
f.setPointSize(f.pointSize() * hSFactor-2);
ui->buttonZone1->setFont(f);
f = ui->buttonZone2->font();
f.setPointSize(f.pointSize() * hSFactor-2);
ui->buttonZone2->setFont(f);
f = ui->buttonZone3->font();
f.setPointSize(f.pointSize() * hSFactor-2);
ui->buttonZone3->setFont(f);
ui->topMenuLayout->setMargin(0);
// Add toggle button
QIcon icon3;
icon3.addFile(QString::fromUtf8(":/resources/smallcamera/up.png"), QSize(), QIcon::Normal, QIcon::Off);
icon3.addFile(QString::fromUtf8(":/resources/smallcamera/down.png"), QSize(), QIcon::Normal, QIcon::On);
QPushButton *toggleButton = new QPushButton(ui->buttonWidget);
toggleButton->setObjectName(QString::fromUtf8("toggleButton"));
toggleButton->setFocusPolicy(Qt::NoFocus);
toggleButton->setAutoFillBackground(false);
toggleButton->setEnabled(true);
toggleButton->setFlat(true);
toggleButton->setCheckable(true);
toggleButton->setChecked(false);
toggleButton->setIcon(icon3);
toggleButton->setIconSize(size);
toggleButton->setMinimumSize(0,0);
toggleButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
ui->buttonNaviLayout->insertWidget(0, toggleButton);
connect (toggleButton, SIGNAL(clicked()), this, SLOT(toggleMenus()));
ui->buttonWidget->resize(60, 272 - ui->topMenuWidget->height());
// move button to right bottom corner with only switch up visible button
ui->buttonWidget->move(this->width() - 37, 272 - 50);
ui->buttonWidget->setStyleSheet("background-color: rgb(21, 26, 32)");
ui->topMenuWidget->resize(480, ui->topMenuWidget->height());
ui->topMenuWidget->move(-ui->topMenuWidget->width(), 0);
ui->topMenuWidget->setStyleSheet("background-color: rgb(21, 26, 32)");
// Reparent menu widget
ui->verticalLayout_2->removeWidget(ui->topMenuWidget);
delete ui->verticalLayout_2;
ui->graphicsWidgetLayout->removeWidget(ui->cameraSurveillance);
ui->graphicsWidgetLayout->removeWidget(ui->buttonWidget);
delete ui->graphicsWidgetLayout;
ui->cameraSurveillance->setParent(this);
ui->buttonWidget->setParent(this);
ui->topMenuWidget->setParent(this);
// Change paint order
ui->topMenuWidget->stackUnder(this);
ui->buttonWidget->stackUnder(ui->topMenuWidget);
ui->cameraSurveillance->stackUnder(ui->buttonWidget);
ui->buttonNaviLayout->setContentsMargins(0, 0, 0, 0);
ui->buttonNaviLayout->setMargin(0);
ui->buttonNaviLayout->setSpacing(18);
ui->cameraSurveillance->resize(444, 272);
connect (ui->pushButtonAlert, SIGNAL(clicked()), this, SLOT(runTimer()));
connect (ui->pushButtonBuzz, SIGNAL(clicked()), this, SLOT(runTimer()));
connect (ui->pushButtonSpeak, SIGNAL(clicked()), this, SLOT(runTimer()));
} else {
ui->label->setPixmap(QPixmap(QString::fromUtf8(":/resources/topnav-all/title-security.png")));
ui->label_2->setPixmap(QPixmap(QString::fromUtf8(":/resources/topnav-all/nav-filler.png")));
QSize size = QSize(60, 60);
QIcon icon;
icon.addFile(QString::fromUtf8(":/resources/camera/Security_btn_1_talk.png"), QSize(), QIcon::Normal, QIcon::On);
ui->pushButtonSpeak->setIcon(icon);
ui->pushButtonSpeak->setIconSize(size);
QIcon icon1;
icon1.addFile(QString::fromUtf8(":/resources/camera/Security_btn_3_noaccess.png"), QSize(), QIcon::Normal, QIcon::On);
ui->pushButtonAlert->setIcon(icon1);
ui->pushButtonAlert->setIconSize(size);
QIcon icon2;
icon2.addFile(QString::fromUtf8(":/resources/camera/Security_btn_2_allowaccess.png"), QSize(), QIcon::Normal, QIcon::On);
ui->pushButtonBuzz->setIcon(icon2);
ui->pushButtonBuzz->setIconSize(size);
}
}
/***
** Default destructor
**/
SecurityScreen::~SecurityScreen()
{
delete ui;
}
/***
** Display live video from the first USB connected camera
**/
void SecurityScreen::on_buttonZone1_clicked()
{
ui->cameraSurveillance->stopVideo();
ui->cameraSurveillance->onStartVideo(QString("/dev/video0"));
ui->buttonZone1->setChecked(true);
ui->buttonZone2->setChecked(false);
ui->buttonZone3->setChecked(false);
runTimer();
//TODO: Can add face recognition processing code here, or
// store the feed into a local or a remote file, or
// do any other processing of the video feed
}
/***
** Display live video from the second USB connected camera
**/
void SecurityScreen::on_buttonZone2_clicked()
{
ui->cameraSurveillance->stopVideo();
ui->cameraSurveillance->onStartVideo(QString("/dev/video1"));
ui->buttonZone1->setChecked(false);
ui->buttonZone2->setChecked(true);
ui->buttonZone3->setChecked(false);
runTimer();
}
/***
** Display live video from the third USB connected camera
**/
void SecurityScreen::on_buttonZone3_clicked()
{
ui->cameraSurveillance->stopVideo();
ui->cameraSurveillance->onStartVideo(QString("/dev/video2"));
ui->buttonZone1->setChecked(false);
ui->buttonZone2->setChecked(false);
ui->buttonZone3->setChecked(true);
runTimer();
}
/***
** Run single shot timer to auto hide menus, for small resolution
**/
void SecurityScreen::runTimer()
{
// Run only in small resolution
if (!isSmallResolution)
return;
if (autoHideTimer->isActive()) {
autoHideTimer->stop();
}
autoHideTimer->start(timeOut);
}
/***
** Reset live camera capture screen. Turn off all camera feeds
**/
void SecurityScreen::turnOffCameras()
{
ui->buttonZone1->setChecked(false);
ui->buttonZone2->setChecked(false);
ui->buttonZone3->setChecked(false);
ui->cameraSurveillance->stopVideo();
}
/***
** Set Zone Names based on Settings panel entries
**/
void SecurityScreen::setSecurityZoneNames(QStringList& zoneList)
{
if(zoneList.size() > 0)
ui->buttonZone1->setText(zoneList.at(0));
if(zoneList.size() > 1)
ui->buttonZone2->setText(zoneList.at(1));
if(zoneList.size() > 2)
ui->buttonZone3->setText(zoneList.at(2));
}
/***
** Toggle visibility of menus on Ui
**/
void SecurityScreen::toggleMenus()
{
if (this->sender() == autoHideTimer) {
setButtonState(false);
} else {
autoHideTimer->stop();
}
QPropertyAnimation *buttonsAnim = new QPropertyAnimation(ui->buttonWidget, "geometry");
QPropertyAnimation *topMenuAnim = new QPropertyAnimation(ui->topMenuWidget, "geometry");
// Determine Ui widget position, if pos.x if > height() * .5 widget is on top
buttonsAnim->setDuration(transition_speed);
buttonsAnim->setStartValue(ui->buttonWidget->geometry());
topMenuAnim->setDuration(transition_speed);
topMenuAnim->setStartValue(ui->topMenuWidget->geometry());
if (ui->buttonWidget->geometry().top() > (this->height() * .5)) {
buttonsAnim->setEndValue(QRect(this->width() - ui->buttonWidget->width(), ui->topMenuWidget->height(), ui->buttonWidget->width(), ui->buttonWidget->height()));
topMenuAnim->setEndValue(QRect(0, 0, ui->topMenuWidget->width(), ui->topMenuWidget->height()));
} else {
buttonsAnim->setEndValue(QRect(this->width() - ui->buttonWidget->width(), this->height() - 50, ui->buttonWidget->width(), ui->buttonWidget->height()));
topMenuAnim->setEndValue(QRect(-ui->topMenuWidget->width(), 0, ui->topMenuWidget->width(), ui->topMenuWidget->height()));
}
QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
group->addAnimation(buttonsAnim);
group->addAnimation(topMenuAnim);
connect (group, SIGNAL(finished()), this, SLOT(animFinished()));
group->start(QAbstractAnimation::DeleteWhenStopped);
}
void SecurityScreen::animFinished()
{
if (getButtonState())
runTimer();
}
void SecurityScreen::setButtonState(bool isChecked)
{
QPushButton *button = ui->buttonWidget->findChild<QPushButton *>("toggleButton");
if (!button) {
qDebug() << "null widget";
return;
}
button->setChecked(isChecked);
}
bool SecurityScreen::getButtonState()
{
QPushButton *button = ui->buttonWidget->findChild<QPushButton *>("toggleButton");
if (!button) {
qDebug() << "null widget";
return false;
}
return button->isChecked();
}