mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 05:45:27 +00:00
Add Flags Source to ClassesWidget
This commit is contained in:
parent
03da92ac24
commit
6b7a5c9227
@ -254,14 +254,38 @@ ClassesWidget::ClassesWidget(QWidget *parent) :
|
|||||||
ui->classesTreeView->sortByColumn(ClassesModel::TYPE, Qt::AscendingOrder);
|
ui->classesTreeView->sortByColumn(ClassesModel::TYPE, Qt::AscendingOrder);
|
||||||
|
|
||||||
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshClasses()));
|
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshClasses()));
|
||||||
|
connect(Core(), SIGNAL(flagsChanged()), this, SLOT(flagsChanged()));
|
||||||
|
connect(ui->classSourceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshClasses()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassesWidget::~ClassesWidget() {}
|
ClassesWidget::~ClassesWidget() {}
|
||||||
|
|
||||||
|
ClassesWidget::Source ClassesWidget::getSource()
|
||||||
|
{
|
||||||
|
if (ui->classSourceCombo->currentIndex() == 1)
|
||||||
|
{
|
||||||
|
return Source::FLAGS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Source::BIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClassesWidget::flagsChanged()
|
||||||
|
{
|
||||||
|
if (getSource() == Source::FLAGS)
|
||||||
|
{
|
||||||
|
refreshClasses();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ClassesWidget::refreshClasses()
|
void ClassesWidget::refreshClasses()
|
||||||
{
|
{
|
||||||
model->beginReload();
|
model->beginReload();
|
||||||
classes = CutterCore::getInstance()->getAllClassesFromBin();
|
classes = getSource() == Source::BIN
|
||||||
|
? CutterCore::getInstance()->getAllClassesFromBin()
|
||||||
|
: CutterCore::getInstance()->getAllClassesFromFlags();
|
||||||
model->endReload();
|
model->endReload();
|
||||||
|
|
||||||
ui->classesTreeView->resizeColumnToContents(0);
|
ui->classesTreeView->resizeColumnToContents(0);
|
||||||
|
@ -77,8 +77,13 @@ private slots:
|
|||||||
void on_classesTreeView_doubleClicked(const QModelIndex &index);
|
void on_classesTreeView_doubleClicked(const QModelIndex &index);
|
||||||
|
|
||||||
void refreshClasses();
|
void refreshClasses();
|
||||||
|
void flagsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum class Source { BIN, FLAGS };
|
||||||
|
|
||||||
|
Source getSource();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ClassesWidget> ui;
|
std::unique_ptr<Ui::ClassesWidget> ui;
|
||||||
|
|
||||||
ClassesModel *model;
|
ClassesModel *model;
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -50,6 +53,55 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="classSourceLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Source:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="classSourceCombo">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Binary Info (Fixed)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Flags (Editable)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user