mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-20 13:46:06 +00:00
Remember last selected Decompiler
This commit is contained in:
parent
26dce4c7b9
commit
dee24b861d
@ -642,3 +642,13 @@ QStringList Configuration::getTranslationsDirectories() const
|
||||
#endif // Q_OS_MAC
|
||||
};
|
||||
}
|
||||
|
||||
QString Configuration::getSelectedDecompiler()
|
||||
{
|
||||
return s.value("selectedDecompiler").toString();
|
||||
}
|
||||
|
||||
void Configuration::setSelectedDecompiler(const QString &id)
|
||||
{
|
||||
s.setValue("selectedDecompiler", id);
|
||||
}
|
||||
|
@ -148,6 +148,12 @@ public:
|
||||
*/
|
||||
QStringList getTranslationsDirectories() const;
|
||||
|
||||
/**
|
||||
* @return id of the last selected decompiler (see CutterCore::getDecompilerById)
|
||||
*/
|
||||
QString getSelectedDecompiler();
|
||||
void setSelectedDecompiler(const QString &id);
|
||||
|
||||
signals:
|
||||
void fontsUpdated();
|
||||
void colorsUpdated();
|
||||
|
@ -60,8 +60,12 @@ PseudocodeWidget::PseudocodeWidget(MainWindow *main, QAction *action) :
|
||||
});
|
||||
|
||||
auto decompilers = Core()->getDecompilers();
|
||||
auto selectedDecompilerId = Config()->getSelectedDecompiler();
|
||||
for (auto dec : decompilers) {
|
||||
ui->decompilerComboBox->addItem(dec->getName(), dec->getId());
|
||||
if (dec->getId() == selectedDecompilerId) {
|
||||
ui->decompilerComboBox->setCurrentIndex(ui->decompilerComboBox->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(decompilers.size() <= 1) {
|
||||
@ -71,6 +75,7 @@ PseudocodeWidget::PseudocodeWidget(MainWindow *main, QAction *action) :
|
||||
}
|
||||
}
|
||||
|
||||
connect(ui->decompilerComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &PseudocodeWidget::decompilerSelected);
|
||||
connectCursorPositionChanged(false);
|
||||
connect(Core(), &CutterCore::seekChanged, this, &PseudocodeWidget::seekChanged);
|
||||
|
||||
@ -124,6 +129,11 @@ void PseudocodeWidget::refreshPseudocode()
|
||||
doRefresh(Core()->getOffset());
|
||||
}
|
||||
|
||||
void PseudocodeWidget::decompilerSelected()
|
||||
{
|
||||
Configuration().setSelectedDecompiler(ui->decompilerComboBox->currentData().toString());
|
||||
}
|
||||
|
||||
void PseudocodeWidget::connectCursorPositionChanged(bool disconnect)
|
||||
{
|
||||
if (disconnect) {
|
||||
|
@ -27,6 +27,7 @@ private slots:
|
||||
void fontsUpdated();
|
||||
void colorsUpdatedSlot();
|
||||
void refreshPseudocode();
|
||||
void decompilerSelected();
|
||||
void cursorPositionChanged();
|
||||
void seekChanged();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user