| 1 | /* |
| 2 | * File: TapeCopy.cpp |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Aug 31, 2010 |
| 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 | #include "TapeCopy.h"cxx . . $ `<file>/HercUtilities/TapeCopy.h`/ |
| 25 | #include "Preferences.h"cxx . . $ `<file>/HercStudio/Preferences.h`/ |
| 26 | #include "UtilityExecutor.h"cxx . . $ `<file>/HercUtilities/UtilityExecutor.h`/ |
| 27 | #include "UtilityRunner.h"cxx . . $ `<file>/HercUtilities/UtilityRunner.h`/ |
| 28 | #include "StringTokenizer.h"cxx . . $ `<file>/HercStudio/StringTokenizer.h`/ |
| 29 | |
| 30 | #include <QFileDialog> |
| 31 | #include <QFile> |
| 32 | #include <QMessageBox> |
| 33 | #include <QTimer> |
| 34 | |
| 35 | #include <csignal> |
| 36 | |
| 37 | |
| 38 | TapeCopycxx . . $ TapeCopy#::TapeCopycxx . . $ TapeCopy#TapeCopy(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) |
| 39 | : GenericUtilitycxx . . $ GenericUtility#("tapecopy"cxx . . $ QString#QString(e1217c004a86c950).,parent) |
| 40 | { |
| 41 | uicxx . . $ TapeCopy#ui..setupUicxx . . $ Ui_TapeCopyClass#setupUi(d194de0c0f68c28b).(this); |
| 42 | mUpperGeometrycxx . . $ TapeCopy#mUpperGeometry. =cxx . . $ QRect#`operator=`(f34997df7bb8d462). uicxx . . $ TapeCopy#ui..FileBoxcxx . . $ Ui_TapeCopyClass#FileBox.->geometrycxx . . $ QWidget#geometry(f4023511c62cad66).(); |
| 43 | mLowerGeometrycxx . . $ TapeCopy#mLowerGeometry. =cxx . . $ QRect#`operator=`(f34997df7bb8d462). uicxx . . $ TapeCopy#ui..ScsiBoxcxx . . $ Ui_TapeCopyClass#ScsiBox.->geometrycxx . . $ QWidget#geometry(f4023511c62cad66).(); |
| 44 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeCopy#ui..scsiToFileRadiocxx . . $ Ui_TapeCopyClass#scsiToFileRadio., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(scsiToTape())); |
| 45 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeCopy#ui..fileToScsiRadiocxx . . $ Ui_TapeCopyClass#fileToScsiRadio., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(tapeToScsi())); |
| 46 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeCopy#ui..runButtoncxx . . $ Ui_TapeCopyClass#runButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runClicked())); |
| 47 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeCopy#ui..cancelButtoncxx . . $ Ui_TapeCopyClass#cancelButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(cancelClicked())); |
| 48 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeCopy#ui..browseFileButtoncxx . . $ Ui_TapeCopyClass#browseFileButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(browseFileClicked())); |
| 49 | } |
| 50 | |
| 51 | TapeCopycxx . . $ TapeCopy#::~cxx . . $ TapeCopy#`~TapeCopy`(49f6e7a06ebc5aa8).TapeCopycxx . . $ TapeCopy#() |
| 52 | { |
| 53 | |
| 54 | } |
| 55 | |
| 56 | void TapeCopycxx . . $ TapeCopy#::runClickedcxx . . $ TapeCopy#runClicked(49f6e7a06ebc5aa8).() |
| 57 | { |
| 58 | if (!runOrStopClickedcxx . . $ GenericUtility#runOrStopClicked(c9857a73d68e59ba).()) |
| 59 | { |
| 60 | uicxx . . $ TapeCopy#ui..runButtoncxx . . $ Ui_TapeCopyClass#runButton.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Run"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 61 | return; |
| 62 | } |
| 63 | if (uicxx . . $ TapeCopy#ui..filenamecxx . . $ Ui_TapeCopyClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 64 | { |
| 65 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "tapecopy"cxx . . $ QString#QString(85c52e162fed56f9)., "Please specify tape file to process"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 66 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 67 | return; |
| 68 | } |
| 69 | if (!QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(uicxx . . $ TapeCopy#ui..filenamecxx . . $ Ui_TapeCopyClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).())) |
| 70 | { |
| 71 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "tapecopy"cxx . . $ QString#QString(85c52e162fed56f9)., "The specified file does not exist"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 72 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> parameterscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 77 | parameters.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(uicxx . . $ TapeCopy#ui..filenamecxx . . $ Ui_TapeCopyClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).()); |
| 78 | stdcxx . . $ std/::stringcxx . . $ std/string# scsicxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).="/dev/st"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 79 | scsi+=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75).uicxx . . $ TapeCopy#ui..spinBoxcxx . . $ Ui_TapeCopyClass#spinBox.->textcxx . . $ QAbstractSpinBox#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 80 | parameters.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(scsicxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)..c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).()); |
| 81 | stdcxx . . $ std/::stringcxx . . $ std/string# commandcxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f). = "tapecopy"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 82 | |
| 83 | executecxx . . $ GenericUtility#execute(e5618828c763ae1e).(command, Preferencescxx . . $ Preferences#::getInstancecxx . . $ Preferences#getInstance(2e7be89de0a5bc0).().hercDircxx . . $ Preferences#hercDir(219584694fe2b248).(), parameters); |
| 84 | |
| 85 | uicxx . . $ TapeCopy#ui..runButtoncxx . . $ Ui_TapeCopyClass#runButton.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Stop"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 86 | } |
| 87 | |
| 88 | void TapeCopycxx . . $ TapeCopy#::browseFileClickedcxx . . $ TapeCopy#browseFileClicked(49f6e7a06ebc5aa8).() |
| 89 | { |
| 90 | QStringcxx . . $ QString# dir = uicxx . . $ QString#QString(e1217c004a86c950)..filenamecxx . . $ Ui_TapeCopyClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).(); |
| 91 | if (dir.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 92 | dir =cxx . . $ QString#`operator=`(d02845eef0c33901). Preferencescxx . . $ Preferences#::getInstancecxx . . $ Preferences#getInstance(2e7be89de0a5bc0).().configDircxx . . $ Preferences#configDir(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).(); |
| 93 | QStringcxx . . $ QString# s = QFileDialogcxx . . $ QString#QString(e1217c004a86c950).::getOpenFileNamecxx . . $ QFileDialog#getOpenFileName(a6b29be4bec65236).(this,"Browse for tape to map"cxx . . $ QString#QString(85c52e162fed56f9).,dir); |
| 94 | uicxx . . $ TapeCopy#ui..filenamecxx . . $ Ui_TapeCopyClass#filename.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(s); |
| 95 | } |
| 96 | |
| 97 | void TapeCopycxx . . $ TapeCopy#::cancelClickedcxx . . $ TapeCopy#cancelClicked(49f6e7a06ebc5aa8).() |
| 98 | { |
| 99 | deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 100 | } |
| 101 | |
| 102 | void TapeCopycxx . . $ TapeCopy#::tapeToScsicxx . . $ TapeCopy#tapeToScsi(49f6e7a06ebc5aa8).() |
| 103 | { |
| 104 | uicxx . . $ TapeCopy#ui..FileBoxcxx . . $ Ui_TapeCopyClass#FileBox.->setGeometrycxx . . $ QWidget#setGeometry(22ba0428947158b).(mUpperGeometrycxx . . $ TapeCopy#mUpperGeometry.); |
| 105 | uicxx . . $ TapeCopy#ui..ScsiBoxcxx . . $ Ui_TapeCopyClass#ScsiBox.->setGeometrycxx . . $ QWidget#setGeometry(22ba0428947158b).(mLowerGeometrycxx . . $ TapeCopy#mLowerGeometry.); |
| 106 | uicxx . . $ TapeCopy#ui..FileBoxcxx . . $ Ui_TapeCopyClass#FileBox.->setTitlecxx . . $ QGroupBox#setTitle(3520e46b33348bf6).("Input Tape"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 107 | uicxx . . $ TapeCopy#ui..ScsiBoxcxx . . $ Ui_TapeCopyClass#ScsiBox.->setTitlecxx . . $ QGroupBox#setTitle(3520e46b33348bf6).("Output Tape"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 108 | } |
| 109 | |
| 110 | void TapeCopycxx . . $ TapeCopy#::scsiToTapecxx . . $ TapeCopy#scsiToTape(49f6e7a06ebc5aa8).() |
| 111 | { |
| 112 | uicxx . . $ TapeCopy#ui..FileBoxcxx . . $ Ui_TapeCopyClass#FileBox.->setGeometrycxx . . $ QWidget#setGeometry(22ba0428947158b).(mLowerGeometrycxx . . $ TapeCopy#mLowerGeometry.); |
| 113 | uicxx . . $ TapeCopy#ui..ScsiBoxcxx . . $ Ui_TapeCopyClass#ScsiBox.->setGeometrycxx . . $ QWidget#setGeometry(22ba0428947158b).(mUpperGeometrycxx . . $ TapeCopy#mUpperGeometry.); |
| 114 | uicxx . . $ TapeCopy#ui..FileBoxcxx . . $ Ui_TapeCopyClass#FileBox.->setTitlecxx . . $ QGroupBox#setTitle(3520e46b33348bf6).("Output Tape"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 115 | uicxx . . $ TapeCopy#ui..ScsiBoxcxx . . $ Ui_TapeCopyClass#ScsiBox.->setTitlecxx . . $ QGroupBox#setTitle(3520e46b33348bf6).("Input Tape"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 116 | } |
| 117 | |
| 118 | void TapeCopycxx . . $ TapeCopy#::finishedSlotcxx . . $ TapeCopy#finishedSlot(49f6e7a06ebc5aa8).() |
| 119 | { |
| 120 | |
| 121 | } |