Skip to content

Commit

Permalink
Bundle icons using the Qt resource system.
Browse files Browse the repository at this point in the history
Simplify resource loading logic and enable reproducible builds.
Fixes keepassxreboot#2582
  • Loading branch information
phoerious authored and droidmonkey committed Mar 14, 2020
1 parent 4ff781f commit b045160
Show file tree
Hide file tree
Showing 56 changed files with 634 additions and 552 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ For **Qt-UI files** (*.ui*): 2 spaces

// Application includes
#include "core/Config.h"
#include "core/FilePath.h"
#include "core/Resources.h"

// Global includes
#include <QWidget>
Expand Down
11 changes: 2 additions & 9 deletions share/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ add_subdirectory(translations)
file(GLOB wordlists_files "wordlists/*.wordlist")
install(FILES ${wordlists_files} DESTINATION ${DATA_INSTALL_DIR}/wordlists)

file(GLOB DATABASE_ICONS icons/database/*.png)

install(FILES ${DATABASE_ICONS} DESTINATION ${DATA_INSTALL_DIR}/icons/database)

if(UNIX AND NOT APPLE AND NOT HAIKU)
install(DIRECTORY icons/application/ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor
FILES_MATCHING PATTERN "keepassx*.png" PATTERN "keepassx*.svg"
Expand All @@ -39,12 +35,9 @@ if(APPLE)
install(FILES macosx/keepassxc.icns DESTINATION ${DATA_INSTALL_DIR})
endif()

install(DIRECTORY docs/ DESTINATION ${DATA_INSTALL_DIR}/docs FILES_MATCHING PATTERN "*.pdf")
install(FILES icons/application/256x256/apps/keepassxc.png DESTINATION ${DATA_INSTALL_DIR}/icons/application/256x256/apps)

install(DIRECTORY wizard/ DESTINATION ${DATA_INSTALL_DIR}/wizard FILES_MATCHING PATTERN "*.png")

install(DIRECTORY icons/application/ DESTINATION ${DATA_INSTALL_DIR}/icons/application
FILES_MATCHING PATTERN "*.png" PATTERN "*.svg")
install(DIRECTORY docs/ DESTINATION ${DATA_INSTALL_DIR}/docs FILES_MATCHING PATTERN "*.pdf")

add_custom_target(icons
# SVG to PNGs for KeePassXC
Expand Down
45 changes: 45 additions & 0 deletions share/icons/application/index.theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[Icon Theme]
Name=application
Comment=KeePassXC Application Icon Theme

Directories=256x256/apps,scalable/actions,scalable/apps,scalable/categories,scalable/mimetypes,scalable/status

[scalable/actions]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=Actions

[scalable/apps]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=Applications

[scalable/categories]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=Categories

[scalable/mimetypes]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=MimeTypes

[scalable/status]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=Status

[256x256/apps]
Size=256
Type=Fixed
Context=Applications
93 changes: 1 addition & 92 deletions share/icons/application/scalable/apps/freedesktop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 152 additions & 0 deletions share/icons/icons.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/icons">
<file>application/index.theme</file>

<file>application/256x256/apps/keepassxc.png</file>

<file>application/scalable/actions/application-exit.svg</file>
<file>application/scalable/actions/auto-type.svg</file>
<file>application/scalable/actions/bugreport.svg</file>
<file>application/scalable/actions/chronometer.svg</file>
<file>application/scalable/actions/configure.svg</file>
<file>application/scalable/actions/database-change-key.svg</file>
<file>application/scalable/actions/database-lock.svg</file>
<file>application/scalable/actions/database-merge.svg</file>
<file>application/scalable/actions/dialog-close.svg</file>
<file>application/scalable/actions/dialog-ok.svg</file>
<file>application/scalable/actions/document-close.svg</file>
<file>application/scalable/actions/document-edit.svg</file>
<file>application/scalable/actions/document-new.svg</file>
<file>application/scalable/actions/document-open.svg</file>
<file>application/scalable/actions/document-properties.svg</file>
<file>application/scalable/actions/document-save.svg</file>
<file>application/scalable/actions/document-save-as.svg</file>
<file>application/scalable/actions/donate.svg</file>
<file>application/scalable/actions/edit-clear-locationbar-ltr.svg</file>
<file>application/scalable/actions/edit-clear-locationbar-rtl.svg</file>
<file>application/scalable/actions/entry-clone.svg</file>
<file>application/scalable/actions/entry-delete.svg</file>
<file>application/scalable/actions/entry-edit.svg</file>
<file>application/scalable/actions/entry-new.svg</file>
<file>application/scalable/actions/favicon-download.svg</file>
<file>application/scalable/actions/getting-started.svg</file>
<file>application/scalable/actions/group-delete.svg</file>
<file>application/scalable/actions/group-edit.svg</file>
<file>application/scalable/actions/group-empty-trash.svg</file>
<file>application/scalable/actions/group-new.svg</file>
<file>application/scalable/actions/health.svg</file>
<file>application/scalable/actions/help-about.svg</file>
<file>application/scalable/actions/key-enter.svg</file>
<file>application/scalable/actions/keyboard-shortcuts.svg</file>
<file>application/scalable/actions/message-close.svg</file>
<file>application/scalable/actions/object-locked.svg</file>
<file>application/scalable/actions/object-unlocked.svg</file>
<file>application/scalable/actions/paperclip.svg</file>
<file>application/scalable/actions/password-copy.svg</file>
<file>application/scalable/actions/password-generate.svg</file>
<file>application/scalable/actions/password-generator.svg</file>
<file>application/scalable/actions/password-show-off.svg</file>
<file>application/scalable/actions/password-show-on.svg</file>
<file>application/scalable/actions/sort-alphabetical-ascending.svg</file>
<file>application/scalable/actions/sort-alphabetical-descending.svg</file>
<file>application/scalable/actions/statistics.svg</file>
<file>application/scalable/actions/system-help.svg</file>
<file>application/scalable/actions/system-search.svg</file>
<file>application/scalable/actions/system-software-update.svg</file>
<file>application/scalable/actions/url-copy.svg</file>
<file>application/scalable/actions/user-guide.svg</file>
<file>application/scalable/actions/username-copy.svg</file>
<file>application/scalable/actions/view-history.svg</file>
<file>application/scalable/actions/web.svg</file>

<file>application/scalable/apps/freedesktop.svg</file>
<file>application/scalable/apps/internet-web-browser.svg</file>
<file>application/scalable/apps/keepassxc.svg</file>
<file>application/scalable/apps/keepassxc-dark.svg</file>
<file>application/scalable/apps/keepassxc-locked.svg</file>
<file>application/scalable/apps/keepassxc-unlocked.svg</file>
<file>application/scalable/apps/preferences-desktop-icons.svg</file>
<file>application/scalable/apps/preferences-system-network-sharing.svg</file>
<file>application/scalable/apps/utilities-terminal.svg</file>

<file>application/scalable/categories/preferences-other.svg</file>

<file>application/scalable/mimetypes/application-x-keepassxc.svg</file>

<file>application/scalable/status/dialog-error.svg</file>
<file>application/scalable/status/dialog-information.svg</file>
<file>application/scalable/status/dialog-warning.svg</file>
<file>application/scalable/status/security-high.svg</file>

<file>database/C00_Password.png</file>
<file>database/C01_Package_Network.png</file>
<file>database/C02_MessageBox_Warning.png</file>
<file>database/C03_Server.png</file>
<file>database/C04_Klipper.png</file>
<file>database/C05_Edu_Languages.png</file>
<file>database/C06_KCMDF.png</file>
<file>database/C07_Kate.png</file>
<file>database/C08_Socket.png</file>
<file>database/C09_Identity.png</file>
<file>database/C10_Kontact.png</file>
<file>database/C11_Camera.png</file>
<file>database/C12_IRKickFlash.png</file>
<file>database/C13_KGPG_Key3.png</file>
<file>database/C14_Laptop_Power.png</file>
<file>database/C15_Scanner.png</file>
<file>database/C16_Mozilla_Firebird.png</file>
<file>database/C17_CDROM_Unmount.png</file>
<file>database/C18_Display.png</file>
<file>database/C19_Mail_Generic.png</file>
<file>database/C20_Misc.png</file>
<file>database/C21_KOrganizer.png</file>
<file>database/C22_ASCII.png</file>
<file>database/C23_Icons.png</file>
<file>database/C24_Connect_Established.png</file>
<file>database/C25_Folder_Mail.png</file>
<file>database/C26_FileSave.png</file>
<file>database/C27_NFS_Unmount.png</file>
<file>database/C28_QuickTime.png</file>
<file>database/C29_KGPG_Term.png</file>
<file>database/C30_Konsole.png</file>
<file>database/C31_FilePrint.png</file>
<file>database/C32_FSView.png</file>
<file>database/C33_Run.png</file>
<file>database/C34_Configure.png</file>
<file>database/C35_KRFB.png</file>
<file>database/C36_Ark.png</file>
<file>database/C37_KPercentage.png</file>
<file>database/C38_Samba_Unmount.png</file>
<file>database/C39_History.png</file>
<file>database/C40_Mail_Find.png</file>
<file>database/C41_VectorGfx.png</file>
<file>database/C42_KCMMemory.png</file>
<file>database/C43_EditTrash.png</file>
<file>database/C44_KNotes.png</file>
<file>database/C45_Cancel.png</file>
<file>database/C46_Help.png</file>
<file>database/C47_KPackage.png</file>
<file>database/C48_Folder.png</file>
<file>database/C49_Folder_Blue_Open.png</file>
<file>database/C50_Folder_Tar.png</file>
<file>database/C51_Decrypted.png</file>
<file>database/C52_Encrypted.png</file>
<file>database/C53_Apply.png</file>
<file>database/C54_Signature.png</file>
<file>database/C55_Thumbnail.png</file>
<file>database/C56_KAddressBook.png</file>
<file>database/C57_View_Text.png</file>
<file>database/C58_KGPG.png</file>
<file>database/C59_Package_Development.png</file>
<file>database/C60_KFM_Home.png</file>
<file>database/C61_Services.png</file>
<file>database/C62_Tux.png</file>
<file>database/C63_Feather.png</file>
<file>database/C64_Apple.png</file>
<file>database/C65_W.png</file>
<file>database/C66_Money.png</file>
<file>database/C67_Certificate.png</file>
<file>database/C68_BlackBerry.png</file>
</qresource>
</RCC>
6 changes: 6 additions & 0 deletions share/wizard/wizard.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/wizard">
<file>background-pixmap.png</file>
</qresource>
</RCC>
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ set(keepassx_SOURCES
core/EntryAttachments.cpp
core/EntryAttributes.cpp
core/EntrySearcher.cpp
core/FilePath.cpp
core/FileWatcher.cpp
core/Group.cpp
core/HibpOffline.cpp
Expand All @@ -50,6 +49,7 @@ set(keepassx_SOURCES
core/PasswordGenerator.cpp
core/PasswordHealth.cpp
core/PassphraseGenerator.cpp
core/Resources.cpp
core/SignalMultiplexer.cpp
core/ScreenLockListener.cpp
core/ScreenLockListenerPrivate.cpp
Expand Down Expand Up @@ -210,6 +210,10 @@ if(MINGW OR (UNIX AND NOT APPLE))
core/OSEventFilter.cpp)
endif()

set(keepassx_SOURCES ${keepassx_SOURCES}
../share/icons/icons.qrc
../share/wizard/wizard.qrc)

set(keepassx_SOURCES_MAINEXE main.cpp)

add_feature_info(Auto-Type WITH_XC_AUTOTYPE "Automatic password typing")
Expand Down
4 changes: 2 additions & 2 deletions src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include "core/Config.h"
#include "core/Database.h"
#include "core/Entry.h"
#include "core/FilePath.h"
#include "core/Group.h"
#include "core/ListDeleter.h"
#include "core/Resources.h"
#include "core/Tools.h"
#include "gui/MessageBox.h"

Expand Down Expand Up @@ -63,7 +63,7 @@ AutoType::AutoType(QObject* parent, bool test)
pluginName += "test";
}

QString pluginPath = filePath()->pluginPath(pluginName);
QString pluginPath = resources()->pluginPath(pluginName);

if (!pluginPath.isEmpty()) {
#ifdef WITH_XC_AUTOTYPE
Expand Down
Loading

0 comments on commit b045160

Please sign in to comment.