1 //=============================================================================
2 //  MuseScore
3 //  Linux Music Score Editor
4 //
5 //  Copyright (C) 2020 MuseScore BVBA 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 __EXPORTDIALOG_H__
21 #define __EXPORTDIALOG_H__
22 
23 #include "ui_exportdialog.h"
24 #include "abstractdialog.h"
25 #include "libmscore/excerpt.h"
26 #include "libmscore/mscore.h"
27 #include "libmscore/score.h"
28 
29 namespace Ms {
30 
31 //---------------------------------------------------------
32 //   ExportScoreItem
33 //---------------------------------------------------------
34 
35 class ExportScoreItem : public QListWidgetItem {
36       Score* _score;
37 
38    public:
39       ExportScoreItem(Score*, QListWidget* parent = 0);
40 
score()41       Score* score() { return _score; }
42 
isChecked()43       bool isChecked() const { return checkState() == Qt::CheckState::Checked; }
setChecked(bool b)44       void setChecked(bool b) { setCheckState(b ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); }
45 
title()46       QString title() const { return _score->title(); }
47       };
48 
49 //---------------------------------------------------------
50 //   ExportDialog
51 //---------------------------------------------------------
52 
53 class ExportDialog : public AbstractDialog, public Ui::ExportDialog {
54       Q_OBJECT
55 
56       QButtonGroup* pdfSeparateOrSingleFiles;
57 
58       Score* cs = nullptr;
59 
60       void loadValues();
61       void loadScoreAndPartsList();
62 
63       virtual void showEvent(QShowEvent*);
64       virtual void hideEvent(QHideEvent*);
65 
66    private slots:
67       void fileTypeChosen(int);
68       void selectAll();
69       void selectCurrent();
70       void selectScore();
71       void selectParts();
72       void clearSelection();
73       void setOkButtonEnabled();
74 
75    protected:
76       virtual void retranslate();
77 
78    public:
79       ExportDialog(Score* s, QWidget* parent);
setScore(Score * s)80       void setScore(Score* s) { cs = s; }
81       void setType(const QString& type = "");
82 
83    public slots:
84       void accept();
85 };
86 }
87 
88 #endif
89