Commit 133b8483 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QML standalone wizard: Add support for Maemo5 application icon.

Reviewed-by: Alessandro Portale
parent 1d453301
......@@ -57,10 +57,12 @@ symbian {
$$itempath = /opt/share/$$eval($${deploymentfolder}.target)
INSTALLS += $$item
}
icon.files = $${TARGET}.png
icon.path = /usr/share/icons/hicolor/scalable/hildon
desktopfile.files = $${TARGET}.desktop
desktopfile.path = /usr/share/applications/hildon
target.path = /opt/bin
INSTALLS += desktopfile target
INSTALLS += desktopfile icon target
} else:macx {
!isEqual(PWD,$$OUT_PWD) {
copyCommand = @echo Copying application data...
......
......@@ -185,6 +185,16 @@ QString QmlStandaloneApp::symbianSvgIcon() const
return path(SymbianSvgIconOrigin);
}
void QmlStandaloneApp::setMaemoPngIcon(const QString &icon)
{
m_maemoPngIcon = icon;
}
QString QmlStandaloneApp::maemoPngIcon() const
{
return path(MaemoPngIconOrigin);
}
void QmlStandaloneApp::setSymbianTargetUid(const QString &uid)
{
m_symbianTargetUid = uid;
......@@ -287,6 +297,9 @@ QString QmlStandaloneApp::path(Path path) const
case SymbianSvgIcon: return pathBase + symbianIconFileName;
case SymbianSvgIconOrigin: return !m_symbianSvgIcon.isEmpty() ? m_symbianSvgIcon
: originsRoot + symbianIconFileName;
case MaemoPngIcon: return pathBase + projectName() + QLatin1String(".png");
case MaemoPngIconOrigin: return !m_maemoPngIcon.isEmpty() ? m_maemoPngIcon
: originsRoot + QLatin1String("maemoicon.png");
case QmlDir: return pathBase + qmlSubDir;
case QmlDirProFileRelative: return useExistingMainQml() ? appProFilePath.relativeFilePath(m_mainQmlFile.canonicalPath())
: QString(qmlSubDir).remove(qmlSubDir.length() - 1, 1);
......@@ -516,6 +529,7 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons
files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute);
files.append(file(generateFile(GeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp)));
files.append(file(generateFile(GeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon)));
files.append(file(generateFile(GeneratedFileInfo::MaemoPngIconFile, errorMessage), path(MaemoPngIcon)));
files.append(file(generateFile(GeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
files.append(file(generateFile(GeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
......@@ -566,6 +580,9 @@ QByteArray QmlStandaloneApp::generateFile(GeneratedFileInfo::File file,
case GeneratedFileInfo::SymbianSvgIconFile:
data = readBlob(path(SymbianSvgIconOrigin));
break;
case GeneratedFileInfo::MaemoPngIconFile:
data = readBlob(path(MaemoPngIconOrigin));
break;
case GeneratedFileInfo::AppProFile:
data = generateProFile(errorMessage);
comment = proFileComment;
......
......@@ -85,7 +85,8 @@ struct GeneratedFileInfo
AppViewerPriFile,
AppViewerCppFile,
AppViewerHFile,
SymbianSvgIconFile
SymbianSvgIconFile,
MaemoPngIconFile
};
GeneratedFileInfo();
......@@ -127,6 +128,8 @@ public:
AppViewerHOrigin,
SymbianSvgIcon,
SymbianSvgIconOrigin,
MaemoPngIcon,
MaemoPngIconOrigin,
QmlDir,
QmlDirProFileRelative,
ModulesDir
......@@ -144,6 +147,8 @@ public:
void setProjectPath(const QString &path);
void setSymbianSvgIcon(const QString &icon);
QString symbianSvgIcon() const;
void setMaemoPngIcon(const QString &icon);
QString maemoPngIcon() const;
void setSymbianTargetUid(const QString &uid);
QString symbianTargetUid() const;
void setLoadDummyData(bool loadIt);
......@@ -180,6 +185,7 @@ private:
QString m_projectName;
QFileInfo m_projectPath;
QString m_symbianSvgIcon;
QString m_maemoPngIcon;
QString m_symbianTargetUid;
bool m_loadDummyData;
Orientation m_orientation;
......
......@@ -149,6 +149,7 @@ QWizard *QmlStandaloneAppWizard::createWizardDialog(QWidget *parent,
m_d->wizardDialog->setPath(defaultPath);
m_d->wizardDialog->setProjectName(QmlStandaloneAppWizardDialog::uniqueProjectName(defaultPath));
m_d->wizardDialog->m_qmlOptionsPage->setSymbianSvgIcon(m_d->standaloneApp->symbianSvgIcon());
m_d->wizardDialog->m_qmlOptionsPage->setMaemoPngIcon(m_d->standaloneApp->maemoPngIcon());
m_d->wizardDialog->m_qmlOptionsPage->setOrientation(m_d->standaloneApp->orientation());
m_d->wizardDialog->m_qmlOptionsPage->setNetworkEnabled(m_d->standaloneApp->networkEnabled());
m_d->wizardDialog->m_qmlOptionsPage->setLoadDummyData(m_d->standaloneApp->loadDummyData());
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>382</width>
<height>285</height>
<width>404</width>
<height>548</height>
</rect>
</property>
<property name="windowTitle">
......@@ -53,83 +53,171 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Symbian specific</string>
<widget class="QTabWidget" name="platformsTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="symbianAppIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Application Icon (.svg):</string>
</property>
<property name="buddy">
<cstring>symbianAppIconLoadToolButton</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="symbianTargetUid3Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Target UID3:</string>
</property>
<property name="buddy">
<cstring>symbianTargetUid3LineEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="symbianTargetUid3LineEdit"/>
</item>
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="symbianEnableNetworkChackBox">
<property name="text">
<string>Enable network access</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="symbianAppIconPreview">
<property name="minimumSize">
<size>
<width>45</width>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>45</width>
<height>45</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="symbianAppIconLoadToolButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Symbian specific</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="symbianAppIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Application Icon (.svg):</string>
</property>
<property name="buddy">
<cstring>symbianAppIconLoadToolButton</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="symbianAppIconPreview">
<property name="minimumSize">
<size>
<width>45</width>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>45</width>
<height>45</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="symbianAppIconLoadToolButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="symbianTargetUid3Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Target UID3:</string>
</property>
<property name="buddy">
<cstring>symbianTargetUid3LineEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="symbianTargetUid3LineEdit"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="symbianEnableNetworkChackBox">
<property name="text">
<string>Enable network access</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Maemo specific</string>
</attribute>
<widget class="QLabel" name="maemoAppIconLabel">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>155</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Application Icon (64x64):</string>
</property>
</widget>
<widget class="QToolButton" name="maemoPngIconButton">
<property name="geometry">
<rect>
<x>171</x>
<y>10</y>
<width>71</width>
<height>70</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</widget>
</widget>
</item>
<item>
......
......@@ -35,6 +35,7 @@
#include <QtGui/QDesktopServices>
#include <QtGui/QFileDialog>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
namespace Qt4ProjectManager {
namespace Internal {
......@@ -167,6 +168,7 @@ class QmlStandaloneAppWizardOptionsPagePrivate
{
Ui::QmlStandaloneAppWizardOptionPage ui;
QString symbianSvgIcon;
QString maemoPngIcon;
friend class QmlStandaloneAppWizardOptionsPage;
};
......@@ -179,6 +181,8 @@ QmlStandaloneAppWizardOptionsPage::QmlStandaloneAppWizardOptionsPage(QWidget *pa
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);
......@@ -226,6 +230,27 @@ void QmlStandaloneAppWizardOptionsPage::setSymbianSvgIcon(const QString &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();
......@@ -267,5 +292,14 @@ void QmlStandaloneAppWizardOptionsPage::openSymbianSvgIcon()
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
......@@ -79,6 +79,8 @@ public:
QmlStandaloneApp::Orientation orientation() const;
QString symbianSvgIcon() const;
void setSymbianSvgIcon(const QString &icon);
QString maemoPngIcon() const;
void setMaemoPngIcon(const QString &icon);
QString symbianUid() const;
void setLoadDummyData(bool loadIt);
bool loadDummyData() const;
......@@ -88,6 +90,7 @@ public:
private slots:
void openSymbianSvgIcon(); // Via file open dialog
void openMaemoPngIcon();
private:
class QmlStandaloneAppWizardOptionsPagePrivate *m_d;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment