summaryrefslogtreecommitdiffhomepage
path: root/api/plugin-api.cpp
blob: ef9e47a13229b68d8f106f5afb40c18b7b208711 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "plugin-api.hpp"
#include <QDebug>

namespace plugin_api::detail {

BaseDialog::BaseDialog() = default;
void BaseDialog::closeEvent(QCloseEvent*)
{
    if (isVisible())
    {
        emit closing();
        close();
    }
}

void BaseDialog::done(int)
{
    if (isVisible())
        close();
}

bool BaseDialog::embeddable() noexcept { return false; }
void BaseDialog::save() {}
void BaseDialog::reload() {}
void BaseDialog::set_buttons_visible(bool x) {}

} // ns plugin_api::detail

// these exist so that vtable is emitted in a single compilation unit, not all of them.

Metadata_::Metadata_() = default;
Metadata_::~Metadata_() = default;
Metadata::Metadata() = default;
Metadata::~Metadata() = default;

IFilter::IFilter() = default;
IFilter::~IFilter() = default;
IFilterDialog::IFilterDialog() = default;
IFilterDialog::~IFilterDialog() = default;
void IFilterDialog::register_filter(IFilter* filter) {}
void IFilterDialog::unregister_filter() {}
IProtocol::IProtocol() = default;
IProtocol::~IProtocol() = default;
IProtocolDialog::IProtocolDialog() = default;
IProtocolDialog::~IProtocolDialog() = default;
void IProtocolDialog::register_protocol(IProtocol* protocol){}
void IProtocolDialog::unregister_protocol() {}
ITracker::ITracker() = default;
ITracker::~ITracker() = default;
bool ITracker::center() { return false; }
ITrackerDialog::ITrackerDialog() = default;
ITrackerDialog::~ITrackerDialog() = default;
void ITrackerDialog::register_tracker(ITracker*) {}
void ITrackerDialog::unregister_tracker() {}

bool module_status::is_ok() const
{
    return error.isNull();
}
module_status_mixin::~module_status_mixin() = default;
module_status::module_status(const QString& error) : error(error) {}
module_status::module_status() = default;
module_status module_status_mixin::status_ok() { return {}; }

module_status module_status_mixin::error(const QString& error)
{
    return module_status(error.isEmpty() ? tr("Unknown error") : error);
}

module_status ITracker::status_ok()
{
    return module_status();
}

module_status ITracker::error(const QString& error)
{
    return module_status_mixin::error(error);
}