]> git.sesse.net Git - kdenlive/commitdiff
Compile without QJson, require Solid for network connectivity awareness
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 30 Dec 2011 00:43:54 +0000 (01:43 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 30 Dec 2011 00:43:54 +0000 (01:43 +0100)
src/CMakeLists.txt
src/utils/CMakeLists.txt
src/utils/freesound.cpp
src/utils/freesound.h

index f39ee5c9f53390d8f3de922afa5bb40bbf5f6dc9..915c1c4b7ef3e62430d1398492e70a31d81f4eee 100644 (file)
@@ -69,9 +69,10 @@ macro_log_feature(QJSON_FOUND
   "http://qjson.sourceforge.net"
   FALSE
   ""
-  "Required to build the rotoscoping filter"
+  "Required to build the rotoscoping filter and for Freesound.org queries"
 )
 
+
 add_subdirectory(audioscopes)
 add_subdirectory(beziercurve)
 add_subdirectory(blackmagic)
@@ -316,6 +317,7 @@ target_link_libraries(kdenlive
   ${KDE4_KNEWSTUFF_LIBS}
   ${KDE4_KNOTIFYCONFIG_LIBRARY}
   ${KDE4_KROSSUI_LIBS}
+  ${KDE4_SOLID_LIBS}
   ${QT_LIBRARIES}
   ${LIBMLT_LIBRARY}
   ${LIBMLTPLUS_LIBRARY}
index f420ed43bcbc4c58f07411fd22b93d098916801e..00e9eddff2431df02dc0a18b8c2c1b229b0ba4b1 100644 (file)
@@ -3,3 +3,5 @@ set(kdenlive_SRCS
   utils/freesound.cpp
   PARENT_SCOPE
 )
+
+
index f18fa41e92ca1191843955733aa718e3036dbd18..1ac1b2a7fde1c5cbe749d5deff8b31bcb2bb2d60 100644 (file)
 #include <KFileDialog>
 #include <kio/job.h>
 #include <KIO/NetAccess>
+#include <Solid/Networking>
 #include <KRun>
 
+#ifdef USE_QJSON
 #include <qjson/parser.h>
+#endif
 
 const int imageRole = Qt::UserRole;
 const int urlRole = Qt::UserRole + 1;
@@ -55,7 +58,9 @@ FreeSound::FreeSound(const QString & folder, QWidget * parent) :
     setFont(KGlobalSettings::toolBarFont());
     setupUi(this);
     setAttribute(Qt::WA_DeleteOnClose);
+#ifdef USE_QJSON
     service_list->addItem(i18n("Freesound Audio Library"), FREESOUND);
+#endif
     service_list->addItem(i18n("Open Clip Art Graphic Library"), OPENCLIPART);
     setWindowTitle(i18n("Search Online Resources"));
     connect(button_search, SIGNAL(clicked()), this, SLOT(slotStartSearch()));
@@ -68,6 +73,11 @@ FreeSound::FreeSound(const QString & folder, QWidget * parent) :
     connect(m_previewProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(slotPreviewStatusChanged(QProcess::ProcessState)));
     connect(service_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangeService()));
     sound_image->setFixedWidth(180);
+    if (Solid::Networking::status() == Solid::Networking::Unconnected) {
+        slotOffline();
+    }
+    connect(Solid::Networking::notifier(), SIGNAL(shouldConnect()), this, SLOT(slotOnline()));
+    connect(Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), this, SLOT(slotOffline()));
 }
 
 FreeSound::~FreeSound()
@@ -109,6 +119,7 @@ void FreeSound::slotShowResults()
     search_results->blockSignals(true);
     search_results->clear();
     if (m_service == FREESOUND) {
+#ifdef USE_QJSON
         QJson::Parser parser;
         bool ok;
         //kDebug()<<"// GOT RESULT: "<<m_result;
@@ -152,6 +163,7 @@ void FreeSound::slotShowResults()
                 ++i;
             }
         }
+#endif  
     }
     else if (m_service == OPENCLIPART) {
         QDomDocument doc;
@@ -277,3 +289,15 @@ void FreeSound::slotChangeService()
     if (!search_text->text().isEmpty()) slotStartSearch();
 }
 
+void FreeSound::slotOnline()
+{
+    button_search->setEnabled(true);
+    search_info->setText(QString());
+}
+
+void FreeSound::slotOffline()
+{
+    button_search->setEnabled(false);
+    search_info->setText(i18n("You need to be online\n for searching"));
+}
+
index c81a34b412cc2f023720fbd3a0ec9556ddd77ab2..297dfcccddb0ad166677ce56792a1c8912c609ab 100644 (file)
@@ -50,6 +50,8 @@ private slots:
     void slotSaveSound();
     void slotOpenUrl(const QString &url);
     void slotChangeService();
+    void slotOnline();
+    void slotOffline();
 
 private:
     QString m_folder;