Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / video / videogadgetoptionspage.cpp
blobc6aef2c9caf28fa874a916c277a5b55aa9e53716
1 /**
2 ******************************************************************************
4 * @file videogadgetoptionspage.cpp
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup VideoGadgetPlugin Video Gadget Plugin
9 * @{
10 * @brief A video gadget plugin
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "videogadgetoptionspage.h"
29 #include "videogadgetconfiguration.h"
30 #include "helpdialog.h"
32 #include "ui_videooptionspage.h"
34 VideoGadgetOptionsPage::VideoGadgetOptionsPage(VideoGadgetConfiguration *config, QObject *parent) :
35 IOptionsPage(parent), m_config(config)
37 m_page = 0;
40 QWidget *VideoGadgetOptionsPage::createPage(QWidget *parent)
42 m_page = new Ui::VideoOptionsPage();
43 QWidget *w = new QWidget(parent);
44 m_page->setupUi(w);
46 // TODO
47 m_page->respectAspectRatioCheckBox->setVisible(false);
48 m_page->helpButton->setVisible(false);
50 m_page->displayVideoCheckBox->setChecked(m_config->displayVideo());
51 m_page->displayControlsCheckBox->setChecked(m_config->displayControls());
52 m_page->autoStartCheckBox->setChecked(m_config->autoStart());
53 m_page->respectAspectRatioCheckBox->setChecked(m_config->respectAspectRatio());
54 m_page->descPlainTextEdit->setPlainText(m_config->pipelineDesc());
55 m_page->infoPlainTextEdit->setPlainText(m_config->pipelineInfo());
57 connect(m_page->helpButton, SIGNAL(clicked()), this, SLOT(openHelpDialog()));
59 return w;
62 void VideoGadgetOptionsPage::apply()
64 m_config->setDisplayVideo(m_page->displayVideoCheckBox->isChecked());
65 m_config->setDisplayControls(m_page->displayControlsCheckBox->isChecked());
66 m_config->setAutoStart(m_page->autoStartCheckBox->isChecked());
67 m_config->setRespectAspectRatio(m_page->respectAspectRatioCheckBox->isChecked());
68 m_config->setPipelineDesc(m_page->descPlainTextEdit->toPlainText());
69 m_config->setPipelineInfo(m_page->infoPlainTextEdit->toPlainText());
72 void VideoGadgetOptionsPage::finish()
74 delete m_page;
77 void VideoGadgetOptionsPage::openHelpDialog()
79 HelpDialog dlg(0);
81 dlg.execDialog();