Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to move soundfont to top #5269

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions fluid/fluid_gui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,32 @@
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="soundFontTop">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="toolTip">
<string>Move SoundFont to Top</string>
</property>
<property name="accessibleDescription">
<string/>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../mscore/musescore.qrc">
<normaloff>:/data/icons/object-select.svg</normaloff>:/data/icons/object-select.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="soundFontUp">
<property name="sizePolicy">
Expand Down
22 changes: 22 additions & 0 deletions fluid/fluidgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ FluidGui::FluidGui(Synthesizer* s)
: SynthesizerGui(s)
{
setupUi(this);
connect(soundFontTop, SIGNAL(clicked()), SLOT(soundFontTopClicked()));
connect(soundFontUp, SIGNAL(clicked()), SLOT(soundFontUpClicked()));
connect(soundFontDown, SIGNAL(clicked()), SLOT(soundFontDownClicked()));
connect(soundFontAdd, SIGNAL(clicked()), SLOT(soundFontAddClicked()));
Expand Down Expand Up @@ -148,6 +149,26 @@ void FluidGui::synthesizerChanged()
emit sfChanged();
}


//---------------------------------------------------------
// soundFontTopClicked
//---------------------------------------------------------

void FluidGui::soundFontTopClicked()
{
int row = soundFonts->currentRow();
if (row <= 0)
return;
QStringList sfonts = fluid()->soundFonts();
sfonts.move(row, 0);
fluid()->loadSoundFonts(sfonts);
sfonts = fluid()->soundFonts();
soundFonts->clear();
soundFonts->addItems(sfonts);
soundFonts->setCurrentRow(0);
emit sfChanged();
}

//---------------------------------------------------------
// moveSoundfontInTheList
//---------------------------------------------------------
Expand Down Expand Up @@ -219,6 +240,7 @@ void FluidGui::updateUpDownButtons()
{
int rows = soundFonts->count();
int row = soundFonts->currentRow();
soundFontTop->setEnabled(row > 0);
soundFontUp->setEnabled(row > 0);
soundFontDown->setEnabled((row != -1) && (row < (rows-1)));
soundFontDelete->setEnabled(row != -1);
Expand Down
1 change: 1 addition & 0 deletions fluid/fluidgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class FluidGui : public Ms::SynthesizerGui, Ui::FluidGui {
void moveSoundfontInTheList(int currentIdx, int targetIdx);

private slots:
void soundFontTopClicked();
void soundFontUpClicked();
void soundFontDownClicked();
void soundFontAddClicked();
Expand Down
26 changes: 26 additions & 0 deletions zerberus/zerberus_gui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="soundFontTop">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="toolTip">
<string>Move SoundFont to Top</string>
</property>
<property name="accessibleDescription">
<string/>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../mscore/musescore.qrc">
<normaloff>:/data/icons/object-select.svg</normaloff>:/data/icons/object-select.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="soundFontUp">
<property name="sizePolicy">
Expand Down
23 changes: 21 additions & 2 deletions zerberus/zerberusgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ ZerberusGui::ZerberusGui(Ms::Synthesizer* s)
: SynthesizerGui(s)
{
setupUi(this);
connect(soundFontTop, SIGNAL(clicked()), SLOT(soundFontTopClicked()));
connect(soundFontUp, SIGNAL(clicked()), SLOT(soundFontUpClicked()));
connect(soundFontDown, SIGNAL(clicked()), SLOT(soundFontDownClicked()));
connect(soundFontAdd, SIGNAL(clicked()), SLOT(soundFontAddClicked()));
Expand All @@ -114,6 +115,22 @@ ZerberusGui::ZerberusGui(Ms::Synthesizer* s)
updateButtons();
}

void ZerberusGui::soundFontTopClicked()
{
int row = files->currentRow();
if (row <= 0)
return;

QStringList sfonts = zerberus()->soundFonts();
sfonts.move(row, 0);

zerberus()->removeSoundFonts(zerberus()->soundFonts());

loadSoundFontsAsync(sfonts);
files->setCurrentRow(0);
emit sfChanged();
}

//---------------------------------------------------------
// moveSoundfontInTheList
//---------------------------------------------------------
Expand Down Expand Up @@ -297,10 +314,12 @@ void ZerberusGui::updateProgress()

void ZerberusGui::updateButtons()
{
int rows = zerberus()->soundFonts().count();
int row = files->currentRow();
soundFontTop->setEnabled(row > 0);
soundFontUp->setEnabled(row > 0);
soundFontDown->setEnabled((row != -1) && (row < (rows-1)));
soundFontDelete->setEnabled(row != -1);
soundFontUp->setEnabled(row != -1);
soundFontDown->setEnabled(row != -1);
}

//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions zerberus/zerberusgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class ZerberusGui : public Ms::SynthesizerGui, Ui::ZerberusGui {
void moveSoundfontInTheList(int currentIdx, int targetIdx);

private slots:
void soundFontTopClicked();
void soundFontUpClicked();
void soundFontDownClicked();
void soundFontAddClicked();
Expand Down