1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2019 MuseScore BVBA
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 #include "musescoredialogs.h"
21 #include "icons.h"
22 #include "preferences.h"
23 #include "musescore.h"
24 #include "scoreview.h"
25
26 namespace Ms {
27
28 //---------------------------------------------------------
29 // InsertMeasuresDialog
30 //---------------------------------------------------------
31
InsertMeasuresDialog(QWidget * parent)32 InsertMeasuresDialog::InsertMeasuresDialog(QWidget* parent)
33 : QDialog(parent)
34 {
35 setObjectName("InsertMeasuresDialog");
36 setupUi(this);
37 setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
38 setModal(true);
39 insmeasures->selectAll();
40 connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonBoxClicked(QAbstractButton*)));
41 }
42
43 //---------------------------------------------------------
44 // buttonBoxClicked
45 //---------------------------------------------------------
46
buttonBoxClicked(QAbstractButton * button)47 void InsertMeasuresDialog::buttonBoxClicked(QAbstractButton* button)
48 {
49 switch (buttonBox->buttonRole(button)) {
50 case QDialogButtonBox::AcceptRole:
51 accept();
52 // fall through
53 case QDialogButtonBox::RejectRole:
54 close();
55 default:
56 break;
57 }
58 }
59
60 //---------------------------------------------------------
61 // Insert Measure --> accept
62 //---------------------------------------------------------
63
accept()64 void InsertMeasuresDialog::accept()
65 {
66 int n = insmeasures->value();
67 if (mscore->currentScore())
68 mscore->currentScoreView()->cmdInsertMeasures(n, ElementType::MEASURE);
69 done(1);
70 }
71
72 //---------------------------------------------------------
73 // InsertMeasuresDialog hideEvent
74 //---------------------------------------------------------
75
hideEvent(QHideEvent * event)76 void InsertMeasuresDialog::hideEvent(QHideEvent* event)
77 {
78 MuseScore::saveGeometry(this);
79 QDialog::hideEvent(event);
80 }
81
82 //---------------------------------------------------------
83 // MeasuresDialog
84 //---------------------------------------------------------
85
MeasuresDialog(QWidget * parent)86 MeasuresDialog::MeasuresDialog(QWidget* parent)
87 : QDialog(parent)
88 {
89 setupUi(this);
90 setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
91 setModal(true);
92 measures->selectAll();
93 connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonBoxClicked(QAbstractButton*)));
94 }
95
96 //---------------------------------------------------------
97 // buttonBoxClicked
98 //---------------------------------------------------------
99
buttonBoxClicked(QAbstractButton * button)100 void MeasuresDialog::buttonBoxClicked(QAbstractButton* button)
101 {
102 switch (buttonBox->buttonRole(button)) {
103 case QDialogButtonBox::AcceptRole:
104 accept();
105 // fall through
106 case QDialogButtonBox::RejectRole:
107 close();
108 default:
109 break;
110 }
111 }
112
113 //---------------------------------------------------------
114 // accept
115 //---------------------------------------------------------
116
accept()117 void MeasuresDialog::accept()
118 {
119 int n = measures->value();
120 if (mscore->currentScore())
121 mscore->currentScoreView()->cmdAppendMeasures(n, ElementType::MEASURE);
122 done(1);
123 }
124
125
126 //---------------------------------------------------------
127 // AboutBoxDialog
128 //---------------------------------------------------------
129
AboutBoxDialog()130 AboutBoxDialog::AboutBoxDialog()
131 {
132 setupUi(this);
133 museLogo->setPixmap(QPixmap(preferences.isThemeDark() ?
134 ":/data/musescore-logo-transbg-m.png" : ":/data/musescore_logo_full.png"));
135
136 if (MuseScore::unstable())
137 versionLabel->setText(tr("Unstable Prerelease for Version: %1").arg(VERSION));
138 else {
139 auto msVersion = QString(VERSION);
140 if (strlen(BUILD_NUMBER))
141 msVersion += QString(".") + QString(BUILD_NUMBER);// +QString(" Beta");
142 versionLabel->setText(tr("Version: %1").arg(msVersion));
143 }
144
145 revisionLabel->setText(tr("Revision: %1").arg(revision));
146 setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
147
148 QString visitAndDonateString;
149 #if !defined(FOR_WINSTORE)
150 visitAndDonateString = tr("Visit %1www.musescore.org%2 for new versions and more information.\nSupport MuseScore with your %3donation%4.")
151 .arg("<a href=\"https://www.musescore.org/\">")
152 .arg("</a>")
153 .arg("<a href=\"https://www.musescore.org/donate\">")
154 .arg("</a>");
155 visitAndDonateString += "\n\n";
156 #endif
157 QString finalString = visitAndDonateString + tr("Copyright © 1999-2021 MuseScore BVBA and others.\nPublished under the GNU General Public License.");
158 finalString.replace("\n", "<br/>");
159 copyrightLabel->setText(QString("<span style=\"font-size:10pt;\">%1</span>").arg(finalString));
160 connect(copyRevisionButton, SIGNAL(clicked()), this, SLOT(copyRevisionToClipboard()));
161 copyRevisionButton->setIcon(*icons[int(Icons::copy_ICON)]);
162 }
163
164 //---------------------------------------------------------
165 // copyRevisionToClipboard
166 //---------------------------------------------------------
167
copyRevisionToClipboard()168 void AboutBoxDialog::copyRevisionToClipboard()
169 {
170 QClipboard* cb = QApplication::clipboard();
171 QString sysinfo = "OS: ";
172 sysinfo += QSysInfo::prettyProductName();
173 sysinfo += ", Arch.: ";
174 sysinfo += QSysInfo::currentCpuArchitecture();
175 // endianness?
176 sysinfo += ", MuseScore version (";
177 sysinfo += QSysInfo::WordSize==32 ? "32" : "64";
178 sysinfo += "-bit): " + QString(VERSION);
179 if (strlen(BUILD_NUMBER))
180 sysinfo += QString(".") + QString(BUILD_NUMBER);
181 sysinfo += ", revision: ";
182 sysinfo += "github-musescore-musescore-";
183 sysinfo += revision;
184 cb->setText(sysinfo);
185 }
186
187 //---------------------------------------------------------
188 // AboutBoxDialog
189 //---------------------------------------------------------
190
AboutMusicXMLBoxDialog()191 AboutMusicXMLBoxDialog::AboutMusicXMLBoxDialog()
192 {
193 setupUi(this);
194 setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
195 label->setText(QString("<span style=\"font-size:10pt;\">%1<br/></span>")
196 .arg(tr( "MusicXML is an open file format for exchanging digital sheet music,\n"
197 "supported by many applications.\n"
198 "Copyright © 2004-2017 the Contributors to the MusicXML\n"
199 "Specification, published by the W3C Music Notation Community\n"
200 "Group under the W3C Community Contributor License Agreement\n"
201 "(CLA):\n%1\n"
202 "A human-readable summary is available:\n%2")
203 .arg( "\n <a href=\"https://www.w3.org/community/about/agreements/cla/\">https://www.w3.org/community/about/agreements/cla/</a>\n",
204 "\n <a href=\"https://www.w3.org/community/about/agreements/cla-deed/\">https://www.w3.org/community/about/agreements/cla-deed/</a>\n")
205 .replace("\n","<br/>")));
206 }
207
208 } // namespace Ms
209