Browse Source

Beginnings of icon copying

master
probonopd 8 years ago
parent
commit
b830f1f8cd
  1. 24
      linuxdeployqt/main.cpp

24
linuxdeployqt/main.cpp

@ -88,7 +88,7 @@ int main(int argc, char **argv)
desktopExecEntry = settings->value("Desktop Entry/Exec", "r").toString().split(' ').first().split('/').last().trimmed(); desktopExecEntry = settings->value("Desktop Entry/Exec", "r").toString().split(' ').first().split('/').last().trimmed();
qDebug() << "desktopExecEntry:" << desktopExecEntry; qDebug() << "desktopExecEntry:" << desktopExecEntry;
desktopFile = firstArgument; desktopFile = firstArgument;
desktopIconEntry = settings->value("Desktop Entry/Icon", "r").toString().split(' ').first().trimmed(); desktopIconEntry = settings->value("Desktop Entry/Icon", "r").toString().split(' ').first().split('.').first().trimmed();
qDebug() << "desktopIconEntry:" << desktopIconEntry; qDebug() << "desktopIconEntry:" << desktopIconEntry;
QString candidateBin = QDir::cleanPath(QFileInfo(firstArgument).absolutePath() + desktopExecEntry); // Not FHS-like QString candidateBin = QDir::cleanPath(QFileInfo(firstArgument).absolutePath() + desktopExecEntry); // Not FHS-like
@ -219,6 +219,28 @@ int main(int argc, char **argv)
} }
} }
/* To make an AppDir, we need to find the icon and copy it in place */
QStringList candidates;
QString iconToBeUsed = "";
if(desktopIconEntry != ""){
QDirIterator it3(appDirPath, QDirIterator::Subdirectories);
while (it3.hasNext()) {
it3.next();
if((it3.fileName().startsWith(desktopIconEntry)) && ((it3.fileName().endsWith(".png")) || (it3.fileName().endsWith(".svg")) || (it3.fileName().endsWith(".svgz")) || (it3.fileName().endsWith(".xpm")))){
candidates.append(it3.filePath());
}
}
qDebug() << "Found icons from desktop file:" << candidates;
if(candidates.length() == 1){
iconToBeUsed = candidates.at(0); // The only choice
}
/* Copy in place */
if(iconToBeUsed != ""){
/* Check if there is already an icon and only if there is not, copy it to the AppDir */
}
}
for (int i = 2; i < argc; ++i) { for (int i = 2; i < argc; ++i) {
QByteArray argument = QByteArray(argv[i]); QByteArray argument = QByteArray(argv[i]);
if (argument == QByteArray("-no-plugins")) { if (argument == QByteArray("-no-plugins")) {

Loading…
Cancel
Save