| 1 | /* |
| 2 | * File: PunchProperties.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 "PunchProperties.h"cxx . . $ `<file>/HercConfiguration/PunchProperties.h`/ |
| 26 | |
| 27 | #include <sstream> |
| 28 | #include <algorithm> |
| 29 | |
| 30 | PunchPropertiescxx . . $ PunchProperties#::PunchPropertiescxx . . $ PunchProperties#PunchProperties(b7c8c82eacf24532).(ConfigLinecxx . . $ ConfigLine#& line, QWidgetcxx . . $ QWidget# *parent) |
| 31 | : GenericDevicePropertiescxx . . $ GenericDeviceProperties#(line, parent) |
| 32 | { |
| 33 | uicxx . . $ PunchProperties#ui..setupUicxx . . $ Ui_PunchPropertiesClass#setupUi(108f35f7aa7f3cf9).(this); |
| 34 | |
| 35 | uicxx . . $ PunchProperties#ui..fileNamecxx . . $ Ui_PunchPropertiesClass#fileName.->setValidatorcxx . . $ QLineEdit#setValidator(65a0e52d19f97f21).(new PunchFileNameValidatorcxx . . $ PunchFileNameValidator#(this)); |
| 36 | |
| 37 | if (!line.isNewcxx . . $ ConfigLine#isNew(50ce9a9e25b4a850).()) |
| 38 | { |
| 39 | uicxx . . $ PunchProperties#ui..deviceNumbercxx . . $ Ui_PunchPropertiesClass#deviceNumber.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(0).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 40 | uicxx . . $ PunchProperties#ui..punchCombocxx . . $ Ui_PunchPropertiesClass#punchCombo.->setCurrentIndexcxx . . $ QComboBox#setCurrentIndex(d4f767463ce0a6b3).( 0 ); |
| 41 | if (mLinecxx . . $ GenericDeviceProperties#mLine..sizecxx . . $ ConfigLine#size(455f465bc33b4cdf).() > 2) |
| 42 | { |
| 43 | uicxx . . $ PunchProperties#ui..fileNamecxx . . $ Ui_PunchPropertiesClass#fileName.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(2).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 44 | uicxx . . $ PunchProperties#ui..asciiCheckBoxcxx . . $ Ui_PunchPropertiesClass#asciiCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(false); |
| 45 | uicxx . . $ PunchProperties#ui..crlfCheckBoxcxx . . $ Ui_PunchPropertiesClass#crlfCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(false); |
| 46 | uicxx . . $ PunchProperties#ui..noclearCheckBoxcxx . . $ Ui_PunchPropertiesClass#noclearCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(false); |
| 47 | for (int i=3; i< mLinecxx . . $ GenericDeviceProperties#mLine..sizecxx . . $ ConfigLine#size(455f465bc33b4cdf).(); i++) |
| 48 | { |
| 49 | stdcxx . . $ std/::stringcxx . . $ std/string# token = (cxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).mLinecxx . . $ GenericDeviceProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(i)); |
| 50 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(token.begincxx . . $ std/__cxx11/basic_string#begin(2d83d3f7098a8e9c).(), token.endcxx . . $ std/__cxx11/basic_string#end(2d83d3f7098a8e9c).(), token.begincxx . . $ std/__cxx11/basic_string#begin(2d83d3f7098a8e9c).(), ::tolower); |
| 51 | if (token ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "ascii") |
| 52 | uicxx . . $ PunchProperties#ui..asciiCheckBoxcxx . . $ Ui_PunchPropertiesClass#asciiCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(true); |
| 53 | if (token ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "crlf") |
| 54 | uicxx . . $ PunchProperties#ui..crlfCheckBoxcxx . . $ Ui_PunchPropertiesClass#crlfCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(true); |
| 55 | if (token ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "noclear") |
| 56 | uicxx . . $ PunchProperties#ui..noclearCheckBoxcxx . . $ Ui_PunchPropertiesClass#noclearCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(true); |
| 57 | } |
| 58 | } |
| 59 | else |
| 60 | { |
| 61 | uicxx . . $ PunchProperties#ui..asciiCheckBoxcxx . . $ Ui_PunchPropertiesClass#asciiCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 62 | uicxx . . $ PunchProperties#ui..crlfCheckBoxcxx . . $ Ui_PunchPropertiesClass#crlfCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 63 | uicxx . . $ PunchProperties#ui..noclearCheckBoxcxx . . $ Ui_PunchPropertiesClass#noclearCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ PunchProperties#ui..OKButtoncxx . . $ Ui_PunchPropertiesClass#OKButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(ok())); |
| 68 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ PunchProperties#ui..cancelButtoncxx . . $ Ui_PunchPropertiesClass#cancelButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(cancel())); |
| 69 | |
| 70 | } |
| 71 | |
| 72 | PunchPropertiescxx . . $ PunchProperties#::~cxx . . $ PunchProperties#`~PunchProperties`(49f6e7a06ebc5aa8).PunchPropertiescxx . . $ PunchProperties#() |
| 73 | { |
| 74 | |
| 75 | } |
| 76 | |
| 77 | void PunchPropertiescxx . . $ PunchProperties#::okcxx . . $ PunchProperties#ok(49f6e7a06ebc5aa8).() |
| 78 | { |
| 79 | if (!deviceNumberValidatorcxx . . $ GenericDeviceProperties#deviceNumberValidator(5bc323e34e13a656).(uicxx . . $ PunchProperties#ui..deviceNumbercxx . . $ Ui_PunchPropertiesClass#deviceNumber.)) |
| 80 | return; |
| 81 | stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# newLineBuffcxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).; |
| 82 | bool fileGiven = (uicxx . . $ PunchProperties#ui..fileNamecxx . . $ Ui_PunchPropertiesClass#fileName.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).().lengthcxx . . $ std/__cxx11/basic_string#length(48278e53df7b52a5).() > 0); |
| 83 | |
| 84 | newLineBuff <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ PunchProperties#ui..deviceNumbercxx . . $ Ui_PunchPropertiesClass#deviceNumber.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " |
| 85 | <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ PunchProperties#ui..punchCombocxx . . $ Ui_PunchPropertiesClass#punchCombo.->currentTextcxx . . $ QComboBox#currentText(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " |
| 86 | <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ PunchProperties#ui..fileNamecxx . . $ Ui_PunchPropertiesClass#fileName.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() |
| 87 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (fileGiven && uicxx . . $ PunchProperties#ui..asciiCheckBoxcxx . . $ Ui_PunchPropertiesClass#asciiCheckBox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).() ? " ascii" : " ") |
| 88 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (fileGiven && uicxx . . $ PunchProperties#ui..crlfCheckBoxcxx . . $ Ui_PunchPropertiesClass#crlfCheckBox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).() ? " crlf" : " ") |
| 89 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (fileGiven && uicxx . . $ PunchProperties#ui..noclearCheckBoxcxx . . $ Ui_PunchPropertiesClass#noclearCheckBox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).() ? " noclear" : " ") |
| 90 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 91 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5, "new line:" << newLineBuff.str()); |
| 92 | mLinecxx . . $ GenericDeviceProperties#mLine..replaceLinecxx . . $ ConfigLine#replaceLine(9c546c94e5fcce4e).(newLineBuff.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).()); |
| 93 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! updateLinecxx . . $ GenericDeviceProperties#updateLine(b45ddcbc8423892c).(true); |
| 94 | this->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 95 | } |
| 96 | |
| 97 | void PunchPropertiescxx . . $ PunchProperties#::cancelcxx . . $ PunchProperties#cancel(49f6e7a06ebc5aa8).() |
| 98 | { |
| 99 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! updateLinecxx . . $ GenericDeviceProperties#updateLine(b45ddcbc8423892c).(false); |
| 100 | this->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 101 | } |
| 102 | |
| 103 | |
| 104 | void PunchPropertiescxx . . $ PunchProperties#::setBoxesEnabledcxx . . $ PunchProperties#setBoxesEnabled(b45ddcbc8423892c).(bool enabled) |
| 105 | { |
| 106 | uicxx . . $ PunchProperties#ui..asciiCheckBoxcxx . . $ Ui_PunchPropertiesClass#asciiCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(enabled); |
| 107 | uicxx . . $ PunchProperties#ui..crlfCheckBoxcxx . . $ Ui_PunchPropertiesClass#crlfCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(enabled); |
| 108 | uicxx . . $ PunchProperties#ui..noclearCheckBoxcxx . . $ Ui_PunchPropertiesClass#noclearCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(enabled); |
| 109 | } |
| 110 | |
| 111 | PunchFileNameValidatorcxx . . $ PunchFileNameValidator#::PunchFileNameValidatorcxx . . $ PunchFileNameValidator#PunchFileNameValidator(749de1b6ae65bddd).(QObjectcxx . . $ QObject# * parent) |
| 112 | : QValidatorcxx . . $ QValidator#QValidator(749de1b6ae65bddd).(parent), mParentcxx . . $ PunchFileNameValidator#mParent.(dynamic_cast<PunchPropertiescxx . . $ PunchProperties# *>(parent)) |
| 113 | { |
| 114 | |
| 115 | } |
| 116 | |
| 117 | QValidatorcxx . . $ QValidator#::Statecxx . . $ QValidator#State# PunchFileNameValidatorcxx . . $ PunchFileNameValidator#::validatecxx . . $ PunchFileNameValidator#validate(c53298829ad8eccd).(QStringcxx . . $ QString# & v, int & ) const |
| 118 | { |
| 119 | mParentcxx . . $ PunchFileNameValidator#mParent.->setBoxesEnabledcxx . . $ PunchProperties#setBoxesEnabled(b45ddcbc8423892c).(v.lengthcxx . . $ QString#length(455f465bc33b4cdf).()>0); |
| 120 | return QValidatorcxx . . $ QValidator#::Acceptablecxx . . $ QValidator#Acceptable.; |
| 121 | } |
| 122 |