aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/DbAndroid/dbandroidpathdialog.h
blob: 4c4496fa8f22d5a07834f7bf64e5dd8989b4700a (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
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
79
80
#ifndef DBANDROIDPATHDIALOG_H
#define DBANDROIDPATHDIALOG_H

#include "dbandroidurl.h"
#include <QDialog>

namespace Ui {
    class DbAndroidPathDialog;
}

class DbAndroid;
class QTimer;
class WidgetCover;
class DbAndroidInstance;

class DbAndroidPathDialog : public QDialog
{
        Q_OBJECT

    public:
        DbAndroidPathDialog(const DbAndroid* plugin, QWidget *parent = 0);
        ~DbAndroidPathDialog();
        void setUrl(const QString& url);
        void setUrl(const DbAndroidUrl& url);
        const DbAndroidUrl& getUrl() const;

    private:
        void init();
        void updateUrl();
        void loadUrl();
        void asyncDbUpdate(const QString& connectionUrl, DbAndroidMode enforcedMode);
        void asyncAppUpdate(const QString& connectionUrl, DbAndroidMode enforcedMode);
        void refreshDevices();
        DbAndroidMode getSelectedMode() const;
        void setDbListUpdatesEnabled(bool enabled);

        const DbAndroid* plugin = nullptr;
        DbAndroidUrl dbUrl;
        Ui::DbAndroidPathDialog *ui;
        QTimer* dbListUpdateTimer = nullptr;
        QTimer* appListUpdateTimer = nullptr;
        WidgetCover* dbListCover = nullptr;
        WidgetCover* appListCover = nullptr;
        bool updatingDbList = false;
        bool updatingAppList = false;
        bool suspendDbListUpdates = false;
        bool suspendAppListUpdates = false;
        QStringList fullAppList;

    private slots:
        void scheduleDbListUpdate();
        void scheduleAppListUpdate();
        void updateState();
        void refreshDbList();
        void refreshAppList();
        void updateDeviceList();
        void updateValidations();
        void handleUpdateDbList(const QStringList& dbList);
        void handleUpdateAppList(const QStringList& apps);
        void handleFinishedAsyncDbListUpdate(bool appOkay);
        void handleFinishedAsyncAppListUpdate();
        void handleDbCreationUpdate(bool canCreateDatabases);
        void createNewDatabase();
        void deleteSelectedDatabase();
        void modeChanged(bool checked);
        void applyAppFilter(const QString& value);

    public slots:
        void accept();

    signals:
        void callForValidations();
        void callForDbCreationUpdate(bool canCreateDatabases);
        void asyncDbListUpdatingFinished(bool appOkay);
        void asyncAppListUpdatingFinished();
        void callForDbListUpdate(const QStringList& newList);
        void callForAppListUpdate(const QStringList& newList);
};

#endif // DBANDROIDPATHDIALOG_H