Skip to content

Commit

Permalink
mac changes #89
Browse files Browse the repository at this point in the history
Note: submodule is needed for icon support!
  • Loading branch information
rodlie committed Jan 14, 2019
1 parent 20f4808 commit 17a0618
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 98 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "fm/bundle"]
path = fm/bundle
url = https://github.com/rodlie/adwaita-bundle
1 change: 1 addition & 0 deletions fm/bundle
Submodule bundle added at 401508
103 changes: 29 additions & 74 deletions fm/fm.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CONFIG(basic) {
CONFIG += no_udisks no_tray no_dbus
}

macx: DEFINES += NO_DBUS NO_UDISKS

TARGET = $${QTFM_TARGET}
TARGET_NAME = $${QTFM_TARGET_NAME}
VERSION = $${QTFM_MAJOR}.$${QTFM_MINOR}.$${QTFM_PATCH}
Expand All @@ -15,16 +17,6 @@ DEPENDPATH += . src
INCLUDEPATH += . src ../libfm
LIBS += -L../libfm -lQtFM

macx {
CONFIG += no_udisks no_dbus no_tray

# MacPorts
exists( /opt/local/include ) {
INCLUDEPATH += /opt/local/include
LIBS += -L/opt/local/lib -linotify
}
}

HEADERS += src/mainwindow.h \
src/mymodel.h \
src/bookmarkmodel.h \
Expand Down Expand Up @@ -53,80 +45,43 @@ SOURCES += src/main.cpp \

OTHER_FILES += $${TARGET}.desktop
RESOURCES += ../$${TARGET}.qrc
macx: exists(bundle/adwaita.qrc): RESOURCES += bundle/adwaita.qrc

DEFINES += APP=\"\\\"$${TARGET}\\\"\"
DEFINES += APP_NAME=\"\\\"$${TARGET_NAME}\\\"\"
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"

isEmpty(PREFIX) {
PREFIX = /usr/local
}
isEmpty(DOCDIR) {
DOCDIR = $$PREFIX/share/doc
}

target.path = $${PREFIX}/bin
desktop.files += $${TARGET}.desktop
desktop.path += $${PREFIX}/share/applications
docs.path += $${DOCDIR}/$${TARGET}-$${VERSION}
docs.files += ../LICENSE ../README.md ../AUTHORS ../ChangeLog
man.files += qtfm.1
man.path += $${MANDIR}/man1
INSTALLS += target desktop docs man

icon128.files = hicolor/128x128/apps/qtfm.png
icon128.path = $${PREFIX}/share/icons/hicolor/128x128/apps
icon160.files = hicolor/160x160/apps/qtfm.png
icon160.path = $${PREFIX}/share/icons/hicolor/160x160/apps
icon16.files = hicolor/16x16/apps/qtfm.png
icon16.path = $${PREFIX}/share/icons/hicolor/16x16/apps
icon192.files = hicolor/192x192/apps/qtfm.png
icon192.path = $${PREFIX}/share/icons/hicolor/192x192/apps
icon20.files = hicolor/20x20/apps/qtfm.png
icon20.path = $${PREFIX}/share/icons/hicolor/20x20/apps
icon22.files = hicolor/22x22/apps/qtfm.png
icon22.path = $${PREFIX}/share/icons/hicolor/22x22/apps
icon24.files = hicolor/24x24/apps/qtfm.png
icon24.path = $${PREFIX}/share/icons/hicolor/24x24/apps
icon256.files = hicolor/256x256/apps/qtfm.png
icon256.path = $${PREFIX}/share/icons/hicolor/256x256/apps
icon32.files = hicolor/32x32/apps/qtfm.png
icon32.path = $${PREFIX}/share/icons/hicolor/32x32/apps
icon36.files = hicolor/36x36/apps/qtfm.png
icon36.path = $${PREFIX}/share/icons/hicolor/36x36/apps
icon48.files = hicolor/48x48/apps/qtfm.png
icon48.path = $${PREFIX}/share/icons/hicolor/48x48/apps
icon512.files = hicolor/512x512/apps/qtfm.png
icon512.path = $${PREFIX}/share/icons/hicolor/512x512/apps
icon64.files = hicolor/64x64/apps/qtfm.png
icon64.path = $${PREFIX}/share/icons/hicolor/64x64/apps
icon72.files = hicolor/72x72/apps/qtfm.png
icon72.path = $${PREFIX}/share/icons/hicolor/72x72/apps
icon96.files = hicolor/96x96/apps/qtfm.png
icon96.path = $${PREFIX}/share/icons/hicolor/96x96/apps
iconSVG.files = hicolor/scalable/apps/qtfm.svg
iconSVG.path = $${PREFIX}/share/icons/hicolor/scalable/apps
unix:!macx {
target.path = $${PREFIX}/bin
desktop.files += $${TARGET}.desktop
desktop.path += $${PREFIX}/share/applications
docs.path += $${DOCDIR}/$${TARGET}-$${VERSION}
docs.files += ../LICENSE ../README.md ../AUTHORS ../ChangeLog
man.files += qtfm.1
man.path += $${MANDIR}/man1
INSTALLS += target desktop docs man

INSTALLS += icon128 icon160 icon16 icon192 icon20 icon22 \
icon24 icon256 icon32 icon36 icon48 icon512 icon64 \
icon72 icon96 iconSVG
hicolor.files = hicolor
hicolor.path = $${PREFIX}/share/icons
INSTALLS += hicolor

!CONFIG(no_udisks|no_dbus) {
exists(../libdisks/libdisks.pro) {
INCLUDEPATH += ../libdisks
LIBS += -L../libdisks -lDisks
} else {
CONFIG += link_pkgconfig
PKGCONFIG += Disks
!CONFIG(no_udisks|no_dbus) {
exists(../libdisks/libdisks.pro) {
INCLUDEPATH += ../libdisks
LIBS += -L../libdisks -lDisks
} else {
CONFIG += link_pkgconfig
PKGCONFIG += Disks
}
}
CONFIG(no_udisks): DEFINES += NO_UDISKS
CONFIG(no_dbus) {
DEFINES += NO_DBUS
DEFINES += NO_UDISKS
}
!CONFIG(no_dbus) : QT += dbus
}

lessThan(QT_MAJOR_VERSION, 5): LIBS += -lmagic
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
CONFIG(deploy) : DEFINES += DEPLOY
CONFIG(no_udisks): DEFINES += NO_UDISKS
CONFIG(no_dbus) {
DEFINES += NO_DBUS
DEFINES += NO_UDISKS
}
!CONFIG(no_dbus) : QT += dbus
4 changes: 4 additions & 0 deletions fm/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ MainWindow::MainWindow()
#endif

// set icon theme
#ifdef Q_OS_MAC
QIcon::setThemeName("Adwaita");
#else
Common::setupIconTheme(qApp->applicationFilePath());
#endif

// Create mime utils
mimeUtils = new MimeUtils(this);
Expand Down
7 changes: 7 additions & 0 deletions fm/src/mymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,14 @@ QVariant myModel::findIcon(myModelItem *item) const {
if (folderIcons->contains(type.fileName())) {
return folderIcons->value(type.fileName());
}
#ifdef Q_OS_MAC
if (type.fileName().endsWith(".app")) {
return iconFactory->icon(type);
}
return QIcon::fromTheme("folder", iconFactory->icon(type));
#else
return iconFactory->icon(type);
#endif
}

// If thumbnails are allowed and current file has it, show it
Expand Down
27 changes: 14 additions & 13 deletions qtfm.pri
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@ QTFM_MAJOR = 6
QTFM_MINOR = 1
QTFM_PATCH = 6

isEmpty(PREFIX) {
PREFIX = /usr/local
isEmpty(XDGDIR) {
XDGDIR = $${PREFIX}/etc/xdg
unix:!macx {
isEmpty(PREFIX) {
PREFIX = /usr/local
isEmpty(XDGDIR) {
XDGDIR = $${PREFIX}/etc/xdg
}
}
isEmpty(DOCDIR): DOCDIR = $$PREFIX/share/doc
isEmpty(MANDIR): MANDIR = $$PREFIX/share/man
isEmpty(XDGDIR): XDGDIR = /etc/xdg
}
isEmpty(DOCDIR) {
DOCDIR = $$PREFIX/share/doc
}
isEmpty(MANDIR) {
MANDIR = $$PREFIX/share/man
}
isEmpty(XDGDIR) {
XDGDIR = /etc/xdg
}

CONFIG += staticlib
CONFIG -= install_lib

macx {
QTFM_TARGET = QtFM
LIBS += -framework CoreFoundation -framework CoreServices
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += libinotify
}

CONFIG(release, debug|release): DEFINES += QT_NO_DEBUG_OUTPUT
Expand Down
24 changes: 13 additions & 11 deletions qtfm.pro
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
TEMPLATE = subdirs
CONFIG -= ordered
SUBDIRS += libfm libdisks fm
SUBDIRS += libfm fm
fm.depends += libfm

CONFIG(basic) {
CONFIG += no_udisks no_tray
unix:!macx {
SUBDIRS += libdisks
CONFIG(basic) {
CONFIG += no_udisks no_tray no_dbus
}
!CONFIG(no_udisks) {
fm.depends += libdisks
}
!CONFIG(no_tray) {
SUBDIRS += tray
tray.depends += libdisks libfm
}
}
!CONFIG(no_udisks) {
fm.depends += libdisks
}
!CONFIG(no_tray) {
SUBDIRS += tray
tray.depends += libdisks libfm
}

lessThan(QT_MAJOR_VERSION, 5): warning("Qt4 is deprecated, please consider upgrading to Qt5 if possible.")

0 comments on commit 17a0618

Please sign in to comment.