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 "createpalettedialog.h"
21 
22 #include "ui_createPalette.h"
23 
24 namespace Ms {
25 
CreatePaletteDialog(QWidget * parent)26 CreatePaletteDialog::CreatePaletteDialog(QWidget* parent)
27    : QDialog(parent), ui(new Ui::CreatePaletteDialog)
28       {
29       ui->setupUi(this);
30 
31       QPushButton* okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
32       Q_ASSERT(okButton);
33 
34       okButton->setText(tr("Create"));
35       okButton->setEnabled(!ui->paletteNameLineEdit->text().isEmpty());
36 
37       connect(ui->paletteNameLineEdit, &QLineEdit::textChanged, okButton, [okButton](const QString& text) {
38             okButton->setEnabled(!text.isEmpty());
39             });
40       }
41 
~CreatePaletteDialog()42 CreatePaletteDialog::~CreatePaletteDialog()
43       {
44       delete ui;
45       }
46 
paletteName() const47 QString CreatePaletteDialog::paletteName() const
48       {
49       return ui->paletteNameLineEdit->text();
50       }
51 
52 } // namespace Ms
53