Skip to content

Commit

Permalink
Look for docset icons in various places.
Browse files Browse the repository at this point in the history
  • Loading branch information
k3rni committed Oct 4, 2014
1 parent b9fb24b commit f28f696
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 13 additions & 0 deletions zeal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <QApplication>
#include <QLocalSocket>
#include <QProxyStyle>
#include <QStandardPaths>

#include <string>
#include <iostream>
Expand Down Expand Up @@ -82,6 +83,18 @@ int main(int argc, char *argv[])
return -1; // Exit already a process running
}

// look for icons in:
// 1. user's data directory (same as docsets dir, but in icons/)
// 2. executable directory/icons
// 3. on unix, standard/legacy install location
// 4. current directory/icons
QDir::setSearchPaths("icons", QStandardPaths::locateAll(QStandardPaths::DataLocation, "icons", QStandardPaths::LocateDirectory));
QDir::addSearchPath("icons", QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("icons"));
#ifndef WIN32
QDir::addSearchPath("icons", "/usr/share/pixmaps/zeal");
#endif
QDir::addSearchPath("icons", "./icons");

MainWindow w;

if (!w.startHidden())
Expand Down
8 changes: 1 addition & 7 deletions zeal/zealsettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,7 @@ void ZealSettingsDialog::downloadDocsetList()
auto url_list = url.split("/");
auto iconfile = url_list[url_list.count()-1].replace(".tgz", ".png");
iconfile = iconfile.replace(".tar.bz2", ".png");
#ifdef WIN32
QDir icondir(QCoreApplication::applicationDirPath());
icondir.cd("icons");
#else
QDir icondir("/usr/share/pixmaps/zeal");
#endif
auto *lwi = new QListWidgetItem(QIcon(icondir.filePath(iconfile)), name);
auto *lwi = new QListWidgetItem(QIcon(QString("icons:") + iconfile), name);
lwi->setCheckState(Qt::Unchecked);

if(docsets->names().contains(name)){
Expand Down

0 comments on commit f28f696

Please sign in to comment.