Hello community, here is the log from the commit of package krunner for openSUSE:Factory checked in at 2014-12-21 11:57:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/krunner (Old) and /work/SRC/openSUSE:Factory/.krunner.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "krunner" Changes: -------- --- /work/SRC/openSUSE:Factory/krunner/krunner.changes 2014-11-11 01:08:47.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.krunner.new/krunner.changes 2014-12-21 11:57:09.000000000 +0100 @@ -1,0 +2,8 @@ +Sat Dec 6 12:53:30 UTC 2014 - [email protected] + +- Update to 5.5.0 + * Add a simple cli tool to run a query on all runners + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.5.0.php + +------------------------------------------------------------------- Old: ---- krunner-5.4.0.tar.xz New: ---- krunner-5.5.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ krunner.spec ++++++ --- /var/tmp/diff_new_pack.2r26ws/_old 2014-12-21 11:57:10.000000000 +0100 +++ /var/tmp/diff_new_pack.2r26ws/_new 2014-12-21 11:57:10.000000000 +0100 @@ -18,11 +18,11 @@ %define lname libKF5Runner5 Name: krunner -Version: 5.4.0 +Version: 5.5.0 Release: 0 %define kf5_version %{version} BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 1.4.0 +BuildRequires: extra-cmake-modules >= 1.5.0 BuildRequires: fdupes BuildRequires: kconfig-devel >= %{kf5_version} BuildRequires: kcoreaddons-devel >= %{kf5_version} @@ -40,7 +40,7 @@ License: LGPL-2.1+ Group: System/GUI/KDE Url: http://www.kde.org -Source: http://download.kde.org/stable/frameworks/5.4/portingAids/%{name}-%{version}.tar.xz +Source: http://download.kde.org/stable/frameworks/5.5/portingAids/%{name}-%{version}.tar.xz Source1: baselibs.conf BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ krunner-5.4.0.tar.xz -> krunner-5.5.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/CMakeLists.txt new/krunner-5.5.0/CMakeLists.txt --- old/krunner-5.4.0/CMakeLists.txt 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/CMakeLists.txt 2014-12-06 13:44:15.000000000 +0100 @@ -3,7 +3,7 @@ project(KRunner) # ECM setup -find_package(ECM 1.4.0 REQUIRED NO_MODULE) +find_package(ECM 1.5.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(FeatureSummary) @@ -15,8 +15,8 @@ include(KDECompilerSettings) include(KDECMakeSettings) -set(KF5_VERSION "5.4.0") # handled by release scripts -set(KF5_DEP_VERSION "5.4.0") # handled by release scripts +set(KF5_VERSION "5.5.0") # handled by release scripts +set(KF5_DEP_VERSION "5.5.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KRUNNER diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/po/it/plasma_runner_example_homefiles.po new/krunner-5.5.0/po/it/plasma_runner_example_homefiles.po --- old/krunner-5.4.0/po/it/plasma_runner_example_homefiles.po 1970-01-01 01:00:00.000000000 +0100 +++ new/krunner-5.5.0/po/it/plasma_runner_example_homefiles.po 2014-12-06 13:44:15.000000000 +0100 @@ -0,0 +1,32 @@ +# Copyright (C) YEAR This_file_is_part_of_KDE +# This file is distributed under the same license as the PACKAGE package. +# Vincenzo Reale <[email protected]>, 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2014-04-27 20:56+0000\n" +"PO-Revision-Date: 2014-11-24 22:25+0100\n" +"Last-Translator: Vincenzo Reale <[email protected]>\n" +"Language-Team: Italian <[email protected]>\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Lokalize 1.5\n" + +#: homefilesrunner.cpp:71 +#, kde-format +msgid "Finds files matching :q: in the %1 folder" +msgstr "Trova i file che corrispondono a :q: nella cartella %1" + +#: homefilesrunner.cpp:116 +#, kde-format +msgid "Open %1" +msgstr "Apri %1" + +#: homefilesrunner.cpp:157 +msgid "This is just for show" +msgstr "Solo per dimostrazione" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/po/lt/plasma_runner_example_homefiles.po new/krunner-5.5.0/po/lt/plasma_runner_example_homefiles.po --- old/krunner-5.4.0/po/lt/plasma_runner_example_homefiles.po 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/po/lt/plasma_runner_example_homefiles.po 2014-12-06 13:44:15.000000000 +0100 @@ -1,22 +1,24 @@ # Lithuanian translations for l package. # Copyright (C) 2014 This_file_is_part_of_KDE # This file is distributed under the same license as the l package. -# Automatically generated, 2014. # +# Automatically generated, 2014. +# [email protected] <[email protected]>, 2014. msgid "" msgstr "" "Project-Id-Version: l 10n\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-04-27 20:56+0000\n" -"PO-Revision-Date: 2013-09-05 01:47+0000\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" -"Language: \n" +"PO-Revision-Date: 2014-11-11 00:33+0200\n" +"Last-Translator: Liudas Ališauskas <[email protected]>\n" +"Language-Team: Lithuanian <[email protected]>\n" +"Language: lt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n%10>=2 && (n%100<10 || n" "%100>=20) ? 1 : n%10==0 || (n%100>10 && n%100<20) ? 2 : 3);\n" +"X-Generator: Lokalize 1.5\n" #: homefilesrunner.cpp:71 #, kde-format @@ -26,7 +28,7 @@ #: homefilesrunner.cpp:116 #, kde-format msgid "Open %1" -msgstr "" +msgstr "Atverti %1" #: homefilesrunner.cpp:157 msgid "This is just for show" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/po/nb/plasma_runner_example_homefiles.po new/krunner-5.5.0/po/nb/plasma_runner_example_homefiles.po --- old/krunner-5.4.0/po/nb/plasma_runner_example_homefiles.po 1970-01-01 01:00:00.000000000 +0100 +++ new/krunner-5.5.0/po/nb/plasma_runner_example_homefiles.po 2014-12-06 13:44:15.000000000 +0100 @@ -0,0 +1,34 @@ +# Translation of plasma_runner_example_homefiles to Norwegian Bokmål +# +# Bjørn Steensrud <[email protected]>, 2014. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2014-04-27 20:56+0000\n" +"PO-Revision-Date: 2014-11-05 11:00+0100\n" +"Last-Translator: Bjørn Steensrud <[email protected]>\n" +"Language-Team: Norwegian Bokmål <[email protected]>\n" +"Language: nb\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Lokalize 1.5\n" +"X-Environment: kde\n" +"X-Accelerator-Marker: &\n" +"X-Text-Markup: kde4\n" + +#: homefilesrunner.cpp:71 +#, kde-format +msgid "Finds files matching :q: in the %1 folder" +msgstr "Finn filer i %1-mappa som passer med :q:" + +#: homefilesrunner.cpp:116 +#, kde-format +msgid "Open %1" +msgstr "Åpne %1" + +#: homefilesrunner.cpp:157 +msgid "This is just for show" +msgstr "Dette er bare for syns skylds" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/po/tr/plasma_runner_example_homefiles.po new/krunner-5.5.0/po/tr/plasma_runner_example_homefiles.po --- old/krunner-5.4.0/po/tr/plasma_runner_example_homefiles.po 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/po/tr/plasma_runner_example_homefiles.po 2014-12-06 13:44:15.000000000 +0100 @@ -2,20 +2,21 @@ # This file is distributed under the same license as the PACKAGE package. # # Volkan Gezer <[email protected]>, 2013. +# Kaan Ozdincer <[email protected]>, 2014. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-04-27 20:56+0000\n" -"PO-Revision-Date: 2013-10-02 17:38+0200\n" -"Last-Translator: Volkan Gezer <[email protected]>\n" +"PO-Revision-Date: 2014-11-12 00:33+0200\n" +"Last-Translator: Kaan Ozdincer <[email protected]>\n" "Language-Team: Turkish <[email protected]>\n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Generator: Lokalize 1.5\n" +"X-Generator: Lokalize 1.4\n" #: homefilesrunner.cpp:71 #, kde-format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/CMakeLists.txt new/krunner-5.5.0/src/CMakeLists.txt --- old/krunner-5.4.0/src/CMakeLists.txt 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/src/CMakeLists.txt 2014-12-06 13:44:15.000000000 +0100 @@ -3,7 +3,7 @@ add_library(KF5Runner abstractrunner.cpp # scripting/runnerscript.cpp - private/runnerjobs.cpp + runnerjobs.cpp querymatch.cpp runnercontext.cpp runnermanager.cpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/abstractrunner.cpp new/krunner-5.5.0/src/abstractrunner.cpp --- old/krunner-5.4.0/src/abstractrunner.cpp 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/src/abstractrunner.cpp 2014-12-06 13:44:15.000000000 +0100 @@ -35,7 +35,7 @@ #include <Plasma/PluginLoader> #include <qstandardpaths.h> -#include "private/abstractrunner_p.h" +#include "abstractrunner_p.h" #include "querymatch.h" #include "runnercontext.h" #include "scripting/runnerscript.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/abstractrunner_p.h new/krunner-5.5.0/src/abstractrunner_p.h --- old/krunner-5.4.0/src/abstractrunner_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/krunner-5.5.0/src/abstractrunner_p.h 2014-12-06 13:44:15.000000000 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright 2006-2009 Aaron Seigo <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef ABSTRACTRUNNER_P_H +#define ABSTRACTRUNNER_P_H + +#include <QReadWriteLock> + +#include "plasma/dataengineconsumer.h" + +namespace Plasma +{ + +class AbstractRunner; + +class AbstractRunnerPrivate : public DataEngineConsumer +{ +public: + AbstractRunnerPrivate(AbstractRunner *r); + ~AbstractRunnerPrivate(); + void init(const KService::Ptr service); + void init(const QString &path); + void setupScriptSupport(); + + AbstractRunner::Priority priority; + AbstractRunner::Speed speed; + RunnerContext::Types blackListed; + KPluginInfo runnerDescription; + AbstractRunner *runner; + int fastRuns; + QReadWriteLock speedLock; + Package *package; + QHash<QString, QAction*> actions; + QList<RunnerSyntax> syntaxes; + RunnerSyntax *defaultSyntax; + bool hasRunOptions : 1; + bool suspendMatching : 1; +}; + +} // namespace Plasma +#endif + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/data/servicetypes/plasma-runner.desktop new/krunner-5.5.0/src/data/servicetypes/plasma-runner.desktop --- old/krunner-5.4.0/src/data/servicetypes/plasma-runner.desktop 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/src/data/servicetypes/plasma-runner.desktop 2014-12-06 13:44:15.000000000 +0100 @@ -18,6 +18,7 @@ Comment[ia]=Plugin de KRunner Comment[it]=Estensione di KRunner Comment[ko]=KRunner 플러그인 +Comment[lt]=KRunner priedas Comment[mr]=KRunner प्लगइन Comment[nb]=KRunner-programtillegg Comment[nds]=KRunner-Moduul diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/private/abstractrunner_p.h new/krunner-5.5.0/src/private/abstractrunner_p.h --- old/krunner-5.4.0/src/private/abstractrunner_p.h 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/src/private/abstractrunner_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,59 +0,0 @@ -/* - * Copyright 2006-2009 Aaron Seigo <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef ABSTRACTRUNNER_P_H -#define ABSTRACTRUNNER_P_H - -#include <QReadWriteLock> - -#include "plasma/dataengineconsumer.h" - -namespace Plasma -{ - -class AbstractRunner; - -class AbstractRunnerPrivate : public DataEngineConsumer -{ -public: - AbstractRunnerPrivate(AbstractRunner *r); - ~AbstractRunnerPrivate(); - void init(const KService::Ptr service); - void init(const QString &path); - void setupScriptSupport(); - - AbstractRunner::Priority priority; - AbstractRunner::Speed speed; - RunnerContext::Types blackListed; - KPluginInfo runnerDescription; - AbstractRunner *runner; - int fastRuns; - QReadWriteLock speedLock; - Package *package; - QHash<QString, QAction*> actions; - QList<RunnerSyntax> syntaxes; - RunnerSyntax *defaultSyntax; - bool hasRunOptions : 1; - bool suspendMatching : 1; -}; - -} // namespace Plasma -#endif - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/private/runnerjobs.cpp new/krunner-5.5.0/src/private/runnerjobs.cpp --- old/krunner-5.4.0/src/private/runnerjobs.cpp 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/src/private/runnerjobs.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2007, 2009 Ryan P. Bitanga <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "runnerjobs_p.h" - -#include <QTimer> -#include <QMutexLocker> -#include <QDebug> - -#include "runnermanager.h" -#include "querymatch.h" - -using ThreadWeaver::Job; -using ThreadWeaver::Queue; - -namespace Plasma { - -DelayedRunnerPolicy::DelayedRunnerPolicy() - : QueuePolicy() -{} - -DelayedRunnerPolicy::~DelayedRunnerPolicy() -{} - -DelayedRunnerPolicy& DelayedRunnerPolicy::instance() -{ - static DelayedRunnerPolicy policy; - return policy; -} - -bool DelayedRunnerPolicy::canRun(ThreadWeaver::JobPointer job) -{ - QSharedPointer<FindMatchesJob> aJob(job.dynamicCast<FindMatchesJob>()); - if (QTimer *t = aJob->delayTimer()) { - // If the timer is active, the required delay has not been reached - //qDebug() << "delayed timer" << aJob->runner()->name() << !t->isActive(); - return !t->isActive(); // DATA RACE! (with QTimer start/stop from runnermanager.cpp) - } - - return true; -} - -void DelayedRunnerPolicy::free(ThreadWeaver::JobPointer job) -{ - Q_UNUSED(job) -} - -void DelayedRunnerPolicy::release(ThreadWeaver::JobPointer job) -{ - free(job); -} - -void DelayedRunnerPolicy::destructed(ThreadWeaver::JobInterface* job) -{ - Q_UNUSED(job) -} - -DefaultRunnerPolicy::DefaultRunnerPolicy() - : QueuePolicy(), - m_cap(2) -{} - -DefaultRunnerPolicy::~DefaultRunnerPolicy() -{} - -DefaultRunnerPolicy& DefaultRunnerPolicy::instance() -{ - static DefaultRunnerPolicy policy; - return policy; -} - -bool DefaultRunnerPolicy::canRun(ThreadWeaver::JobPointer job) -{ - Plasma::AbstractRunner *runner = job.dynamicCast<FindMatchesJob>()->runner(); - QMutexLocker l(&m_mutex); - - if (m_runCounts[runner->name()] > m_cap) { - return false; - } else { - ++m_runCounts[runner->name()]; - return true; - } -} - -void DefaultRunnerPolicy::free(ThreadWeaver::JobPointer job) -{ - Plasma::AbstractRunner *runner = job.dynamicCast<FindMatchesJob>()->runner(); - QMutexLocker l(&m_mutex); - - --m_runCounts[runner->name()]; -} - -void DefaultRunnerPolicy::release(ThreadWeaver::JobPointer job) -{ - free(job); -} - -void DefaultRunnerPolicy::destructed(ThreadWeaver::JobInterface* job) -{ - Q_UNUSED(job) -} - -//////////////////// -// Jobs -//////////////////// - -FindMatchesJob::FindMatchesJob(Plasma::AbstractRunner *runner, - Plasma::RunnerContext *context, QObject *parent) - : ThreadWeaver::Job(), - m_context(*context, 0), - m_runner(runner), - m_timer(0), - m_decorator(new ThreadWeaver::QObjectDecorator(this, true)) -{ - QMutexLocker l(mutex()); Q_UNUSED(l); - if (runner->speed() == Plasma::AbstractRunner::SlowSpeed) { - assignQueuePolicy(&DelayedRunnerPolicy::instance()); - } else { - assignQueuePolicy(&DefaultRunnerPolicy::instance()); - } -} - -FindMatchesJob::~FindMatchesJob() -{ -} - -QTimer* FindMatchesJob::delayTimer() const -{ - return m_timer; -} - -void FindMatchesJob::setDelayTimer(QTimer *timer) -{ - m_timer = timer; -} - -void FindMatchesJob::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*) -{ -// qDebug() << "Running match for " << m_runner->objectName() -// << " in Thread " << thread()->id() << endl; - if (m_context.isValid()) { - m_runner->performMatch(m_context); - } -} - -int FindMatchesJob::priority() const -{ - return m_runner->priority(); -} - -Plasma::AbstractRunner* FindMatchesJob::runner() const -{ - return m_runner; -} - -DelayedJobCleaner::DelayedJobCleaner(const QSet<QSharedPointer<FindMatchesJob> > &jobs, const QSet<AbstractRunner *> &runners) - : QObject(Queue::instance()), - m_weaver(Queue::instance()), - m_jobs(jobs), - m_runners(runners) -{ - connect(m_weaver, SIGNAL(finished()), this, SLOT(checkIfFinished())); - - for (auto it = m_jobs.constBegin(); it != m_jobs.constEnd(); ++it) { - connect((*it)->decorator(), &ThreadWeaver::QObjectDecorator::done, this, &DelayedJobCleaner::jobDone); - } -} - -DelayedJobCleaner::~DelayedJobCleaner() -{ - qDeleteAll(m_runners); -} - -void DelayedJobCleaner::jobDone(ThreadWeaver::JobPointer job) -{ - auto runJob = job.dynamicCast<FindMatchesJob>(); - - if (!runJob) { - return; - } - - m_jobs.remove(runJob); - - if (m_jobs.isEmpty()) { - deleteLater(); - } -} - -void DelayedJobCleaner::checkIfFinished() -{ - if (m_weaver->isIdle()) { - m_jobs.clear(); - deleteLater(); - } -} - - -} // Plasma namespace - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/private/runnerjobs_p.h new/krunner-5.5.0/src/private/runnerjobs_p.h --- old/krunner-5.4.0/src/private/runnerjobs_p.h 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/src/private/runnerjobs_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2007, 2009 Ryan P. Bitanga <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef PLASMA_RUNNERJOBS_P_H -#define PLASMA_RUNNERJOBS_P_H - -#include <QHash> -#include <QMutex> -#include <QSet> - -#include <ThreadWeaver/Job> -#include <ThreadWeaver/QueuePolicy> -#include <ThreadWeaver/Queue> -#include <ThreadWeaver/QObjectDecorator> - -#include "abstractrunner.h" - -using ThreadWeaver::Job; - -class QTimer; - -namespace Plasma { -// Queue policies - -// QueuePolicy that only allows a job to be executed after -// waiting in the queue for the specified timeout -class DelayedRunnerPolicy : public ThreadWeaver::QueuePolicy -{ -public: - ~DelayedRunnerPolicy(); - - static DelayedRunnerPolicy &instance(); - - bool canRun(ThreadWeaver::JobPointer job); - void free(ThreadWeaver::JobPointer job); - void release(ThreadWeaver::JobPointer job); - virtual void destructed(ThreadWeaver::JobInterface* job); - -private: - DelayedRunnerPolicy(); - QMutex m_mutex; -}; - -// QueuePolicy that limits the instances of a particular runner -class DefaultRunnerPolicy : public ThreadWeaver::QueuePolicy -{ -public: - ~DefaultRunnerPolicy(); - - static DefaultRunnerPolicy &instance(); - - void setCap(int cap) - { - m_cap = cap; - } - int cap() const - { - return m_cap; - } - - bool canRun(ThreadWeaver::JobPointer job); - void free(ThreadWeaver::JobPointer job); - void release(ThreadWeaver::JobPointer job); - void destructed(ThreadWeaver::JobInterface* job); -private: - DefaultRunnerPolicy(); - - int m_cap; - QHash<QString, int> m_runCounts; - QMutex m_mutex; -}; - -/* - * FindMatchesJob class - * Class to run queries in different threads - */ -class FindMatchesJob : public Job -{ -public: - FindMatchesJob(Plasma::AbstractRunner *runner, - Plasma::RunnerContext *context, QObject *parent = 0); - ~FindMatchesJob(); - - int priority() const; - Plasma::AbstractRunner* runner() const; - - QTimer* delayTimer() const; - void setDelayTimer(QTimer *timer); - ThreadWeaver::QObjectDecorator* decorator() const { return m_decorator; } - -protected: - virtual void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread* thread); - -private: - Plasma::RunnerContext m_context; - Plasma::AbstractRunner *m_runner; - QTimer *m_timer; - ThreadWeaver::QObjectDecorator* m_decorator; -}; - -class DelayedJobCleaner : public QObject -{ -public: - DelayedJobCleaner(const QSet<QSharedPointer<FindMatchesJob> > &jobs, const QSet<AbstractRunner *> &runners = QSet<AbstractRunner *>()); - ~DelayedJobCleaner(); - -private Q_SLOTS: - void jobDone(ThreadWeaver::JobPointer); - void checkIfFinished(); - -private: - ThreadWeaver::Queue *m_weaver; - QSet<QSharedPointer<FindMatchesJob> > m_jobs; - QSet<AbstractRunner *> m_runners; -}; - -} - -#endif // PLASMA_RUNNERJOBS_P_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/runnerjobs.cpp new/krunner-5.5.0/src/runnerjobs.cpp --- old/krunner-5.4.0/src/runnerjobs.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/krunner-5.5.0/src/runnerjobs.cpp 2014-12-06 13:44:15.000000000 +0100 @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2007, 2009 Ryan P. Bitanga <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "runnerjobs_p.h" + +#include <QTimer> +#include <QMutexLocker> +#include <QDebug> + +#include "runnermanager.h" +#include "querymatch.h" + +using ThreadWeaver::Job; +using ThreadWeaver::Queue; + +namespace Plasma { + +DelayedRunnerPolicy::DelayedRunnerPolicy() + : QueuePolicy() +{} + +DelayedRunnerPolicy::~DelayedRunnerPolicy() +{} + +DelayedRunnerPolicy& DelayedRunnerPolicy::instance() +{ + static DelayedRunnerPolicy policy; + return policy; +} + +bool DelayedRunnerPolicy::canRun(ThreadWeaver::JobPointer job) +{ + QSharedPointer<FindMatchesJob> aJob(job.dynamicCast<FindMatchesJob>()); + if (QTimer *t = aJob->delayTimer()) { + // If the timer is active, the required delay has not been reached + //qDebug() << "delayed timer" << aJob->runner()->name() << !t->isActive(); + return !t->isActive(); // DATA RACE! (with QTimer start/stop from runnermanager.cpp) + } + + return true; +} + +void DelayedRunnerPolicy::free(ThreadWeaver::JobPointer job) +{ + Q_UNUSED(job) +} + +void DelayedRunnerPolicy::release(ThreadWeaver::JobPointer job) +{ + free(job); +} + +void DelayedRunnerPolicy::destructed(ThreadWeaver::JobInterface* job) +{ + Q_UNUSED(job) +} + +DefaultRunnerPolicy::DefaultRunnerPolicy() + : QueuePolicy(), + m_cap(2) +{} + +DefaultRunnerPolicy::~DefaultRunnerPolicy() +{} + +DefaultRunnerPolicy& DefaultRunnerPolicy::instance() +{ + static DefaultRunnerPolicy policy; + return policy; +} + +bool DefaultRunnerPolicy::canRun(ThreadWeaver::JobPointer job) +{ + Plasma::AbstractRunner *runner = job.dynamicCast<FindMatchesJob>()->runner(); + QMutexLocker l(&m_mutex); + + if (m_runCounts[runner->name()] > m_cap) { + return false; + } else { + ++m_runCounts[runner->name()]; + return true; + } +} + +void DefaultRunnerPolicy::free(ThreadWeaver::JobPointer job) +{ + Plasma::AbstractRunner *runner = job.dynamicCast<FindMatchesJob>()->runner(); + QMutexLocker l(&m_mutex); + + --m_runCounts[runner->name()]; +} + +void DefaultRunnerPolicy::release(ThreadWeaver::JobPointer job) +{ + free(job); +} + +void DefaultRunnerPolicy::destructed(ThreadWeaver::JobInterface* job) +{ + Q_UNUSED(job) +} + +//////////////////// +// Jobs +//////////////////// + +FindMatchesJob::FindMatchesJob(Plasma::AbstractRunner *runner, + Plasma::RunnerContext *context, QObject *parent) + : ThreadWeaver::Job(), + m_context(*context, 0), + m_runner(runner), + m_timer(0), + m_decorator(new ThreadWeaver::QObjectDecorator(this, true)) +{ + QMutexLocker l(mutex()); Q_UNUSED(l); + if (runner->speed() == Plasma::AbstractRunner::SlowSpeed) { + assignQueuePolicy(&DelayedRunnerPolicy::instance()); + } else { + assignQueuePolicy(&DefaultRunnerPolicy::instance()); + } +} + +FindMatchesJob::~FindMatchesJob() +{ +} + +QTimer* FindMatchesJob::delayTimer() const +{ + return m_timer; +} + +void FindMatchesJob::setDelayTimer(QTimer *timer) +{ + m_timer = timer; +} + +void FindMatchesJob::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*) +{ +// qDebug() << "Running match for " << m_runner->objectName() +// << " in Thread " << thread()->id() << endl; + if (m_context.isValid()) { + m_runner->performMatch(m_context); + } +} + +int FindMatchesJob::priority() const +{ + return m_runner->priority(); +} + +Plasma::AbstractRunner* FindMatchesJob::runner() const +{ + return m_runner; +} + +DelayedJobCleaner::DelayedJobCleaner(const QSet<QSharedPointer<FindMatchesJob> > &jobs, const QSet<AbstractRunner *> &runners) + : QObject(Queue::instance()), + m_weaver(Queue::instance()), + m_jobs(jobs), + m_runners(runners) +{ + connect(m_weaver, SIGNAL(finished()), this, SLOT(checkIfFinished())); + + for (auto it = m_jobs.constBegin(); it != m_jobs.constEnd(); ++it) { + connect((*it)->decorator(), &ThreadWeaver::QObjectDecorator::done, this, &DelayedJobCleaner::jobDone); + } +} + +DelayedJobCleaner::~DelayedJobCleaner() +{ + qDeleteAll(m_runners); +} + +void DelayedJobCleaner::jobDone(ThreadWeaver::JobPointer job) +{ + auto runJob = job.dynamicCast<FindMatchesJob>(); + + if (!runJob) { + return; + } + + m_jobs.remove(runJob); + + if (m_jobs.isEmpty()) { + deleteLater(); + } +} + +void DelayedJobCleaner::checkIfFinished() +{ + if (m_weaver->isIdle()) { + m_jobs.clear(); + deleteLater(); + } +} + + +} // Plasma namespace + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/runnerjobs_p.h new/krunner-5.5.0/src/runnerjobs_p.h --- old/krunner-5.4.0/src/runnerjobs_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/krunner-5.5.0/src/runnerjobs_p.h 2014-12-06 13:44:15.000000000 +0100 @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2007, 2009 Ryan P. Bitanga <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PLASMA_RUNNERJOBS_P_H +#define PLASMA_RUNNERJOBS_P_H + +#include <QHash> +#include <QMutex> +#include <QSet> + +#include <ThreadWeaver/Job> +#include <ThreadWeaver/QueuePolicy> +#include <ThreadWeaver/Queue> +#include <ThreadWeaver/QObjectDecorator> + +#include "abstractrunner.h" + +using ThreadWeaver::Job; + +class QTimer; + +namespace Plasma { +// Queue policies + +// QueuePolicy that only allows a job to be executed after +// waiting in the queue for the specified timeout +class DelayedRunnerPolicy : public ThreadWeaver::QueuePolicy +{ +public: + ~DelayedRunnerPolicy(); + + static DelayedRunnerPolicy &instance(); + + bool canRun(ThreadWeaver::JobPointer job); + void free(ThreadWeaver::JobPointer job); + void release(ThreadWeaver::JobPointer job); + virtual void destructed(ThreadWeaver::JobInterface* job); + +private: + DelayedRunnerPolicy(); + QMutex m_mutex; +}; + +// QueuePolicy that limits the instances of a particular runner +class DefaultRunnerPolicy : public ThreadWeaver::QueuePolicy +{ +public: + ~DefaultRunnerPolicy(); + + static DefaultRunnerPolicy &instance(); + + void setCap(int cap) + { + m_cap = cap; + } + int cap() const + { + return m_cap; + } + + bool canRun(ThreadWeaver::JobPointer job); + void free(ThreadWeaver::JobPointer job); + void release(ThreadWeaver::JobPointer job); + void destructed(ThreadWeaver::JobInterface* job); +private: + DefaultRunnerPolicy(); + + int m_cap; + QHash<QString, int> m_runCounts; + QMutex m_mutex; +}; + +/* + * FindMatchesJob class + * Class to run queries in different threads + */ +class FindMatchesJob : public Job +{ +public: + FindMatchesJob(Plasma::AbstractRunner *runner, + Plasma::RunnerContext *context, QObject *parent = 0); + ~FindMatchesJob(); + + int priority() const; + Plasma::AbstractRunner* runner() const; + + QTimer* delayTimer() const; + void setDelayTimer(QTimer *timer); + ThreadWeaver::QObjectDecorator* decorator() const { return m_decorator; } + +protected: + virtual void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread* thread); + +private: + Plasma::RunnerContext m_context; + Plasma::AbstractRunner *m_runner; + QTimer *m_timer; + ThreadWeaver::QObjectDecorator* m_decorator; +}; + +class DelayedJobCleaner : public QObject +{ +public: + DelayedJobCleaner(const QSet<QSharedPointer<FindMatchesJob> > &jobs, const QSet<AbstractRunner *> &runners = QSet<AbstractRunner *>()); + ~DelayedJobCleaner(); + +private Q_SLOTS: + void jobDone(ThreadWeaver::JobPointer); + void checkIfFinished(); + +private: + ThreadWeaver::Queue *m_weaver; + QSet<QSharedPointer<FindMatchesJob> > m_jobs; + QSet<AbstractRunner *> m_runners; +}; + +} + +#endif // PLASMA_RUNNERJOBS_P_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/src/runnermanager.cpp new/krunner-5.5.0/src/runnermanager.cpp --- old/krunner-5.4.0/src/runnermanager.cpp 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/src/runnermanager.cpp 2014-12-06 13:44:15.000000000 +0100 @@ -38,7 +38,7 @@ #include <ThreadWeaver/Queue> #include <ThreadWeaver/Thread> -#include "private/runnerjobs_p.h" +#include "runnerjobs_p.h" #include "plasma/pluginloader.h" #include <plasma/version.h> #include "querymatch.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/tests/CMakeLists.txt new/krunner-5.5.0/tests/CMakeLists.txt --- old/krunner-5.4.0/tests/CMakeLists.txt 2014-11-02 13:18:03.000000000 +0100 +++ new/krunner-5.5.0/tests/CMakeLists.txt 2014-12-06 13:44:15.000000000 +0100 @@ -1,3 +1,7 @@ add_executable(runnermodeltest runnermodeltest.cpp ../src/declarative/runnermodel.cpp) target_link_libraries(runnermodeltest Qt5::Widgets KF5::Service KF5Runner) ecm_mark_as_test(runnermodeltest) + +add_executable(runnertest runnertest.cpp) +target_link_libraries(runnertest Qt5::Widgets KF5::Runner) +ecm_mark_as_test(runnertest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/krunner-5.4.0/tests/runnertest.cpp new/krunner-5.5.0/tests/runnertest.cpp --- old/krunner-5.4.0/tests/runnertest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/krunner-5.5.0/tests/runnertest.cpp 2014-12-06 13:44:15.000000000 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright 2014 Vishesh Handa <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <QCoreApplication> +#include <QCommandLineParser> +#include <QCommandLineOption> +#include <QDebug> + +#include "runnermanager.h" + +using namespace Plasma; + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + + QCommandLineParser parser; + parser.addPositionalArgument(QStringLiteral("query"), QStringLiteral("words to query")); + + parser.addOption(QCommandLineOption(QStringList() << QLatin1String("r") << QLatin1String("runner"), + QLatin1String("Name of the runner"), + QLatin1String("runnerName"))); + + parser.addHelpOption(); + parser.process(app); + + QString query = parser.positionalArguments().join(" "); + if (query.isEmpty()) { + parser.showHelp(1); + } + QString runnerName = parser.value("runner"); + + RunnerManager manager; + + QList<Plasma::QueryMatch> matches; + QObject::connect(&manager, &RunnerManager::matchesChanged, [&](const QList<Plasma::QueryMatch>& list) { + matches = list; + }); + QObject::connect(&manager, &RunnerManager::queryFinished, [&]() { + qDebug() << "Found matches:"; + for (const auto& match : matches) { + qDebug() << match.matchCategory() << match.text(); + } + app.quit(); + }); + + manager.launchQuery(query, runnerName); + return app.exec(); +} -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
