1 //=============================================================================
2 //  MusE Score
3 //  Linux Music Score Editor
4 //
5 //  Copyright (C) 2002-2009 Werner Schweer and others
6 //
7 //  This program is free software; you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License version 2.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __METAEDIT_H__
21 #define __METAEDIT_H__
22 
23 #include "ui_metaedit.h"
24 
25 namespace Ms {
26 
27 class Score;
28 
29 //---------------------------------------------------------
30 //   MetaEditDialog
31 ///   Dialog for editing metatags.
32 ///   NOTE: Right now, builtin metatags cannot be deleted by the user,
33 ///   because they are automatically created when a MasterScore is instantiated.
34 ///   This means that if they get deleted, they are simply readded (but empty)
35 ///   when the score is reopened.
36 ///   see also MasterScore::MasterScore()
37 //---------------------------------------------------------
38 
39 class MetaEditDialog : public QDialog, public Ui::MetaEditDialog {
40       Q_OBJECT
41 
42       Score* m_score; /// the current score
43       bool m_dirty;   /// whether the editor has unsaved changes or not
44 
45       virtual void closeEvent(QCloseEvent*) override;
46 
47       bool isBuiltinTag(const QString& tag) const;
48       QPair<QLineEdit*, QLineEdit*> addTag(const QString& key, const QString& value, const bool builtinTag);
49 
50       bool save();
51       void newClicked();
52       void setDirty(const bool dirty = true);
53       void openFileLocation();
54       virtual void accept();
55 
56    private slots:
57       void buttonBoxClicked(QAbstractButton*);
58 
59    public:
60       MetaEditDialog(Score* score, QWidget* parent = nullptr);
61       };
62 
63 
64 } // namespace Ms
65 #endif
66 
67