src/RelpipeChartMainWindow.h
author František Kučera <franta-hg@frantovo.cz>
Fri, 23 Oct 2020 12:36:32 +0200
branchv_0
changeset 50 9008fd23fc17
parent 45 50461b01e30d
permissions -rw-r--r--
fix null pointer address points to the zero page
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     1
/**
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     2
 * Relational pipes
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     3
 * Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     4
 *
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
42
707a6734f364 fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 32
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
29
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     8
 *
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    12
 * GNU General Public License for more details.
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    13
 *
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    14
 * You should have received a copy of the GNU General Public License
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    16
 */
6
5acb6b487caf code clean-up, comments
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    17
#pragma once
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
18
16784291982f add QTableWidget with rows and collumns filled with attribute values
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    19
#include <QTableWidget>
19
ac70c7af6a9b code clean-up, exit code
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    20
#include <QLabel>
28
04f1ac8a931b Qt Charts: first working version
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    21
#include <QSplitter>
18
16784291982f add QTableWidget with rows and collumns filled with attribute values
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    22
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
#include "ui_RelpipeChartMainWindow.h"
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
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: 6
diff changeset
    25
#include <relpipe/reader/typedefs.h>
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: 6
diff changeset
    26
#include <relpipe/reader/TypeId.h>
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: 6
diff changeset
    27
#include <relpipe/reader/handlers/RelationalReaderStringHandler.h>
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: 6
diff changeset
    28
#include <relpipe/reader/handlers/AttributeMetadata.h>
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: 6
diff changeset
    29
23
ff4a1c07a481 use our own QAbstractTableModel and a QTableView instead of the QTableWidget
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    30
#include "RelpipeTableModel.h"
28
04f1ac8a931b Qt Charts: first working version
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    31
#include "RelpipeChartWidget.h"
23
ff4a1c07a481 use our own QAbstractTableModel and a QTableView instead of the QTableWidget
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    32
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: 6
diff changeset
    33
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: 6
diff changeset
    34
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: 6
diff changeset
    35
20
b13e7ed9eea3 better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents: 19
diff changeset
    36
class RelpipeChartMainWindow : public QMainWindow {
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	Q_OBJECT
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
public:
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	RelpipeChartMainWindow();
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	virtual ~RelpipeChartMainWindow();
19
ac70c7af6a9b code clean-up, exit code
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    41
public slots:
20
b13e7ed9eea3 better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents: 19
diff changeset
    42
	void startRelation(const string_t name, std::vector<AttributeMetadata> attributes);
b13e7ed9eea3 better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents: 19
diff changeset
    43
	void attribute(const string_t value);
b13e7ed9eea3 better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents: 19
diff changeset
    44
	void endOfPipe();
19
ac70c7af6a9b code clean-up, exit code
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    45
	void setStatusMessage(string_t message);
45
50461b01e30d basic keyboard shortcuts: Ctrl+PgDown, Ctrl+PgUp, Ctrl+Q
František Kučera <franta-hg@frantovo.cz>
parents: 42
diff changeset
    46
	void selectNextTab();
50461b01e30d basic keyboard shortcuts: Ctrl+PgDown, Ctrl+PgUp, Ctrl+Q
František Kučera <franta-hg@frantovo.cz>
parents: 42
diff changeset
    47
	void selectPreviousTab();
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
private:
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
	Ui::RelpipeChartMainWindow widget;
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: 6
diff changeset
    50
	QTabWidget* tabs = new QTabWidget(this);
32
23018a2ed2a0 fix: multiple relations
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    51
	QSplitter* splitter;
50
9008fd23fc17 fix null pointer
František Kučera <franta-hg@frantovo.cz>
parents: 45
diff changeset
    52
	RelpipeTableModel* currentModel = nullptr;
9008fd23fc17 fix null pointer
František Kučera <franta-hg@frantovo.cz>
parents: 45
diff changeset
    53
	RelpipeChartWidget* currentChartWidget = nullptr;
19
ac70c7af6a9b code clean-up, exit code
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    54
	QLabel* status = new QLabel();
45
50461b01e30d basic keyboard shortcuts: Ctrl+PgDown, Ctrl+PgUp, Ctrl+Q
František Kučera <franta-hg@frantovo.cz>
parents: 42
diff changeset
    55
	void setupKeyboardShortcuts();
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
};