-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdatabaseviewer.h
More file actions
83 lines (65 loc) · 1.82 KB
/
Copy pathdatabaseviewer.h
File metadata and controls
83 lines (65 loc) · 1.82 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef DATABASEVIEWER_H
#define DATABASEVIEWER_H
#include "chessgamewindow.h"
#include "pgngame.h"
#include "streamparser.h"
#include "databaseviewermodel.h"
#include "databasefilterproxymodel.h"
#include "pgngame.h"
#include <QTextEdit>
#include <QSortFilterProxyModel>
#include <QWidget>
#include <QTableView>
#include <QHeaderView>
#include <QStringList>
#include <QTimer>
#include <QPushButton>
#include <QSplitter>
class ChessTabHost;
namespace Ui {
class DatabaseViewer;
}
// DatabaseViewer class creates and handles a chess database table.
class DatabaseViewer : public QWidget
{
Q_OBJECT
public:
explicit DatabaseViewer(QString filePath, QWidget *parent = nullptr);
~DatabaseViewer();
void importPGN();
void exportPGN();
void setWindowTitle(QString text);
signals:
void saveRequested(const QString &filePath, const QVector<PGNGame> &database);
protected:
void resizeEvent(QResizeEvent *event) override;
void showEvent(QShowEvent *event) override;
private slots:
void filter();
void saveColumnRatios();
void addGame();
void onPGNGameUpdated(PGNGame &game);
void onDoubleSelected(const QModelIndex &proxyIndex);
void onSingleSelected(const QModelIndex ¤t, const QModelIndex &previous);
void onContextMenu(const QPoint &pos);
void onHeaderContextMenu(const QPoint &pos);
private:
void setupUI();
void resizeTable();
void resizeSplitter();
// UI
QAction* mFilterAction;
QAction* mAddGameAction;
QSplitter* contentLayout;
QWidget* gamePreview;
ChessGameWindow *m_embed;
QTableView *dbView;
DatabaseViewerModel *dbModel;
DatabaseFilterProxyModel *proxyModel;
QStringList mShownHeaders;
QTimer *mSaveTimer;
QVector<float> mRatios;
ChessTabHost *host;
QString m_filePath;
};
#endif // DATABASEVIEWER_H