1 /*! 2 @file GuiLoopingPopup.cpp 3 4 @brief xxx. 5 6 @author L. J. Barman 7 8 Copyright (c) 2008-2013, L. J. Barman, all rights reserved 9 10 This file is part of the PianoBooster application 11 12 PianoBooster is free software: you can redistribute it and/or modify 13 it under the terms of the GNU General Public License as published by 14 the Free Software Foundation, either version 3 of the License, or 15 (at your option) any later version. 16 17 PianoBooster is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with PianoBooster. If not, see <http://www.gnu.org/licenses/>. 24 25 */ 26 27 #include <QtWidgets> 28 29 #include "GuiLoopingPopup.h" 30 #include "GlView.h" 31 GuiLoopingPopup(QWidget * parent)32GuiLoopingPopup::GuiLoopingPopup(QWidget *parent) 33 : QWidget(parent) 34 { 35 setupUi(this); 36 m_song = nullptr; 37 setWindowTitle(tr("Continuous Looping")); 38 setWindowFlags(Qt::Popup); 39 } 40 init(CSong * song)41void GuiLoopingPopup::init(CSong* song) 42 { 43 m_song = song; 44 loopBarsSpin->setValue(m_song->getLoopingBars()); 45 updateInfo(); 46 } 47 updateInfo()48void GuiLoopingPopup::updateInfo() 49 { 50 if (m_song->getLoopingBars() > 0.0) 51 loopingText->setText(tr("Repeat End Bar:") + " " + QString().setNum(m_song->getPlayUptoBar())); 52 else 53 loopingText->setText(tr("Repeat Bar is disabled")); 54 } 55 on_loopBarsSpin_valueChanged(double bars)56void GuiLoopingPopup::on_loopBarsSpin_valueChanged(double bars) 57 { 58 if (!m_song) return; 59 60 m_song->setLoopingBars( bars); 61 updateInfo(); 62 } 63 closeEvent(QCloseEvent * event)64void GuiLoopingPopup::closeEvent(QCloseEvent *event) 65 { 66 QPushButton* parent = static_cast<QPushButton*> (parentWidget()); 67 if (parent) 68 parent->setChecked(false); 69 } 70 71