1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* This file is part of Ubuntu TimeOut Scope.
* Copyright 2014 Canonical Ltd.
*
* TimeOut Scope is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* TimeOut Scope is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TimeOut-scope.h"
#include "TimeOut-query.h"
#include "TimeOut-preview.h"
#include <unity-scopes.h>
using namespace unity::scopes;
void TimeoutScope::start(std::string const&) {
timeout.setCacheDirectory(cache_directory());
}
void TimeoutScope::stop() {
}
SearchQueryBase::UPtr TimeoutScope::search(CannedQuery const &q, SearchMetadata const& metadata) {
const QString scopePath = QString::fromStdString(scope_directory());
SearchQueryBase::UPtr query(new TimeoutQuery(q, metadata, timeout, scopePath));
return query;
}
PreviewQueryBase::UPtr TimeoutScope::preview(Result const& result, ActionMetadata const& metadata) {
PreviewQueryBase::UPtr preview(new TimeoutPreview(result, metadata, timeout));
return preview;
}
#define EXPORT __attribute__ ((visibility ("default")))
extern "C"
{
EXPORT
ScopeBase*
// cppcheck-suppress unusedFunction
UNITY_SCOPE_CREATE_FUNCTION() {
return new TimeoutScope();
}
EXPORT
void
// cppcheck-suppress unusedFunction
UNITY_SCOPE_DESTROY_FUNCTION(ScopeBase* scope_base) {
delete scope_base;
}
}
|