Debian Codegraph @

HercStudio/Regs64.cpp

raw symbols SCIP
1 /*
2 * File: Regs64.cpp
3 *
4 * Author: Jacob Dekel
5 * Created on: Aug 7, 2009
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 "Regs64.h"
26 #include "Preferences.h"
27
28 std::string Regs64::gCommand = "]GREGS64=";
29 std::string Regs64::cCommand = "]CREGS64=";
30 std::string Regs64::fCommand = "]FREGS64=";
31
32 Regs64::Regs64(QWidget * parent, std::string command) :
33 Regs32(parent, command),
34 mLine5(this),
35 mLine6(this),
36 mLine7(this),
37 mLine8(this)
38 {
39 setFont();
40 }
41
42 Regs64::~Regs64()
43 {
44 }
45
46 void Regs64::setActive(bool active)
47 {
48 Regs32::setActive(active);
49 mLine5.setVisible(active);
50 mLine6.setVisible(active);
51 mLine7.setVisible(active);
52 mLine8.setVisible(active);
53 std::string command = mCommand + (active ? '1' : '0');
54 }
55
56 void Regs64::setFont()
57 {
58 Regs32::setFont();
59 Preferences& pref = Preferences::getInstance();
60 int fontSize = pref.fontSize(Preferences::RegsFontObject);
61 QFont font(pref.fontName(Preferences::RegsFontObject).c_str(),
62 fontSize,
63 (pref.fontIsBold(Preferences::RegsFontObject) ? QFont::Bold : QFont::Normal),
64 pref.fontIsItalic(Preferences::RegsFontObject));
65
66 font.setStyleHint(QFont::Courier);
67 mLine5.setFont(font);
68 mLine6.setFont(font);
69 mLine7.setFont(font);
70 mLine8.setFont(font);
71 mLine5.setGeometry(fontSize*36,fontSize+2,fontSize*35,fontSize+2);
72 mLine6.setGeometry(fontSize*36,2*(fontSize+2),fontSize*35,fontSize+2);
73 mLine7.setGeometry(fontSize*36,3*(fontSize+2),fontSize*35,fontSize+2);
74 mLine8.setGeometry(fontSize*36,4*(fontSize+2),fontSize*35,fontSize+2);
75 }
76 bool Regs64::notify(const QByteArray& statusLine)
77 {
78 if (statusLine.length() < 2)
79 {
80 setFont();
81 return false;
82 }
83 if (statusLine[5] == '0')
84 Regs32::mLine1.setText(statusLine);
85 else if (statusLine[5] == '2')
86 Regs32::mLine2.setText(statusLine);
87 else if (statusLine[5] == '4')
88 Regs32::mLine3.setText(statusLine);
89 else if (statusLine[5] == '6')
90 Regs32::mLine4.setText(statusLine);
91 else if (statusLine[5] == '8')
92 Regs64::mLine5.setText(statusLine);
93 else if (statusLine[5] == 'A')
94 Regs64::mLine6.setText(statusLine);
95 else if (statusLine[5] == 'C')
96 Regs64::mLine7.setText(statusLine);
97 else if (statusLine[5] == 'E')
98 Regs64::mLine8.setText(statusLine);
99 else return false;
100
101 return true;
102 }