aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/DbAndroid/dbandroidconnectionfactory.cpp
blob: e1e59f8632d7e1219bbab8d4e77fe70d6fa66182 (plain) (blame)
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
#include "dbandroidconnectionfactory.h"
#include "dbandroidjsonconnection.h"
#include "dbandroidshellconnection.h"

DbAndroidConnectionFactory::DbAndroidConnectionFactory(DbAndroid* plugin) :
    plugin(plugin)
{
}

DbAndroidConnection* DbAndroidConnectionFactory::create(const QString& url, QObject* parent)
{
    return create(DbAndroidUrl(url), parent);
}

DbAndroidConnection* DbAndroidConnectionFactory::create(const DbAndroidUrl& url, QObject* parent)
{
    switch (url.getMode())
    {
        case DbAndroidMode::SHELL:
            return new DbAndroidShellConnection(plugin, url.getDevice(), parent);
        case DbAndroidMode::NETWORK:
        case DbAndroidMode::USB:
            return new DbAndroidJsonConnection(plugin, parent);
        case DbAndroidMode::null:
            break;
    }
    return nullptr;
}