Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
paymentserver.h
Go to the documentation of this file.
1 #ifndef PAYMENTSERVER_H
2 #define PAYMENTSERVER_H
3 
4 //
5 // This class handles payment requests from clicking on
6 // bitcoin: URIs
7 //
8 // This is somewhat tricky, because we have to deal with
9 // the situation where the user clicks on a link during
10 // startup/initialization, when the splash-screen is up
11 // but the main window (and the Send Coins tab) is not.
12 //
13 // So, the strategy is:
14 //
15 // Create the server, and register the event handler,
16 // when the application is created. Save any URIs
17 // received at or during startup in a list.
18 //
19 // When startup is finished and the main window is
20 // show, a signal is sent to slot uiReady(), which
21 // emits a receivedURL() signal for any payment
22 // requests that happened during startup.
23 //
24 // After startup, receivedURL() happens as usual.
25 //
26 // This class has one more feature: a static
27 // method that finds URIs passed in the command line
28 // and, if a server is running in another process,
29 // sends them to the server.
30 //
31 #include <QObject>
32 #include <QString>
33 
34 class QApplication;
35 class QLocalServer;
36 
37 class PaymentServer : public QObject
38 {
39  Q_OBJECT
40 
41 private:
42  bool saveURIs;
43  QLocalServer* uriServer;
44 
45 public:
46  // Returns true if there were URIs on the command line
47  // which were successfully sent to an already-running
48  // process.
49  static bool ipcSendCommandLine();
50 
51  PaymentServer(QApplication* parent);
52 
53  bool eventFilter(QObject *object, QEvent *event);
54 
55 signals:
56  void receivedURI(QString);
57 
58 public slots:
59  // Signal this when the main window's UI is ready
60  // to display payment requests to the user
61  void uiReady();
62 
63 private slots:
64  void handleURIConnection();
65 };
66 
67 #endif // PAYMENTSERVER_H
void receivedURI(QString)
bool eventFilter(QObject *object, QEvent *event)
QLocalServer * uriServer
Definition: paymentserver.h:43
static bool ipcSendCommandLine()
void handleURIConnection()
PaymentServer(QApplication *parent)