Sayonara Player
LineInputDialog.h
1 /* LineInputDialog.h */
2 
3 /* Copyright (C) 2011-2019 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LINEINPUTDIALOG_H
22 #define LINEINPUTDIALOG_H
23 
24 #include "Gui/Utils/Widgets/Dialog.h"
25 #include "Utils/Pimpl.h"
26 
27 UI_FWD(LineInputDialog)
28 
29 namespace Gui
30 {
31  class Completer;
32 
40  public Dialog
41  {
42  Q_OBJECT
43  UI_CLASS(LineInputDialog)
44  PIMPL(LineInputDialog)
45 
46  public:
47  enum ReturnValue
48  {
49  Ok=0,
50  Cancelled
51  };
52 
53  LineInputDialog(const QString& window_title, const QString& info_text, const QString& input_text, QWidget* parent=nullptr);
54  LineInputDialog(const QString& window_title, const QString& info_text, QWidget* parent=nullptr);
55  ~LineInputDialog();
56 
57  void set_header_text(const QString& text);
58  void set_info_text(const QString& text);
59  void set_completer_text(const QStringList& lst);
60 
65  ReturnValue return_value() const;
66 
71  QString text() const;
72 
77  void set_text(const QString& text);
78 
83  bool was_accepted() const;
84 
85  private slots:
86  void ok_clicked();
87  void cancel_clicked();
88 
89  protected:
90  void showEvent(QShowEvent* e) override;
91  void closeEvent(QCloseEvent* e) override;
92  };
93 }
94 
95 #endif // LINEINPUTDIALOG_H
Gui::LineInputDialog::text
QString text() const
Return the entered text.
Gui::LineInputDialog::return_value
ReturnValue return_value() const
returns if the dialog was closes by cancel or ok button
Gui::Dialog
Dialog with Settings connection. Also contains triggers for language_changed() and skin_changed()....
Definition: Dialog.h:33
Gui::LineInputDialog
Dialog for entering one line. Listen for the sig_closed() signal for the Gui::Dialog class and reques...
Definition: LineInputDialog.h:39
Gui::LineInputDialog::was_accepted
bool was_accepted() const
Convenience method for return_value() method.
Gui::LineInputDialog::set_text
void set_text(const QString &text)
Prefill the QLineEdit widget.