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