Merge pull request #660 from QuasarApp/task_659

Fix deploy icons
This commit is contained in:
Andrei Yankovich 2021-09-14 10:25:15 +03:00 committed by GitHub
commit bf81c108c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 16 additions and 16 deletions

View File

@ -21,7 +21,7 @@ function createShortCut {
echo "Encoding=UTF-8" >> $DEST_FILE
echo "Name=$DEST_NAME" >> $DEST_FILE
echo "Type=Application" >> $DEST_FILE
echo "Icon=$CQT_INSTALL_DEB_DIR/$ICON" >> $DEST_FILE
echo "Icon=$CQT_INSTALL_DEB_DIR/icons/${SRC_FILE%%.*}.png" >> $DEST_FILE
echo "Terminal=false" >> $DEST_FILE
echo "Exec=$SRC_FILE" >> $DEST_FILE

View File

@ -21,7 +21,7 @@ function generateShortCutCmd(cmd) {
"CreateShortcut",
"@TargetDir@/" + prefix + "/" + cmd,
"@DesktopDir@/" + getBasename(cmd) + ".lnk",
"iconPath=@TargetDir@/$ICON",
"iconPath=@TargetDir@/" + prefix + "/icons/" + getBasename(cmd) + ".ico",
"iconId=0");
}
@ -36,7 +36,7 @@ function generateShortCutCmd(cmd) {
Terminal=false\n
Exec=\"@TargetDir@/" + prefix + "/" + cmd + "\"\n
Name=" + getBasename(cmd) + "\n
Icon=@TargetDir@/$ICON\n
Icon=@TargetDir@/" + prefix + "/icons/" + getBasename(cmd) + ".png\n
Name[en_US]=" + getBasename(cmd));
console.log("create icons!!! on LINUX done");

View File

@ -70,7 +70,6 @@ bool iDistribution::unpackFile(const QFileInfo &resource,
inputText.replace("$DESCRIPTION", info.Description);
inputText.replace("$VERSION", info.Version);
inputText.replace("$RELEASEDATA", info.ReleaseData);
inputText.replace("$ICON", info.Icon);
inputText.replace("$PUBLISHER", info.Publisher);
inputText.replace("$HOMEPAGE", info.Homepage);
inputText.replace("$PREFIX", info.Prefix);
@ -162,7 +161,7 @@ bool iDistribution::collectInfoWithDeployIcons(const DistroModule &pkg,
return false;
}
return deployIcon(info, pkg);
return deployIcon(pkg);
}
@ -272,11 +271,10 @@ QString iDistribution::getName(const DistroModule& pkg) const {
return name;
}
bool iDistribution::deployIcon(TemplateInfo &info, const DistroModule& pkg) {
bool iDistribution::deployIcon(const DistroModule& pkg) {
auto localData = dataLocation(pkg);
const DeployConfig *cfg = DeployCore::_config;
info.Icon = "icons/Icon.png";
QSet<QString> icons;
for (const auto& target: pkg.targets()) {
auto targetObject = cfg->targets().value(target);
@ -298,14 +296,18 @@ bool iDistribution::deployIcon(TemplateInfo &info, const DistroModule& pkg) {
break;
QFileInfo iconInfo(icon);
info.Icon = releativeLocation(pkg) + "/icons/" + iconInfo.fileName();
if (!copyFile(icon, localData + "/icons/", false)) {
QFileInfo runScript(targetObject.getRunScriptFile());
QString dist = localData + "/icons/" + runScript.baseName() + "." + iconInfo.suffix();
if (!copyFile(icon, dist, true)) {
QuasarAppUtils::Params::log(QString("Failed to copy icon: %0.").arg(icon),
QuasarAppUtils::Error);
return false;
}
icons += icon;
}

View File

@ -105,7 +105,7 @@ protected:
* @param pkg This is package info
* @return true if this method finished successful.
*/
bool deployIcon(TemplateInfo &info, const DistroModule &pkg);
bool deployIcon(const DistroModule &pkg);
/**
* @brief dataLocation This method should be retrun location of application or package files.

View File

@ -14,7 +14,6 @@ struct DEPLOYSHARED_EXPORT TemplateInfo
QString Description;
QString Version;
QString ReleaseData;
QString Icon;
QString Publisher;
QString Homepage;
QString Prefix;

View File

@ -71,8 +71,8 @@ void parseTargetPrivate(DeployConfig& conf,
auto &cointainer = conf.targetsEdit();
for (const auto &iconPair: inputParams) {
auto pair = iconPair.split(DeployCore::getSeparator(1), splitbehavior);
for (const auto &targetPair: inputParams) {
auto pair = targetPair.split(DeployCore::getSeparator(1), splitbehavior);
if (pair.size() == 1) {
QuasarAppUtils::Params::log(QString("Set new default property for all tagets: " + pair.value(0)),

View File

@ -1315,7 +1315,6 @@ void deploytest::testIcons() {
delete deploy;
}
void deploytest::testPathUtils() {

View File

@ -129,7 +129,7 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -icon [target;val,val] | Sets path to icon for a targets |
| -icon [target;val,val] | Sets path to icon for a targets. This option support only png (Linux) and ico (Windows) files. |
| -disableRunScript [target,target2,target3] | Disables the generation of run script for selected targets|
| -disableShortCut [target,target2,target3] | Disables the generation of shortcut for selected targets |
| -runScript [target;val,val] | forces cqtdeployer swap default run script to new from the arguments of option. This option copy all content from input file and insert all code into runScript.sh or .bat. Example of use: cqtdeployer -runScript "myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh" For get more information about customScript see the documentation [page](CustomScripts.md)|

View File

@ -125,7 +125,7 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -icon [target;val,val] | Установит путь к иконке или логотипу для целе |
| -icon [target;val,val] | Установит путь к иконке или логотипу для целе. Эта комманда поддерживает только png файлы для Linux и ico файлы для Windows |
| -disableRunScript [target; val, val]| Отключает создание сценария выполнения для выбранных целей |
| -disableShortCut [target; val, val] | Отключает создание ярлыков для выбранных целей |
| -runScript [target; val, val] | заставляет cqtdeployer заменить сценарий запуска по умолчанию на новый из аргументов параметра. Эта опция копирует все содержимое из входного файла и вставляет весь код в runScript.sh или .bat. Пример использования: cqtdeployer -runScript "myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh". Для получения дополнительной информации смотрите статью [Кастомные скрипты](CustomScripts.md)|