mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-30 16:25:04 +00:00
parent
6294343e6e
commit
65a668943a
@ -1351,6 +1351,7 @@ void MainWindow::setViewLayout(const CutterLayout &layout)
|
|||||||
dock->deserializeViewProperties({}); // call with empty properties to reset the widget
|
dock->deserializeViewProperties({}); // call with empty properties to reset the widget
|
||||||
newDocks.push_back(dock);
|
newDocks.push_back(dock);
|
||||||
}
|
}
|
||||||
|
dock->ignoreVisibilityStatus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDefault) {
|
if (!isDefault) {
|
||||||
@ -1373,6 +1374,10 @@ void MainWindow::setViewLayout(const CutterLayout &layout)
|
|||||||
showZenDocks();
|
showZenDocks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto dock : dockWidgets) {
|
||||||
|
dock->ignoreVisibilityStatus(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadLayouts(QSettings &settings)
|
void MainWindow::loadLayouts(QSettings &settings)
|
||||||
|
@ -43,6 +43,12 @@ void CutterDockWidget::deserializeViewProperties(const QVariantMap &)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CutterDockWidget::ignoreVisibilityStatus(bool ignore)
|
||||||
|
{
|
||||||
|
this->ignoreVisibility = ignore;
|
||||||
|
updateIsVisibleToUser();
|
||||||
|
}
|
||||||
|
|
||||||
void CutterDockWidget::toggleDockWidget(bool show)
|
void CutterDockWidget::toggleDockWidget(bool show)
|
||||||
{
|
{
|
||||||
if (!show) {
|
if (!show) {
|
||||||
@ -61,7 +67,7 @@ QWidget *CutterDockWidget::widgetToFocusOnRaise()
|
|||||||
void CutterDockWidget::updateIsVisibleToUser()
|
void CutterDockWidget::updateIsVisibleToUser()
|
||||||
{
|
{
|
||||||
// Check if the user can actually see the widget.
|
// Check if the user can actually see the widget.
|
||||||
bool visibleToUser = isVisible() && !visibleRegion().isEmpty();
|
bool visibleToUser = isVisible() && !visibleRegion().isEmpty() && !ignoreVisibility;
|
||||||
if (visibleToUser == isVisibleToUserCurrent) {
|
if (visibleToUser == isVisibleToUserCurrent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,12 @@ public:
|
|||||||
* @see CutterDockWidget#serializeViewProprties
|
* @see CutterDockWidget#serializeViewProprties
|
||||||
*/
|
*/
|
||||||
virtual void deserializeViewProperties(const QVariantMap &properties);
|
virtual void deserializeViewProperties(const QVariantMap &properties);
|
||||||
|
/**
|
||||||
|
* @brief Ignore visibility status.
|
||||||
|
* Useful for temporary ignoring visibility changes while this information is unreliable.
|
||||||
|
* @param ignored - set to true for enabling ignoring mode
|
||||||
|
*/
|
||||||
|
void ignoreVisibilityStatus(bool ignored);
|
||||||
signals:
|
signals:
|
||||||
void becameVisibleToUser();
|
void becameVisibleToUser();
|
||||||
void closed();
|
void closed();
|
||||||
@ -105,6 +111,7 @@ private:
|
|||||||
bool isTransient = false;
|
bool isTransient = false;
|
||||||
|
|
||||||
bool isVisibleToUserCurrent = false;
|
bool isVisibleToUserCurrent = false;
|
||||||
|
bool ignoreVisibility = false;
|
||||||
void updateIsVisibleToUser();
|
void updateIsVisibleToUser();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,21 +19,36 @@ R2GraphWidget::R2GraphWidget(MainWindow *main)
|
|||||||
QChar commandChar;
|
QChar commandChar;
|
||||||
QString label;
|
QString label;
|
||||||
} types[] = {
|
} types[] = {
|
||||||
{'a', tr("aga - Data reference graph")},
|
{'a', tr("Data reference graph (aga)")},
|
||||||
{'A', tr("agA - Global data references graph")},
|
{'A', tr("Global data references graph (agA)")},
|
||||||
// {'c', tr("c - Function callgraph")},
|
// {'c', tr("c - Function callgraph")},
|
||||||
// {'C', tr("C - Global callgraph")},
|
// {'C', tr("C - Global callgraph")},
|
||||||
// {'f', tr("f - Basic blocks function graph")},
|
// {'f', tr("f - Basic blocks function graph")},
|
||||||
{'i', tr("agi - Imports graph")},
|
{'i', tr("Imports graph (agi)")},
|
||||||
{'r', tr("agr - References graph")},
|
{'r', tr("References graph (agr)")},
|
||||||
{'R', tr("agR - Global references graph")},
|
{'R', tr("Global references graph (agR)")},
|
||||||
{'x', tr("agx - Cross references graph")},
|
{'x', tr("Cross references graph (agx)")},
|
||||||
{'g', tr("agg - Custom graph")},
|
{'g', tr("Custom graph (agg)")},
|
||||||
|
{' ', tr("User command")},
|
||||||
};
|
};
|
||||||
for (auto &graphType : types) {
|
for (auto &graphType : types) {
|
||||||
ui->graphType->addItem(graphType.label, graphType.commandChar);
|
if (graphType.commandChar != ' ') {
|
||||||
|
ui->graphType->addItem(graphType.label, graphType.commandChar);
|
||||||
|
} else {
|
||||||
|
ui->graphType->addItem(graphType.label, QVariant());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
connect(ui->graphType, &QComboBox::currentTextChanged, this, &R2GraphWidget::typeChanged);
|
connect<void(QComboBox::*)(int)>(ui->graphType, &QComboBox::currentIndexChanged, this, &R2GraphWidget::typeChanged);
|
||||||
|
connect(ui->customCommand, &QLineEdit::textEdited, this, [this](){
|
||||||
|
graphView->setGraphCommand(ui->customCommand->text());
|
||||||
|
});
|
||||||
|
connect(ui->customCommand, &QLineEdit::returnPressed, this, [this](){
|
||||||
|
graphView->setGraphCommand(ui->customCommand->text());
|
||||||
|
graphView->refreshView();
|
||||||
|
});
|
||||||
|
ui->customCommand->hide();
|
||||||
|
typeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
R2GraphWidget::~R2GraphWidget()
|
R2GraphWidget::~R2GraphWidget()
|
||||||
@ -44,10 +59,14 @@ void R2GraphWidget::typeChanged()
|
|||||||
{
|
{
|
||||||
auto currentData = ui->graphType->currentData();
|
auto currentData = ui->graphType->currentData();
|
||||||
if (currentData.isNull()) {
|
if (currentData.isNull()) {
|
||||||
graphView->setGraphCommand(ui->graphType->currentText());
|
ui->customCommand->setVisible(true);
|
||||||
|
graphView->setGraphCommand(ui->customCommand->text());
|
||||||
|
ui->customCommand->setFocus();
|
||||||
} else {
|
} else {
|
||||||
|
ui->customCommand->setVisible(false);
|
||||||
auto command = QString("ag%1").arg(currentData.toChar());
|
auto command = QString("ag%1").arg(currentData.toChar());
|
||||||
graphView->setGraphCommand(command);
|
graphView->setGraphCommand(command);
|
||||||
|
graphView->refreshView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,38 +29,69 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>ag</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="graphType">
|
<widget class="QComboBox" name="graphType">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="customCommand">
|
||||||
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>ag...</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="refreshButton">
|
<widget class="QPushButton" name="refreshButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Refresh</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources.qrc">
|
||||||
|
<normaloff>:/img/icons/arrow_right.svg</normaloff>:/img/icons/arrow_right.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../resources.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user