diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-05-05 23:54:29 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-05-06 20:26:40 +0200 |
commit | 17c4551a0a02df27cb907678a0509c1a63f6256c (patch) | |
tree | 5eed9407be2f20dd823521ebe8726139ec187a75 /plugingui/resamplingframecontent.cc | |
parent | 286cddccfd9d69f4bc567fc9f00898f06315cd30 (diff) |
Introduce the new resampling frame.
Diffstat (limited to 'plugingui/resamplingframecontent.cc')
-rw-r--r-- | plugingui/resamplingframecontent.cc | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/plugingui/resamplingframecontent.cc b/plugingui/resamplingframecontent.cc new file mode 100644 index 0000000..1f752d3 --- /dev/null +++ b/plugingui/resamplingframecontent.cc @@ -0,0 +1,92 @@ +/* -*- Mode: c++ -*- */ +/*************************************************************************** + * resamplingframecontent.cc + * + * Fri May 5 23:43:28 CEST 2017 + * Copyright 2017 André Nusser + * andre.nusser@googlemail.com + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DrumGizmo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include "resamplingframecontent.h" + +#include <settings.h> + +namespace GUI +{ + +ResamplingframeContent::ResamplingframeContent( + Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) + : Widget(parent) + , settings(settings) + , settings_notifier(settings_notifier) +{ + CONNECT(this, settings_notifier.drumkit_samplerate, + this, &ResamplingframeContent::updateDrumkitSamplerate); + CONNECT(this, settings_notifier.samplerate, + this, &ResamplingframeContent::updateSessionSamplerate); + CONNECT(this, settings_notifier.resamplig_recommended, + this, &ResamplingframeContent::updateResamplingRecommended); + + text_field.move(0, 0); + text_field.setReadOnly(true); + + updateContent(); + text_field.show(); +} + +void ResamplingframeContent::resize(std::size_t width, std::size_t height) +{ + Widget::resize(width, height); + text_field.resize(width, height); +} + +void ResamplingframeContent::updateContent() +{ + text_field.setText( + "Session samplerate: " + session_samplerate + "\n" + "Drumkit samplerate: " + drumkit_samplerate + "\n" + "Resampling recommended: " + resamplig_recommended + "\n" + ); +} + +void ResamplingframeContent::updateDrumkitSamplerate(std::size_t drumkit_samplerate) +{ + this->drumkit_samplerate = drumkit_samplerate == 0 + ? "" + : std::to_string(drumkit_samplerate); + + updateContent(); +} + +void ResamplingframeContent::updateSessionSamplerate(double samplerate) +{ + this->session_samplerate = std::to_string((std::size_t)samplerate); + + updateContent(); +} + +void ResamplingframeContent::updateResamplingRecommended(bool resamplig_recommended) +{ + this->resamplig_recommended = resamplig_recommended ? "Yes" : "No"; + + updateContent(); +} + +} // GUI:: |