| 1 | /* |
| 2 | * File: Dasdconv.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 "Dasdconv.h"cxx . . $ `<file>/HercUtilities/Dasdconv.h`/ |
| 26 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 27 | #include "UtilityExecutor.h"cxx . . $ `<file>/HercUtilities/UtilityExecutor.h`/ |
| 28 | #include "UtilityRunner.h"cxx . . $ `<file>/HercUtilities/UtilityRunner.h`/ |
| 29 | #include "Preferences.h"cxx . . $ `<file>/HercStudio/Preferences.h`/ |
| 30 | |
| 31 | #include <QFileDialog> |
| 32 | #include <QMessageBox> |
| 33 | |
| 34 | #include <csignal> |
| 35 | |
| 36 | |
| 37 | Dasdconvcxx . . $ Dasdconv#::Dasdconvcxx . . $ Dasdconv#Dasdconv(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) |
| 38 | : GenericUtilitycxx . . $ GenericUtility#("dasdconv"cxx . . $ QString#QString(e1217c004a86c950).,parent) |
| 39 | { |
| 40 | uicxx . . $ Dasdconv#ui..setupUicxx . . $ Ui_DasdconvClass#setupUi(d194de0c0f68c28b).(this); |
| 41 | |
| 42 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ Dasdconv#ui..runButtoncxx . . $ Ui_DasdconvClass#runButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runClicked())); |
| 43 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ Dasdconv#ui..exitButtoncxx . . $ Ui_DasdconvClass#exitButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(exitClicked())); |
| 44 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ Dasdconv#ui..browseFileButtoncxx . . $ Ui_DasdconvClass#browseFileButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(browseFileClicked())); |
| 45 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ Dasdconv#ui..browseOutButtoncxx . . $ Ui_DasdconvClass#browseOutButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(browseOutClicked())); |
| 46 | |
| 47 | } |
| 48 | |
| 49 | Dasdconvcxx . . $ Dasdconv#::~cxx . . $ Dasdconv#`~Dasdconv`(49f6e7a06ebc5aa8).Dasdconvcxx . . $ Dasdconv#() |
| 50 | { |
| 51 | |
| 52 | } |
| 53 | |
| 54 | void Dasdconvcxx . . $ Dasdconv#::runClickedcxx . . $ Dasdconv#runClicked(49f6e7a06ebc5aa8).() |
| 55 | { |
| 56 | if (!runOrStopClickedcxx . . $ GenericUtility#runOrStopClicked(c9857a73d68e59ba).()) |
| 57 | { |
| 58 | uicxx . . $ Dasdconv#ui..runButtoncxx . . $ Ui_DasdconvClass#runButton.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Run"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 59 | return; |
| 60 | } |
| 61 | if (uicxx . . $ Dasdconv#ui..infilecxx . . $ Ui_DasdconvClass#infile.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 62 | { |
| 63 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "dasdconv"cxx . . $ QString#QString(85c52e162fed56f9)., "Please specify input file to convert"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 64 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 65 | return; |
| 66 | } |
| 67 | if (!QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(uicxx . . $ Dasdconv#ui..infilecxx . . $ Ui_DasdconvClass#infile.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).())) |
| 68 | { |
| 69 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "dasdconv"cxx . . $ QString#QString(85c52e162fed56f9)., "Input file does not exist"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 70 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 71 | return; |
| 72 | |
| 73 | } |
| 74 | if (uicxx . . $ Dasdconv#ui..filenamecxx . . $ Ui_DasdconvClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 75 | { |
| 76 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "dasdconv"cxx . . $ QString#QString(85c52e162fed56f9)., "Please specify ckd file to create"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 77 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 78 | return; |
| 79 | } |
| 80 | if (uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 81 | { |
| 82 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "dasdconv"cxx . . $ QString#QString(85c52e162fed56f9)., "Please specify output directory"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 83 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 84 | return; |
| 85 | } |
| 86 | if (!QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).())) |
| 87 | { |
| 88 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "dasdconv"cxx . . $ QString#QString(85c52e162fed56f9)., "Output directory does not exist"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 89 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 90 | return; |
| 91 | } |
| 92 | QFileInfocxx . . $ QFileInfo# dirInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).()); |
| 93 | if (!dirInfo.isDircxx . . $ QFileInfo#isDir(50ce9a9e25b4a850).()) |
| 94 | { |
| 95 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "dasdconv"cxx . . $ QString#QString(85c52e162fed56f9)., "Output path is not a directory"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 96 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 97 | return; |
| 98 | } |
| 99 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> parameterscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 100 | |
| 101 | if (uicxx . . $ Dasdconv#ui..replaceCheckboxcxx . . $ Ui_DasdconvClass#replaceCheckbox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).()) |
| 102 | parameters.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).("-r"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 103 | if (uicxx . . $ Dasdconv#ui..lfsCheckboxcxx . . $ Ui_DasdconvClass#lfsCheckbox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).()) |
| 104 | parameters.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).("-lfs"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 105 | |
| 106 | parameters.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(uicxx . . $ Dasdconv#ui..infilecxx . . $ Ui_DasdconvClass#infile.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).()); |
| 107 | |
| 108 | stdcxx . . $ std/::stringcxx . . $ std/string# fullPathcxx . . $ std/__cxx11/basic_string#basic_string(49f6e7a06ebc5aa8).; |
| 109 | if (uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().lengthcxx . . $ QString#length(455f465bc33b4cdf).() > 0) |
| 110 | { |
| 111 | fullPath =cxx . . $ std/__cxx11/basic_string#`operator=`(706c69e8c742c906). uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 112 | fullPath +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "/"; |
| 113 | } |
| 114 | fullPath +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). uicxx . . $ Dasdconv#ui..filenamecxx . . $ Ui_DasdconvClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 115 | |
| 116 | parameters.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(fullPath); |
| 117 | stdcxx . . $ std/::stringcxx . . $ std/string# commandcxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f). = "dasdconv"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 118 | |
| 119 | executecxx . . $ GenericUtility#execute(e5618828c763ae1e).(command, Preferencescxx . . $ Preferences#::getInstancecxx . . $ Preferences#getInstance(2e7be89de0a5bc0).().hercDircxx . . $ Preferences#hercDir(219584694fe2b248).(), parameters); |
| 120 | |
| 121 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(mRunnercxx . . $ GenericUtility#mRunner., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(valueChanged(int)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runnerValueChanged(int))); |
| 122 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(mRunnercxx . . $ GenericUtility#mRunner., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(maximumChanged(int)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runnerMaximumChanged(int))); |
| 123 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(mRunnercxx . . $ GenericUtility#mRunner., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(error(QByteArray)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runnerError(QByteArray))); |
| 124 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(mErrorRunnercxx . . $ GenericUtility#mErrorRunner., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(valueChanged(int)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runnerValueChanged(int))); |
| 125 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(mErrorRunnercxx . . $ GenericUtility#mErrorRunner., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(maximumChanged(int)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runnerMaximumChanged(int))); |
| 126 | uicxx . . $ Dasdconv#ui..runButtoncxx . . $ Ui_DasdconvClass#runButton.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Stop"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 127 | } |
| 128 | |
| 129 | |
| 130 | void Dasdconvcxx . . $ Dasdconv#::exitClickedcxx . . $ Dasdconv#exitClicked(49f6e7a06ebc5aa8).() |
| 131 | { |
| 132 | deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 133 | } |
| 134 | |
| 135 | void Dasdconvcxx . . $ Dasdconv#::browseFileClickedcxx . . $ Dasdconv#browseFileClicked(49f6e7a06ebc5aa8).() |
| 136 | { |
| 137 | QStringcxx . . $ QString# s = QFileDialogcxx . . $ QString#QString(e1217c004a86c950).::getOpenFileNamecxx . . $ QFileDialog#getOpenFileName(a6b29be4bec65236).(this,"Browse for input disk"cxx . . $ QString#QString(85c52e162fed56f9).,uicxx . . $ Dasdconv#ui..filenamecxx . . $ Ui_DasdconvClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).()); |
| 138 | uicxx . . $ Dasdconv#ui..infilecxx . . $ Ui_DasdconvClass#infile.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(s); |
| 139 | if (uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 140 | { |
| 141 | QDircxx . . $ QDir# dcxx . . $ QDir#QDir(3520e46b33348bf6).("/"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 142 | stdcxx . . $ std/::stringcxx . . $ std/string# path = dcxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f)..absoluteFilePathcxx . . $ QDir#absoluteFilePath(5555d9024dcf93fb).(s).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 143 | int lastSlash = s.toStdStringcxx . . $ QString#toStdString(219584694fe2b248).().find_last_ofcxx . . $ std/__cxx11/basic_string#find_last_of(625b4b37461b5dfd).('/'); |
| 144 | uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(pathcxx . . $ QString#QString(85c52e162fed56f9)..substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0,lastSlash).c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 145 | } |
| 146 | |
| 147 | } |
| 148 | void Dasdconvcxx . . $ Dasdconv#::browseOutClickedcxx . . $ Dasdconv#browseOutClicked(49f6e7a06ebc5aa8).() |
| 149 | { |
| 150 | QStringcxx . . $ QString# s = QFileDialogcxx . . $ QString#QString(e1217c004a86c950).::getExistingDirectorycxx . . $ QFileDialog#getExistingDirectory(a1339ef2a1b3555a).(this,"Browse for output file path"cxx . . $ QString#QString(85c52e162fed56f9).,uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).()); |
| 151 | uicxx . . $ Dasdconv#ui..pathcxx . . $ Ui_DasdconvClass#path.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(s); |
| 152 | } |
| 153 | |
| 154 | |
| 155 | void Dasdconvcxx . . $ Dasdconv#::runnerMaximumChangedcxx . . $ Dasdconv#runnerMaximumChanged(d4f767463ce0a6b3).(int maximum) |
| 156 | { |
| 157 | uicxx . . $ Dasdconv#ui..progressBarcxx . . $ Ui_DasdconvClass#progressBar.->setMaximumcxx . . $ QProgressBar#setMaximum(d4f767463ce0a6b3).(maximum); |
| 158 | } |
| 159 | |
| 160 | void Dasdconvcxx . . $ Dasdconv#::runnerValueChangedcxx . . $ Dasdconv#runnerValueChanged(d4f767463ce0a6b3).(int value) |
| 161 | { |
| 162 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5, "dasdconv got value changed " << value); |
| 163 | if (value > 0) |
| 164 | uicxx . . $ Dasdconv#ui..progressBarcxx . . $ Ui_DasdconvClass#progressBar.->setValuecxx . . $ QProgressBar#setValue(d4f767463ce0a6b3).(value); |
| 165 | else |
| 166 | { |
| 167 | uicxx . . $ Dasdconv#ui..progressBarcxx . . $ Ui_DasdconvClass#progressBar.->setValuecxx . . $ QProgressBar#setValue(d4f767463ce0a6b3).(uicxx . . $ Dasdconv#ui..progressBarcxx . . $ Ui_DasdconvClass#progressBar.->maximumcxx . . $ QProgressBar#maximum(455f465bc33b4cdf).()); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | void Dasdconvcxx . . $ Dasdconv#::finishedSlotcxx . . $ Dasdconv#finishedSlot(49f6e7a06ebc5aa8).() |
| 172 | { |
| 173 | deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 174 | } |