MuseScore  3.4
Music composition and notation
newwizard.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Score
3 // Linux Music Score Editor
4 //
5 // Copyright (C) 2008-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 __NEWWIZARD_H__
21 #define __NEWWIZARD_H__
22 
23 #include "ui_timesigwizard.h"
24 #include "ui_newwizard.h"
25 
26 #include <QWizard>
27 
28 #include "libmscore/timesig.h"
29 #include "libmscore/key.h"
30 #include "libmscore/fraction.h"
31 
32 namespace Ms {
33 
34 class Score;
35 class Palette;
36 class StaffListItem;
37 class InstrumentsWidget;
38 class TemplateBrowser;
39 
40 //---------------------------------------------------------
41 // TimesigWizard
42 //---------------------------------------------------------
43 
44 class TimesigWizard : public QWidget, private Ui::TimesigWizard {
45  Q_OBJECT
46 
47  private slots:
48  void commonTimeToggled(bool);
49  void cutTimeToggled(bool);
50  void fractionToggled(bool);
51 
52  public:
53  TimesigWizard(QWidget* parent = 0);
54  int measures() const;
55  Fraction timesig() const;
56  bool pickup(int* z, int* n) const;
57  TimeSigType type() const;
58  };
59 
60 //---------------------------------------------------------
61 // TitleWizard
62 //---------------------------------------------------------
63 
64 class TitleWizard : public QWidget, public Ui::NewWizard {
65  Q_OBJECT
66 
67  public:
68  TitleWizard(QWidget* parent = 0);
69  };
70 
71 //---------------------------------------------------------
72 // NewWizardInfoPage
73 // Enter score information such as title and composer
74 //---------------------------------------------------------
75 
76 class NewWizardInfoPage : public QWizardPage {
77  Q_OBJECT
78 
80 
81  public:
82  NewWizardInfoPage(QWidget* parent = 0);
83  QString title() const { return w->title->text(); }
84  QString subtitle() const { return w->subtitle->text(); }
85  QString composer() const { return w->composer->text(); }
86  QString poet() const { return w->poet->text(); }
87  QString copyright() const { return w->copyright->text(); }
88  virtual void initializePage() override;
89  };
90 
91 //---------------------------------------------------------
92 // NewWizardInstrumentsPage
93 // Choose instruments to appear in the score
94 //---------------------------------------------------------
95 
96 class NewWizardInstrumentsPage : public QWizardPage {
97  Q_OBJECT
98 
99  bool complete;
101 
102  public slots:
103  void setComplete(bool);
104 
105  public:
106  NewWizardInstrumentsPage(QWidget* parent = 0);
107  virtual bool isComplete() const override;
108  void createInstruments(Score* s);
109  virtual void initializePage() override;
110  };
111 
112 //---------------------------------------------------------
113 // NewWizardTimesigPage
114 // Choose time signature for the score
115 //---------------------------------------------------------
116 
117 class NewWizardTimesigPage : public QWizardPage {
118  Q_OBJECT
119 
121 
122  public:
123  NewWizardTimesigPage(QWidget* parent = 0);
124  int measures() const { return w->measures(); }
125  Fraction timesig() const { return w->timesig(); }
126  bool pickupMeasure(int* z, int* n) const { return w->pickup(z, n); }
127  TimeSigType timesigType() const { return w->type(); }
128  };
129 
130 //---------------------------------------------------------
131 // NewWizardTemplatePage
132 // Choose a template on which to base the score
133 //---------------------------------------------------------
134 
135 class NewWizardTemplatePage : public QWizardPage {
136  Q_OBJECT
137 
139  QString path;
140 
141  private slots:
142  void templateChanged(const QString&);
143  void fileAccepted(const QString&);
144 
145  public:
146  NewWizardTemplatePage(QWidget* parent = 0);
147  virtual bool isComplete() const override;
148  QString templatePath() const;
149  virtual void initializePage();
150  void buildTemplatesList();
151  };
152 
153 //---------------------------------------------------------
154 // NewWizardKeysigPage
155 // Choose key signature for the score
156 //---------------------------------------------------------
157 
158 class NewWizardKeysigPage : public QWizardPage {
159  Q_OBJECT
160 
162  QDoubleSpinBox* _tempo;
163  QGroupBox* tempoGroup;
164 
165  public:
166  NewWizardKeysigPage(QWidget* parent = 0);
167  virtual bool isComplete() const override { return true; }
168  KeySigEvent keysig() const;
169  double tempo() const { return _tempo->value(); }
170  bool createTempo() const { return tempoGroup->isChecked(); }
171  void init();
172  };
173 
174 //---------------------------------------------------------
175 // NewWizard
176 // New Score Wizard - create a new score
177 //---------------------------------------------------------
178 
179 class NewWizard : public QWizard {
180  Q_OBJECT
181 
187 
188  virtual void hideEvent(QHideEvent*);
189 
190  private slots:
191  void idChanged(int);
192 
193  public:
194  NewWizard(QWidget* parent = 0);
195  friend class QWizardPage;
196  virtual int nextId() const;
197 
198  enum Page { Invalid = -1, Type, Instruments, Template, Keysig, Timesig};
199 
200  QString templatePath() const { return templatePage->templatePath(); }
201  int measures() const { return timesigPage->measures(); }
202  Fraction timesig() const { return timesigPage->timesig(); }
203  void createInstruments(Score* s) { instrumentsPage->createInstruments(s); }
204  QString title() const { return infoPage->title(); }
205  QString subtitle() const { return infoPage->subtitle(); }
206  QString composer() const { return infoPage->composer(); }
207  QString poet() const { return infoPage->poet(); }
208  QString copyright() const { return infoPage->copyright(); }
209  KeySigEvent keysig() const { return keysigPage->keysig(); }
210  bool pickupMeasure(int* z, int* n) const { return timesigPage->pickupMeasure(z, n); }
211  TimeSigType timesigType() const { return timesigPage->timesigType(); }
212  double tempo() const { return keysigPage->tempo(); }
213  bool createTempo() const { return keysigPage->createTempo(); }
214  bool emptyScore() const;
215  void updateValues() const;
216  };
217 
218 
219 } // namespace Ms
220 #endif
221 
Definition: newwizard.h:117
Definition: newwizard.h:64
NewWizardInstrumentsPage * instrumentsPage
Definition: newwizard.h:183
NewWizardTimesigPage * timesigPage
Definition: newwizard.h:184
Definition: templateBrowser.h:30
QString path
Definition: newwizard.h:139
void fractionToggled(bool)
Definition: newwizard.cpp:144
int measures() const
Definition: newwizard.h:201
bool complete
Definition: newwizard.h:99
void cutTimeToggled(bool)
Definition: newwizard.cpp:130
QString copyright() const
Definition: newwizard.h:208
TimesigWizard * w
Definition: newwizard.h:120
void createInstruments(Score *score, QList< MTrack > &tracks)
Definition: importmidi_instrument.cpp:385
TimeSigType type() const
Definition: newwizard.cpp:103
Definition: newwizard.h:96
void createInstruments(Score *s)
Definition: newwizard.cpp:245
QString templatePath() const
Definition: newwizard.cpp:364
TitleWizard * w
Definition: newwizard.h:79
double tempo() const
Definition: newwizard.h:212
KeySigEvent keysig() const
Definition: newwizard.cpp:436
QString subtitle() const
Definition: newwizard.h:205
TimesigWizard(QWidget *parent=0)
Definition: newwizard.cpp:52
TimeSigType timesigType() const
Definition: newwizard.h:211
int measures() const
Definition: newwizard.cpp:69
KeySigEvent keysig() const
Definition: newwizard.h:209
Definition: score.h:391
virtual bool isComplete() const override
Definition: newwizard.h:167
double tempo() const
Definition: newwizard.h:169
QString title() const
Definition: newwizard.h:83
InstrumentsWidget * instrumentsWidget
Definition: newwizard.h:100
Palette * sp
Definition: newwizard.h:161
QString composer() const
Definition: newwizard.h:85
bool pickupMeasure(int *z, int *n) const
Definition: newwizard.h:126
QString composer() const
Definition: newwizard.h:206
QString copyright() const
Definition: newwizard.h:87
NewWizardInfoPage * infoPage
Definition: newwizard.h:182
Definition: key.h:95
Definition: newwizard.h:135
void commonTimeToggled(bool)
Definition: newwizard.cpp:116
Definition: aeolus.cpp:26
Definition: newwizard.h:44
TimeSigType
Definition: timesig.h:30
bool pickupMeasure(int *z, int *n) const
Definition: newwizard.h:210
Page
Definition: newwizard.h:198
QGroupBox * tempoGroup
Definition: newwizard.h:163
Fraction timesig() const
Definition: newwizard.h:202
QString poet() const
Definition: newwizard.h:86
QString poet() const
Definition: newwizard.h:207
Definition: newwizard.h:76
TemplateBrowser * templateFileBrowser
Definition: newwizard.h:138
QDoubleSpinBox * _tempo
Definition: newwizard.h:162
Fraction timesig() const
Definition: newwizard.h:125
Definition: newwizard.h:198
Definition: palette.h:72
bool createTempo() const
Definition: newwizard.h:170
int measures() const
Definition: newwizard.h:124
Definition: instrwidget.h:127
TimeSigType timesigType() const
Definition: newwizard.h:127
QString templatePath() const
Definition: newwizard.h:200
Definition: fraction.h:46
bool createTempo() const
Definition: newwizard.h:213
Fraction timesig() const
Definition: newwizard.cpp:78
QString title() const
Definition: newwizard.h:204
QString subtitle() const
Definition: newwizard.h:84
Definition: newwizard.h:179
Definition: newwizard.h:158
bool pickup(int *z, int *n) const
Definition: newwizard.cpp:92
void createInstruments(Score *s)
Definition: newwizard.h:203
NewWizardKeysigPage * keysigPage
Definition: newwizard.h:186
NewWizardTemplatePage * templatePage
Definition: newwizard.h:185