1 /***************************************************************************
2 **                                                                        **
3 **  Polyphone, a soundfont editor                                         **
4 **  Copyright (C) 2013-2019 Davy Triponney                                **
5 **                                                                        **
6 **  This program is free software: you can redistribute it and/or modify  **
7 **  it under the terms of the GNU General Public License as published by  **
8 **  the Free Software Foundation, either version 3 of the License, or     **
9 **  (at your option) any later version.                                   **
10 **                                                                        **
11 **  This program is distributed in the hope that it will be useful,       **
12 **  but WITHOUT ANY WARRANTY; without even the implied warranty of        **
13 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          **
14 **  GNU General Public License for more details.                          **
15 **                                                                        **
16 **  You should have received a copy of the GNU General Public License     **
17 **  along with this program. If not, see http://www.gnu.org/licenses/.    **
18 **                                                                        **
19 ****************************************************************************
20 **           Author: Davy Triponney                                       **
21 **  Website/Contact: https://www.polyphone-soundfonts.com                 **
22 **             Date: 01.01.2013                                           **
23 ***************************************************************************/
24 
25 #include "soundfonteditortop.h"
26 #include "ui_soundfonteditortop.h"
27 #include "contextmanager.h"
28 #include "soundfontinformation.h"
29 
SoundfontEditorTop(QWidget * parent)30 SoundfontEditorTop::SoundfontEditorTop(QWidget *parent) :
31     QWidget(parent),
32     ui(new Ui::SoundfontEditorTop)
33 {
34     ui->setupUi(this);
35 
36     // Style
37     ui->lineEdit_name->resizeAfterChange(false);
38     ui->lineEdit_name->setColor(ContextManager::theme()->getColor(ThemeManager::HIGHLIGHTED_TEXT));
39 }
40 
~SoundfontEditorTop()41 SoundfontEditorTop::~SoundfontEditorTop()
42 {
43     delete ui;
44 }
45 
initialize(SoundfontInformation * soundfontInfo)46 void SoundfontEditorTop::initialize(SoundfontInformation * soundfontInfo)
47 {
48     // Title
49     ui->lineEdit_name->setText(soundfontInfo->getTitle());
50 }
51 
getEditingError()52 QString SoundfontEditorTop::getEditingError()
53 {
54     // A title must be provided
55     if (ui->lineEdit_name->text().isEmpty())
56         return tr("A title must be provided.");
57 
58     return "";
59 }
60 
fillArguments(QMap<QString,QString> & arguments)61 void SoundfontEditorTop::fillArguments(QMap<QString, QString> &arguments)
62 {
63     arguments["title"] = ui->lineEdit_name->text();
64 }
65