mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
Add dir.projects cutter setting (#416)
This commit is contained in:
parent
0ecc0ed113
commit
87ee023235
@ -98,7 +98,8 @@ void NewFileDialog::on_selectProjectsDirButton_clicked()
|
||||
QFileDialog dialog(this);
|
||||
dialog.setFileMode(QFileDialog::DirectoryOnly);
|
||||
|
||||
QString currentDir = CutterCore::getInstance()->getConfig("dir.projects");
|
||||
auto currentDir = Config()->getDirProjects();
|
||||
|
||||
if (currentDir.startsWith("~")) {
|
||||
currentDir = QDir::homePath() + currentDir.mid(1);
|
||||
}
|
||||
@ -112,7 +113,7 @@ void NewFileDialog::on_selectProjectsDirButton_clicked()
|
||||
|
||||
QString dir = dialog.selectedFiles().first();
|
||||
if (!dir.isEmpty()) {
|
||||
CutterCore::getInstance()->setConfig("dir.projects", dir);
|
||||
Config()->setDirProjects(dir);
|
||||
fillProjectsList();
|
||||
}
|
||||
}
|
||||
@ -161,6 +162,9 @@ void NewFileDialog::on_actionRemove_item_triggered()
|
||||
// Remove selected item from recents list
|
||||
QListWidgetItem *item = ui->recentsListWidget->currentItem();
|
||||
|
||||
if (item == nullptr)
|
||||
return;
|
||||
|
||||
QVariant data = item->data(Qt::UserRole);
|
||||
QString sitem = data.toString();
|
||||
|
||||
@ -251,7 +255,9 @@ bool NewFileDialog::fillProjectsList()
|
||||
{
|
||||
CutterCore *core = CutterCore::getInstance();
|
||||
|
||||
ui->projectsDirEdit->setText(core->getConfig("dir.projects"));
|
||||
auto currentDir = Config()->getDirProjects();
|
||||
|
||||
ui->projectsDirEdit->setText(currentDir);
|
||||
|
||||
QStringList projects = core->getProjectNames();
|
||||
projects.sort(Qt::CaseInsensitive);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "SaveProjectDialog.h"
|
||||
#include "ui_SaveProjectDialog.h"
|
||||
#include "utils/TempConfig.h"
|
||||
#include "utils/Configuration.h"
|
||||
|
||||
SaveProjectDialog::SaveProjectDialog(bool quit, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@ -24,7 +25,7 @@ SaveProjectDialog::SaveProjectDialog(bool quit, QWidget *parent) :
|
||||
}
|
||||
|
||||
ui->nameEdit->setText(core->getConfig("prj.name"));
|
||||
ui->projectsDirEdit->setText(core->getConfig("dir.projects"));
|
||||
ui->projectsDirEdit->setText(Config()->getDirProjects());
|
||||
ui->simpleCheckBox->setChecked(core->getConfigb("prj.simple"));
|
||||
ui->filesCheckBox->setChecked(core->getConfigb("prj.files"));
|
||||
ui->gitCheckBox->setChecked(core->getConfigb("prj.git"));
|
||||
|
@ -58,6 +58,23 @@ void Configuration::loadInitial()
|
||||
applySavedAsmOptions();
|
||||
}
|
||||
|
||||
QString Configuration::getDirProjects()
|
||||
{
|
||||
auto projectsDir = s.value("dir.projects").toString();
|
||||
if (projectsDir == "") {
|
||||
projectsDir = Core()->getConfig("dir.projects");
|
||||
setDirProjects(projectsDir);
|
||||
}
|
||||
|
||||
return projectsDir;
|
||||
}
|
||||
|
||||
void Configuration::setDirProjects(const QString &dir)
|
||||
{
|
||||
Core()->setConfig("dir.projects", dir);
|
||||
s.setValue("dir.projects", dir);
|
||||
}
|
||||
|
||||
void Configuration::resetAll()
|
||||
{
|
||||
Core()->cmd("e-");
|
||||
|
@ -47,6 +47,9 @@ public:
|
||||
return s.value("dark").toBool();
|
||||
}
|
||||
|
||||
QString getDirProjects();
|
||||
void setDirProjects(const QString& dir);
|
||||
|
||||
// Images
|
||||
QString getLogoFile();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user