mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Save last clicked tab in NewFileDialog
This commit is contained in:
parent
c0fe9e2c3f
commit
b222aaa094
@ -63,9 +63,8 @@ NewFileDialog::NewFileDialog(QWidget *parent) :
|
||||
ui->logoSvgWidget->load(Config()->getLogoFile());
|
||||
|
||||
fillRecentFilesList();
|
||||
bool projectsExist = fillProjectsList();
|
||||
|
||||
if (projectsExist) {
|
||||
if (Config()->getNewFileLastClicked() == TAB_PROJECTS) {
|
||||
ui->tabWidget->setCurrentWidget(ui->projectsTab);
|
||||
} else {
|
||||
ui->tabWidget->setCurrentWidget(ui->filesTab);
|
||||
@ -340,3 +339,8 @@ void NewFileDialog::loadProject(const QString &project)
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void NewFileDialog::on_tabWidget_currentChanged(int index)
|
||||
{
|
||||
Config()->setNewFileLastClicked(index);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ class NewFileDialog : public QDialog
|
||||
public:
|
||||
explicit NewFileDialog(QWidget *parent = nullptr);
|
||||
~NewFileDialog();
|
||||
enum newFileTabs { TAB_FILES = 0, TAB_PROJECTS };
|
||||
|
||||
private slots:
|
||||
void on_loadFileButton_clicked();
|
||||
@ -36,6 +37,8 @@ private slots:
|
||||
void on_actionClear_all_triggered();
|
||||
void on_actionRemove_project_triggered();
|
||||
|
||||
void on_tabWidget_currentChanged(int index);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
|
@ -74,6 +74,21 @@ void Configuration::setDirProjects(const QString &dir)
|
||||
s.setValue("dir.projects", dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configuration::setFilesTabLastClicked
|
||||
* Set the new file dialog last clicked tab
|
||||
* @param lastClicked
|
||||
*/
|
||||
void Configuration::setNewFileLastClicked(int lastClicked)
|
||||
{
|
||||
s.setValue("newFileLastClicked", lastClicked);
|
||||
}
|
||||
|
||||
int Configuration::getNewFileLastClicked()
|
||||
{
|
||||
return s.value("newFileLastClicked").toInt();
|
||||
}
|
||||
|
||||
void Configuration::resetAll()
|
||||
{
|
||||
Core()->cmd("e-");
|
||||
@ -292,6 +307,12 @@ QString Configuration::getConfigString(const QString &key)
|
||||
return getConfigVar(key).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configuration::setConfig
|
||||
* Set radare2 configuration value (e.g. "asm.lines")
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
void Configuration::setConfig(const QString &key, const QVariant &value)
|
||||
{
|
||||
if (asmOptions.contains(key)) {
|
||||
|
@ -51,6 +51,9 @@ public:
|
||||
QString getDirProjects();
|
||||
void setDirProjects(const QString& dir);
|
||||
|
||||
void setNewFileLastClicked(int lastClicked);
|
||||
int getNewFileLastClicked();
|
||||
|
||||
// Images
|
||||
QString getLogoFile();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user