Hi All,
I have attached three patches.
The first (patch1-chrisp...) is a simple fix for a spelling mistake in
matrix.rc
that broke the keyboard shortcut for combining equal-pitch notes.
The second (patch2-chrisp...) is a more complicated patch that implements an
extension of the Qt checkbox that disables itself depending on which LilyPond
version you are trying to export to. It turns out that the only option that
needs to be aware of LilyPond version is printing short staff names. All the
other options can still be checked they are just implemented differently. I
chose to move the LilyPond version enum into the 'global' Rosegarden namespace
so it only needs to be defined once. There are comments to this effect. I
realise this could be a bit dodgy but seemed the cleanest solution.
I did this to teach myself about Qt slots and signals, so if it is considered
unnecessary I am happy for this patch to be rejected. I did also just add the
version requirement to the appropriate tooltip (in patch3-chrisp...), which
should be enough to avoid confusing any users who wonder why the short staff
names aren't being exported (e.g., me).
As far as I can tell everything works.
Cheers,
Chris
diff --git a/data/rc/matrix.rc b/data/rc/matrix.rc
index 48f2b52..1bc4af2 100644
--- a/data/rc/matrix.rc
+++ b/data/rc/matrix.rc
@@ -118,7 +118,7 @@
<Action name="repeat_quantize" text="&Repeat Last Quantize" shortcut="+" />
<Action name="legatoize" text="&Legato" shortcut="-" />
</Menu>
- <Action name="collapse_notes" text="Collapse &Equal-Pitch Notes" shoprtcut="Ctrl+=" />
+ <Action name="collapse_notes" text="Collapse &Equal-Pitch Notes" shortcut="Ctrl+=" />
<Separator/>
<Action name="jog_left" text="Jog &Left" shortcut="Alt+Left" />
<Action name="jog_right" text="&Jog Right" shortcut="Alt+Right" />
diff --git a/src/document/io/LilyPondExporter.h b/src/document/io/LilyPondExporter.h
index e8cb82f..7bccc30 100644
--- a/src/document/io/LilyPondExporter.h
+++ b/src/document/io/LilyPondExporter.h
@@ -47,6 +47,16 @@ class QString;
namespace Rosegarden
{
+
+// This is now in the Rosegarden namespace so it can be used
+// in LilyPondOptionsDialog with the LilyVersionAwareCheckBox.
+enum {
+ LILYPOND_VERSION_2_6,
+ LILYPOND_VERSION_2_8,
+ LILYPOND_VERSION_2_10,
+ LILYPOND_VERSION_2_12,
+ LILYPOND_VERSION_2_14
+};
class TimeSignature;
class Studio;
@@ -243,13 +253,14 @@ private:
unsigned int m_exportNoteLanguage;
int m_languageLevel;
- enum {
- LILYPOND_VERSION_2_6,
- LILYPOND_VERSION_2_8,
- LILYPOND_VERSION_2_10,
- LILYPOND_VERSION_2_12,
- LILYPOND_VERSION_2_14
- };
+// There is now an enum global within the Rosegarden namespace (declared
+// at the beggining of this file) that contains values such as:
+// enum {
+// LILYPOND_VERSION_2_6,
+// LILYPOND_VERSION_2_8,
+// ...
+// };
+// These are the values used with m_languageLevel.
int m_repeatMode;
enum {
diff --git a/src/gui/dialogs/LilyPondOptionsDialog.cpp b/src/gui/dialogs/LilyPondOptionsDialog.cpp
index dcb0ecd..c349a8b 100644
--- a/src/gui/dialogs/LilyPondOptionsDialog.cpp
+++ b/src/gui/dialogs/LilyPondOptionsDialog.cpp
@@ -24,6 +24,8 @@
#include "misc/Strings.h"
#include "misc/Debug.h"
+#include "gui/dialogs/LilyVersionAwareCheckBox.h"
+
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
@@ -228,8 +230,7 @@ LilyPondOptionsDialog::LilyPondOptionsDialog(QWidget *parent,
layoutNotation->addWidget(m_lilyExportStaffGroup, 3, 0, 1, 2);
m_lilyExportStaffGroup->setToolTip(tr("<qt>Track staff brackets are found in the <b>Track Parameters</b> box, and may be used to group staffs in various ways</qt>"));
- m_useShortNames = new QCheckBox(
- tr("Print short staff names"), frameNotation);
+ m_useShortNames = new LilyVersionAwareCheckBox(tr("Print short staff names"), frameNotation, LILYPOND_VERSION_2_10);
m_useShortNames->setToolTip(tr("<qt>Useful for large, complex scores, this prints the short name every time there is a line break in the score, making it easier to follow which line belongs to which instrument across pages</qt>"));
layoutNotation->addWidget(m_useShortNames, 4, 0, 1, 2);
@@ -326,12 +327,15 @@ LilyPondOptionsDialog::LilyPondOptionsDialog(QWidget *parent,
setLayout(metaGridLayout);
-
+ connect(m_lilyLanguage, SIGNAL(activated(int)), m_useShortNames, SLOT(slotCheckVersion(int)));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help()));
populateDefaultValues();
+
+ // Initally enable or disable m_useShortNames according to inital setting of m_lilyLanguage
+ m_useShortNames->checkVersion(m_lilyLanguage->currentIndex());
resize(minimumSizeHint());
}
diff --git a/src/gui/dialogs/LilyPondOptionsDialog.h b/src/gui/dialogs/LilyPondOptionsDialog.h
index 02d6de1..96031e7 100644
--- a/src/gui/dialogs/LilyPondOptionsDialog.h
+++ b/src/gui/dialogs/LilyPondOptionsDialog.h
@@ -22,6 +22,7 @@
#include <QString>
#include "gui/configuration/HeadersConfigurationPage.h"
+#include "LilyVersionAwareCheckBox.h"
class QWidget;
class QCheckBox;
@@ -63,7 +64,7 @@ protected:
QComboBox *m_lilyExportLyrics;
QCheckBox *m_lilyPaperLandscape;
QCheckBox *m_lilyRaggedBottom;
- QCheckBox *m_useShortNames;
+ LilyVersionAwareCheckBox *m_useShortNames;
QCheckBox *m_lilyExportEmptyStaves;
QCheckBox *m_lilyChordNamesMode;
QCheckBox *m_lilyExportBeams;
diff --git a/src/gui/dialogs/LilyVersionAwareCheckBox.cpp b/src/gui/dialogs/LilyVersionAwareCheckBox.cpp
new file mode 100644
index 0000000..63810d2
--- /dev/null
+++ b/src/gui/dialogs/LilyVersionAwareCheckBox.cpp
@@ -0,0 +1,40 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2014 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ This program 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 2 of the
+ License, or (at your option) any later version. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#include "LilyVersionAwareCheckBox.h"
+#include "document/io/LilyPondExporter.h"
+
+namespace Rosegarden
+{
+
+LilyVersionAwareCheckBox::LilyVersionAwareCheckBox(const QString& text, QWidget* parent, int workingVersion)
+ : QCheckBox(text, parent), firstWorkingVersion(workingVersion) {}
+
+void LilyVersionAwareCheckBox::checkVersion(int value)
+{
+ if (value < firstWorkingVersion) this->setDisabled(true);
+ else this->setDisabled(false);
+}
+
+void LilyVersionAwareCheckBox::slotCheckVersion(int value)
+{
+ if (value < firstWorkingVersion) this->setDisabled(true);
+ else this->setDisabled(false);
+}
+
+}
+#include "LilyVersionAwareCheckBox.moc"
diff --git a/src/gui/dialogs/LilyVersionAwareCheckBox.h b/src/gui/dialogs/LilyVersionAwareCheckBox.h
new file mode 100644
index 0000000..fa8ea41
--- /dev/null
+++ b/src/gui/dialogs/LilyVersionAwareCheckBox.h
@@ -0,0 +1,43 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2014 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ This program 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 2 of the
+ License, or (at your option) any later version. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#ifndef LILYVERSIONAWARECHECKBOX_H
+#define LILYVERSIONAWARECHECKBOX_H
+
+#include <QCheckBox>
+#include <QObject>
+
+namespace Rosegarden
+{
+
+class LilyVersionAwareCheckBox : public QCheckBox
+{
+ Q_OBJECT
+ int firstWorkingVersion;
+
+public:
+ LilyVersionAwareCheckBox(const QString& text, QWidget* parent, int workingVersion);
+ void checkVersion(int value);
+
+public slots:
+ void slotCheckVersion(int value);
+
+private:
+};
+
+}
+#endif // LILYVERSIONAWARECHECKBOX_H
diff --git a/src/gui/dialogs/LilyPondOptionsDialog.cpp b/src/gui/dialogs/LilyPondOptionsDialog.cpp
index 536bc2e..dcb0ecd 100644
--- a/src/gui/dialogs/LilyPondOptionsDialog.cpp
+++ b/src/gui/dialogs/LilyPondOptionsDialog.cpp
@@ -230,7 +230,7 @@ LilyPondOptionsDialog::LilyPondOptionsDialog(QWidget *parent,
m_useShortNames = new QCheckBox(
tr("Print short staff names"), frameNotation);
- m_useShortNames->setToolTip(tr("<qt>Useful for large, complex scores, this prints the short name every time there is a line break in the score, making it easier to follow which line belongs to which instrument across pages</qt>"));
+ m_useShortNames->setToolTip(tr("<qt>Useful for large, complex scores, this prints the short name every time there is a line break in the score, making it easier to follow which line belongs to which instrument across pages. Requires Lilypond version >=2.10</qt>"));
layoutNotation->addWidget(m_useShortNames, 4, 0, 1, 2);
layoutGrid->setRowStretch(4, 10);
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel