-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathanalysis.hpp
59 lines (52 loc) · 1.52 KB
/
analysis.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef ANALYSIS_HPP
#define ANALYSIS_HPP
#include <sstream>
class QHBoxLayout;
class QLabel;
#include <QWidget>
#include <QProcess>
#include <QTemporaryFile>
#include <QVBoxLayout>
#include <QScrollArea>
#include "globals.hpp"
#include "gamestate.hpp"
class Analysis : public QWidget {
Q_OBJECT
public:
struct CommandLine {
QString executable,moves;
QStringList beforeMoves,afterMoves;
};
explicit Analysis(Globals& globals_,NodePtr node,const std::pair<Placements,ExtendedSteps>& partialMove,const CommandLine& commandLine,std::set<std::string>& passSynonyms_,QWidget* parent=nullptr);
~Analysis();
private:
void setWindowTitle();
void processStandardOutput();
void processPlainText(std::string& text);
virtual bool event(QEvent* event) override;
virtual bool eventFilter(QObject* watched,QEvent* event) override;
virtual void contextMenuEvent(QContextMenuEvent* event) override;
Globals& globals;
std::set<std::string> passSynonyms;
QProcess process;
QTemporaryFile moveFile;
QByteArray output;
std::stringstream ss;
bool scrolledDown;
enum State {
ROW_START,
APPENDING_TEXT,
PROCESSING_MOVES
} state;
Subnode startPosition,currentPosition;
QVBoxLayout layout;
QScrollArea scrollArea;
QWidget scrollAreaChild;
QVBoxLayout vBoxLayout;
QHBoxLayout* lastHBoxLayout;
QLabel* lastLabel;
signals:
void sendPosition(const NodePtr& node,const std::pair<Placements,ExtendedSteps>& partialMove);
friend class StartAnalysis;
};
#endif // ANALYSIS_HPP