swift
commandinput.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_COMPONENTS_COMMANDINPUT_H
7 #define SWIFT_GUI_COMPONENTS_COMMANDINPUT_H
8 
9 #include <QLineEdit>
10 #include <QObject>
11 #include <QString>
12 
13 #include "gui/lineedithistory.h"
14 #include "gui/swiftguiexport.h"
15 #include "misc/digestsignal.h"
16 #include "misc/identifiable.h"
17 #include "misc/identifier.h"
18 
19 namespace swift::misc
20 {
21  namespace network
22  {
23  class CServer;
24  }
25  namespace simulation
26  {
27  class CSimulatorPluginInfo;
28  }
29 } // namespace swift::misc
30 namespace swift::gui::components
31 {
34  {
35  Q_OBJECT
36 
37  public:
39  CCommandInput(QWidget *parent = nullptr);
40 
42  void showToolTip(bool show);
43 
44  signals:
46  void commandEntered(const QString &command, const swift::misc::CIdentifier &originator);
47 
49  void textEntered(const QString &command, const swift::misc::CIdentifier &originator);
50 
51  private:
53  void validateCommand();
54 
56  void setCommandToolTip();
57 
59  void onSimulatorPluginChanged(const swift::misc::simulation::CSimulatorPluginInfo &info);
60 
62  void onConnectedServerChanged(const swift::misc::network::CServer &server);
63 
64  bool m_showToolTip = true;
65  swift::misc::CDigestSignal m_dsCommandTooltip { this, &CCommandInput::setCommandToolTip,
66  std::chrono::seconds(5), 2 };
67  };
68 } // namespace swift::gui::components
69 #endif // SWIFT_GUI_COMPONENTS_COMMANDINPUT_H
Line edit with history.
Specialized line edit for command inputs.
Definition: commandinput.h:34
void commandEntered(const QString &command, const swift::misc::CIdentifier &originator)
Command was entered.
void textEntered(const QString &command, const swift::misc::CIdentifier &originator)
Text entered (which is not a command)
Receive 1..n signals, collect them over time, and resend afer n milliseconds.
Definition: digestsignal.h:18
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
Definition: identifiable.h:24
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition: identifier.h:29
Value object encapsulating information of a server.
Definition: server.h:28
High level reusable GUI components.
Definition: aboutdialog.cpp:13
Free functions in swift::misc.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.