forked from qt-creator/qt-creator
QML Wizard: Remove "dummy data" setting.
This also obsoletes one class and one UI file. Reviewed-by: Alessandro Portale
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "qmlstandaloneappwizardpages.h"
|
||||
#include "ui_qmlstandaloneappwizardsourcespage.h"
|
||||
#include "ui_qmlstandaloneappwizardoptionspage.h"
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <QtGui/QDesktopServices>
|
||||
@@ -164,142 +163,5 @@ QStringList QmlStandaloneAppWizardSourcesPage::moduleImportPaths() const
|
||||
return ertriesFromListWidget(*m_d->ui.importPathsListWidget);
|
||||
}
|
||||
|
||||
class QmlStandaloneAppWizardOptionsPagePrivate
|
||||
{
|
||||
Ui::QmlStandaloneAppWizardOptionPage ui;
|
||||
QString symbianSvgIcon;
|
||||
QString maemoPngIcon;
|
||||
friend class QmlStandaloneAppWizardOptionsPage;
|
||||
};
|
||||
|
||||
QmlStandaloneAppWizardOptionsPage::QmlStandaloneAppWizardOptionsPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
, m_d(new QmlStandaloneAppWizardOptionsPagePrivate)
|
||||
{
|
||||
m_d->ui.setupUi(this);
|
||||
|
||||
const QIcon open = QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon);
|
||||
m_d->ui.symbianAppIconLoadToolButton->setIcon(open);
|
||||
connect(m_d->ui.symbianAppIconLoadToolButton, SIGNAL(clicked()), SLOT(openSymbianSvgIcon()));
|
||||
connect(m_d->ui.maemoPngIconButton, SIGNAL(clicked()), this,
|
||||
SLOT(openMaemoPngIcon()));
|
||||
|
||||
m_d->ui.orientationBehaviorComboBox->addItem(tr("Auto rotate orientation"),
|
||||
QmlStandaloneApp::Auto);
|
||||
m_d->ui.orientationBehaviorComboBox->addItem(tr("Lock to landscape orientation"),
|
||||
QmlStandaloneApp::LockLandscape);
|
||||
m_d->ui.orientationBehaviorComboBox->addItem(tr("Lock to portrait orientation"),
|
||||
QmlStandaloneApp::LockPortrait);
|
||||
}
|
||||
|
||||
QmlStandaloneAppWizardOptionsPage::~QmlStandaloneAppWizardOptionsPage()
|
||||
{
|
||||
delete m_d;
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::setOrientation(QmlStandaloneApp::Orientation orientation)
|
||||
{
|
||||
QComboBox *const comboBox = m_d->ui.orientationBehaviorComboBox;
|
||||
for (int i = 0; i < comboBox->count(); ++i)
|
||||
if (comboBox->itemData(i).toInt() == static_cast<int>(orientation)) {
|
||||
comboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QmlStandaloneApp::Orientation QmlStandaloneAppWizardOptionsPage::orientation() const
|
||||
{
|
||||
const int index = m_d->ui.orientationBehaviorComboBox->currentIndex();
|
||||
return static_cast<QmlStandaloneApp::Orientation>(m_d->ui.orientationBehaviorComboBox->itemData(index).toInt());
|
||||
}
|
||||
|
||||
QString QmlStandaloneAppWizardOptionsPage::symbianSvgIcon() const
|
||||
{
|
||||
return m_d->symbianSvgIcon;
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::setSymbianSvgIcon(const QString &icon)
|
||||
{
|
||||
QPixmap iconPixmap(icon);
|
||||
if (!iconPixmap.isNull()) {
|
||||
const int symbianIconSize = 44;
|
||||
if (iconPixmap.height() > symbianIconSize || iconPixmap.width() > symbianIconSize)
|
||||
iconPixmap = iconPixmap.scaledToHeight(symbianIconSize, Qt::SmoothTransformation);
|
||||
m_d->ui.symbianAppIconPreview->setPixmap(iconPixmap);
|
||||
m_d->symbianSvgIcon = icon;
|
||||
}
|
||||
}
|
||||
|
||||
QString QmlStandaloneAppWizardOptionsPage::maemoPngIcon() const
|
||||
{
|
||||
return m_d->maemoPngIcon;
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::setMaemoPngIcon(const QString &icon)
|
||||
{
|
||||
QString error;
|
||||
QPixmap iconPixmap(icon);
|
||||
if (iconPixmap.isNull())
|
||||
error = tr("The file is not a valid image.");
|
||||
else if (iconPixmap.size() != QSize(64, 64))
|
||||
error = tr("The icon has an invalid size.");
|
||||
if (!error.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Icon unusable"), error);
|
||||
} else {
|
||||
m_d->ui.maemoPngIconButton->setIcon(iconPixmap);
|
||||
m_d->maemoPngIcon = icon;
|
||||
}
|
||||
}
|
||||
|
||||
QString QmlStandaloneAppWizardOptionsPage::symbianUid() const
|
||||
{
|
||||
return m_d->ui.symbianTargetUid3LineEdit->text();
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::setSymbianUid(const QString &uid)
|
||||
{
|
||||
m_d->ui.symbianTargetUid3LineEdit->setText(uid);
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::setLoadDummyData(bool loadIt)
|
||||
{
|
||||
m_d->ui.loadDummyDataCheckBox->setChecked(loadIt);
|
||||
}
|
||||
|
||||
bool QmlStandaloneAppWizardOptionsPage::loadDummyData() const
|
||||
{
|
||||
return m_d->ui.loadDummyDataCheckBox->isChecked();
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::setNetworkEnabled(bool enableIt)
|
||||
{
|
||||
m_d->ui.symbianEnableNetworkChackBox->setChecked(enableIt);
|
||||
}
|
||||
|
||||
bool QmlStandaloneAppWizardOptionsPage::networkEnabled() const
|
||||
{
|
||||
return m_d->ui.symbianEnableNetworkChackBox->isChecked();
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::openSymbianSvgIcon()
|
||||
{
|
||||
const QString svgIcon = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
m_d->ui.symbianAppIconLabel->text(),
|
||||
QDesktopServices::storageLocation(QDesktopServices::PicturesLocation),
|
||||
QLatin1String("*.svg"));
|
||||
if (!svgIcon.isEmpty())
|
||||
setSymbianSvgIcon(svgIcon);
|
||||
}
|
||||
|
||||
void QmlStandaloneAppWizardOptionsPage::openMaemoPngIcon()
|
||||
{
|
||||
const QString iconPath = QFileDialog::getOpenFileName(this,
|
||||
m_d->ui.maemoAppIconLabel->text(), m_d->maemoPngIcon,
|
||||
QLatin1String("*.png"));
|
||||
if (!iconPath.isEmpty())
|
||||
setMaemoPngIcon(iconPath);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
Reference in New Issue
Block a user