Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
36cd30e0
Commit
36cd30e0
authored
14 years ago
by
Christian Kandeler
Browse files
Options
Downloads
Patches
Plain Diff
Mobile wizards: Scale Maemo icon if necessary and approved by user.
parent
7bb57d37
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp
+30
-8
30 additions, 8 deletions
...lugins/qt4projectmanager/wizards/mobileappwizardpages.cpp
with
30 additions
and
8 deletions
src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp
+
30
−
8
View file @
36cd30e0
...
...
@@ -33,6 +33,7 @@
#include
"ui_mobileappwizardsymbianoptionspage.h"
#include
<coreplugin/coreconstants.h>
#include
<QtCore/QTemporaryFile>
#include
<QtGui/QDesktopServices>
#include
<QtGui/QFileDialog>
#include
<QtGui/QFileDialog>
...
...
@@ -183,16 +184,37 @@ void MobileAppWizardMaemoOptionsPage::setPngIcon(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
);
if
(
iconPixmap
.
isNull
())
{
QMessageBox
::
critical
(
this
,
tr
(
"Invalid Icon"
),
tr
(
"The file is not a valid image."
));
return
;
}
const
QSize
iconSize
(
64
,
64
);
QString
actualIconPath
;
if
(
iconPixmap
.
size
()
==
iconSize
)
{
actualIconPath
=
icon
;
}
else
{
m_d
->
ui
.
pngIconButton
->
setIcon
(
iconPixmap
);
m_d
->
pngIcon
=
icon
;
const
QMessageBox
::
StandardButton
button
=
QMessageBox
::
warning
(
this
,
tr
(
"Wrong Icon Size"
),
tr
(
"The icon needs to be 64x64 pixels big, "
"but is not. Do you want Creator to scale it?"
),
QMessageBox
::
Ok
|
QMessageBox
::
Cancel
);
if
(
button
!=
QMessageBox
::
Ok
)
return
;
iconPixmap
=
iconPixmap
.
scaled
(
iconSize
);
QTemporaryFile
tmpFile
;
tmpFile
.
setAutoRemove
(
false
);
const
char
*
const
format
=
QFileInfo
(
icon
).
suffix
().
toAscii
().
data
();
if
(
!
tmpFile
.
open
()
||
!
iconPixmap
.
save
(
&
tmpFile
,
format
))
{
QMessageBox
::
critical
(
this
,
tr
(
"File Error"
),
tr
(
"Could not copy icon file."
));
return
;
}
actualIconPath
=
tmpFile
.
fileName
();
}
m_d
->
ui
.
pngIconButton
->
setIcon
(
iconPixmap
);
m_d
->
pngIcon
=
actualIconPath
;
}
void
MobileAppWizardMaemoOptionsPage
::
openPngIcon
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment