Debian Codegraph @

HercUtilities/Dasdls.cpp

raw symbols SCIP
1 /*
2 * File: Dasdls.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 "Dasdls.h"
26 #include "HerculesStudio.h"
27 #include "UtilityRunner.h"
28 #include "Preferences.h"
29 #include "StringTokenizer.h"
30
31
32 #include <QFileDialog>
33 #include <QMessageBox>
34
35 #include <csignal>
36
37 Dasdls::Dasdls(QWidget *parent)
38 : GenericUtility("dasdls",parent)
39 {
40 ui.setupUi(this);
41
42 connect(ui.runButton, SIGNAL(clicked()), this, SLOT(runClicked()));
43 connect(ui.exitButton, SIGNAL(clicked()), this, SLOT(exitClicked()));
44 connect(ui.browseFileButton, SIGNAL(clicked()), this, SLOT(browseFileClicked()));
45 connect(ui.browseSfButton, SIGNAL(clicked()), this, SLOT(browseSfClicked()));
46 }
47
48 Dasdls::~Dasdls()
49 {
50
51 }
52
53 void Dasdls::exitClicked()
54 {
55 deleteLater();
56 }
57
58 void Dasdls::runClicked()
59 {
60 if (!runOrStopClicked())
61 {
62 ui.runButton->setText("Run");
63 return;
64 }
65 if (ui.filename->text().isEmpty())
66 {
67 QMessageBox::warning(this, "dasdls", "Please specify ckd file to process",
68 QMessageBox::Ok, QMessageBox::NoButton);
69 return;
70 }
71 std::vector<std::string> parameters;
72
73 parameters.push_back(ui.filename->text().toStdString());
74
75 if (!ui.shadowFile->text().isEmpty())
76 {
77 parameters.push_back("sf=" + ui.shadowFile->text().toStdString());
78 }
79 std::string command = "dasdls";
80
81 execute(command, Preferences::getInstance().hercDir(), parameters);
82
83 connect(mErrorRunner, SIGNAL(valueChanged(int)), this, SLOT(runnerValueChanged(int)));
84 connect(mErrorRunner, SIGNAL(maximumChanged(int)), this, SLOT(runnerMaximumChanged(int)));
85 ui.runButton->setText("Stop");
86 }
87
88 void Dasdls::browseFileClicked()
89 {
90 QString s = QFileDialog::getOpenFileName(this,"Browse for disk to list",ui.filename->text());
91 ui.filename->setText(s);
92 }
93
94 void Dasdls::browseSfClicked()
95 {
96 QString s = QFileDialog::getOpenFileName(this,"Browse for shadow file",ui.shadowFile->text());
97 ui.shadowFile->setText(s);
98 }
99
100 void Dasdls::runnerMaximumChanged(int maximum)
101 {
102 mMaximum = maximum;
103 hOutDebug(2,"dasdls maximum is " << maximum);
104 }
105
106 void Dasdls::runnerValueChanged(int value)
107 {
108 hOutDebug(2,"value:" << value);
109 return;
110 }
111
112 void Dasdls::finishedSlot()
113 {
114 mExecutor = NULL;
115 if (mFinishedOK)
116 {
117 QMessageBox::information(this, "dasdls", "Disk listing successfully completed!",
118 QMessageBox::Ok,
119 QMessageBox::NoButton);
120 }
121 ui.runButton->setText("Run");
122 deleteLater();
123 }