19 #include "ui_editcommanddialog.h" 24 #include <QFileDialog> 30 m_key(static_cast<Qt::Key>(0))
33 ui->group->addItems(groups);
34 ui->group->lineEdit()->setText(group);
50 return ui->group->lineEdit()->text();
55 return ui->description->text();
60 ui->group->lineEdit()->setText(group);
65 ui->description->setText(description);
70 return ui->command->text();
75 ui->command->setText(command);
80 return ui->args->text();
85 ui->args->setText(arguments);
108 return ui->keyAssociate->isChecked();
113 ui->keyAssociate->setChecked(release);
118 return ui->keyRelease->isChecked();
123 ui->keyRelease->setChecked(release);
129 QString commandFileName =
ui->command->text();
130 QFileInfo commandFileInfo(commandFileName);
131 QString commandFolderName = commandFileInfo.baseName();
132 QFileInfo commandDirInfo(commandFolderName);
135 if (commandFileInfo.exists()) {
136 dirStr = commandFileName;
137 }
else if (commandDirInfo.exists()) {
138 dirStr = commandFolderName;
143 QString fileName = QFileDialog::getOpenFileName(
145 tr(
"Select command"),
147 tr(
"All (*);;Python (*.py);;Shell (*.sh *.bat);;Binary (*.bin *.exe)"), 0, QFileDialog::DontUseNativeDialog);
149 if (fileName !=
"") {
150 ui->command->setText(fileName);
159 setFocusPolicy(Qt::StrongFocus);
167 setFocusPolicy(Qt::NoFocus);
186 ui->group->lineEdit()->setText(command.
getGroup());
202 ui->keyLabel->setText(
"");
206 QString altGrStr =
m_keyModifiers & Qt::GroupSwitchModifier ?
"Gr " :
"";
208 ui->keyLabel->setText(altGrStr + QKeySequence(maskedModifiers,
m_key).toString());
212 ui->keyLabel->setText(QKeySequence(
m_key).toString());
220 ui->keyAssociate->setChecked(
false);
221 ui->keyAssociate->setEnabled(
false);
225 ui->keyAssociate->setEnabled(
true);
238 ui->keyCapture->setChecked(
false);
void setKey(Qt::Key key, Qt::KeyboardModifiers modifiers)
void setRelease(bool release)
Qt::KeyboardModifiers getKeyModifiers() const
bool getAssociateKey() const
void setGroup(const QString &group)
CommandKeyReceiver * m_commandKeyReceiver
void setDescription(const QString &description)
const QString & getDescription() const
void toCommand(Command &command) const
void setCommand(const QString &command)
void setRelease(bool release)
void setArgString(const QString &argString)
Qt::KeyboardModifiers getKeyModifiers() const
QString getArguments() const
void on_showFileDialog_clicked(bool checked)
void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release)
QString getCommand() const
void setArguments(const QString &arguments)
void setDescription(const QString &description)
EditCommandDialog(const QStringList &groups, const QString &group, QWidget *parent=0)
QString getDescription() const
Qt::KeyboardModifiers m_keyModifiers
const QString & getArgString() const
void setCommand(const QString &command)
const QString & getGroup() const
void setAssociateKey(bool associate)
void setAssociateKey(bool associate)
Ui::EditCommandDialog * ui
void fromCommand(const Command &command)
bool getAssociateKey() const
void setGroup(const QString &group)
const QString & getCommand() const
void on_keyCapture_toggled(bool checked)
void setKeyModifiers(Qt::KeyboardModifiers keyModifiers)