kwave  18.07.70
Kwave::StringEnterDialog Class Reference

#include <StringEnterDialog.h>

Inheritance diagram for Kwave::StringEnterDialog:
Inheritance graph
Collaboration diagram for Kwave::StringEnterDialog:
Collaboration graph

Public Member Functions

 StringEnterDialog (QWidget *parent, const QString &preset)
 
virtual ~StringEnterDialog () Q_DECL_OVERRIDE
 
QString command ()
 

Private Slots

virtual void accept () Q_DECL_OVERRIDE
 
void invokeHelp ()
 

Private Attributes

QString m_command
 

Detailed Description

Definition at line 32 of file StringEnterDialog.h.

Constructor & Destructor Documentation

◆ StringEnterDialog()

Kwave::StringEnterDialog::StringEnterDialog ( QWidget *  parent,
const QString &  preset 
)
explicit

Constructor.

Parameters
parentthe parent widget the dialog belongs to
presetinitial text of the line edit field

Definition at line 36 of file StringEnterDialog.cpp.

References CONFIG_GROUP, CONFIG_WIDTH, and m_command.

38  :QDialog(parent), Ui::StringEnterDlg(), m_command()
39 {
40  setupUi(this);
41  setFixedHeight(sizeHint().height());
42  setMaximumWidth(sizeHint().width() * 2);
43 
44  // restore the window width from the previous invocation
45  KConfigGroup cfg = KSharedConfig::openConfig()->group(CONFIG_GROUP);
46  QString result = cfg.readEntry(CONFIG_WIDTH);
47  bool ok = false;
48  int w = result.toUInt(&ok);
49  if (ok && (w > sizeHint().width()))
50  resize(w, height());
51 
52  if (preset.length()) {
53  edCommand->setText(preset);
54  m_command = preset;
55  }
56 }
#define CONFIG_GROUP
#define CONFIG_WIDTH

◆ ~StringEnterDialog()

Kwave::StringEnterDialog::~StringEnterDialog ( )
virtual

Destructor

Definition at line 59 of file StringEnterDialog.cpp.

References CONFIG_GROUP, and CONFIG_WIDTH.

60 {
61  // save the window width for the next invocation
62  KConfigGroup cfg = KSharedConfig::openConfig()->group(CONFIG_GROUP);
63  cfg.writeEntry(CONFIG_WIDTH, width());
64 }
#define CONFIG_GROUP
#define CONFIG_WIDTH

Member Function Documentation

◆ accept

void Kwave::StringEnterDialog::accept ( )
privatevirtualslot

called when the dialog has been accepted (OK pressed)

Definition at line 73 of file StringEnterDialog.cpp.

References m_command.

74 {
75  m_command = edCommand->text().trimmed();
76  if (m_command.length())
77  QDialog::accept();
78  else
79  QDialog::close();
80 }

◆ command()

QString Kwave::StringEnterDialog::command ( )

Returns the string that has been entered

Definition at line 67 of file StringEnterDialog.cpp.

References m_command.

68 {
69  return m_command;
70 }

◆ invokeHelp

void Kwave::StringEnterDialog::invokeHelp ( )
privateslot

invoke the online help

Definition at line 83 of file StringEnterDialog.cpp.

References _.

84 {
85  KHelpClient::invokeHelp(_("plugin_sect_stringenter"));
86 }
#define _(m)
Definition: memcpy.c:66

Member Data Documentation

◆ m_command

QString Kwave::StringEnterDialog::m_command
private

the command that has been entered

Definition at line 62 of file StringEnterDialog.h.

Referenced by accept(), command(), and StringEnterDialog().


The documentation for this class was generated from the following files: