diff --git a/src/widgets/ClassesWidget.cpp b/src/widgets/ClassesWidget.cpp index d115b5e3..ad66a347 100644 --- a/src/widgets/ClassesWidget.cpp +++ b/src/widgets/ClassesWidget.cpp @@ -254,14 +254,38 @@ ClassesWidget::ClassesWidget(QWidget *parent) : ui->classesTreeView->sortByColumn(ClassesModel::TYPE, Qt::AscendingOrder); 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::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() { model->beginReload(); - classes = CutterCore::getInstance()->getAllClassesFromBin(); + classes = getSource() == Source::BIN + ? CutterCore::getInstance()->getAllClassesFromBin() + : CutterCore::getInstance()->getAllClassesFromFlags(); model->endReload(); ui->classesTreeView->resizeColumnToContents(0); diff --git a/src/widgets/ClassesWidget.h b/src/widgets/ClassesWidget.h index 9a21f230..30fccfba 100644 --- a/src/widgets/ClassesWidget.h +++ b/src/widgets/ClassesWidget.h @@ -77,8 +77,13 @@ private slots: void on_classesTreeView_doubleClicked(const QModelIndex &index); void refreshClasses(); + void flagsChanged(); private: + enum class Source { BIN, FLAGS }; + + Source getSource(); + std::unique_ptr ui; ClassesModel *model; diff --git a/src/widgets/ClassesWidget.ui b/src/widgets/ClassesWidget.ui index 39ac92df..b4161f84 100644 --- a/src/widgets/ClassesWidget.ui +++ b/src/widgets/ClassesWidget.ui @@ -15,6 +15,9 @@ + + 0 + 0 @@ -50,6 +53,55 @@ + + + + 10 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Source: + + + + + + + + 0 + 0 + + + + + Binary Info (Fixed) + + + + + Flags (Editable) + + + + + +