From a89be5dd9b5c52bb674a8dae54621e8669b5d1f8 Mon Sep 17 00:00:00 2001 From: Thomas Frauendorfer Date: Fri, 4 Jul 2008 00:40:56 +0200 Subject: [PATCH] Other: change how pkg-config includes are handeles Wrote some own functions to hande pkg-config includes. now Makefile generation will stop if xmms2-client-cpp.pc is missing Now, compilation should work, even if xmms2-client-cpp development files where installed after qmake das called for the first time. also enabled adding files in the playlistview contextmenu --- features/pkgconfig.prf | 24 ++++++++++++++++++++++++ lib/lib.pro | 10 ++++++++-- src/playlist/playlistview.cpp | 3 ++- src/src.pro | 11 +++++++++-- 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 features/pkgconfig.prf diff --git a/features/pkgconfig.prf b/features/pkgconfig.prf new file mode 100644 index 0000000..3070d5d --- /dev/null +++ b/features/pkgconfig.prf @@ -0,0 +1,24 @@ +defineTest(pkgconfig_exists) { + packages = $$1 + count(packages, 0): return(false) + + system(pkg-config --exists $$packages) { + return(true) + } else { + return (false) + } +} + +defineReplace(pkgconfig_cflags) { + packages = $$1 + count(packages, 0): return(false) + + return ($$system(pkg-config --cflags $$packages)) +} + +defineReplace(pkgconfig_libs) { + packages = $$1 + count(packages, 0): return(false) + + return ($$system(pkg-config --libs $$packages)) +} diff --git a/lib/lib.pro b/lib/lib.pro index 2a71ea7..2581351 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -1,6 +1,7 @@ TEMPLATE = lib CONFIG += static include (../config.pri) +load (../features/pkgconfig.prf) MOC_DIR = .moc OBJECTS_DIR = .obj @@ -39,7 +40,12 @@ QMAKE_CXXFLAGS += -g ;CONFIG += debug warn_on QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -CONFIG += link_pkgconfig -PKGCONFIG += xmms2-client-cpp xmms2-client +XMMSCLIENTPKG += xmms2-client-cpp +pkgconfig_exists ($$XMMSCLIENTPKG) { + QMAKE_CXXFLAGS += $$pkgconfig_cflags($$XMMSCLIENTPKG) + LIBS += $$pkgconfig_libs($$XMMSCLIENTPKG) +} else { + error (Please install the xmms2 c++ client library) +} ;CONFIG += avahi diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 7a59ad3..72fe862 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -188,7 +188,8 @@ PlaylistView::contextMenuEvent (QContextMenuEvent *e) a = new QAction (tr ("Add file"), this); a->setShortcut (tr ("Ctrl+F")); - a->setEnabled(false); // FIXME: Disabled for now + connect (a, SIGNAL (triggered ()), + qobject_cast (parent ()), SLOT (menuAddFile ())); qm.addAction (a); a = new QAction (tr ("Remove selected"), this); diff --git a/src/src.pro b/src/src.pro index b1f486f..df289d1 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,6 +1,7 @@ TEMPLATE = app include (../config.pri) +load (../features/pkgconfig.prf) COMPONENTS+=../lib/liblib.a LIBS += $$COMPONENTS @@ -28,7 +29,13 @@ QMAKE_CXXFLAGS += -g ;CONFIG += debug warn_on QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -CONFIG += link_pkgconfig -PKGCONFIG += xmms2-client-cpp xmms2-client +XMMSCLIENTPKG += xmms2-client-cpp +pkgconfig_exists ($$XMMSCLIENTPKG) { + QMAKE_CXXFLAGS += $$pkgconfig_cflags($$XMMSCLIENTPKG) + LIBS += $$pkgconfig_libs($$XMMSCLIENTPKG) +} else { + error (Please install the xmms2 c++ client library) +} + ;CONFIG += avahi