New Score Wizard: TimeSig page: more descriptive class names and accessibility info

- Class names are more descriptive
- Accessible names and descriptions provided for all controls
- Enabled screen reader on pickup measure controls
This commit is contained in:
Peter Jonas 2018-06-22 16:17:43 +01:00
parent cf1f5ceb13
commit d7004e87f5
4 changed files with 174 additions and 114 deletions

View file

@ -54,6 +54,7 @@ TimesigWizard::TimesigWizard(QWidget* parent)
connect(tsCommonTime, SIGNAL(toggled(bool)), SLOT(commonTimeToggled(bool)));
connect(tsCutTime, SIGNAL(toggled(bool)), SLOT(cutTimeToggled(bool)));
connect(tsFraction, SIGNAL(toggled(bool)), SLOT(fractionToggled(bool)));
pickupMeasure->setChecked(false); // checked in the UI file to enable screen reader on pickup duration controls
}
//---------------------------------------------------------
@ -154,10 +155,10 @@ TitleWizard::TitleWizard(QWidget* parent)
}
//---------------------------------------------------------
// NewWizardPage1
// NewWizardInfoPage
//---------------------------------------------------------
NewWizardPage1::NewWizardPage1(QWidget* parent)
NewWizardInfoPage::NewWizardInfoPage(QWidget* parent)
: QWizardPage(parent)
{
setTitle(tr("Create New Score"));
@ -176,17 +177,17 @@ NewWizardPage1::NewWizardPage1(QWidget* parent)
// initializePage
//---------------------------------------------------------
void NewWizardPage1::initializePage()
void NewWizardInfoPage::initializePage()
{
w->title->setText("");
w->subtitle->setText("");
}
//---------------------------------------------------------
// NewWizardPage2
// NewWizardInstrumentsPage
//---------------------------------------------------------
NewWizardPage2::NewWizardPage2(QWidget* parent)
NewWizardInstrumentsPage::NewWizardInstrumentsPage(QWidget* parent)
: QWizardPage(parent)
{
setFinalPage(true);
@ -194,30 +195,30 @@ NewWizardPage2::NewWizardPage2(QWidget* parent)
setSubTitle(tr("Choose instruments on the left to add to instrument list on the right:"));
setAccessibleName(title());
setAccessibleDescription(subTitle());
w = new InstrumentsWidget;
instrumentsWidget = new InstrumentsWidget;
QGridLayout* grid = new QGridLayout;
grid->setSpacing(0);
grid->setContentsMargins(0, 0, 0, 0);
grid->addWidget(w, 0, 0);
grid->addWidget(instrumentsWidget, 0, 0);
setLayout(grid);
connect(w, SIGNAL(completeChanged(bool)), SLOT(setComplete(bool)));
connect(instrumentsWidget, SIGNAL(completeChanged(bool)), SLOT(setComplete(bool)));
}
//---------------------------------------------------------
// initializePage
//---------------------------------------------------------
void NewWizardPage2::initializePage()
void NewWizardInstrumentsPage::initializePage()
{
complete = false;
w->init();
instrumentsWidget->init();
}
//---------------------------------------------------------
// setComplete
//---------------------------------------------------------
void NewWizardPage2::setComplete(bool val)
void NewWizardInstrumentsPage::setComplete(bool val)
{
complete = val;
emit completeChanged();
@ -227,7 +228,7 @@ void NewWizardPage2::setComplete(bool val)
// isComplete
//---------------------------------------------------------
bool NewWizardPage2::isComplete() const
bool NewWizardInstrumentsPage::isComplete() const
{
return complete;
}
@ -236,16 +237,16 @@ bool NewWizardPage2::isComplete() const
// createInstruments
//---------------------------------------------------------
void NewWizardPage2::createInstruments(Score* s)
void NewWizardInstrumentsPage::createInstruments(Score* s)
{
w->createInstruments(s);
instrumentsWidget->createInstruments(s);
}
//---------------------------------------------------------
// NewWizardPage3
// NewWizardTimesigPage
//---------------------------------------------------------
NewWizardPage3::NewWizardPage3(QWidget* parent)
NewWizardTimesigPage::NewWizardTimesigPage(QWidget* parent)
: QWizardPage(parent)
{
setFinalPage(true);
@ -261,10 +262,10 @@ NewWizardPage3::NewWizardPage3(QWidget* parent)
}
//---------------------------------------------------------
// NewWizardPage4
// NewWizardTemplatePage
//---------------------------------------------------------
NewWizardPage4::NewWizardPage4(QWidget* parent)
NewWizardTemplatePage::NewWizardTemplatePage(QWidget* parent)
: QWizardPage(parent)
{
setFinalPage(true);
@ -281,12 +282,14 @@ NewWizardPage4::NewWizardPage4(QWidget* parent)
QVBoxLayout* layout = new QVBoxLayout;
QHBoxLayout* searchLayout = new QHBoxLayout;
QLineEdit* search = new QLineEdit;
search->setPlaceholderText(tr("Search"));
search->setClearButtonEnabled(true);
search->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QLineEdit* searchBox = new QLineEdit;
searchBox->setPlaceholderText(tr("Search"));
searchBox->setAccessibleName(searchBox->placeholderText());
searchBox->setAccessibleDescription(tr("Filter templates by name"));
searchBox->setClearButtonEnabled(true);
searchBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
searchLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Maximum));
searchLayout->addWidget(search);
searchLayout->addWidget(searchBox);
layout->addLayout(searchLayout);
layout->addWidget(templateFileBrowser);
@ -294,7 +297,7 @@ NewWizardPage4::NewWizardPage4(QWidget* parent)
connect(templateFileBrowser, SIGNAL(scoreSelected(const QString&)), SLOT(templateChanged(const QString&)));
connect(templateFileBrowser, SIGNAL(scoreActivated(const QString&)), SLOT(fileAccepted(const QString&)));
connect(search, &QLineEdit::textChanged, [this] (const QString& searchString) {
connect(searchBox, &QLineEdit::textChanged, [this] (const QString& searchString) {
this->templateFileBrowser->filter(searchString);
});
}
@ -303,7 +306,7 @@ NewWizardPage4::NewWizardPage4(QWidget* parent)
// initializePage
//---------------------------------------------------------
void NewWizardPage4::initializePage()
void NewWizardTemplatePage::initializePage()
{
templateFileBrowser->show();
path.clear();
@ -313,7 +316,7 @@ void NewWizardPage4::initializePage()
// buildTemplatesList
//---------------------------------------------------------
void NewWizardPage4::buildTemplatesList()
void NewWizardTemplatePage::buildTemplatesList()
{
QDir dir(mscoreGlobalShare + "/templates");
@ -338,7 +341,7 @@ void NewWizardPage4::buildTemplatesList()
// isComplete
//---------------------------------------------------------
bool NewWizardPage4::isComplete() const
bool NewWizardTemplatePage::isComplete() const
{
return !path.isEmpty();
}
@ -347,7 +350,7 @@ bool NewWizardPage4::isComplete() const
// fileAccepted
//---------------------------------------------------------
void NewWizardPage4::fileAccepted(const QString& s)
void NewWizardTemplatePage::fileAccepted(const QString& s)
{
path = s;
templateFileBrowser->show();
@ -359,7 +362,7 @@ void NewWizardPage4::fileAccepted(const QString& s)
// templateChanged
//---------------------------------------------------------
void NewWizardPage4::templateChanged(const QString& s)
void NewWizardTemplatePage::templateChanged(const QString& s)
{
path = s;
emit completeChanged();
@ -369,16 +372,16 @@ void NewWizardPage4::templateChanged(const QString& s)
// templatePath
//---------------------------------------------------------
QString NewWizardPage4::templatePath() const
QString NewWizardTemplatePage::templatePath() const
{
return path;
}
//---------------------------------------------------------
// NewWizardPage5
// NewWizardKeysigPage
//---------------------------------------------------------
NewWizardPage5::NewWizardPage5(QWidget* parent)
NewWizardKeysigPage::NewWizardKeysigPage(QWidget* parent)
: QWizardPage(parent)
{
setFinalPage(true);
@ -389,7 +392,8 @@ NewWizardPage5::NewWizardPage5(QWidget* parent)
QGroupBox* b1 = new QGroupBox;
b1->setTitle(tr("Key Signature"));
b1->setAccessibleName(title());
b1->setAccessibleName(b1->title());
b1->setAccessibleDescription(tr("Choose a key signature"));
sp = MuseScore::newKeySigPalette();
sp->setMoreElements(false);
sp->setShowContextMenu(false);
@ -405,6 +409,8 @@ NewWizardPage5::NewWizardPage5(QWidget* parent)
tempoGroup->setCheckable(true);
tempoGroup->setChecked(false);
tempoGroup->setTitle(tr("Tempo"));
tempoGroup->setAccessibleName(tempoGroup->title());
tempoGroup->setAccessibleDescription(tr("Add tempo marking to score"));
QLabel* bpm = new QLabel;
bpm->setText(tr("BPM:"));
_tempo = new QDoubleSpinBox;
@ -430,7 +436,7 @@ NewWizardPage5::NewWizardPage5(QWidget* parent)
// keysig
//---------------------------------------------------------
KeySigEvent NewWizardPage5::keysig() const
KeySigEvent NewWizardKeysigPage::keysig() const
{
int idx = sp->getSelectedIdx();
Element* e = sp->element(idx);
@ -461,19 +467,19 @@ NewWizard::NewWizard(QWidget* parent)
setOption(QWizard::HaveFinishButtonOnEarlyPages, true);
setOption(QWizard::HaveNextButtonOnLastPage, true);
p1 = new NewWizardPage1;
p2 = new NewWizardPage2;
p3 = new NewWizardPage3;
p4 = new NewWizardPage4;
p5 = new NewWizardPage5;
infoPage = new NewWizardInfoPage;
instrumentsPage = new NewWizardInstrumentsPage;
timesigPage = new NewWizardTimesigPage;
templatePage = new NewWizardTemplatePage;
keysigPage = new NewWizardKeysigPage;
// enum Page { Invalid = -1, Type, Instruments, Template, Keysig, Timesig};
setPage(Page::Type, p1);
setPage(Page::Instruments, p2);
setPage(Page::Template, p4);
setPage(Page::Keysig, p5);
setPage(Page::Timesig, p3);
setPage(Page::Type, infoPage);
setPage(Page::Instruments, instrumentsPage);
setPage(Page::Template, templatePage);
setPage(Page::Keysig, keysigPage);
setPage(Page::Timesig, timesigPage);
resize(QSize(840, 560)); //ensure default size if no geometry in settings
MuseScore::restoreGeometry(this);
@ -523,7 +529,7 @@ int NewWizard::nextId() const
bool NewWizard::emptyScore() const
{
QString p = p4->templatePath();
QString p = templatePage->templatePath();
QFileInfo fi(p);
bool val = fi.completeBaseName() == "00-Blank";
return val;
@ -536,7 +542,7 @@ bool NewWizard::emptyScore() const
void NewWizard::updateValues() const
{
//p2->buildInstrumentsList();
p4->buildTemplatesList();
templatePage->buildTemplatesList();
}
//---------------------------------------------------------

View file

@ -69,16 +69,17 @@ class TitleWizard : public QWidget, public Ui::NewWizard {
};
//---------------------------------------------------------
// NewWizardPage1
// NewWizardInfoPage
// Enter score information such as title and composer
//---------------------------------------------------------
class NewWizardPage1 : public QWizardPage {
class NewWizardInfoPage : public QWizardPage {
Q_OBJECT
TitleWizard* w;
public:
NewWizardPage1(QWidget* parent = 0);
NewWizardInfoPage(QWidget* parent = 0);
QString title() const { return w->title->text(); }
QString subtitle() const { return w->subtitle->text(); }
QString composer() const { return w->composer->text(); }
@ -88,36 +89,38 @@ class NewWizardPage1 : public QWizardPage {
};
//---------------------------------------------------------
// NewWizardPage2
// NewWizardInstrumentsPage
// Choose instruments to appear in the score
//---------------------------------------------------------
class NewWizardPage2 : public QWizardPage {
class NewWizardInstrumentsPage : public QWizardPage {
Q_OBJECT
bool complete;
InstrumentsWidget* w;
InstrumentsWidget* instrumentsWidget;
public slots:
void setComplete(bool);
public:
NewWizardPage2(QWidget* parent = 0);
NewWizardInstrumentsPage(QWidget* parent = 0);
virtual bool isComplete() const override;
void createInstruments(Score* s);
virtual void initializePage() override;
};
//---------------------------------------------------------
// NewWizardPage3
// NewWizardTimesigPage
// Choose time signature for the score
//---------------------------------------------------------
class NewWizardPage3 : public QWizardPage {
class NewWizardTimesigPage : public QWizardPage {
Q_OBJECT
TimesigWizard* w;
public:
NewWizardPage3(QWidget* parent = 0);
NewWizardTimesigPage(QWidget* parent = 0);
int measures() const { return w->measures(); }
Fraction timesig() const { return w->timesig(); }
bool pickupMeasure(int* z, int* n) const { return w->pickup(z, n); }
@ -125,11 +128,11 @@ class NewWizardPage3 : public QWizardPage {
};
//---------------------------------------------------------
// NewWizardPage4
// request template file
// NewWizardTemplatePage
// Choose a template on which to base the score
//---------------------------------------------------------
class NewWizardPage4 : public QWizardPage {
class NewWizardTemplatePage : public QWizardPage {
Q_OBJECT
ScoreBrowser* templateFileBrowser;
@ -140,7 +143,7 @@ class NewWizardPage4 : public QWizardPage {
void fileAccepted(const QString&);
public:
NewWizardPage4(QWidget* parent = 0);
NewWizardTemplatePage(QWidget* parent = 0);
virtual bool isComplete() const override;
QString templatePath() const;
virtual void initializePage();
@ -148,10 +151,11 @@ class NewWizardPage4 : public QWizardPage {
};
//---------------------------------------------------------
// NewWizardPage5
// NewWizardKeysigPage
// Choose key signature for the score
//---------------------------------------------------------
class NewWizardPage5 : public QWizardPage {
class NewWizardKeysigPage : public QWizardPage {
Q_OBJECT
Palette* sp;
@ -159,7 +163,7 @@ class NewWizardPage5 : public QWizardPage {
QGroupBox* tempoGroup;
public:
NewWizardPage5(QWidget* parent = 0);
NewWizardKeysigPage(QWidget* parent = 0);
virtual bool isComplete() const override { return true; }
KeySigEvent keysig() const;
double tempo() const { return _tempo->value(); }
@ -169,16 +173,17 @@ class NewWizardPage5 : public QWizardPage {
//---------------------------------------------------------
// NewWizard
// New Score Wizard - create a new score
//---------------------------------------------------------
class NewWizard : public QWizard {
Q_OBJECT
NewWizardPage1* p1;
NewWizardPage2* p2;
NewWizardPage3* p3;
NewWizardPage4* p4;
NewWizardPage5* p5;
NewWizardInfoPage* infoPage;
NewWizardInstrumentsPage* instrumentsPage;
NewWizardTimesigPage* timesigPage;
NewWizardTemplatePage* templatePage;
NewWizardKeysigPage* keysigPage;
virtual void hideEvent(QHideEvent*);
@ -192,20 +197,20 @@ class NewWizard : public QWizard {
enum Page { Invalid = -1, Type, Instruments, Template, Keysig, Timesig};
QString templatePath() const { return p4->templatePath(); }
int measures() const { return p3->measures(); }
Fraction timesig() const { return p3->timesig(); }
void createInstruments(Score* s) { p2->createInstruments(s); }
QString title() const { return p1->title(); }
QString subtitle() const { return p1->subtitle(); }
QString composer() const { return p1->composer(); }
QString poet() const { return p1->poet(); }
QString copyright() const { return p1->copyright(); }
KeySigEvent keysig() const { return p5->keysig(); }
bool pickupMeasure(int* z, int* n) const { return p3->pickupMeasure(z, n); }
TimeSigType timesigType() const { return p3->timesigType(); }
double tempo() const { return p5->tempo(); }
bool createTempo() const { return p5->createTempo(); }
QString templatePath() const { return templatePage->templatePath(); }
int measures() const { return timesigPage->measures(); }
Fraction timesig() const { return timesigPage->timesig(); }
void createInstruments(Score* s) { instrumentsPage->createInstruments(s); }
QString title() const { return infoPage->title(); }
QString subtitle() const { return infoPage->subtitle(); }
QString composer() const { return infoPage->composer(); }
QString poet() const { return infoPage->poet(); }
QString copyright() const { return infoPage->copyright(); }
KeySigEvent keysig() const { return keysigPage->keysig(); }
bool pickupMeasure(int* z, int* n) const { return timesigPage->pickupMeasure(z, n); }
TimeSigType timesigType() const { return timesigPage->timesigType(); }
double tempo() const { return keysigPage->tempo(); }
bool createTempo() const { return keysigPage->createTempo(); }
bool emptyScore() const;
void updateValues() const;
};

View file

@ -27,7 +27,7 @@
<string>Title</string>
</property>
<property name="accessibleDescription">
<string>Insert title here</string>
<string>Enter score title</string>
</property>
</widget>
</item>
@ -44,7 +44,7 @@
<string>Subtitle</string>
</property>
<property name="accessibleDescription">
<string>Insert subtitle here</string>
<string>Enter score subtitle</string>
</property>
</widget>
</item>
@ -61,7 +61,7 @@
<string>Composer</string>
</property>
<property name="accessibleDescription">
<string>Insert composer's name here</string>
<string>Enter the composer's name</string>
</property>
</widget>
</item>
@ -78,7 +78,7 @@
<string>Lyricist</string>
</property>
<property name="accessibleDescription">
<string>Insert lyricist's name here</string>
<string>Enter the lyricist's name</string>
</property>
</widget>
</item>
@ -95,7 +95,7 @@
<string>Copyright</string>
</property>
<property name="accessibleDescription">
<string>Insert copyright here</string>
<string>Enter copyright information</string>
</property>
</widget>
</item>

View file

@ -25,6 +25,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="accessibleDescription">
<string>Enter a numerical time signature or choose one of the time signature symbols</string>
</property>
<property name="title">
<string>Enter Time Signature:</string>
</property>
@ -36,6 +39,15 @@
</property>
<item>
<widget class="QRadioButton" name="tsFraction">
<property name="toolTip">
<string>Custom numerical time signature</string>
</property>
<property name="accessibleName">
<string>Custom numerical time signature</string>
</property>
<property name="accessibleDescription">
<string>Enter a numerical time signature such as four-four or six-eight</string>
</property>
<property name="text">
<string notr="true"/>
</property>
@ -46,9 +58,15 @@
</item>
<item>
<widget class="QSpinBox" name="timesigZ">
<property name="toolTip">
<string>Beats in a measure</string>
</property>
<property name="accessibleName">
<string>Beats in a measure</string>
</property>
<property name="accessibleDescription">
<string>The numerator, or upper number, in the time signature</string>
</property>
<property name="minimum">
<number>1</number>
</property>
@ -78,9 +96,15 @@
</item>
<item>
<widget class="QComboBox" name="timesigN">
<property name="toolTip">
<string>Beat unit</string>
</property>
<property name="accessibleName">
<string>Beat unit</string>
</property>
<property name="accessibleDescription">
<string>The denominator, or lower number, in the time signature</string>
</property>
<property name="currentIndex">
<number>2</number>
</property>
@ -136,23 +160,6 @@
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="tsCutTime">
<property name="toolTip">
<string>Cut time</string>
</property>
<property name="accessibleName">
<string>Cut Time</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="musescore.qrc">
<normaloff>:/data/icons/timesig_allabreve.svg</normaloff>:/data/icons/timesig_allabreve.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="tsCommonTime">
<property name="toolTip">
@ -161,15 +168,38 @@
<property name="accessibleName">
<string>Common Time</string>
</property>
<property name="accessibleDescription">
<string>Use the common time symbol, the letter C, and a four-four meter</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="musescore.qrc">
<iconset>
<normaloff>:/data/icons/timesig_common.svg</normaloff>:/data/icons/timesig_common.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="tsCutTime">
<property name="toolTip">
<string>Cut time</string>
</property>
<property name="accessibleName">
<string>Cut Time</string>
</property>
<property name="accessibleDescription">
<string>Use the cut time symbol, the letter C with a vertical line through it, and a two-two meter</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset>
<normaloff>:/data/icons/timesig_allabreve.svg</normaloff>:/data/icons/timesig_allabreve.svg</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -178,6 +208,9 @@
<property name="accessibleName">
<string>Pickup Measure</string>
</property>
<property name="accessibleDescription">
<string>Begin the score with an incomplete measure</string>
</property>
<property name="title">
<string>Pickup Measure</string>
</property>
@ -185,7 +218,7 @@
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
<bool>true</bool>
</property>
<layout class="QHBoxLayout">
<item>
@ -197,8 +230,14 @@
</item>
<item>
<widget class="QSpinBox" name="pickupTimesigZ">
<property name="toolTip">
<string>Number of beats in the pickup measure</string>
</property>
<property name="accessibleName">
<string>Beats in a measure</string>
<string>Pickup beats</string>
</property>
<property name="accessibleDescription">
<string>Number of beats in the pickup measure</string>
</property>
<property name="minimum">
<number>1</number>
@ -229,8 +268,14 @@
</item>
<item>
<widget class="QComboBox" name="pickupTimesigN">
<property name="statusTip">
<string>Beat unit for the pickup measure</string>
</property>
<property name="accessibleName">
<string>Beat unit</string>
<string>Pickup beat unit</string>
</property>
<property name="accessibleDescription">
<string>Beat unit for the pickup measure</string>
</property>
<property name="currentIndex">
<number>2</number>
@ -293,6 +338,9 @@
<property name="accessibleName">
<string>Enter Number of Measures</string>
</property>
<property name="accessibleDescription">
<string>Hint: You can also add or remove measures after creation of the score.</string>
</property>
<property name="title">
<string>Enter Number of Measures:</string>
</property>
@ -315,11 +363,14 @@
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="measureCount">
<property name="toolTip">
<string>Number of measures</string>
</property>
<property name="accessibleName">
<string>Measures</string>
</property>
<property name="accessibleDescription">
<string>Hint: You can also add or remove measures after creation of the score.</string>
<string>The number of measures initially present in the score</string>
</property>
<property name="minimum">
<number>1</number>
@ -365,17 +416,15 @@
</widget>
<tabstops>
<tabstop>tsFraction</tabstop>
<tabstop>tsCommonTime</tabstop>
<tabstop>tsCutTime</tabstop>
<tabstop>timesigZ</tabstop>
<tabstop>timesigN</tabstop>
<tabstop>tsCutTime</tabstop>
<tabstop>tsCommonTime</tabstop>
<tabstop>pickupMeasure</tabstop>
<tabstop>pickupTimesigZ</tabstop>
<tabstop>pickupTimesigN</tabstop>
<tabstop>measureCount</tabstop>
</tabstops>
<resources>
<include location="musescore.qrc"/>
</resources>
<resources/>
<connections/>
</ui>