summaryrefslogtreecommitdiff
path: root/browser/userinput.h
blob: 54f21dea801dbbe0774fd96f08361ca15b069c9b (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
/**
 * Copyright (C) 2013, Pelagicore
 *
 * Author: Marcel Schuette <marcel.schuette@pelagicore.com>
 *
 * This file is part of the GENIVI project Browser Proof-Of-Concept
 * For further information, see http://genivi.org/
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef USERINPUT_H
#define USERINPUT_H

#include <QObject>
#include <QDBusContext>
#include <QDebug>

#include "../common/browserdefs.h"



class userinput : public QObject, protected QDBusContext
{
    Q_OBJECT
public:
    explicit userinput(QObject *parent = 0);
    
signals:
    void onInputText(QString a_strInputName, QString a_strDefaultInputValue,
                     conn::brw::INPUT_ELEMENT_TYPE a_i32InputValueType, int a_s32MaxLength,
                     int a_s32Max, int a_s32Min, int a_s32Step);
    void inputText(QString input);
    void setOutputWebview(QString path);
    void onConfirmDialog(QString);
    void onPromptDialog(QString,QString);
    void onAlertDialog(QString);
    void onDialogCanceled(void);
    void onSelect(const QString &a_strSelectName, const conn::brw::SelectableOptionList & a_oOptions, bool a_bMultiSelectionAllowed);

    // Internal
    void doCloseAlertDialog(void);
    void doCloseConfirmDialog(bool);
    void doClosePromptDialog(QString, bool);
    void selectIndexes(QList<int>);
    
public Q_SLOTS:
    conn::brw::ERROR_IDS inputText(conn::brw::DIALOG_RESULT a_eResult, const QString &a_strInputValue);
    void inputTextReceived(QString a_strInputName, QString a_strDefaultInputValue, int a_i32InputValueType,
                           int a_s32MaxLength, int a_s32Max, int a_s32Min, int a_s32Step);
    conn::brw::ERROR_IDS closeAlertDialog (void);
    conn::brw::ERROR_IDS closeConfirmDialog (conn::brw::DIALOG_RESULT);
    conn::brw::ERROR_IDS closePromptDialog (QString, conn::brw::DIALOG_RESULT);
    conn::brw::ERROR_IDS getPrevEnteredValues(const QString&, const QString&, conn::brw::INPUT_ELEMENT_TYPE, QStringList&);
    conn::brw::ERROR_IDS selectOption(const conn::brw::SelectableOptionList &);

private:
    struct inputStruct {
        QString name;
        QString value;
        conn::brw::INPUT_ELEMENT_TYPE type;
    };

    struct {
        QString name;
        conn::brw::INPUT_ELEMENT_TYPE type;
    } m_currentInput;

    QList<struct inputStruct> *m_inputHistory;
};

#endif // USERINPUT_H