mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 02:25:26 +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
|
||||
newDocks.push_back(dock);
|
||||
}
|
||||
dock->ignoreVisibilityStatus(true);
|
||||
}
|
||||
|
||||
if (!isDefault) {
|
||||
@ -1373,6 +1374,10 @@ void MainWindow::setViewLayout(const CutterLayout &layout)
|
||||
showZenDocks();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto dock : dockWidgets) {
|
||||
dock->ignoreVisibilityStatus(false);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (!show) {
|
||||
@ -61,7 +67,7 @@ QWidget *CutterDockWidget::widgetToFocusOnRaise()
|
||||
void CutterDockWidget::updateIsVisibleToUser()
|
||||
{
|
||||
// Check if the user can actually see the widget.
|
||||
bool visibleToUser = isVisible() && !visibleRegion().isEmpty();
|
||||
bool visibleToUser = isVisible() && !visibleRegion().isEmpty() && !ignoreVisibility;
|
||||
if (visibleToUser == isVisibleToUserCurrent) {
|
||||
return;
|
||||
}
|
||||
|
@ -86,6 +86,12 @@ public:
|
||||
* @see CutterDockWidget#serializeViewProprties
|
||||
*/
|
||||
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:
|
||||
void becameVisibleToUser();
|
||||
void closed();
|
||||
@ -105,6 +111,7 @@ private:
|
||||
bool isTransient = false;
|
||||
|
||||
bool isVisibleToUserCurrent = false;
|
||||
bool ignoreVisibility = false;
|
||||
void updateIsVisibleToUser();
|
||||
};
|
||||
|
||||
|
@ -19,21 +19,36 @@ R2GraphWidget::R2GraphWidget(MainWindow *main)
|
||||
QChar commandChar;
|
||||
QString label;
|
||||
} types[] = {
|
||||
{'a', tr("aga - Data reference graph")},
|
||||
{'A', tr("agA - Global data references graph")},
|
||||
{'a', tr("Data reference graph (aga)")},
|
||||
{'A', tr("Global data references graph (agA)")},
|
||||
// {'c', tr("c - Function callgraph")},
|
||||
// {'C', tr("C - Global callgraph")},
|
||||
// {'f', tr("f - Basic blocks function graph")},
|
||||
{'i', tr("agi - Imports graph")},
|
||||
{'r', tr("agr - References graph")},
|
||||
{'R', tr("agR - Global references graph")},
|
||||
{'x', tr("agx - Cross references graph")},
|
||||
{'g', tr("agg - Custom graph")},
|
||||
{'i', tr("Imports graph (agi)")},
|
||||
{'r', tr("References graph (agr)")},
|
||||
{'R', tr("Global references graph (agR)")},
|
||||
{'x', tr("Cross references graph (agx)")},
|
||||
{'g', tr("Custom graph (agg)")},
|
||||
{' ', tr("User command")},
|
||||
};
|
||||
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()
|
||||
@ -44,10 +59,14 @@ void R2GraphWidget::typeChanged()
|
||||
{
|
||||
auto currentData = ui->graphType->currentData();
|
||||
if (currentData.isNull()) {
|
||||
graphView->setGraphCommand(ui->graphType->currentText());
|
||||
ui->customCommand->setVisible(true);
|
||||
graphView->setGraphCommand(ui->customCommand->text());
|
||||
ui->customCommand->setFocus();
|
||||
} else {
|
||||
ui->customCommand->setVisible(false);
|
||||
auto command = QString("ag%1").arg(currentData.toChar());
|
||||
graphView->setGraphCommand(command);
|
||||
graphView->refreshView();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,38 +29,69 @@
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>ag</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="graphType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="customCommand">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</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>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="refreshButton">
|
||||
<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>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user