-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcmdtreeview.h
140 lines (120 loc) · 5.44 KB
/
cmdtreeview.h
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/**
* Copyright (C) 2021 Jo2003 (olenka.joerg@gmail.com)
* This file is part of cd2netmd_gui
*
* cd2netmd is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* cd2netmd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
*/
#pragma once
#include <QObject>
#include <QTreeView>
#include <QResizeEvent>
#include <QContextMenuEvent>
#include <QAction>
//------------------------------------------------------------------------------
//! @brief md tree visualization of the data that model contains.
//------------------------------------------------------------------------------
class CMDTreeView : public QTreeView
{
Q_OBJECT
public:
/// data type for disc content
using DiscContent = QVector<QStringList>;
//--------------------------------------------------------------------------
//! @brief Constructs a new instance.
//!
//! @param parent The parent
//--------------------------------------------------------------------------
explicit CMDTreeView(QWidget* parent);
protected:
//--------------------------------------------------------------------------
//! @brief scale columns on size change
//!
//! @param e resize event
//--------------------------------------------------------------------------
void resizeEvent(QResizeEvent *e) override;
//--------------------------------------------------------------------------
//! @brief context menu was activated
//!
//! @param event The event
//--------------------------------------------------------------------------
void contextMenuEvent(QContextMenuEvent *event) override;
//--------------------------------------------------------------------------
//! @brief Creates actions belonging to context menu
//--------------------------------------------------------------------------
void createActions();
//--------------------------------------------------------------------------
//! @brief grab disc conent
//!
//! @param[in,out] content stores title content
//! @param[in] pModel pointer to QAbstractItemModel
//! @param[in] parent parent index (optional)
//--------------------------------------------------------------------------
void treeWalk(DiscContent& content, QAbstractItemModel *pModel, QModelIndex parent = QModelIndex());
signals:
//--------------------------------------------------------------------------
//! @brief signal about track deletion
//!
//! @param[in] <unnamed> track number
//--------------------------------------------------------------------------
void delTrack(int16_t);
//--------------------------------------------------------------------------
//! @brief signal about group deletion
//!
//! @param[in] <unnamed> group number
//--------------------------------------------------------------------------
void delGroup(int16_t);
//--------------------------------------------------------------------------
//! @brief signal about disc erase
//--------------------------------------------------------------------------
void eraseDisc();
//--------------------------------------------------------------------------
//! @brief Adds a group.
//!
//! @param[in] <unnamed> group name
//! @param[in] <unnamed> first group title
//! @param[in] <unnamed> last group title
//--------------------------------------------------------------------------
void addGroup(QString, int16_t, int16_t);
private slots:
//--------------------------------------------------------------------------
//! @brief delete track action activated
//--------------------------------------------------------------------------
void slotDelTrack();
//--------------------------------------------------------------------------
//! @brief delete group action activated
//--------------------------------------------------------------------------
void slotDelGroup();
//--------------------------------------------------------------------------
//! @brief erase disc action activated
//--------------------------------------------------------------------------
void slotEraseDisc();
//--------------------------------------------------------------------------
//! @brief add group action activated
//--------------------------------------------------------------------------
void slotAddGroup();
//--------------------------------------------------------------------------
//! @brief export title list action activated
//--------------------------------------------------------------------------
void slotExportTitles();
private:
/// add group action
QAction* mpaAddGroup;
/// del group action
QAction* mpaDelGroup;
/// del track action
QAction* mpaDelTrack;
/// erase disc action
QAction* mpaEraseDisc;
/// export title list
QAction* mpaExportTilteList;
};