mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Merge pull request #444 from lvntky/feat-copy-value
Feat: add copy value only option on logger and tracker
This commit is contained in:
@@ -338,11 +338,11 @@ void SeerVariableLoggerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
structVisualizerMenu.addAction(addStructAmpersandVisualizerAction);
|
||||
menu.addMenu(&structVisualizerMenu);
|
||||
|
||||
QAction* deleteAction = menu.addAction("Delete selected");
|
||||
QAction* deleteAllAction = menu.addAction("Delete all");
|
||||
|
||||
QAction* copyAction = menu.addAction("Copy selected");
|
||||
QAction* copyAllAction = menu.addAction("Copy all");
|
||||
QAction* deleteAction = menu.addAction("Delete selected");
|
||||
QAction* deleteAllAction = menu.addAction("Delete all");
|
||||
QAction* copyAction = menu.addAction("Copy selected");
|
||||
QAction* copyValueOnlyAction = menu.addAction("Copy selected value");
|
||||
QAction* copyAllAction = menu.addAction("Copy all");
|
||||
|
||||
QString actionText;
|
||||
if (item != 0) {
|
||||
@@ -360,6 +360,9 @@ void SeerVariableLoggerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove potential '&' and '*' characters at start of string.
|
||||
variable.remove(QRegularExpression("^[\\*\\&]*"));
|
||||
|
||||
addMemoryVisualizerAction->setText(QString("\"%1\"").arg(actionText));
|
||||
addMemoryAsteriskVisualizerAction->setText(QString("\"*%1\"").arg(actionText));
|
||||
addMemoryAmpersandVisualizerAction->setText(QString("\"&&%1\"").arg(actionText));
|
||||
@@ -399,12 +402,12 @@ void SeerVariableLoggerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
handleDeleteAllToolButton();
|
||||
}
|
||||
|
||||
if (action == copyAction || action == copyAllAction) {
|
||||
if (action == copyAction || action == copyAllAction || action == copyValueOnlyAction) {
|
||||
// Get selected tree items.
|
||||
QList<QTreeWidgetItem*> items;
|
||||
|
||||
// Get list of 'select' items.
|
||||
if (action == copyAction) {
|
||||
if (action == copyAction || action == copyValueOnlyAction) {
|
||||
items = variablesTreeWidget->selectedItems();
|
||||
}
|
||||
|
||||
@@ -428,7 +431,11 @@ void SeerVariableLoggerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
text += '\n';
|
||||
}
|
||||
|
||||
text += items[i]->text(1) + ":" + items[i]->text(2);
|
||||
if (action != copyValueOnlyAction) {
|
||||
text += items[i]->text(1) + ":" + items[i]->text(2);
|
||||
} else {
|
||||
text += items[i]->text(2);
|
||||
}
|
||||
}
|
||||
|
||||
clipboard->setText(text, QClipboard::Clipboard);
|
||||
|
||||
@@ -500,7 +500,7 @@ void SeerVariableTrackerBrowserWidget::handleItemCreate (QTreeWidgetItem* parent
|
||||
for (int i = 0; i < nv_pairs.size(); ++i) {
|
||||
QString nv = nv_pairs[i];
|
||||
QString nv_old = nv_old_pairs[i];
|
||||
|
||||
|
||||
QStringPair pair = Seer::parseNameValue(nv, '=');
|
||||
QStringPair old_pair = Seer::parseNameValue(nv_old, '=');
|
||||
// Look for the existing child, if any so we can reuse it.
|
||||
@@ -586,11 +586,11 @@ void SeerVariableTrackerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
structVisualizerMenu.addAction(addStructAmpersandVisualizerAction);
|
||||
menu.addMenu(&structVisualizerMenu);
|
||||
|
||||
QAction* deleteAction = menu.addAction("Delete selected");
|
||||
QAction* deleteAllAction = menu.addAction("Delete all");
|
||||
|
||||
QAction* copyAction = menu.addAction("Copy selected");
|
||||
QAction* copyAllAction = menu.addAction("Copy all");
|
||||
QAction* deleteAction = menu.addAction("Delete selected");
|
||||
QAction* deleteAllAction = menu.addAction("Delete all");
|
||||
QAction* copyAction = menu.addAction("Copy selected");
|
||||
QAction* copyValueOnlyAction = menu.addAction("Copy selected value");
|
||||
QAction* copyAllAction = menu.addAction("Copy all");
|
||||
|
||||
QString actionText;
|
||||
if (item != 0) {
|
||||
@@ -608,6 +608,9 @@ void SeerVariableTrackerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove potential '&' and '*' characters at start of string.
|
||||
variable.remove(QRegularExpression("^[\\*\\&]*"));
|
||||
|
||||
addMemoryVisualizerAction->setText(QString("\"%1\"").arg(actionText));
|
||||
addMemoryAsteriskVisualizerAction->setText(QString("\"*%1\"").arg(actionText));
|
||||
addMemoryAmpersandVisualizerAction->setText(QString("\"&&%1\"").arg(actionText));
|
||||
@@ -646,12 +649,12 @@ void SeerVariableTrackerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
handleDeleteAllToolButton();
|
||||
}
|
||||
|
||||
if (action == copyAction || action == copyAllAction) {
|
||||
if (action == copyAction || action == copyAllAction || action == copyValueOnlyAction) {
|
||||
// Get selected tree items.
|
||||
QList<QTreeWidgetItem*> items;
|
||||
|
||||
// Get list of 'select' items.
|
||||
if (action == copyAction) {
|
||||
if (action == copyAction || copyValueOnlyAction) {
|
||||
items = variablesTreeWidget->selectedItems();
|
||||
}
|
||||
|
||||
@@ -675,7 +678,11 @@ void SeerVariableTrackerBrowserWidget::handleContextMenu (const QPoint& pos) {
|
||||
text += '\n';
|
||||
}
|
||||
|
||||
text += items[i]->text(0) + ":" + items[i]->text(1);
|
||||
if (action != copyValueOnlyAction) {
|
||||
text += items[i]->text(0) + ":" + items[i]->text(1);
|
||||
} else {
|
||||
text += items[i]->text(1);
|
||||
}
|
||||
}
|
||||
|
||||
clipboard->setText(text, QClipboard::Clipboard);
|
||||
|
||||
Reference in New Issue
Block a user