| 1 | /* |
| 2 | * File: TapeMap.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 "TapeMap.h"cxx . . $ `<file>/HercUtilities/TapeMap.h`/ |
| 25 | |
| 26 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 27 | #include "SystemUtils.h"cxx . . $ `<file>/HercUtilities/SystemUtils.h`/ |
| 28 | #include "Preferences.h"cxx . . $ `<file>/HercStudio/Preferences.h`/ |
| 29 | #include "UtilityExecutor.h"cxx . . $ `<file>/HercUtilities/UtilityExecutor.h`/ |
| 30 | #include "UtilityRunner.h"cxx . . $ `<file>/HercUtilities/UtilityRunner.h`/ |
| 31 | #include "StringTokenizer.h"cxx . . $ `<file>/HercStudio/StringTokenizer.h`/ |
| 32 | |
| 33 | #include <QFileDialog> |
| 34 | #include <QMessageBox> |
| 35 | #include <QTimer> |
| 36 | |
| 37 | #include <csignal> |
| 38 | |
| 39 | TapeMapcxx . . $ TapeMap#::TapeMapcxx . . $ TapeMap#TapeMap(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) |
| 40 | : GenericUtilitycxx . . $ GenericUtility#("tapemap"cxx . . $ QString#QString(e1217c004a86c950)., parent) |
| 41 | { |
| 42 | uicxx . . $ TapeMap#ui..setupUicxx . . $ Ui_TapeMapClass#setupUi(108f35f7aa7f3cf9).(this); |
| 43 | |
| 44 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeMap#ui..runButtoncxx . . $ Ui_TapeMapClass#runButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(runClicked())); |
| 45 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeMap#ui..exitButtoncxx . . $ Ui_TapeMapClass#exitButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(exitClicked())); |
| 46 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(uicxx . . $ TapeMap#ui..browseFileButtoncxx . . $ Ui_TapeMapClass#browseFileButton., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clicked()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(browseFileClicked())); |
| 47 | } |
| 48 | |
| 49 | TapeMapcxx . . $ TapeMap#::~cxx . . $ TapeMap#`~TapeMap`(49f6e7a06ebc5aa8).TapeMapcxx . . $ TapeMap#() |
| 50 | { |
| 51 | |
| 52 | } |
| 53 | |
| 54 | void TapeMapcxx . . $ TapeMap#::runClickedcxx . . $ TapeMap#runClicked(49f6e7a06ebc5aa8).() |
| 55 | { |
| 56 | if (!runOrStopClickedcxx . . $ GenericUtility#runOrStopClicked(c9857a73d68e59ba).()) |
| 57 | { |
| 58 | uicxx . . $ TapeMap#ui..runButtoncxx . . $ Ui_TapeMapClass#runButton.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Run"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 59 | return; |
| 60 | } |
| 61 | if (uicxx . . $ TapeMap#ui..filenamecxx . . $ Ui_TapeMapClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 62 | { |
| 63 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "tapemap"cxx . . $ QString#QString(85c52e162fed56f9)., "Please specify tape file to process"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 . . $ TapeMap#ui..filenamecxx . . $ Ui_TapeMapClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).())) |
| 68 | { |
| 69 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(21b6fd1dd558cc82).(this, "tapemap"cxx . . $ QString#QString(85c52e162fed56f9)., "The specified file does not exist"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 70 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 71 | return; |
| 72 | } |
| 73 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> parameterscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 74 | |
| 75 | parameters.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(uicxx . . $ TapeMap#ui..filenamecxx . . $ Ui_TapeMapClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).()); |
| 76 | |
| 77 | stdcxx . . $ std/::stringcxx . . $ std/string# commandcxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f). = "tapemap"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 78 | |
| 79 | executecxx . . $ GenericUtility#execute(e5618828c763ae1e).(command, Preferencescxx . . $ Preferences#::getInstancecxx . . $ Preferences#getInstance(2e7be89de0a5bc0).().hercDircxx . . $ Preferences#hercDir(219584694fe2b248).(), parameters); |
| 80 | uicxx . . $ TapeMap#ui..runButtoncxx . . $ Ui_TapeMapClass#runButton.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Stop"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 81 | } |
| 82 | |
| 83 | void TapeMapcxx . . $ TapeMap#::browseFileClickedcxx . . $ TapeMap#browseFileClicked(49f6e7a06ebc5aa8).() |
| 84 | { |
| 85 | QStringcxx . . $ QString# dir = uicxx . . $ QString#QString(e1217c004a86c950)..filenamecxx . . $ Ui_TapeMapClass#filename.->textcxx . . $ QLineEdit#text(6ef7b6c27b00b43d).(); |
| 86 | if (dir.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 87 | dir =cxx . . $ QString#`operator=`(d02845eef0c33901). Preferencescxx . . $ Preferences#::getInstancecxx . . $ Preferences#getInstance(2e7be89de0a5bc0).().configDircxx . . $ Preferences#configDir(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).(); |
| 88 | QStringcxx . . $ QString# s = QFileDialogcxx . . $ QString#QString(e1217c004a86c950).::getOpenFileNamecxx . . $ QFileDialog#getOpenFileName(a6b29be4bec65236).(this,"Browse for tape to map"cxx . . $ QString#QString(85c52e162fed56f9).,dir); |
| 89 | uicxx . . $ TapeMap#ui..filenamecxx . . $ Ui_TapeMapClass#filename.->setTextcxx . . $ QLineEdit#setText(3520e46b33348bf6).(s); |
| 90 | } |
| 91 | |
| 92 | void TapeMapcxx . . $ TapeMap#::exitClickedcxx . . $ TapeMap#exitClicked(49f6e7a06ebc5aa8).() |
| 93 | { |
| 94 | deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 95 | } |
| 96 | |
| 97 | void TapeMapcxx . . $ TapeMap#::finishedSlotcxx . . $ TapeMap#finishedSlot(49f6e7a06ebc5aa8).() |
| 98 | { |
| 99 | if (mStartedcxx . . $ GenericUtility#mStarted. && mFinishedcxx . . $ GenericUtility#mFinished. && mFinishedOKcxx . . $ GenericUtility#mFinishedOK.) |
| 100 | { |
| 101 | QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(dea435d67faf38b3).(this, "tapemap"cxx . . $ QString#QString(85c52e162fed56f9)., "Tapemap operation successfully completed!"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 102 | QMessageBoxcxx . . $ QMessageBox#::Okcxx . . $ QMessageBox#Ok., |
| 103 | QMessageBoxcxx . . $ QMessageBox#::NoButtoncxx . . $ QMessageBox#NoButton.); |
| 104 | deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 105 | } |
| 106 | else emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! errorcxx . . $ GenericUtility#error(49f6e7a06ebc5aa8).(); |
| 107 | } |