Debian Codegraph @

HercConfiguration/GenericDeviceProperties.cpp

raw symbols SCIP
1 /*
2 * File: GenericDeviceProperties.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 "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/
26 #include "GenericDeviceProperties.h"cxx . . $ `<file>/HercConfiguration/GenericDeviceProperties.h`/
27 #include "TerminalProperties.h"cxx . . $ `<file>/HercConfiguration/TerminalProperties.h`/
28 #include "SysgProperties.h"cxx . . $ `<file>/HercConfiguration/SysgProperties.h`/
29 #include "ConsoleProperties.h"cxx . . $ `<file>/HercConfiguration/ConsoleProperties.h`/
30 #include "PrinterProperties.h"cxx . . $ `<file>/HercConfiguration/PrinterProperties.h`/
31 #include "CardReaderProperties.h"cxx . . $ `<file>/HercConfiguration/CardReaderProperties.h`/
32 #include "PunchProperties.h"cxx . . $ `<file>/HercConfiguration/PunchProperties.h`/
33 #include "TapeProperties.h"cxx . . $ `<file>/HercConfiguration/TapeProperties.h`/
34 #include "CtcProperties.h"cxx . . $ `<file>/HercConfiguration/CtcProperties.h`/
35 #include "DasdProperties.h"cxx . . $ `<file>/HercConfiguration/DasdProperties.h`/
36 #include "DevicesWidget.h"cxx . . $ `<file>/HercConfiguration/DevicesWidget.h`/
37 #include "ConfigurationEditor.h"cxx . . $ `<file>/HercConfiguration/ConfigurationEditor.h`/
38
39 #include <QMessageBox>
40
41 #include <sstream>
42 #include <iomanip>
43
44 GenericDevicePropertiescxx . . $ GenericDeviceProperties#::GenericDevicePropertiescxx . . $ GenericDeviceProperties#GenericDeviceProperties(b7c8c82eacf24532).(ConfigLinecxx . . $ ConfigLine#& line, QWidgetcxx . . $ QWidget# *parent)
45 : IpValidatorcxx . . $ IpValidator#(parent) , mLinecxx . . $ GenericDeviceProperties#mLine.(line), mParentcxx . . $ GenericDeviceProperties#mParent.(parent),
46 mOriginalDeviceNumbercxx . . $ GenericDeviceProperties#mOriginalDeviceNumber.(ConfigurationEditorcxx . . $ ConfigurationEditor#::parseNumcxx . . $ ConfigurationEditor#parseNum(7b1020165ab78f0a).(mLinecxx . . $ GenericDeviceProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(0),16))
47 {
48
49
50 }
51
52 GenericDevicePropertiescxx . . $ GenericDeviceProperties#::~cxx . . $ GenericDeviceProperties#`~GenericDeviceProperties`(49f6e7a06ebc5aa8).GenericDevicePropertiescxx . . $ GenericDeviceProperties#()
53 {
54
55 }
56
57 GenericDevicePropertiescxx . . $ GenericDeviceProperties# * GenericDevicePropertiescxx . . $ GenericDeviceProperties#::classFactorycxx . . $ GenericDeviceProperties#classFactory(a94d470fa14a4f70).(DeviceConfigLinecxx . . $ DeviceConfigLine#& line, QWidgetcxx . . $ QWidget# *parent, DeviceTypescxx . . $ DeviceTypes#::Typecxx . . $ DeviceTypes#Type# type)
58 {
59 if (type == 0)
60 type = line.getDeviceTypecxx . . $ DeviceConfigLine#getDeviceType(2700e08780fa2d6b).();
61 hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(1, "GenericDeviceProperties::classFactory " << type);
62 switch(type)
63 {
64 case DeviceTypescxx . . $ DeviceTypes#::Terminalcxx . . $ DeviceTypes#Terminal.:
65 return new TerminalPropertiescxx . . $ TerminalProperties#(line,parent);
66 case DeviceTypescxx . . $ DeviceTypes#::Consolecxx . . $ DeviceTypes#Console.:
67 return new ConsolePropertiescxx . . $ ConsoleProperties#(line,parent);
68 case DeviceTypescxx . . $ DeviceTypes#::Printercxx . . $ DeviceTypes#Printer.:
69 return new PrinterPropertiescxx . . $ PrinterProperties#(line,parent);
70 case DeviceTypescxx . . $ DeviceTypes#::CardReadercxx . . $ DeviceTypes#CardReader.:
71 return new CardReaderPropertiescxx . . $ CardReaderProperties#(line,parent);
72 case DeviceTypescxx . . $ DeviceTypes#::CardPunchcxx . . $ DeviceTypes#CardPunch.:
73 return new PunchPropertiescxx . . $ PunchProperties#(line,parent);
74 case DeviceTypescxx . . $ DeviceTypes#::Tapecxx . . $ DeviceTypes#Tape.:
75 return new TapePropertiescxx . . $ TapeProperties#(line,parent);
76 case DeviceTypescxx . . $ DeviceTypes#::CTCcxx . . $ DeviceTypes#CTC.:
77 return new CtcPropertiescxx . . $ CtcProperties#(line,parent);
78 case DeviceTypescxx . . $ DeviceTypes#::DASDcxx . . $ DeviceTypes#DASD.:
79 return new DasdPropertiescxx . . $ DasdProperties#(line,parent);
80 case DeviceTypescxx . . $ DeviceTypes#::Sysgcxx . . $ DeviceTypes#Sysg.:
81 return new SysgPropertiescxx . . $ SysgProperties#(line,parent);
82 default:
83 throw hsExceptioncxx . . $ hsException#("Invalid device, "cxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).+cxx . . $ std/operator+(39ed2c165380f78e). line.getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(1));
84 }
85 }
86
87 bool GenericDevicePropertiescxx . . $ GenericDeviceProperties#::deviceNumberValidatorcxx . . $ GenericDeviceProperties#deviceNumberValidator(5bc323e34e13a656).(QLineEditcxx . . $ QLineEdit# * deviceLine)
88 {
89 // check that field is not empty
90 if (deviceLine->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() || !ConfigurationEditorcxx . . $ ConfigurationEditor#::validateNumcxx . . $ ConfigurationEditor#validateNum(495ddb8d7f661655).(deviceLine->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(),16))
91 {
92 QMessageBoxcxx . . $ QMessageBox# * p = new QMessageBoxcxx . . $ QMessageBox#(this);
93 p->setTextcxx . . $ QMessageBox#setText(3520e46b33348bf6).("Please enter device number in the range 0000-ffff"cxx . . $ QString#QString(85c52e162fed56f9).);
94 p->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
95 deviceLine->setFocuscxx . . $ QWidget#setFocus(49f6e7a06ebc5aa8).();
96 return false;
97 }
98
99 //make sure device number is new/unique
100 DevicesWidgetcxx . . $ DevicesWidget# * dev = dynamic_cast<DevicesWidgetcxx . . $ DevicesWidget# *>(mParentcxx . . $ GenericDeviceProperties#mParent.);
101 // if parent is not DevicesWidget, it must be a live update while hercules is running
102 if (dev == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
103 return true;
104
105 stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# buffcxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;
106 int iDevno = ConfigurationEditorcxx . . $ ConfigurationEditor#::parseNumcxx . . $ ConfigurationEditor#parseNum(7b1020165ab78f0a).(deviceLine->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(),16);
107 if (iDevno != mOriginalDeviceNumbercxx . . $ GenericDeviceProperties#mOriginalDeviceNumber.)
108 {
109 buff <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::hexcxx . . $ std/hex(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(4) <<cxx . . $ std/`operator<<`(47f1cf32aeb3f1a2). stdcxx . . $ std/::setfillcxx . . $ std/setfill(ade351e831a1374a).('0') <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::uppercasecxx . . $ std/uppercase(cf36cc481190cd1f).
110 <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). iDevno;
111 stdcxx . . $ std/::stringcxx . . $ std/string# devno = buffcxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f)..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).();
112 if (!dev->isUniquecxx . . $ DevicesWidget#isUnique(c9120223c4466434).(devnocxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).))
113 {
114 QMessageBoxcxx . . $ QMessageBox# * p = new QMessageBoxcxx . . $ QMessageBox#(this);
115 p->setTextcxx . . $ QMessageBox#setText(3520e46b33348bf6).("This device number is already used"cxx . . $ QString#QString(85c52e162fed56f9).);
116 p->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
117 return false;
118 }
119 }
120 return true;
121
122 }
123