Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,61 @@ PKG_CHECK_MODULES([libavcodec], [libavcodec])
PKG_CHECK_MODULES([libavformat], [libavformat])
PKG_CHECK_MODULES([libavutil], [libavutil])

PKG_CHECK_MODULES(
[QT6WIDGETS], [Qt6Widgets], [qt6_enabled="yes"],
[
PKG_CHECK_MODULES([QT5WIDGETS], [Qt5Widgets], [qt6_enabled="no"])
]
)

qt_host_bins="$( eval $PKG_CONFIG --variable=host_bins Qt5Core )"

PKG_CHECK_MODULES([QT5WIDGETS], [Qt5Widgets])
if test "x$qt6_enabled" = "xyes"; then
qt_host_bins="$( eval $PKG_CONFIG --variable=host_bins Qt6Core )"
else
qt_host_bins="$( eval $PKG_CONFIG --variable=host_bins Qt5Core )"
fi

AC_ARG_WITH(
[moc],
[AS_HELP_STRING([--with-moc], [Path of the Qt meta object compiler.])],
[AC_SUBST([MOC], [$with_moc])],
[
AC_PATH_PROGS([MOC], [moc-qt5 moc], [not_found], [$qt_host_bins])
if test "x$qt6_enabled" = "xyes"; then
AC_PATH_PROGS([MOC], [moc-qt6 moc], [not_found], [$qt_host_bins])
else
AC_PATH_PROGS([MOC], [moc-qt5 moc], [not_found], [$qt_host_bins])
fi
AS_IF(
[test "x$MOC" = "x$not_found"],
[AC_MSG_ERROR(["moc (Qt's meta object compiler) was not found."])]
)
]
)

AC_MSG_CHECKING([whether Qt is static])
if [ `$PKG_CONFIG --variable=qt_config Qt5Core | $GREP 'static' > /dev/null` ]; then
static_qt="yes"
if test "x$qt6_enabled" = "xyes"; then
AC_MSG_CHECKING([whether Qt is static])
if [ `$PKG_CONFIG --variable=qt_config Qt6Core | $GREP 'static' > /dev/null` ]; then
static_qt="yes"
else
static_qt="no"
fi
else
static_qt="no"
AC_MSG_CHECKING([whether Qt is static])
if [ `$PKG_CONFIG --variable=qt_config Qt5Core | $GREP 'static' > /dev/null` ]; then
static_qt="yes"
else
static_qt="no"
fi
fi
AC_MSG_RESULT([$static_qt])

AS_IF(
[test "x$static_qt" = "xyes"],
[
PKG_CHECK_MODULES([QT5PLATFORMSUPPORT], [Qt5PlatformSupport])
if test "x$qt6_enabled" = "xyes"; then
PKG_CHECK_MODULES([QT6PLATFORMSUPPORT], [Qt6PlatformSupport])
else
PKG_CHECK_MODULES([QT5PLATFORMSUPPORT], [Qt5PlatformSupport])
fi
AC_DEFINE([D2VWITCH_STATIC_QT])
]
)
Expand All @@ -70,7 +95,11 @@ AS_CASE(

AS_IF([test "x$static_qt" = "xyes"],
[
AC_SUBST([QT5PLATFORMPLUGIN], ["$qt_host_bins/../plugins/platforms/libqwindows.a"])
if test "x$qt6_enabled" = "xyes"; then
AC_SUBST([QT6PLATFORMPLUGIN], ["$qt_host_bins/../plugins/platforms/libqwindows.a"])
else
AC_SUBST([QT5PLATFORMPLUGIN], ["$qt_host_bins/../plugins/platforms/libqwindows.a"])
fi
]
)
]
Expand Down
31 changes: 23 additions & 8 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
project('d2vwitch', 'cpp',
version: '5',
default_options: ['cpp_std=c++11', 'buildtype=release'],
default_options: ['buildtype=release'],
meson_version: '>=0.46')

qt5 = import('qt5')
dep_qt6 = dependency('qt6', modules: ['Core', 'Gui', 'Widgets'], required: false)
if dep_qt6.found()
if meson.version().version_compare('>= 0.57')
qt = import('qt6')
dep_qt = dep_qt6
dep_qt_options = ['cpp_std=c++17']
dep_qt_args = ['-std=c++17', '-DUSE_QT6']
else
error('Qt 6 is only supported since Meson 0.57.')
endif
else
qt = import('qt5')
dep_qt = dependency('qt5', modules: ['Core', 'Gui', 'Widgets'], required : true)
dep_qt_options = ['cpp_std=c++11']
dep_qt_args = ['-std=c++11']
endif

deps = [
dependency('vapoursynth').partial_dependency(includes: true, compile_args: true),
dependency('libavcodec'),
dependency('libavformat'),
dependency('libavutil'),
dependency('qt5', modules: ['Core', 'Gui', 'Widgets'])
]

moc_headers = [
Expand All @@ -19,7 +33,7 @@ moc_headers = [
'src/ScrollArea.h'
]

processed_files = qt5.preprocess(moc_headers: moc_headers)
processed_files = qt.preprocess(moc_headers: moc_headers)

sources = [
'src/Audio.cpp',
Expand All @@ -44,7 +58,6 @@ sources = [
processed_files
]


warnings = [
'-Wall',
'-Wextra',
Expand All @@ -58,7 +71,9 @@ cpp_args = [

executable('d2vwitch',
sources: sources,
dependencies: deps,
dependencies: [deps, dep_qt],
gui_app: true,
cpp_args: cpp_args,
install: true)
cpp_args: [cpp_args, dep_qt_args],
override_options: dep_qt_options,
install: true
)
4 changes: 4 additions & 0 deletions src/D2VWitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,11 @@ int main(int argc, char **_argv) {

if (index > -1) {
for (int i = index + 1; i < entries.size(); i++) {
#ifdef USE_QT6
if (entries[i].mid(4, 2) == name.mid(4, 2))
#else
if (entries[i].midRef(4, 2) == name.midRef(4, 2))
#endif
fake_file.push_back(input_dir.absoluteFilePath(entries[i]).toStdString());
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/GUIWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,11 @@ GUIWindow::GUIWindow(QSettings &_settings, QWidget *parent)
d2v_edit->setText(file_name);
});

#ifdef USE_QT6
connect(video_group, static_cast<void (QButtonGroup::*)(int, bool)>(&QButtonGroup::idToggled), [this] (int id, bool checked) {
#else
connect(video_group, static_cast<void (QButtonGroup::*)(int, bool)>(&QButtonGroup::buttonToggled), [this] (int id, bool checked) {
#endif
// "int id" is the QButtonGroup id, not AVStream::id

if (checked) {
Expand Down