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.
8 * @see The GNU Public License (GPL) Version 3
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
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"
33 struct FileWizardPagePrivate
{
34 FileWizardPagePrivate();
39 FileWizardPagePrivate::FileWizardPagePrivate() :
43 FileWizardPage::FileWizardPage(QWidget
*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()
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
);
85 case QEvent::LanguageChange
:
86 m_d
->m_ui
.retranslateUi(this);
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
) {
125 bool FileWizardPage::validateBaseName(const QString
&name
, QString
*errorMessage
/* = 0*/)
127 return FileNameValidatingLineEdit::validateFileName(name
, false, errorMessage
);