mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-21 14:16:08 +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
|
#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;
|
QStringList getTranslationsDirectories() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return id of the last selected decompiler (see CutterCore::getDecompilerById)
|
||||||
|
*/
|
||||||
|
QString getSelectedDecompiler();
|
||||||
|
void setSelectedDecompiler(const QString &id);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fontsUpdated();
|
void fontsUpdated();
|
||||||
void colorsUpdated();
|
void colorsUpdated();
|
||||||
|
@ -60,8 +60,12 @@ PseudocodeWidget::PseudocodeWidget(MainWindow *main, QAction *action) :
|
|||||||
});
|
});
|
||||||
|
|
||||||
auto decompilers = Core()->getDecompilers();
|
auto decompilers = Core()->getDecompilers();
|
||||||
|
auto selectedDecompilerId = Config()->getSelectedDecompiler();
|
||||||
for (auto dec : decompilers) {
|
for (auto dec : decompilers) {
|
||||||
ui->decompilerComboBox->addItem(dec->getName(), dec->getId());
|
ui->decompilerComboBox->addItem(dec->getName(), dec->getId());
|
||||||
|
if (dec->getId() == selectedDecompilerId) {
|
||||||
|
ui->decompilerComboBox->setCurrentIndex(ui->decompilerComboBox->count() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(decompilers.size() <= 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);
|
connectCursorPositionChanged(false);
|
||||||
connect(Core(), &CutterCore::seekChanged, this, &PseudocodeWidget::seekChanged);
|
connect(Core(), &CutterCore::seekChanged, this, &PseudocodeWidget::seekChanged);
|
||||||
|
|
||||||
@ -124,6 +129,11 @@ void PseudocodeWidget::refreshPseudocode()
|
|||||||
doRefresh(Core()->getOffset());
|
doRefresh(Core()->getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PseudocodeWidget::decompilerSelected()
|
||||||
|
{
|
||||||
|
Configuration().setSelectedDecompiler(ui->decompilerComboBox->currentData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
void PseudocodeWidget::connectCursorPositionChanged(bool disconnect)
|
void PseudocodeWidget::connectCursorPositionChanged(bool disconnect)
|
||||||
{
|
{
|
||||||
if (disconnect) {
|
if (disconnect) {
|
||||||
|
@ -27,6 +27,7 @@ private slots:
|
|||||||
void fontsUpdated();
|
void fontsUpdated();
|
||||||
void colorsUpdatedSlot();
|
void colorsUpdatedSlot();
|
||||||
void refreshPseudocode();
|
void refreshPseudocode();
|
||||||
|
void decompilerSelected();
|
||||||
void cursorPositionChanged();
|
void cursorPositionChanged();
|
||||||
void seekChanged();
|
void seekChanged();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user