Quantcast
Channel: Fedora People
Viewing all articles
Browse latest Browse all 29995

Trever Fischer: More Zeitgeist in More Places!

$
0
0

First, I’ve read all the comments and discussion around the ‘net about my previous blog post where I threw some ideas around for phonon-gstreamer. I’ll follow that statement up with more interesting details later this week, but the important thing I want to say is: No, PulseAudio won’t be required, but I don’t support not using it. Really, I think PulseAudio should have first-class citizenship in KDE. Shoddy support in our applications slows the adoption of it and makes everyone look bad, including the PA devs.

Second, remember my post about creating a webbrowser with Zeitgeist as the history backend in four steps? This week, the Zeitgeist team is embarking on a small KDE deployment sprint. We’re taking a look at a bunch of applications and figuring out how to stuff (more) Zeitgeist into them:

  • KWrite
  • Dragon
  • Juk
  • Amarok

First, have a look at this here:

Dragon + Zeitgeist = <3

Thats Dragon with a new zeitgeist-powered “recently-played” view. Excluding a couple of buildsystem and other lines that convert the list from a KListWidget to a QListView, here’s the portion of the patch that converts it to use Zeitgeist:

 RecentlyPlayedList::RecentlyPlayedList(QWidget *parent)
-		:KListWidget(parent)
+		:QListView(parent)
 {
-  connect(this,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this, SLOT(itemDoubleClicked(QListWidgetItem*)));
   setAlternatingRowColors( true );
   setSelectionMode(QAbstractItemView::SingleSelection);
-
-  configGroup = new KConfigGroup( KGlobal::config(), "General" );
-  loadEntries();
+  //configGroup = new KConfigGroup( KGlobal::config(), "General" );
+#ifdef HAVE_ZEITGEIST
+  m_model = new QZeitgeist::LogModel(this);
+  setModel(m_model);
+  QZeitgeist::DataModel::Event audioTemplate;
+  QZeitgeist::DataModel::Event videoTemplate;
+  QZeitgeist::DataModel::Subject audioSubjectTemplate;
+  QZeitgeist::DataModel::Subject videoSubjectTemplate;
+  audioSubjectTemplate.setInterpretation(QZeitgeist::Interpretation::Subject::NFOAudio);
+  videoSubjectTemplate.setInterpretation(QZeitgeist::Interpretation::Subject::NFOVideo);
+  audioTemplate.setSubjects(QZeitgeist::DataModel::SubjectList() << audioSubjectTemplate);
+  videoTemplate.setSubjects(QZeitgeist::DataModel::SubjectList() << videoSubjectTemplate); +  m_model->setEventTemplates(QZeitgeist::DataModel::EventList() << audioTemplate << videoTemplate); +  m_model->setResultType(QZeitgeist::Log::MostRecentSubjects);
+#endif

Yup, thats it. And thanks to the magic of QZeitgeist’s LogModel, it automatically updates while stuff happens. Seriously. I’m listening to some tracks in Amarok, and Dragon starts listing them. I’m actually blow away by how easy it is to add Zeitgeist to something, and I’m the guy maintaining QZeitgeist.

Why isn’t your application using Zeitgeist yet? :)

<g:plusone href="http://wm161.net/2012/05/28/more-zeitgeist-in-more-places/" size="tall"></g:plusone>

flattr this!


Viewing all articles
Browse latest Browse all 29995

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>