~ci-train-bot/ubuntu-ui-extras/ubuntu-ui-extras-ubuntu-zesty-2515

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/Extras/Printers/printer/printersignalhandler.h

  • Committer: Andrew Hayzen
  • Date: 2017-02-21 10:46:29 UTC
  • Revision ID: ahayzen@gmail.com-20170221104629-pbm454x5k7rr4ot5
* Add printer-components from ubuntu-settings-components to ubuntu-ui-extras (original branch https://code.launchpad.net/~phablet-team/ubuntu-settings-components/printer-components)
* Add plugin module to Extras/Printers
* Add translation support for cpp/h
* Add tests for Printers
* Add debian depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2017 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#ifndef USC_PRINTER_SIGNAL_HANDLER_H
 
18
#define USC_PRINTER_SIGNAL_HANDLER_H
 
19
 
 
20
#include "printers_global.h"
 
21
 
 
22
#include <QObject>
 
23
#include <QSet>
 
24
#include <QTimer>
 
25
 
 
26
class PRINTERS_DECL_EXPORT PrinterSignalHandler : public QObject
 
27
{
 
28
    Q_OBJECT
 
29
    QTimer m_timer;
 
30
    QSet<QString> m_unprocessed;
 
31
public:
 
32
    explicit PrinterSignalHandler(int triggerEventDelay = 500,
 
33
                                  QObject *parent = Q_NULLPTR);
 
34
    ~PrinterSignalHandler();
 
35
 
 
36
public Q_SLOTS:
 
37
    void onPrinterModified(
 
38
        const QString &text, const QString &printerUri,
 
39
        const QString &printerName, uint printerState,
 
40
        const QString &printerStateReason, bool acceptingJobs
 
41
    );
 
42
    void onPrinterStateChanged(
 
43
        const QString &text, const QString &printerUri,
 
44
        const QString &printerName, uint printerState,
 
45
        const QString &printerStateReason, bool acceptingJobs
 
46
    );
 
47
 
 
48
private Q_SLOTS:
 
49
    void process();
 
50
 
 
51
Q_SIGNALS:
 
52
    void printerModified(const QString &printerName);
 
53
};
 
54
 
 
55
#endif // USC_PRINTER_SIGNAL_HANDLER_H