Debian Codegraph @

HercStudio/Recovery.cpp

raw symbols SCIP
1 /*
2 * File: Recovery.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 "Recovery.h"
26 #include "NamedPipe.h"
27
28 #include <sstream>
29
30 Recovery::Recovery(QWidget *parent)
31 : QDialog(parent)
32 {
33 ui.setupUi(this);
34 mHerculesConf = readHerculesConf();
35
36 ui.configurationFilename->setText(mHerculesConf.c_str());
37 std::stringstream ss;
38 ss << NamedPipe::getInstance().getHerculesPid();
39 ui.processNumber->setText(ss.str().c_str());
40
41 connect(ui.exitButton, SIGNAL(clicked()), this , SLOT(exit()));
42 connect(ui.attachButton, SIGNAL(clicked()), this , SLOT(recover()));
43 connect(ui.skipButton, SIGNAL(clicked()), this , SLOT(skip()));
44 }
45
46 Recovery::~Recovery()
47 {
48
49 }
50
51 void Recovery::exit()
52 {
53 mHerculesConf = "!";
54 this->close();
55 }
56
57 void Recovery::skip()
58 {
59 mHerculesConf = "";
60 this->close();
61 }
62
63
64 void Recovery::recover()
65 {
66 this->close();
67 }
68
69 std::string Recovery::getHerculesConf()
70 {
71 return mHerculesConf;
72 }
73
74 std::string Recovery::readHerculesConf()
75 {
76 std::string cmdLine = NamedPipe::getInstance().getHerculesCommandline();
77 int ind = cmdLine.find("-d -f");
78 std::string past_f = cmdLine.substr(ind+6);
79 ind = past_f.find(" ");
80 return past_f.substr(0,ind);
81 }