- fix: Project options -> file doesn't work.
This commit is contained in:
parent
ec43e4634d
commit
ccfb786f74
|
@ -177,7 +177,6 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet
|
||||||
|
|
||||||
void CompilerSetOptionWidget::doLoad()
|
void CompilerSetOptionWidget::doLoad()
|
||||||
{
|
{
|
||||||
disconnectInputs();
|
|
||||||
ui->cbCompilerSet->clear();
|
ui->cbCompilerSet->clear();
|
||||||
if (pSettings->compilerSets().size()<=0) {
|
if (pSettings->compilerSets().size()<=0) {
|
||||||
ui->btnRenameCompilerSet->setEnabled(false);
|
ui->btnRenameCompilerSet->setEnabled(false);
|
||||||
|
@ -196,7 +195,6 @@ void CompilerSetOptionWidget::doLoad()
|
||||||
}
|
}
|
||||||
ui->cbCompilerSet->setCurrentIndex(index);
|
ui->cbCompilerSet->setCurrentIndex(index);
|
||||||
reloadCurrentCompilerSet();
|
reloadCurrentCompilerSet();
|
||||||
connectInputs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerSetOptionWidget::doSave()
|
void CompilerSetOptionWidget::doSave()
|
||||||
|
|
|
@ -26,7 +26,6 @@ ProjectCompilerWidget::ProjectCompilerWidget(const QString &name, const QString
|
||||||
SettingsWidget(name,group,parent),
|
SettingsWidget(name,group,parent),
|
||||||
ui(new Ui::ProjectCompilerWidget)
|
ui(new Ui::ProjectCompilerWidget)
|
||||||
{
|
{
|
||||||
mInitialized=false;
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +75,12 @@ void ProjectCompilerWidget::refreshOptions()
|
||||||
void ProjectCompilerWidget::doLoad()
|
void ProjectCompilerWidget::doLoad()
|
||||||
{
|
{
|
||||||
mOptions = pMainWindow->project()->options().compilerOptions;
|
mOptions = pMainWindow->project()->options().compilerOptions;
|
||||||
|
ui->cbCompilerSet->blockSignals(true);
|
||||||
ui->cbCompilerSet->setCurrentIndex(pMainWindow->project()->options().compilerSet);
|
ui->cbCompilerSet->setCurrentIndex(pMainWindow->project()->options().compilerSet);
|
||||||
|
ui->cbCompilerSet->blockSignals(false);
|
||||||
ui->chkAddCharset->setChecked(pMainWindow->project()->options().addCharset);
|
ui->chkAddCharset->setChecked(pMainWindow->project()->options().addCharset);
|
||||||
ui->chkStaticLink->setChecked(pMainWindow->project()->options().staticLink);
|
ui->chkStaticLink->setChecked(pMainWindow->project()->options().staticLink);
|
||||||
mInitialized=true;
|
refreshOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectCompilerWidget::doSave()
|
void ProjectCompilerWidget::doSave()
|
||||||
|
@ -87,7 +88,6 @@ void ProjectCompilerWidget::doSave()
|
||||||
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
|
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
|
||||||
if (!pSet)
|
if (!pSet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
|
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
|
||||||
pMainWindow->project()->options().compilerOptions = ui->tabOptions->arguments(true);
|
pMainWindow->project()->options().compilerOptions = ui->tabOptions->arguments(true);
|
||||||
if (pSet->compilerType()!=CompilerType::Clang)
|
if (pSet->compilerType()!=CompilerType::Clang)
|
||||||
|
@ -104,10 +104,12 @@ void ProjectCompilerWidget::doSave()
|
||||||
|
|
||||||
void ProjectCompilerWidget::init()
|
void ProjectCompilerWidget::init()
|
||||||
{
|
{
|
||||||
|
ui->cbCompilerSet->blockSignals(true);
|
||||||
ui->cbCompilerSet->clear();
|
ui->cbCompilerSet->clear();
|
||||||
for (size_t i=0;i<pSettings->compilerSets().size();i++) {
|
for (size_t i=0;i<pSettings->compilerSets().size();i++) {
|
||||||
ui->cbCompilerSet->addItem(pSettings->compilerSets().getSet(i)->name());
|
ui->cbCompilerSet->addItem(pSettings->compilerSets().getSet(i)->name());
|
||||||
}
|
}
|
||||||
|
ui->cbCompilerSet->blockSignals(false);
|
||||||
ui->cbEncodingDetails->setVisible(false);
|
ui->cbEncodingDetails->setVisible(false);
|
||||||
ui->cbEncoding->clear();
|
ui->cbEncoding->clear();
|
||||||
ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT);
|
ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT);
|
||||||
|
@ -120,15 +122,17 @@ void ProjectCompilerWidget::init()
|
||||||
|
|
||||||
void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
|
void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
|
if (index<0)
|
||||||
|
return;
|
||||||
std::shared_ptr<Project> project = pMainWindow->project();
|
std::shared_ptr<Project> project = pMainWindow->project();
|
||||||
|
clearSettingsChanged();
|
||||||
|
disconnectInputs();
|
||||||
|
ui->cbCompilerSet->blockSignals(true);
|
||||||
auto action = finally([this]{
|
auto action = finally([this]{
|
||||||
disconnectInputs();
|
ui->cbCompilerSet->blockSignals(false);
|
||||||
refreshOptions();
|
refreshOptions();
|
||||||
connectInputs();
|
connectInputs();
|
||||||
});
|
});
|
||||||
if (!mInitialized || index==project->options().compilerSet) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Settings::PCompilerSet pSet=pSettings->compilerSets().getSet(index);
|
Settings::PCompilerSet pSet=pSettings->compilerSets().getSet(index);
|
||||||
#ifdef ENABLE_SDCC
|
#ifdef ENABLE_SDCC
|
||||||
if (pSet) {
|
if (pSet) {
|
||||||
|
@ -165,7 +169,8 @@ void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
project->setCompilerSet(index);
|
project->setCompilerSet(index);
|
||||||
project->saveOptions();
|
setSettingsChanged();
|
||||||
|
//project->saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectCompilerWidget::on_cbEncoding_currentTextChanged(const QString &/*arg1*/)
|
void ProjectCompilerWidget::on_cbEncoding_currentTextChanged(const QString &/*arg1*/)
|
||||||
|
|
|
@ -37,7 +37,6 @@ private:
|
||||||
private:
|
private:
|
||||||
Ui::ProjectCompilerWidget *ui;
|
Ui::ProjectCompilerWidget *ui;
|
||||||
QMap<QString,QString> mOptions;
|
QMap<QString,QString> mOptions;
|
||||||
bool mInitialized;
|
|
||||||
|
|
||||||
// SettingsWidget interface
|
// SettingsWidget interface
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -57,6 +57,11 @@ void ProjectFilesWidget::doSave()
|
||||||
ui->treeProject->clicked(ui->treeProject->currentIndex());
|
ui->treeProject->clicked(ui->treeProject->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectFilesWidget::onLoaded()
|
||||||
|
{
|
||||||
|
disconnectAbstractItemView(ui->treeProject);
|
||||||
|
}
|
||||||
|
|
||||||
PProjectUnit ProjectFilesWidget::currentUnit()
|
PProjectUnit ProjectFilesWidget::currentUnit()
|
||||||
{
|
{
|
||||||
QModelIndex index = ui->treeProject->currentIndex();
|
QModelIndex index = ui->treeProject->currentIndex();
|
||||||
|
@ -142,8 +147,9 @@ void ProjectFilesWidget::on_treeProject_doubleClicked(const QModelIndex &index)
|
||||||
disableFileOptions();
|
disableFileOptions();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PProjectUnit unit = node->pUnit.lock();
|
PProjectUnit unit = currentUnit();
|
||||||
if (unit) {
|
if (unit) {
|
||||||
|
disconnectInputs();
|
||||||
ui->grpFileOptions->setEnabled(true);
|
ui->grpFileOptions->setEnabled(true);
|
||||||
ui->spinPriority->setValue(unit->priority());
|
ui->spinPriority->setValue(unit->priority());
|
||||||
ui->chkCompile->setChecked(unit->compile());
|
ui->chkCompile->setChecked(unit->compile());
|
||||||
|
@ -153,6 +159,8 @@ void ProjectFilesWidget::on_treeProject_doubleClicked(const QModelIndex &index)
|
||||||
ui->txtBuildCommand->setPlainText(unit->buildCmd());
|
ui->txtBuildCommand->setPlainText(unit->buildCmd());
|
||||||
ui->txtBuildCommand->setEnabled(ui->chkOverrideBuildCommand->isChecked());
|
ui->txtBuildCommand->setEnabled(ui->chkOverrideBuildCommand->isChecked());
|
||||||
loadUnitEncoding(unit);
|
loadUnitEncoding(unit);
|
||||||
|
connectInputs();
|
||||||
|
disconnectAbstractItemView(ui->treeProject);
|
||||||
} else {
|
} else {
|
||||||
disableFileOptions();
|
disableFileOptions();
|
||||||
}
|
}
|
||||||
|
@ -266,7 +274,7 @@ void ProjectFilesWidget::init()
|
||||||
SettingsWidget::init();
|
SettingsWidget::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFilesWidget::showEvent(QShowEvent */*event*/)
|
void ProjectFilesWidget::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
if (ui->cbEncoding->count()>0) {
|
if (ui->cbEncoding->count()>0) {
|
||||||
if (pMainWindow->project()->options().encoding==ENCODING_SYSTEM_DEFAULT) {
|
if (pMainWindow->project()->options().encoding==ENCODING_SYSTEM_DEFAULT) {
|
||||||
|
@ -275,6 +283,7 @@ void ProjectFilesWidget::showEvent(QShowEvent */*event*/)
|
||||||
ui->cbEncoding->setItemText(0,tr("Project(%1)").arg(QString(pMainWindow->project()->options().encoding)));
|
ui->cbEncoding->setItemText(0,tr("Project(%1)").arg(QString(pMainWindow->project()->options().encoding)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SettingsWidget::showEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ private:
|
||||||
protected:
|
protected:
|
||||||
void doLoad() override;
|
void doLoad() override;
|
||||||
void doSave() override;
|
void doSave() override;
|
||||||
|
void onLoaded() override;
|
||||||
private:
|
private:
|
||||||
PProjectUnit currentUnit();
|
PProjectUnit currentUnit();
|
||||||
void copyUnits();
|
void copyUnits();
|
||||||
|
|
|
@ -45,14 +45,17 @@ void SettingsWidget::init()
|
||||||
this, &SettingsWidget::onUpdateIcons);
|
this, &SettingsWidget::onUpdateIcons);
|
||||||
onUpdateIcons();
|
onUpdateIcons();
|
||||||
//load();
|
//load();
|
||||||
connectInputs();
|
clearSettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::load()
|
void SettingsWidget::load()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
disconnectInputs();
|
||||||
doLoad();
|
doLoad();
|
||||||
clearSettingsChanged();
|
clearSettingsChanged();
|
||||||
|
connectInputs();
|
||||||
|
onLoaded();
|
||||||
} catch (FileError & e) {
|
} catch (FileError & e) {
|
||||||
QMessageBox::warning(nullptr,
|
QMessageBox::warning(nullptr,
|
||||||
tr("Load Error"),
|
tr("Load Error"),
|
||||||
|
@ -210,3 +213,8 @@ void SettingsWidget::onUpdateIcons()
|
||||||
{
|
{
|
||||||
updateIcons(pIconsManager->actionIconSize());
|
updateIcons(pIconsManager->actionIconSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsWidget::onLoaded()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public slots:
|
||||||
protected:
|
protected:
|
||||||
virtual void doLoad() = 0;
|
virtual void doLoad() = 0;
|
||||||
virtual void doSave() = 0;
|
virtual void doSave() = 0;
|
||||||
|
virtual void onLoaded();
|
||||||
void connectAbstractItemView(QAbstractItemView* pView);
|
void connectAbstractItemView(QAbstractItemView* pView);
|
||||||
void disconnectAbstractItemView(QAbstractItemView* pView);
|
void disconnectAbstractItemView(QAbstractItemView* pView);
|
||||||
virtual void updateIcons(const QSize &size) ;
|
virtual void updateIcons(const QSize &size) ;
|
||||||
|
|
Loading…
Reference in New Issue