qmake: Add application icon support for windows
A new qmake's variable RC_ICONS is introduced to specify the icons. The first one will be used as the application's icon. Change-Id: I4218db795837d470087dff8526eb0e4cb81ce5ed Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
ef838063b1
commit
ad3536b7ad
@ -366,16 +366,6 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
|
||||
|
||||
}
|
||||
|
||||
static QString cQuoted(const QString &str)
|
||||
{
|
||||
QString ret = str;
|
||||
ret.replace(QLatin1Char('"'), QStringLiteral("\\\""));
|
||||
ret.replace(QLatin1Char('\\'), QStringLiteral("\\\\"));
|
||||
ret.prepend(QLatin1Char('"'));
|
||||
ret.append(QLatin1Char('"'));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
||||
{
|
||||
const ProString templateName = project->first("TEMPLATE");
|
||||
|
@ -382,7 +382,7 @@ void Win32MakefileGenerator::processRcFileVar()
|
||||
if (Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING)
|
||||
return;
|
||||
|
||||
if (((!project->values("VERSION").isEmpty())
|
||||
if (((!project->values("VERSION").isEmpty() || !project->values("RC_ICONS").isEmpty())
|
||||
&& project->values("RC_FILE").isEmpty()
|
||||
&& project->values("RES_FILE").isEmpty()
|
||||
&& !project->isActiveConfig("no_generated_target_info")
|
||||
@ -397,6 +397,10 @@ void Win32MakefileGenerator::processRcFileVar()
|
||||
vers += "0";
|
||||
QString versionString = vers.join('.');
|
||||
|
||||
QStringList rcIcons;
|
||||
foreach (const ProString &icon, project->values("RC_ICONS"))
|
||||
rcIcons.append(fileFixify(icon.toQString(), FileFixifyAbsolute));
|
||||
|
||||
QString companyName;
|
||||
if (!project->values("QMAKE_TARGET_COMPANY").isEmpty())
|
||||
companyName = project->values("QMAKE_TARGET_COMPANY").join(' ');
|
||||
@ -425,6 +429,11 @@ void Win32MakefileGenerator::processRcFileVar()
|
||||
ts << "# include <winver.h>" << endl;
|
||||
ts << "# endif" << endl;
|
||||
ts << endl;
|
||||
if (!rcIcons.isEmpty()) {
|
||||
for (int i = 0; i < rcIcons.size(); ++i)
|
||||
ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << endl;
|
||||
ts << endl;
|
||||
}
|
||||
ts << "VS_VERSION_INFO VERSIONINFO" << endl;
|
||||
ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl;
|
||||
ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl;
|
||||
@ -902,4 +911,14 @@ QString Win32MakefileGenerator::escapeFilePath(const QString &path) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString Win32MakefileGenerator::cQuoted(const QString &str)
|
||||
{
|
||||
QString ret = str;
|
||||
ret.replace(QLatin1Char('"'), QStringLiteral("\\\""));
|
||||
ret.replace(QLatin1Char('\\'), QStringLiteral("\\\\"));
|
||||
ret.prepend(QLatin1Char('"'));
|
||||
ret.append(QLatin1Char('"'));
|
||||
return ret;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -73,6 +73,7 @@ protected:
|
||||
void fixTargetExt();
|
||||
void processRcFileVar();
|
||||
virtual QString getLibTarget();
|
||||
static QString cQuoted(const QString &str);
|
||||
};
|
||||
|
||||
inline Win32MakefileGenerator::~Win32MakefileGenerator()
|
||||
|
Loading…
Reference in New Issue
Block a user