LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / utils / filewizardpage.cpp
blobf25fb3d4bcd3d55a94cec7b356250948304076c6
1 /**
2 ******************************************************************************
4 * @file filewizardpage.cpp
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @brief
8 * @see The GNU Public License (GPL) Version 3
9 * @defgroup
10 * @{
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "filewizardpage.h"
30 #include "ui_filewizardpage.h"
32 namespace Utils {
33 struct FileWizardPagePrivate {
34 FileWizardPagePrivate();
35 Ui::WizardPage m_ui;
36 bool m_complete;
39 FileWizardPagePrivate::FileWizardPagePrivate() :
40 m_complete(false)
43 FileWizardPage::FileWizardPage(QWidget *parent) :
44 QWizardPage(parent),
45 m_d(new FileWizardPagePrivate)
47 m_d->m_ui.setupUi(this);
48 connect(m_d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
49 connect(m_d->m_ui.nameLineEdit, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
51 connect(m_d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated()));
52 connect(m_d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated()));
55 FileWizardPage::~FileWizardPage()
57 delete m_d;
60 QString FileWizardPage::name() const
62 return m_d->m_ui.nameLineEdit->text();
65 QString FileWizardPage::path() const
67 return m_d->m_ui.pathChooser->path();
70 void FileWizardPage::setPath(const QString &path)
72 m_d->m_ui.pathChooser->setPath(path);
75 void FileWizardPage::setName(const QString &name)
77 m_d->m_ui.nameLineEdit->setText(name);
80 void FileWizardPage::changeEvent(QEvent *e)
82 QWizardPage::changeEvent(e);
84 switch (e->type()) {
85 case QEvent::LanguageChange:
86 m_d->m_ui.retranslateUi(this);
87 break;
88 default:
89 break;
93 bool FileWizardPage::isComplete() const
95 return m_d->m_complete;
98 void FileWizardPage::setNameLabel(const QString &label)
100 m_d->m_ui.nameLabel->setText(label);
103 void FileWizardPage::setPathLabel(const QString &label)
105 m_d->m_ui.pathLabel->setText(label);
108 void FileWizardPage::slotValidChanged()
110 const bool newComplete = m_d->m_ui.pathChooser->isValid() && m_d->m_ui.nameLineEdit->isValid();
112 if (newComplete != m_d->m_complete) {
113 m_d->m_complete = newComplete;
114 emit completeChanged();
118 void FileWizardPage::slotActivated()
120 if (m_d->m_complete) {
121 emit activated();
125 bool FileWizardPage::validateBaseName(const QString &name, QString *errorMessage /* = 0*/)
127 return FileNameValidatingLineEdit::validateFileName(name, false, errorMessage);
129 } // namespace Utils