Debian Codegraph @

HercConfiguration/PrinterProperties.cpp

raw symbols SCIP
1 /*
2 * File: PrinterProperties.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 "PrinterProperties.h"cxx . . $ `<file>/HercConfiguration/PrinterProperties.h`/
26
27 #include <QMessageBox>
28 #include <QFileDialog>
29
30 #include <algorithm>
31 #include <sstream>
32
33 PrinterPropertiescxx . . $ PrinterProperties#::PrinterPropertiescxx . . $ PrinterProperties#PrinterProperties(b7c8c82eacf24532).(ConfigLinecxx . . $ ConfigLine#& line, QWidgetcxx . . $ QWidget# *parent)
34 : GenericDevicePropertiescxx . . $ GenericDeviceProperties#(line, parent)
35 {
36 uicxx . . $ PrinterProperties#ui..setupUicxx . . $ Ui_PrinterPropertiesClass#setupUi(108f35f7aa7f3cf9).(this);
37
38 uicxx . . $ PrinterProperties#ui..filenamecxx . . $ Ui_PrinterPropertiesClass#filename.->setValidatorcxx . . $ QLineEdit#setValidator(65a0e52d19f97f21).(new PrinterFileNameValidatorcxx . . $ PrinterFileNameValidator#(this));
39
40 if (!line.isNewcxx . . $ ConfigLine#isNew(50ce9a9e25b4a850).())
41 {
42 uicxx . . $ PrinterProperties#ui..deviceNumbercxx . . $ Ui_PrinterPropertiesClass#deviceNumber.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(0).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).());
43 uicxx . . $ PrinterProperties#ui..printerCombocxx . . $ Ui_PrinterPropertiesClass#printerCombo.->setCurrentIndexcxx . . $ QComboBox#setCurrentIndex(d4f767463ce0a6b3).( (mLinecxx . . $ GenericDeviceProperties#mLine..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(1) ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "3211") ? 1 : 0);
44 if (mLinecxx . . $ GenericDeviceProperties#mLine..sizecxx . . $ ConfigLine#size(455f465bc33b4cdf).() > 2)
45 {
46 uicxx . . $ PrinterProperties#ui..filenamecxx . . $ Ui_PrinterPropertiesClass#filename.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(mLinecxx . . $ QString#QString(85c52e162fed56f9)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(2).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).());
47 if (mLinecxx . . $ GenericDeviceProperties#mLine..sizecxx . . $ ConfigLine#size(455f465bc33b4cdf).() > 3)
48 {
49 stdcxx . . $ std/::stringcxx . . $ std/string# crlf = mLinecxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f)..getTokencxx . . $ ConfigLine#getToken(ffc0d510d034206b).(3);
50 stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(crlf.begincxx . . $ std/__cxx11/basic_string#begin(2d83d3f7098a8e9c).(), crlf.endcxx . . $ std/__cxx11/basic_string#end(2d83d3f7098a8e9c).(), crlf.begincxx . . $ std/__cxx11/basic_string#begin(2d83d3f7098a8e9c).(), ::tolower);
51 uicxx . . $ PrinterProperties#ui..crlfCheckBoxcxx . . $ Ui_PrinterPropertiesClass#crlfCheckBox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(crlf ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "crlf");
52 }
53 }
54 else
55 uicxx . . $ PrinterProperties#ui..crlfCheckBoxcxx . . $ Ui_PrinterPropertiesClass#crlfCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false);
56 }
57
58 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ PrinterProperties#ui..OKButtoncxx . . $ Ui_PrinterPropertiesClass#OKButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(ok()));
59 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ PrinterProperties#ui..cancelButtoncxx . . $ Ui_PrinterPropertiesClass#cancelButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(cancel()));
60 connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ PrinterProperties#ui..filenameBrowseButtoncxx . . $ Ui_PrinterPropertiesClass#filenameBrowseButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(fileNameBrowse()));
61
62 }
63
64 PrinterPropertiescxx . . $ PrinterProperties#::~cxx . . $ PrinterProperties#`~PrinterProperties`(49f6e7a06ebc5aa8).PrinterPropertiescxx . . $ PrinterProperties#()
65 {
66
67 }
68
69 void PrinterPropertiescxx . . $ PrinterProperties#::okcxx . . $ PrinterProperties#ok(49f6e7a06ebc5aa8).()
70 {
71 if (!deviceNumberValidatorcxx . . $ GenericDeviceProperties#deviceNumberValidator(5bc323e34e13a656).(uicxx . . $ PrinterProperties#ui..deviceNumbercxx . . $ Ui_PrinterPropertiesClass#deviceNumber.))
72 return;
73
74 if (uicxx . . $ PrinterProperties#ui..filenamecxx . . $ Ui_PrinterPropertiesClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).())
75 {
76 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, "File name is empty"cxx . . $ QString#QString(85c52e162fed56f9)., "Please provide file name"cxx . . $ QString#QString(85c52e162fed56f9)., QMessageBoxcxx . . $ QFlags#QFlags(9b289cee16747614).::Okcxx . . $ QMessageBox#Ok.);
77 return;
78 }
79
80
81 stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# newLineBuffcxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;
82 bool crlf = (uicxx . . $ PrinterProperties#ui..filenamecxx . . $ Ui_PrinterPropertiesClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() == false) && (uicxx . . $ PrinterProperties#ui..crlfCheckBoxcxx . . $ Ui_PrinterPropertiesClass#crlfCheckBox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).());
83
84 newLineBuff <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ PrinterProperties#ui..deviceNumbercxx . . $ Ui_PrinterPropertiesClass#deviceNumber.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "
85 <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ PrinterProperties#ui..printerCombocxx . . $ Ui_PrinterPropertiesClass#printerCombo.->currentTextcxx . . $ QComboBox#currentText(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "
86 <<cxx . . $ std/`operator<<`(88df5bef833f7f83). uicxx . . $ PrinterProperties#ui..filenamecxx . . $ Ui_PrinterPropertiesClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "
87 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (crlf ? "crlf" : " ")
88 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n";
89 hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5,"new line:" << newLineBuff.str());
90 mLinecxx . . $ GenericDeviceProperties#mLine..replaceLinecxx . . $ ConfigLine#replaceLine(9c546c94e5fcce4e).(newLineBuff.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).());
91 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! updateLinecxx . . $ GenericDeviceProperties#updateLine(b45ddcbc8423892c).(true);
92 this->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).();
93 }
94
95 void PrinterPropertiescxx . . $ PrinterProperties#::cancelcxx . . $ PrinterProperties#cancel(49f6e7a06ebc5aa8).()
96 {
97 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! updateLinecxx . . $ GenericDeviceProperties#updateLine(b45ddcbc8423892c).(false);
98 this->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).();
99 }
100
101 void PrinterPropertiescxx . . $ PrinterProperties#::setCrlfEnabledcxx . . $ PrinterProperties#setCrlfEnabled(b45ddcbc8423892c).(bool checked)
102 {
103 uicxx . . $ PrinterProperties#ui..crlfCheckBoxcxx . . $ Ui_PrinterPropertiesClass#crlfCheckBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(checked);
104 }
105
106 void PrinterPropertiescxx . . $ PrinterProperties#::fileNameBrowsecxx . . $ PrinterProperties#fileNameBrowse(49f6e7a06ebc5aa8).()
107 {
108 stdcxx . . $ std/::stringcxx . . $ std/string# scxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f). = QFileDialogcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).::getOpenFileNamecxx . . $ QFileDialog#getOpenFileName(a6b29be4bec65236).(this,
109 "Set Printer File"cxx . . $ QString#QString(85c52e162fed56f9).,
110 "~/"cxx . . $ QString#QString(85c52e162fed56f9).,
111 trcxx . . $ PrinterProperties#tr(75d9f1c324b4579d).("All files(*)")).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().datacxx . . $ QByteArray#data(41208ce6ca65dd58).();
112 uicxx . . $ PrinterProperties#ui..filenamecxx . . $ Ui_PrinterPropertiesClass#filename.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(scxx . . $ QString#QString(85c52e162fed56f9)..c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).());
113 }
114
115 PrinterFileNameValidatorcxx . . $ PrinterFileNameValidator#::PrinterFileNameValidatorcxx . . $ PrinterFileNameValidator#PrinterFileNameValidator(749de1b6ae65bddd).(QObjectcxx . . $ QObject# * parent)
116 : QValidatorcxx . . $ QValidator#QValidator(749de1b6ae65bddd).(parent), mParentcxx . . $ PrinterFileNameValidator#mParent.(dynamic_cast<PrinterPropertiescxx . . $ PrinterProperties# *>(parent))
117 {
118
119 }
120
121 QValidatorcxx . . $ QValidator#::Statecxx . . $ QValidator#State# PrinterFileNameValidatorcxx . . $ PrinterFileNameValidator#::validatecxx . . $ PrinterFileNameValidator#validate(c53298829ad8eccd).(QStringcxx . . $ QString# & v, int & ) const
122 {
123 mParentcxx . . $ PrinterFileNameValidator#mParent.->setCrlfEnabledcxx . . $ PrinterProperties#setCrlfEnabled(b45ddcbc8423892c).(v.lengthcxx . . $ QString#length(455f465bc33b4cdf).()>0);
124 return QValidatorcxx . . $ QValidator#::Acceptablecxx . . $ QValidator#Acceptable.;
125 }