| 1 | /* |
| 2 | * File: ConsoleProperties.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 "ConsoleProperties.h"cxx . . $ `<file>/HercConfiguration/ConsoleProperties.h`/ |
| 26 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 27 | |
| 28 | #include <sstream> |
| 29 | #include <iostream> |
| 30 | |
| 31 | ConsolePropertiescxx . . $ ConsoleProperties#::ConsolePropertiescxx . . $ ConsoleProperties#ConsoleProperties(b7c8c82eacf24532).(ConfigLinecxx . . $ ConfigLine# & line, QWidgetcxx . . $ QWidget# *parent) |
| 32 | : GenericDevicePropertiescxx . . $ GenericDeviceProperties#(line, parent), mLinecxx . . $ ConsoleProperties#mLine.(line) |
| 33 | { |
| 34 | uicxx . . $ ConsoleProperties#ui..setupUicxx . . $ Ui_ConsolePropertiesClass#setupUi(108f35f7aa7f3cf9).(this); |
| 35 | if (!mLinecxx . . $ ConsoleProperties#mLine..isNewcxx . . $ ConfigLine#isNew(50ce9a9e25b4a850).()) |
| 36 | { |
| 37 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5, "not new" << mLine.getLine()); |
| 38 | uicxx . . $ ConsoleProperties#ui..deviceNumbercxx . . $ Ui_ConsolePropertiesClass#deviceNumber.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(0).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 39 | |
| 40 | if (mLinecxx . . $ ConsoleProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(1) ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "1052") |
| 41 | uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->setCurrentIndexcxx . . $ QComboBox#setCurrentIndex(d4f767463ce0a6b3).(0); |
| 42 | else if (mLinecxx . . $ ConsoleProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(1) ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "3215") |
| 43 | uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->setCurrentIndexcxx . . $ QComboBox#setCurrentIndex(d4f767463ce0a6b3).(1); |
| 44 | else if (mLinecxx . . $ ConsoleProperties#mLine..getLowercaseTokencxx . . $ ConfigLine#getLowercaseToken(ffc0d510d034206b).(1) ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "1052-c") |
| 45 | uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->setCurrentIndexcxx . . $ QComboBox#setCurrentIndex(d4f767463ce0a6b3).(2); |
| 46 | else uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->setCurrentIndexcxx . . $ QComboBox#setCurrentIndex(d4f767463ce0a6b3).(3); |
| 47 | |
| 48 | if (uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->currentIndexcxx . . $ QComboBox#currentIndex(455f465bc33b4cdf).() >= 2) |
| 49 | // integrated |
| 50 | { |
| 51 | setIntegratedcxx . . $ ConsoleProperties#setIntegrated(b45ddcbc8423892c).(true); |
| 52 | |
| 53 | if (mLinecxx . . $ ConsoleProperties#mLine..sizecxx . . $ ConfigLine#size(455f465bc33b4cdf).() > 2) |
| 54 | { |
| 55 | uicxx . . $ ConsoleProperties#ui..commandPrefixcxx . . $ Ui_ConsolePropertiesClass#commandPrefix.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(2).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 56 | } |
| 57 | } |
| 58 | else // not integrated |
| 59 | { |
| 60 | setIntegratedcxx . . $ ConsoleProperties#setIntegrated(b45ddcbc8423892c).(false); |
| 61 | int index=2; |
| 62 | if (mLinecxx . . $ ConsoleProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(index) ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "noprompt") |
| 63 | { |
| 64 | uicxx . . $ ConsoleProperties#ui..noPromptCheckBoxcxx . . $ Ui_ConsolePropertiesClass#noPromptCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(true); |
| 65 | index++; |
| 66 | } |
| 67 | |
| 68 | if (mLinecxx . . $ ConsoleProperties#mLine..sizecxx . . $ ConfigLine#size(455f465bc33b4cdf).() > index) |
| 69 | { |
| 70 | if (mLinecxx . . $ ConsoleProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(index).lengthcxx . . $ std/__cxx11/basic_string#length(48278e53df7b52a5).() > 0 && mLinecxx . . $ ConsoleProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(index)[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).0] != '*') |
| 71 | uicxx . . $ ConsoleProperties#ui..terminalGroupcxx . . $ Ui_ConsolePropertiesClass#terminalGroup.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(index).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 72 | uicxx . . $ ConsoleProperties#ui..ipAddresscxx . . $ Ui_ConsolePropertiesClass#ipAddress.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(index+1).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 73 | uicxx . . $ ConsoleProperties#ui..subnetMaskcxx . . $ Ui_ConsolePropertiesClass#subnetMask.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(index+2).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | else |
| 78 | { |
| 79 | setIntegratedcxx . . $ ConsoleProperties#setIntegrated(b45ddcbc8423892c).(false); |
| 80 | } |
| 81 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ ConsoleProperties#ui..OKButtoncxx . . $ Ui_ConsolePropertiesClass#OKButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(ok())); |
| 82 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ ConsoleProperties#ui..cancelButtoncxx . . $ Ui_ConsolePropertiesClass#cancelButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(cancel())); |
| 83 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(currentIndexChanged(int)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(deviceTypeChanged(int)) ); |
| 84 | } |
| 85 | |
| 86 | ConsolePropertiescxx . . $ ConsoleProperties#::~cxx . . $ ConsoleProperties#`~ConsoleProperties`(49f6e7a06ebc5aa8).ConsolePropertiescxx . . $ ConsoleProperties#() |
| 87 | { |
| 88 | |
| 89 | } |
| 90 | |
| 91 | void ConsolePropertiescxx . . $ ConsoleProperties#::okcxx . . $ ConsoleProperties#ok(49f6e7a06ebc5aa8).() |
| 92 | { |
| 93 | if (!deviceNumberValidatorcxx . . $ GenericDeviceProperties#deviceNumberValidator(5bc323e34e13a656).(uicxx . . $ ConsoleProperties#ui..deviceNumbercxx . . $ Ui_ConsolePropertiesClass#deviceNumber.)) |
| 94 | return; |
| 95 | if ( (uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->currentIndexcxx . . $ QComboBox#currentIndex(455f465bc33b4cdf).() < 2) && !validateIpcxx . . $ IpValidator#validateIp(8c7794b15f0d8b60).(uicxx . . $ ConsoleProperties#ui..ipAddresscxx . . $ Ui_ConsolePropertiesClass#ipAddress.,false, false)) |
| 96 | return; |
| 97 | if (!validateIpcxx . . $ IpValidator#validateIp(8c7794b15f0d8b60).(uicxx . . $ ConsoleProperties#ui..subnetMaskcxx . . $ Ui_ConsolePropertiesClass#subnetMask.,true, false)) |
| 98 | return; |
| 99 | stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# newLineBuffcxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).; |
| 100 | if (uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->currentIndexcxx . . $ QComboBox#currentIndex(455f465bc33b4cdf).() >= 2) |
| 101 | { |
| 102 | newLineBuff <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..deviceNumbercxx . . $ Ui_ConsolePropertiesClass#deviceNumber.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " |
| 103 | <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->currentTextcxx . . $ QComboBox#currentText(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " |
| 104 | <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..commandPrefixcxx . . $ Ui_ConsolePropertiesClass#commandPrefix.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() +cxx . . $ std/operator+(900ec9581c410ad9). "\n"; |
| 105 | } |
| 106 | else |
| 107 | { |
| 108 | newLineBuff <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..deviceNumbercxx . . $ Ui_ConsolePropertiesClass#deviceNumber.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() |
| 109 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..deviceCombocxx . . $ Ui_ConsolePropertiesClass#deviceCombo.->currentTextcxx . . $ QComboBox#currentText(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 110 | |
| 111 | // noprompt |
| 112 | if (uicxx . . $ ConsoleProperties#ui..noPromptCheckBoxcxx . . $ Ui_ConsolePropertiesClass#noPromptCheckBox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).()) |
| 113 | newLineBuff <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " noprompt" ; |
| 114 | |
| 115 | // terminal group |
| 116 | if (uicxx . . $ ConsoleProperties#ui..terminalGroupcxx . . $ Ui_ConsolePropertiesClass#terminalGroup.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().lengthcxx . . $ QString#length(455f465bc33b4cdf).() > 0) |
| 117 | newLineBuff <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..terminalGroupcxx . . $ Ui_ConsolePropertiesClass#terminalGroup.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 118 | else |
| 119 | newLineBuff <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " *"; |
| 120 | |
| 121 | // ip address |
| 122 | newLineBuff <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..ipAddresscxx . . $ Ui_ConsolePropertiesClass#ipAddress.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 123 | |
| 124 | // subnet mask |
| 125 | if (uicxx . . $ ConsoleProperties#ui..subnetMaskcxx . . $ Ui_ConsolePropertiesClass#subnetMask.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "...") |
| 126 | newLineBuff <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ ConsoleProperties#ui..subnetMaskcxx . . $ Ui_ConsolePropertiesClass#subnetMask.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 127 | |
| 128 | newLineBuff <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 129 | |
| 130 | } |
| 131 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5, newLineBuff.str()); |
| 132 | mLinecxx . . $ ConsoleProperties#mLine..replaceLinecxx . . $ ConfigLine#replaceLine(9c546c94e5fcce4e).(newLineBuff.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).()); |
| 133 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! updateLinecxx . . $ ConsoleProperties#updateLine(b45ddcbc8423892c).(true); |
| 134 | this->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 135 | } |
| 136 | |
| 137 | void ConsolePropertiescxx . . $ ConsoleProperties#::cancelcxx . . $ ConsoleProperties#cancel(49f6e7a06ebc5aa8).() |
| 138 | { |
| 139 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! updateLinecxx . . $ ConsoleProperties#updateLine(b45ddcbc8423892c).(false); |
| 140 | deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 141 | } |
| 142 | |
| 143 | void ConsolePropertiescxx . . $ ConsoleProperties#::setIntegratedcxx . . $ ConsoleProperties#setIntegrated(b45ddcbc8423892c).(bool integrated) |
| 144 | { |
| 145 | uicxx . . $ ConsoleProperties#ui..commandPrefixcxx . . $ Ui_ConsolePropertiesClass#commandPrefix.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(integrated); |
| 146 | uicxx . . $ ConsoleProperties#ui..noPromptCheckBoxcxx . . $ Ui_ConsolePropertiesClass#noPromptCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(!integrated); |
| 147 | uicxx . . $ ConsoleProperties#ui..label_terminalcxx . . $ Ui_ConsolePropertiesClass#label_terminal.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).( integratedcxx . . $ QString#QString(85c52e162fed56f9). ? "Command Prefix" : "Terminal Group"); |
| 148 | uicxx . . $ ConsoleProperties#ui..terminalGroupcxx . . $ Ui_ConsolePropertiesClass#terminalGroup.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(!integrated); |
| 149 | uicxx . . $ ConsoleProperties#ui..ipAddresscxx . . $ Ui_ConsolePropertiesClass#ipAddress.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(!integrated); |
| 150 | uicxx . . $ ConsoleProperties#ui..subnetMaskcxx . . $ Ui_ConsolePropertiesClass#subnetMask.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(!integrated); |
| 151 | |
| 152 | } |
| 153 | |
| 154 | void ConsolePropertiescxx . . $ ConsoleProperties#::deviceTypeChangedcxx . . $ ConsoleProperties#deviceTypeChanged(d4f767463ce0a6b3).(int index) |
| 155 | { |
| 156 | if (index >= 2) |
| 157 | setIntegratedcxx . . $ ConsoleProperties#setIntegrated(b45ddcbc8423892c).(true); |
| 158 | else |
| 159 | setIntegratedcxx . . $ ConsoleProperties#setIntegrated(b45ddcbc8423892c).(false); |
| 160 | } |