Skip to content

Commit

Permalink
Merge pull request #660 from QuasarApp/task_659
Browse files Browse the repository at this point in the history
Fix deploy icons
  • Loading branch information
EndrII authored Sep 14, 2021
2 parents 3895d40 + 8d6c660 commit bf81c10
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Deploy/Distributions/Templates/deb/DEBIAN/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

}
Expand All @@ -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");
Expand Down
14 changes: 8 additions & 6 deletions Deploy/Distributions/idistribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -162,7 +161,7 @@ bool iDistribution::collectInfoWithDeployIcons(const DistroModule &pkg,
return false;
}

return deployIcon(info, pkg);
return deployIcon(pkg);

}

Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion Deploy/Distributions/idistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class DEPLOYSHARED_EXPORT iDistribution
* @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.
Expand Down
1 change: 0 additions & 1 deletion Deploy/Distributions/templateinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct DEPLOYSHARED_EXPORT TemplateInfo
QString Description;
QString Version;
QString ReleaseData;
QString Icon;
QString Publisher;
QString Homepage;
QString Prefix;
Expand Down
4 changes: 2 additions & 2 deletions Deploy/configparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
1 change: 0 additions & 1 deletion UnitTests/tst_deploytest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,6 @@ void deploytest::testIcons() {


delete deploy;

}

void deploytest::testPathUtils() {
Expand Down
2 changes: 1 addition & 1 deletion md/en/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)|
Expand Down
2 changes: 1 addition & 1 deletion md/ru/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)|
Expand Down

0 comments on commit bf81c10

Please sign in to comment.