Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt5 based implementation #28

Closed
wants to merge 1 commit into from
Closed

Conversation

mgerhardy
Copy link

note: this is not integrated into the build - I have no idea of premake in combination with qt
but I still hope it can serve as a reference

I tried to match your coding style - if something isn't how you wanna it to be, please let me know.

@mgerhardy
Copy link
Author

just for reference (as no premake is there) - here is the cmake build script that i'm using.

set(LIB nativefiledialog)
set(SRCS nfd_common.c nfd.h)

set(EXTRA_INCLUDE_DIRS)
set(EXTRA_LIBRARIES)

if (APPLE)
    set(SRCS ${SRCS} nfd_cocoa.mm)
    set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} AppKit)
endif()

if (MSVC)
    set(SRCS ${SRCS} nfd_win.cpp)
endif()

set(QT FALSE)
if (LINUX)
    find_package(Qt5Widgets)
    if (${Qt5Widgets_FOUND})
        set(SRCS ${SRCS} nfd_qt.cpp)
        set(QT TRUE)
    else()
        pkg_check_modules(GTK3 gtk+-3.0)
        if (GTK3_FOUND)
            link_directories(${GTK3_LIBRARY_DIRS})
            add_definitions(${GTK3_CFLAGS_OTHER})
            set(SRCS ${SRCS} nfd_gtk.c)
            set(EXTRA_INCLUDE_DIRS "${EXTRA_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS}")
            set(EXTRA_LIBRARIES "${EXTRA_LIBRARIES} ${GTK3_LIBRARIES}")
        else()
            find_program(ZENITY zenity)
            if(ZENITY)
                set(SRCS ${SRCS} nfd_zenity.c)
            else()
                message(FATAL "Could not find any working dialog")
            endif()
        endif()
    endif()
endif()

add_library(${LIB} ${SRCS})

if (QT)
    qt5_use_modules(${LIB} Widgets)
endif()

if (EXTRA_INCLUDE_DIRS)
    target_include_directories(${LIB} PRIVATE ${EXTRA_INCLUDE_DIRS})
endif()
if (EXTRA_LIBRARIES)
    target_link_libraries(${LIB} ${EXTRA_LIBRARIES})
endif()

@mgerhardy mgerhardy force-pushed the master branch 3 times, most recently from 0e0cf45 to 5c32c48 Compare November 3, 2016 14:15
note: this is not integrated into the build - I have no idea of premake in combination with qt
but I still hope it can serve as a reference
{
const QString& entry = selectedFiles.at( 0 );
const size_t len = entry.size();
const QByteArray& ba = entry.toLatin1();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong, the output should be utf8

@mlabbe
Copy link
Owner

mlabbe commented Nov 12, 2017

I see the primary benefit of NFD being avoiding large libraries like QT. If you are linking QT, why would you want NFD?

@mgerhardy
Copy link
Author

There is also gtk; )
And it just allows me to us the lib on different desktop environments with native support for the directory picker.

@mlabbe
Copy link
Owner

mlabbe commented Nov 12, 2017

Unfortunately, Qt's Cmake is incompatible with our build system. I will not be maintaining Cmake or incorporating it into NFD. Pre-generating build scripts with Premake as we do is far better for our users.

I have no idea how to maintainably support Qt via Premake and I find the rationale for Qt's existence in NFD at all circumspect, as one of the main goals is to allow library users to avoid linking Qt or Wx. There is also a question of license compatibility which I am not even going to render an opinion on at this point.

I am going to pass on this PR. Thanks for giving it a shot and paying attention to NFD though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants