Skip to content

Commit e76bd69

Browse files
committed
GUI: AttachDialog + HandlesView ActionRefresh Configuration
1 parent a7d7332 commit e76bd69

File tree

6 files changed

+264
-207
lines changed

6 files changed

+264
-207
lines changed

src/gui/Src/Gui/AttachDialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ AttachDialog::AttachDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Attach
1919

2020
// F5 as shortcut to refresh view
2121
mRefreshAction = new QAction(tr("Refresh"), this);
22-
mRefreshAction->setShortcut(QKeySequence("F5"));
22+
mRefreshAction->setShortcut(ConfigShortcut("ActionRefresh"));
23+
ui->btnRefresh->setText(tr("Refresh") + QString(" (%1)").arg(mRefreshAction->shortcut().toString()));
2324
connect(mRefreshAction, SIGNAL(triggered()), this, SLOT(refresh()));
2425
this->addAction(mRefreshAction);
2526
connect(ui->btnRefresh, SIGNAL(clicked()), this, SLOT(refresh()));

src/gui/Src/Gui/AttachDialog.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</sizepolicy>
8181
</property>
8282
<property name="text">
83-
<string>Refresh (F5)</string>
83+
<string>Refresh</string>
8484
</property>
8585
<property name="autoDefault">
8686
<bool>false</bool>

src/gui/Src/Gui/HandlesView.cpp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,25 @@ HandlesView::HandlesView(QWidget* parent) : QWidget(parent)
4242
this->setLayout(mVertLayout);
4343

4444
// Create the action list for the right click context menu
45-
mActionRefresh = new QAction(QIcon(":/images/arrow_restart.png"), tr("&Refresh"), this);
45+
mActionRefresh = new QAction(QIcon(":/icons/images/arrow-restart.png"), tr("&Refresh"), this);
4646
connect(mActionRefresh, SIGNAL(triggered()), this, SLOT(reloadData()));
47-
mActionCloseHandle = new QAction(QIcon(":/images/close-all-tabs.png"), tr("Close handle"), this);
47+
addAction(mActionRefresh);
48+
mActionCloseHandle = new QAction(QIcon(":/icons/images/close-all-tabs.png"), tr("Close handle"), this);
4849
connect(mActionCloseHandle, SIGNAL(triggered()), this, SLOT(closeHandleSlot()));
49-
mActionDisablePrivilege = new QAction(QIcon(":/images/close-all-tabs.png"), tr("Disable Privilege: "), this);
50+
mActionDisablePrivilege = new QAction(QIcon(":/icons/images/close-all-tabs.png"), tr("Disable Privilege: "), this);
5051
connect(mActionDisablePrivilege, SIGNAL(triggered()), this, SLOT(disablePrivilegeSlot()));
5152
mActionEnablePrivilege = new QAction(tr("Enable Privilege: "), this);
5253
connect(mActionEnablePrivilege, SIGNAL(triggered()), this, SLOT(enablePrivilegeSlot()));
53-
mActionDisableAllPrivileges = new QAction(QIcon(":/images/close-all-tabs.png"), tr("Disable all privileges"), this);
54+
mActionDisableAllPrivileges = new QAction(QIcon(":/icons/images/close-all-tabs.png"), tr("Disable all privileges"), this);
5455
connect(mActionDisableAllPrivileges, SIGNAL(triggered()), this, SLOT(disableAllPrivilegesSlot()));
5556
mActionEnableAllPrivileges = new QAction(tr("Enable all privileges"), this);
5657
connect(mActionEnableAllPrivileges, SIGNAL(triggered()), this, SLOT(enableAllPrivilegesSlot()));
5758

5859
connect(mHandlesTable, SIGNAL(contextMenuSignal(const QPoint &)), this, SLOT(handlesTableContextMenuSlot(const QPoint &)));
5960
connect(mTcpConnectionsTable, SIGNAL(contextMenuSignal(const QPoint &)), this, SLOT(tcpConnectionsTableContextMenuSlot(const QPoint &)));
6061
connect(mPrivilegesTable, SIGNAL(contextMenuSignal(const QPoint &)), this, SLOT(privilegesTableContextMenuSlot(const QPoint &)));
62+
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcuts()));
63+
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(dbgStateChanged(DBGSTATE)));
6164

6265
if(!IsWindowsVistaOrGreater())
6366
{
@@ -66,6 +69,7 @@ HandlesView::HandlesView(QWidget* parent) : QWidget(parent)
6669
mTcpConnectionsTable->reloadData();
6770
}
6871
reloadData();
72+
refreshShortcuts();
6973
}
7074

7175
void HandlesView::reloadData()
@@ -76,6 +80,26 @@ void HandlesView::reloadData()
7680
enumTcpConnections();
7781
enumPrivileges();
7882
}
83+
else
84+
{
85+
mHandlesTable->setRowCount(0);
86+
mHandlesTable->reloadData();
87+
mTcpConnectionsTable->setRowCount(0);
88+
mTcpConnectionsTable->reloadData();
89+
mPrivilegesTable->setRowCount(0);
90+
mPrivilegesTable->reloadData();
91+
}
92+
}
93+
94+
void HandlesView::refreshShortcuts()
95+
{
96+
mActionRefresh->setShortcut(ConfigShortcut("ActionRefresh"));
97+
}
98+
99+
void HandlesView::dbgStateChanged(DBGSTATE state)
100+
{
101+
if(state == stopped)
102+
reloadData();
79103
}
80104

81105
void HandlesView::handlesTableContextMenuSlot(const QPoint & pos)

src/gui/Src/Gui/HandlesView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class HandlesView : public QWidget
1313

1414
public slots:
1515
void reloadData();
16+
void refreshShortcuts();
17+
void dbgStateChanged(DBGSTATE state);
1618

1719
void handlesTableContextMenuSlot(const QPoint & pos);
1820
void tcpConnectionsTableContextMenuSlot(const QPoint & pos);

src/gui/Src/Utils/Configuration.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
329329
defaultShortcuts.insert("ActionStepScript", Shortcut(tr("Actions -> Step Script"), "Tab"));
330330
defaultShortcuts.insert("ActionAbortScript", Shortcut(tr("Actions -> Abort Script"), "Esc"));
331331
defaultShortcuts.insert("ActionExecuteCommandScript", Shortcut(tr("Actions -> Execute Script Command"), "X"));
332+
defaultShortcuts.insert("ActionRefresh", Shortcut(tr("Actions -> Refresh"), "F5"));
332333

333334
Shortcuts = defaultShortcuts;
334335

0 commit comments

Comments
 (0)