src/RelpipeChartMainWindow.cpp
author František Kučera <franta-hg@frantovo.cz>
Sat, 29 Sep 2018 00:43:16 +0200
branchv_0
changeset 13 c84042d014c9
parent 12 a45d1cac365e
child 14 0a6a88e4e48f
permissions -rw-r--r--
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
     1
#include <QTabWidget>
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
     2
#include <QPushButton>
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
     3
#include <QLabel>
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
     4
#include <QStatusBar>
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
     5
#include <QSplitter>
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
     6
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
#include "RelpipeChartMainWindow.h"
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
13
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
     9
using namespace relpipe::reader;
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    10
using namespace relpipe::reader::handlers;
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    11
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
RelpipeChartMainWindow::RelpipeChartMainWindow() {
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
	widget.setupUi(this);
12
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
    14
13
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    15
	tabs->addTab(new QPushButton("here will be options", tabs), "Options");
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    16
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    17
	statusBar()->addWidget(new QLabel("Loading relations...", widget.statusbar));
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    18
12
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
    19
13
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    20
	// TODO: remove; just demo
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    21
	QPushButton* emitButton = new QPushButton("emit", widget.statusbar);
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    22
	statusBar()->addWidget(emitButton);
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    23
	QObject::connect(
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    24
			emitButton, &QPushButton::pressed,
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    25
			this, &RelpipeChartMainWindow::slot123
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    26
			);
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    27
	// ---
12
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
    28
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
    29
	setCentralWidget(tabs);
a45d1cac365e splitter and component placeholders
František Kučera <franta-hg@frantovo.cz>
parents: 6
diff changeset
    30
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
}
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
RelpipeChartMainWindow::~RelpipeChartMainWindow() {
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
}
13
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    35
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    36
void RelpipeChartMainWindow::slot123() {
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    37
	// TODO: remove; just demo
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    38
	statusBar()->addWidget(new QPushButton("slot123", widget.statusbar));
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    39
}
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    40
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    41
void RelpipeChartMainWindow::startRelation(string_t name, std::vector<AttributeMetadata> attributes) {
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    42
	// TODO: chart and table
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    43
	QSplitter* splitter = new QSplitter(Qt::Orientation::Vertical, tabs);
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    44
	splitter->addWidget(new QPushButton("here will be the chart", splitter));
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    45
	splitter->addWidget(new QPushButton("here will be the table", splitter));
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    46
	tabs->addTab(splitter, QString::fromWCharArray(name.c_str()));
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    47
}
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    48
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    49
void RelpipeChartMainWindow::attribute(const string_t& value) {
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    50
	// TODO: fill table and draw chart
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    51
}
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    52
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    53
void RelpipeChartMainWindow::endOfPipe() {
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    54
	// TODO: just display a message
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    55
	statusBar()->addWidget(new QPushButton("endOfPipe", widget.statusbar));
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    56
}