| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2008 by Andres Cabrera * |
| 3 | * [email protected] * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 3 of the License, or * |
| 8 | * (at your option) any later version. * |
| 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 * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | #include "simpledocument.h" |
| 22 | #include "documentview.h" |
| 23 | #include "widgetlayout.h" |
| 24 | #include "qutebutton.h" |
| 25 | #include "quteapp.h" |
| 26 | |
| 27 | SimpleDocument::SimpleDocument(QWidget *parent, OpEntryParser *opcodeTree) : |
| 28 | BaseDocument(parent,opcodeTree) |
| 29 | { |
| 30 | init(parent,opcodeTree); |
| 31 | } |
| 32 | |
| 33 | void SimpleDocument::setTextString(QString &text) |
| 34 | { |
| 35 | m_widgetLayouts[0]->setFontScaling(1.0); // Must come before parsing |
| 36 | parseTextString(text); |
| 37 | m_widgetLayouts[0]->show(); |
| 38 | m_widgetLayouts[0]->setWidgetsLocked(true); |
| 39 | m_view->setFullText(text, true); // TODO do something different if not a csd file? |
| 40 | } |
| 41 | |
| 42 | void SimpleDocument::registerButton(QuteButton *b) |
| 43 | { |
| 44 | connect(b, SIGNAL(play()), static_cast<QuteApp *>(parent()), SLOT(start())); |
| 45 | // connect(b, SIGNAL(render()), static_cast<qutecsound *>(parent()), SLOT(render())); |
| 46 | connect(b, SIGNAL(pause()), static_cast<QuteApp *>(parent()), SLOT(pause())); |
| 47 | connect(b, SIGNAL(stop()), static_cast<QuteApp *>(parent()), SLOT(stop())); |
| 48 | } |
| 49 | |
| 50 | void SimpleDocument::init(QWidget *parent, OpEntryParser *opcodeTree) |
| 51 | { |
| 52 | m_view = new DocumentView(parent, opcodeTree); |
| 53 | m_view->hide(); |
| 54 | } |