Debian Codegraph @

HercStudio/MipsLed.cpp

raw symbols SCIP
1 /*
2 * File: MipsLcd.cpp
3 *
4 * Author: Jacob Dekel
5 * Created on: Jun 15, 2010
6 *
7 * Copyright (c) 2009-2013 Jacob Dekel
8 * $Id$
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25 #include "MipsLed.h"
26 #include "HerculesStudio.h"
27 #include "Preferences.h"
28
29 #include <QLCDNumber>
30
31 MipsLed::MipsLed(QWidget * parent)
32 : Mips(parent)
33 {
34 mMips = new QLCDNumber(6,parent);
35 mMips->setSegmentStyle(QLCDNumber::Flat);
36 mMips->setFrameShape( QLCDNumber::NoFrame );
37 mMips->setVisible(true);
38 }
39
40 MipsLed::~MipsLed()
41 {
42 }
43
44 void MipsLed::move(int x, int y)
45 {
46 mMips->move(x,y);
47 }
48
49 void MipsLed::display(double value)
50 {
51 mMips->display(value);
52 }
53
54 void MipsLed::setActive(bool active)
55 {
56 if (active)
57 {
58 if (Preferences::getInstance().greenLed())
59 mMips->setStyleSheet("QLCDNumber { color: #00ff00;}");
60 else
61 mMips->setStyleSheet("QLCDNumber { color: #ff0000;}");
62 }
63 else
64 if (Preferences::getInstance().greenLed())
65 mMips->setStyleSheet("QLCDNumber { color: #005000;}");
66 else
67 mMips->setStyleSheet("QLCDNumber { color: #700000;}");
68
69 }
70
71 void MipsLed::setToolTip(const QString & tip)
72 {
73 mMips->setToolTip(tip);
74 }
75
76 void MipsLed::deleteLater()
77 {
78 mMips->deleteLater();
79 }
80
81 bool MipsLed::isVisible()
82 {
83 return mMips->isVisible();
84 }