-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathClipEditor.h
156 lines (119 loc) · 3.94 KB
/
ClipEditor.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/************************************************************************
**
** Copyright (C) 2023 Kevin B. Hendricks, Stratford Ontario Canada
** Copyright (C) 2012 John Schember <john@nachtimwald.com>
** Copyright (C) 2012 Dave Heiland
** Copyright (C) 2012 Grant Drake
**
** This file is part of PageEdit.
**
** PageEdit 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.
**
** PageEdit 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
** along with PageEdit. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#pragma once
#ifndef CLIPEDITOR_H
#define CLIPEDITOR_H
#include <QDialog>
#include <QStandardItemModel>
#include <QPointer>
#include "SettingsStore.h"
#include "ClipEditorModel.h"
#include "ClipEditorTreeView.h"
#include "ui_ClipEditor.h"
/**
* The editor used to create and modify saved clip entries
*/
class ClipEditor : public QDialog
{
Q_OBJECT
public:
ClipEditor(QWidget *parent);
void ForceClose();
void SetCSSList(const QStringList&);
public slots:
QStandardItem *AddEntry(bool is_group = false, ClipEditorModel::clipEntry *clip_entry = NULL, bool insert_after = true);
signals:
void PasteSelectedClipRequest(QList<ClipEditorModel::clipEntry *> clip_entries);
void ShowStatusMessageRequest(const QString &message);
void ClipsUpdated();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
protected slots:
void reject();
void showEvent(QShowEvent *event);
private slots:
QStandardItem *AddGroup();
void Edit();
void Cut();
bool Copy();
void Paste();
void Delete();
void Import();
void Reload();
void Export();
void ExportAll();
void CollapseAll();
void ExpandAll();
void AutoFill();
void Apply();
bool Save();
void MoveUp();
void MoveDown();
void MoveLeft();
void MoveRight();
void PasteIntoDocument();
void FilterEditTextChangedSlot(const QString &text);
void OpenContextMenu(const QPoint &point);
void SettingsFileModelUpdated();
void ModelItemDropped(const QModelIndex &index);
private:
bool MaybeSaveDialogSaysProceed(bool is_forced);
void MoveVertical(bool move_down);
void MoveHorizontal(bool move_left);
void ExportItems(QList<QStandardItem *> items);
void SetupClipEditorTree();
int SelectedRowsCount();
QList<ClipEditorModel::clipEntry *> GetSelectedEntries();
QList<QStandardItem *> GetSelectedItems();
bool ItemsAreUnique(QList<QStandardItem *> items);
bool SaveData(QList<ClipEditorModel::clipEntry *> entries = QList<ClipEditorModel::clipEntry *>() , QString filename = QString());
bool FilterEntries(const QString &text, QStandardItem *item = NULL);
bool SelectFirstVisibleNonGroup(QStandardItem *item);
void ReadSettings();
void WriteSettings();
void CreateContextMenuActions();
void SetupContextMenu(const QPoint &point);
void ConnectSignalsSlots();
QAction *m_AddEntry;
QAction *m_AddGroup;
QAction *m_Edit;
QAction *m_Cut;
QAction *m_Copy;
QAction *m_Paste;
QAction *m_Delete;
QAction *m_Import;
QAction *m_Reload;
QAction *m_Export;
QAction *m_ExportAll;
QAction *m_CollapseAll;
QAction *m_ExpandAll;
QAction *m_AutoFill;
ClipEditorModel *m_ClipEditorModel;
QString m_LastFolderOpen;
QPointer<QMenu> m_ContextMenu;
QList<ClipEditorModel::clipEntry *> m_SavedClipEntries;
QStringList m_CSSList;
Ui::ClipEditor ui;
};
#endif // CLIPEDITOR_H