Sayonara Player
Loading...
Searching...
No Matches
LineInputDialog.h
1/* LineInputDialog.h */
2
3/* Copyright (C) 2011-2024 Michael Lugmair (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
27UI_FWD(LineInputDialog)
28
29namespace 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& title, const QString& infoText, const QString& inputText,
54 QWidget* parent = nullptr);
55 LineInputDialog(const QString& title, const QString& infoText, QWidget* parent = nullptr);
56 virtual ~LineInputDialog() override;
57
58 void setHeaderText(const QString& text);
59 void setInfoText(const QString& text);
60 void setCompleterText(const QStringList& lst);
61
66 ReturnValue returnValue() const;
67
72 QString text() const;
73
78 void setText(const QString& text);
79
80 void setPlaceholderText(const QString& text);
81
82 void showInfo(bool b, const QString& infoPrefix = QString());
83
88 bool wasAccepted() const;
89 void setInvalidChars(const QList<QChar>& chars);
90
91 private slots:
92 void okClicked();
93 void cancelClicked();
94 void textEdited(const QString& text);
95
96 protected:
97 void showEvent(QShowEvent* e) override;
98 void closeEvent(QCloseEvent* e) override;
99
100 public:
101 static QString
102 getRenameFilename(QWidget* parent, const QString& oldName, const QString& parentPath = QString());
103 static QString getNewFilename(QWidget* parent, const QString& info, const QString& parentPath = QString());
104 };
105}
106
107#endif // LINEINPUTDIALOG_H
Dialog with Settings connection. Also contains triggers for language_changed() and skin_changed()....
Definition: Dialog.h:37
Dialog for entering one line. Listen for the sig_closed() signal for the Gui::Dialog class and reques...
Definition: LineInputDialog.h:41
QString text() const
Return the entered text.
void setText(const QString &text)
Prefill the QLineEdit widget.
ReturnValue returnValue() const
returns if the dialog was closes by cancel or ok button
bool wasAccepted() const
Convenience method for return_value() method.
Definition: EngineUtils.h:33