forked from qt-creator/qt-creator
Debugger: Improve UnstartedAppWatcherDialog.
Make it possible to ESC out of it by using a QDialogButtonBox and overriding the ESC shortcut. Also remove context help button. Change-Id: If632c5f3cadc012dd2f67dcb709570f7a9c25bf5 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -49,6 +49,8 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QKeyEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@@ -84,6 +86,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
|
|||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Attach to Process Not Yet Started"));
|
setWindowTitle(tr("Attach to Process Not Yet Started"));
|
||||||
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
m_kitChooser = new DebuggerKitChooser(DebuggerKitChooser::LocalDebugging, this);
|
m_kitChooser = new DebuggerKitChooser(DebuggerKitChooser::LocalDebugging, this);
|
||||||
m_kitChooser->populate();
|
m_kitChooser->populate();
|
||||||
@@ -124,19 +127,11 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
|
|||||||
m_waitingLabel = new QLabel(QString(), this);
|
m_waitingLabel = new QLabel(QString(), this);
|
||||||
m_waitingLabel->setAlignment(Qt::AlignCenter);
|
m_waitingLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
m_watchingPushButton = new QPushButton(this);
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
|
||||||
|
m_watchingPushButton = buttonBox->addButton(tr("Start Watching"), QDialogButtonBox::ActionRole);
|
||||||
m_watchingPushButton->setCheckable(true);
|
m_watchingPushButton->setCheckable(true);
|
||||||
m_watchingPushButton->setChecked(false);
|
m_watchingPushButton->setChecked(false);
|
||||||
m_watchingPushButton->setEnabled(false);
|
m_watchingPushButton->setEnabled(false);
|
||||||
m_watchingPushButton->setText(tr("Start Watching"));
|
|
||||||
|
|
||||||
m_closePushButton = new QPushButton(this);
|
|
||||||
m_closePushButton->setText(tr("Close"));
|
|
||||||
|
|
||||||
QHBoxLayout *buttonsLine = new QHBoxLayout();
|
|
||||||
buttonsLine->addSpacerItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
|
||||||
buttonsLine->addWidget(m_watchingPushButton);
|
|
||||||
buttonsLine->addWidget(m_closePushButton);
|
|
||||||
|
|
||||||
QFormLayout *mainLayout = new QFormLayout(this);
|
QFormLayout *mainLayout = new QFormLayout(this);
|
||||||
mainLayout->addRow(new QLabel(tr("Kit: "), this), m_kitChooser);
|
mainLayout->addRow(new QLabel(tr("Kit: "), this), m_kitChooser);
|
||||||
@@ -145,7 +140,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
|
|||||||
mainLayout->addRow(m_continueOnAttachCheckBox);
|
mainLayout->addRow(m_continueOnAttachCheckBox);
|
||||||
mainLayout->addRow(m_waitingLabel);
|
mainLayout->addRow(m_waitingLabel);
|
||||||
mainLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
mainLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||||
mainLayout->addRow(buttonsLine);
|
mainLayout->addRow(buttonBox);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(m_pathChooser, &Utils::PathChooser::beforeBrowsing,
|
connect(m_pathChooser, &Utils::PathChooser::beforeBrowsing,
|
||||||
@@ -154,8 +149,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
|
|||||||
this, &UnstartedAppWatcherDialog::startStopWatching);
|
this, &UnstartedAppWatcherDialog::startStopWatching);
|
||||||
connect(m_pathChooser, &Utils::PathChooser::pathChanged, this,
|
connect(m_pathChooser, &Utils::PathChooser::pathChanged, this,
|
||||||
&UnstartedAppWatcherDialog::stopAndCheckExecutable);
|
&UnstartedAppWatcherDialog::stopAndCheckExecutable);
|
||||||
connect(m_closePushButton, &QAbstractButton::clicked,
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
this, &QDialog::reject);
|
|
||||||
connect(&m_timer, &QTimer::timeout,
|
connect(&m_timer, &QTimer::timeout,
|
||||||
this, &UnstartedAppWatcherDialog::findProcess);
|
this, &UnstartedAppWatcherDialog::findProcess);
|
||||||
connect(m_kitChooser, &KitChooser::currentIndexChanged,
|
connect(m_kitChooser, &KitChooser::currentIndexChanged,
|
||||||
@@ -165,6 +159,18 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
|
|||||||
setWaitingState(checkExecutableString() ? NotWatchingState : InvalidWacherState);
|
setWaitingState(checkExecutableString() ? NotWatchingState : InvalidWacherState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UnstartedAppWatcherDialog::event(QEvent *e)
|
||||||
|
{
|
||||||
|
if (e->type() == QEvent::ShortcutOverride) {
|
||||||
|
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
||||||
|
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||||
|
ke->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QDialog::event(e);
|
||||||
|
}
|
||||||
|
|
||||||
void UnstartedAppWatcherDialog::selectExecutable()
|
void UnstartedAppWatcherDialog::selectExecutable()
|
||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
|
@@ -64,6 +64,8 @@ public:
|
|||||||
bool continueOnAttach() const;
|
bool continueOnAttach() const;
|
||||||
void startWatching();
|
void startWatching();
|
||||||
|
|
||||||
|
bool event(QEvent *) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void processFound();
|
void processFound();
|
||||||
|
|
||||||
@@ -93,7 +95,6 @@ private:
|
|||||||
QCheckBox *m_hideOnAttachCheckBox;
|
QCheckBox *m_hideOnAttachCheckBox;
|
||||||
QCheckBox *m_continueOnAttachCheckBox;
|
QCheckBox *m_continueOnAttachCheckBox;
|
||||||
QPushButton *m_watchingPushButton;
|
QPushButton *m_watchingPushButton;
|
||||||
QPushButton *m_closePushButton;
|
|
||||||
ProjectExplorer::DeviceProcessItem m_process;
|
ProjectExplorer::DeviceProcessItem m_process;
|
||||||
QTimer m_timer;
|
QTimer m_timer;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user